text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={})}(this,(function(e){"use strict";function t(e,t,n){return e.fields=t||[],e.fname=n,e}function n(e){return 1===e.length?i(e[0]):r(e)}const i=e=>function(t){return t[e]},r=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function o(e){throw Error(e)}function s(e){const t=[],n=e.length;let i,r,s,a=null,u=0,c="";function l(){t.push(c+e.substring(i,r)),c="",i=r+1}for(e+="",i=r=0;r<n;++r)if(s=e[r],"\\"===s)c+=e.substring(i,r),c+=e.substring(++r,++r),i=r;else if(s===a)l(),a=null,u=-1;else{if(a)continue;i===u&&'"'===s||i===u&&"'"===s?(i=r+1,a=s):"."!==s||u?"["===s?(r>i&&l(),u=i=r+1):"]"===s&&(u||o("Access path missing open bracket: "+e),u>0&&l(),u=0,i=r+1):r>i?l():i=r+1}return u&&o("Access path missing closing bracket: "+e),a&&o("Access path missing closing quote: "+e),r>i&&(r++,l()),t}!function(e,i,r){const o=s(e);e=1===o.length?o[0]:e,t((r&&r.get||n)(o),[e],i||e)}("id");const a=t(e=>e,[],"identity");t(()=>0,[],"zero"),t(()=>1,[],"one"),t(()=>!0,[],"true"),t(()=>!1,[],"false");function u(e,t,n){const i=[t].concat([].slice.call(n));console[e].apply(console,i)}var c=Array.isArray;function l(e){return e===Object(e)}const f=e=>"__proto__"!==e;function d(...e){return e.reduce((e,t)=>{for(const n in t)if("signals"===n)e.signals=p(e.signals,t.signals);else{const i="legend"===n?{layout:1}:"style"===n||null;g(e,n,t[n],i)}return e},{})}function g(e,t,n,i){if(!f(t))return;let r,o;if(l(n)&&!c(n))for(r in o=l(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?g(o,r,n[r]):f(r)&&(o[r]=n[r]);else e[t]=n}function p(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function m(e){return null!=e?c(e)?e:[e]:[]}const h=Object.prototype.hasOwnProperty;function b(e,t){return h.call(e,t)}function v(e){return"boolean"==typeof e}function y(e){return"number"==typeof e}function x(e){return"string"==typeof e}function O(e){return c(e)?"["+e.map(O)+"]":l(e)||x(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function w(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]]=!0;return t}
  /*! *****************************************************************************
      Copyright (c) Microsoft Corporation.
  
      Permission to use, copy, modify, and/or distribute this software for any
      purpose with or without fee is hereby granted.
  
      THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
      REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
      AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
      INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
      OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      PERFORMANCE OF THIS SOFTWARE.
      ***************************************************************************** */function j(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function A(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,(function(n,i){return Array.isArray(i)?n.push.apply(n,e.call(i,t-1)):n.push(i),n}),[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(e){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var D=function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e){var t=function(){function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(o,a,u,c,l){"object"==typeof a&&(u=a.depth,c=a.prototype,l=a.includeNonEnumerable,a=a.circular);var f=[],d=[],g="undefined"!=typeof Buffer;return void 0===a&&(a=!0),void 0===u&&(u=1/0),function o(u,p){if(null===u)return null;if(0===p)return u;var m,h;if("object"!=typeof u)return u;if(e(u,t))m=new t;else if(e(u,n))m=new n;else if(e(u,i))m=new i((function(e,t){u.then((function(t){e(o(t,p-1))}),(function(e){t(o(e,p-1))}))}));else if(r.__isArray(u))m=[];else if(r.__isRegExp(u))m=new RegExp(u.source,s(u)),u.lastIndex&&(m.lastIndex=u.lastIndex);else if(r.__isDate(u))m=new Date(u.getTime());else{if(g&&Buffer.isBuffer(u))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(u.length):new Buffer(u.length),u.copy(m),m;e(u,Error)?m=Object.create(u):void 0===c?(h=Object.getPrototypeOf(u),m=Object.create(h)):(m=Object.create(c),h=c)}if(a){var b=f.indexOf(u);if(-1!=b)return d[b];f.push(u),d.push(m)}for(var v in e(u,t)&&u.forEach((function(e,t){var n=o(t,p-1),i=o(e,p-1);m.set(n,i)})),e(u,n)&&u.forEach((function(e){var t=o(e,p-1);m.add(t)})),u){var y;h&&(y=Object.getOwnPropertyDescriptor(h,v)),y&&null==y.set||(m[v]=o(u[v],p-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);for(v=0;v<x.length;v++){var O=x[v];(!(j=Object.getOwnPropertyDescriptor(u,O))||j.enumerable||l)&&(m[O]=o(u[O],p-1),j.enumerable||Object.defineProperty(m,O,{enumerable:!1}))}}if(l){var w=Object.getOwnPropertyNames(u);for(v=0;v<w.length;v++){var j,A=w[v];(j=Object.getOwnPropertyDescriptor(u,A))&&j.enumerable||(m[A]=o(u[A],p-1),Object.defineProperty(m,A,{enumerable:!1}))}}return m}(o,u)}function o(e){return Object.prototype.toString.call(e)}function s(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},r.__objToStr=o,r.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},r.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},r.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},r.__getRegExpFlags=s,r}();e.exports&&(e.exports=t)})),F=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,s;if(Array.isArray(t)){for(s="[",n=0;n<t.length;n++)n&&(s+=","),s+=e(t[n])||"null";return s+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=o.push(t)-1,u=Object.keys(t).sort(r&&r(t));for(s="",n=0;n<u.length;n++){var c=u[n],l=e(t[c]);l&&(s&&(s+=","),s+=JSON.stringify(c)+":"+l)}return o.splice(a,1),"{"+s+"}"}}(e)};function k(e){return!!e.or}function C(e){return!!e.and}function E(e){return!!e.not}function S(e,t){return E(e)?{not:S(e.not,t)}:C(e)?{and:e.and.map(e=>S(e,t))}:k(e)?{or:e.or.map(e=>S(e,t))}:t(e)}const $=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var s=o[r];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},B=D;function _(e,t){const n={};for(const i of t)b(e,i)&&(n[i]=e[i]);return n}function z(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>F(e)).join(",")})`};const N=F;function P(e){if(y(e))return e;const t=x(e)?e:F(e);if(t.length<250)return t;let n=0;for(let e=0;e<t.length;e++){n=(n<<5)-n+t.charCodeAt(e),n&=n}return n}function M(e){return!1===e||null===e}function T(e,t){return e.indexOf(t)>-1}function L(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function q(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function R(e,t){for(const n of V(t))g(e,n,t[n],!0)}function W(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function U(e,t){for(const n of e)if(t.has(n))return!0;return!1}function H(e){const t=new Set;for(const n of e){const e=s(n).map((e,t)=>0===t?e:`[${e}]`),i=e.map((t,n)=>e.slice(0,n+1).join(""));for(const e of i)t.add(e)}return t}function I(e,t){return void 0===e||void 0===t||U(H(e),H(t))}function G(e){return 0===V(e).length}const V=Object.keys,J=Object.values,Y=Object.entries;function X(e){return!0===e||!1===e}function Q(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function K(e,t){return E(e)?"!("+K(e.not,t)+")":C(e)?"("+e.and.map(e=>K(e,t)).join(") && (")+")":k(e)?"("+e.or.map(e=>K(e,t)).join(") || (")+")":t(e)}function Z(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&Z(e[n],t)&&delete e[n],G(e)}function ee(e){return e.charAt(0).toUpperCase()+e.substr(1)}function te(e,t="datum"){const n=s(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(O).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function ne(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function ie(e){return""+s(e).map(ne).join("\\.")}function re(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function oe(e){return""+s(e).join(".")}function se(e){return e?s(e).length:0}function ae(...e){for(const t of e)if(void 0!==t)return t}let ue=42;function ce(e){if(void 0!==e)return(e%360+360)%360}function le(e){return!!y(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const fe={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function de(e){return e&&e.condition}const ge=["domain","grid","labels","ticks","title"],pe={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"main",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},me={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},he=Object.assign(Object.assign({},me),{style:1,labelExpr:1,encoding:1});function be(e){return!!he[e]}const ve={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},ye=ve.arc,xe=ve.area,Oe=ve.bar,we=ve.image,je=ve.line,Ae=ve.point,De=ve.rect,Fe=ve.rule,ke=ve.text,Ce=ve.tick,Ee=ve.trail,Se=ve.circle,$e=ve.square,Be=ve.geoshape;function _e(e){return T(["line","area","trail"],e)}function ze(e){return T(["rect","bar","image","arc"],e)}const Ne=V(ve);function Pe(e){return e.type}w(Ne);const Me=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Te=V({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBand:1,timeUnitBandPosition:1}),Le={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},qe={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Re={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function We(e){return"mark"in e}class Ue{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!We(e)&&(Pe(t=e.mark)?t.type:t)===this.name;var t}}const He={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Ie={count:1,min:1,max:1};function Ge(e){return!!e&&!!e.argmin}function Ve(e){return!!e&&!!e.argmax}function Je(e){return x(e)&&!!He[e]}const Ye=["count","valid","missing","distinct"];function Xe(e){return x(e)&&T(Ye,e)}const Qe=["count","sum","distinct","valid","missing"],Ke=w(["mean","average","median","q1","q3","min","max"]),Ze="row",et="column",tt="facet",nt="x",it="y",rt="x2",ot="y2",st="radius",at="radius2",ut="theta",ct="theta2",lt="latitude",ft="longitude",dt="latitude2",gt="longitude2",pt="color",mt="fill",ht="stroke",bt="shape",vt="size",yt="angle",xt="opacity",Ot="fillOpacity",wt="strokeOpacity",jt="strokeWidth",At="strokeDash",Dt="text",Ft="order",kt="detail",Ct="key",Et="tooltip",St="href",$t="url",Bt="description",_t={theta:1,theta2:1,radius:1,radius2:1};function zt(e){return e in _t}const Nt={longitude:1,longitude2:1,latitude:1,latitude2:1};const Pt=V(Nt),Mt=Object.assign(Object.assign(Object.assign(Object.assign({},{x:1,y:1,x2:1,y2:1}),_t),Nt),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1});function Tt(e){return e===pt||e===mt||e===ht}const Lt={row:1,column:1,facet:1},qt=V(Lt),Rt=Object.assign(Object.assign({},Mt),Lt),Wt=V(Rt),Ut=j(Rt,["order","detail","tooltip"]),Ht=j(Ut,["row","column","facet"]);function It(e){return!!Rt[e]}const Gt=[rt,ot,dt,gt,ct,at];function Vt(e){return Jt(e)!==e}function Jt(e){switch(e){case rt:return nt;case ot:return it;case dt:return lt;case gt:return ft;case ct:return ut;case at:return st}return e}function Yt(e){if(zt(e))switch(e){case ut:return"startAngle";case ct:return"endAngle";case st:return"outerRadius";case at:return"innerRadius"}return e}function Xt(e){switch(e){case nt:return rt;case it:return ot;case lt:return dt;case ft:return gt;case ut:return ct;case st:return at}}function Qt(e){switch(e){case nt:case rt:return"width";case it:case ot:return"height"}}const Kt=j(Mt,["x","y","x2","y2","latitude","longitude","latitude2","longitude2","theta","theta2","radius","radius2"]),Zt=V(Kt),en={x:1,y:1},tn=V(en);function nn(e){return e in en}const rn={theta:1,radius:1},on=V(rn);function sn(e){return"width"===e?nt:it}const an=j(Kt,["text","tooltip","href","url","description","detail","key","order"]),un=V(an);const cn=Object.assign(Object.assign(Object.assign({},en),rn),an),ln=V(cn);function fn(e){return!!cn[e]}function dn(e,t){return function(e){switch(e){case pt:case mt:case ht:case Bt:case kt:case Ct:case Et:case St:case Ft:case xt:case Ot:case wt:case jt:case tt:case Ze:case et:return gn;case nt:case it:case lt:case ft:return pn;case rt:case ot:case dt:case gt:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case vt:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case At:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case bt:return{point:"always",geoshape:"always"};case Dt:return{text:"always"};case yt:return{point:"always",square:"always",text:"always"};case $t:return{image:"always"};case ut:case st:return{text:"always",arc:"always"};case ct:case at:return{arc:"always"}}}(e)[t]}const gn={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},pn=j(gn,["geoshape"]);function mn(e){switch(e){case nt:case it:case ut:case st:case vt:case yt:case jt:case xt:case Ot:case wt:case rt:case ot:case ct:case at:return;case tt:case Ze:case et:case bt:case At:case Dt:case Et:case St:case $t:case Bt:return"discrete";case pt:case mt:case ht:return"flexible";case lt:case ft:case dt:case gt:case kt:case Ct:case Ft:return}}function hn(e){return v(e)&&(e=Do(e,void 0)),"bin"+V(e).map(t=>xn(e[t])?Q(`_${t}_${Y(e[t])}`):Q(`_${t}_${e[t]}`)).join("")}function bn(e){return!0===e||yn(e)&&!e.binned}function vn(e){return"binned"===e||yn(e)&&!0===e.binned}function yn(e){return l(e)}function xn(e){return null==e?void 0:e.selection}function On(e){switch(e){case Ze:case et:case vt:case pt:case mt:case ht:case jt:case xt:case Ot:case wt:case bt:return 6;case At:return 4;default:return 10}}function wn(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const jn='Autosize "fit" only works for single views and layered views.';function An(e){return("width"==e?"Width":"Height")+' "container" only works for single views and layered views.'}function Dn(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function Fn(e){return e?`Dropping "fit-${e}" because spec has discrete ${Qt(e)}.`:'Dropping "fit" because spec has discrete size.'}function kn(e){return`Unknown field for ${e}. Cannot calculate view size.`}function Cn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function En(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Sn(e){return`Selection not supported for ${e} yet.`}const $n="The same selection must be used to override scale domains in a layered view.";function Bn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function _n(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function zn(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Nn(e){return`Invalid field type "${e}".`}function Pn(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function Mn(e,t){return`Dropping ${N(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function Tn(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?" when "+n:""}.`}function Ln(e){return e+" encoding should be discrete (ordinal / nominal / binned)."}function qn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function Rn(e){return`Using unaggregated domain with raw field has no effect (${N(e)}).`}function Wn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Un(e){return`Unaggregated domain is currently unsupported for log scale (${N(e)}).`}function Hn(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function In(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const Gn="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Vn(e,t){return`Invalid ${e}: ${N(t)}.`}function Jn(e){return`1D error band does not support ${e}.`}function Yn(e){return`Channel ${e} is required for "binned" bin.`}const Xn=function(e,t){let n=e||0;return{level(e){return arguments.length?(n=+e,this):n},error(){return n>=1&&u(t||"error","ERROR",arguments),this},warn(){return n>=2&&u(t||"warn","WARN",arguments),this},info(){return n>=3&&u(t||"log","INFO",arguments),this},debug(){return n>=4&&u(t||"log","DEBUG",arguments),this}}}(2);let Qn=Xn;function Kn(...e){Qn.warn(...e)}function Zn(e){if(e&&l(e))for(const t of ai)if(t in e)return!0;return!1}const ei=["january","february","march","april","may","june","july","august","september","october","november","december"],ti=ei.map(e=>e.substr(0,3)),ni=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],ii=ni.map(e=>e.substr(0,3));function ri(e,t){const n=[];if(t&&void 0!==e.day&&V(e).length>1&&(Kn(function(e){return`Dropping day from datetime ${N(e)} as day cannot be combined with other units.`}(e)),delete(e=B(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(le(e)&&(e=+e),y(e))return e-1;{const t=e.toLowerCase(),n=ei.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=ti.indexOf(i);if(-1!==r)return r;throw new Error(Vn("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(le(e)&&(e=+e),y(e))return e>4&&Kn(Vn("quarter",e)),e-1;throw new Error(Vn("quarter",e))}(e.quarter):e.quarter;n.push(y(i)?3*i:i+"*3")}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(le(e)&&(e=+e),y(e))return e%7;{const t=e.toLowerCase(),n=ni.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=ii.indexOf(i);if(-1!==r)return r;throw new Error(Vn("day",e))}}(e.day):e.day;n.push(y(i)?i+1:i+"+1")}else n.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const i=e[t];n.push(void 0===i?0:i)}return n}function oi(e){const t=ri(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const si={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},ai=V(si);function ui(e){return e.startsWith("utc")}const ci={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function li(e){const t=[];for(const n of ai)fi(e,n)&&t.push(n);return t}function fi(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function di(e,t,{end:n}={end:!1}){const i=te(t),r=ui(e)?"utc":"";let o;const s={};for(const t of ai)fi(e,t)&&(s[t]="quarter"===(a=t)?`(${r}quarter(${i})-1)`:`${r}${a}(${i})`,o=t);var a;return n&&(s[o]+="+1"),function(e){const t=ri(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(s)}function gi(e){if(!e)return;const t=li(e);return`timeUnitSpecifier(${F(t)}, ${F(ci)})`}function pi(e){if(!e)return;let t;return x(e)?t={unit:e}:l(e)&&(t=Object.assign(Object.assign({},e),e.unit?{unit:e.unit}:{})),ui(t.unit)&&(t.utc=!0,t.unit=t.unit.substr(3)),t}function mi(e){return e&&!!e.signal}function hi(e){return!!e.step}function bi(e){return!c(e)&&("field"in e&&"data"in e)}const vi=V({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1}),yi={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},xi=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function Oi(e){return e&&!!e.field&&void 0!==e.equal}function wi(e){return e&&!!e.field&&void 0!==e.lt}function ji(e){return e&&!!e.field&&void 0!==e.lte}function Ai(e){return e&&!!e.field&&void 0!==e.gt}function Di(e){return e&&!!e.field&&void 0!==e.gte}function Fi(e){if(e&&e.field){if(c(e.range)&&2===e.range.length)return!0;if(mi(e.range))return!0}return!1}function ki(e){return e&&!!e.field&&(c(e.oneOf)||c(e.in))}function Ci(e){return ki(e)||Oi(e)||Fi(e)||wi(e)||Ai(e)||ji(e)||Di(e)}function Ei(e,t){return Co(e,{timeUnit:t,wrapTime:!0})}function Si(e,t=!0){var n;const{field:i}=e,r=null===(n=pi(e.timeUnit))||void 0===n?void 0:n.unit,o=r?"time("+di(r,i)+")":co(e,{expr:"datum"});if(Oi(e))return o+"==="+Ei(e.equal,r);if(wi(e)){return`${o}<${Ei(e.lt,r)}`}if(Ai(e)){return`${o}>${Ei(e.gt,r)}`}if(ji(e)){return`${o}<=${Ei(e.lte,r)}`}if(Di(e)){return`${o}>=${Ei(e.gte,r)}`}if(ki(e))return`indexof([${function(e,t){return e.map(e=>Ei(e,t))}(e.oneOf,r).join(",")}], ${o}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return $i(o,e.valid);if(Fi(e)){const{range:n}=e,i=mi(n)?{signal:n.signal+"[0]"}:n[0],s=mi(n)?{signal:n.signal+"[1]"}:n[1];if(null!==i&&null!==s&&t)return"inrange("+o+", ["+Ei(i,r)+", "+Ei(s,r)+"])";const a=[];return null!==i&&a.push(`${o} >= ${Ei(i,r)}`),null!==s&&a.push(`${o} <= ${Ei(s,r)}`),a.length>0?a.join(" && "):"true"}throw new Error("Invalid field predicate: "+JSON.stringify(e))}function $i(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function Bi(e){var t;return Ci(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:null===(t=pi(e.timeUnit))||void 0===t?void 0:t.unit}):e}const _i="quantitative",zi="ordinal",Ni="temporal",Pi="nominal",Mi="geojson";const Ti="linear",Li="log",qi="pow",Ri="sqrt",Wi="symlog",Ui="time",Hi="utc",Ii="quantile",Gi="quantize",Vi="threshold",Ji="point",Yi="band",Xi={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function Qi(e,t){const n=Xi[e],i=Xi[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Ki={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Zi(e){return Ki[e]}const er=["linear","log","pow","sqrt","symlog","time","utc"],tr=w(er),nr=w(["linear","log","pow","sqrt","symlog"]);const ir=w(["quantile","quantize","threshold"]),rr=w(er.concat(["quantile","quantize","threshold","sequential","identity"])),or=w(["ordinal","bin-ordinal","point","band"]);function sr(e){return e in or}function ar(e){return e in rr}function ur(e){return e in tr}function cr(e){return e in ir}function lr(e){return null==e?void 0:e.selection}const fr=j({type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},["type","domain","range","rangeMax","rangeMin","scheme"]),dr=V(fr);function gr(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!T(["point","band","identity"],e);case"bins":return!T(["point","band","identity","ordinal"],e);case"round":return ur(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return ur(e)||T(["point","band"],e);case"paddingOuter":case"align":return T(["point","band"],e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"clamp":return ur(e);case"nice":return ur(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return ar(e)&&!T(["log","time","utc","threshold","quantile"],e)}}function pr(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Tt(e)?void 0:`Cannot use the scale property "${e}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function mr(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,s=Or(e);return Xr(n)&&!Xe(n.aggregate)&&r&&ur(r.get("type"))&&!1===r.get("zero")?hr({fieldDef:n,channel:t,markDef:i,ref:s,config:o}):s}function hr({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(_e(n.type))return i;return null===Mo("invalid",n,r)?i:[br(e,t),i]}function br(e,t){const n=vr(e,!0),i="y"===Jt(t)?{field:{group:"height"}}:{value:0};return Object.assign({test:n},i)}function vr(e,t=!0){return $i(x(e)?e:co(e,{expr:"datum"}),!t)}function yr(e,t,n,i){const r={};if(t&&(r.scale=t),Kr(e)){const{datum:t}=e;Zn(t)?r.signal=oi(t):mi(t)?r.signal=t.signal:r.value=t}else r.field=co(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function xr({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,band:o=.5}){const s=0<o&&o<1?"datum":void 0,a=co(t,{expr:s,suffix:r}),u=void 0!==n?co(n,{expr:s}):co(t,{suffix:"end",expr:s}),c={};if(0===o||1===o){c.scale=e;const t=0===o?a:u;c.field=t}else{const t=`${o} * ${a} + ${1-o} * ${u}`;c.signal=`scale("${e}", ${t})`}return i&&(c.offset=i),c}function Or({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:c,band:l}){var f;if(t){if(to(t)){if(no(t)){l=null!=l?l:Ir({channel:e,fieldDef:t,fieldDef2:n,markDef:i,stack:a,config:r,isMidPoint:!0});const{bin:s,timeUnit:c,type:f}=t;if(bn(s)||l&&c&&f===Ni)return a&&a.impute?yr(t,o,{binSuffix:"mid"},{offset:u}):l?xr({scaleName:o,fieldOrDatumDef:t,band:l,offset:u}):yr(t,o,So(t,e)?{binSuffix:"range"}:{},{offset:u});if(vn(s)){if(Xr(n))return xr({scaleName:o,fieldOrDatumDef:t,fieldOrDatumDef2:n,band:l,offset:u});Kn(Yn(e===nt?rt:ot))}}const c=null==s?void 0:s.get("type");return yr(t,o,sr(c)?{binSuffix:"range"}:{},{offset:u,band:"band"===c?null!==(f=null!=l?l:t.band)&&void 0!==f?f:.5:void 0})}if(io(t)){const n=t.value,i=u?{offset:u}:{};return Object.assign(Object.assign({},wr(e,n)),i)}}return"function"==typeof c&&(c=c()),c?Object.assign(Object.assign({},c),u?{offset:u}:{}):c}function wr(e,t){return T(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:T(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:_o(t)}function jr(e){return e&&"number"!==e&&"time"!==e}function Ar(e,t,n){return`${e}(${t}${n?", "+JSON.stringify(n):""})`}function Dr({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){var s,a;if(jr(n))return kr({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const u=Fr(e,i,r);if(ko(e)){const n=function(e,t,n,i,r){return!t||n?`${r?"utc":"time"}Format(${e}, '${n=x(n)?n:i}')`:function(e,t,n){if(!e)return;const i=gi(e);return`${n||ui(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,r)}(u,Xr(e)?null===(s=pi(e.timeUnit))||void 0===s?void 0:s.unit:void 0,t,o.timeFormat,ro(e)&&(null===(a=e.scale)||void 0===a?void 0:a.type)===Hi);return n?{signal:n}:void 0}if(t=Sr(Qr(e),t,o),Xr(e)&&bn(e.bin)){return{signal:_r(u,co(e,{expr:i,binSuffix:"end"}),t,n,o)}}return t||"quantitative"===Qr(e)?{signal:""+$r(u,t)}:{signal:`isValid(${u}) ? ${u} : ""+${u}`}}function Fr(e,t,n){return Xr(e)?n?`${co(e,{expr:t,suffix:"end"})}-${co(e,{expr:t,suffix:"start"})}`:co(e,{expr:t}):function(e){const{datum:t}=e;return Zn(t)?oi(t):""+JSON.stringify(t)}(e)}function kr({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:s}){if(s=null!=s?s:Fr(e,i,r),Xr(e)&&bn(e.bin)){return{signal:_r(s,co(e,{expr:i,binSuffix:"end"}),t,n,o)}}return{signal:Ar(n,s,t)}}function Cr(e,t,n,i,r,o){var s;if(!jr(i)){if(ko(e)){return function(e,t,n,i){if(e)return e;if(t)return{signal:gi(t)};return i?void 0:n.timeFormat}(n,Xr(e)?null===(s=pi(e.timeUnit))||void 0===s?void 0:s.unit:void 0,r,o)}return Sr(t,n,r)}}function Er(e,t,n){return e&&(mi(e)||"number"===e||"time"===e)?e:ko(t)&&"time"!==n&&"utc"!==n?"time":void 0}function Sr(e,t,n){return x(t)?t:e===_i?n.numberFormat:void 0}function $r(e,t){return`format(${e}, "${t||""}")`}function Br(e,t,n,i){var r;return jr(n)?Ar(n,e,t):$r(e,null!==(r=x(t)?t:void 0)&&void 0!==r?r:i.numberFormat)}function _r(e,t,n,i,r){const o=Br(e,n,i,r),s=Br(t,n,i,r);return`${$i(e,!1)} ? "null" : ${o} + " – " + ${s}`}const zr="min",Nr={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function Pr(e){return e in Nr}function Mr(e){return!!e&&!!e.encoding}function Tr(e){return!(!e||"count"!==e.op&&!e.field)}function Lr(e){return!!e&&c(e)}function qr(e){return"row"in e||"column"in e}function Rr(e){return!!e&&"header"in e}function Wr(e){return"facet"in e}function Ur(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),i?{bin:i}:{}),r?{aggregate:r}:{}),{field:t})}function Hr(e){return"sort"in e}function Ir({channel:e,fieldDef:t,fieldDef2:n,markDef:i,stack:r,config:o,isMidPoint:s}){if(to(t)&&void 0!==t.band)return t.band;if(Xr(t)){const{timeUnit:e,bin:r}=t;if(e&&!n)return s?To("timeUnitBandPosition",i,o):ze(i.type)?To("timeUnitBand",i,o):0;if(bn(r))return ze(i.type)&&!s?1:.5}return(null==r?void 0:r.fieldChannel)===e&&s?.5:void 0}function Gr(e,t,n,i,r,o){return!!(bn(t.bin)||t.timeUnit&&no(t)&&"temporal"===t.type)&&!!Ir({channel:e,fieldDef:t,fieldDef2:n,stack:i,markDef:r,config:o})}function Vr(e){return!!e&&"condition"in e}function Jr(e){const t=e&&e.condition;return!!t&&!c(t)&&Xr(t)}function Yr(e){const t=e&&e.condition;return!!t&&!c(t)&&to(t)}function Xr(e){return!(!e||!e.field&&"count"!==e.aggregate)}function Qr(e){return e&&e.type}function Kr(e){return!!e&&"datum"in e}function Zr(e){return no(e)&&fo(e)||eo(e)}function eo(e){return Kr(e)&&y(e.datum)}function to(e){return Xr(e)||Kr(e)}function no(e){return!!e&&("field"in e||"count"===e.aggregate)&&"type"in e}function io(e){return e&&"value"in e&&"value"in e}function ro(e){return!!e&&("scale"in e||"sort"in e)}function oo(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function so(e){return!!e&&"legend"in e}function ao(e){return!!e&&("format"in e||"formatType"in e)}function uo(e){return z(e,["legend","axis","header","scale"])}function co(e,t={}){var n,i,r;let o=e.field;const a=t.prefix;let u=t.suffix,c="";if(function(e){return"count"===e.aggregate}(e))o=function(e){return 0===e.indexOf("__")}(l="count")?l:"__"+l;else{let s;if(!t.nofn)if(function(e){return"op"in e}(e))s=e.op;else{const{bin:a,aggregate:l,timeUnit:f}=e;bn(a)?(s=hn(a),u=(null!==(n=t.binSuffix)&&void 0!==n?n:"")+(null!==(i=t.suffix)&&void 0!==i?i:"")):l?Ve(l)?(c=`["${o}"]`,o="argmax_"+l.argmax):Ge(l)?(c=`["${o}"]`,o="argmin_"+l.argmin):s=String(l):f&&(s=function(e){const t=pi(e),{utc:n}=t,i=j(t,["utc"]);return i.unit?(n?"utc":"")+V(i).map(e=>Q(`${"unit"===e?"":`_${e}_`}${i[e]}`)).join(""):(n?"utc":"")+"timeunit"+V(i).map(e=>Q(`_${e}_${i[e]}`)).join("")}(f),u=(!T(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!==(r=t.suffix)&&void 0!==r?r:""))}s&&(o=o?`${s}_${o}`:s)}var l;return u&&(o=`${o}_${u}`),a&&(o=`${a}_${o}`),t.forAs?oe(o):t.expr?function(e,t="datum"){return`${t}[${O(s(e).join("."))}]`}(o,t.expr)+c:ie(o)+c}function lo(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return Xr(e)&&!!e.bin;case"temporal":return!1}throw new Error(Nn(e.type))}function fo(e){return!lo(e)}const go=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(Ve(t))return`${r} for argmax(${t.argmax})`;if(Ge(t))return`${r} for argmin(${t.argmin})`;const o=pi(i),s=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||bn(n)&&"bin";return s?s.toUpperCase()+"("+r+")":r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:o,aggregate:s}=e;if("count"===s)return t.countTitle;if(bn(r))return i+" (binned)";if(o){const e=null===(n=pi(o))||void 0===n?void 0:n.unit;if(e)return`${i} (${li(e).join("-")})`}else if(s)return Ve(s)?`${i} for max ${s.argmax}`:Ge(s)?`${i} for min ${s.argmin}`:`${ee(s)} of ${i}`;return i}(e,t)}};let po=go;function mo(e){po=e}function ho(e,t,{allowDisabling:n,includeDefault:i=!0}){var r,o;const s=null===(r=bo(e))||void 0===r?void 0:r.title;if(!Xr(e))return s;const a=e,u=i?vo(a,t):void 0;return n?ae(s,a.title,u):null!==(o=null!=s?s:a.title)&&void 0!==o?o:u}function bo(e){return oo(e)&&e.axis?e.axis:so(e)&&e.legend?e.legend:Rr(e)&&e.header?e.header:void 0}function vo(e,t){return po(e,t)}function yo(e){var t;if(ao(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const n=null!==(t=bo(e))&&void 0!==t?t:{},{format:i,formatType:r}=n;return{format:i,formatType:r}}}function xo(e){return Xr(e)?e:Jr(e)?e.condition:void 0}function Oo(e){return to(e)?e:Yr(e)?e.condition:void 0}function wo(e,t,n,i={}){if(x(e)||y(e)||v(e)){return Kn(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${N(n)}}.`}(t,x(e)?"string":y(e)?"number":"boolean",e)),{value:e}}return to(e)?jo(e,t,n,i):Yr(e)?Object.assign(Object.assign({},e),{condition:jo(e.condition,t,n,i)}):e}function jo(e,t,n,i){if(ao(e)){const{format:r,formatType:o}=e,s=j(e,["format","formatType"]);if(jr(o)&&!n.customFormatTypes)return Kn(zn(t)),jo(s,t,n,i)}else{const r=oo(e)?"axis":so(e)?"legend":Rr(e)?"header":null;if(r&&e[r]){const o=e[r],{format:s,formatType:a}=o,u=j(o,["format","formatType"]);if(jr(a)&&!n.customFormatTypes)return Kn(zn(t)),jo(Object.assign(Object.assign({},e),{[r]:u}),t,n,i)}}return Xr(e)?Ao(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=y(n)?"quantitative":x(n)?"nominal":Zn(n)?"temporal":void 0,Object.assign(Object.assign({},e),{type:t})}(e)}function Ao(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:s}=e,a=Object.assign({},e);if(n||!i||Je(i)||Ve(i)||Ge(i)||(Kn(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete a.aggregate),r&&(a.timeUnit=pi(r)),s&&(a.field=""+s),bn(o)&&(a.bin=Do(o,t)),vn(o)&&!nn(t)&&Kn(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),no(a)){const{type:e}=a,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case _i:return"quantitative";case"t":case Ni:return"temporal";case"o":case zi:return"ordinal";case"n":case Pi:return"nominal";case Mi:return"geojson"}}(e);e!==t&&(a.type=t),"quantitative"!==e&&Xe(i)&&(Kn(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),a.type="quantitative")}else if(!Vt(t)){const e=function(e,t){var n;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Hr(e)&&c(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!Ve(i)&&!Ge(i))return"quantitative";if(ro(e)&&(null===(n=e.scale)||void 0===n?void 0:n.type))switch(Xi[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(a,t);a.type=e}if(no(a)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Ze:case et:case tt:return fo(e)?{compatible:!1,warning:Ln(t)}:Fo;case nt:case it:case pt:case mt:case ht:case Dt:case kt:case Ct:case Et:case St:case $t:case yt:case ut:case st:case Bt:return Fo;case ft:case gt:case lt:case dt:return n!==_i?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Fo;case xt:case Ot:case wt:case jt:case vt:case ct:case at:case rt:case ot:return"nominal"!==n||e.sort?Fo:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case At:return T(["ordinal","nominal"],e.type)?Fo:{compatible:!1,warning:"StrokeDash channel should be used with only discrete data."};case bt:return T(["ordinal","nominal","geojson"],e.type)?Fo:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case Ft:return"nominal"!==e.type||"sort"in e?Fo:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(a,t)||{};!1===e&&Kn(n)}if(Hr(a)&&x(a.sort)){const{sort:e}=a;if(Pr(e))return Object.assign(Object.assign({},a),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&Pr(t))return Object.assign(Object.assign({},a),{sort:{encoding:t,order:"descending"}})}if(Rr(a)){const{header:e}=a,{orient:t}=e,n=j(e,["orient"]);if(t)return Object.assign(Object.assign({},a),{header:Object.assign(Object.assign({},n),{labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t})})}return a}function Do(e,t){return v(e)?{maxbins:On(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:On(t)})}const Fo={compatible:!0};function ko(e){const{formatType:t}=yo(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||Xr(n)&&!!n.timeUnit));var n}function Co(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var o;const s=t&&(null===(o=pi(t))||void 0===o?void 0:o.unit);let a,u=s||"temporal"===n;return mi(e)?a=e.signal:Zn(e)?(u=!0,a=oi(e)):(x(e)||y(e))&&u&&(a=`datetime(${JSON.stringify(e)})`,function(e){return!!si[e]}(s)&&(y(e)&&e<1e4||x(e)&&isNaN(Date.parse(e)))&&(a=oi({[s]:e}))),a?i&&u?`time(${a})`:a:r?void 0:JSON.stringify(e)}function Eo(e,t){const{type:n}=e;return t.map(t=>{const i=Co(t,{timeUnit:Xr(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t})}function So(e,t){return bn(e.bin)?fn(t)&&T(["ordinal","nominal"],e.type):(console.warn("Only call this method for binned field defs."),!1)}function $o(e){const{anchor:t,frame:n,offset:i,orient:r,color:o,subtitleColor:s,subtitleFont:a,subtitleFontSize:u,subtitleFontStyle:c,subtitleFontWeight:l,subtitleLineHeight:f,subtitlePadding:d}=e,g=j(e,["anchor","frame","offset","orient","color","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding"]),p=Object.assign(Object.assign({},g),o?{fill:o}:{}),m=Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),i?{offset:i}:{}),r?{orient:r}:{}),h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},s?{subtitleColor:s}:{}),a?{subtitleFont:a}:{}),u?{subtitleFontSize:u}:{}),c?{subtitleFontStyle:c}:{}),l?{subtitleFontWeight:l}:{}),f?{subtitleLineHeight:f}:{}),d?{subtitlePadding:d}:{});return{titleMarkConfig:p,subtitleMarkConfig:_(p,["align","baseline","dx","dy","limit"]),nonMark:m,subtitle:h}}function Bo(e){return x(e)||c(e)&&x(e[0])}function _o(e){return mi(e)?e:void 0!==e?{value:e}:void 0}function zo(e){return mi(e)?e.signal:O(e.value)}function No(e){return mi(e)?e.signal:null==e?null:O(e)}function Po(e){var t;return[].concat(e.type,null!==(t=e.style)&&void 0!==t?t:[])}function Mo(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?To(e,t,n,i):void 0}function To(e,t,n,{vgChannel:i}={}){return ae(i?Lo(e,t,n.style):void 0,Lo(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Lo(e,t,n){return qo(e,Po(t),n)}function qo(e,t,n){let i;t=m(t);for(const r of t){const t=n[r];t&&void 0!==t[e]&&(i=t[e])}return i}function Ro(e,t){return m(e).reduce((e,n)=>{var i;return e.field.push(co(n,t)),e.order.push(null!==(i=n.sort)&&void 0!==i?i:"ascending"),e},{field:[],order:[]})}function Wo(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if($(t,e))return;n.push(e)}),n}function Uo(e,t){return $(e,t)||!t?e:e?[...m(e),...m(t)].join(", "):t}function Ho(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((Bo(n)||mi(n))&&(Bo(i)||mi(i)))return{explicit:e.explicit,value:Uo(n,i)};if(Bo(n)||mi(n))return{explicit:e.explicit,value:n};if(Bo(i)||mi(i))return{explicit:e.explicit,value:i};if(!(Bo(n)||mi(n)||Bo(i)||mi(i)))return{explicit:e.explicit,value:Wo(n,i)};throw new Error("It should never reach here")}function Io(e,t){const n=e&&e[t];return!!n&&(c(n)?L(n,e=>!!e.field):Xr(n)||Jr(n))}function Go(e){return L(Wt,t=>{if(Io(e,t)){const n=e[t];if(c(n))return L(n,e=>!!e.aggregate);{const e=xo(n);return e&&!!e.aggregate}}return!1})}function Vo(e,t){const n=[],i=[],r=[],o=[],s={};return Xo(e,(a,u)=>{if(Xr(a)){const{field:c,aggregate:l,bin:f,timeUnit:d}=a,g=j(a,["field","aggregate","bin","timeUnit"]);if(l||d||f){const e=bo(a),p=e&&e.title;let m=co(a,{forAs:!0});const h=Object.assign(Object.assign(Object.assign({},p?[]:{title:ho(a,t,{allowDisabling:!0})}),g),{field:m});if(l){let e;if(Ve(l)?(e="argmax",m=co({op:"argmax",field:l.argmax},{forAs:!0}),h.field=`${m}.${c}`):Ge(l)?(e="argmin",m=co({op:"argmin",field:l.argmin},{forAs:!0}),h.field=`${m}.${c}`):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(e=l),e){const t={op:e,as:m};c&&(t.field=c),o.push(t)}}else if(n.push(m),no(a)&&bn(f)){if(i.push({bin:f,field:c,as:m}),n.push(co(a,{binSuffix:"end"})),So(a,u)&&n.push(co(a,{binSuffix:"range"})),nn(u)){const e={field:m+"_end"};s[u+"2"]=e}h.bin="binned",Vt(u)||(h.type=_i)}else if(d){r.push({timeUnit:d,field:c,as:m});const e=no(a)&&a.type!==Ni&&"time";e&&(u===Dt||u===Et?h.formatType=e:!function(e){return!!Kt[e]}(u)?nn(u)&&(h.axis=Object.assign({formatType:e},h.axis)):h.legend=Object.assign({formatType:e},h.legend))}s[u]=h}else n.push(c),s[u]=e[u]}else s[u]=e[u]}),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:s}}function Jo(e,t,n,i){return V(e).reduce((r,o)=>{if(!It(o))return Kn(function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}(o)),r;const s=e[o];if("angle"!==o||"arc"!==t||e.theta||(Kn("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=ut),!function(e,t,n){const i=dn(t,n);if(!i)return!1;if("binned"===i){const n=e[t===rt?nt:it];return!!(Xr(n)&&Xr(e[t])&&vn(n.bin))}return!0}(e,o,t))return Kn(Tn(o,t)),r;if(o===vt&&"line"===t){const t=xo(e[o]);if(null==t?void 0:t.aggregate)return Kn("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."),r}if(o===pt&&(n?"fill"in e:"stroke"in e))return Kn(Pn("encoding",{fill:"fill"in e,stroke:"stroke"in e})),r;if(o===kt||o===Ft&&!c(s)&&!io(s)||o===Et&&c(s))s&&(r[o]=m(s).reduce((e,t)=>(Xr(t)?e.push(Ao(t,o)):Kn(Mn(t,o)),e),[]));else{if(o===Et&&null===s)r[o]=null;else if(!(Xr(s)||Kr(s)||io(s)||Vr(s)||mi(s)))return Kn(Mn(s,o)),r;r[o]=wo(s,o,i)}return r},{})}function Yo(e,t){const n={};for(const i of V(e)){const r=wo(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Xo(e,t,n){if(e)for(const i of V(e)){const r=e[i];if(c(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function Qo(e,t,n,i){return e?V(e).reduce((n,r)=>{const o=e[r];return c(o)?o.reduce((e,n)=>t.call(i,e,n,r),n):t.call(i,n,o,r)},n):n}function Ko(e,t){return V(t).reduce((n,i)=>{switch(i){case nt:case it:case St:case Bt:case $t:case rt:case ot:case ut:case ct:case st:case at:case lt:case ft:case dt:case gt:case Dt:case bt:case yt:case Et:return n;case Ft:if("line"===e||"trail"===e)return n;case kt:case Ct:{const e=t[i];if(c(e)||Xr(e))for(const t of m(e))t.aggregate||n.push(co(t,{}));return n}case vt:if("trail"===e)return n;case pt:case mt:case ht:case xt:case Ot:case wt:case At:case jt:{const e=xo(t[i]);return e&&!e.aggregate&&n.push(co(e,{})),n}}},[])}function Zo(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>{const r=i?" of "+es(t):"";return{field:e+t.field,type:t.type,title:mi(n)?{signal:n+`"${escape(r)}"`}:n+r}}),...W(function(e){const t=[];for(const n of V(e))if(Io(e,n)){const i=m(e[n]);for(const e of i)Xr(e)?t.push(e):Jr(e)&&t.push(e.condition)}return t}(n).map(uo),P)]}}function es(e){const{title:t,field:n}=e;return ae(t,n)}function ts(e,t,n,i,r){const{scale:o,axis:s}=n;return({partName:a,mark:u,positionPrefix:c,endPositionPrefix:l,extraEncoding:f={}})=>{const d=es(n);return ns(e,a,r,{mark:u,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:c+"_"+n.field,type:n.type},void 0!==d?{title:d}:{}),void 0!==o?{scale:o}:{}),void 0!==s?{axis:s}:{})},x(l)?{[t+"2"]:{field:l+"_"+n.field}}:{}),i),f)})}}function ns(e,t,n,i){const{clip:r,color:o,opacity:s}=e,a=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},i),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),r?{clip:r}:{}),o?{color:o}:{}),s?{opacity:s}:{}),Pe(i.mark)?i.mark:{type:i.mark}),{style:`${a}-${t}`}),v(e[t])?{}:e[t])})]:[]}function is(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],s=i[r+"2"],a=i[r+"Error"],u=i[r+"Error2"];return{continuousAxisChannelDef:rs(o,n),continuousAxisChannelDef2:rs(s,n),continuousAxisChannelDefError:rs(a,n),continuousAxisChannelDefError2:rs(u,n),continuousAxis:r}}function rs(e,t){if(e&&e.aggregate){const{aggregate:n}=e,i=j(e,["aggregate"]);return n!==t&&Kn(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function os(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(Pe(n)&&n.orient)return n.orient;if(Zr(r)){if(Zr(o)){const e=Xr(r)&&r.aggregate,n=Xr(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return ko(o)&&!ko(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(Zr(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const ss="boxplot",as=new Ue(ss,cs);function us(e){return y(e)?"tukey":e}function cs(e,{config:t}){var n,i;e=Object.assign(Object.assign({},e),{encoding:Yo(e.encoding,t)});const{mark:r,encoding:o,selection:s,projection:a}=e,u=j(e,["mark","encoding","selection","projection"]),f=Pe(r)?r:{type:r};s&&Kn(Sn("boxplot"));const d=null!==(n=f.extent)&&void 0!==n?n:t.boxplot.extent,g=Mo("size",f,t),p=us(d),{bins:m,timeUnits:h,transform:b,continuousAxisChannelDef:v,continuousAxis:y,groupby:x,aggregate:O,encodingWithoutContinuousAxis:w,ticksOrient:A,boxOrient:D,customTooltipWithoutAggregatedField:F}=function(e,t,n){const i=os(e,ss),{continuousAxisChannelDef:r,continuousAxis:o}=is(e,i,ss),s=r.field,a=us(t),u=[...ls(s),{op:"median",field:s,as:"mid_box_"+s},{op:"min",field:s,as:("min-max"===a?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===a?"upper_whisker_":"max_")+s}],l="min-max"===a||"tukey"===a?[]:[{calculate:`datum["upper_box_${s}"] - datum["lower_box_${s}"]`,as:"iqr_"+s},{calculate:`min(datum["upper_box_${s}"] + datum["iqr_${s}"] * ${t}, datum["max_${s}"])`,as:"upper_whisker_"+s},{calculate:`max(datum["lower_box_${s}"] - datum["iqr_${s}"] * ${t}, datum["min_${s}"])`,as:"lower_whisker_"+s}],f=e.encoding,d=o,g=(f[d],j(f,["symbol"==typeof d?d:d+""])),{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t}=e,n=j(e,["tooltip"]);if(!t)return{filteredEncoding:n};let i,r;if(c(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return c(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(g),{bins:h,timeUnits:b,aggregate:v,groupby:y,encoding:x}=Vo(m,n),O="vertical"===i?"horizontal":"vertical",w=i,A=[...h,...b,{aggregate:[...v,...u],groupby:y},...l];return{bins:h,timeUnits:b,transform:A,groupby:y,aggregate:v,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:x,ticksOrient:O,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,d,t),{color:k,size:C}=w,E=j(w,["color","size"]),S=e=>ts(f,y,v,e,t.boxplot),$=S(E),B=S(w),_=S(Object.assign(Object.assign({},E),C?{size:C}:{})),N=Zo([{fieldPrefix:"min-max"===p?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===p?"lower_whisker_":"min_",titlePrefix:"Min"}],v,w),P={type:"tick",color:"black",opacity:1,orient:A,invalid:null,aria:!1},M="min-max"===p?N:Zo([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],v,w),T=[...$({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:M}),...$({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:M}),...$({partName:"ticks",mark:P,positionPrefix:"lower_whisker",extraEncoding:M}),...$({partName:"ticks",mark:P,positionPrefix:"upper_whisker",extraEncoding:M})],L=[..."tukey"!==p?T:[],...B({partName:"box",mark:Object.assign(Object.assign({type:"bar"},g?{size:g}:{}),{orient:D,invalid:null,ariaRoleDescription:"box"}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:N}),..._({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},l(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),g?{size:g}:{}),{orient:A,aria:!1}),positionPrefix:"mid_box",extraEncoding:N})];if("min-max"===p)return Object.assign(Object.assign({},u),{transform:(null!==(i=u.transform)&&void 0!==i?i:[]).concat(b),layer:L});const q=`datum["lower_box_${v.field}"]`,R=`datum["upper_box_${v.field}"]`,W=`(${R} - ${q})`,U=`${q} - ${d} * ${W}`,H=`${R} + ${d} * ${W}`,I=`datum["${v.field}"]`,V={joinaggregate:ls(v.field),groupby:x},J={transform:[{filter:`(${U} <= ${I}) && (${I} <= ${H})`},{aggregate:[{op:"min",field:v.field,as:"lower_whisker_"+v.field},{op:"max",field:v.field,as:"upper_whisker_"+v.field},{op:"min",field:"lower_box_"+v.field,as:"lower_box_"+v.field},{op:"max",field:"upper_box_"+v.field,as:"upper_box_"+v.field},...O],groupby:x}],layer:T},Y=j(E,["tooltip"]),{scale:X,axis:Q}=v,K=es(v),Z=z(Q,["title"]),ee=ns(f,"outliers",t.boxplot,{transform:[{filter:`(${I} < ${U}) || (${I} > ${H})`}],mark:"point",encoding:Object.assign(Object.assign(Object.assign({[y]:Object.assign(Object.assign(Object.assign({field:v.field,type:v.type},void 0!==K?{title:K}:{}),void 0!==X?{scale:X}:{}),G(Z)?{}:{axis:Z})},Y),k?{color:k}:{}),F?{tooltip:F}:{})})[0];let te;const ne=[...m,...h,V];return ee?te={transform:ne,layer:[ee,J]}:(te=J,te.transform.unshift(...ne)),Object.assign(Object.assign({},u),{layer:[te,{transform:b,layer:L}]})}function ls(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const fs="errorbar",ds=new Ue(fs,gs);function gs(e,{config:t}){e=Object.assign(Object.assign({},e),{encoding:Yo(e.encoding,t)});const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:s,markDef:a,outerSpec:u,tooltipEncoding:c}=ms(e,fs,t);delete o.size;const l=ts(a,r,i,o,t.errorbar),f=a.thickness,d=a.size,g=Object.assign(Object.assign({type:"tick",orient:s,aria:!1},void 0!==f?{thickness:f}:{}),void 0!==d?{size:d}:{}),p=[...l({partName:"ticks",mark:g,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:g,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:Object.assign({type:"rule",ariaRoleDescription:"errorbar"},void 0!==f?{size:f}:{}),positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})];return Object.assign(Object.assign(Object.assign({},u),{transform:n}),p.length>1?{layer:p}:Object.assign({},p[0]))}function ps(e,t){const{encoding:n}=e;if(function(e){return(to(e.x)||to(e.y))&&!to(e.x2)&&!to(e.y2)&&!to(e.xError)&&!to(e.xError2)&&!to(e.yError)&&!to(e.yError2)}(n))return{orient:os(e,t),inputType:"raw"};const i=function(e){return to(e.x2)||to(e.y2)}(n),r=function(e){return to(e.xError)||to(e.xError2)||to(e.yError)||to(e.yError2)}(n),o=n.x,s=n.y;if(i){if(r)throw new Error(t+" cannot be both type aggregated-upper-lower and aggregated-error");const e=n.x2,i=n.y2;if(to(e)&&to(i))throw new Error(t+" cannot have both x2 and y2");if(to(e)){if(Zr(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(to(i)){if(Zr(s))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error("Both y and y2 have to be quantitative in "+t)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,a=n.yError2;if(to(i)&&!to(e))throw new Error(t+" cannot have xError2 without xError");if(to(a)&&!to(r))throw new Error(t+" cannot have yError2 without yError");if(to(e)&&to(r))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(to(e)){if(Zr(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(to(r)){if(Zr(s))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function ms(e,t,n){var i;const{mark:r,encoding:o,selection:s,projection:a}=e,u=j(e,["mark","encoding","selection","projection"]),c=Pe(r)?r:{type:r};s&&Kn(Sn(t));const{orient:l,inputType:f}=ps(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:g,continuousAxisChannelDefError:p,continuousAxisChannelDefError2:m,continuousAxis:h}=is(e,l,t),{errorBarSpecificAggregate:b,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,s,a){let u=[],c=[];const l=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":a.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Kn(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,s)),"stderr"===n||"stdev"===n)u=[{op:n,field:l,as:"extent_"+l},{op:t,field:l,as:"center_"+l}],c=[{calculate:`datum["center_${l}"] + datum["extent_${l}"]`,as:"upper_"+l},{calculate:`datum["center_${l}"] - datum["extent_${l}"]`,as:"lower_"+l}],f=[{fieldPrefix:"center_",titlePrefix:ee(t)},{fieldPrefix:"upper_",titlePrefix:hs(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:hs(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),u=[{op:t,field:l,as:"lower_"+l},{op:i,field:l,as:"upper_"+l},{op:e,field:l,as:"center_"+l}],f=[{fieldPrefix:"upper_",titlePrefix:ho({field:l,aggregate:i,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ho({field:l,aggregate:t,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ho({field:l,aggregate:e,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Kn((g=e.center,`${(p=e.extent)?"extent ":""}${p&&g?"and ":""}${g?"center ":""}${p&&g?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:`datum["${n.field}"]`,as:"upper_"+l},{calculate:`datum["${l}"]`,as:"lower_"+l}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`datum["${l}"] + datum["${i.field}"]`,as:"upper_"+l}],r?c.push({calculate:`datum["${l}"] + datum["${r.field}"]`,as:"lower_"+l}):c.push({calculate:`datum["${l}"] - datum["${i.field}"]`,as:"lower_"+l}));for(const e of c)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:re(re(e.calculate,'datum["',""),'"]',"")})}var g,p;return{postAggregateCalculates:c,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(c,d,g,p,m,f,t,n),O=o,w=h,A=(O[w],"x"===h?"x2":"y2"),D=(O[A],"x"===h?"xError":"yError"),F=(O[D],"x"===h?"xError2":"yError2"),k=(O[F],j(O,["symbol"==typeof w?w:w+"","symbol"==typeof A?A:A+"","symbol"==typeof D?D:D+"","symbol"==typeof F?F:F+""])),{bins:C,timeUnits:E,aggregate:S,groupby:$,encoding:B}=Vo(k,n),_=[...S,...b],z="raw"!==f?[]:$,N=Zo(y,d,B,x);return{transform:[...null!==(i=u.transform)&&void 0!==i?i:[],...C,...E,...0===_.length?[]:[{aggregate:_,groupby:z}],...v],groupby:z,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:B,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:c,outerSpec:u,tooltipEncoding:N}}function hs(e,t,n){return ee(e)+" "+n+" "+t}const bs="errorband",vs=new Ue(bs,ys);function ys(e,{config:t}){e=Object.assign(Object.assign({},e),{encoding:Yo(e.encoding,t)});const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:s,outerSpec:a,tooltipEncoding:u}=ms(e,bs,t),c=s,l=ts(c,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},g={type:f?"line":"rule"};const p=Object.assign(Object.assign({},c.interpolate?{interpolate:c.interpolate}:{}),c.tension&&c.interpolate?{tension:c.tension}:{});return f?(d=Object.assign(Object.assign(Object.assign({},d),p),{ariaRoleDescription:"errorband"}),g=Object.assign(Object.assign(Object.assign({},g),p),{aria:!1})):c.interpolate?Kn(Jn("interpolate")):c.tension&&Kn(Jn("tension")),Object.assign(Object.assign({},a),{transform:n,layer:[...l({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...l({partName:"borders",mark:g,positionPrefix:"lower",extraEncoding:u}),...l({partName:"borders",mark:g,positionPrefix:"upper",extraEncoding:u})]})}const xs={};function Os(e,t,n){const i=new Ue(e,t);xs[e]={normalizer:i,parts:n}}Os(ss,cs,["box","median","outliers","rule","ticks"]),Os(fs,gs,["ticks","rule"]),Os(bs,ys,["band","borders"]);const ws=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],js=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],As="_vgsid_",Ds={single:{on:"click",fields:[As],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:[As],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Fs(e){return!(!e||"legend"!==e&&!e.legend)}function ks(e){return Fs(e)&&l(e)}function Cs(e){return"concat"in e}function Es(e){return"vconcat"in e}function Ss(e){return"hconcat"in e}function $s(e){return l(e)&&void 0!==e.step}function Bs(e){return e.view||e.width||e.height}const _s=V({align:1,bounds:1,center:1,columns:1,spacing:1});function zs(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function Ns(e,t){const n=Ps(e,t);return $s(n)?n.step:Ms}function Ps(e,t){var n;return ae(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Ms=20,Ts={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Ms},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},arc:{},area:{},bar:qe,circle:{},geoshape:{},image:{},line:{},point:{},rect:Re,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Ds,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},Ls=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],qs={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Rs={blue:Ls[0],orange:Ls[1],red:Ls[2],teal:Ls[3],green:Ls[4],yellow:Ls[5],purple:Ls[6],pink:Ls[7],brown:Ls[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Ws(e={}){const{color:t,font:n,fontSize:i}=e,r=j(e,["color","font","fontSize"]);return d({},Ts,n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:l(e)?Object.assign(Object.assign({},Rs),e):Rs}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:l(e)?Object.assign(Object.assign({},qs),e):qs}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},r||{})}const Us=["view",...Ne],Hs=["color","fontSize","background","padding","facet","concat","numberFormat","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Is=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function Gs(e){e=B(e);for(const t of Hs)delete e[t];if(e.axis)for(const t in e.axis)de(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of ws)delete e.legend[t];if(e.mark){for(const t of Te)delete e.mark[t];e.mark.tooltip&&l(e.mark.tooltip)&&delete e.mark.tooltip}for(const t of Us){for(const n of Te)delete e[t][n];const n=Is[t];if(n)for(const i of n)delete e[t][i];Vs(e,t)}for(const t of V(xs))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=$o(e.title);G(t)||(e.style["group-title"]=Object.assign(Object.assign({},e.style["group-title"]),t));G(n)||(e.style["group-subtitle"]=Object.assign(Object.assign({},e.style["group-subtitle"]),n));G(i)?delete e.title:e.title=i}(e);for(const t in e)l(e[t])&&G(e[t])&&delete e[t];return G(e)?void 0:e}function Vs(e,t,n,i){const r=i?e[t][i]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},r),e.style[null!=n?n:t]);G(o)||(e.style[null!=n?n:t]=o),i||delete e[t]}function Js(e){return"layer"in e}const Ys={zero:1,center:1,normalize:1};const Xs=new Set([ye,Oe,xe,Fe,Ae,Se,$e,je,ke,Ce]),Qs=new Set([Oe,xe,ye]);function Ks(e,t){var n,i;const r="x"===t?"y":"radius",o=e[t],s=e[r];if(Xr(o)&&Xr(s))if("quantitative"===Qr(o)&&"quantitative"===Qr(s)){if(o.stack)return t;if(s.stack)return r;const e=Xr(o)&&!!o.aggregate;if(e!==(Xr(s)&&!!s.aggregate))return e?t:r;{const e=null===(n=o.scale)||void 0===n?void 0:n.type,a=null===(i=s.scale)||void 0===i?void 0:i.type;if(e&&"linear"!==e)return r;if(a&&"linear"!==a)return t}}else{if("quantitative"===Qr(o))return t;if("quantitative"===Qr(s))return r}else{if("quantitative"===Qr(o))return t;if("quantitative"===Qr(s))return r}}function Zs(e,t,n={}){const i=Pe(e)?e.type:e;if(!Xs.has(i))return null;const r=Ks(t,"x")||Ks(t,"theta");if(!r)return null;const o=t[r],s=Xr(o)?co(o,{}):void 0;let a=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(r),u=t[a],c=Xr(u)?co(u,{}):void 0;c===s&&(c=void 0,u=void 0,a=void 0);const l=Zt.reduce((e,n)=>{if("tooltip"!==n&&Io(t,n)){const i=t[n];for(const t of m(i)){const i=xo(t);if(i.aggregate)continue;const r=co(i,{});r&&r===c||e.push({channel:n,fieldDef:i})}}return e},[]);let f;if(void 0!==o.stack?f=v(o.stack)?o.stack?"zero":null:o.stack:l.length>0&&Qs.has(i)&&(f="zero"),!f||!(f in Ys))return null;var d;if(Go(t)&&0===l.length)return null;if(o.scale&&o.scale.type&&o.scale.type!==Ti){if(n.disallowNonLinearStack)return null;Kn(function(e){return`Cannot stack non-linear scale (${e}).`}(o.scale.type))}return to(t[Xt(r)])?(void 0!==o.stack&&Kn(`Cannot stack "${d=r}" if there is already "${d}2".`),null):(Xr(o)&&o.aggregate&&!T(Qe,o.aggregate)&&Kn(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannel:u?a:void 0,groupbyField:c,fieldChannel:r,impute:null!==o.impute&&_e(i),stackBy:l,offset:f})}function ea(e){const t=j(e,["point","line"]);return V(t).length>1?t:t.type}function ta(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:z(e[t],["point","line"])}));return e}function na(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?l(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?l(t.point)?t.point:{}:void 0}function ia(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class ra{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(We(e)){const{mark:n,encoding:i}=e,r=Pe(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!na(r,t[r.type],i);case"area":return!!na(r,t[r.type],i)||!!ia(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{selection:r,projection:o,mark:s,encoding:a}=e,u=j(e,["selection","projection","mark","encoding"]),c=Yo(a,i),l=Pe(s)?s:{type:s},f=na(l,i[l.type],c),d="area"===l.type&&ia(l,i[l.type]),g=[Object.assign(Object.assign({},r?{selection:r}:{}),{mark:ea(Object.assign(Object.assign({},"area"===l.type&&void 0===l.opacity&&void 0===l.fillOpacity?{opacity:.7}:{}),l)),encoding:z(c,["shape"])})],p=Zs(l,c);let m=c;if(p){const{fieldChannel:e,offset:t}=p;m=Object.assign(Object.assign({},c),{[e]:Object.assign(Object.assign({},c[e]),t?{stack:t}:{})})}return d&&g.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},_(l,["clip","interpolate","tension","tooltip"])),d),encoding:m})),f&&g.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},_(l,["clip","tooltip"])),f),encoding:m})),n(Object.assign(Object.assign({},u),{layer:g}),Object.assign(Object.assign({},t),{config:ta(i)}))}}class oa{constructor(){this.name="RangeStep"}hasMatchingType(e){var t;if(We(e)&&e.encoding)for(const n of tn){const i=e.encoding[n];if(i&&to(i)&&(null===(t=null==i?void 0:i.scale)||void 0===t?void 0:t.rangeStep))return!0}return!1}run(e){var t;const n={};let i=Object.assign({},e.encoding);for(const e of tn){const r=Qt(e),o=i[e];if(o&&to(o)&&(null===(t=null==o?void 0:o.scale)||void 0===t?void 0:t.rangeStep)){const{scale:t}=o,s=j(o,["scale"]),a=j(t,["rangeStep"]);n[r]={step:t.rangeStep},Kn('Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.'),i=Object.assign(Object.assign({},i),{[e]:Object.assign(Object.assign({},s),G(a)?{}:{scale:a})})}}return Object.assign(Object.assign(Object.assign({},n),e),{encoding:i})}}function sa(e,t){return t?qr(e)?da(e,t):ca(e,t):e}function aa(e,t){return t?da(e,t):e}function ua(e,t,n){const i=t[e];return function(e){return e&&!x(e)&&"repeat"in e}(i)?i.repeat in n?Object.assign(Object.assign({},t),{[e]:n[i.repeat]}):void Kn(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t}function ca(e,t){if(void 0!==(e=ua("field",e,t))){if(null===e)return null;if(Hr(e)&&Tr(e.sort)){const n=ua("field",e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function la(e,t){if(Xr(e))return ca(e,t);{const n=ua("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function fa(e,t){if(!to(e)){if(Yr(e)){const n=la(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});return j(e,["condition"])}return e}{const n=la(e,t);if(n)return n;if(Vr(e))return{condition:e.condition}}}function da(e,t){const n={};for(const i in e)if(b(e,i)){const r=e[i];if(c(r))n[i]=r.map(e=>fa(e,t)).filter(e=>e);else{const e=fa(r,t);void 0!==e&&(n[i]=e)}}return n}class ga{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(We(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of Gt){const n=t[Jt(e)];if(t[e]&&(Xr(n)&&!vn(n.bin)||Kr(n)))return!0}}return!1}run(e,t,n){const{encoding:i}=e;var r,o;return Kn((r=!!i.x2,o=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${r&&o?"x2 and y2":r?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function pa({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...V(e),...V(t)]);for(const o of r){const r=t[o],s=e[o];if(to(r)){const e=Object.assign(Object.assign({},s),r);i[o]=e}else Yr(r)?i[o]=Object.assign(Object.assign({},r),{condition:Object.assign(Object.assign({},s),r.condition)}):r||null===r?i[o]=r:(n||io(s)||mi(s)||to(s)||c(s))&&(i[o]=s)}}else i=t;return!i||G(i)?void 0:i}function ma(e){const{parentProjection:t,projection:n}=e;return t&&n&&Kn(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${N(t)} is overridden by a child projection ${N(n)}.`}({parentProjection:t,projection:n})),null!=n?n:t}function ha(e,t){void 0===t&&(t=Ws(e.config));const n=function(e,t={}){return ba.map(e,{config:t})}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=We(e)||Js(e),s={};o?"container"==i&&"container"==r?(s.type="fit",s.contains="padding"):"container"==i?(s.type="fit-x",s.contains="padding"):"container"==r&&(s.type="fit-y",s.contains="padding"):("container"==i&&(Kn(An("width")),i=void 0),"container"==r&&(Kn(An("height")),r=void 0));const a=Object.assign(Object.assign(Object.assign({type:"pad"},s),n?va(n.autosize):{}),va(e.autosize));"fit"!==a.type||o||(Kn(jn),a.type="pad");"container"==i&&"fit"!=a.type&&"fit-x"!=a.type&&Kn(Dn("width"));"container"==r&&"fit"!=a.type&&"fit-y"!=a.type&&Kn(Dn("height"));if($(a,{type:"pad"}))return;return a}(n,{width:i,height:r,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const ba=new class extends class{map(e,t){return Wr(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):Ss(e)?this.mapHConcat(e,t):Es(e)?this.mapVConcat(e,t):Cs(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Js(e))return this.mapLayer(e,t);if(We(e))return this.mapUnit(e,t);throw new Error(wn(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,i=j(e,["concat"]);return Object.assign(Object.assign({},i),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[as,ds,vs,new ra,new ga,new oa]}map(e,t){if(We(e)){const n=Io(e.encoding,Ze),i=Io(e.encoding,et),r=Io(e.encoding,tt);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=aa(e.encoding,t.repeater),o=Object.assign(Object.assign({},e),r?{encoding:r}:{});if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const s=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,s);return o}mapRepeat(e,t){return function(e){return!c(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i}=e,r=j(e,["repeat","spec"]),{row:o,column:s,layer:a}=n,{repeater:u={},repeaterPrefix:c=""}=t;return o||s?this.mapRepeat(Object.assign(Object.assign({},e),{repeat:Object.assign(Object.assign({},o?{row:o}:{}),s?{column:s}:{}),spec:{repeat:{layer:a},spec:i}}),t):Object.assign(Object.assign({},r),{layer:a.map(e=>{const n=Object.assign(Object.assign({},u),{layer:e}),r=(i.name||"")+c+"child__layer_"+Q(e),o=this.mapLayerOrUnit(i,Object.assign(Object.assign({},t),{repeater:n,repeaterPrefix:r}));return o.name=r,o})})}mapNonLayerRepeat(e,t){var n;const{repeat:i,spec:r,data:o}=e,s=j(e,["repeat","spec","data"]);!c(i)&&e.columns&&(e=z(e,["columns"]),Kn(Bn("repeat")));const a=[],{repeater:u={},repeaterPrefix:l=""}=t,f=!c(i)&&i.row||[u?u.row:null],d=!c(i)&&i.column||[u?u.column:null],g=c(i)&&i||[u?u.repeat:null];for(const e of g)for(const n of f)for(const o of d){const s={repeat:e,row:n,column:o,layer:u.layer},f=(r.name||"")+l+"child__"+(c(i)?""+Q(e):(i.row?"row_"+Q(n):"")+(i.column?"column_"+Q(o):"")),d=this.map(r,Object.assign(Object.assign({},t),{repeater:s,repeaterPrefix:f}));d.name=f,a.push(z(d,["data"]))}const p=c(i)?e.columns:i.column?i.column.length:1;return Object.assign(Object.assign({data:null!==(n=r.data)&&void 0!==n?n:o,align:"all"},s),{columns:p,concat:a})}mapFacet(e,t){const{facet:n}=e;return qr(n)&&e.columns&&(e=z(e,["columns"]),Kn(Bn("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:s}=t,a=ma({parentProjection:o,projection:i}),u=pa({parentEncoding:r,encoding:aa(n,t.repeater)});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),a?{projection:a}:{}),u?{encoding:u}:{}),{config:s})}mapFacetedUnit(e,t){const n=e.encoding,{row:i,column:r,facet:o}=n,s=j(n,["row","column","facet"]),{mark:a,width:u,projection:c,height:l,view:f,selection:d,encoding:g}=e,p=j(e,["mark","width","projection","height","view","selection","encoding"]),{facetMapping:m,layout:h}=this.getFacetMappingAndLayout({row:i,column:r,facet:o},t),b=aa(s,t.repeater);return this.mapFacet(Object.assign(Object.assign(Object.assign({},p),h),{facet:m,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u?{width:u}:{}),l?{height:l}:{}),f?{view:f}:{}),c?{projection:c}:{}),{mark:a,encoding:b}),d?{selection:d}:{})}),t)}getFacetMappingAndLayout(e,t){var n;const{row:i,column:r,facet:o}=e;if(i||r){o&&Kn(`Facet encoding dropped as ${(s=[...i?[Ze]:[],...r?[et]:[]]).join(" and ")} ${s.length>1?"are":"is"} also specified.`);const t={},a={};for(const i of[Ze,et]){const r=e[i];if(r){const e=j(r,["align","center","spacing","columns"]);t[i]=e;for(const e of["align","center","spacing"])void 0!==r[e]&&(a[e]=null!==(n=a[e])&&void 0!==n?n:{},a[e][i]=r[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:r}=o;return{facetMapping:sa(j(o,["align","center","spacing","columns"]),t.repeater),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),n?{center:n}:{}),i?{spacing:i}:{}),r?{columns:r}:{})}}var s}mapLayer(e,t){var{parentEncoding:n,parentProjection:i}=t,r=j(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:s}=e,a=j(e,["encoding","projection"]),u=Object.assign(Object.assign({},r),{parentEncoding:pa({parentEncoding:n,encoding:o,layer:!0}),parentProjection:ma({parentProjection:i,projection:s})});return super.mapLayer(a,u)}};function va(e){return x(e)?{type:e}:null!=e?e:{}}const ya=["background","padding"];function xa(e){return ya.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}class Oa{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Oa(B(this.explicit),B(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return ae(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of V(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function wa(e){return{explicit:!0,value:e}}function ja(e){return{explicit:!1,value:e}}function Aa(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:Da(t,n,i,r)}}function Da(e,t,n,i){return e.explicit&&t.explicit&&Kn(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${N(n)} and ${N(i)}). Using ${N(n)}.`}(n,i,e.value,t.value)),e}function Fa(e,t,n,i,r=Da){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:$(e.value,t.value)?e:r(e,t,n,i)}class ka extends Oa{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function Ca(e){return"url"in e}function Ea(e){return"values"in e}function Sa(e){return"name"in e&&!Ca(e)&&!Ea(e)&&!$a(e)}function $a(e){return e&&(Ba(e)||_a(e)||za(e))}function Ba(e){return"sequence"in e}function _a(e){return"sphere"in e}function za(e){return"graticule"in e}var Na;function Pa(e){return"filter"in e}function Ma(e){return"lookup"in e}function Ta(e){return"pivot"in e}function La(e){return"density"in e}function qa(e){return"quantile"in e}function Ra(e){return"regression"in e}function Wa(e){return"loess"in e}function Ua(e){return"sample"in e}function Ha(e){return"window"in e}function Ia(e){return"joinaggregate"in e}function Ga(e){return"flatten"in e}function Va(e){return"calculate"in e}function Ja(e){return"bin"in e}function Ya(e){return"impute"in e}function Xa(e){return"timeUnit"in e}function Qa(e){return"aggregate"in e}function Ka(e){return"stack"in e}function Za(e){return"fold"in e}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(Na||(Na={}));const eu="[",tu="]",nu=/[[\]{}]/,iu={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let ru,ou;function su(e,t,n){return ru=t||"view",ou=n||iu,uu(e.trim()).map(cu)}function au(e,t,n,i,r){const o=e.length;let s,a=0;for(;t<o;++t){if(s=e[t],!a&&s===n)return t;r&&r.indexOf(s)>=0?--a:i&&i.indexOf(s)>=0&&++a}return t}function uu(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=au(e,r,",","[{","]}"),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function cu(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=au(e,i,tu,eu,tu),i===t)throw"Empty between selector: "+e;if(n=uu(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if(">"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;n=n.map(cu);const r=cu(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:ru},n=[];let i,r,o=[0,0],s=0,a=0,u=e.length,c=0;if("}"===e[u-1]){if(c=e.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(",");if(!e.length||t.length>2)throw e;return t.map(t=>{const n=+t;if(n!=n)throw e;return n})}(e.substring(c+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}u=(e=e.slice(0,c).trim()).length,c=0}if(!u)throw e;"@"===e[0]&&(s=++c);i=au(e,c,":"),i<u&&(n.push(e.substring(a,i).trim()),a=c=++i);if(c=au(e,c,eu),c===u)n.push(e.substring(a,u).trim());else if(n.push(e.substring(a,c).trim()),r=[],a=++c,a===u)throw"Unmatched left bracket: "+e;for(;c<u;){if(c=au(e,c,tu),c===u)throw"Unmatched left bracket: "+e;if(r.push(e.substring(a,c).trim()),c<u-1&&e[++c]!==eu)throw"Expected left bracket: "+e;a=++c}if(!(u=n.length)||nu.test(n[u-1]))throw"Invalid event selector: "+e;u>1?(t.type=n[1],s?t.markname=n[0].slice(1):(l=n[0],ou[l]?t.marktype=n[0]:t.source=n[0])):t.type=n[0];var l;"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);o[0]&&(t.throttle=o[0]);o[1]&&(t.debounce=o[1]);return t}(e)}function lu(e,t,n,i){const r=Vr(t)&&t.condition,o=i(t);if(r){return{[n]:[...m(r).map(t=>{const n=i(t),r=function(e){return e.selection}(t)?Gl(e,t.selection):Jl(e,t.test);return Object.assign({test:r},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function fu(e,t="text"){const n=e.encoding[t];return lu(e,n,t,t=>du(t,e.config))}function du(e,t,n="datum"){if(e){if(io(e))return _o(e.value);if(to(e)){const{format:i,formatType:r}=yo(e);return Dr({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function gu(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,s=n.tooltip;if(c(s))return{tooltip:mu({tooltip:s},o,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return lu(e,s,"tooltip",e=>{const s=du(e,r,a);if(s)return s;if(null===e)return;let u=Mo("tooltip",i,r);return!0===u&&(u={content:"encoding"}),x(u)?{value:u}:l(u)?mi(u)?u:"encoding"===u.content?mu(n,o,r,t):{signal:a}:void 0})}}function pu(e,t,n,{reactiveGeom:i}={}){const r={},o=i?"datum.datum":"datum",s=[];function a(i,a){const u=Jt(a),c=no(i)?i:Object.assign(Object.assign({},i),{type:e[u].type}),l=m(c.title||vo(c,n)).join(", ");let f;if(nn(a)){const i="x"===a?"x2":"y2",s=xo(e[i]);if(vn(c.bin)&&s){const e=co(c,{expr:o}),t=co(s,{expr:o}),{format:a,formatType:u}=yo(c);f=_r(e,t,a,u,n),r[i]=!0}else if(t&&t.fieldChannel===a&&"normalize"===t.offset){const{format:e,formatType:t}=yo(c);f=Dr({fieldOrDatumDef:c,format:e,formatType:t,expr:o,config:n,normalizeStack:!0}).signal}}f=null!=f?f:du(c,n,o).signal,s.push({channel:a,key:l,value:f})}Xo(e,(e,t)=>{Xr(e)?a(e,t):Jr(e)&&a(e.condition,t)});const u={};for(const{channel:e,key:t,value:n}of s)r[e]||u[t]||(u[t]=n);return u}function mu(e,t,n,{reactiveGeom:i}={}){const r=pu(e,t,n,{reactiveGeom:i}),o=Y(r).map(([e,t])=>`"${e}": ${t}`);return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function hu(e){const{markDef:t,config:n}=e,i=Mo("aria",t,n);return!1===i?{}:Object.assign(Object.assign(Object.assign({},i?{aria:i}:{}),function(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=Mo("ariaRoleDescription",n,i);if(null!=r)return{ariaRoleDescription:{value:r}};return t in yi?{}:{ariaRoleDescription:{value:t}}}(e)),function(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return lu(e,o,"description",t=>du(t,e.config));const s=Mo("description",n,i);if(null!=s)return{description:_o(s)};if(!1===i.aria)return{};const a=pu(t,r,i);if(G(a))return;return{description:{signal:Y(a).map(([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`).join(" + ")}}}(e))}function bu(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:s}=n;let{defaultRef:a,defaultValue:u}=n;void 0===a&&(u=null!=u?u:Mo(e,i,o,{vgChannel:s,ignoreVgConfig:!0}),void 0!==u&&(a=_o(u)));const c=r[e];return lu(t,c,null!=s?s:e,n=>Or({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:a}))}function vu(e,t={filled:void 0}){var n,i,r,o;const{markDef:s,encoding:a,config:u}=e,{type:c}=s,l=null!==(n=t.filled)&&void 0!==n?n:Mo("filled",s,u),f=T(["bar","point","circle","square","geoshape"],c)?"transparent":void 0,d=null!==(r=null!==(i=Mo(!0===l?"color":void 0,s,u,{vgChannel:"fill"}))&&void 0!==i?i:u.mark[!0===l&&"color"])&&void 0!==r?r:f,g=null!==(o=Mo(!1===l?"color":void 0,s,u,{vgChannel:"stroke"}))&&void 0!==o?o:u.mark[!1===l&&"color"],p=l?"fill":"stroke",m=Object.assign(Object.assign({},d?{fill:_o(d)}:{}),g?{stroke:_o(g)}:{});return s.color&&(l?s.fill:s.stroke)&&Kn(Pn("property",{fill:"fill"in s,stroke:"stroke"in s})),Object.assign(Object.assign(Object.assign(Object.assign({},m),bu("color",e,{vgChannel:p,defaultValue:l?d:g})),bu("fill",e,{defaultValue:a.fill?d:void 0})),bu("stroke",e,{defaultValue:a.stroke?g:void 0}))}function yu(e,t){const n=t[function(e){switch(e){case nt:return"xOffset";case it:return"yOffset";case rt:return"x2Offset";case ot:return"y2Offset";case ut:return"thetaOffset";case st:return"radiusOffset";case ct:return"theta2Offset";case at:return"radius2Offset"}}(e)];if(n)return n}function xu(e,t,{defaultPos:n,vgChannel:i,isMidPoint:r}){const{encoding:o,markDef:s,config:a,stack:u}=t,c=o[e],l=o[Xt(e)],f=t.scaleName(e),d=t.getScaleComponent(e),g=yu(e,s),p=Ou({model:t,defaultPos:n,channel:e,scaleName:f,scale:d}),m=!c&&nn(e)&&(o.latitude||o.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,isMidPoint:i,scaleName:r,stack:o,offset:s,markDef:a,config:u}=e;if(to(n)&&o&&t===o.fieldChannel){if(Xr(n)){const e=Ir({channel:t,fieldDef:n,isMidPoint:i,markDef:a,stack:o,config:u});if(void 0!==e)return xr({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",band:e,offset:s})}return yr(n,r,{suffix:"end"},{offset:s})}return mr(e)}({channel:e,channelDef:c,channel2Def:l,markDef:s,config:a,isMidPoint:r,scaleName:f,scale:d,stack:u,offset:g,defaultRef:p});return m?{[i||e]:m}:void 0}function Ou({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:s}=e;return()=>{const a=Jt(n),u=Yt(n),c=Mo(n,o,s,{vgChannel:u});if(void 0!==c)return wr(n,c);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(T([Li,Ui,Hi],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===a?{field:{group:"height"}}:{value:0};switch(a){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":{const t=e[Qt(n)];return Object.assign(Object.assign({},t),{mult:.5})}}}}const wu={left:"x",center:"xc",right:"x2"},ju={top:"y",middle:"yc",bottom:"y2"};function Au(e,t,n,i="middle"){if("radius"===e||"theta"===e)return Yt(e);const r=Mo("x"===e?"align":"baseline",t,n);return"x"===e?wu[r||("top"===i?"left":"center")]:ju[r||i]}function Du(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Fu(e,t,{defaultPos:n,defaultPos2:i}):xu(e,t,{defaultPos:n})}function Fu(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,s=Xt(e),a=Qt(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:s,config:a}=e,u=Jt(n),c=Qt(n),l=Yt(n),f=i[u],d=e.scaleName(u),g=e.getScaleComponent(u),p=yu(n in i||n in o?n:u,e.markDef);if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude))return{[l]:{field:e.getName(n)}};const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:c}){if(to(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0))return yr(t,o,{suffix:"start"},{offset:u});return mr({channel:e,channelDef:n,scaleName:o,scale:s,stack:a,markDef:i,config:r,offset:u,defaultRef:c})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:a,scaleName:d,scale:g,stack:s,offset:p,defaultRef:void 0});if(void 0!==m)return{[l]:m};return ku(n,o)||ku(n,{[n]:Lo(n,o,a.style),[c]:Lo(c,o,a.style)})||ku(n,a[r])||ku(n,a.mark)||{[l]:Ou({model:e,defaultPos:t,channel:n,scaleName:d,scale:g})()}}(t,i,s),c=u[a]?Au(e,r,o):Yt(e);return Object.assign(Object.assign({},xu(e,t,{defaultPos:n,vgChannel:c})),u)}function ku(e,t){const n=Qt(e),i=Yt(e);return void 0!==t[i]?{[i]:wr(e,t[i])}:void 0!==t[e]?{[i]:wr(e,t[e])}:t[n]?{[n]:wr(e,t[n])}:void 0}function Cu(e,t,n){var i,r,o,s;const{config:a,encoding:u,markDef:l,stack:f}=e,d=Xt(t),g=Qt(t),p=u[t],m=u[d],h=e.getScaleComponent(t),b=h?h.get("type"):void 0,v=e.scaleName(t),y=l.orient,x=null!==(r=null!==(i=u[g])&&void 0!==i?i:u.size)&&void 0!==r?r:Mo("size",l,a,{vgChannel:g}),O="bar"===n&&("x"===t?"vertical"===y:"horizontal"===y);if(Xr(p)&&(bn(p.bin)||vn(p.bin)||p.timeUnit&&!m)&&!x&&!sr(b)){const n=Ir({channel:t,fieldDef:p,stack:f,markDef:l,config:a}),i=null===(o=e.component.axes[t])||void 0===o?void 0:o[0];return function({fieldDef:e,fieldDef2:t,channel:n,band:i,scaleName:r,markDef:o,spacing:s=0,axisTranslate:a,reverse:u,config:c}){const l=Xt(n),f=Yt(n),d=Yt(l),g=yu(n,o);if(bn(e.bin)||e.timeUnit)return{[d]:$u({channel:n,fieldDef:e,scaleName:r,markDef:o,band:(1-i)/2,offset:Su(l,s,u,a,g),config:c}),[f]:$u({channel:n,fieldDef:e,scaleName:r,markDef:o,band:1-(1-i)/2,offset:Su(n,s,u,a,g),config:c})};if(vn(e.bin)){const i=yr(e,r,{},{offset:Su(l,s,u,a,g)});if(Xr(t))return{[d]:i,[f]:yr(t,r,{},{offset:Su(n,s,u,a,g)})};if(yn(e.bin)&&e.bin.step)return{[d]:i,[f]:{signal:`scale("${r}", ${co(e,{expr:"datum"})} + ${e.bin.step})`,offset:Su(n,s,u,a,g)}}}return void Kn(Yn(l))}({fieldDef:p,fieldDef2:m,channel:t,markDef:l,scaleName:v,band:n,axisTranslate:null!==(s=null==i?void 0:i.get("translate"))&&void 0!==s?s:.5,spacing:nn(t)?Mo("binSpacing",l,a):void 0,reverse:h.get("reverse"),config:a})}return(to(p)&&sr(b)||O)&&!m?function(e,t,n,i){var r;const{markDef:o,encoding:s,config:a,stack:u}=i,l=o.orient,f=i.scaleName(n),d=i.getScaleComponent(n),g=Qt(n),p=Xt(n),m="horizontal"===l&&"y"===n||"vertical"===l&&"x"===n,h=Mo(m?"size":g,o,a,{vgChannel:g});let b;(s.size||void 0!==h)&&(m?b=bu("size",i,{vgChannel:g,defaultValue:h}):Kn(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(o.type)));const v=null!==(r=to(t)?Ir({channel:n,fieldDef:t,markDef:o,stack:u,config:a}):void 0)&&void 0!==r?r:1;b=b||{[g]:Eu(e,g,f,d,a,v)};const y="band"!==(null==d?void 0:d.get("type"))||!("band"in b[g]),x=Au(n,o,a,y?"middle":"top"),O=yu(n,o),w=mr({channel:n,channelDef:t,markDef:o,config:a,scaleName:f,scale:d,stack:u,offset:O,defaultRef:Ou({model:i,defaultPos:"mid",channel:n,scaleName:f,scale:d}),band:y?.5:(1-v)/2});if(g)return Object.assign({[x]:w},b);{const e=Yt(p),t=b[g],n=O?Object.assign(Object.assign({},t),{offset:O}):t;return{[x]:w,[e]:c(w)?[w[0],Object.assign(Object.assign({},w[1]),{offset:n})]:Object.assign(Object.assign({},w),{offset:n})}}}(n,p,t,e):Fu(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function Eu(e,t,n,i,r,o){if(i){const t=i.get("type");if("point"===t||"band"===t){if(void 0!==r[e].discreteBandSize)return{value:r[e].discreteBandSize};if(t===Ji){const e=i.get("range");return hi(e)&&y(e.step)?{value:e.step-2}:{value:Ms-2}}return{scale:n,band:o}}return{value:r[e].continuousBandSize}}const s=Ns(r.view,t),a=ae(r[e].discreteBandSize,s-2);return void 0!==a?{value:a}:void 0}function Su(e,t,n,i,r){if(zt(e))return 0;const o="x"===e||"y2"===e?-t/2:t/2;if(mi(n)||mi(r)||mi(i)){const e=No(n),t=No(r),s=No(i);return{signal:(s?s+" + ":"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${o})`:o)}}return r=r||0,i+(n?-r-o:+r+o)}function $u({channel:e,fieldDef:t,scaleName:n,markDef:i,band:r,offset:o,config:s}){return hr({fieldDef:t,channel:e,markDef:i,ref:xr({scaleName:n,fieldOrDatumDef:t,band:r,offset:o}),config:s})}const Bu=new Set(["aria"]);function _u(e,t){const{fill:n,stroke:i}="include"===t.color?vu(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return vi.reduce((n,i)=>(Bu.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=_o(e[i])),n),{})}(e.markDef,t)),zu(e,"fill",n)),zu(e,"stroke",i)),bu("opacity",e)),bu("fillOpacity",e)),bu("strokeOpacity",e)),bu("strokeWidth",e)),bu("strokeDash",e)),function(e){const{encoding:t,mark:n}=e,i=t.order;return!_e(n)&&io(i)?lu(e,i,"zindex",e=>e):{}}(e)),gu(e)),fu(e,"href")),hu(e))}function zu(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===Mo("invalid",o,i)&&n&&!_e(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&ar(r)&&(t[o]=!0)}return t},{}),r=V(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>vr(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:ln});if(i)return{[t]:[{test:i,value:null},...m(n)]}}return n?{[t]:n}:{}}function Nu(e){const{config:t,markDef:n}=e;if(Mo("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&ar(r)&&(t[o]=!0)}return t},{}),r=V(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>vr(e,t)).join(` ${e} `)}return}(e,{channels:tn});if(t)return{defined:{signal:t}}}return{}}function Pu(e,t){if(void 0!==t)return{[e]:_o(t)}}const Mu="voronoi",Tu={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Mu)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(_e(o))return Kn(`The "nearest" transform is not supported for ${o} marks.`),n;const s={name:e.getName(Mu),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},gu(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((t,n)=>{var i;const r=null!==(i=t.name)&&void 0!==i?i:"";r===e.component.mark[0].name?a=n:r.indexOf(Mu)>=0&&(u=!0)}),u||n.splice(a+1,0,s),n}};class Lu{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.indexOf(e)>-1?Kn("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class qu extends Lu{constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}clone(){const e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash="Output "+function(e){const t=++ue;return e?String(e)+t:t}()),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class Ru extends Lu{constructor(e,t){super(e),this.formula=t}clone(){return new Ru(null,B(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{field:r,timeUnit:o}=n,s=xg(t)?t.encoding[Xt(i)]:void 0,a=xg(t)&&Gr(i,n,s,t.stack,t.markDef,t.config);if(o){const t=co(n,{forAs:!0});e[P({as:t,field:r,timeUnit:o})]=Object.assign({as:t,field:r,timeUnit:o},a?{band:!0}:{})}return e},{});return G(n)?null:new Ru(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t),{timeUnit:i}=n,r=j(n,["timeUnit"]),o=pi(i),s=Object.assign(Object.assign({},r),{timeUnit:o});return new Ru(e,{[P(s)]:s})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of Y(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(J(this.formula).map(e=>e.as))}dependentFields(){return new Set(J(this.formula).map(e=>e.field))}hash(){return"TimeUnit "+P(this.formula)}assemble(){const e=[];for(const t of J(this.formula)){const{field:n,as:i,timeUnit:r}=t,o=pi(r),{unit:s,utc:a}=o,u=j(o,["unit","utc"]);e.push(Object.assign(Object.assign(Object.assign(Object.assign({field:ie(n),type:"timeunit"},s?{units:li(s)}:{}),a?{timezone:"utc"}:{}),u),{as:[i,i+"_end"]}))}return e}}const Wu="_tuple_fields";class Uu{constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}const Hu={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Fs(e.bind),parse:(e,t,n,i)=>{i.on||delete t.events,i.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,s=t.init&&t.init[0],a=Tu.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{var u,c;const l=Q(`${i}_${e.field}`);n.filter(e=>e.name===l).length||n.unshift(Object.assign(Object.assign({name:l},s?{init:uc(s[r])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${O(e.field)}] : null`}]:[],bind:null!==(c=null!==(u=o[e.field])&&void 0!==u?u:o[e.channel])&&void 0!==c?c:o}))}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter(e=>e.name===i+yc)[0],s=i+Wu,a=r.items.map(e=>Q(`${i}_${e.field}`)),u=a.map(e=>e+" !== null").join(" && ");return a.length&&(o.update=`${u} ? {fields: ${s}, values: [${a.join(", ")}]} : null`),delete o.value,delete o.on,n}},Iu="_toggle",Gu={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Iu,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+yc,i=t.name+Iu;return`${i} ? null : ${n}, `+("global"===t.resolve?i+" ? null : true, ":`${i} ? null : {unit: ${Ac(e)}}, `)+`${i} ? ${n} : null`}},Vu={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=x(n.clear)?su(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>{if(Hu.has(t))for(const e of t.project.items){const i=n.findIndex(n=>n.name===Q(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex(t=>t.name===e.signals.visual);if(i(t,"[0, 0]"),-1===t){i(n.findIndex(t=>t.name===e.signals.data),"null")}}else{let e=n.findIndex(e=>e.name===t.name+yc);i(e,"null"),Gu.has(t)&&(e=n.findIndex(e=>e.name===t.name+Iu),i(e,"false"))}return n}},Ju={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!fn(r))continue;const o=e.getScaleComponent(r),s=o?o.get("type"):void 0;if(!o||!ar(s)){Kn("Scale bindings are currently only supported for scales with unbinned, continuous domains.");continue}const a={selection:t.name,field:i.field};o.set("selectionExtent",a,!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||Xu(e)||0===i.length)return n;const r=n.filter(e=>e.name===t.name)[0];let o=r.update;if(o.indexOf(Oc)>=0)r.update=`{${i.map(e=>`${O(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of i){const t=`${O(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!Xu(e))for(const e of t.scales){const t=n.filter(t=>t.name===e.signals.data)[0];t.push="outer",delete t.value,delete t.update}return n}};function Yu(e,t){return`domain(${O(e.scaleName(t))})`}function Xu(e){var t;return e.parent&&jg(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:Xu(e.parent.parent))}const Qu={has:e=>{const t="global"===e.resolve&&e.bind&&Fs(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==As;return t&&!n&&Kn("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n,i)=>{var r;if(i.on||delete t.events,i.clear||delete t.clear,i.on||i.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=m(null!==(r=n.filter)&&void 0!==r?r:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=ks(t.bind)?t.bind.legend:"click",s=x(o)?su(o,"view"):m(o);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=ks(t.bind)&&t.bind.legend,o=e=>t=>{const n=B(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const s=Q(e.field)+"_legend",a=`${i}_${s}`;if(0===n.filter(e=>e.name===a).length){const e=r.merge.map(o(s+"_symbols")).concat(r.merge.map(o(s+"_labels"))).concat(r.merge.map(o(s+"_entries")));n.unshift(Object.assign(Object.assign({name:a},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:"!event.item || !datum ? null : "+a,force:!0}]}))}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+yc),s=i+Wu,a=r.items.filter(e=>e.hasLegend).map(e=>Q(`${i}_${Q(e.field)}_legend`)),u=`${a.map(e=>e+" !== null").join(" && ")} ? {fields: ${s}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?o.on.push({events:a.map(e=>({signal:e})),update:u}):a.length>0&&(o.update=u,delete o.value,delete o.on);const c=n.find(e=>e.name===i+Iu),l=ks(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push(Object.assign(Object.assign({},c.on[0]),{events:l})):c.on[0].events=l),n}};const Ku="_translate_anchor",Zu="_translate_delta",ec={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Ju.has(t),o=i+Ku,{x:s,y:a}=t.project.hasChannel;let u=su(t.translate,"scope");return r||(u=u.map(e=>(e.between[0].markname=i+fc,e))),n.push({name:o,value:{},on:[{events:u.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==s?", extent_x: "+(r?Yu(e,nt):`slice(${s.signals.visual})`):"")+(void 0!==a?", extent_y: "+(r?Yu(e,it):`slice(${a.signals.visual})`):"")+"}"}]},{name:i+Zu,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==s&&tc(e,t,s,"width",n),void 0!==a&&tc(e,t,a,"height",n),n}};function tc(e,t,n,i,r){var o;const s=t.name,a=s+Ku,u=s+Zu,c=n.channel,l=Ju.has(t),f=r.filter(e=>e.name===n.signals[l?"data":"visual"])[0],d=e.getSizeSignalRef(i).signal,g=e.getScaleComponent(c),p=g.get("type"),m=`${a}.extent_${c}`,h=`${l?"log"===p?"panLog":"pow"===p?"panPow":"panLinear":"panLinear"}(${m}, ${`${l&&c===nt?"-":""}${u}.${c} / `+(l?""+d:`span(${m})`)}`+(l&&"pow"===p?", "+(null!==(o=g.get("exponent"))&&void 0!==o?o:1):"")+")";f.on.push({events:{signal:u},update:l?h:`clampRange(${h}, 0, ${d})`})}const nc="_zoom_anchor",ic="_zoom_delta",rc={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Ju.has(t),o=i+ic,{x:s,y:a}=t.project.hasChannel,u=O(e.scaleName(nt)),c=O(e.scaleName(it));let l=su(t.zoom,"scope");return r||(l=l.map(e=>(e.markname=i+fc,e))),n.push({name:i+nc,on:[{events:l,update:r?"{"+[u?`x: invert(${u}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter(e=>!!e).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:l,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&oc(e,t,s,"width",n),void 0!==a&&oc(e,t,a,"height",n),n}};function oc(e,t,n,i,r){var o;const s=t.name,a=n.channel,u=Ju.has(t),c=r.filter(e=>e.name===n.signals[u?"data":"visual"])[0],l=e.getSizeSignalRef(i).signal,f=e.getScaleComponent(a),d=f.get("type"),g=u?Yu(e,a):c.name,p=s+ic,m=`${u?"log"===d?"zoomLog":"pow"===d?"zoomPow":"zoomLinear":"zoomLinear"}(${g}, ${`${s}${nc}.${a}`}, ${p}`+(u&&"pow"===d?", "+(null!==(o=f.get("exponent"))&&void 0!==o?o:1):"")+")";c.on.push({events:{signal:p},update:u?m:`clampRange(${m}, 0, ${l})`})}const sc=[{has:()=>!0,parse:(e,t,n)=>{var i,r,o;const s=t.name,a=null!==(i=t.project)&&void 0!==i?i:t.project=new Uu,u={},c={},l=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=Q(`${s}_${n}`);for(let e=1;l.has(i);e++)i=Q(`${s}_${n}_${e}`);return l.add(i),{[t]:i}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of m(n.init))for(const i of V(e))Ht[i]?(n.encodings||(n.encodings=[])).push(i):"interval"===n.type?(Kn('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(i);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!==(r=n.fields)&&void 0!==r?r:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),a.items.push(t),a.hasField[e]=t}for(const i of null!==(o=n.encodings)&&void 0!==o?o:[]){const n=e.fieldDef(i);if(n){let r=n.field;if(n.aggregate){Kn(En(i,n.aggregate));continue}if(!r){Kn(Cn(i));continue}if(n.timeUnit){r=e.vgField(i);const t={timeUnit:n.timeUnit,as:r,field:n.field};c[P(t)]=t}if(!u[r]){let o="E";if("interval"===t.type){ar(e.getScaleComponent(i).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const s={field:r,channel:i,type:o};s.signals=Object.assign(Object.assign({},f(s,"data")),f(s,"visual")),a.items.push(u[r]=s),a.hasField[r]=a.hasChannel[i]=u[r]}}else Kn(Cn(i))}if(n.init){const e=e=>a.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const i=m(n.init);t.init=i.map(e)}}G(c)||(a.timeUnit=new Ru(null,c))},signals:(e,t,n)=>{const i=t.name+Wu;return n.filter(e=>e.name===i).length>0?n:n.concat({name:i,value:t.project.items.map(e=>{const t=j(e,["signals","hasLegend"]);return t.field=ie(t.field),t})})}},Gu,Ju,Qu,ec,rc,Hu,Tu,Vu];function ac(e,t){for(const n of sc)n.has(e)&&t(n)}function uc(e,t=!0,n=a){if(c(e)){const i=e.map(e=>uc(e,t,n));return t?`[${i.join(", ")}]`:i}return Zn(e)?n(t?oi(e):function(e){const t=ri(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(JSON.stringify(e)):e}function cc(e,t){return jc(e,(n,i)=>{t=i.marks?i.marks(e,n,t):t,ac(n,i=>{i.marks&&(t=i.marks(e,n,t))})}),t}function lc(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const fc="_brush",dc="_scale_trigger",gc={signals:(e,t)=>{const n=t.name,i=n+Wu,r=Ju.has(t),o=[],s=[],a=[];if(t.translate&&!r){const e="!event.item || event.item.mark.name !== "+O(n+fc);pc(t,(t,n)=>{var i;const r=m(null!==(i=n.between[0].filter)&&void 0!==i?i:n.between[0].filter=[]);return r.indexOf(e)<0&&r.push(e),t})}t.project.items.forEach((n,i)=>{const r=n.channel;if(r!==nt&&r!==it)return void Kn("Interval selections only support x and y encoding channels.");const u=t.init?t.init[i]:null,c=function(e,t,n,i){const r=n.channel,o=n.signals.visual,s=n.signals.data,a=Ju.has(t),u=O(e.scaleName(r)),c=e.getScaleComponent(r),l=c?c.get("type"):void 0,f=e=>`scale(${u}, ${e})`,d=e.getSizeSignalRef(r===nt?"width":"height").signal,g=r+"(unit)",p=pc(t,(e,t)=>[...e,{events:t.between[0],update:`[${g}, ${g}]`},{events:t,update:`[${o}[0], clamp(${g}, 0, ${d})]`}]);return p.push({events:{signal:t.name+dc},update:ar(l)?`[${f(s+"[0]")}, ${f(s+"[1]")}]`:"[0, 0]"}),a?[{name:s,on:[]}]:[Object.assign(Object.assign({name:o},i?{init:uc(i,!0,f)}:{value:[]}),{on:p}),Object.assign(Object.assign({name:s},i?{init:uc(i)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${u}, ${o})`}]})]}(e,t,n,u),l=n.signals.data,f=n.signals.visual,d=O(e.scaleName(r)),g=ar(e.getScaleComponent(r).get("type"))?"+":"";o.push(...c),s.push(l),a.push({scaleName:e.scaleName(r),expr:`(!isArray(${l}) || (${g}invert(${d}, ${f})[0] === ${g}${l}[0] && ${g}invert(${d}, ${f})[1] === ${g}${l}[1]))`})}),r||o.push({name:n+dc,value:{},on:[{events:a.map(e=>({scale:e.scaleName})),update:a.map(e=>e.expr).join(" && ")+` ? ${n+dc} : {}`}]});const u=t.init,c=`unit: ${Ac(e)}, fields: ${i}, values`;return o.concat(Object.assign(Object.assign({name:n+yc},u?{init:`{${c}: ${uc(u)}}`}:{}),{on:[{events:[{signal:s.join(" || ")}],update:s.join(" && ")+` ? {${c}: [${s}]} : null`}]}))},modifyExpr:(e,t)=>t.name+yc+", "+("global"===t.resolve?"true":`{unit: ${Ac(e)}}`),marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=r&&r.signals.visual,a=o&&o.signals.visual,u=`data(${O(t.name+vc)})`;if(Ju.has(t))return n;const c={x:void 0!==r?{signal:s+"[0]"}:{value:0},y:void 0!==o?{signal:a+"[0]"}:{value:0},x2:void 0!==r?{signal:s+"[1]"}:{field:{group:"width"}},y2:void 0!==o?{signal:a+"[1]"}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of V(c))c[t]=[Object.assign({test:`${u}.length && ${u}[0].unit === ${Ac(e)}`},c[t]),{value:0}];const l=t.mark,{fill:f,fillOpacity:d,cursor:g}=l,p=j(l,["fill","fillOpacity","cursor"]),m=V(p).reduce((e,t)=>(e[t]=[{test:[void 0!==r&&`${s}[0] !== ${s}[1]`,void 0!==o&&`${a}[0] !== ${a}[1]`].filter(e=>e).join(" && "),value:p[t]},{value:null}],e),{});return[{name:i+fc+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:c}},...n,{name:i+fc,type:"rect",clip:!0,encode:{enter:Object.assign(Object.assign({},g?{cursor:{value:g}}:{}),{fill:{value:"transparent"}}),update:Object.assign(Object.assign({},c),m)}}]}};function pc(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(Kn(n+" is not an ordered event stream for interval selections."),e),[])}function mc(e,t){const n=t.name,i=n+Wu,r=t.project,o="(item().isVoronoi ? datum.datum : datum)",s=r.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${O(e.vgField(t.channel,{}))}], ${o}[${O(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${O(t.field)}]`}).join(", "),a=`unit: ${Ac(e)}, fields: ${i}, values`,u=t.events;return[{name:n+yc,on:u?[{events:u,update:`datum && item().mark.marktype !== 'group' ? {${a}: [${s}]} : null`,force:!0}]:[]}]}const hc={signals:mc,modifyExpr:(e,t)=>t.name+yc+", "+("global"===t.resolve?"null":`{unit: ${Ac(e)}}`)},bc={signals:mc,modifyExpr:(e,t)=>t.name+yc+", "+("global"===t.resolve?"true":`{unit: ${Ac(e)}}`)},vc="_store",yc="_tuple",xc="_modify",Oc="vlSelectionResolve",wc={single:bc,multi:hc,interval:gc};function jc(e,t){const n=e.component.selection;if(n)for(const e of J(n)){if(!0===t(e,wc[e.type]))break}}function Ac(e,{escape:t}={escape:!0}){let n=t?O(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!Og(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of qt)e[t]&&(n+=` + '__facet_${t}_' + (facet[${O(i.vgField(t))}])`)}return n}function Dc(e){let t=!1;return jc(e,e=>{t=t||e.project.items.some(e=>e.field===As)}),t}const Fc="RawCode",kc="Literal",Cc="Property",Ec="Identifier",Sc="ArrayExpression",$c="BinaryExpression",Bc="CallExpression",_c="ConditionalExpression",zc="LogicalExpression",Nc="MemberExpression",Pc="ObjectExpression",Mc="UnaryExpression";function Tc(e){this.type=e}var Lc,qc,Rc,Wc,Uc;Tc.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case Sc:return e.elements;case $c:case zc:return[e.left,e.right];case Bc:return[e.callee].concat(e.arguments);case _c:return[e.test,e.consequent,e.alternate];case Nc:return[e.object,e.property];case Pc:return e.properties;case Cc:return[e.key,e.value];case Mc:return[e.argument];case Ec:case kc:case Fc:default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(Lc={})[1]="Boolean",Lc[2]="<end>",Lc[3]="Identifier",Lc[4]="Keyword",Lc[5]="Null",Lc[6]="Numeric",Lc[7]="Punctuator",Lc[8]="String",Lc[9]="RegularExpression";var Hc="Identifier",Ic="Unexpected token %0",Gc="Invalid regular expression",Vc="Invalid regular expression: missing /",Jc="Octal literals are not allowed in strict mode.",Yc="ILLEGAL",Xc="Disabled.",Qc=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Kc=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Zc(e,t){if(!e)throw new Error("ASSERT: "+t)}function el(e){return e>=48&&e<=57}function tl(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function nl(e){return"01234567".indexOf(e)>=0}function il(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function rl(e){return 10===e||13===e||8232===e||8233===e}function ol(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Qc.test(String.fromCharCode(e))}function sl(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Kc.test(String.fromCharCode(e))}var al={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function ul(){for(var e;Rc<Wc&&(il(e=qc.charCodeAt(Rc))||rl(e));)++Rc}function cl(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)Rc<Wc&&tl(qc[Rc])?(i=qc[Rc++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):Dl({},Ic,Yc);return String.fromCharCode(r)}function ll(){var e,t,n,i;for(t=0,"}"===(e=qc[Rc])&&Dl({},Ic,Yc);Rc<Wc&&tl(e=qc[Rc++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&Dl({},Ic,Yc),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function fl(){var e,t;for(e=qc.charCodeAt(Rc++),t=String.fromCharCode(e),92===e&&(117!==qc.charCodeAt(Rc)&&Dl({},Ic,Yc),++Rc,(e=cl("u"))&&"\\"!==e&&ol(e.charCodeAt(0))||Dl({},Ic,Yc),t=e);Rc<Wc&&sl(e=qc.charCodeAt(Rc));)++Rc,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==qc.charCodeAt(Rc)&&Dl({},Ic,Yc),++Rc,(e=cl("u"))&&"\\"!==e&&sl(e.charCodeAt(0))||Dl({},Ic,Yc),t+=e);return t}function dl(){var e,t;return e=Rc,{type:1===(t=92===qc.charCodeAt(Rc)?fl():function(){var e,t;for(e=Rc++;Rc<Wc;){if(92===(t=qc.charCodeAt(Rc)))return Rc=e,fl();if(!sl(t))break;++Rc}return qc.slice(e,Rc)}()).length?3:al.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:Rc}}function gl(){var e,t,n,i,r=Rc,o=qc.charCodeAt(Rc),s=qc[Rc];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Rc,{type:7,value:String.fromCharCode(o),start:r,end:Rc};default:if(61===(e=qc.charCodeAt(Rc+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Rc+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:Rc};case 33:case 61:return Rc+=2,61===qc.charCodeAt(Rc)&&++Rc,{type:7,value:qc.slice(r,Rc),start:r,end:Rc}}}return">>>="===(i=qc.substr(Rc,4))?{type:7,value:i,start:r,end:Rc+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:Rc+=3}:s===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(s)>=0||"=>"===t?{type:7,value:t,start:r,end:Rc+=2}:"<>=!+-*%&|^/".indexOf(s)>=0?{type:7,value:s,start:r,end:++Rc}:void Dl({},Ic,Yc)}function pl(){var e,t,n;if(Zc(el((n=qc[Rc]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Rc,e="","."!==n){if(e=qc[Rc++],n=qc[Rc],"0"===e){if("x"===n||"X"===n)return++Rc,function(e){for(var t="";Rc<Wc&&tl(qc[Rc]);)t+=qc[Rc++];return 0===t.length&&Dl({},Ic,Yc),ol(qc.charCodeAt(Rc))&&Dl({},Ic,Yc),{type:6,value:parseInt("0x"+t,16),start:e,end:Rc}}(t);if(nl(n))return function(e){for(var t="0"+qc[Rc++];Rc<Wc&&nl(qc[Rc]);)t+=qc[Rc++];return(ol(qc.charCodeAt(Rc))||el(qc.charCodeAt(Rc)))&&Dl({},Ic,Yc),{type:6,value:parseInt(t,8),octal:!0,start:e,end:Rc}}(t);n&&el(n.charCodeAt(0))&&Dl({},Ic,Yc)}for(;el(qc.charCodeAt(Rc));)e+=qc[Rc++];n=qc[Rc]}if("."===n){for(e+=qc[Rc++];el(qc.charCodeAt(Rc));)e+=qc[Rc++];n=qc[Rc]}if("e"===n||"E"===n)if(e+=qc[Rc++],"+"!==(n=qc[Rc])&&"-"!==n||(e+=qc[Rc++]),el(qc.charCodeAt(Rc)))for(;el(qc.charCodeAt(Rc));)e+=qc[Rc++];else Dl({},Ic,Yc);return ol(qc.charCodeAt(Rc))&&Dl({},Ic,Yc),{type:6,value:parseFloat(e),start:t,end:Rc}}function ml(){var e,t,n,i;return Uc=null,ul(),e=Rc,t=function(){var e,t,n,i;for(Zc("/"===(e=qc[Rc]),"Regular expression literal must start with a slash"),t=qc[Rc++],n=!1,i=!1;Rc<Wc;)if(t+=e=qc[Rc++],"\\"===e)rl((e=qc[Rc++]).charCodeAt(0))&&Dl({},Vc),t+=e;else if(rl(e.charCodeAt(0)))Dl({},Vc);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||Dl({},Vc),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";Rc<Wc&&sl((e=qc[Rc]).charCodeAt(0));)++Rc,"\\"===e&&Rc<Wc?Dl({},Ic,Yc):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&Dl({},Gc,n),{value:n,literal:t}}(),i=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(e,t)=>{if(parseInt(t,16)<=1114111)return"x";Dl({},Gc)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Dl({},Gc)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:Rc}}function hl(){var e;return ul(),Rc>=Wc?{type:2,start:Rc,end:Rc}:ol(e=qc.charCodeAt(Rc))?dl():40===e||41===e||59===e?gl():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(Zc("'"===(e=qc[Rc])||'"'===e,"String literal must starts with a quote"),t=Rc,++Rc;Rc<Wc;){if((n=qc[Rc++])===e){e="";break}if("\\"===n)if((n=qc[Rc++])&&rl(n.charCodeAt(0)))"\r"===n&&"\n"===qc[Rc]&&++Rc;else switch(n){case"u":case"x":"{"===qc[Rc]?(++Rc,r+=ll()):r+=cl(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:nl(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),Rc<Wc&&nl(qc[Rc])&&(o=!0,i=8*i+"01234567".indexOf(qc[Rc++]),"0123".indexOf(n)>=0&&Rc<Wc&&nl(qc[Rc])&&(i=8*i+"01234567".indexOf(qc[Rc++]))),r+=String.fromCharCode(i)):r+=n}else{if(rl(n.charCodeAt(0)))break;r+=n}}return""!==e&&Dl({},Ic,Yc),{type:8,value:r,octal:o,start:t,end:Rc}}():46===e?el(qc.charCodeAt(Rc+1))?pl():gl():el(e)?pl():gl()}function bl(){var e;return Rc=(e=Uc).end,Uc=hl(),Rc=e.end,e}function vl(){var e;e=Rc,Uc=hl(),Rc=e}function yl(e,t,n){var i=new Tc("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function xl(e,t){var n=new Tc("CallExpression");return n.callee=e,n.arguments=t,n}function Ol(e){var t=new Tc(Hc);return t.name=e,t}function wl(e){var t=new Tc("Literal");return t.value=e.value,t.raw=qc.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function jl(e,t,n){var i=new Tc("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function Al(e,t,n){var i=new Tc("Property");return i.key=t,i.value=n,i.kind=e,i}function Dl(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(e,t)=>(Zc(t<i.length,"Message reference must be in range"),i[t]));throw(n=new Error(r)).index=Rc,n.description=r,n}function Fl(e){2===e.type&&Dl(e,"Unexpected end of input"),6===e.type&&Dl(e,"Unexpected number"),8===e.type&&Dl(e,"Unexpected string"),3===e.type&&Dl(e,"Unexpected identifier"),4===e.type&&Dl(e,"Unexpected reserved word"),Dl(e,Ic,e.value)}function kl(e){var t=bl();7===t.type&&t.value===e||Fl(t)}function Cl(e){return 7===Uc.type&&Uc.value===e}function El(e){return 4===Uc.type&&Uc.value===e}function Sl(){var e=[];for(Rc=Uc.start,kl("[");!Cl("]");)Cl(",")?(bl(),e.push(null)):(e.push(Wl()),Cl("]")||kl(","));return bl(),function(e){var t=new Tc("ArrayExpression");return t.elements=e,t}(e)}function $l(){var e;return Rc=Uc.start,8===(e=bl()).type||6===e.type?(e.octal&&Dl(e,Jc),wl(e)):Ol(e.value)}function Bl(){var e,t,n;return Rc=Uc.start,3===(e=Uc).type?(n=$l(),kl(":"),Al("init",n,Wl())):2!==e.type&&7!==e.type?(t=$l(),kl(":"),Al("init",t,Wl())):void Fl(e)}function _l(){var e,t,n=[],i={},r=String;for(Rc=Uc.start,kl("{");!Cl("}");)t="$"+((e=Bl()).key.type===Hc?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?Dl({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),Cl("}")||kl(",");return kl("}"),function(e){var t=new Tc("ObjectExpression");return t.properties=e,t}(n)}var zl={if:1};function Nl(){var e,t,n;if(Cl("("))return function(){var e;return kl("("),e=Ul(),kl(")"),e}();if(Cl("["))return Sl();if(Cl("{"))return _l();if(e=Uc.type,Rc=Uc.start,3===e||zl[Uc.value])n=Ol(bl().value);else if(8===e||6===e)Uc.octal&&Dl(Uc,Jc),n=wl(bl());else{if(4===e)throw new Error(Xc);1===e?((t=bl()).value="true"===t.value,n=wl(t)):5===e?((t=bl()).value=null,n=wl(t)):Cl("/")||Cl("/=")?(n=wl(ml()),vl()):Fl(bl())}return n}function Pl(){var e=[];if(kl("("),!Cl(")"))for(;Rc<Wc&&(e.push(Wl()),!Cl(")"));)kl(",");return kl(")"),e}function Ml(){return kl("."),Rc=Uc.start,function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e=bl())||Fl(e),Ol(e.value);var e}function Tl(){var e;return kl("["),e=Ul(),kl("]"),e}function Ll(){var e=function(){var e;for(e=Nl();;)if(Cl("."))e=jl(".",e,Ml());else if(Cl("("))e=xl(e,Pl());else{if(!Cl("["))break;e=jl("[",e,Tl())}return e}();if(7===Uc.type&&(Cl("++")||Cl("--")))throw new Error(Xc);return e}function ql(){var e,t,n,i,r;if(7!==Uc.type&&4!==Uc.type)t=Ll();else{if(Cl("++")||Cl("--"))throw new Error(Xc);if(Cl("+")||Cl("-")||Cl("~")||Cl("!"))e=bl(),t=ql(),n=e.value,i=t,(r=new Tc("UnaryExpression")).operator=n,r.argument=i,r.prefix=!0,t=r;else{if(El("delete")||El("void")||El("typeof"))throw new Error(Xc);t=Ll()}}return t}function Rl(e){var t=0;if(7!==e.type&&4!==e.type)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Wl(){var e,t;return e=function(){var e,t,n,i,r,o,s,a,u,c;if(e=Uc,u=ql(),0===(r=Rl(i=Uc)))return u;for(i.prec=r,bl(),t=[e,Uc],o=[u,i,s=ql()];(r=Rl(Uc))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),t.pop(),n=yl(a,u,s),o.push(n);(i=bl()).prec=r,o.push(i),t.push(Uc),n=ql(),o.push(n)}for(n=o[c=o.length-1],t.pop();c>1;)t.pop(),n=yl(o[c-1].value,o[c-2],n),c-=2;return n}(),Cl("?")&&(bl(),t=Wl(),kl(":"),e=function(e,t,n){var i=new Tc("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Wl())),e}function Ul(){var e=Wl();if(Cl(","))throw new Error(Xc);return e}function Hl(e){const t=function(e){Rc=0,Wc=(qc=e).length,Uc=null,vl();var t=Ul();if(2!==Uc.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class Il extends Lu{constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Jl(this.model,this.filter,this),this._dependentFields=Hl(this.expr)}clone(){return new Il(null,this.model,B(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return"Filter "+this.expr}}function Gl(e,t,n,i="datum"){const r=[];const o=K(t,(function(t){const o=Q(t),s=e.getSelectionComponent(o,t),a=O(o+vc);if(s.project.timeUnit){const t=null!=n?n:e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}return"none"!==s.empty&&r.push(a),`vlSelectionTest(${a}, ${i}`+("global"===s.resolve?")":`, ${O(s.resolve)})`)}));return(r.length?"!("+r.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Vl(e,t){const n=t.encoding;let i=t.field;if(n||i){if(n&&!i){const r=e.project.items.filter(e=>e.channel===n);!r.length||r.length>1?(i=e.project.items[0].field,Kn((r.length?"Multiple ":"No ")+`matching ${O(n)} encoding found for selection ${O(t.selection)}. `+`Using "field": ${O(i)}.`)):i=r[0].field}}else i=e.project.items[0].field,e.project.items.length>1&&Kn(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${O(i)}.`);return`${e.name}[${O(i)}]`}function Jl(e,t,n){return K(t,t=>x(t)?t:function(e){return null==e?void 0:e.selection}(t)?Gl(e,t.selection,n):Si(t))}function Yl(e,t,n,i){var r,o,s;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(o=e.encode[t])&&void 0!==o?o:{},e.encode[t].update=null!==(s=e.encode[t].update)&&void 0!==s?s:{},e.encode[t].update[n]=i}function Xl(e,t,n,i={header:!1}){var r,o;const s=e.combine(),{disable:a,orient:u,scale:l,labelExpr:f,title:d,zindex:g}=s,p=j(s,["disable","orient","scale","labelExpr","title","zindex"]);if(!a){for(const e in p){const n=pe[e],i=p[e];if(n&&n!==t&&"both"!==n)delete p[e];else if(de(i)){const{condition:t}=i,n=j(i,["condition"]),r=m(t),o=fe[e];if(o){const{vgProp:t,part:i}=o;Yl(p,i,t,[...r.map(e=>{const{test:t}=e,n=j(e,["test"]);return Object.assign({test:Jl(null,t)},n)}),n]),delete p[e]}else if(null===o){const t={signal:r.map(e=>{const{test:t}=e,n=j(e,["test"]);return`${Jl(null,t)} ? ${zo(n)} : `}).join("")+zo(n)};p[e]=t}}else if(mi(i)){const t=fe[e];if(t){const{vgProp:n,part:r}=t;Yl(p,r,n,i),delete p[e]}}}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode=Object.assign({},e?{grid:e}:{}),G(p.encode)&&delete p.encode}return Object.assign(Object.assign({scale:l,orient:u},p),{domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:ae(g,0)})}{if(!i.header&&e.mainExtracted)return;if(void 0!==f){let e=f;(null===(o=null===(r=p.encode)||void 0===r?void 0:r.labels)||void 0===o?void 0:o.update)&&mi(p.encode.labels.update.text)&&(e=re(f,"datum.label",p.encode.labels.update.text.signal)),Yl(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of ge)e.hasAxisPart(t)||delete p.encode[t];G(p.encode)&&delete p.encode}const t=function(e,t){if(e)return c(e)&&!Bo(e)?e.map(e=>vo(e,t)).join(", "):e}(d,n);return Object.assign(Object.assign(Object.assign(Object.assign({scale:l,orient:u,grid:!1},t?{title:t}:{}),p),!1===n.aria?{aria:!1}:{}),{zindex:ae(g,0)})}}}function Ql(e){const{axes:t}=e.component,n=[];for(const i of tn)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}const Kl={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},Zl={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},ef=V(Kl),tf=V(Zl);function nf(e,t,n,i){return Object.assign.apply(null,[{},...e.map(e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},s=new Set([...V(r),...V(o)]),a={};for(const t of s.values())a[t]={signal:`${i.signal} === "${e}" ? ${No(r[t])} : ${No(o[t])}`};return a}return t[e]})])}function rf(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:t in nr?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[];const o="x"===e?"axisX":"axisY",s=mi(n)?"axisOrient":"axis"+ee(n),a=[...r,...r.map(e=>o+e.substr(4))],u=["axis",s,o];return{vlOnlyAxisConfig:nf(a,i,e,n),vgAxisConfig:nf(u,i,e,n),axisConfigStyle:of([...u,...a],i)}}function of(e,t){var n;const i=[{}];for(const r of e){let e=null===(n=t[r])||void 0===n?void 0:n.style;if(e){e=m(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function sf(e,t,n,i={}){var r;const o=qo(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null===(r=i[t])||void 0===r?void 0:r[e]))return{configFrom:t,configValue:i[t][e]};return{}}const af={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:n})=>{const{format:i,formatType:r}=n;return Cr(e,e.type,i,r,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return Er(i,t,n)},grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>{var i;return(!Xr(e)||!vn(e.bin))&&(null!==(i=t.grid)&&void 0!==i?i:function(e,t){return!sr(e)&&Xr(t)&&!bn(null==t?void 0:t.bin)}(n,e))},gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||lf(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||cf(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>{var i;return null!==(i=e.labelFlush)&&void 0!==i?i:function(e,t){if("x"===t&&T(["quantitative","temporal"],e))return!0;return}(t.type,n)},labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{var i;return null!==(i=e.labelOverlap)&&void 0!==i?i:function(e,t,n,i){if(n&&!l(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t||"greedy";return}(t.type,n,Xr(t)&&!!t.timeUnit,Xr(t)?t.sort:void 0)},orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{var o;const s="x"===e?"width":"y"===e?"height":void 0,a=s?t.getSizeSignalRef(s):void 0;return null!==(o=n.tickCount)&&void 0!==o?o:function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!sr(t)&&"log"!==t){if(Xr(e)){if(bn(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&T(["month","hours","day","quarter"],null===(r=pi(e.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=ff(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",s=t.fieldDef(o);return Wo(r?[Ur(r)]:[],Xr(s)?[Ur(s)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(c(n))return Eo(t,n);if(mi(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>{var i;return null!==(i=e.zindex)&&void 0!==i?i:function(e,t){if("rect"===e&&lo(t))return 1;return 0}(n,t)}};function uf(e){return`(((${e.signal} % 360) + 360) % 360)`}function cf(e,t,n,i){if(void 0!==e){if("x"===n){if(mi(e)){const n=uf(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${mi(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(mi(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(mi(e)){const n=uf(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${mi(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(mi(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function lf(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(mi(e)){const n=uf(e);return{signal:`(${r?"("+n+" + 90)":n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${mi(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(mi(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${t.signal} ${n} "${o}"`+' ? "left" : "right"'}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function ff(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,s=r?r.title:void 0;return o&&s?Uo(o,s):o||(s||(void 0!==o?o:void 0!==s?s:void 0))}class df extends Lu{constructor(e,t){super(e),this.transform=t,this._dependentFields=Hl(this.transform.calculate)}clone(){return new df(null,B(this.transform))}static parseAllForSortIndex(e,t){return t.forEachFieldDef((t,n)=>{if(ro(t)&&Lr(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,s=o.map((e,t)=>`${Si({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+o.length;e=new df(e,{calculate:s,as:gf(t,n,{forAs:!0})})}}),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return"Calculate "+P(this.transform)}}function gf(e,t,n){return co(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function pf(e,t){return T(["top","bottom"],t)?"column":T(["left","right"],t)||"row"===e?"row":"column"}function mf(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return ae(((null==t?void 0:t.header)||{})[e],r[e],n.header[e])}function hf(e,t,n,i){const r={};for(const o of e){const e=mf(o,t,n,i);void 0!==e&&(r[o]=e)}return r}const bf=["row","column"],vf=["header","footer"];function yf(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:s,titleOrient:a}=hf(["titleAnchor","titleAngle","titleOrient"],r,i,t),u=pf(t,a),c=ce(s);return{name:t+"-title",type:"group",role:u+"-title",title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),Of(c,u)),xf(u,c,o)),Cf(i,r,t,ef,Kl))}}function xf(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=lf(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function Of(e,t){const n=cf(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function wf(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of vf)if(n[r])for(const o of n[r]){const s=Df(e,t,r,n,o);null!=s&&i.push(s)}return i}function jf(e,t){var n;const{sort:i}=e;return Tr(i)?{field:co(i,{expr:"datum"}),order:null!==(n=i.order)&&void 0!==n?n:"ascending"}:c(i)?{field:gf(e,t,{expr:"datum"}),order:"ascending"}:{field:co(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function Af(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:s,labelOrient:a,labelExpr:u}=hf(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),c=Dr({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,l=pf(t,a);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:u?re(re(u,"datum.label",c),"datum.value",co(e,{expr:"parent"})):c}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),Of(o,l)),xf(l,o,s)),Cf(n,e,t,tf,Zl))}function Df(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:s}=i,a=e.config?e.config:void 0;if(s&&r.labels){const{labelOrient:e}=hf(["labelOrient"],s,a,t);("row"===t&&!T(["top","bottom"],e)||"column"===t&&!T(["left","right"],e))&&(o=Af(s,t,a))}const u=Og(e)&&!qr(e.facet),c=r.axes,l=(null==c?void 0:c.length)>0;if(o||l){const a="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:jf(s,t)}:{}),l&&u?{from:{data:e.getName("facet_domain_"+t)}}:{}),o?{title:o}:{}),r.sizeSignal?{encode:{update:{[a]:r.sizeSignal}}}:{}),l?{axes:c}:{})}}return null}const Ff={column:{start:0,end:1},row:{start:1,end:0}};function kf(e,t){return Ff[t][e]}function Cf(e,t,n,i,r){const o={};for(const s of i){if(!r[s])continue;const i=mf(s,t,e,n);void 0!==i&&(o[r[s]]=i)}return o}function Ef(e){return[...Sf(e,"width"),...Sf(e,"height"),...Sf(e,"childWidth"),...Sf(e,"childHeight")]}function Sf(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(sr(i)&&hi(o)){const i=e.scaleName(n);if(Og(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[$f(i,o)]}return[$f(i,o),{name:r,update:Bf(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${zs(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function $f(e,t){return{name:e+"_step",value:t.step}}function Bf(e,t,n){const i=t.get("type"),r=t.get("padding"),o=ae(t.get("paddingOuter"),r);let s=t.get("paddingInner");return s="band"===i?void 0!==s?s:r:1,`bandspace(${n}, ${s}, ${o}) * ${e}_step`}function _f(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function zf(e,t){return V(e).reduce((n,i)=>{const r=e[i];return Object.assign(Object.assign({},n),lu(t,r,i,e=>mi(e)?e:{value:e.value}))},{})}function Nf(e,t){if(jg(t)||Og(t))return"shared";if(wg(t))return nn(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function Pf(e,t){const n=e.scale[t],i=nn(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Kn(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const Mf=Object.assign(Object.assign({},{aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1}),{disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Tf=V(Mf);class Lf extends Oa{}const qf={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){var s,a,u,l,f,d,g,p;if("symbol"!==o)return;const{markDef:m,encoding:h,config:b,mark:v}=n,y=m.filled&&"trail"!==v;let x=Object.assign(Object.assign({},function(e,t,n){for(const i of n){const n=To(i,t.markDef,t.config);void 0!==n&&(e[i]=_o(n))}return e}({},n,Me)),vu(n,{filled:y}));const O=null!==(s=r.get("symbolOpacity"))&&void 0!==s?s:b.legend.symbolOpacity,w=null!==(a=r.get("symbolFillColor"))&&void 0!==a?a:b.legend.symbolFillColor,j=null!==(u=r.get("symbolStrokeColor"))&&void 0!==u?u:b.legend.symbolStrokeColor,A=void 0===O?null!==(l=Rf(h.opacity))&&void 0!==l?l:m.opacity:void 0;if(x.fill)if("fill"===i||y&&i===pt)delete x.fill;else if(x.fill.field)w?delete x.fill:(x.fill=_o(null!==(f=b.legend.symbolBaseFillColor)&&void 0!==f?f:"black"),x.fillOpacity=_o(null!=A?A:1));else if(c(x.fill)){const e=null!==(p=null!==(g=Wf(null!==(d=h.fill)&&void 0!==d?d:h.color))&&void 0!==g?g:m.fill)&&void 0!==p?p:y&&m.color;e&&(x.fill=_o(e))}if(x.stroke)if("stroke"===i||!y&&i===pt)delete x.stroke;else if(x.stroke.field||j)delete x.stroke;else if(c(x.stroke)){const e=ae(Wf(h.stroke||h.color),m.stroke,y?m.color:void 0);e&&(x.stroke={value:e})}if(i!==xt){const e=Xr(t)&&Hf(n,r,t);e?x.opacity=[Object.assign({test:e},_o(null!=A?A:1)),_o(b.legend.unselectedOpacity)]:A&&(x.opacity=_o(A))}return x=Object.assign(Object.assign({},x),e),G(x)?void 0:x},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){var r;if("gradient"!==n)return;const{config:o,markDef:s,encoding:a}=t;let u={};const c=void 0===(null!==(r=i.get("gradientOpacity"))&&void 0!==r?r:o.legend.gradientOpacity)?Rf(a.opacity)||s.opacity:void 0;c&&(u.opacity=_o(c));return u=Object.assign(Object.assign({},u),e),G(u)?void 0:u},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},s=n.config,a=Xr(t)?Hf(n,r,t):void 0,u=a?[{test:a,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:c,formatType:l}=o,f=jr(l)?kr({fieldOrDatumDef:t,field:"datum.value",format:c,formatType:l,config:s}):void 0,d=Object.assign(Object.assign(Object.assign({},u?{opacity:u}:{}),f?{text:f}:{}),e);return G(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?Object.assign(Object.assign({},e),{fill:{value:"transparent"}}):e}};function Rf(e){return Uf(e,(e,t)=>Math.max(e,t.value))}function Wf(e){return Uf(e,(e,t)=>ae(e,t.value))}function Uf(e,t){return function(e){const t=e&&e.condition;return!!t&&(c(t)||io(t))}(e)?m(e.condition).reduce(t,e.value):io(e)?e.value:void 0}function Hf(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=O(n.field);return i.map(e=>`(!length(data(${O(Q(e)+vc)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`).join(" || ")}const If={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return Cr(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return Er(i,t,n)},gradientLength:e=>{var t,n;const{legend:i,legendConfig:r}=e;return null!==(n=null!==(t=i.gradientLength)&&void 0!==t?t:r.gradientLength)&&void 0!==n?n:function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:s,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(ur(r))return"horizontal"===n?"top"===i||"bottom"===i?Jf(t,"width",s,o):s:Jf(t,"height",u,a);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>{var i,r;return null!==(r=null!==(i=e.labelOverlap)&&void 0!==i?i:t.labelOverlap)&&void 0!==r?r:function(e){if(T(["quantile","threshold","log"],e))return"greedy";return}(n)},symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>{var r;return null!==(r=e.symbolType)&&void 0!==r?r:function(e,t,n,i){var r;if("shape"!==t){const e=null!==(r=Wf(n))&&void 0!==r?r:i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape)},title:({fieldOrDatumDef:e,config:t})=>ho(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Tt(n)&&ur(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(c(n))return Eo(t,n);if(mi(n))return n;return}(t,e)};function Gf(e){const{legend:t}=e;return ae(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Tt(e)){if(T(["quarter","month","day"],t))return"symbol";if(ur(n))return"gradient"}return"symbol"}(e))}function Vf({legendConfig:e,legendType:t,orient:n,legend:i}){var r,o;return null!==(o=null!==(r=i.direction)&&void 0!==r?r:e[t?"gradientDirection":"symbolDirection"])&&void 0!==o?o:function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(n,t)}function Jf(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function Yf(e){const t=xg(e)?function(e){const{encoding:t}=e,n={};for(const i of[pt,...js]){const r=Oo(t[i]);r&&e.getScaleComponent(i)&&(i===bt&&Xr(r)&&r.type===Mi||(n[i]=Qf(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){Yf(i);for(const r of V(i.component.legends))n.legend[r]=Pf(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=Kf(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of V(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function Xf(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function Qf(e,t){var n,i,r;let o=e.legend(t);const{markDef:s,encoding:a,config:u}=e,c=u.legend,l=new Lf({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null===(i=e.fieldDef(t))||void 0===i?void 0:i.field;jc(e,e=>{var i,o;const s=null!==(i=e.project.hasField[r])&&void 0!==i?i:e.project.hasChannel[t];if(s&&Qu.has(e)){const t=null!==(o=n.get("selections"))&&void 0!==o?o:[];t.push(e.name),n.set("selections",t,!1),s.hasLegend=!0}})}(e,t,l);const f=void 0!==o?!o:c.disable;if(l.set("disable",f,void 0!==o),f)return l;o=o||{};const d=e.getScaleComponent(t).get("type"),g=Oo(a[t]),p=Xr(g)?null===(n=pi(g.timeUnit))||void 0===n?void 0:n.unit:void 0,m=o.orient||u.legend.orient||"right",h=Gf({legend:o,channel:t,timeUnit:p,scaleType:d}),b={legend:o,channel:t,model:e,markDef:s,encoding:a,fieldOrDatumDef:g,legendConfig:c,config:u,scaleType:d,orient:m,legendType:h,direction:Vf({legend:o,legendType:h,orient:m,legendConfig:c})};for(const n of Tf){if("gradient"===h&&n.startsWith("symbol")||"symbol"===h&&n.startsWith("gradient"))continue;const i=n in If?If[n](b):o[n];if(void 0!==i){const r=Xf(i,n,o,e.fieldDef(t));(r||void 0===u.legend[n])&&l.set(n,i,r)}}const v=null!==(i=null==o?void 0:o.encoding)&&void 0!==i?i:{},y=l.get("selections"),x={},O={fieldOrDatumDef:g,model:e,channel:t,legendCmpt:l,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=zf(null!==(r=v[t])&&void 0!==r?r:{},e),i=t in qf?qf[t](n,O):n;void 0===i||G(i)||(x[t]=Object.assign(Object.assign(Object.assign({},(null==y?void 0:y.length)&&Xr(g)?{name:`${Q(g.field)}_legend_${t}`}:{}),(null==y?void 0:y.length)?{interactive:!!y}:{}),{update:i}))}return G(x)||l.set("encode",x,!!(null==o?void 0:o.encoding)),l}function Kf(e,t){var n,i,r,o;if(!e)return t.clone();const s=e.getWithExplicit("orient"),a=t.getWithExplicit("orient");if(s.explicit&&a.explicit&&s.value!==a.value)return;let u=!1;for(const n of Tf){const i=Fa(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return Zf(e,t);case"title":return Ho(e,t);case"type":return u=!0,ja("symbol")}return Da(e,t,n,"legend")});e.setWithExplicit(n,i)}return u&&((null===(i=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===i?void 0:i.gradient)&&Z(e.implicit,["encode","gradient"]),(null===(o=null===(r=e.explicit)||void 0===r?void 0:r.encode)||void 0===o?void 0:o.gradient)&&Z(e.explicit,["encode","gradient"])),e}function Zf(e,t){return"circle"===t.value?t:e}function ed(e){const t=e.component.legends,n={};for(const i of V(t)){const r=e.getScaleComponent(i),o=N(r.get("domains"));if(n[o])for(const e of n[o]){Kf(e,t[i])||n[o].push(t[i])}else n[o]=[t[i].clone()]}return J(n).flat().map(t=>function(e,t){var n,i,r;const o=e.combine(),{disable:s,labelExpr:a,selections:u}=o,c=j(o,["disable","labelExpr","selections"]);if(s)return;!1===t.aria&&null==c.aria&&(c.aria=!1);if(null===(n=c.encode)||void 0===n?void 0:n.symbols){const e=c.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||c.stroke||(e.stroke={value:"transparent"});for(const t of js)c[t]&&delete e[t]}c.title||delete c.title;if(void 0!==a){let e=a;(null===(r=null===(i=c.encode)||void 0===i?void 0:i.labels)||void 0===r?void 0:r.update)&&mi(c.encode.labels.update.text)&&(e=re(a,"datum.label",c.encode.labels.update.text.signal)),function(e,t,n,i){var r,o,s;e.encode=null!==(r=e.encode)&&void 0!==r?r:{},e.encode[t]=null!==(o=e.encode[t])&&void 0!==o?o:{},e.encode[t].update=null!==(s=e.encode[t].update)&&void 0!==s?s:{},e.encode[t].update[n]=i}(c,"labels","text",{signal:e})}return c}(t,e.config)).filter(e=>void 0!==e)}function td(e){return jg(e)||wg(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),nd(e))}(e):nd(e)}function nd(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const i=mi(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return T(t,i)||t.push(i),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},n)]}return[Object.assign(Object.assign({name:i},{translate:{signal:"[width / 2, height / 2]"}}),n)]}const id=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class rd extends Oa{constructor(e,t,n,i){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function od(e){e.component.projection=xg(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,i=!(n&&(null!=n.scale||null!=n.translate)),r=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=i?function(e){const t=[],{encoding:n}=e;for(const i of[[ft,lt],[gt,dt]])(Oo(n[i[0]])||Oo(n[i[1]]))&&t.push({signal:e.getName("geojson_"+t.length)});e.channelHasField(bt)&&e.typedFieldDef(bt).type===Mi&&t.push({signal:e.getName("geojson_"+t.length)});0===t.length&&t.push(e.requestDataName(Na.Main));return t}(e):void 0;return new rd(e.projectionName(!0),Object.assign(Object.assign({},null!==(t=e.config.projection)&&void 0!==t?t:{}),null!=n?n:{}),r,o)}return}(e):function(e){if(0===e.children.length)return;let t;for(const t of e.children)od(t);const n=q(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=q(id,n=>!b(e.explicit,n)&&!b(t.explicit,n)||!(!b(e.explicit,n)||!b(t.explicit,n)||N(e.get(n))!==N(t.get(n))));if(N(e.size)===N(t.size)){if(n)return e;if(N(e.explicit)===N({}))return t;if(N(t.explicit)===N({}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0});if(t&&n){const n=e.projectionName(!0),i=new rd(n,t.specifiedProjection,t.size,B(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function sd(e,t){return`${hn(e)}_${t}`}function ad(e,t,n){var i;const r=sd(null!==(i=Do(n,void 0))&&void 0!==i?i:{},t);return e.getName(r+"_bins")}function ud(e,t,n){let i,r;i=function(e){return"as"in e}(e)?x(e.as)?[e.as,e.as+"_end"]:[e.as[0],e.as[1]]:[co(e,{forAs:!0}),co(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},Do(t,void 0)),s=sd(o,e.field),{signal:a,extentSignal:u}=function(e,t){return{signal:e.getName(t+"_bins"),extentSignal:e.getName(t+"_extent")}}(n,s);if(xn(o.extent)){const e=o.extent,t=e.selection;r=Vl(n.getSelectionComponent(Q(t),t),e),delete o.extent}return{key:s,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[i]},a?{signal:a}:{}),u?{extentSignal:u}:{}),r?{span:r}:{})}}class cd extends Lu{constructor(e,t){super(e),this.bins=t}clone(){return new cd(null,B(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(no(n)&&bn(n.bin)){const{key:r,binComponent:o}=ud(n,n.bin,t);e[r]=Object.assign(Object.assign(Object.assign({},o),e[r]),function(e,t,n,i){var r,o;if(So(t,n)){const s=xg(e)&&null!==(o=null!==(r=e.axis(n))&&void 0!==r?r:e.legend(n))&&void 0!==o?o:{},a=co(t,{expr:"datum"}),u=co(t,{expr:"datum",binSuffix:"end"});return{formulaAs:co(t,{binSuffix:"range",forAs:!0}),formula:_r(a,u,s.format,s.formatType,i)}}return{}}(t,n,i,t.config))}return e},{});return G(n)?null:new cd(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=ud(t,t.bin,n);return new cd(e,{[i]:r})}merge(e,t){for(const n of V(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=W([...this.bins[n].as,...e.bins[n].as],P)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(J(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(J(this.bins).map(e=>e.field))}hash(){return"Bin "+P(this.bins)}assemble(){return J(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,r=e.bin,{extent:o}=r,s=j(r,["extent"]),a=Object.assign(Object.assign(Object.assign({type:"bin",field:ie(e.field),as:n,signal:e.signal},xn(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),s);!o&&e.extentSignal&&(t.push({type:"extent",field:ie(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:co({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}function ld(e,t,n,i){const r=xg(i)?i.encoding[Xt(t)]:void 0;if(no(n)&&xg(i)&&Gr(t,n,r,i.stack,i.markDef,i.config))e.add(co(n,{})),e.add(co(n,{suffix:"end"})),n.bin&&So(n,t)&&e.add(co(n,{binSuffix:"range"}));else if(t in Nt){const n=function(e){switch(e){case lt:return"y";case dt:return"y2";case ft:return"x";case gt:return"x2"}}(t);e.add(i.getName(n))}else e.add(co(n));return e}class fd extends Lu{constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new fd(null,new Set(this.dimensions),B(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const i={},r=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,s,a,u;const{aggregate:c,field:l}=e;if(c)if("count"===c)i["*"]=null!==(o=i["*"])&&void 0!==o?o:{},i["*"].count=new Set([co(e,{forAs:!0})]);else{if(Ge(c)||Ve(c)){const e=Ge(c)?"argmin":"argmax",t=c[e];i[t]=null!==(s=i[t])&&void 0!==s?s:{},i[t][e]=new Set([co({op:e,field:t},{forAs:!0})])}else i[l]=null!==(a=i[l])&&void 0!==a?a:{},i[l][c]=new Set([co(e,{forAs:!0})]);fn(n)&&"unaggregated"===t.scaleDomain(n)&&(i[l]=null!==(u=i[l])&&void 0!==u?u:{},i[l].min=new Set([co({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([co({field:l,aggregate:"max"},{forAs:!0})]))}else ld(r,n,e,t)}),r.size+V(i).length===0?null:new fd(e,r,i)):null}static makeFromTransform(e,t){var n,i,r;const o=new Set,s={};for(const e of t.aggregate){const{op:t,field:r,as:o}=e;t&&("count"===t?(s["*"]=null!==(n=s["*"])&&void 0!==n?n:{},s["*"].count=new Set([o||co(e,{forAs:!0})])):(s[r]=null!==(i=s[r])&&void 0!==i?i:{},s[r][t]=new Set([o||co(e,{forAs:!0})])))}for(const e of null!==(r=t.groupby)&&void 0!==r?r:[])o.add(e);return o.size+V(s).length===0?null:new fd(e,o,s)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const i of V(t)){const r=t[i];for(const t of V(r))i in e?e[i][t]=new Set([...null!==(n=e[i][t])&&void 0!==n?n:[],...r[t]]):e[i]={[t]:r[t]}}}(this.measures,e.measures),!0):(function(...e){Qn.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...V(this.measures)])}producedFields(){const e=new Set;for(const t of V(this.measures))for(const n of V(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return"Aggregate "+P({dimensions:this.dimensions,measures:this.measures})}assemble(){const e=[],t=[],n=[];for(const i of V(this.measures))for(const r of V(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:ie(i));return{type:"aggregate",groupby:[...this.dimensions].map(ie),ops:e,fields:t,as:n}}}class dd extends Lu{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of qt){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]=Object.assign({name:t.getName(e+"_domain"),fields:[co(n),...bn(i)?[co(n,{binSuffix:"end"})]:[]]},Tr(r)?{sortField:r}:c(r)?{sortIndexField:gf(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of qt)this[t]&&(e+=` ${t.charAt(0)}:${P(this[t])}`);return e}get fields(){var e;const t=[];for(const n of qt)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of qt)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of tn){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(sr(i)&&hi(r)){const n=tg(ng(this.childModel,t));n?e[t]=n:Kn(kn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x"}[e],r=[],o=[],s=[];n&&n[i]&&(t?(r.push("distinct_"+n[i]),o.push("max")):(r.push(n[i]),o.push("distinct")),s.push("distinct_"+n[i]));const{sortField:a,sortIndexField:u}=this[e];if(a){const{op:e=zr,field:t}=a;r.push(t),o.push(e),s.push(co(a,{forAs:!0}))}else u&&(r.push(u),o.push("max"),s.push(u));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},r.length?{fields:r,ops:o,as:s}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,o=[],s={};for(const e of bf){for(const i of vf){const o=null!==(t=r[e]&&r[e][i])&&void 0!==t?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){s[e]=!0;break}}if(s[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?i?{signal:`ceil(${t} / ${i})`}:1:i?{signal:`min(${t}, ${i})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:a,column:u}=s;return(a||u)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;const n=[];let i=null;const r=this.getChildIndependentFieldsWithStep(),{column:o,row:s,facet:a}=this;if(o&&s&&(r.x||r.y)){i=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(null!==(e=r.x)&&void 0!==e?e:[],null!==(t=r.y)&&void 0!==t?t:[]),s=o.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:s}]})}for(const e of[et,Ze])this[e]&&n.push(this.assembleRowColumnHeaderData(e,i,r));if(a){const e=this.assembleFacetHeaderData(r);e&&n.push(...e)}return n}}function gd(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function pd(e){const t={};return function e(t,n){if(E(t))e(t.not,n);else if(C(t))for(const i of t.and)e(i,n);else if(k(t))for(const i of t.or)e(i,n);else n(t)}(e.filter,e=>{var n;if(Ci(e)){let i=null;Oi(e)?i=e.equal:ji(e)?i=e.lte:wi(e)?i=e.lt:Ai(e)?i=e.gt:Di(e)?i=e.gte:Fi(e)?i=e.range[0]:ki(e)&&(i=(null!==(n=e.oneOf)&&void 0!==n?n:e.in)[0]),i&&(Zn(i)?t[e.field]="date":y(i)?t[e.field]="number":x(i)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function md(e){const t={};function n(e){var n;ko(e)?t[e.field]="date":"quantitative"===e.type&&(x(n=e.aggregate)&&T(["min","max"],n))?t[e.field]="number":se(e.field)>1?e.field in t||(t[e.field]="flatten"):ro(e)&&Tr(e.sort)&&se(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((xg(e)||Og(e))&&e.forEachFieldDef((t,i)=>{if(no(t))n(t);else{const r=Jt(i),o=e.fieldDef(r);n(Object.assign(Object.assign({},t),{type:o.type}))}}),xg(e)){const{mark:n,markDef:i,encoding:r}=e;if(_e(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];Xr(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class hd extends Lu{constructor(e,t){super(e),this._parse=t}clone(){return new hd(null,B(this._parse))}hash(){return"Parse "+P(this._parse)}static makeExplicit(e,t,n){let i={};const r=t.data;return!$a(r)&&r&&r.format&&r.format.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of V(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Kn(_n(e,n[e],t.value)))}for(const e of V(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Kn(_n(e,t[e],n)))}const r=new Oa(t,n);i.copyAll(r);const o={};for(const e of V(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===V(o).length||i.parseNothing?null:new hd(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of V(this._parse)){const n=this._parse[t];1===se(t)&&(e[t]=n)}return e}producedFields(){return new Set(V(this._parse))}dependentFields(){return new Set(V(this._parse))}assembleTransforms(e=!1){return V(this._parse).filter(t=>!e||se(t)>1).map(e=>{const t=function(e,t){const n=te(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:"))return`timeParse(${n},'${gd(t.slice(5,t.length))}')`;if(0===t.indexOf("utc:"))return`utcParse(${n},'${gd(t.slice(4,t.length))}')`;return Kn(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:oe(e)}}).filter(e=>null!==e)}}class bd extends Lu{clone(){return new bd(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([As])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:As}}}class vd extends Lu{constructor(e,t){super(e),this.params=t}clone(){return new vd(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return"Graticule "+P(this.params)}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class yd extends Lu{constructor(e,t){super(e),this.params=t}clone(){return new yd(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([null!==(e=this.params.as)&&void 0!==e?e:"data"])}hash(){return"Hash "+P(this.params)}assemble(){return Object.assign({type:"sequence"},this.params)}}class xd extends Lu{constructor(e){let t;if(super(null),$a(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},z(e.format,["parse"])):{}),Ea(e))this._data={values:e.values};else if(Ca(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];T(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else _a(e)?this._data={values:[{type:"Sphere"}]}:(Sa(e)||$a(e))&&(this._data={});this._generator=$a(e),e.name&&(this._name=e.name),t&&!G(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}var Od;function wd(e){return e instanceof xd||e instanceof vd||e instanceof yd}class jd{constructor(){Od.set(this,void 0),A(this,Od,!1)}setModified(){A(this,Od,!0)}get modifiedFlag(){return function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}(this,Od)}}Od=new WeakMap;class Ad extends jd{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(const e of t)this.run(e[0]);return this.modifiedFlag}}class Dd extends jd{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class Fd extends Dd{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let i=0;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const t of V(n))n[t].length>1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class kd extends Dd{constructor(e){super(),this.requiresSelectionId=e&&Dc(e)}run(e){e instanceof bd&&(this.requiresSelectionId&&(wd(e.parent)||e.parent instanceof fd||e.parent instanceof hd)||(this.setModified(),e.remove()))}}class Cd extends jd{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof Ru&&(n=e.producedFields(),U(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class Ed extends Dd{constructor(){super()}run(e){e instanceof qu&&!e.isRequired()&&(this.setModified(),e.remove())}}class Sd extends Ad{run(e){if(!(wd(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof hd)if(e instanceof hd)this.setModified(),e.merge(t);else{if(I(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class $d extends Ad{run(e){const t=[...e.children],n=e.children.filter(e=>e instanceof hd);if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of V(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!G(i)){this.setModified();const n=new hd(e,i);for(const r of t){if(r instanceof hd)for(const e of V(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof hd&&0===V(r.parse).length&&r.remove()}}}}}class Bd extends Ad{run(e){e instanceof qu||e.numChildren()>0||e instanceof dd||(this.setModified(),e.remove())}}class _d extends Ad{run(e){const t=e.children.filter(e=>e instanceof Ru),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class zd extends Ad{run(e){const t=e.children.filter(e=>e instanceof fd),n={};for(const e of t){const t=P(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of V(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class Nd extends Ad{constructor(e){super(),this.model=e}run(e){const t=!(wd(e)||e instanceof Il||e instanceof hd||e instanceof bd),n=[],i=[];for(const r of e.children)r instanceof cd&&(t&&!I(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof cd?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class Pd extends Ad{run(e){const t=[...e.children];if(!L(t,e=>e instanceof qu)||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof qu){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof qu))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class Md extends Lu{constructor(e,t){super(e),this.transform=t}clone(){return new Md(null,B(this.transform))}addDimensions(e){this.transform.groupby=W(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:co(e)}hash(){return"JoinAggregateTransform "+P(this.transform)}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==i?{groupby:i}:{})}}class Td extends Lu{constructor(e,t){super(e),this._stack=t}clone(){return new Td(null,B(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,s=[],a=[];if(void 0!==t.sort)for(const e of t.sort)s.push(e.field),a.push(ae(e.order,"ascending"));const u={field:s,order:a};let l;return l=function(e){return c(e)&&e.every(e=>x(e))&&e.length>1}(r)?r:x(r)?[r,r+"_end"]:[t.stack+"_start",t.stack+"_end"],new Td(e,{stackField:n,groupby:i,offset:o,sort:u,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannel:r,fieldChannel:o,offset:s,impute:a}=n;let u;if(r){u=xo(i[r])}const l=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=co(t.fieldDef);return n&&e.push(n),e},[])}(t),f=t.encoding.order;let d;return d=c(f)||Xr(f)?Ro(f):l.reduce((e,t)=>(e.field.push(t),e.order.push("y"===o?"descending":"ascending"),e),{field:[],order:[]}),new Td(e,{dimensionFieldDef:u,stackField:t.vgField(o),facetby:[],stackby:l,sort:d,offset:s,impute:a,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return"Stack "+P(this._stack)}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[co(e,{binSuffix:"mid"})]:[co(e,{}),co(e,{binSuffix:"end"})]:[co(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:o,offset:s,impute:a,as:u}=this._stack;if(a&&n){const{band:o=.5,bin:s}=n;s&&e.push({type:"formula",expr:o+"*"+co(n,{expr:"datum"})+`+${1-o}*`+co(n,{expr:"datum",binSuffix:"end"}),as:co(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:co(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:s}),e}}class Ld extends Lu{constructor(e,t){super(e),this.transform=t}clone(){return new Ld(null,B(this.transform))}addDimensions(e){this.transform.groupby=W(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(null!==(e=this.transform.groupby)&&void 0!==e?e:[]).forEach(n.add,n),(null!==(t=this.transform.sort)&&void 0!==t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:co(e)}hash(){return"WindowTransform "+P(this.transform)}assemble(){var e;const t=[],n=[],i=[],r=[];for(const e of this.transform.window)n.push(e.op),i.push(this.getDefaultName(e)),r.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,s=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>Je(e)))return Object.assign({type:"joinaggregate",as:i,ops:n,fields:t},void 0!==s?{groupby:s}:{});const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(null!==(e=t.order)&&void 0!==e?e:"ascending");const c={field:a,order:u},l=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:r,as:i,ops:n,fields:t,sort:c},void 0!==l?{ignorePeers:l}:{}),void 0!==s?{groupby:s}:{}),void 0!==o?{frame:o}:{})}}function qd(e){if(e instanceof dd)if(1!==e.numChildren()||e.children[0]instanceof qu){const n=e.model.component.data.main;!function e(t){if(t instanceof qu&&t.type===Na.Main&&1===t.numChildren()){const n=t.children[0];n instanceof dd||(n.swapWithParent(),e(t))}}(n);const i=(t=e,function e(n){if(!(n instanceof dd)){const i=n.clone();if(i instanceof qu){const e=Rd+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof fd||i instanceof Td||i instanceof Ld||i instanceof Md)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof fd||t instanceof Td||t instanceof Ld||t instanceof Md)&&t.addDimensions(e.fields),t.swapWithParent(),qd(e)}else e.children.map(qd);var t}const Rd="scale_";function Wd(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!Wd(t.children))return!1}return!0}function Ud(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function Hd(e,t,n){let i=e.sources,r=!1;return r=Ud(new Ed,i)||r,r=Ud(new kd(t),i)||r,i=i.filter(e=>e.numChildren()>0),r=Ud(new Bd,i)||r,i=i.filter(e=>e.numChildren()>0),n||(r=Ud(new Sd,i)||r,r=Ud(new Nd(t),i)||r,r=Ud(new Cd,i)||r,r=Ud(new $d,i)||r,r=Ud(new zd,i)||r,r=Ud(new _d,i)||r,r=Ud(new Fd,i)||r,r=Ud(new Pd,i)||r),e.sources=i,r}class Id{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Id(()=>e(t))}}function Gd(e){xg(e)?function(e){const t=e.component.scales;for(const n of V(t)){const i=Vd(e,n);if(t[n].setWithExplicit("domains",i),Qd(e,n),e.component.data.isFaceted){let t=e;for(;!Og(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)bi(e)&&(e.data=Rd+e.data.replace(Rd,""))}}}(e):function(e){for(const t of e.children)Gd(t);const t=e.component.scales;for(const n of V(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):Fa(i,e.getWithExplicit("domains"),"domains","scale",Zd);const t=e.get("selectionExtent");r&&t&&r.selection!==t.selection&&Kn($n),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function Vd(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=Kd(t,n);if(!e)return void Kn(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Kd(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:r})),"x"===t&&Oo(i.x2)?Oo(i.x)?Fa(Yd(n,r,e,"x"),Yd(n,r,e,"x2"),"domain","scale",Zd):Yd(n,r,e,"x2"):"y"===t&&Oo(i.y2)?Oo(i.y)?Fa(Yd(n,r,e,"y"),Yd(n,r,e,"y2"),"domain","scale",Zd):Yd(n,r,e,"y2"):Yd(n,r,e,t)}function Jd(e,t,n){var i;const r=null===(i=pi(n))||void 0===i?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map(e=>({signal:`{data: ${Co(e,{timeUnit:n,type:t})}}`}))}(e,t,r):[e]}function Yd(e,t,n,i){const{encoding:r}=n,o=Oo(r[i]),{type:s}=o,a=o.timeUnit;if(function(e){return e&&e.unionWith}(t)){const r=Yd(e,void 0,n,i),o=Jd(t.unionWith,s,a);return wa([...r.value,...o])}if(mi(t))return wa([t]);if(t&&"unaggregated"!==t&&!lr(t))return wa(Jd(t,s,a));const u=n.stack;if(u&&i===u.fieldChannel){if("normalize"===u.offset)return ja([[0,1]]);const e=n.requestDataName(Na.Main);return ja([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const c=fn(i)&&Xr(o)?function(e,t,n){if(!sr(n))return;const i=e.fieldDef(t),r=i.sort;if(Lr(r))return{op:"min",field:gf(i,t),order:"ascending"};const{stack:o}=e,s=o?[...o.groupbyField?[o.groupbyField]:[],...o.stackBy.map(e=>e.fieldDef.field)]:void 0;if(Tr(r)){return Xd(r,o&&!T(s,r.field))}if(Mr(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:a,field:u}=i,c=o&&!T(s,u);if(Ge(a)||Ve(a))return Xd({field:co(i),order:n},c);if(Je(a)||!a)return Xd({op:a,field:u,order:n},c)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(T(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(Kr(o)){return ja(Jd([o.datum],s,a))}const f=o;if("unaggregated"===t){const e=n.requestDataName(Na.Main),{field:t}=o;return ja([{data:e,field:co({field:t,aggregate:"min"})},{data:e,field:co({field:t,aggregate:"max"})}])}if(bn(f.bin)){if(sr(e))return ja("bin-ordinal"===e?[]:[{data:X(c)?n.requestDataName(Na.Main):n.requestDataName(Na.Raw),field:n.vgField(i,So(f,i)?{binSuffix:"range"}:{}),sort:!0!==c&&l(c)?c:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=f;if(bn(e)){const t=ad(n,f.field,e);return ja([new Id(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return ja([{data:n.requestDataName(Na.Main),field:n.vgField(i,{})}])}}if(f.timeUnit&&T(["time","utc"],e)&&Gr(i,f,xg(n)?n.encoding[Xt(i)]:void 0,n.stack,n.markDef,n.config)){const e=n.requestDataName(Na.Main);return ja([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return ja(c?[{data:X(c)?n.requestDataName(Na.Main):n.requestDataName(Na.Raw),field:n.vgField(i),sort:c}]:[{data:n.requestDataName(Na.Main),field:n.vgField(i)}])}function Xd(e,t){const{op:n,field:i,order:r}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":zr},i?{field:ie(i)}:{}),r?{order:r}:{})}function Qd(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,o=null===(n=e.fieldDef(t))||void 0===n?void 0:n.bin,s=lr(r)&&r,a=yn(o)&&xn(o.extent)&&o.extent;(s||a)&&i.set("selectionExtent",null!=s?s:a,!0)}function Kd(e,t){const{aggregate:n,type:i}=e;return n?x(n)&&!Ke[n]?{valid:!1,reason:Wn(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:Un(e)}:{valid:!0}:{valid:!1,reason:Rn(e)}}function Zd(e,t,n,i){return e.explicit&&t.explicit&&Kn(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${N(n)} and ${N(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function eg(e){const t=W(e.map(e=>{if(bi(e)){return j(e,["sort"])}return e}),P),n=W(e.map(e=>{if(bi(e)){const t=e.sort;return void 0===t||X(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),P);if(0===t.length)return;if(1===t.length){const t=e[0];if(bi(t)&&n.length>0){let e=n[0];if(n.length>1)Kn(Gn),e=!0;else if(l(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return Object.assign(Object.assign({},t),{sort:e})}return t}const i=W(n.map(e=>X(e)||!("op"in e)||x(e.op)&&e.op in Ie?e:(Kn(function(e){return`Dropping sort property ${N(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0)),P);let r;1===i.length?r=i[0]:i.length>1&&(Kn(Gn),r=!0);const o=W(e.map(e=>bi(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},r?{sort:r}:{})}return Object.assign({fields:t},r?{sort:r}:{})}function tg(e){if(bi(e)&&x(e.field))return e.field;if(function(e){return!c(e)&&"fields"in e&&!("data"in e)}(e)){let t;for(const n of e.fields)if(bi(n)&&x(n.field))if(t){if(t!==n.field)return Kn("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return Kn("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!c(e)&&"fields"in e&&"data"in e}(e)){Kn("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return x(t)?t:void 0}}function ng(e,t){return eg(e.component.scales[t].get("domains").map(t=>(bi(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function ig(e){return V(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:s,selectionExtent:a,domains:u,range:c,reverse:f}=r,d=j(r,["name","type","selectionExtent","domains","range","reverse"]),g=function(e,t,n,i){if(nn(n)){if(hi(e))return{step:{signal:t+"_step"}}}else if(l(e)&&bi(e))return Object.assign(Object.assign({},e),{data:i.lookupDataSource(e.data)});return e}(r.range,o,n,e);let p;a&&(p=function(e,t){const n=t.selection;return{signal:Vl(e.getSelectionComponent(n,Q(n)),t)}}(e,a));const m=ng(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:s},m?{domain:m}:{}),p?{domainRaw:p}:{}),{range:g}),void 0!==f?{reverse:f}:{}),d)),t},[])}class rg extends Oa{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||L(this.get("domains"),e=>c(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const og=["range","scheme"];function sg(e){return"x"===e?"width":"y"===e?"height":void 0}function ag(e,t){const n=e.fieldDef(t);if(n&&n.bin&&bn(n.bin)){const i=ad(e,n.field,n.bin),r=sg(t),o=e.getName(r);return new Id(()=>{const t=e.getSignalName(i),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function ug(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const i of og)if(void 0!==n[i]){const o=gr(r,i),s=pr(e,i);if(o)if(s)Kn(s);else switch(i){case"range":{const i=n.range;if(c(i)){if(nn(e))return wa(i.map(e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return Id.fromName(i,n)}return e}))}else if(l(i))return wa({data:t.requestDataName(Na.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return wa(i)}case"scheme":return wa(cg(n[i]))}else Kn(Hn(r,i,e))}if(e===nt||e===it){const t=e===nt?"width":"height",n=i[t];if($s(n)){if(sr(r))return wa({step:n.step});Kn(In(t))}}const{rangeMin:o,rangeMax:s}=n,a=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,s=t.getSignalName.bind(t),{type:a}=Oo(o[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:f}=t.specifiedScales[e];switch(e){case nt:case it:{if(T(["point","band"],u))if(e!==nt||n.width){if(e===it&&!n.height){const e=Ps(i.view,"height");if($s(e))return e}}else{const e=Ps(i.view,"width");if($s(e))return e}const r=sg(e),o=t.getName(r);return e===it&&ar(u)?[Id.fromName(s,o),0]:[0,Id.fromName(s,o)]}case vt:{const o=function e(t,n,i){if(n)return mi(n)?{signal:`${n.signal} ? 0 : ${e(t,!1,i)}`}:0;switch(t){case"bar":case"tick":return i.scale.minBandSize;case"line":case"trail":case"rule":return i.scale.minStrokeWidth;case"text":return i.scale.minFontSize;case"point":case"square":case"circle":return i.scale.minSize}throw new Error(Tn("size",t))}(r,t.component.scales[e].get("zero"),i),s=function(e,t,n,i){const r={x:ag(n,"x"),y:ag(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=fg(t,r,i.view);return y(e)?e-1:new Id(()=>e.signal+" - 1")}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=fg(t,r,i.view);return y(e)?Math.pow(lg*e,2):new Id(()=>`pow(0.95 * ${e.signal}, 2)`)}}throw new Error(Tn("size",e))}(r,n,t,i);return cr(u)?function(e,t,n){const i=()=>{const i=No(t),r=No(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return mi(t)?new Id(i):{signal:i()}}(o,s,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&c(n)?n.length+1:(Kn(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,l,e)):[o,s]}case ut:return[0,2*Math.PI];case yt:return[0,360];case st:return[0,new Id(()=>`min(${t.getSignalName("width")},${t.getSignalName("height")})/2`)];case jt:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case At:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case bt:return"symbol";case pt:case mt:case ht:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==f?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case xt:case Ot:case wt:return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error("Scale range undefined for channel "+e)}(e,t);return(void 0!==o||void 0!==s)&&gr(r,"rangeMin")&&c(a)&&2===a.length?wa([null!=o?o:a[0],null!=s?s:a[1]]):ja(a)}function cg(e){return function(e){return!x(e)&&!!e.name}(e)?Object.assign({scheme:e.name},z(e,["name"])):{scheme:e}}const lg=.95;function fg(e,t,n){const i=$s(e.width)?e.width.step:Ns(n,"width"),r=$s(e.height)?e.height.step:Ns(n,"height");return t.x||t.y?new Id(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function dg(e,t){xg(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:s}=e;for(const a of V(n)){const u=s[a],c=n[a],l=e.getScaleComponent(a),f=Oo(r[a]),d=u[t],g=l.get("type"),p=l.get("padding"),m=l.get("paddingInner"),h=gr(g,t),b=pr(a,t);if(void 0!==d&&(h?b&&Kn(b):Kn(Hn(g,t,a))),h&&void 0===b)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Zn(u[t])||"temporal"===n||e?c.set(t,{signal:Co(u[t],{type:n,timeUnit:e})},!0):c.set(t,u[t],!0);break;default:c.copyKeyFromObject(t,u)}}else{const n=t in gg?gg[t]({model:e,channel:a,fieldOrDatumDef:f,scaleType:g,scalePadding:p,scalePaddingInner:m,domain:u.domain,markDef:o,config:i}):i.scale[t];void 0!==n&&c.set(t,n,!1)}}}(e,t):mg(e,t)}const gg={bins:({model:e,fieldOrDatumDef:t})=>Xr(t)?function(e,t){const n=t.bin;if(bn(n)){const i=ad(e,t.field,n);return new Id(()=>e.getSignalName(i))}if(vn(n)&&yn(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(T([pt,mt,ht],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,fieldOrDatumDef:n})=>function(e,t,n){var i;if((null===(i=xo(n))||void 0===i?void 0:i.bin)||T([Ui,Hi],e))return;return t in en||void 0}(e,t,n),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(e in en){if(ur(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:s}=r;if("bar"===t&&(!Xr(i)||!i.bin&&!i.timeUnit)&&("vertical"===s&&"x"===e||"horizontal"===s&&"y"===e))return o.continuousBandSize}if(t===Ji)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,config:i})=>function(e,t,n,i){if(void 0!==e)return;if(t in en){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return ae(e,"bar"===n?t:r)}return}(e,t,n.type,i.scale),paddingOuter:({scalePadding:e,channel:t,scaleType:n,markDef:i,scalePaddingInner:r,config:o})=>function(e,t,n,i,r,o){if(void 0!==e)return;if(t in en&&n===Yi){const{bandPaddingOuter:e}=o;return ae(e,mi(r)?{signal:r.signal+"/2"}:r/2)}return}(e,t,n,i.type,r,o.scale),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return ar(e)&&"descending"===t?mi(i.xReverse)?{signal:"!"+i.xReverse.signal}:!i.xReverse:i.xReverse;if(ar(e)&&"descending"===t)return!0;return}(t,Xr(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r})=>function(e,t,n,i,r){if(n&&"unaggregated"!==n&&ar(r)){if(c(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!cr(r))return!0;if((!Xr(t)||!t.bin)&&T([...tn,...on],e)){const{orient:t,type:n}=i;return!T(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(e,t,n,i,r)};function pg(e){xg(e)?function(e){const t=e.component.scales;for(const n of ln){const i=t[n];if(!i)continue;const r=ug(n,e);i.setWithExplicit("range",r)}}(e):mg(e,"range")}function mg(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?pg(n):dg(n,t);for(const i of V(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=Fa(r,e.getWithExplicit(t),t,"scale",Aa((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[i].setWithExplicit(t,r)}}function hg(e,t,n,i){const r=function(e,t,n){var i;switch(t.type){case"nominal":case"ordinal":if(Tt(e)||"discrete"===mn(e))return"shape"===e&&"ordinal"===t.type&&Kn(qn(e,"ordinal")),"ordinal";if(e in en){if(T(["rect","bar","image","rule"],n))return"band"}else if("arc"===n&&e in rn)return"band";return void 0!==t.band||oo(t)&&(null===(i=t.axis)||void 0===i?void 0:i.tickBand)?"band":"point";case"temporal":return Tt(e)?"time":"discrete"===mn(e)?(Kn(qn(e,"temporal")),"ordinal"):Xr(t)&&t.timeUnit&&pi(t.timeUnit).utc?"utc":"time";case"quantitative":return Tt(e)?Xr(t)&&bn(t.bin)?"bin-ordinal":"linear":"discrete"===mn(e)?(Kn(qn(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Nn(t.type))}(t,n,i),{type:o}=e;return fn(t)?void 0!==o?function(e,t){if(!fn(e))return!1;switch(e){case nt:case it:case ut:case st:return ur(t)||T(["band","point"],t);case vt:case jt:case xt:case Ot:case wt:case yt:return ur(t)||cr(t)||T(["band","point","ordinal"],t);case pt:case mt:case ht:return"band"!==t;case At:return"ordinal"===t||cr(t);case bt:return"ordinal"===t}}(t,o)?Xr(n)&&(s=o,a=n.type,!(T([zi,Pi],a)?void 0===s||sr(s):a===Ni?T([Ui,Hi,void 0],s):a!==_i||T([Li,qi,Ri,Wi,Ii,Gi,Vi,Ti,void 0],s)))?(Kn(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,r)),r):o:(Kn(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,o,r)),r):r:null;var s,a}function bg(e){xg(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return ln.reduce((i,r)=>{const o=Oo(t[r]);if(o&&n===Be&&r===bt&&o.type===Mi)return i;let s=o&&o.scale;if(o&&null!==s&&!1!==s){s=null!=s?s:{};const t=hg(s,r,o,n);i[r]=new rg(e.scaleName(r+"",!0),{value:t,explicit:s.type===t})}return i},{})}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const n of e.children){bg(n);for(const o of V(n.component.scales))if(r.scale[o]=null!==(t=r.scale[o])&&void 0!==t?t:Nf(o,e),"shared"===r.scale[o]){const e=i[o],t=n.component.scales[o].getWithExplicit("type");e?Qi(e.value,t.value)?i[o]=Fa(e,t,"type","scale",vg):(r.scale[o]="independent",delete i[o]):i[o]=t}}for(const t of V(i)){const r=e.scaleName(t,!0),o=i[t];n[t]=new rg(r,o);for(const n of e.children){const e=n.component.scales[t];e&&(n.renameScale(e.get("name"),r),e.merged=!0)}}return n}(e)}const vg=Aa((e,t)=>Zi(e)-Zi(t));class yg{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function xg(e){return"unit"===(null==e?void 0:e.type)}function Og(e){return"facet"===(null==e?void 0:e.type)}function wg(e){return"concat"===(null==e?void 0:e.type)}function jg(e){return"layer"===(null==e?void 0:e.type)}class Ag{constructor(e,t,n,i,r,o,s){var a,u;this.type=t,this.parent=n,this.config=r,this.view=s,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.name=null!==(a=e.name)&&void 0!==a?a:i,this.title=Bo(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new yg,this.projectionNameMap=n?n.projectionNameMap:new yg,this.signalNameMap=n?n.signalNameMap:new yg,this.data=e.data,this.description=e.description,this.transforms=(null!==(u=e.transform)&&void 0!==u?u:[]).map(e=>Pa(e)?{filter:S(e.filter,Bi)}:e),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){var i,r;const o=n[t],s={},{spacing:a,columns:u}=o;void 0!==a&&(s.spacing=a),void 0!==u&&(Wr(e)&&!qr(e.facet)||Cs(e))&&(s.columns=u),Es(e)&&(s.columns=1);for(const t of _s)if(void 0!==e[t])if("spacing"===t){const n=e[t];s[t]=y(n)?n:{row:null!==(i=n.row)&&void 0!==i?i:a,column:null!==(r=n.column)&&void 0!==r?r:a}}else s[t]=e[t];return s}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:Wr(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new Oa,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},o?B(o):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){bg(e),Gd(e);for(const t of dr)dg(e,t);t||pg(e)}(this)}parseProjection(){od(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Yf(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!==(t=null===(e=this.view)||void 0===e?void 0:e.style)&&void 0!==t?t:"cell"}assembleEncodeFromView(e){const t=j(e,["style"]),n={};for(const e of V(t)){const i=t[e];void 0!==i&&(n[e]=_o(i))}return n}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=_o(this.description)),"unit"!==this.type&&"layer"!==this.type)?G(t)?void 0:t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=j(e,["spacing"]),{component:i,config:r}=this,o=function(e,t){const n={};for(const i of qt){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=hf(["titleAnchor","titleOrient"],r.facetFieldDef,t,i),s=pf(i,o),a=kf(e,s);void 0!==a&&(n[s]=a)}}return G(n)?void 0:n}(i.layoutHeaders,r);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of qt)e[n].title&&t.push(yf(this,n));for(const e of bf)t=t.concat(wf(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>Xl(e,"grid",t)),...i.map(e=>Xl(e,"grid",t)),...n.map(e=>Xl(e,"main",t)),...i.map(e=>Xl(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return ed(this)}assembleProjections(){return td(this)}assembleTitle(){var e,t,n;const i=null!==(e=this.title)&&void 0!==e?e:{},{encoding:r}=i,o=j(i,["encoding"]),s=Object.assign(Object.assign(Object.assign({},$o(this.config.title).nonMark),o),r?{encode:{update:r}}:{});if(s.text)return T(["unit","layer"],this.type)?T(["middle",void 0],s.anchor)&&(s.frame=null!==(t=s.frame)&&void 0!==t?t:"group"):s.anchor=null!==(n=s.anchor)&&void 0!==n?n:"start",G(s)?void 0:s}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||Og(this.parent)?function e(t){return jg(t)||wg(t)?t.children.reduce((t,n)=>t.concat(e(n)),ig(t)):ig(t)}(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return Q((this.name?this.name+"_":"")+e)}getDataName(e){return this.getName(Na[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(Og(this.parent)){const t=sn(_f(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(sr(e)&&hi(i)){const e=n.get("name"),i=tg(ng(this,t));if(i){return{signal:Bf(e,n,co({aggregate:"distinct",field:i},{expr:"datum"}))}}return Kn(kn(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):It(e)&&fn(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null===(e=this.component.axes.x)||void 0===e?void 0:e.some(e=>e.hasOrientSignalRef()))||(null===(t=this.component.axes.y)||void 0===t?void 0:t.some(e=>e.hasOrientSignalRef()))}}class Dg extends Ag{vgField(e,t={}){const n=this.fieldDef(e);if(n)return co(n,t)}reduceFieldDef(e,t){return Qo(this.getMapping(),(t,n,i)=>{const r=xo(n);return r?e(t,r,i):t},t)}forEachFieldDef(e,t){Xo(this.getMapping(),(t,n)=>{const i=xo(t);i&&e(i,n)},t)}}class Fg extends Lu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"value",null!==(r=o[1])&&void 0!==r?r:"density"]}clone(){return new Fg(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"DensityTransform "+P(this.transform)}assemble(){const e=this.transform,{density:t}=e,n=j(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class kg extends Lu{constructor(e,t){super(e),this.filter=t}clone(){return new kg(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==Mo("invalid",r,n))return null;const o=t.reduceFieldDef((e,n,r)=>{const o=fn(r)&&t.getScaleComponent(r);if(o){ar(o.get("type"))&&"count"!==n.aggregate&&!_e(i)&&(e[n.field]=n)}return e},{});return V(o).length?new kg(e,o):null}dependentFields(){return new Set(V(this.filter))}producedFields(){return new Set}hash(){return"FilterInvalid "+P(this.filter)}assemble(){const e=V(this.filter).reduce((e,t)=>{const n=this.filter[t],i=co(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Cg extends Lu{constructor(e,t){super(e),this.transform=t,this.transform=B(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!==(n=i[t])&&void 0!==n?n:e})}clone(){return new Cg(this.parent,B(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return"FlattenTransform "+P(this.transform)}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Eg extends Lu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"key",null!==(r=o[1])&&void 0!==r?r:"value"]}clone(){return new Eg(null,B(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return"FoldTransform "+P(this.transform)}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Sg extends Lu{constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}clone(){return new Sg(null,B(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[ft,lt],[gt,dt]]){const r=i.map(e=>{const n=Oo(t.encoding[e]);return Xr(n)?n.field:Kr(n)?{expr:""+n.datum}:io(n)?{expr:""+n.value}:void 0});(r[0]||r[1])&&(e=new Sg(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(bt)){const i=t.typedFieldDef(bt);i.type===Mi&&(e=new Sg(e,null,i.field,t.getName("geojson_"+n++)))}return e}dependentFields(){var e;const t=(null!==(e=this.fields)&&void 0!==e?e:[]).filter(x);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${P(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class $g extends Lu{constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}clone(){return new $g(null,this.projection,B(this.fields),B(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[ft,lt],[gt,dt]]){const i=n.map(e=>{const n=Oo(t.encoding[e]);return Xr(n)?n.field:Kr(n)?{expr:""+n.datum}:io(n)?{expr:""+n.value}:void 0}),r=n[0]===gt?"2":"";(i[0]||i[1])&&(e=new $g(e,t.projectionName(),i,[t.getName("x"+r),t.getName("y"+r)]))}return e}dependentFields(){return new Set(this.fields.filter(x))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${P(this.fields)} ${P(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Bg extends Lu{constructor(e,t){super(e),this.transform=t}clone(){return new Bg(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new Bg(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(Xr(i)&&Xr(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const s=i.impute?r:r.impute?i:void 0,{method:a,value:u,frame:c,keyvals:l}=o.impute,f=Ko(t.mark,n);return new Bg(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:s.field},a?{method:a}:{}),void 0!==u?{value:u}:{}),c?{frame:c}:{}),void 0!==l?{keyvals:l}:{}),f.length?{groupby:f}:{}))}return null}hash(){return"Impute "+P(this.transform)}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:s=[null,null]}=this.transform,a=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(u=n,void 0!==(null==u?void 0:u.stop)?this.processSequence(n):n)}:{}),{method:"value"}),r?{groupby:r}:{}),{value:i&&"value"!==i?null:o});var u;if(i&&"value"!==i){return[a,Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:s,ignorePeers:!1},r?{groupby:r}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[a]}}class _g extends Lu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:t.on,null!==(r=o[1])&&void 0!==r?r:t.loess]}clone(){return new _g(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"LoessTransform "+P(this.transform)}assemble(){const e=this.transform,{loess:t,on:n}=e,i=j(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},i)}}class zg extends Lu{constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new zg(null,B(this.transform),this.secondary)}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let s=null;if(function(e){return"data"in e}(o)){let e=Yg(o.data,r);e||(e=new xd(o.data),r.push(e));const n=t.getName("lookup_"+i);s=new qu(e,n,Na.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=s}else if(function(e){return"selection"in e}(o)){const e=o.selection;if(n=Object.assign({as:e},n),s=t.getSelectionComponent(Q(e),e).materialized,!s)throw new Error(`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new zg(e,n,s.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?m(this.transform.as):this.transform.from.fields)}hash(){return"Lookup "+P({transform:this.transform,secondary:this.secondary})}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:m(this.transform.as)}:{});else{let t=this.transform.as;x(t)||(Kn('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class Ng extends Lu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:"prob",null!==(r=o[1])&&void 0!==r?r:"value"]}clone(){return new Ng(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"QuantileTransform "+P(this.transform)}assemble(){const e=this.transform,{quantile:t}=e,n=j(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Pg extends Lu{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=B(t);const o=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=o[0])&&void 0!==i?i:t.on,null!==(r=o[1])&&void 0!==r?r:t.regression]}clone(){return new Pg(null,B(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"RegressionTransform "+P(this.transform)}assemble(){const e=this.transform,{regression:t,on:n}=e,i=j(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},i)}}class Mg extends Lu{constructor(e,t){super(e),this.transform=t}clone(){return new Mg(null,B(this.transform))}addDimensions(e){var t;this.transform.groupby=W((null!==(t=this.transform.groupby)&&void 0!==t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}hash(){return"PivotTransform "+P(this.transform)}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==i?{limit:i}:{}),void 0!==r?{op:r}:{}),void 0!==n?{groupby:n}:{})}}class Tg extends Lu{constructor(e,t){super(e),this.transform=t}clone(){return new Tg(null,B(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return"SampleTransform "+P(this.transform)}assemble(){return{type:"sample",size:this.transform.sample}}}function Lg(e){let t=0;return function n(i,r){var o;if(i instanceof xd&&!i.isGenerator&&!Ca(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof hd&&(i.parent instanceof xd&&!r.source?(r.format=Object.assign(Object.assign({},null!==(o=r.format)&&void 0!==o?o:{}),{parse:i.assembleFormatParse()}),r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof dd){r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source;for(const t of i.assemble())e.push(t)}else{if((i instanceof vd||i instanceof yd||i instanceof kg||i instanceof Il||i instanceof df||i instanceof $g||i instanceof Sg||i instanceof fd||i instanceof zg||i instanceof Ld||i instanceof Md||i instanceof Eg||i instanceof Cg||i instanceof Fg||i instanceof _g||i instanceof Ng||i instanceof Pg||i instanceof bd||i instanceof Tg||i instanceof Mg)&&r.transform.push(i.assemble()),(i instanceof cd||i instanceof Ru||i instanceof Bg||i instanceof Td)&&r.transform.push(...i.assemble()),i instanceof qu)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof qu)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof qu&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}}function qg(e){return"top"===e||"left"===e||mi(e)?"header":"footer"}function Rg(e,t){var n;const{facet:i,config:r,child:o,component:s}=e;if(e.channelHasField(t)){const a=i[t],u=mf("title",null,r,t);let l=ho(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[t].title&&(l=c(l)?l.join(", "):l,l+=" / "+o.component.layoutHeaders[t].title,o.component.layoutHeaders[t].title=null);const f=mf("labelOrient",a,r,t),d=ae((null!==(n=a.header)&&void 0!==n?n:{}).labels,r.header.labels,!0),g=T(["bottom","right"],f)?"footer":"header";s.layoutHeaders[t]={title:l,facetFieldDef:a,[g]:"facet"===t?[]:[Wg(e,t,d)]}}}function Wg(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function Ug(e,t){var n;const{child:i}=e;if(i.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=Pf(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",s=r[o];for(const r of i.component.axes[t]){const t=qg(r.get("orient"));s[t]=null!==(n=s[t])&&void 0!==n?n:[Wg(e,o,!1)];const i=Xl(r,"main",e.config,{header:!0});i&&s[t][0].axes.push(i),r.mainExtracted=!0}}}}function Hg(e){for(const t of e.children)t.parseLayoutSize()}function Ig(e,t){const n=_f(t),i=sn(n),r=e.component.resolve,o=e.component.layoutSize;let s;for(const t of e.children){const e=t.component.layoutSize.getWithExplicit(n),o=r.scale[i];if("independent"===o&&"step"===e.value){s=void 0;break}if(s){if("independent"===o&&s.value!==e.value){s=void 0;break}s=Fa(s,e,n,"")}else s=e}if(s){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,s)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function Gg(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(sr(e)){const e=Ps(i.view,t);return hi(n)||$s(e)?"step":e}return zs(i.view,t)}if(e.hasProjection||"arc"===e.mark)return zs(i.view,t);{const e=Ps(i.view,t);return $s(e)?e.step:e}}function Vg(e,t,n){return co(t,Object.assign({suffix:"by_"+co(e)},null!=n?n:{}))}class Jg extends Dg{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=vp(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet,i)}initFacet(e,t){return qr(e)?Qo(e,(e,n,i)=>T([Ze,et],i)?void 0===n.field?(Kn(Mn(n,i)),e):(e[i]=wo(n,i,t),e):(Kn(Tn(i,"facet")),e),{}):{facet:wo(e,"facet",t)}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=Qg(this),this.child.parseData()}parseLayoutSize(){Hg(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of qt)Rg(e,t);Ug(e,"x"),Ug(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n;const i={};for(const r of qt)for(const o of vf){const s=this.component.layoutHeaders[r],a=s[o],{facetFieldDef:u}=s;if(u){const t=mf("titleOrient",u,this.config,r);if(T(["right","bottom"],t)){const n=pf(r,t);i.titleAnchor=null!==(e=i.titleAnchor)&&void 0!==e?e:{},i.titleAnchor[n]="end"}}if(null==a?void 0:a[0]){const e="row"===r?"height":"width",a="header"===o?"headerBand":"footerBand";"facet"===r||this.child.component.layoutSize.get(e)||(i[a]=null!==(t=i[a])&&void 0!==t?t:{},i[a][r]=.5),s.title&&(i.offset=null!==(n=i.offset)&&void 0!==n?n:{},i.offset["row"===r?"rowTitle":"columnTitle"]=10)}}return i}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:i})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Jg)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof Jg?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:co(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof Jg){if(this.child.channelHasField("column")){const i=co(this.child.facet.column);e.push(i),t.push("distinct"),n.push("distinct_"+i)}}else for(const i of tn){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(sr(o)&&hi(s)){const r=tg(ng(this.child,i));r?(e.push(r),t.push("distinct"),n.push("distinct_"+r)):Kn(kn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:o,as:s}=this.getCardinalityAggregateForChild(),a=[];for(const e of qt){const t=this.facet[e];if(t){a.push(co(t));const{bin:u,sort:l}=t;if(bn(u)&&a.push(co(t,{binSuffix:"end"})),Tr(l)){const{field:e,op:a=zr}=l,u=Vg(t,l);n&&i?(r.push(u),o.push("max"),s.push(u)):(r.push(e),o.push(a),s.push(u))}else if(c(l)){const n=gf(t,e);r.push(n),o.push("max"),s.push(n)}}}const u=!!n&&!!i;return Object.assign({name:e,data:t,groupby:a},u||r.length>0?{aggregate:Object.assign(Object.assign({},u?{cross:u}:{}),r.length?{fields:r,ops:o,as:s}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?Tr(n.sort)?[Vg(n,n.sort,{expr:"datum"})]:c(n.sort)?[gf(n,e,{expr:"datum"})]:[co(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(Tr(e)?e.order:!c(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return Af(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of bf)if(e[i]){const r=mf("labelOrient",e[i],t,i);if(T(n[i],r))return Af(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Lg(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},i?{title:i}:{}),r?{style:r}:{}),{from:{facet:this.assembleFacet()},sort:{field:qt.map(e=>this.facetSortFields(e)).flat(),order:qt.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&V(e.component.selection).length){const n=O(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:su("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return lc(t)}(this,[])))]}getMapping(){return this.facet}}function Yg(e,t){var n,i,r,o,s,a,u,c,l,f;for(const d of t){const t=d.data;if((!e.name||!d.hasName()||e.name===d.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(i=t.format)||void 0===i?void 0:i.feature)||((null===(r=e.format)||void 0===r?void 0:r.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(s=e.format)||void 0===s?void 0:s.feature)!==(null===(a=t.format)||void 0===a?void 0:a.feature)||((null===(u=e.format)||void 0===u?void 0:u.mesh)||(null===(c=t.format)||void 0===c?void 0:c.mesh))&&(null===(l=e.format)||void 0===l?void 0:l.mesh)!==(null===(f=t.format)||void 0===f?void 0:f.mesh)))if(Ea(e)&&Ea(t)){if($(e.values,t.values))return d}else if(Ca(e)&&Ca(t)){if(e.url===t.url)return d}else if(Sa(e)&&e.name===d.dataName)return d}return null}function Xg(e,t){if(e.data||!e.parent){if(null===e.data){const e=new xd({values:[]});return t.push(e),e}const n=Yg(e.data,t);if(n)return $a(e.data)||(n.data.format=function(e,...t){for(const n of t)R(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new xd(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function Qg(e){var t,n,i,r,o,s,a,u,c,l;let f=Xg(e,e.component.data.sources);const{outputNodes:d,outputNodeRefCounts:g}=e.component.data,p=e.parent?e.parent.component.data.ancestorParse.clone():new ka,m=e.data;$a(m)?(Ba(m)?f=new yd(f,m.sequence):za(m)&&(f=new vd(f,m.graticule)),p.parseNothing=!0):null===(null===(t=null==m?void 0:m.format)||void 0===t?void 0:t.parse)&&(p.parseNothing=!0),f=null!==(n=hd.makeExplicit(f,e,p))&&void 0!==n?n:f,f=new bd(f);const h=e.parent&&jg(e.parent);(xg(e)||Og(e))&&h&&(f=null!==(i=cd.makeFromEncoding(f,e))&&void 0!==i?i:f),e.transforms.length>0&&(f=function(e,t,n){var i,r;let o=0;for(const s of t.transforms){let a,u=void 0;if(Va(s))a=e=new df(e,s),u="derived";else if(Pa(s)){const r=pd(s);a=e=null!==(i=hd.makeWithAncestors(e,{},r,n))&&void 0!==i?i:e,e=new Il(e,t,s.filter)}else if(Ja(s))a=e=cd.makeFromTransform(e,s,t),u="number";else if(Xa(s))u="date",void 0===n.getWithExplicit(s.field).value&&(e=new hd(e,{[s.field]:u}),n.set(s.field,u,!1)),a=e=Ru.makeFromTransform(e,s);else if(Qa(s))a=e=fd.makeFromTransform(e,s),u="number",Dc(t)&&(e=new bd(e));else if(Ma(s))a=e=zg.make(e,t,s,o++),u="derived";else if(Ha(s))a=e=new Ld(e,s),u="number";else if(Ia(s))a=e=new Md(e,s),u="number";else if(Ka(s))a=e=Td.makeFromTransform(e,s),u="derived";else if(Za(s))a=e=new Eg(e,s),u="derived";else if(Ga(s))a=e=new Cg(e,s),u="derived";else if(Ta(s))a=e=new Mg(e,s),u="derived";else if(Ua(s))e=new Tg(e,s);else if(Ya(s))a=e=Bg.makeFromTransform(e,s),u="derived";else if(La(s))a=e=new Fg(e,s),u="derived";else if(qa(s))a=e=new Ng(e,s),u="derived";else if(Ra(s))a=e=new Pg(e,s),u="derived";else{if(!Wa(s)){Kn(`Ignoring an invalid transform: ${N(s)}.`);continue}a=e=new _g(e,s),u="derived"}if(a&&void 0!==u)for(const e of null!==(r=a.producedFields())&&void 0!==r?r:[])n.set(e,u,!1)}return e}(f,e,p));const b=function(e){const t={};if(xg(e)&&e.component.selection)for(const n of V(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&se(e.field)>1&&(t[e.field]="flatten")}return t}(e),v=md(e);f=null!==(r=hd.makeWithAncestors(f,{},Object.assign(Object.assign({},b),v),p))&&void 0!==r?r:f,xg(e)&&(f=Sg.parseAll(f,e),f=$g.parseAll(f,e)),(xg(e)||Og(e))&&(h||(f=null!==(o=cd.makeFromEncoding(f,e))&&void 0!==o?o:f),f=null!==(s=Ru.makeFromEncoding(f,e))&&void 0!==s?s:f,f=df.parseAllForSortIndex(f,e));const y=e.getDataName(Na.Raw),x=new qu(f,y,Na.Raw,g);if(d[y]=x,f=x,xg(e)){const t=fd.makeFromEncoding(f,e);t&&(f=t,Dc(e)&&(f=new bd(f))),f=null!==(a=Bg.makeFromEncoding(f,e))&&void 0!==a?a:f,f=null!==(u=Td.makeFromEncoding(f,e))&&void 0!==u?u:f}xg(e)&&(f=null!==(c=kg.make(f,e))&&void 0!==c?c:f);const O=e.getDataName(Na.Main),w=new qu(f,O,Na.Main,g);d[O]=w,f=w,xg(e)&&function(e,t){jc(e,n=>{const i=n.name,r=e.getName("lookup_"+i);e.component.data.outputNodes[r]=n.materialized=new qu(new Il(t,e,{selection:i}),r,Na.Lookup,e.component.data.outputNodeRefCounts)})}(e,w);let j=null;if(Og(e)){const t=e.getName("facet");f=null!==(l=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Tr(r.sort)){const{field:n,op:i=zr}=r.sort;e=t=new Md(e,{joinaggregate:[{op:i,field:n,as:Vg(r,r.sort,{forAs:!0})}],groupby:[co(r)]})}return t}return null}(f,e.facet))&&void 0!==l?l:f,j=new dd(f,e,t,w.getSource()),d[t]=j}return Object.assign(Object.assign({},e.component.data),{outputNodes:d,outputNodeRefCounts:g,raw:x,main:w,facetRoot:j,ancestorParse:p})}class Kg extends Ag{constructor(e,t,n,i){var r,o,s,a;super(e,"concat",t,n,i,e.resolve),"shared"!==(null===(o=null===(r=e.resolve)||void 0===r?void 0:r.axis)||void 0===o?void 0:o.x)&&"shared"!==(null===(a=null===(s=e.resolve)||void 0===s?void 0:s.axis)||void 0===a?void 0:a.y)||Kn("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map((e,t)=>vp(e,this,this.getName("concat_"+t),void 0,i))}parseData(){this.component.data=Qg(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of V(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Es(e)?e.vconcat:Ss(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Hg(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";Ig(e,t),Ig(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){const e=Ef(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),i?{encode:{update:i}}:{}),e.assembleGroup())})}assembleDefaultLayout(){const e=this.layout.columns;return Object.assign(Object.assign({},null!=e?{columns:e}:{}),{bounds:"full",align:"each"})}}const Zg=Object.assign(Object.assign({disable:1,gridScale:1,scale:1},me),{labelExpr:1,encode:1}),ep=V(Zg);class tp extends Oa{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new tp(B(this.explicit),B(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return mi(this.explicit.orient)}}const np={bottom:"top",top:"bottom",left:"right",right:"left"};function ip(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let i=0;i<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=rp(n,r)}}}return e}function rp(e,t){for(const n of ep){const i=Fa(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(e,t)=>{switch(n){case"title":return Ho(e,t);case"gridScale":return{explicit:e.explicit,value:ae(e.value,t.value)}}return Da(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function op(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(mi(n.labelAngle)?n.labelAngle:ce(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===ff(i,r))return!0}return e===n[t]}const sp=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function ap(e,t){var n,i,r;let o=t.axis(e);const s=new tp,a=Oo(t.encoding[e]),{mark:u,config:c}=t,l=(null==o?void 0:o.orient)||(null===(n=c["x"===e?"axisX":"axisY"])||void 0===n?void 0:n.orient)||(null===(i=c.axis)||void 0===i?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),f=t.getScaleComponent(e).get("type"),d=rf(e,f,l,t.config),g=void 0!==o?!o:sf("disable",c.style,null==o?void 0:o.style,d).configValue;if(s.set("disable",g,void 0!==o),g)return s;o=o||{};const p=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return mi(o)?o:ce(o);{const{configValue:o}=sf("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?ce(o):n!==nt||!T([Pi,zi],e.type)||Xr(e)&&e.timeUnit?void 0:270}}(a,o,e,c.style,d),m={fieldOrDatumDef:a,axis:o,channel:e,model:t,scaleType:f,orient:l,labelAngle:p,mark:u,config:c};for(const n of ep){const i=n in af?af[n](m):be(n)?o[n]:void 0,r=void 0!==i,a=op(i,n,o,t,e);if(r&&a)s.set(n,i,a);else{const{configValue:e,configFrom:t}=be(n)&&"values"!==n?sf(n,c.style,o.style,d):{},u=void 0!==e;r&&!u?s.set(n,i,a):("vgAxisConfig"!==t||sp.has(n)&&u||de(e)||mi(e))&&s.set(n,e,!1)}}const h=null!==(r=o.encoding)&&void 0!==r?r:{},b=ge.reduce((n,i)=>{var r;if(!s.hasAxisPart(i))return n;const o=zf(null!==(r=h[i])&&void 0!==r?r:{},t),a="labels"===i?function(e,t,n){var i;const{encoding:r,config:o}=e,s=null!==(i=Oo(r[t]))&&void 0!==i?i:Oo(r[Xt(t)]),a=e.axis(t)||{},{format:u,formatType:c}=a;return jr(c)?Object.assign({text:kr({fieldOrDatumDef:s,field:"datum.value",format:u,formatType:c,config:o})},n):n}(t,e,o):o;return void 0===a||G(a)||(n[i]={update:a}),n},{});return G(b)||s.set("encode",b,!!o.encoding||void 0!==o.labelAngle),s}function up(e,t,n){const i=Mo("orient",e,n);if(e.orient=function(e,t,n){switch(e){case Ae:case Se:case $e:case ke:case De:case we:return}const{x:i,y:r,x2:o,y2:s}=t;switch(e){case Oe:if(Xr(i)&&(vn(i.bin)||Xr(r)&&r.aggregate&&!i.aggregate))return"vertical";if(Xr(r)&&(vn(r.bin)||Xr(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(s||o){if(n)return n;if(!o&&(Xr(i)&&i.type===_i&&!bn(i.bin)||eo(i)))return"horizontal";if(!s&&(Xr(r)&&r.type===_i&&!bn(r.bin)||eo(r)))return"vertical"}case Fe:if(o&&(!Xr(i)||!vn(i.bin))&&s&&(!Xr(r)||!vn(r.bin)))return;case xe:if(s)return Xr(r)&&vn(r.bin)?"horizontal":"vertical";if(o)return Xr(i)&&vn(i.bin)?"vertical":"horizontal";if(e===Fe){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case je:case Ce:{const t=Zr(i),o=Zr(r);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=i,o=r,s=t.type===Ni,a=o.type===Ni;return s&&!a?"tick"!==e?"vertical":"horizontal":!s&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(e.type,t,i),void 0!==i&&i!==e.orient&&Kn(`Specified orient "${e.orient}" overridden with "${i}".`),"bar"===e.type&&e.orient){const i=Mo("cornerRadiusEnd",e,n);if(void 0!==i){const n="horizontal"===e.orient&&t.x2||"vertical"===e.orient&&t.y2?["cornerRadius"]:Le[e.orient];for(const t of n)e[t]=i;void 0!==e.cornerRadiusEnd&&delete e.cornerRadiusEnd}}void 0===Mo("opacity",e,n)&&(e.opacity=function(e,t){if(T([Ae,Ce,Se,$e],e)&&!Go(t))return.7;return}(e.type,t));return void 0===Mo("cursor",e,n)&&(e.cursor=function(e,t,n){if(t.href||e.href||Mo("href",e,n))return"pointer";return e.cursor}(e,t,n)),e}function cp(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),xu("x",e,{defaultPos:"mid"})),xu("y",e,{defaultPos:"mid"})),bu("size",e)),bu("angle",e)),function(e,t,n){if(n)return{shape:{value:n}};return bu("shape",e)}(e,0,t))}function lp(e){var t;const{config:n,markDef:i}=e,{orient:r}=i,o="horizontal"===r?"width":"height",s=e.getScaleComponent("horizontal"===r?"x":"y"),a=null!==(t=Mo("size",i,n,{vgChannel:o}))&&void 0!==t?t:n.tick.bandSize;if(void 0!==a)return a;{const e=s?s.get("range"):void 0;if(e&&hi(e)&&y(e.step))return 3*e.step/4;return 3*Ns(n.view,o)/4}}const fp={arc:{vgMark:"arc",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),xu("x",e,{defaultPos:"mid"})),xu("y",e,{defaultPos:"mid"})),Cu(e,"radius","arc")),Cu(e,"theta","arc"))},area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"})),Du("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),Du("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),Nu(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Cu(e,"x","bar")),Cu(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>cp(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&Xr(n)&&n.type===Mi?{field:co(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"})),Cu(e,"x","image")),Cu(e,"y","image")),fu(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})),xu("x",e,{defaultPos:"mid"})),xu("y",e,{defaultPos:"mid"})),bu("size",e,{vgChannel:"strokeWidth"})),Nu(e))},point:{vgMark:"symbol",encodeEntry:e=>cp(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Cu(e,"x","rect")),Cu(e,"y","rect"))},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),Du("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n})),Du("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n})),bu("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>cp(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"})),xu("x",e,{defaultPos:"mid"})),xu("y",e,{defaultPos:"mid"})),fu(e)),bu("size",e,{vgChannel:"fontSize"})),bu("angle",e)),Pu("align",function(e,t,n){if(void 0===Mo("align",e,n))return"center";return}(e.markDef,0,t))),Pu("baseline",function(e,t,n){if(void 0===Mo("baseline",e,n))return"middle";return}(e.markDef,0,t))),xu("radius",e,{defaultPos:null,isMidPoint:!0})),xu("theta",e,{defaultPos:null,isMidPoint:!0}))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"})),xu("x",e,{defaultPos:"mid",vgChannel:"xc"})),xu("y",e,{defaultPos:"mid",vgChannel:"yc"})),bu("size",e,{defaultValue:lp(e),vgChannel:r})),{[o]:_o(Mo("thickness",n,t))})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},_u(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"})),xu("x",e,{defaultPos:"mid"})),xu("y",e,{defaultPos:"mid"})),bu("size",e)),Nu(e))}};function dp(e){if(T([je,xe,Ee],e.mark)){const t=Ko(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:gp+e.requestDataName(Na.Main),data:e.requestDataName(Na.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:mp(e,{fromPrefix:gp})}]}(e,t)}else if(T([Oe],e.mark)){const t=xi.some(t=>Mo(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=mp(e,{fromPrefix:pp}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map(e=>`scale('${n}',${e})`).join(",")})`;let o,s;"x"===e.stack.fieldChannel?(o=Object.assign(Object.assign({},_(t.encode.update,["y","yc","y2","height",...xi])),{x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}}),s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update=Object.assign(Object.assign({},z(t.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(o=Object.assign(Object.assign({},_(t.encode.update,["x","xc","x2","width"])),{y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}}),s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update=Object.assign(Object.assign({},z(t.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const n of xi){const i=To(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=_o(i)),i&&(t.encode.update[n]={value:0})}const a=e.fieldDef(e.stack.groupbyChannel),u=co(a)?[co(a)]:[];((null==a?void 0:a.bin)||(null==a?void 0:a.timeUnit))&&u.push(co(a,{binSuffix:"end"}));o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((n,i)=>{if(t.encode.update[i])return Object.assign(Object.assign({},n),{[i]:t.encode.update[i]});{const t=To(i,e.markDef,e.config);return void 0!==t?Object.assign(Object.assign({},n),{[i]:_o(t)}):n}},o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(Na.Main),name:pp+e.requestDataName(Na.Main),groupby:u,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:s},marks:[t]}]}]}(e)}return mp(e)}const gp="faceted_path_";const pp="stack_group_";function mp(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,s=ae(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),a=Po(i),u=r.key,l=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,s=t.order;if(!(!c(s)&&io(s)&&M(s.value)||!s&&M(Mo("order",r,o)))){if((c(s)||Xr(s))&&!n)return Ro(s,{expr:"datum"});if(_e(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(Xr(i)){const t=i.sort;return c(t)?{field:co(i,{prefix:n,suffix:"sort_index",expr:"datum"})}:Tr(t)?{field:co({aggregate:Go(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})}:Mr(t)?{field:co(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}:null===t?void 0:{field:co(i,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}}}(e),f=function(e){if(!e.component.selection)return null;const t=V(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=V(i.component.selection).length,i=i.parent;return n?{interactive:t>0||!!e.encoding.tooltip}:null}(e),d=Mo("aria",i,o),g=fp[n].postEncodingTransform?fp[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:fp[n].vgMark},s?{clip:!0}:{}),a?{style:a}:{}),u?{key:u.field}:{}),l?{sort:l}:{}),f||{}),!1===d?{aria:d}:{}),{from:{data:t.fromPrefix+e.requestDataName(Na.Main)},encode:{update:fp[n].encodeEntry(e)}}),g?{transform:g}:{})]}class hp extends Dg{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,Bs(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const o=Pe(e.mark)?Object.assign({},e.mark):{type:e.mark},s=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=To("filled",e,t),r=e.type;return ae(i,r!==Ae&&r!==je&&r!==Fe)}(o,r,{graticule:e.data&&za(e.data)}));const a=this.encoding=Jo(e.encoding||{},s,o.filled,r);this.markDef=up(o,a,r),this.size=function({encoding:e,size:t}){for(const n of tn){const i=Qt(n);$s(t[i])&&Zr(e[n])&&(delete t[i],Kn(In(i)))}return t}({encoding:a,size:Bs(e)?Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{}):i}),this.stack=Zs(s,a),this.specifiedScales=this.initScales(s,a),this.specifiedAxes=this.initAxes(a),this.specifiedLegends=this.initLegend(a),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t=this.mark===Be,n=e&&Pt.some(t=>to(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return ln.reduce((e,n)=>{var i;const r=Oo(t[n]);return r&&(e[n]=null!==(i=r.scale)&&void 0!==i?i:{}),e},{})}initAxes(e){return tn.reduce((t,n)=>{const i=e[n];if(to(i)||n===nt&&to(e.x2)||n===it&&to(e.y2)){const e=to(i)?i.axis:void 0;t[n]=e?Object.assign({},e):e}return t},{})}initLegend(e){return un.reduce((t,n)=>{const i=Oo(e[n]);if(i&&function(e){switch(e){case pt:case mt:case ht:case vt:case bt:case xt:case jt:case At:return!0;case Ot:case wt:case yt:return!1}}(n)){const e=i.legend;t[n]=e?Object.assign({},e):e}return t},{})}parseData(){this.component.data=Qg(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of tn){const r=Qt(i);if(t[r]){const e=t[r];n.layoutSize.set(r,$s(e)?"step":e,!0)}else{const t=Gg(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const i={},r=e.config.selection;for(const o of V(null!=t?t:{})){const s=B(t[o]),a=j(r[s.type],["fields","encodings"]);for(const e in a)"encodings"===e&&s.fields||"fields"===e&&s.encodings||("mark"===e&&(s[e]=Object.assign(Object.assign({},a[e]),s[e])),void 0!==s[e]&&!0!==s[e]||(s[e]=null!==(n=a[e])&&void 0!==n?n:s[e]));const u=Q(o),c=i[u]=Object.assign(Object.assign({},s),{name:u,events:x(s.on)?su(s.on,"scope"):B(s.on)});ac(c,n=>{n.has(c)&&n.parse&&n.parse(e,c,s,t[o])})}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=dp(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,tn.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[ap(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;jc(e,(i,r)=>{const o=i.name,s=O(o+vc);if(0===t.filter(e=>e.name===o).length){const e="global"===i.resolve?"union":i.resolve,n="multi"===i.type?", true)":")";t.push({name:i.name,update:`${Oc}(${s}, ${O(e)}${n}`})}n=!0,r.topLevelSignals&&(t=r.topLevelSignals(e,i,t)),ac(i,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))})}),n&&0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]});return lc(t)}(this,e)}assembleSignals(){return[...Ql(this),...(e=this,t=[],jc(e,(n,i)=>{const r=n.name;let o=i.modifyExpr(e,n);t.push(...i.signals(e,n)),ac(n,i=>{i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(o=i.modifyExpr(e,n,o))}),t.push({name:r+xc,on:[{events:{signal:n.name+yc},update:`modify(${O(n.name+vc)}, ${o})`}]})}),lc(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return jc(e,t=>{const i={name:t.name+vc};if(t.init){const n=t.project.items.map(e=>j(e,["signals"])),r=t.init.map(e=>uc(e,!1));i.values="interval"===t.type?[{unit:Ac(e,{escape:!1}),fields:n,values:r}]:r.map(t=>({unit:Ac(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+vc).length||n.push(i)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Ef(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&jg(this.parent)||(t=cc(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Io(this.encoding,e)}fieldDef(e){return xo(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return no(t)?t:null}}class bp extends Ag{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o=Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(Js(e))return new bp(e,this,this.getName("layer_"+t),o,r);if(We(e))return new hp(e,this,this.getName("layer_"+t),o,r);throw new Error(wn(e))})}parseData(){this.component.data=Qg(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;Hg(e=this),Ig(e,"width"),Ig(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of V(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:i}=e.component,r={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const r of V(t.component.axes))i.axis[r]=Pf(e.component.resolve,r),"shared"===i.axis[r]&&(n[r]=ip(n[r],t.component.axes[r]),n[r]||(i.axis[r]="independent",delete n[r]))}for(const o of tn){for(const s of e.children)if(s.component.axes[o]){if("independent"===i.axis[o]){n[o]=(null!==(t=n[o])&&void 0!==t?t:[]).concat(s.component.axes[o]);for(const e of s.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!mi(t)){if(r[t]>0&&!n){const n=np[t];r[t]>r[n]&&e.set("orient",n,!1)}r[t]++}}}delete s.component.axes[o]}if("independent"===i.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),Ql(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),Ef(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)xg(n)&&(t=cc(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),ed(this))}}function vp(e,t,n,i,r){if(Wr(e))return new Jg(e,t,n,r);if(Js(e))return new bp(e,t,n,i,r);if(We(e))return new hp(e,t,n,i,r);if(function(e){return Es(e)||Ss(e)||Cs(e)}(e))return new Kg(e,t,n,r);throw new Error(wn(e))}e.compile=function(e,t={}){var n;t.logger&&(n=t.logger,Qn=n),t.fieldTitle&&mo(t.fieldTitle);try{const n=Ws(d(t.config,e.config)),i=ha(e,n),r=vp(i,null,"",void 0,n);r.parse(),function(e,t){Wd(e.sources);let n=0,i=0;for(let i=0;i<5&&Hd(e,t,!0);i++)n++;e.sources.map(qd);for(let n=0;n<5&&Hd(e,t,!1);n++)i++;Wd(e.sources),5===Math.max(n,i)&&Kn("Maximum optimization runs(5) reached.")}(r.component.data,r);return{spec:function(e,t,n={},i){const r=e.config?Gs(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){var n,i;const r=[],o=Lg(r);let s=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+s++);const e=t.assemble();o(t,e)}for(const e of r)0===e.transform.length&&delete e.transform;let a=0;for(const[e,t]of r.entries())0!==(null!==(n=t.transform)&&void 0!==n?n:[]).length||t.source||r.splice(a++,0,r.splice(e,1)[0]);for(const t of r)for(const n of null!==(i=t.transform)&&void 0!==i?i:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of r)e.name in t&&(e.values=t[e.name]);return r}(e.component.data,n)),s=e.assembleProjections(),a=e.assembleTitle(),u=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let l=e.assembleLayoutSignals();return l=l.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),a?{title:a}:{}),u?{style:u}:{}),c?{encode:{update:c}}:{}),{data:o}),s.length>0?{projections:s}:{}),e.assembleGroup([...l,...e.assembleSelectionTopLevelSignals([])])),r?{config:r}:{}),i?{usermeta:i}:{})}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):x(t)&&(t={type:t});if(r&&o&&(s=t.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===r&&"step"===o)Kn(Fn()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Kn(Fn(sn(e)));const n="width"===e?"height":"width";t.type=function(e){return e?"fit-"+sn(e):"fit"}(n)}var s;return Object.assign(Object.assign(Object.assign({},1===V(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),xa(n)),xa(e))}(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&(Qn=Xn),t.fieldTitle&&mo(go)}},e.normalize=ha,e.version="4.15.0",Object.defineProperty(e,"__esModule",{value:!0})}));