!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";var i="5.1.0";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 r=function(e){var t={exports:{}};return e(t,t.exports),t.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,s,u,l,c){"object"==typeof s&&(u=s.depth,l=s.prototype,c=s.includeNonEnumerable,s=s.circular);var f=[],d=[],p="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===u&&(u=1/0),function o(u,m){if(null===u)return null;if(0===m)return u;var g,h;if("object"!=typeof u)return u;if(e(u,t))g=new t;else if(e(u,n))g=new n;else if(e(u,i))g=new i((function(e,t){u.then((function(t){e(o(t,m-1))}),(function(e){t(o(e,m-1))}))}));else if(r.__isArray(u))g=[];else if(r.__isRegExp(u))g=new RegExp(u.source,a(u)),u.lastIndex&&(g.lastIndex=u.lastIndex);else if(r.__isDate(u))g=new Date(u.getTime());else{if(p&&Buffer.isBuffer(u))return g=Buffer.allocUnsafe?Buffer.allocUnsafe(u.length):new Buffer(u.length),u.copy(g),g;e(u,Error)?g=Object.create(u):void 0===l?(h=Object.getPrototypeOf(u),g=Object.create(h)):(g=Object.create(l),h=l)}if(s){var v=f.indexOf(u);if(-1!=v)return d[v];f.push(u),d.push(g)}for(var y in e(u,t)&&u.forEach((function(e,t){var n=o(t,m-1),i=o(e,m-1);g.set(n,i)})),e(u,n)&&u.forEach((function(e){var t=o(e,m-1);g.add(t)})),u){var b;h&&(b=Object.getOwnPropertyDescriptor(h,y)),b&&null==b.set||(g[y]=o(u[y],m-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);for(y=0;yc(e,t)))}:a(e)?{or:e.or.map((e=>c(e,t)))}:t(e)}const f=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 a=o[r];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n},d=r;function p(e,n){const i={};for(const r of n)t.hasOwnProperty(e,r)&&(i[r]=e[r]);return i}function m(e,t){const n={...e};for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>o(e))).join(",")})`};const g=o;function h(e){if(t.isNumber(e))return e;const n=t.isString(e)?e:o(e);if(n.length<250)return n;let i=0;for(let e=0;e0===t?e:`[${e}]`)),r=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of r)n.add(e)}return n}function C(e,t){return void 0===e||void 0===t||$(k(e),k(t))}function S(e){return 0===E(e).length}const E=Object.keys,B=Object.values,_=Object.entries;function z(e){return!0===e||!1===e}function O(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function P(e,t){return u(e)?`!(${P(e.not,t)})`:s(e)?`(${e.and.map((e=>P(e,t))).join(") && (")})`:a(e)?`(${e.or.map((e=>P(e,t))).join(") || (")})`:t(e)}function N(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&N(e[n],t)&&delete e[n],S(e)}function j(e){return e.charAt(0).toUpperCase()+e.substr(1)}function M(e,n="datum"){const i=t.splitAccessPath(e),r=[];for(let e=1;e<=i.length;e++){const o=`[${i.slice(0,e).map(t.stringValue).join("][")}]`;r.push(`${n}${o}`)}return r.join(" && ")}function T(e,n="datum"){return`${n}[${t.stringValue(t.splitAccessPath(e).join("."))}]`}function L(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function q(e){return`${t.splitAccessPath(e).map(L).join("\\.")}`}function R(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function W(e){return`${t.splitAccessPath(e).join(".")}`}function U(e){return e?t.splitAccessPath(e).length:0}function H(...e){for(const t of e)if(void 0!==t)return t}let I=42;function V(e){const t=++I;return e?String(e)+t:t}function G(e){return Y(e)?e:`__${e}`}function Y(e){return e.startsWith("__")}function X(e){if(void 0!==e)return(e%360+360)%360}function J(e){return!!t.isNumber(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const Q="row",K="column",Z="facet",ee="x",te="y",ne="x2",ie="y2",re="radius",oe="radius2",ae="theta",se="theta2",ue="latitude",le="longitude",ce="latitude2",fe="longitude2",de="color",pe="fill",me="stroke",ge="shape",he="size",ve="angle",ye="opacity",be="fillOpacity",xe="strokeOpacity",we="strokeWidth",Ae="strokeDash",De="text",Fe="order",$e="detail",ke="key",Ce="tooltip",Se="href",Ee="url",Be="description",_e={theta:1,theta2:1,radius:1,radius2:1};function ze(e){return e in _e}const Oe={longitude:1,longitude2:1,latitude:1,latitude2:1};const Pe=E(Oe),Ne={x:1,y:1,x2:1,y2:1,..._e,...Oe,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 je(e){return e===de||e===pe||e===me}const Me={row:1,column:1,facet:1},Te=E(Me),Le={...Ne,...Me},qe=E(Le),{order:Re,detail:We,tooltip:Ue,...He}=Le,{row:Ie,column:Ve,facet:Ge,...Ye}=He;function Xe(e){return!!Le[e]}const Je=[ne,ie,ce,fe,se,oe];function Qe(e){return Ke(e)!==e}function Ke(e){switch(e){case ne:return ee;case ie:return te;case ce:return ue;case fe:return le;case se:return ae;case oe:return re}return e}function Ze(e){if(ze(e))switch(e){case ae:return"startAngle";case se:return"endAngle";case re:return"outerRadius";case oe:return"innerRadius"}return e}function et(e){switch(e){case ee:return ne;case te:return ie;case ue:return ce;case le:return fe;case ae:return se;case re:return oe}}function tt(e){switch(e){case ee:case ne:return"width";case te:case ie:return"height"}}const{x:nt,y:it,x2:rt,y2:ot,latitude:at,longitude:st,latitude2:ut,longitude2:lt,theta:ct,theta2:ft,radius:dt,radius2:pt,...mt}=Ne,gt=E(mt),ht={x:1,y:1},vt=E(ht);function yt(e){return e in ht}const bt={theta:1,radius:1},xt=E(bt);function wt(e){return"width"===e?ee:te}const{text:At,tooltip:Dt,href:Ft,url:$t,description:kt,detail:Ct,key:St,order:Et,...Bt}=mt,_t=E(Bt);const zt={...ht,...bt,...Bt},Ot=E(zt);function Pt(e){return!!zt[e]}function Nt(e,t){return function(e){switch(e){case de:case pe:case me:case Be:case $e:case ke:case Ce:case Se:case Fe:case ye:case be:case xe:case we:case Z:case Q:case K:return jt;case ee:case te:case ue:case le:return Tt;case ne:case ie:case ce:case fe:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case he:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Ae:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case ge:return{point:"always",geoshape:"always"};case De:return{text:"always"};case ve:return{point:"always",square:"always",text:"always"};case Ee:return{image:"always"};case ae:case re:return{text:"always",arc:"always"};case se:case oe:return{arc:"always"}}}(e)[t]}const jt={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"},{geoshape:Mt,...Tt}=jt;function Lt(e){switch(e){case ee:case te:case ae:case re:case he:case ve:case we:case ye:case be:case xe:case ne:case ie:case se:case oe:return;case Z:case Q:case K:case ge:case Ae:case De:case Ce:case Se:case Ee:case Be:return"discrete";case de:case pe:case me:return"flexible";case ue:case le:case ce:case fe:case $e:case ke:case Fe:return}}const qt={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},Rt={count:1,min:1,max:1};function Wt(e){return!!e&&!!e.argmin}function Ut(e){return!!e&&!!e.argmax}function Ht(e){return t.isString(e)&&!!qt[e]}const It=["count","valid","missing","distinct"];function Vt(e){return t.isString(e)&&y(It,e)}const Gt=["count","sum","distinct","valid","missing"],Yt=t.toSet(["mean","average","median","q1","q3","min","max"]);function Xt(e){return t.isBoolean(e)&&(e=ua(e,void 0)),"bin"+E(e).map((t=>Zt(e[t])?O(`_${t}_${_(e[t])}`):O(`_${t}_${e[t]}`))).join("")}function Jt(e){return!0===e||Kt(e)&&!e.binned}function Qt(e){return"binned"===e||Kt(e)&&!0===e.binned}function Kt(e){return t.isObject(e)}function Zt(e){return null==e?void 0:e.param}function en(e){switch(e){case Q:case K:case he:case de:case pe:case me:case we:case ye:case be:case xe:case ge:return 6;case Ae:return 4;default:return 10}}function tn(e){return e&&!!e.expr}function nn(e){const t=E(e||{}),n={};for(const i of t)n[i]=pn(e[i]);return n}function rn(e){const{anchor:t,frame:n,offset:i,orient:r,color:o,subtitleColor:a,subtitleFont:s,subtitleFontSize:u,subtitleFontStyle:l,subtitleFontWeight:c,subtitleLineHeight:f,subtitlePadding:d,...m}=e,g={...m,...o?{fill:o}:{}},h={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{}},v={...a?{subtitleColor:a}:{},...s?{subtitleFont:s}:{},...u?{subtitleFontSize:u}:{},...l?{subtitleFontStyle:l}:{},...c?{subtitleFontWeight:c}:{},...f?{subtitleLineHeight:f}:{},...d?{subtitlePadding:d}:{}};return{titleMarkConfig:g,subtitleMarkConfig:p(g,["align","baseline","dx","dy","limit"]),nonMark:h,subtitle:v}}function on(e){return t.isString(e)||t.isArray(e)&&t.isString(e[0])}function an(e){return e&&!!e.signal}function sn(e){return!!e.step}function un(e){return!t.isArray(e)&&("field"in e&&"data"in e)}const ln=E({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,url:1,smooth:1}),cn={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},fn=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function dn(e){const n=t.isArray(e.condition)?e.condition.map(mn):mn(e.condition);return{...pn(e),condition:n}}function pn(e){if(tn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function mn(e){if(tn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function gn(e){if(tn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return an(e)?e:void 0!==e?{value:e}:void 0}function hn(e){return an(e)?e.signal:t.stringValue(e.value)}function vn(e){return an(e)?e.signal:null==e?null:t.stringValue(e)}function yn(e,t,n){for(const i of n){const n=wn(i,t.markDef,t.config);void 0!==n&&(e[i]=gn(n))}return e}function bn(e){var t;return[].concat(e.type,null!==(t=e.style)&&void 0!==t?t:[])}function xn(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?wn(e,t,n,i):void 0}function wn(e,t,n,{vgChannel:i}={}){return H(i?An(e,t,n.style):void 0,An(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function An(e,t,n){return Dn(e,bn(t),n)}function Dn(e,n,i){let r;n=t.array(n);for(const t of n){const n=i[t];n&&void 0!==n[e]&&(r=n[e])}return r}function Fn(e,n){return t.array(e).reduce(((e,t)=>{var i;return e.field.push(Yo(t,n)),e.order.push(null!==(i=t.sort)&&void 0!==i?i:"ascending"),e}),{field:[],order:[]})}function $n(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(f(t,e))return;n.push(e)})),n}function kn(e,n){return f(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function Cn(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((on(n)||an(n))&&(on(i)||an(i)))return{explicit:e.explicit,value:kn(n,i)};if(on(n)||an(n))return{explicit:e.explicit,value:n};if(on(i)||an(i))return{explicit:e.explicit,value:i};if(!(on(n)||an(n)||on(i)||an(i)))return{explicit:e.explicit,value:$n(n,i)};throw new Error("It should never reach here")}function Sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function En(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Bn(e,t,"set"),n),n}function Bn(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function _n(e){return`Invalid specification ${g(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const zn='Autosize "fit" only works for single views and layered views.';function On(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function Pn(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function Nn(e){return e?`Dropping "fit-${e}" because spec has discrete ${tt(e)}.`:'Dropping "fit" because spec has discrete size.'}function jn(e){return`Unknown field for ${e}. Cannot calculate view size.`}function Mn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Tn(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Ln(e){return`Selection not supported for ${e} yet.`}const qn="The same selection must be used to override scale domains in a layered view.";function Rn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function Wn(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function Un(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function Hn(e){return`Invalid field type "${e}".`}function In(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 Vn(e,t){return`Dropping ${g(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function Gn(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function Yn(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function Xn(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Jn(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function Qn(e){return`Using unaggregated domain with raw field has no effect (${g(e)}).`}function Kn(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Zn(e){return`Unaggregated domain is currently unsupported for log scale (${g(e)}).`}function ei(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function ti(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const ni="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function ii(e,t){return`Invalid ${e}: ${g(t)}.`}function ri(e){return`1D error band does not support ${e}.`}function oi(e){return`Channel ${e} is required for "binned" bin.`}const ai=t.logger(t.Warn);let si=ai;function ui(...e){si.warn(...e)}function li(e){if(e&&t.isObject(e))for(const t of vi)if(t in e)return!0;return!1}const ci=["january","february","march","april","may","june","july","august","september","october","november","december"],fi=ci.map((e=>e.substr(0,3))),di=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],pi=di.map((e=>e.substr(0,3)));function mi(e,n){const i=[];if(n&&void 0!==e.day&&E(e).length>1&&(ui(function(e){return`Dropping day from datetime ${g(e)} as day cannot be combined with other units.`}(e)),delete(e=d(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const r=n?function(e){if(J(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=ci.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=fi.indexOf(i);if(-1!==r)return r;throw new Error(ii("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=n?function(e){if(J(e)&&(e=+e),t.isNumber(e))return e>4&&ui(ii("quarter",e)),e-1;throw new Error(ii("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(r)?3*r:`${r}*3`)}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const r=n?function(e){if(J(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=di.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=pi.indexOf(i);if(-1!==r)return r;throw new Error(ii("day",e))}}(e.day):e.day;i.push(t.isNumber(r)?r+1:`${r}+1`)}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}return i}function gi(e){const t=mi(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const hi={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},vi=E(hi);function yi(e){return e.startsWith("utc")}const bi={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function xi(e){return vi.filter((t=>wi(e,t)))}function wi(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 Ai(e,t,{end:n}={end:!1}){const i=M(t),r=yi(e)?"utc":"";let o;const a={};for(const t of vi)wi(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=mi(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function Di(e){if(!e)return;const t=xi(e);return`timeUnitSpecifier(${g(t)}, ${g(bi)})`}function Fi(e){if(!e)return;let n;return t.isString(e)?n={unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),yi(n.unit)&&(n.utc=!0,n.unit=n.unit.substr(3)),n}function $i(e){return e&&!!e.field&&void 0!==e.equal}function ki(e){return e&&!!e.field&&void 0!==e.lt}function Ci(e){return e&&!!e.field&&void 0!==e.lte}function Si(e){return e&&!!e.field&&void 0!==e.gt}function Ei(e){return e&&!!e.field&&void 0!==e.gte}function Bi(e){if(e&&e.field){if(t.isArray(e.range)&&2===e.range.length)return!0;if(an(e.range))return!0}return!1}function _i(e){return e&&!!e.field&&(t.isArray(e.oneOf)||t.isArray(e.in))}function zi(e){return _i(e)||$i(e)||Bi(e)||ki(e)||Si(e)||Ci(e)||Ei(e)}function Oi(e,t){return fa(e,{timeUnit:t,wrapTime:!0})}function Pi(e,t=!0){var n;const{field:i}=e,r=null===(n=Fi(e.timeUnit))||void 0===n?void 0:n.unit,o=r?`time(${Ai(r,i)})`:Yo(e,{expr:"datum"});if($i(e))return`${o}===${Oi(e.equal,r)}`;if(ki(e)){return`${o}<${Oi(e.lt,r)}`}if(Si(e)){return`${o}>${Oi(e.gt,r)}`}if(Ci(e)){return`${o}<=${Oi(e.lte,r)}`}if(Ei(e)){return`${o}>=${Oi(e.gte,r)}`}if(_i(e))return`indexof([${function(e,t){return e.map((e=>Oi(e,t)))}(e.oneOf,r).join(",")}], ${o}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return Ni(o,e.valid);if(Bi(e)){const{range:n}=e,i=an(n)?{signal:`${n.signal}[0]`}:n[0],a=an(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==a&&t)return"inrange("+o+", ["+Oi(i,r)+", "+Oi(a,r)+"])";const s=[];return null!==i&&s.push(`${o} >= ${Oi(i,r)}`),null!==a&&s.push(`${o} <= ${Oi(a,r)}`),s.length>0?s.join(" && "):"true"}throw new Error(`Invalid field predicate: ${g(e)}`)}function Ni(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function ji(e){var t;return zi(e)&&e.timeUnit?{...e,timeUnit:null===(t=Fi(e.timeUnit))||void 0===t?void 0:t.unit}:e}const Mi="quantitative",Ti="ordinal",Li="temporal",qi="nominal",Ri="geojson";const Wi="linear",Ui="log",Hi="pow",Ii="sqrt",Vi="symlog",Gi="time",Yi="utc",Xi="quantile",Ji="quantize",Qi="threshold",Ki="point",Zi="band",er={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 tr(e,t){const n=er[e],i=er[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const nr={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 ir(e){return nr[e]}const rr=["linear","log","pow","sqrt","symlog","time","utc"],or=t.toSet(rr),ar=t.toSet(["linear","log","pow","sqrt","symlog"]);const sr=t.toSet(["quantile","quantize","threshold"]),ur=rr.concat(["quantile","quantize","threshold","sequential","identity"]),lr=t.toSet(ur),cr=t.toSet(["ordinal","bin-ordinal","point","band"]);function fr(e){return e in cr}function dr(e){return e in lr}function pr(e){return e in or}function mr(e){return e in sr}function gr(e){return null==e?void 0:e.param}const{type:hr,domain:vr,range:yr,rangeMax:br,rangeMin:xr,scheme:wr,...Ar}={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},Dr=E(Ar);function Fr(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return pr(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return pr(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"clamp":return pr(e);case"nice":return pr(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return dr(e)&&!y(["log","time","utc","threshold","quantile"],e)}}function $r(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return je(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}}const kr={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"},Cr=kr.arc,Sr=kr.area,Er=kr.bar,Br=kr.image,_r=kr.line,zr=kr.point,Or=kr.rect,Pr=kr.rule,Nr=kr.text,jr=kr.tick,Mr=kr.trail,Tr=kr.circle,Lr=kr.square,qr=kr.geoshape;function Rr(e){return["line","area","trail"].includes(e)}function Wr(e){return["rect","bar","image","arc"].includes(e)}const Ur=E(kr);function Hr(e){return e.type}t.toSet(Ur);const Ir=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Vr=E({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),Gr=E({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function Yr(e){return e&&null!=e.band}const Xr={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},Jr={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Qr={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function Kr(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=ro(e);return No(n)&&!Vt(n.aggregate)&&r&&pr(r.get("type"))&&!1===r.get("zero")?Zr({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function Zr({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(Rr(n.type))return i;return null===xn("invalid",n,r)?i:[eo(e,t),i]}function eo(e,t){return{test:to(e,!0),..."y"===Ke(t)?{field:{group:"height"}}:{value:0}}}function to(e,n=!0){return Ni(t.isString(e)?e:Yo(e,{expr:"datum"}),!n)}function no(e,t,n,i){const r={};if(t&&(r.scale=t),Mo(e)){const{datum:t}=e;li(t)?r.signal=gi(t):an(t)?r.signal=t.signal:tn(t)?r.signal=t.expr:r.value=t}else r.field=Yo(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function io({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=0O(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+E(n).map((e=>O(`_${e}_${n[e]}`))).join("")}(f),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(null!==(u=t.suffix)&&void 0!==u?u:"")}}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?W(n):t.expr?T(n,t.expr)+o:q(n)+o}function Xo(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return No(e)&&!!e.bin;case"temporal":return!1}throw new Error(Hn(e.type))}const Jo=(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(Ut(t))return`${r} for argmax(${t.argmax})`;if(Wt(t))return`${r} for argmin(${t.argmin})`;const o=Fi(i),a=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||Jt(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(Jt(i))return`${n} (binned)`;if(r){var a;const e=null===(a=Fi(r))||void 0===a?void 0:a.unit;if(e)return`${n} (${xi(e).join("-")})`}else if(o)return Ut(o)?`${n} for max ${o.argmax}`:Wt(o)?`${n} for min ${o.argmin}`:`${j(o)} of ${n}`;return n}(e,t)}};let Qo=Jo;function Ko(e){Qo=e}function Zo(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const o=null===(r=ea(e))||void 0===r?void 0:r.title;if(!No(e))return o;const a=e,s=i?ta(a,t):void 0;return n?H(o,a.title,s):null!==(u=null!=o?o:a.title)&&void 0!==u?u:s;var u}function ea(e){return Ho(e)&&e.axis?e.axis:Io(e)&&e.legend?e.legend:$o(e)&&e.header?e.header:void 0}function ta(e,t){return Qo(e,t)}function na(e){if(Vo(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{var t;const n=null!==(t=ea(e))&&void 0!==t?t:{},{format:i,formatType:r}=n;return{format:i,formatType:r}}}function ia(e){return No(e)?e:Oo(e)?e.condition:void 0}function ra(e){return qo(e)?e:Po(e)?e.condition:void 0}function oa(e,n,i,r={}){if(t.isString(e)||t.isNumber(e)||t.isBoolean(e)){return ui(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${g(n)}}.`}(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return qo(e)?aa(e,n,i,r):Po(e)?{...e,condition:aa(e.condition,n,i,r)}:e}function aa(e,n,i,r){if(Vo(e)){const{format:t,formatType:o,...a}=e;if(ao(o)&&!i.customFormatTypes)return ui(Un(n)),aa(a,n,i,r)}else{const t=Ho(e)?"axis":Io(e)?"legend":$o(e)?"header":null;if(t&&e[t]){const{format:o,formatType:a,...s}=e[t];if(ao(a)&&!i.customFormatTypes)return ui(Un(n)),aa({...e,[t]:s},n,i,r)}}return No(e)?sa(e,n,r):function(e){let n=e.type;if(n)return e;const{datum:i}=e;return n=t.isNumber(i)?"quantitative":t.isString(i)?"nominal":li(i)?"temporal":void 0,{...e,type:n}}(e)}function sa(e,n,{compositeMark:i=!1}={}){const{aggregate:r,timeUnit:o,bin:a,field:s}=e,u={...e};if(i||!r||Ht(r)||Ut(r)||Wt(r)||(ui(function(e){return`Invalid aggregation operator "${e}".`}(r)),delete u.aggregate),o&&(u.timeUnit=Fi(o)),s&&(u.field=`${s}`),Jt(a)&&(u.bin=ua(a,n)),Qt(a)&&!yt(n)&&ui(function(e){return`Channel ${e} should not be used with "binned" bin.`}(n)),Ro(u)){const{type:e}=u,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case Mi:return"quantitative";case"t":case Li:return"temporal";case"o":case Ti:return"ordinal";case"n":case qi:return"nominal";case Ri:return"geojson"}}(e);e!==t&&(u.type=t),"quantitative"!==e&&Vt(r)&&(ui(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,r)),u.type="quantitative")}else if(!Qe(n)){const e=function(e,n){var i;switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(So(e)&&t.isArray(e.sort))return"ordinal";const{aggregate:r,bin:o,timeUnit:a}=e;if(a)return"temporal";if(o||r&&!Ut(r)&&!Wt(r))return"quantitative";if(Uo(e)&&null!==(i=e.scale)&&void 0!==i&&i.type)switch(er[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,n);u.type=e}if(Ro(u)){const{compatible:e,warning:t}=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 Q:case K:case Z:return Xo(e)?la:{compatible:!1,warning:Yn(t)};case ee:case te:case de:case pe:case me:case De:case $e:case ke:case Ce:case Se:case Ee:case ve:case ae:case re:case Be:return la;case le:case fe:case ue:case ce:return n!==Mi?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:la;case ye:case be:case xe:case we:case he:case se:case oe:case ne:case ie:return"nominal"!==n||e.sort?la:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case ge:case Ae:return Xo(e)||Uo(i=e)&&mr(null===(r=i.scale)||void 0===r?void 0:r.type)?la:{compatible:!1,warning:Xn(t)};case Fe:return"nominal"!==e.type||"sort"in e?la:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(u,n)||{};!1===e&&ui(t)}if(So(u)&&t.isString(u.sort)){const{sort:e}=u;if(xo(e))return{...u,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&xo(t))return{...u,sort:{encoding:t,order:"descending"}}}if($o(u)){const{header:e}=u;if(e){const{orient:t,...n}=e;if(t)return{...u,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return u}function ua(e,n){return t.isBoolean(e)?{maxbins:en(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:en(n)}}const la={compatible:!0};function ca(e){const{formatType:t}=na(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||No(n)&&!!n.timeUnit));var n}function fa(e,{timeUnit:n,type:i,wrapTime:r,undefinedIfExprNotRequired:o}){var a;const s=n&&(null===(a=Fi(n))||void 0===a?void 0:a.unit);let u,l=s||"temporal"===i;return tn(e)?u=e.expr:an(e)?u=e.signal:li(e)?(l=!0,u=gi(e)):(t.isString(e)||t.isNumber(e))&&l&&(u=`datetime(${g(e)})`,function(e){return!!hi[e]}(s)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(u=gi({[s]:e}))),u?r&&l?`time(${u})`:u:o?void 0:g(e)}function da(e,t){const{type:n}=e;return t.map((t=>{const i=fa(t,{timeUnit:No(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function pa(e,t){return Jt(e.bin)?Pt(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const ma={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 ga(e){return e&&e.condition}const ha=["domain","grid","labels","ticks","title"],va={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:"both",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"},ya={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},ba={...ya,style:1,labelExpr:1,encoding:1};function xa(e){return!!ba[e]}const wa=E({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Aa(e){return"mark"in e}class Da{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!Aa(e)&&(Hr(t=e.mark)?t.type:t)===this.name;var t}}function Fa(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?b(i,(e=>!!e.field)):No(i)||Oo(i))}function $a(e){return b(qe,(n=>{if(Fa(e,n)){const i=e[n];if(t.isArray(i))return b(i,(e=>!!e.aggregate));{const e=ia(i);return e&&!!e.aggregate}}return!1}))}function ka(e,t){const n=[],i=[],r=[],o=[],a={};return Ea(e,((s,u)=>{if(No(s)){const{field:l,aggregate:c,bin:f,timeUnit:d,...p}=s;if(c||d||f){const e=ea(s),m=e&&e.title;let g=Yo(s,{forAs:!0});const h={...m?[]:{title:Zo(s,t,{allowDisabling:!0})},...p,field:g};if(c){let e;if(Ut(c)?(e="argmax",g=Yo({op:"argmax",field:c.argmax},{forAs:!0}),h.field=`${g}.${l}`):Wt(c)?(e="argmin",g=Yo({op:"argmin",field:c.argmin},{forAs:!0}),h.field=`${g}.${l}`):"boxplot"!==c&&"errorbar"!==c&&"errorband"!==c&&(e=c),e){const t={op:e,as:g};l&&(t.field=l),o.push(t)}}else if(n.push(g),Ro(s)&&Jt(f)){if(i.push({bin:f,field:l,as:g}),n.push(Yo(s,{binSuffix:"end"})),pa(s,u)&&n.push(Yo(s,{binSuffix:"range"})),yt(u)){const e={field:`${g}_end`};a[`${u}2`]=e}h.bin="binned",Qe(u)||(h.type=Mi)}else if(d){r.push({timeUnit:d,field:l,as:g});const e=Ro(s)&&s.type!==Li&&"time";e&&(u===De||u===Ce?h.formatType=e:!function(e){return!!mt[e]}(u)?yt(u)&&(h.axis={formatType:e,...h.axis}):h.legend={formatType:e,...h.legend})}a[u]=h}else n.push(l),a[u]=e[u]}else a[u]=e[u]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function Ca(e,n,i,r){return E(e).reduce(((o,a)=>{if(!Xe(a))return ui(function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}(a)),o;const s=e[a];if("angle"!==a||"arc"!==n||e.theta||(ui("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=ae),!function(e,t,n){const i=Nt(t,n);if(!i)return!1;if("binned"===i){const n=e[t===ne?ee:te];return!!(No(n)&&No(e[t])&&Qt(n.bin))}return!0}(e,a,n))return ui(Gn(a,n)),o;if(a===he&&"line"===n){const t=ia(e[a]);if(null!=t&&t.aggregate)return ui("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."),o}if(a===de&&(i?"fill"in e:"stroke"in e))return ui(In("encoding",{fill:"fill"in e,stroke:"stroke"in e})),o;if(a===$e||a===Fe&&!t.isArray(s)&&!Wo(s)||a===Ce&&t.isArray(s))s&&(o[a]=t.array(s).reduce(((e,t)=>(No(t)?e.push(sa(t,a)):ui(Vn(t,a)),e)),[]));else{if(a===Ce&&null===s)o[a]=null;else if(!(No(s)||Mo(s)||Wo(s)||zo(s)||an(s)))return ui(Vn(s,a)),o;o[a]=oa(s,a,r)}return o}),{})}function Sa(e,t){const n={};for(const i of E(e)){const r=oa(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Ea(e,n,i){if(e)for(const r of E(e)){const o=e[r];if(t.isArray(o))for(const e of o)n.call(i,e,r);else n.call(i,o,r)}}function Ba(e,n){return E(n).reduce(((i,r)=>{switch(r){case ee:case te:case Se:case Be:case Ee:case ne:case ie:case ae:case se:case re:case oe:case ue:case le:case ce:case fe:case De:case ge:case ve:case Ce:return i;case Fe:if("line"===e||"trail"===e)return i;case $e:case ke:{const e=n[r];if(t.isArray(e)||No(e))for(const n of t.array(e))n.aggregate||i.push(Yo(n,{}));return i}case he:if("trail"===e)return i;case de:case pe:case me:case ye:case be:case xe:case Ae:case we:{const e=ia(n[r]);return e&&!e.aggregate&&i.push(Yo(e,{})),i}}}),[])}function _a(e,n,i,r=!0){if("tooltip"in i)return{tooltip:i.tooltip};return{tooltip:[...e.map((({fieldPrefix:e,titlePrefix:t})=>{const i=r?` of ${za(n)}`:"";return{field:e+n.field,type:n.type,title:an(t)?{signal:`${t}"${escape(i)}"`}:t+i}})),...D(function(e){const n=[];for(const i of E(e))if(Fa(e,i)){const r=e[i],o=t.array(r);for(const e of o)No(e)?n.push(e):Oo(e)&&n.push(e.condition)}return n}(i).map(Go),h)]}}function za(e){const{title:t,field:n}=e;return H(t,n)}function Oa(e,n,i,r,o){const{scale:a,axis:s}=i;return({partName:u,mark:l,positionPrefix:c,endPositionPrefix:f,extraEncoding:d={}})=>{const p=za(i);return Pa(e,u,o,{mark:l,encoding:{[n]:{field:`${c}_${i.field}`,type:i.type,...void 0!==p?{title:p}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(f)?{[`${n}2`]:{field:`${f}_${i.field}`}}:{},...r,...d}})}}function Pa(e,n,i,r){const{clip:o,color:a,opacity:s}=e,u=e.type;return e[n]||void 0===e[n]&&i[n]?[{...r,mark:{...i[n],...o?{clip:o}:{},...a?{color:a}:{},...s?{opacity:s}:{},...Hr(r.mark)?r.mark:{type:r.mark},style:`${u}-${n}`,...t.isBoolean(e[n])?{}:e[n]}}]:[]}function Na(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ja(o,n),continuousAxisChannelDef2:ja(a,n),continuousAxisChannelDefError:ja(s,n),continuousAxisChannelDefError2:ja(u,n),continuousAxis:r}}function ja(e,t){if(e&&e.aggregate){const{aggregate:n,...i}=e;return n!==t&&ui(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function Ma(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(Hr(n)&&n.orient)return n.orient;if(To(r)){if(To(o)){const e=No(r)&&r.aggregate,n=No(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 ca(o)&&!ca(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(To(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const Ta="boxplot",La=new Da(Ta,Ra);function qa(e){return t.isNumber(e)?"tukey":e}function Ra(e,{config:n}){var i;e={...e,encoding:Sa(e.encoding,n)};const{mark:r,encoding:o,params:a,projection:s,...u}=e,l=Hr(r)?r:{type:r};a&&ui(Ln("boxplot"));const c=null!==(i=l.extent)&&void 0!==i?i:n.boxplot.extent,f=xn("size",l,n),d=qa(c),{bins:p,timeUnits:g,transform:h,continuousAxisChannelDef:v,continuousAxis:y,groupby:b,aggregate:x,encodingWithoutContinuousAxis:w,ticksOrient:A,boxOrient:D,customTooltipWithoutAggregatedField:F}=function(e,n,i){const r=Ma(e,Ta),{continuousAxisChannelDef:o,continuousAxis:a}=Na(e,r,Ta),s=o.field,u=qa(n),l=[...Wa(s),{op:"median",field:s,as:`mid_box_${s}`},{op:"min",field:s,as:("min-max"===u?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===u?"upper_whisker_":"max_")+s}],c="min-max"===u||"tukey"===u?[]:[{calculate:`datum["upper_box_${s}"] - datum["lower_box_${s}"]`,as:`iqr_${s}`},{calculate:`min(datum["upper_box_${s}"] + datum["iqr_${s}"] * ${n}, datum["max_${s}"])`,as:`upper_whisker_${s}`},{calculate:`max(datum["lower_box_${s}"] - datum["iqr_${s}"] * ${n}, datum["min_${s}"])`,as:`lower_whisker_${s}`}],{[a]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:n,...i}=e;if(!n)return{filteredEncoding:i};let r,o;if(t.isArray(n)){for(const e of n)e.aggregate?(r||(r=[]),r.push(e)):(o||(o=[]),o.push(e));r&&(i.tooltip=r)}else n.aggregate?i.tooltip=n:o=n;return t.isArray(o)&&1===o.length&&(o=o[0]),{customTooltipWithoutAggregatedField:o,filteredEncoding:i}}(d),{bins:g,timeUnits:h,aggregate:v,groupby:y,encoding:b}=ka(m,i),x="vertical"===r?"horizontal":"vertical",w=r,A=[...g,...h,{aggregate:[...v,...l],groupby:y},...c];return{bins:g,timeUnits:h,transform:A,groupby:y,aggregate:v,continuousAxisChannelDef:o,continuousAxis:a,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,c,n),{color:$,size:k,...C}=w,E=e=>Oa(l,y,v,e,n.boxplot),B=E(C),_=E(w),z=E({...C,...k?{size:k}:{}}),O=_a([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],v,w),P={type:"tick",color:"black",opacity:1,orient:A,invalid:null,aria:!1},N="min-max"===d?O:_a([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],v,w),j=[...B({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...B({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...B({partName:"ticks",mark:P,positionPrefix:"lower_whisker",extraEncoding:N}),...B({partName:"ticks",mark:P,positionPrefix:"upper_whisker",extraEncoding:N})],M=[..."tukey"!==d?j:[],..._({partName:"box",mark:{type:"bar",...f?{size:f}:{},orient:D,invalid:null,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:O}),...z({partName:"median",mark:{type:"tick",invalid:null,...t.isObject(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...f?{size:f}:{},orient:A,aria:!1},positionPrefix:"mid_box",extraEncoding:O})];var T;if("min-max"===d)return{...u,transform:(null!==(T=u.transform)&&void 0!==T?T:[]).concat(h),layer:M};const L=`datum["lower_box_${v.field}"]`,q=`datum["upper_box_${v.field}"]`,R=`(${q} - ${L})`,W=`${L} - ${c} * ${R}`,U=`${q} + ${c} * ${R}`,H=`datum["${v.field}"]`,I={joinaggregate:Wa(v.field),groupby:b},V={transform:[{filter:`(${W} <= ${H}) && (${H} <= ${U})`},{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}`},...x],groupby:b}],layer:j},{tooltip:G,...Y}=C,{scale:X,axis:J}=v,Q=za(v),K=m(J,["title"]),Z=Pa(l,"outliers",n.boxplot,{transform:[{filter:`(${H} < ${W}) || (${H} > ${U})`}],mark:"point",encoding:{[y]:{field:v.field,type:v.type,...void 0!==Q?{title:Q}:{},...void 0!==X?{scale:X}:{},...S(K)?{}:{axis:K}},...Y,...$?{color:$}:{},...F?{tooltip:F}:{}}})[0];let ee;const te=[...p,...g,I];return Z?ee={transform:te,layer:[Z,V]}:(ee=V,ee.transform.unshift(...te)),{...u,layer:[ee,{transform:h,layer:M}]}}function Wa(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const Ua="errorbar",Ha=new Da(Ua,Ia);function Ia(e,{config:t}){e={...e,encoding:Sa(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:u,tooltipEncoding:l}=Ga(e,Ua,t);delete o.size;const c=Oa(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,p={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},m=[...c({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...m.length>1?{layer:m}:{...m[0]}}}function Va(e,t){const{encoding:n}=e;if(function(e){return(qo(e.x)||qo(e.y))&&!qo(e.x2)&&!qo(e.y2)&&!qo(e.xError)&&!qo(e.xError2)&&!qo(e.yError)&&!qo(e.yError2)}(n))return{orient:Ma(e,t),inputType:"raw"};const i=function(e){return qo(e.x2)||qo(e.y2)}(n),r=function(e){return qo(e.xError)||qo(e.xError2)||qo(e.yError)||qo(e.yError2)}(n),o=n.x,a=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(qo(e)&&qo(i))throw new Error(`${t} cannot have both x2 and y2`);if(qo(e)){if(To(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(qo(i)){if(To(a))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,s=n.yError2;if(qo(i)&&!qo(e))throw new Error(`${t} cannot have xError2 without xError`);if(qo(s)&&!qo(r))throw new Error(`${t} cannot have yError2 without yError`);if(qo(e)&&qo(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(qo(e)){if(To(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(qo(r)){if(To(a))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 Ga(e,t,n){var i;const{mark:r,encoding:o,params:a,projection:s,...u}=e,l=Hr(r)?r:{type:r};a&&ui(Ln(t));const{orient:c,inputType:f}=Va(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:p,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:g,continuousAxis:h}=Na(e,c,t),{errorBarSpecificAggregate:v,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,a,s){let u=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&ui(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)u=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],l=[{calculate:`datum["center_${c}"] + datum["extent_${c}"]`,as:`upper_${c}`},{calculate:`datum["center_${c}"] - datum["extent_${c}"]`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:j(t)},{fieldPrefix:"upper_",titlePrefix:Ya(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Ya(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:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:Zo({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Zo({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Zo({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&ui((p=e.center,`${(m=e.extent)?"extent ":""}${m&&p?"and ":""}${p?"center ":""}${m&&p?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:`datum["${n.field}"]`,as:`upper_${c}`},{calculate:`datum["${c}"]`,as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`datum["${c}"] + datum["${i.field}"]`,as:`upper_${c}`}],r?l.push({calculate:`datum["${c}"] + datum["${r.field}"]`,as:`lower_${c}`}):l.push({calculate:`datum["${c}"] - datum["${i.field}"]`,as:`lower_${c}`}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:R(R(e.calculate,'datum["',""),'"]',"")})}var p,m;return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,d,p,m,g,f,t,n),{[h]:w,["x"===h?"x2":"y2"]:A,["x"===h?"xError":"yError"]:D,["x"===h?"xError2":"yError2"]:F,...$}=o,{bins:k,timeUnits:C,aggregate:S,groupby:E,encoding:B}=ka($,n),_=[...S,...v],z="raw"!==f?[]:E,O=_a(b,d,B,x);return{transform:[...null!==(i=u.transform)&&void 0!==i?i:[],...k,...C,...0===_.length?[]:[{aggregate:_,groupby:z}],...y],groupby:z,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:B,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:u,tooltipEncoding:O}}function Ya(e,t,n){return`${j(e)} ${n} ${t}`}const Xa="errorband",Ja=new Da(Xa,Qa);function Qa(e,{config:t}){e={...e,encoding:Sa(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:u}=Ga(e,Xa,t),l=a,c=Oa(l,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},p={type:f?"line":"rule"};const m={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...m,ariaRoleDescription:"errorband"},p={...p,...m,aria:!1}):l.interpolate?ui(ri("interpolate")):l.tension&&ui(ri("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:u})]}}const Ka={};function Za(e,t,n){const i=new Da(e,t);Ka[e]={normalizer:i,parts:n}}Za(Ta,Ra,["box","median","outliers","rule","ticks"]),Za(Ua,Ia,["ticks","rule"]),Za(Xa,Qa,["band","borders"]);const es=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],ts={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"},ns={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"},is=E(ts),rs=E(ns),os=E({header:1,headerRow:1,headerColumn:1,headerFacet:1}),as=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],ss="_vgsid_",us={point:{on:"click",fields:[ss],toggle:"event.shiftKey",resolve:"global",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 ls(e){return!(!e||"legend"!==e&&!e.legend)}function cs(e){return ls(e)&&t.isObject(e)}function fs(e){return!!e.select}function ds(e){const t=[];for(const n of e||[]){if(fs(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function ps(e){return"concat"in e}function ms(e){return"vconcat"in e}function gs(e){return"hconcat"in e}const hs=["background","padding"];function vs(e,t){const n={};for(const t of hs)e&&void 0!==e[t]&&(n[t]=pn(e[t]));return t&&(n.params=e.params),n}function ys(e){return t.isObject(e)&&void 0!==e.step}function bs(e){return e.view||e.width||e.height}const xs=E({align:1,bounds:1,center:1,columns:1,spacing:1});function ws(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function As(e,t){const n=Ds(e,t);return ys(n)?n.step:Fs}function Ds(e,t){var n;return H(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Fs=20,$s={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Fs},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:Jr,circle:{},geoshape:{},image:{},line:{},point:{},rect:Qr,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:us,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},ks=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Cs={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Ss={blue:ks[0],orange:ks[1],red:ks[2],teal:ks[3],green:ks[4],yellow:ks[5],purple:ks[6],pink:ks[7],brown:ks[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 Es(e){const t=E(e||{}),n={};for(const i of t){const t=e[i];n[i]=ga(t)?dn(t):pn(t)}return n}const Bs=[...Gr,...wa,...os,"background","padding","legend","lineBreak","scale","style","title","view"];function _s(e={}){const{color:n,font:i,fontSize:r,...o}=e,a=t.mergeConfig({},$s,i?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(i):{},n?function(e={}){return{signals:[{name:"color",value:t.isObject(e)?{...Ss,...e}:Ss}],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"}]}}}(n):{},r?function(e){return{signals:[{name:"fontSize",value:t.isObject(e)?{...Cs,...e}:Cs}],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"}}}}}(r):{},o||{}),s=m(a,Bs);for(const e of["background","lineBreak","padding"])a[e]&&(s[e]=pn(a[e]));for(const e of Gr)a[e]&&(s[e]=nn(a[e]));for(const e of wa)a[e]&&(s[e]=Es(a[e]));for(const e of os)a[e]&&(s[e]=nn(a[e]));return a.legend&&(s.legend=nn(a.legend)),a.scale&&(s.scale=nn(a.scale)),a.style&&(s.style=function(e){const t=E(e),n={};for(const i of t)n[i]=Es(e[i]);return n}(a.style)),a.title&&(s.title=nn(a.title)),a.view&&(s.view=nn(a.view)),s}const zs=["view",...Ur],Os=["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"],Ps={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]};function Ns(e){e=d(e);for(const t of Os)delete e[t];if(e.axis)for(const t in e.axis)ga(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of es)delete e.legend[t];if(e.mark){for(const t of Vr)delete e.mark[t];e.mark.tooltip&&t.isObject(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(ds(e.params)),delete e.params);for(const t of zs){for(const n of Vr)delete e[t][n];const n=Ps[t];if(n)for(const i of n)delete e[t][i];js(e,t)}for(const t of E(Ka))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=rn(e.title);S(t)||(e.style["group-title"]={...e.style["group-title"],...t});S(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});S(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&S(e[n])&&delete e[n];return S(e)?void 0:e}function js(e,t,n,i){var r;"view"===t&&(n="cell");const o={...i?e[t][i]:e[t],...e.style[null!==(r=n)&&void 0!==r?r:t]};var a;S(o)||(e.style[null!==(a=n)&&void 0!==a?a:t]=o);i||delete e[t]}function Ms(e){return"layer"in e}class Ts{map(e,t){return ko(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):gs(e)?this.mapHConcat(e,t):ms(e)?this.mapVConcat(e,t):ps(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Ms(e))return this.mapLayer(e,t);if(Aa(e))return this.mapUnit(e,t);throw new Error(_n(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const Ls={zero:1,center:1,normalize:1};const qs=new Set([Cr,Er,Sr,Pr,zr,Tr,Lr,_r,Nr,jr]),Rs=new Set([Er,Sr,Cr]);function Ws(e,t){const n="x"===t?"y":"radius",i=e[t],r=e[n];if(No(i)&&No(r))if("quantitative"===jo(i)&&"quantitative"===jo(r)){if(i.stack)return t;if(r.stack)return n;const e=No(i)&&!!i.aggregate;if(e!==(No(r)&&!!r.aggregate))return e?t:n;{var o,a;const e=null===(o=i.scale)||void 0===o?void 0:o.type,s=null===(a=r.scale)||void 0===a?void 0:a.type;if(e&&"linear"!==e)return n;if(s&&"linear"!==s)return t}}else{if("quantitative"===jo(i))return t;if("quantitative"===jo(r))return n}else{if("quantitative"===jo(i))return t;if("quantitative"===jo(r))return n}}function Us(e,n,i={}){var r,o;const a=Hr(e)?e.type:e;if(!qs.has(a))return null;const s=Ws(n,"x")||Ws(n,"theta");if(!s)return null;const u=n[s],l=No(u)?Yo(u,{}):void 0;let c=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(s),f=n[c],d=No(f)?Yo(f,{}):void 0;d===l&&(d=void 0,f=void 0,c=void 0);const p=gt.reduce(((e,i)=>{if("tooltip"!==i&&Fa(n,i)){const r=n[i];for(const n of t.array(r)){const t=ia(n);if(t.aggregate)continue;const r=Yo(t,{});r&&r===d||e.push({channel:i,fieldDef:t})}}return e}),[]);let m;if(void 0!==u.stack?m=t.isBoolean(u.stack)?u.stack?"zero":null:u.stack:Rs.has(a)&&(m="zero"),!m||!(m in Ls))return null;var g;if($a(n)&&0===p.length)return null;if(null!=u&&null!==(r=u.scale)&&void 0!==r&&r.type&&(null==u||null===(o=u.scale)||void 0===o?void 0:o.type)!==Wi){if(i.disallowNonLinearStack)return null;ui(function(e){return`Cannot stack non-linear scale (${e}).`}(u.scale.type))}return qo(n[et(s)])?(void 0!==u.stack&&ui(`Cannot stack "${g=s}" if there is already "${g}2".`),null):(No(u)&&u.aggregate&&!y(Gt,u.aggregate)&&ui(`Stacking is applied even though the aggregate function is non-summative ("${u.aggregate}").`),{groupbyChannel:f?c:void 0,groupbyField:d,fieldChannel:s,impute:null!==u.impute&&Rr(a),stackBy:p,offset:m})}function Hs(e){const{point:t,line:n,...i}=e;return E(i).length>1?i:i.type}function Is(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:m(e[t],["point","line"])});return e}function Vs(e,n={},i){return"transparent"===e.point?{opacity:0}:e.point?t.isObject(e.point)?e.point:{}:void 0!==e.point?null:n.point||i.shape?t.isObject(n.point)?n.point:{}:void 0}function Gs(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 Ys{constructor(){Sn(this,"name","path-overlay")}hasMatchingType(e,t){if(Aa(e)){const{mark:n,encoding:i}=e,r=Hr(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!Vs(r,t[r.type],i);case"area":return!!Vs(r,t[r.type],i)||!!Gs(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,encoding:s,...u}=e,l=Sa(s,i),c=Hr(a)?a:{type:a},f=Vs(c,i[c.type],l),d="area"===c.type&&Gs(c,i[c.type]),g=[{...r?{params:r}:{},mark:Hs({..."area"===c.type&&void 0===c.opacity&&void 0===c.fillOpacity?{opacity:.7}:{},...c}),encoding:m(l,["shape"])}],h=Us(c,l);let v=l;if(h){const{fieldChannel:e,offset:t}=h;v={...l,[e]:{...l[e],...t?{stack:t}:{}}}}return d&&g.push({...o?{projection:o}:{},mark:{type:"line",...p(c,["clip","interpolate","tension","tooltip"]),...d},encoding:v}),f&&g.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...p(c,["clip","tooltip"]),...f},encoding:v}),n({...u,layer:g},{...t,config:Is(i)})}}function Xs(e,t){return t?Fo(e)?tu(e,t):Ks(e,t):e}function Js(e,t){return t?tu(e,t):e}function Qs(e,n,i){const r=n[e];return(o=r)&&!t.isString(o)&&"repeat"in o?r.repeat in i?{...n,[e]:i[r.repeat]}:void ui(function(e){return`Unknown repeated value "${e}".`}(r.repeat)):n;var o}function Ks(e,t){if(void 0!==(e=Qs("field",e,t))){if(null===e)return null;if(So(e)&&Ao(e.sort)){const n=Qs("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Zs(e,t){if(No(e))return Ks(e,t);{const n=Qs("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function eu(e,t){if(!qo(e)){if(Po(e)){const n=Zs(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=Zs(e,t);if(n)return n;if(zo(e))return{condition:e.condition}}}function tu(e,n){const i={};for(const r in e)if(t.hasOwnProperty(e,r)){const o=e[r];if(t.isArray(o))i[r]=o.map((e=>eu(e,n))).filter((e=>e));else{const e=eu(o,n);void 0!==e&&(i[r]=e)}}return i}class nu{constructor(){Sn(this,"name","RuleForRangedLine")}hasMatchingType(e){if(Aa(e)){const{encoding:t,mark:n}=e;if("line"===n||Hr(n)&&"line"===n.type)for(const e of Je){const n=t[Ke(e)];if(t[e]&&(No(n)&&!Qt(n.bin)||Mo(n)))return!0}}return!1}run(e,n,i){const{encoding:r,mark:o}=e;var a,s;return ui((a=!!r.x2,s=!!r.y2,`Line mark is for continuous lines and thus cannot be used with ${a&&s?"x2 and y2":a?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),console.log(o),i({...e,mark:t.isObject(o)?{...o,type:"rule"}:"rule"},n)}}function iu({parentEncoding:e,encoding:n={},layer:i}){let r={};if(e){const o=new Set([...E(e),...E(n)]);for(const a of o){const o=n[a],s=e[a];if(qo(o)){const e={...s,...o};r[a]=e}else Po(o)?r[a]={...o,condition:{...s,...o.condition}}:o||null===o?r[a]=o:(i||Wo(s)||an(s)||qo(s)||t.isArray(s))&&(r[a]=s)}}else r=n;return!r||S(r)?void 0:r}function ru(e){const{parentProjection:t,projection:n}=e;return t&&n&&ui(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${g(t)} is overridden by a child projection ${g(n)}.`}({parentProjection:t,projection:n})),null!=n?n:t}function ou(e){return"filter"in e}function au(e){return"lookup"in e}function su(e){return"pivot"in e}function uu(e){return"density"in e}function lu(e){return"quantile"in e}function cu(e){return"regression"in e}function fu(e){return"loess"in e}function du(e){return"sample"in e}function pu(e){return"window"in e}function mu(e){return"joinaggregate"in e}function gu(e){return"flatten"in e}function hu(e){return"calculate"in e}function vu(e){return"bin"in e}function yu(e){return"impute"in e}function bu(e){return"timeUnit"in e}function xu(e){return"aggregate"in e}function wu(e){return"stack"in e}function Au(e){return"fold"in e}function Du(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(ou(e))return{filter:ku(e,t)};if(vu(e)&&Kt(e.bin))return{...e,bin:$u(e.bin)};if(au(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function Fu(e,t){var i,r;const o=d(e);if(No(o)&&Kt(o.bin)&&(o.bin=$u(o.bin)),Uo(o)&&null!==(i=o.scale)&&void 0!==i&&null!==(r=i.domain)&&void 0!==r&&r.selection){const{selection:e,...t}=o.scale.domain;o.scale.domain={...t,...e?{param:e}:{}}}if(zo(o))if(n.isArray(o.condition))o.condition=o.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:ku(e,t)}}));else{const{selection:e,param:n,test:i,...r}=Fu(o.condition,t);o.condition=n?o.condition:{...r,test:ku(o.condition,t)}}return o}function $u(e){const t=e.extent;if(null!=t&&t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function ku(e,t){const n=e=>c(e,(e=>{var n,i,r;const o={param:e,empty:null===(n=t.emptySelections[e])||void 0===n||n};return null!==(r=(i=t.selectionPredicates)[e])&&void 0!==r||(i[e]=[]),t.selectionPredicates[e].push(o),o}));return e.selection?n(e.selection):c(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class Cu extends Ts{map(e,t){var n;const i=null!==(n=t.selections)&&void 0!==n?n:[];if(e.params&&!Aa(e)){const t=[];for(const n of e.params)fs(n)?i.push(n):t.push(n);e.params=t}return t.selections=i,super.map(e,Su(e,t))}mapUnit(e,t){var i;const r=t.selections;if(!r||!r.length)return e;const o=(null!==(i=t.path)&&void 0!==i?i:[]).concat(e.name),a=[];for(const t of r)if(t.views&&t.views.length)for(const i of t.views)(n.isString(i)&&(i===e.name||o.indexOf(i)>=0)||n.isArray(i)&&i.map((e=>o.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&a.push(t);else a.push(t);return a.length&&(e.params=a),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=Cu.prototype[e];Cu.prototype[e]=function(e,n){return t.call(this,e,Su(e,n))}}function Su(e,t){var n;return e.name?{...t,path:(null!==(n=t.path)&&void 0!==n?n:[]).concat(e.name)}:t}function Eu(e,t){void 0===t&&(t=_s(e.config));const n=function(e,t={}){const n={config:t};return zu.map(Bu.map(_u.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=Aa(e)||Ms(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(ui(On("width")),i=void 0),"container"==r&&(ui(On("height")),r=void 0));const s={type:"pad",...a,...n?Ou(n.autosize):{},...Ou(e.autosize)};"fit"!==s.type||o||(ui(zn),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&ui(Pn("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&ui(Pn("height"));if(f(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const Bu=new class extends Ts{constructor(...e){super(...e),Sn(this,"nonFacetUnitNormalizers",[La,Ha,Ja,new Ys,new nu])}map(e,t){if(Aa(e)){const n=Fa(e.encoding,Q),i=Fa(e.encoding,K),r=Fa(e.encoding,Z);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=Js(e.encoding,t.repeater),o={...e,...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,n){return function(e){return!t.isArray(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,n):this.mapNonLayerRepeat(e,n)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:u={},repeaterPrefix:l=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...u,layer:e},r=`${(i.name||"")+l}child__layer_${O(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,n){var i;const{repeat:r,spec:o,data:a,...s}=e;!t.isArray(r)&&e.columns&&(e=m(e,["columns"]),ui(Rn("repeat")));const u=[],{repeater:l={},repeaterPrefix:c=""}=n,f=!t.isArray(r)&&r.row||[l?l.row:null],d=!t.isArray(r)&&r.column||[l?l.column:null],p=t.isArray(r)&&r||[l?l.repeat:null];for(const e of p)for(const i of f)for(const a of d){const s={repeat:e,row:i,column:a,layer:l.layer},f=(o.name||"")+c+"child__"+(t.isArray(r)?`${O(e)}`:(r.row?`row_${O(i)}`:"")+(r.column?`column_${O(a)}`:"")),d=this.map(o,{...n,repeater:s,repeaterPrefix:f});d.name=f,u.push(m(d,["data"]))}const g=t.isArray(r)?e.columns:r.column?r.column.length:1;return{data:null!==(i=o.data)&&void 0!==i?i:a,align:"all",...s,columns:g,concat:u}}mapFacet(e,t){const{facet:n}=e;return Fo(n)&&e.columns&&(e=m(e,["columns"]),ui(Rn("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=ru({parentProjection:o,projection:i}),u=iu({parentEncoding:r,encoding:Js(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:u,height:l,view:c,params:f,encoding:d,...p}=e,{facetMapping:m,layout:g}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),h=Js(o,t.repeater);return this.mapFacet({...p,...g,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:a,encoding:h,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&ui(`Facet encoding dropped as ${(a=[...n?[Q]:[],...i?[K]:[]]).join(" and ")} ${a.length>1?"are":"is"} also specified.`);const t={},s={};for(const n of[Q,K]){const i=e[n];if(i){const{align:e,center:r,spacing:a,columns:u,...l}=i;t[n]=l;for(const e of["align","center","spacing"]){var o;if(void 0!==i[e])null!==(o=s[e])&&void 0!==o||(s[e]={}),s[e][n]=i[e]}}}return{facetMapping:t,layout:s}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:Xs(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var a}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:iu({parentEncoding:t,encoding:r,layer:!0}),parentProjection:ru({parentProjection:n,projection:o})};return super.mapLayer(a,s)}},_u=new class extends Ts{map(e,t){var n,i;return null!==(n=t.emptySelections)&&void 0!==n||(t.emptySelections={}),null!==(i=t.selectionPredicates)&&void 0!==i||(t.selectionPredicates={}),e=Du(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=Du(e,t)).encoding){const n={};for(const[i,r]of _(e.encoding))n[i]=Fu(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:_(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const n of B(null!==(s=t.selectionPredicates[e])&&void 0!==s?s:{})){var s;n.empty="none"!==o}return{name:e,value:i,select:a,bind:r}}))}:e}},zu=new Cu;function Ou(e){return t.isString(e)?{type:e}:null!=e?e:{}}class Pu{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Pu(d(this.explicit),d(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return H(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,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of E(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Nu(e){return{explicit:!0,value:e}}function ju(e){return{explicit:!1,value:e}}function Mu(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:Tu(t,n,i,r)}}function Tu(e,t,n,i){return e.explicit&&t.explicit&&ui(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${g(n)} and ${g(i)}). Using ${g(n)}.`}(n,i,e.value,t.value)),e}function Lu(e,t,n,i,r=Tu){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:f(e.value,t.value)?e:r(e,t,n,i)}class qu extends Pu{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 Ru(e){return"url"in e}function Wu(e){return"values"in e}function Uu(e){return"name"in e&&!Ru(e)&&!Wu(e)&&!Hu(e)}function Hu(e){return e&&(Iu(e)||Vu(e)||Gu(e))}function Iu(e){return"sequence"in e}function Vu(e){return"sphere"in e}function Gu(e){return"graticule"in e}let Yu;!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"}(Yu||(Yu={}));const Xu="[",Ju="]",Qu=/[[\]{}]/,Ku={"*":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 Zu,el;function tl(e,t,n){return Zu=t||"view",el=n||Ku,il(e.trim()).map(rl)}function nl(e,t,n,i,r){const o=e.length;let a,s=0;for(;t=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function il(e){const t=[],n=e.length;let i=0,r=0;for(;r"!==(e=e.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+e;n=n.map(rl);const r=rl(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:Zu},n=[];let i,r,o=[0,0],a=0,s=0,u=e.length,l=0;if("}"===e[u-1]){if(l=e.lastIndexOf("{"),!(l>=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(l+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}u=(e=e.slice(0,l).trim()).length,l=0}if(!u)throw e;"@"===e[0]&&(a=++l);i=nl(e,l,":"),i1?(t.type=n[1],a?t.markname=n[0].slice(1):!function(e){return el[e]}(n[0])?t.source=n[0]:t.marktype=n[0]):t.type=n[0];"!"===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 ol(e,n=!0,i=t.identity){if(t.isArray(e)){const t=e.map((e=>ol(e,n,i)));return n?`[${t.join(", ")}]`:t}return li(e)?i(n?gi(e):function(e){const t=mi(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):n?i(g(e)):e}function al(e,n){for(const r of B(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const o=r.name;let a=`${o}${vc}, ${"global"===r.resolve?"true":`{unit: ${wc(e)}}`}`;for(const t of xc)t.defined(r)&&(t.signals&&(n=t.signals(e,r,n)),t.modifyExpr&&(a=t.modifyExpr(e,r,a)));n.push({name:o+yc,on:[{events:{signal:r.name+vc},update:`modify(${t.stringValue(r.name+hc)}, ${a})`}]})}return ll(n)}function sl(e,n){if(e.component.selection&&E(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:tl("mousemove","scope"),update:`isTuple(facet) ? facet : group(${i}).datum`}]})}return ll(n)}function ul(e,t){for(const i of B(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;for(const n of xc)n.defined(i)&&n.marks&&(t=n.marks(e,i,t))}return t}function ll(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}class cl{constructor(e,t){this.debugName=t,Sn(this,"_children",[]),Sn(this,"_parent",null),Sn(this,"_hash",void 0),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.includes(e)?ui("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 fl extends cl{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}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,Sn(this,"_source",void 0),Sn(this,"_name",void 0),this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${V()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class dl extends cl{clone(){return new dl(null,d(this.formula))}constructor(e,t){super(e),this.formula=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,t)=>{const{field:n,timeUnit:i}=t;if(i){const r=Yo(t,{forAs:!0});e[h({as:r,field:n,timeUnit:i})]={as:r,field:n,timeUnit:i}}return e}),{});return S(n)?null:new dl(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Fi(n)};return new dl(e,{[h(r)]:r})}merge(e){this.formula={...this.formula};for(const t in e.formula)this.formula[t]||(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 _(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(B(this.formula).map((e=>e.as)))}dependentFields(){return new Set(B(this.formula).map((e=>e.field)))}hash(){return`TimeUnit ${h(this.formula)}`}assemble(){const e=[];for(const t of B(this.formula)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=Fi(r);e.push({field:q(n),type:"timeunit",...o?{units:xi(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,`${i}_end`]})}return e}}const pl="_tuple_fields";class ml{constructor(...e){Sn(this,"hasChannel",void 0),Sn(this,"hasField",void 0),Sn(this,"timeUnit",void 0),Sn(this,"items",void 0),this.items=e,this.hasChannel={},this.hasField={}}}const gl={defined:()=>!0,parse:(e,n,i)=>{var r;const o=n.name,a=null!==(r=n.project)&&void 0!==r?r:n.project=new ml,s={},u={},l=new Set,c=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=O(`${o}_${n}`);for(let e=1;l.has(i);e++)i=O(`${o}_${n}_${e}`);return l.add(i),{[t]:i}},f=n.type,d=e.config.selection[f],p=void 0!==i.value?t.array(i.value):null;let{fields:m,encodings:g}=t.isObject(i.select)?i.select:{};if(!m&&!g&&p)for(const e of p)if(t.isObject(e))for(const t of E(e))Ye[t]?(g||(g=[])).push(t):"interval"===f?(ui('Interval selections should be initialized using "x" and/or "y" keys.'),g=d.encodings):(m||(m=[])).push(t);m||g||(g=d.encodings,m=d.fields);for(const t of null!==(v=g)&&void 0!==v?v:[]){var v;const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){ui(Tn(t,n.aggregate));continue}if(!i){ui(Mn(t));continue}if(n.timeUnit){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};u[h(r)]=r}if(!s[i]){let r="E";if("interval"===f){dr(e.getScaleComponent(t).get("type"))&&(r="R")}else n.bin&&(r="R-RE");const o={field:i,channel:t,type:r};o.signals={...c(o,"data"),...c(o,"visual")},a.items.push(s[i]=o),a.hasField[i]=a.hasChannel[t]=s[i]}}else ui(Mn(t))}for(const e of null!==(y=m)&&void 0!==y?y:[]){var y;if(a.hasField[e])continue;const t={type:"E",field:e};t.signals={...c(t,"data")},a.items.push(t),a.hasField[e]=t}p&&(n.init=p.map((e=>a.items.map((n=>t.isObject(e)?void 0!==e[n.channel]?e[n.channel]:e[n.field]:e))))),S(u)||(a.timeUnit=new dl(null,u))},signals:(e,t,n)=>{const i=t.name+pl;return n.filter((e=>e.name===i)).length>0?n:n.concat({name:i,value:t.project.items.map((e=>{const{signals:t,hasLegend:n,...i}=e;return i.field=q(i.field),i}))})}},hl={defined: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(!Pt(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&dr(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):ui("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,n,i)=>{const r=n.scales.filter((e=>0===i.filter((t=>t.name===e.signals.data)).length));if(!e.parent||yl(e)||0===r.length)return i;const o=i.filter((e=>e.name===n.name))[0];let a=o.update;if(a.indexOf(bc)>=0)o.update=`{${r.map((e=>`${t.stringValue(q(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of r){const n=`${t.stringValue(q(e.field))}: ${e.signals.data}`;a.includes(n)||(a=`${a.substring(0,a.length-1)}, ${n}}`)}o.update=a}return i.concat(r.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!yl(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 vl(e,n){return`domain(${t.stringValue(e.scaleName(n))})`}function yl(e){var t;return e.parent&&Am(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:yl(e.parent.parent))}const bl="_brush",xl="_scale_trigger",wl={defined:e=>"interval"===e.type,signals:(e,n,i)=>{const r=n.name,o=r+pl,a=hl.defined(n),s=n.init?n.init[0]:null,u=[],l=[];if(n.translate&&!a){const e=`!event.item || event.item.mark.name !== ${t.stringValue(r+bl)}`;Al(n,((n,i)=>{var r,o;const a=t.array(null!==(o=(r=i.between[0]).filter)&&void 0!==o?o:r.filter=[]);return a.includes(e)||a.push(e),n}))}n.project.items.forEach(((r,o)=>{const a=r.channel;if(a!==ee&&a!==te)return void ui("Interval selections only support x and y encoding channels.");const c=s?s[o]:null,f=function(e,n,i,r){const o=i.channel,a=i.signals.visual,s=i.signals.data,u=hl.defined(n),l=t.stringValue(e.scaleName(o)),c=e.getScaleComponent(o),f=c?c.get("type"):void 0,d=e=>`scale(${l}, ${e})`,p=e.getSizeSignalRef(o===ee?"width":"height").signal,m=`${o}(unit)`,g=Al(n,((e,t)=>[...e,{events:t.between[0],update:`[${m}, ${m}]`},{events:t,update:`[${a}[0], clamp(${m}, 0, ${p})]`}]));return g.push({events:{signal:n.name+xl},update:dr(f)?`[${d(`${s}[0]`)}, ${d(`${s}[1]`)}]`:"[0, 0]"}),u?[{name:s,on:[]}]:[{name:a,...r?{init:ol(r,!0,d)}:{value:[]},on:g},{name:s,...r?{init:ol(r)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${l}, ${a})`}]}]}(e,n,r,c),d=r.signals.data,p=r.signals.visual,m=t.stringValue(e.scaleName(a)),g=dr(e.getScaleComponent(a).get("type"))?"+":"";i.push(...f),u.push(d),l.push({scaleName:e.scaleName(a),expr:`(!isArray(${d}) || (${g}invert(${m}, ${p})[0] === ${g}${d}[0] && ${g}invert(${m}, ${p})[1] === ${g}${d}[1]))`})})),a||i.push({name:r+xl,value:{},on:[{events:l.map((e=>({scale:e.scaleName}))),update:`${l.map((e=>e.expr)).join(" && ")} ? ${r+xl} : {}`}]});const c=`unit: ${wc(e)}, fields: ${o}, values`;return i.concat({name:r+vc,...s?{init:`{${c}: ${ol(s)}}`}:{},on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${c}: [${u}]} : null`}]})},marks:(e,n,i)=>{const r=n.name,{x:o,y:a}=n.project.hasChannel,s=o&&o.signals.visual,u=a&&a.signals.visual,l=`data(${t.stringValue(n.name+hc)})`;if(hl.defined(n))return i;const c={x:void 0!==o?{signal:`${s}[0]`}:{value:0},y:void 0!==a?{signal:`${u}[0]`}:{value:0},x2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==a?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of E(c))c[t]=[{test:`${l}.length && ${l}[0].unit === ${wc(e)}`,...c[t]},{value:0}];const{fill:f,fillOpacity:d,cursor:p,...m}=n.mark,g=E(m).reduce(((e,t)=>(e[t]=[{test:[void 0!==o&&`${s}[0] !== ${s}[1]`,void 0!==a&&`${u}[0] !== ${u}[1]`].filter((e=>e)).join(" && "),value:m[t]},{value:null}],e)),{});return[{name:`${r+bl}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:c}},...i,{name:r+bl,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...c,...g}}}]}};function Al(e,t){return e.events.reduce(((e,n)=>n.between?t(e,n):(ui(`${n} is not an ordered event stream for interval selections.`),e)),[])}const Dl={defined:e=>"point"===e.type,signals:(e,n,i)=>{const r=n.name,o=r+pl,a=n.project,s="(item().isVoronoi ? datum.datum : datum)",u=a.items.map((n=>{const i=e.fieldDef(n.channel);return i&&i.bin?`[${s}[${t.stringValue(e.vgField(n.channel,{}))}], ${s}[${t.stringValue(e.vgField(n.channel,{binSuffix:"end"}))}]]`:`${s}[${t.stringValue(n.field)}]`})).join(", "),l=`unit: ${wc(e)}, fields: ${o}, values`,c=n.events;return i.concat([{name:r+vc,on:c?[{events:c,update:`datum && item().mark.marktype !== 'group' ? {${l}: [${u}]} : null`,force:!0}]:[]}])}};function Fl(e,n,i,r){const o=zo(n)&&n.condition,a=r(n);if(o){return{[i]:[...t.array(o).map((t=>{const n=r(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:Gf(e,{param:i,empty:r}),...n}}return{test:Xf(e,t.test),...n}})),...void 0!==a?[a]:[]]}}return void 0!==a?{[i]:a}:{}}function $l(e,t="text"){const n=e.encoding[t];return Fl(e,n,t,(t=>kl(t,e.config)))}function kl(e,t,n="datum"){if(e){if(Wo(e))return gn(e.value);if(qo(e)){const{format:i,formatType:r}=na(e);return uo({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Cl(e,n={}){const{encoding:i,markDef:r,config:o,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:El({tooltip:s},a,o,n)};{const u=n.reactiveGeom?"datum.datum":"datum";return Fl(e,s,"tooltip",(e=>{const s=kl(e,o,u);if(s)return s;if(null===e)return;let l=xn("tooltip",r,o);return!0===l&&(l={content:"encoding"}),t.isString(l)?{value:l}:t.isObject(l)?an(l)?l:"encoding"===l.content?El(i,a,o,n):{signal:u}:void 0}))}}function Sl(e,n,i,{reactiveGeom:r}={}){const o={},a=r?"datum.datum":"datum",s=[];function u(r,u){var l;const c=Ke(u),f=Ro(r)?r:{...r,type:e[c].type},d=f.title||ta(f,i),p=t.array(d).join(", ");let m;if(yt(u)){const t="x"===u?"x2":"y2",r=ia(e[t]);if(Qt(f.bin)&&r){const e=Yo(f,{expr:a}),n=Yo(r,{expr:a}),{format:s,formatType:u}=na(f);m=vo(e,n,s,u,i),o[t]=!0}else if(n&&n.fieldChannel===u&&"normalize"===n.offset){const{format:e,formatType:t}=na(f);m=uo({fieldOrDatumDef:f,format:e,formatType:t,expr:a,config:i,normalizeStack:!0}).signal}}null!==(l=m)&&void 0!==l||(m=kl(f,i,a).signal),s.push({channel:u,key:p,value:m})}Ea(e,((e,t)=>{No(e)?u(e,t):Oo(e)&&u(e.condition,t)}));const l={};for(const{channel:e,key:t,value:n}of s)o[e]||l[t]||(l[t]=n);return l}function El(e,t,n,{reactiveGeom:i}={}){const r=Sl(e,t,n,{reactiveGeom:i}),o=_(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function Bl(e){const{markDef:t,config:n}=e,i=xn("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},..._l(e),...zl(e)}}function _l(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=xn("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in cn?{}:{ariaRoleDescription:{value:t}}}function zl(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Fl(e,o,"description",(t=>kl(t,e.config)));const a=xn("description",n,i);if(null!=a)return{description:gn(a)};if(!1===i.aria)return{};const s=Sl(t,r,i);return S(s)?void 0:{description:{signal:_(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function Ol(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:u}=n;var l;void 0===s&&(null!==(l=u)&&void 0!==l||(u=xn(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==u&&(s=gn(u)));const c=r[e];return Fl(t,c,null!=a?a:e,(n=>ro({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function Pl(e,t={filled:void 0}){var n,i,r,o;const{markDef:a,encoding:s,config:u}=e,{type:l}=a,c=null!==(n=t.filled)&&void 0!==n?n:xn("filled",a,u),f=y(["bar","point","circle","square","geoshape"],l)?"transparent":void 0,d=null!==(i=null!==(r=xn(!0===c?"color":void 0,a,u,{vgChannel:"fill"}))&&void 0!==r?r:u.mark[!0===c&&"color"])&&void 0!==i?i:f,p=null!==(o=xn(!1===c?"color":void 0,a,u,{vgChannel:"stroke"}))&&void 0!==o?o:u.mark[!1===c&&"color"],m=c?"fill":"stroke",g={...d?{fill:gn(d)}:{},...p?{stroke:gn(p)}:{}};return a.color&&(c?a.fill:a.stroke)&&ui(In("property",{fill:"fill"in a,stroke:"stroke"in a})),{...g,...Ol("color",e,{vgChannel:m,defaultValue:c?d:p}),...Ol("fill",e,{defaultValue:s.fill?d:void 0}),...Ol("stroke",e,{defaultValue:s.stroke?p:void 0})}}function Nl(e){const{encoding:t,mark:n}=e,i=t.order;return!Rr(n)&&Wo(i)?Fl(e,i,"zindex",(e=>gn(e.value))):{}}function jl(e,t){const n=t[function(e){switch(e){case ee:return"xOffset";case te:return"yOffset";case ne:return"x2Offset";case ie:return"y2Offset";case ae:return"thetaOffset";case re:return"radiusOffset";case se:return"theta2Offset";case oe:return"radius2Offset"}}(e)];if(n)return n}function Ml(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,u=r[e],l=r[et(e)],c=t.scaleName(e),f=t.getScaleComponent(e),d=jl(e,o),p=Tl({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!u&&yt(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(qo(n)&&r&&t===r.fieldChannel){if(No(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return io({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return no(n,i,{suffix:"end"},{offset:o})}return Kr(e)}({channel:e,channelDef:u,channel2Def:l,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p});return m?{[i||e]:m}:void 0}function Tl({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=Ke(n),u=Ze(n),l=xn(n,o,a,{vgChannel:u});if(void 0!==l)return oo(n,l);switch(t){case"zeroOrMin":case"zeroOrMax":if(i){const e=r.get("type");if(y([Ui,Gi,Yi],e));else if(r.domainDefinitelyIncludesZero())return{scale:i,value:0}}if("zeroOrMin"===t)return"y"===s?{field:{group:"height"}}:{value:0};switch(s){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":return{...e[tt(n)],mult:.5}}}}const Ll={left:"x",center:"xc",right:"x2"},ql={top:"y",middle:"yc",bottom:"y2"};function Rl(e,t,n,i="middle"){if("radius"===e||"theta"===e)return Ze(e);const r="x"===e?"align":"baseline",o=xn(r,t,n);let a;return an(o)?(ui(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?Ll[a||("top"===i?"left":"center")]:ql[a||i]}function Wl(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Ul(e,t,{defaultPos:n,defaultPos2:i}):Ml(e,t,{defaultPos:n})}function Ul(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=et(e),s=tt(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,u=Ke(n),l=tt(n),c=Ze(n),f=i[u],d=e.scaleName(u),p=e.getScaleComponent(u),m=jl(n in i||n in o?n:u,e.markDef);if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=tt(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const g=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:u,defaultRef:l}){if(qo(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return no(t,o,{suffix:"start"},{offset:u});return Kr({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:u,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:p,stack:a,offset:m,defaultRef:void 0});if(void 0!==g)return{[c]:g};return Hl(n,o)||Hl(n,{[n]:An(n,o,s.style),[l]:An(l,o,s.style)})||Hl(n,s[r])||Hl(n,s.mark)||{[c]:Tl({model:e,defaultPos:t,channel:n,scaleName:d,scale:p})()}}(t,i,a);return{...Ml(e,t,{defaultPos:n,vgChannel:u[s]?Rl(e,r,o):Ze(e)}),...u}}function Hl(e,t){const n=tt(e),i=Ze(e);if(void 0!==t[i])return{[i]:oo(e,t[i])};if(void 0!==t[e])return{[i]:oo(e,t[e])};if(t[n]){const i=t[n];if(!Yr(i))return{[n]:oo(e,i)};ui(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function Il(e,n,i){var r,o;const{config:a,encoding:s,markDef:u}=e,l=et(n),c=tt(n),f=s[n],d=s[l],p=e.getScaleComponent(n),m=p?p.get("type"):void 0,g=e.scaleName(n),h=u.orient,v=null!==(r=null!==(o=s[c])&&void 0!==o?o:s.size)&&void 0!==r?r:xn("size",u,a,{vgChannel:c}),y="bar"===i&&("x"===n?"vertical"===h:"horizontal"===h);if(!No(f)||!(Jt(f.bin)||Qt(f.bin)||f.timeUnit&&!d)||v&&!Yr(v)||fr(m))return(qo(f)&&fr(m)||y)&&!d?function(e,n,i){const{markDef:r,encoding:o,config:a,stack:s}=i,u=r.orient,l=i.scaleName(n),c=i.getScaleComponent(n),f=tt(n),d=et(n),p="horizontal"===u&&"y"===n||"vertical"===u&&"x"===n;let m;(o.size||r.size)&&(p?m=Ol("size",i,{vgChannel:f,defaultRef:gn(r.size)}):ui(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(r.type)));const g=Bo({channel:n,fieldDef:e,markDef:r,config:a,scaleType:null==c?void 0:c.get("type"),useVlSizeChannel:p});m=m||{[f]:Vl(f,l,c,a,g)};const h="band"===(null==c?void 0:c.get("type"))&&"band"in m[f]?"top":"middle",v=Rl(n,r,a,h),y="xc"===v||"yc"===v,b=jl(n,r),x=Kr({channel:n,channelDef:e,markDef:r,config:a,scaleName:l,scale:c,stack:s,offset:b,defaultRef:Tl({model:i,defaultPos:"mid",channel:n,scaleName:l,scale:c}),bandPosition:y?.5:an(g)?{signal:`(1-${g})/2`}:Yr(g)?(1-g.band)/2:0});if(f)return{[v]:x,...m};{const e=Ze(d),n=m[f],i=b?{...n,offset:b}:n;return{[v]:x,[e]:t.isArray(x)?[x[0],{...x[1],offset:i}]:{...x,offset:i}}}}(f,n,e):Ul(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"});{var b,x;const t=Bo({channel:n,fieldDef:f,markDef:u,config:a,scaleType:m}),i=null===(b=e.component.axes[n])||void 0===b?void 0:b[0];return function({fieldDef:e,fieldDef2:t,channel:n,bandSize:i,scaleName:r,markDef:o,spacing:a=0,axisTranslate:s,reverse:u,config:l}){const c=et(n),f=Ze(n),d=Ze(c),p=jl(n,o),m=an(i)?{signal:`(1-${i.signal})/2`}:Yr(i)?(1-i.band)/2:.5;if(Jt(e.bin)||e.timeUnit)return{[d]:Yl({channel:n,fieldDef:e,scaleName:r,markDef:o,bandPosition:m,offset:Gl(c,a,u,s,p),config:l}),[f]:Yl({channel:n,fieldDef:e,scaleName:r,markDef:o,bandPosition:an(m)?{signal:`1-${m.signal}`}:1-m,offset:Gl(n,a,u,s,p),config:l})};if(Qt(e.bin)){const i=no(e,r,{},{offset:Gl(c,a,u,s,p)});if(No(t))return{[d]:i,[f]:no(t,r,{},{offset:Gl(n,a,u,s,p)})};if(Kt(e.bin)&&e.bin.step)return{[d]:i,[f]:{signal:`scale("${r}", ${Yo(e,{expr:"datum"})} + ${e.bin.step})`,offset:Gl(n,a,u,s,p)}}}return void ui(oi(c))}({fieldDef:f,fieldDef2:d,channel:n,markDef:u,scaleName:g,bandSize:t,axisTranslate:null!==(x=null==i?void 0:i.get("translate"))&&void 0!==x?x:.5,spacing:yt(n)?xn("binSpacing",u,a):void 0,reverse:p.get("reverse"),config:a})}}function Vl(e,n,i,r,o){if(Yr(o)){if(!i)return{mult:o.band,field:{group:e}};{const e=i.get("type");if("band"===e)return{scale:n,band:o.band};1!==o.band&&(ui(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),o=void 0)}}else{if(an(o))return o;if(o)return{value:o}}if(i){const e=i.get("range");if(sn(e)&&t.isNumber(e.step))return{value:e.step-2}}return{value:As(r.view,e)-2}}function Gl(e,t,n,i,r){if(ze(e))return 0;const o="x"===e||"y2"===e?-t/2:t/2;if(an(n)||an(r)||an(i)){const e=vn(n),t=vn(r),a=vn(i);return{signal:(a?`${a} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${o})`:o)}}return r=r||0,i+(n?-r-o:+r+o)}function Yl({channel:e,fieldDef:t,scaleName:n,markDef:i,bandPosition:r,offset:o,config:a}){return Zr({fieldDef:t,channel:e,markDef:i,ref:io({scaleName:n,fieldOrDatumDef:t,bandPosition:r,offset:o}),config:a})}const Xl=new Set(["aria","width","height"]);function Jl(e,t){const{fill:n,stroke:i}="include"===t.color?Pl(e):{};return{...Kl(e.markDef,t),...Ql(e,"fill",n),...Ql(e,"stroke",i),...Ol("opacity",e),...Ol("fillOpacity",e),...Ol("strokeOpacity",e),...Ol("strokeWidth",e),...Ol("strokeDash",e),...Nl(e),...Cl(e),...$l(e,"href"),...Bl(e)}}function Ql(e,n,i){const{config:r,mark:o,markDef:a}=e;if("hide"===xn("invalid",a,r)&&i&&!Rr(o)){const r=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&&dr(r)&&(t[o]=!0)}return t}),{}),r=E(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>to(e,t))).join(` ${e} `)}return}(e,{invalid:!0,channels:Ot});if(r)return{[n]:[{test:r,value:null},...t.array(i)]}}return i?{[n]:i}:{}}function Kl(e,t){return ln.reduce(((n,i)=>(Xl.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=gn(e[i])),n)),{})}function Zl(e){const{config:t,markDef:n}=e;if(xn("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&&dr(r)&&(t[o]=!0)}return t}),{}),r=E(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>to(e,t))).join(` ${e} `)}return}(e,{channels:vt});if(t)return{defined:{signal:t}}}return{}}function ec(e,t){if(void 0!==t)return{[e]:gn(t)}}const tc="voronoi",nc={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(tc)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Rr(o))return ui(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(tc),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Cl(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 s=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?s=n:r.indexOf(tc)>=0&&(u=!0)})),u||n.splice(s+1,0,a),n}},ic={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!ls(e.bind),parse:(e,t,n)=>Dc(t,n),topLevelSignals:(e,n,i)=>{const r=n.name,o=n.project,a=n.bind,s=n.init&&n.init[0],u=nc.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return o.items.forEach(((e,o)=>{const l=O(`${r}_${e.field}`);var c,f;i.filter((e=>e.name===l)).length||i.unshift({name:l,...s?{init:ol(s[o])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${t.stringValue(e.field)}] : null`}]:[],bind:null!==(c=null!==(f=a[e.field])&&void 0!==f?f:a[e.channel])&&void 0!==c?c:a})})),i},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+vc))[0],a=i+pl,s=r.items.map((e=>O(`${i}_${e.field}`))),u=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${u} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},rc="_toggle",oc={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+rc,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+vc,i=t.name+rc;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${wc(e)}}, `)+`${i} ? ${n} : null`}},ac={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?tl(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(ic.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===O(`${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+vc));i(e,"null"),oc.defined(t)&&(e=n.findIndex((e=>e.name===t.name+rc)),i(e,"false"))}return n}},sc={defined:e=>{const t="global"===e.resolve&&e.bind&&ls(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==ss;return t&&!n&&ui("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,i,r)=>{const o=d(r);if(o.select=t.isString(o.select)?{type:o.select,toggle:i.toggle}:{...o.select,toggle:i.toggle},Dc(i,o),n.isObject(r.select)&&(r.select.on||r.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of i.events){var a;n.filter=t.array(null!==(a=n.filter)&&void 0!==a?a:[]),n.filter.includes(e)||n.filter.push(e)}}const s=cs(i.bind)?i.bind.legend:"click",u=t.isString(s)?tl(s,"view"):t.array(s);i.bind={legend:{merge:u}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=cs(t.bind)&&t.bind.legend,o=e=>t=>{const n=d(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${O(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...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 : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+vc)),a=i+pl,s=r.items.filter((e=>e.hasLegend)).map((e=>O(`${i}_${O(e.field)}_legend`))),u=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:u}):s.length>0&&(o.update=u,delete o.value,delete o.on);const l=n.find((e=>e.name===i+rc)),c=cs(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),n}};const uc="_translate_anchor",lc="_translate_delta",cc={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=hl.defined(t),o=i+uc,{x:a,y:s}=t.project.hasChannel;let u=tl(t.translate,"scope");return r||(u=u.map((e=>(e.between[0].markname=i+bl,e)))),n.push({name:o,value:{},on:[{events:u.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?vl(e,ee):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?vl(e,te):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+lc,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&fc(e,t,a,"width",n),void 0!==s&&fc(e,t,s,"height",n),n}};function fc(e,t,n,i,r){var o,a;const s=t.name,u=s+uc,l=s+lc,c=n.channel,f=hl.defined(t),d=r.filter((e=>e.name===n.signals[f?"data":"visual"]))[0],p=e.getSizeSignalRef(i).signal,m=e.getScaleComponent(c),g=m.get("type"),h=m.get("reverse"),v=`${u}.extent_${c}`,y=`${f?"log"===g?"panLog":"symlog"===g?"panSymlog":"pow"===g?"panPow":"panLinear":"panLinear"}(${v}, ${`${f?c===ee?h?"":"-":h?"-":"":""}${l}.${c} / ${f?`${p}`:`span(${v})`}`}${f?"pow"===g?`, ${null!==(o=m.get("exponent"))&&void 0!==o?o:1}`:"symlog"===g?`, ${null!==(a=m.get("constant"))&&void 0!==a?a:1}`:"":""})`;d.on.push({events:{signal:l},update:f?y:`clampRange(${y}, 0, ${p})`})}const dc="_zoom_anchor",pc="_zoom_delta",mc={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const r=n.name,o=hl.defined(n),a=r+pc,{x:s,y:u}=n.project.hasChannel,l=t.stringValue(e.scaleName(ee)),c=t.stringValue(e.scaleName(te));let f=tl(n.zoom,"scope");return o||(f=f.map((e=>(e.markname=r+bl,e)))),i.push({name:r+dc,on:[{events:f,update:o?"{"+[l?`x: invert(${l}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((e=>!!e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&gc(e,n,s,"width",i),void 0!==u&&gc(e,n,u,"height",i),i}};function gc(e,t,n,i,r){var o,a;const s=t.name,u=n.channel,l=hl.defined(t),c=r.filter((e=>e.name===n.signals[l?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),p=d.get("type"),m=l?vl(e,u):c.name,g=s+pc,h=`${l?"log"===p?"zoomLog":"symlog"===p?"zoomSymlog":"pow"===p?"zoomPow":"zoomLinear":"zoomLinear"}(${m}, ${`${s}${dc}.${u}`}, ${g}${l?"pow"===p?`, ${null!==(o=d.get("exponent"))&&void 0!==o?o:1}`:"symlog"===p?`, ${null!==(a=d.get("constant"))&&void 0!==a?a:1}`:"":""})`;c.on.push({events:{signal:g},update:l?h:`clampRange(${h}, 0, ${f})`})}const hc="_store",vc="_tuple",yc="_modify",bc="vlSelectionResolve",xc=[Dl,wl,gl,oc,ic,hl,sc,ac,cc,mc,nc];function wc(e,{escape:n}={escape:!0}){let i=n?t.stringValue(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!xm(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const n of Te)e[n]&&(i+=` + '__facet_${n}_' + (facet[${t.stringValue(r.vgField(n))}])`)}return i}function Ac(e){var t;return B(null!==(t=e.component.selection)&&void 0!==t?t:{}).reduce(((e,t)=>e||t.project.items.some((e=>e.field===ss))),!1)}function Dc(e,t){!n.isString(t.select)&&t.select.on||delete e.events,!n.isString(t.select)&&t.select.clear||delete e.clear,!n.isString(t.select)&&t.select.toggle||delete e.toggle}const Fc="RawCode",$c="Literal",kc="Property",Cc="Identifier",Sc="ArrayExpression",Ec="BinaryExpression",Bc="CallExpression",_c="ConditionalExpression",zc="LogicalExpression",Oc="MemberExpression",Pc="ObjectExpression",Nc="UnaryExpression";function jc(e){this.type=e}var Mc,Tc,Lc,qc,Rc;jc.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 Ec: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 Oc:return[e.object,e.property];case Pc:return e.properties;case kc:return[e.key,e.value];case Nc:return[e.argument];case Cc:case $c:case Fc:default:return[]}}(this),n=0,i=t.length;n",Mc[3]="Identifier",Mc[4]="Keyword",Mc[5]="Null",Mc[6]="Numeric",Mc[7]="Punctuator",Mc[8]="String",Mc[9]="RegularExpression";var Wc="Identifier",Uc="Unexpected token %0",Hc="Invalid regular expression",Ic="Invalid regular expression: missing /",Vc="Octal literals are not allowed in strict mode.",Gc="ILLEGAL",Yc="Disabled.",Xc=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]"),Jc=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 Qc(e,t){if(!e)throw new Error("ASSERT: "+t)}function Kc(e){return e>=48&&e<=57}function Zc(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function ef(e){return"01234567".indexOf(e)>=0}function tf(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 nf(e){return 10===e||13===e||8232===e||8233===e}function rf(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Xc.test(String.fromCharCode(e))}function of(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Jc.test(String.fromCharCode(e))}const af={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 sf(){for(;Lc1114111||"}"!==e)&&Ff({},Uc,Gc),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function cf(){var e,t;for(e=Tc.charCodeAt(Lc++),t=String.fromCharCode(e),92===e&&(117!==Tc.charCodeAt(Lc)&&Ff({},Uc,Gc),++Lc,(e=uf("u"))&&"\\"!==e&&rf(e.charCodeAt(0))||Ff({},Uc,Gc),t=e);Lc>>="===(i=Tc.substr(Lc,4))?{type:7,value:i,start:r,end:Lc+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:Lc+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:7,value:t,start:r,end:Lc+=2}:("//"===t&&Ff({},Uc,Gc),"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:r,end:++Lc}:void Ff({},Uc,Gc))}function pf(){var e,t,n;if(Qc(Kc((n=Tc[Lc]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Lc,e="","."!==n){if(e=Tc[Lc++],n=Tc[Lc],"0"===e){if("x"===n||"X"===n)return++Lc,function(e){let t="";for(;Lc=0&&Ff({},Hc,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";Ff({},Hc)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Ff({},Hc)}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:Lc}}function gf(){if(sf(),Lc>=qc)return{type:2,start:Lc,end:Lc};const e=Tc.charCodeAt(Lc);return rf(e)?ff():40===e||41===e||59===e?df():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(Qc("'"===(e=Tc[Lc])||'"'===e,"String literal must starts with a quote"),t=Lc,++Lc;Lc=0&&Lc(Qc(t":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 Rf(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,u,l;if(e=Rc,u=Lf(),0===(r=qf(i=Rc)))return u;for(i.prec=r,hf(),t=[e,Rc],o=[u,i,a=Lf()];(r=qf(Rc))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),t.pop(),n=yf(s,u,a),o.push(n);(i=hf()).prec=r,o.push(i),t.push(Rc),n=Lf(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=yf(o[l-1].value,o[l-2],n),l-=2;return n}(),Cf("?")&&(hf(),t=Rf(),kf(":"),e=function(e,t,n){const i=new jc("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Rf())),e}function Wf(){const e=Rf();if(Cf(","))throw new Error(Yc);return e}function Uf(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...Uf(e.object)),t.push(...Uf(e.property))),t)}function Hf(e){return"MemberExpression"===e.object.type?Hf(e.object):"datum"===e.object.name}function If(e){const t=function(e){Lc=0,qc=(Tc=e).length,Rc=null,vf();const t=Wf();if(2!==Rc.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&Hf(e)&&n.add(Uf(e).slice(1).join("."))})),n}class Vf extends cl{clone(){return new Vf(null,this.model,d(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,Sn(this,"expr",void 0),Sn(this,"_dependentFields",void 0),this.expr=Xf(this.model,this.filter,this),this._dependentFields=If(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Gf(e,n,i,r="datum"){const o=t.isString(n)?n:n.param,a=O(o),s=t.stringValue(a+hc);let u;try{u=e.getSelectionComponent(a,o)}catch(e){return`!!${a}`}if(u.project.timeUnit){const t=null!=i?i:e.component.data.raw,n=u.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const l=`vlSelectionTest(${s}, ${r}${"global"===u.resolve?")":`, ${t.stringValue(u.resolve)})`}`,c=`length(data(${s}))`;return!1===n.empty?`${c} && ${l}`:`!${c} || ${l}`}function Yf(e,n,i){const r=O(n),o=i.encoding;let a,s=i.field;try{a=e.getSelectionComponent(r,n)}catch(e){return r}if(o||s){if(o&&!s){const e=a.project.items.filter((e=>e.channel===o));!e.length||e.length>1?(s=a.project.items[0].field,ui((e.length?"Multiple ":"No ")+`matching ${t.stringValue(o)} encoding found for selection ${t.stringValue(i.param)}. `+`Using "field": ${t.stringValue(s)}.`)):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&ui(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${t.stringValue(s)}.`);return`${a.name}[${t.stringValue(q(s))}]`}function Xf(e,n,i){return P(n,(n=>t.isString(n)?n:function(e){return null==e?void 0:e.param}(n)?Gf(e,n,i):Pi(n)))}function Jf(e,t,n,i){var r,o,a,s,u;null!==(r=e.encode)&&void 0!==r||(e.encode={}),null!==(a=(o=e.encode)[t])&&void 0!==a||(o[t]={}),null!==(u=(s=e.encode[t]).update)&&void 0!==u||(s.update={}),e.encode[t].update[n]=i}function Qf(e,n,i,r={header:!1}){const{disable:o,orient:a,scale:s,labelExpr:u,title:l,zindex:c,...f}=e.combine();if(!o){for(const e in f){const i=va[e],r=f[e];if(i&&i!==n&&"both"!==i)delete f[e];else if(ga(r)){const{condition:n,...i}=r,o=t.array(n),a=ma[e];if(a){const{vgProp:t,part:n}=a;Jf(f,n,t,[...o.map((e=>{const{test:t,...n}=e;return{test:Xf(null,t),...n}})),i]),delete f[e]}else if(null===a){const t={signal:o.map((e=>{const{test:t,...n}=e;return`${Xf(null,t)} ? ${hn(n)} : `})).join("")+hn(i)};f[e]=t}}else if(an(r)){const t=ma[e];if(t){const{vgProp:n,part:i}=t;Jf(f,i,n,r),delete f[e]}}y(["labelAlign","labelBaseline"],e)&&null===f[e]&&delete f[e]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:e}=f.encode;f.encode={...e?{grid:e}:{}},S(f.encode)&&delete f.encode}return{scale:s,orient:a,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:H(c,0)}}{if(!r.header&&e.mainExtracted)return;if(void 0!==u){var d,p;let e=u;null!==(d=f.encode)&&void 0!==d&&null!==(p=d.labels)&&void 0!==p&&p.update&&an(f.encode.labels.update.text)&&(e=R(u,"datum.label",f.encode.labels.update.text.signal)),Jf(f,"labels","text",{signal:e})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const t of ha)e.hasAxisPart(t)||delete f.encode[t];S(f.encode)&&delete f.encode}const n=function(e,n){if(e)return t.isArray(e)&&!on(e)?e.map((e=>ta(e,n))).join(", "):e}(l,i);return{scale:s,orient:a,grid:!1,...n?{title:n}:{},...f,...!1===i.aria?{aria:!1}:{},zindex:H(c,0)}}}}function Kf(e){const{axes:t}=e.component,n=[];for(const i of vt)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}function Zf(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"]||{},a=new Set([...E(r),...E(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${vn(r[t])} : ${vn(o[t])}`};return s}return t[e]}))])}function ed(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:function(e){return e in ar}(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=an(n)?"axisOrient":`axis${j(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],u=["axis",a,o];return{vlOnlyAxisConfig:Zf(s,i,e,n),vgAxisConfig:Zf(u,i,e,n),axisConfigStyle:td([...u,...s],i)}}function td(e,n){const i=[{}];for(const o of e){var r;let e=null===(r=n[o])||void 0===r?void 0:r.style;if(e){e=t.array(e);for(const t of e)i.push(n.style[t])}}return Object.assign.apply(null,i)}function nd(e,t,n,i={}){const r=Dn(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"]){var o;if(void 0!==(null===(o=i[t])||void 0===o?void 0:o[e]))return{configFrom:t,configValue:i[t][e]}}return{}}const id={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:n})=>{const{format:i,formatType:r}=n;return fo(e,e.type,i,r,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return po(i,t,n)},grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>{var i;return null!==(i=t.grid)&&void 0!==i?i:function(e,t){return!fr(e)&&No(t)&&!Jt(null==t?void 0:t.bin)&&!Qt(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||ad(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||od(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&&y(["quantitative","temporal"],e))return!0;return}(t.type,n)},labelOverlap:({axis:e,fieldOrDatumDef:n,scaleType:i})=>{var r;return null!==(r=e.labelOverlap)&&void 0!==r?r:function(e,n,i,r){if(i&&!t.isObject(r)||"nominal"!==e&&"ordinal"!==e)return"log"!==n&&"symlog"!==n||"greedy";return}(n.type,i,No(n)&&!!n.timeUnit,No(n)?n.sort:void 0)},orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{var o;const a="x"===e?"width":"y"===e?"height":void 0,s=a?t.getSizeSignalRef(a):void 0;return null!==(o=n.tickCount)&&void 0!==o?o:function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){if(!i&&!fr(t)&&"log"!==t){if(No(e)){var r;if(Jt(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&y(["month","hours","day","quarter"],null===(r=Fi(e.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:s,values:n.values})},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=sd(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return $n(r?[Co(r)]:[],No(a)?[Co(a)]:[])},values:({axis:e,fieldOrDatumDef:n})=>function(e,n){const i=e.values;if(t.isArray(i))return da(n,i);if(an(i))return i;return}(e,n),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>{var i;return null!==(i=e.zindex)&&void 0!==i?i:function(e,t){if("rect"===e&&Xo(t))return 1;return 0}(n,t)}};function rd(e){return`(((${e.signal} % 360) + 360) % 360)`}function od(e,t,n,i){if(void 0!==e){if("x"===n){if(an(e)){const n=rd(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${an(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(Uo(t)&&Do(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${Pi({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new ud(e,{calculate:a,as:ld(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 ${h(this.transform)}`}}function ld(e,t,n){return Yo(e,{prefix:t,suffix:"sort_index",...null!=n?n:{}})}function cd(e,t){return y(["top","bottom"],t)?"column":y(["left","right"],t)||"row"===e?"row":"column"}function fd(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return H((t||{})[e],r[e],n.header[e])}function dd(e,t,n,i){const r={};for(const o of e){const e=fd(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const pd=["row","column"],md=["header","footer"];function gd(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:a,titleOrient:s}=dd(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=cd(t,s),l=X(a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...vd(l,u),...hd(u,l,o),...Fd(i,r,t,is,ts)}}}function hd(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=ad(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function vd(e,t){const n=od(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function yd(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of md)if(n[r])for(const o of n[r]){const a=wd(e,t,r,n,o);null!=a&&i.push(a)}return i}function bd(e,n){const{sort:i}=e;var r;return Ao(i)?{field:Yo(i,{expr:"datum"}),order:null!==(r=i.order)&&void 0!==r?r:"ascending"}:t.isArray(i)?{field:ld(e,n,{expr:"datum"}),order:"ascending"}:{field:Yo(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function xd(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:u}=dd(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=uo({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=cd(t,s);return{text:{signal:u?R(R(u,"datum.label",l),"datum.value",Yo(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...vd(o,c),...hd(c,o,a),...Fd(n,e,t,rs,ns)}}function wd(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=dd(["labelOrient"],a.header,s,t);("row"===t&&!y(["top","bottom"],e)||"column"===t&&!y(["left","right"],e))&&(o=xd(a,t,s))}const u=xm(e)&&!Fo(e.facet),l=r.axes,c=(null==l?void 0:l.length)>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:bd(a,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const Ad={column:{start:0,end:1},row:{start:1,end:0}};function Dd(e,t){return Ad[t][e]}function Fd(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=fd(a,null==t?void 0:t.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function $d(e){return[...kd(e,"width"),...kd(e,"height"),...kd(e,"childWidth"),...kd(e,"childHeight")]}function kd(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(fr(i)&&sn(o)){const i=e.scaleName(n);if(xm(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Cd(i,o)]}return[Cd(i,o),{name:r,update:Sd(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} : ${ws(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Cd(e,t){return{name:`${e}_step`,value:t.step}}function Sd(e,t,n){const i=t.get("type"),r=t.get("padding"),o=H(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${vn(a)}, ${vn(o)}) * ${e}_step`}function Ed(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Bd(e,t){return E(e).reduce(((n,i)=>{const r=e[i];return{...n,...Fl(t,r,i,(e=>gn(e.value)))}}),{})}function _d(e,t){if(Am(t)||xm(t))return"shared";if(wm(t))return yt(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function zd(e,t){const n=e.scale[t],i=yt(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&ui(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 Od=E({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});class Pd extends Pu{}const Nd={symbols:function(e,{fieldOrDatumDef:n,model:i,channel:r,legendCmpt:o,legendType:a}){var s,u,l,c;if("symbol"!==a)return;const{markDef:f,encoding:d,config:p,mark:m}=i,g=f.filled&&"trail"!==m;let h={...yn({},i,Ir),...Pl(i,{filled:g})};const v=null!==(s=o.get("symbolOpacity"))&&void 0!==s?s:p.legend.symbolOpacity,y=null!==(u=o.get("symbolFillColor"))&&void 0!==u?u:p.legend.symbolFillColor,b=null!==(l=o.get("symbolStrokeColor"))&&void 0!==l?l:p.legend.symbolStrokeColor,x=void 0===v?null!==(c=jd(d.opacity))&&void 0!==c?c:f.opacity:void 0;if(h.fill){var w;if("fill"===r||g&&r===de)delete h.fill;else if(h.fill.field)if(y)delete h.fill;else h.fill=gn(null!==(w=p.legend.symbolBaseFillColor)&&void 0!==w?w:"black"),h.fillOpacity=gn(null!=x?x:1);else if(t.isArray(h.fill)){var A,D,F;const e=null!==(A=null!==(D=Md(null!==(F=d.fill)&&void 0!==F?F:d.color))&&void 0!==D?D:f.fill)&&void 0!==A?A:g&&f.color;e&&(h.fill=gn(e))}}if(h.stroke)if("stroke"===r||!g&&r===de)delete h.stroke;else if(h.stroke.field||b)delete h.stroke;else if(t.isArray(h.stroke)){const e=H(Md(d.stroke||d.color),f.stroke,g?f.color:void 0);e&&(h.stroke={value:e})}if(r!==ye){const e=No(n)&&Ld(i,o,n);e?h.opacity=[{test:e,...gn(null!=x?x:1)},gn(p.legend.unselectedOpacity)]:x&&(h.opacity=gn(x))}return h={...h,...e},S(h)?void 0:h},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){var r;if("gradient"!==n)return;const{config:o,markDef:a,encoding:s}=t;let u={};const l=void 0===(null!==(r=i.get("gradientOpacity"))&&void 0!==r?r:o.legend.gradientOpacity)?jd(s.opacity)||a.opacity:void 0;l&&(u.opacity=gn(l));return u={...u,...e},S(u)?void 0:u},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=No(t)?Ld(n,r,t):void 0,u=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=o,f=ao(c)?co({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:a}):void 0,d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return S(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return null!=n&&n.length?{...e,fill:{value:"transparent"}}:e}};function jd(e){return Td(e,((e,t)=>Math.max(e,t.value)))}function Md(e){return Td(e,((e,t)=>H(e,t.value)))}function Td(e,n){return function(e){const n=e&&e.condition;return!!n&&(t.isArray(n)||Wo(n))}(e)?t.array(e.condition).reduce(n,e.value):Wo(e)?e.value:void 0}function Ld(e,n,i){const r=n.get("selections");if(null==r||!r.length)return;const o=t.stringValue(i.field);return r.map((e=>`(!length(data(${t.stringValue(O(e)+hc)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`)).join(" || ")}const qd={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return fo(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return po(i,t,n)},gradientLength:e=>{var t,n;const{legend:i,legendConfig:r}=e;return null!==(t=null!==(n=i.gradientLength)&&void 0!==n?n:r.gradientLength)&&void 0!==t?t:function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:u}=e;if(pr(r))return"horizontal"===n?"top"===i||"bottom"===i?Ud(t,"width",a,o):a:Ud(t,"height",u,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>{var i,r;return null!==(i=null!==(r=e.labelOverlap)&&void 0!==r?r:t.labelOverlap)&&void 0!==i?i:function(e){if(y(["quantile","threshold","log","symlog"],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){if("shape"!==t){var r;const e=null!==(r=Md(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})=>Zo(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(je(n)&&pr(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:n})=>function(e,n){const i=e.values;if(t.isArray(i))return da(n,i);if(an(i))return i;return}(n,e)};function Rd(e){const{legend:t}=e;return H(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(je(e)){if(y(["quarter","month","day"],t))return"symbol";if(pr(n))return"gradient"}return"symbol"}(e))}function Wd({legendConfig:e,legendType:t,orient:n,legend:i}){var r,o;return null!==(r=null!==(o=i.direction)&&void 0!==o?o:e[t?"gradientDirection":"symbolDirection"])&&void 0!==r?r: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 Ud(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function Hd(e){const t=bm(e)?function(e){const{encoding:t}=e,n={};for(const i of[de,...as]){const r=ra(t[i]);r&&e.getScaleComponent(i)&&(i===ge&&No(r)&&r.type===Ri||(n[i]=Vd(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){Hd(i);for(const r of E(i.component.legends))n.legend[r]=zd(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=Gd(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of E(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 Id(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!(null==n||!n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function Vd(e,t){var n,i,r;let o=e.legend(t);const{markDef:a,encoding:s,config:u}=e,l=u.legend,c=new Pd({},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;for(const i of B(null!==(o=e.component.selection)&&void 0!==o?o:{})){var o,a;const e=null!==(a=i.project.hasField[r])&&void 0!==a?a:i.project.hasChannel[t];if(e&&sc.defined(i)){var s;const t=null!==(s=n.get("selections"))&&void 0!==s?s:[];t.push(i.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,c);const f=void 0!==o?!o:l.disable;if(c.set("disable",f,void 0!==o),f)return c;o=o||{};const d=e.getScaleComponent(t).get("type"),p=ra(s[t]),m=No(p)?null===(n=Fi(p.timeUnit))||void 0===n?void 0:n.unit:void 0,g=o.orient||u.legend.orient||"right",h=Rd({legend:o,channel:t,timeUnit:m,scaleType:d}),v={legend:o,channel:t,model:e,markDef:a,encoding:s,fieldOrDatumDef:p,legendConfig:l,config:u,scaleType:d,orient:g,legendType:h,direction:Wd({legend:o,legendType:h,orient:g,legendConfig:l})};for(const n of Od){if("gradient"===h&&n.startsWith("symbol")||"symbol"===h&&n.startsWith("gradient"))continue;const i=n in qd?qd[n](v):o[n];if(void 0!==i){const r=Id(i,n,o,e.fieldDef(t));(r||void 0===u.legend[n])&&c.set(n,i,r)}}const y=null!==(i=null===(r=o)||void 0===r?void 0:r.encoding)&&void 0!==i?i:{},b=c.get("selections"),x={},w={fieldOrDatumDef:p,model:e,channel:t,legendCmpt:c,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){var A;const n=Bd(null!==(A=y[t])&&void 0!==A?A:{},e),i=t in Nd?Nd[t](n,w):n;void 0===i||S(i)||(x[t]={...null!=b&&b.length&&No(p)?{name:`${O(p.field)}_legend_${t}`}:{},...null!=b&&b.length?{interactive:!!b}:{},update:i})}var D;S(x)||c.set("encode",x,!(null===(D=o)||void 0===D||!D.encoding));return c}function Gd(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of Od){const i=Lu(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return Yd(e,t);case"title":return Cn(e,t);case"type":return r=!0,ju("symbol")}return Tu(e,t,n,"legend")}));e.setWithExplicit(n,i)}var o,a,s,u;r&&(null!==(o=e.implicit)&&void 0!==o&&null!==(a=o.encode)&&void 0!==a&&a.gradient&&N(e.implicit,["encode","gradient"]),null!==(s=e.explicit)&&void 0!==s&&null!==(u=s.encode)&&void 0!==u&&u.gradient&&N(e.explicit,["encode","gradient"]));return e}function Yd(e,t){return"circle"===t.value?t:e}function Xd(e){const t=e.component.legends,n={};for(const i of E(t)){const r=e.getScaleComponent(i),o=g(r.get("domains"));if(n[o])for(const e of n[o]){Gd(e,t[i])||n[o].push(t[i])}else n[o]=[t[i].clone()]}return B(n).flat().map((t=>function(e,t){var n;const{disable:i,labelExpr:r,selections:o,...a}=e.combine();if(i)return;!1===t.aria&&null==a.aria&&(a.aria=!1);if(null!==(n=a.encode)&&void 0!==n&&n.symbols){const e=a.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||a.stroke||(e.stroke={value:"transparent"});for(const t of as)a[t]&&delete e[t]}a.title||delete a.title;if(void 0!==r){var s,u;let e=r;null!==(s=a.encode)&&void 0!==s&&null!==(u=s.labels)&&void 0!==u&&u.update&&an(a.encode.labels.update.text)&&(e=R(r,"datum.label",a.encode.labels.update.text.signal)),function(e,t,n,i){var r,o,a,s,u;null!==(r=e.encode)&&void 0!==r||(e.encode={}),null!==(a=(o=e.encode)[t])&&void 0!==a||(o[t]={}),null!==(u=(s=e.encode[t]).update)&&void 0!==u||(s.update={}),e.encode[t].update[n]=i}(a,"labels","text",{signal:e})}return a}(t,e.config))).filter((e=>void 0!==e))}function Jd(e){return Am(e)||wm(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),Qd(e))}(e):Qd(e)}function Qd(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=an(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return y(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const Kd=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class Zd extends Pu{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,Sn(this,"merged",!1)}get isFit(){return!!this.data}}function ep(e){e.component.projection=bm(e)?function(e){if(e.hasProjection){var t;const n=nn(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[[le,ue],[fe,ce]])(ra(n[i[0]])||ra(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(ge)&&e.typedFieldDef(ge).type===Ri&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(Yu.Main));return t}(e):void 0,a=new Zd(e.projectionName(!0),{...null!==(t=nn(e.config.projection))&&void 0!==t?t:{},...null!=n?n:{}},r,o);return a.get("type")||a.set("type","equalEarth",!1),a}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)ep(t);const i=x(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=x(Kd,(i=>!t.hasOwnProperty(e.explicit,i)&&!t.hasOwnProperty(n.explicit,i)||!!(t.hasOwnProperty(e.explicit,i)&&t.hasOwnProperty(n.explicit,i)&&f(e.get(i),n.get(i)))));if(f(e.size,n.size)){if(i)return e;if(f(e.explicit,{}))return n;if(f(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0}));if(n&&i){const t=e.projectionName(!0),i=new Zd(t,n.specifiedProjection,n.size,d(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function tp(e,t,n,i){if(pa(t,n)){var r,o;const a=bm(e)&&null!==(r=null!==(o=e.axis(n))&&void 0!==o?o:e.legend(n))&&void 0!==r?r:{},s=Yo(t,{expr:"datum"}),u=Yo(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Yo(t,{binSuffix:"range",forAs:!0}),formula:vo(s,u,a.format,a.formatType,i)}}return{}}function np(e,t){return`${Xt(e)}_${t}`}function ip(e,t,n){var i;const r=np(null!==(i=ua(n,void 0))&&void 0!==i?i:{},t);return e.getName(`${r}_bins`)}function rp(e,n,i){let r,o;r=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Yo(e,{forAs:!0}),Yo(e,{binSuffix:"end",forAs:!0})];const a={...ua(n,void 0)},s=np(a,e.field),{signal:u,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(i,s);if(Zt(a.extent)){const e=a.extent;o=Yf(i,e.param,e),delete a.extent}return{key:s,binComponent:{bin:a,field:e.field,as:[r],...u?{signal:u}:{},...l?{extentSignal:l}:{},...o?{span:o}:{}}}}class op extends cl{clone(){return new op(null,d(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(Ro(n)&&Jt(n.bin)){const{key:r,binComponent:o}=rp(n,n.bin,t);e[r]={...o,...e[r],...tp(t,n,i,t.config)}}return e}),{});return S(n)?null:new op(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=rp(t,t.bin,n);return new op(e,{[i]:r})}merge(e,t){for(const n of E(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=D([...this.bins[n].as,...e.bins[n].as],h)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(B(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(B(this.bins).map((e=>e.field)))}hash(){return`Bin ${h(this.bins)}`}assemble(){return B(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:q(e.field),as:n,signal:e.signal,...Zt(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:q(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:Yo({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function ap(e,t,n,i){const r=bm(i)?i.encoding[et(t)]:void 0;if(Ro(n)&&bm(i)&&_o(n,r,i.markDef,i.config))e.add(Yo(n,{})),e.add(Yo(n,{suffix:"end"})),n.bin&&pa(n,t)&&e.add(Yo(n,{binSuffix:"range"}));else if(t in Oe){const n=function(e){switch(e){case ue:return"y";case ce:return"y2";case le:return"x";case fe:return"x2"}}(t);e.add(i.getName(n))}else e.add(Yo(n));return e}class sp extends cl{clone(){return new sp(null,new Set(this.dimensions),d(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}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)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o){var s;null!==(s=i["*"])&&void 0!==s||(i["*"]={}),i["*"].count=new Set([Yo(e,{forAs:!0})])}else{if(Wt(o)||Ut(o)){var u;const e=Wt(o)?"argmin":"argmax",t=o[e];null!==(u=i[t])&&void 0!==u||(i[t]={}),i[t][e]=new Set([Yo({op:e,field:t},{forAs:!0})])}else{var l;null!==(l=i[a])&&void 0!==l||(i[a]={}),i[a][o]=new Set([Yo(e,{forAs:!0})])}var c;if(Pt(n)&&"unaggregated"===t.scaleDomain(n))null!==(c=i[a])&&void 0!==c||(i[a]={}),i[a].min=new Set([Yo({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([Yo({field:a,aggregate:"max"},{forAs:!0})])}else ap(r,n,e,t)})),r.size+E(i).length===0?null:new sp(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:a}=e;var r,o;if(t)if("count"===t)null!==(r=i["*"])&&void 0!==r||(i["*"]={}),i["*"].count=new Set([a||Yo(e,{forAs:!0})]);else null!==(o=i[n])&&void 0!==o||(i[n]={}),i[n][t]=new Set([a||Yo(e,{forAs:!0})])}for(const e of null!==(a=t.groupby)&&void 0!==a?a:[]){var a;n.add(e)}return n.size+E(i).length===0?null:new sp(e,n,i)}merge(e){return F(this.dimensions,e.dimensions)?(function(e,t){for(const i of E(t)){const r=t[i];for(const t of E(r)){var n;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){si.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...E(this.measures)])}producedFields(){const e=new Set;for(const t of E(this.measures))for(const n of E(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 ${h({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of E(this.measures))for(const r of E(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:q(i));return{type:"aggregate",groupby:[...this.dimensions].map(q),ops:e,fields:t,as:n}}}class up extends cl{constructor(e,n,i,r){super(e),this.model=n,this.name=i,this.data=r,Sn(this,"column",void 0),Sn(this,"row",void 0),Sn(this,"facet",void 0),Sn(this,"childModel",void 0);for(const e of Te){const i=n.facet[e];if(i){const{bin:r,sort:o}=i;this[e]={name:n.getName(`${e}_domain`),fields:[Yo(i),...Jt(r)?[Yo(i,{binSuffix:"end"})]:[]],...Ao(o)?{sortField:o}:t.isArray(o)?{sortIndexField:ld(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of Te)this[t]&&(e+=` ${t.charAt(0)}:${h(this[t])}`);return e}get fields(){const e=[];for(const n of Te){var t;null!==(t=this[n])&&void 0!==t&&t.fields&&e.push(...this[n].fields)}return e}dependentFields(){const e=new Set(this.fields);for(const t of Te)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 vt){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(fr(i)&&sn(r)){const n=Kp(Zp(this.childModel,t));n?e[t]=n:ui(jn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:u}=this[e];if(s){const{op:e=yo,field:t}=s;r.push(t),o.push(e),a.push(Yo(s,{forAs:!0}))}else u&&(r.push(u),o.push("max"),a.push(u));return{name:this[e].name,source:null!=t?t:this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of pd){for(const t of md){var o;const i=null!==(o=n[e]&&n[e][t])&&void 0!==o?o:[];for(const t of i){var a;if((null===(a=t.axes)||void 0===a?void 0:a.length)>0){r[e]=!0;break}}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:s,column:u}=r;return(s||u)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){var a,s;t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(null!==(a=n.x)&&void 0!==a?a:[],null!==(s=n.y)&&void 0!==s?s:[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[K,Q])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function lp(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function cp(e){const n={};return l(e.filter,(e=>{if(zi(e)){let r=null;if($i(e))r=pn(e.equal);else if(Ci(e))r=pn(e.lte);else if(ki(e))r=pn(e.lt);else if(Si(e))r=pn(e.gt);else if(Ei(e))r=pn(e.gte);else if(Bi(e))r=e.range[0];else if(_i(e)){var i;r=(null!==(i=e.oneOf)&&void 0!==i?i:e.in)[0]}r&&(li(r)?n[e.field]="date":t.isNumber(r)?n[e.field]="number":t.isString(r)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}})),n}function fp(e){const n={};function i(e){var i;ca(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&y(["min","max"],i))?n[e.field]="number":U(e.field)>1?e.field in n||(n[e.field]="flatten"):Uo(e)&&Ao(e.sort)&&U(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((bm(e)||xm(e))&&e.forEachFieldDef(((t,n)=>{if(Ro(t))i(t);else{const r=Ke(n),o=e.fieldDef(r);i({...t,type:o.type})}})),bm(e)){const{mark:t,markDef:i,encoding:r}=e;if(Rr(t)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];No(e)&&"quantitative"===e.type&&!(e.field in n)&&(n[e.field]="number")}}return n}class dp extends cl{clone(){return new dp(null,d(this._parse))}constructor(e,t){super(e),Sn(this,"_parse",void 0),this._parse=t}hash(){return`Parse ${h(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!Hu(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 E(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]:ui(Wn(e,n[e],t.value)))}for(const e of E(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:ui(Wn(e,t[e],n)))}const r=new Pu(t,n);i.copyAll(r);const o={};for(const e of E(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===E(o).length||i.parseNothing?null:new dp(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of E(this._parse)){const n=this._parse[t];1===U(t)&&(e[t]=n)}return e}producedFields(){return new Set(E(this._parse))}dependentFields(){return new Set(E(this._parse))}assembleTransforms(e=!1){return E(this._parse).filter((t=>!e||U(t)>1)).map((e=>{const t=function(e,t){const n=M(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(t.startsWith("date:"))return`timeParse(${n},'${lp(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${lp(t.slice(4,t.length))}')`;return ui(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:W(e)}})).filter((e=>null!==e))}}class pp extends cl{clone(){return new pp(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([ss])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:ss}}}class mp extends cl{clone(){return new mp(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${h(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class gp extends cl{clone(){return new gp(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){var e;return new Set([null!==(e=this.params.as)&&void 0!==e?e:"data"])}hash(){return`Hash ${h(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class hp extends cl{constructor(e){var t;let n;if(super(null),Sn(this,"_data",void 0),Sn(this,"_name",void 0),Sn(this,"_generator",void 0),null!==(t=e)&&void 0!==t||(e={name:"source"}),Hu(e)||(n=e.format?{...m(e.format,["parse"])}:{}),Wu(e))this._data={values:e.values};else if(Ru(e)){if(this._data={url:e.url},!n.type){let t=/(?:\.([^.]+))?$/.exec(e.url)[1];y(["json","csv","tsv","dsv","topojson"],t)||(t="json"),n.type=t}}else Vu(e)?this._data={values:[{type:"Sphere"}]}:(Uu(e)||Hu(e))&&(this._data={});this._generator=Hu(e),e.name&&(this._name=e.name),n&&!S(n)&&(this._data.format=n)}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{name:this._name,...this._data,transform:[]}}}function vp(e){return e instanceof hp||e instanceof mp||e instanceof gp}var yp=new WeakMap;class bp{constructor(){yp.set(this,{writable:!0,value:void 0}),En(this,yp,!1)}setModified(){En(this,yp,!0)}get modifiedFlag(){return function(e,t){return t.get?t.get.call(e):t.value}(e=this,Bn(e,yp,"get"));var e}}class xp extends bp{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 wp extends bp{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class Ap extends wp{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;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class Dp extends wp{constructor(e){super(),Sn(this,"requiresSelectionId",void 0),this.requiresSelectionId=e&&Ac(e)}run(e){e instanceof pp&&(this.requiresSelectionId&&(vp(e.parent)||e.parent instanceof sp||e.parent instanceof dp)||(this.setModified(),e.remove()))}}class Fp extends bp{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof dl&&(n=e.producedFields(),$(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 $p extends wp{constructor(){super()}run(e){e instanceof fl&&!e.isRequired()&&(this.setModified(),e.remove())}}class kp extends xp{run(e){if(!(vp(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof dp)if(e instanceof dp)this.setModified(),e.merge(t);else{if(C(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Cp extends xp{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof dp));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 E(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!S(i)){this.setModified();const n=new dp(e,i);for(const r of t){if(r instanceof dp)for(const e of E(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof dp&&0===E(r.parse).length&&r.remove()}}}}}class Sp extends xp{run(e){e instanceof fl||e.numChildren()>0||e instanceof up||e instanceof hp||(this.setModified(),e.remove())}}class Ep extends xp{run(e){const t=e.children.filter((e=>e instanceof dl)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class Bp extends xp{run(e){const t=e.children.filter((e=>e instanceof sp)),n={};for(const e of t){const t=h(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of E(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 _p extends xp{constructor(e){super(),this.model=e}run(e){const t=!(vp(e)||e instanceof Vf||e instanceof dp||e instanceof pp),n=[],i=[];for(const r of e.children)r instanceof op&&(t&&!C(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 op?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 zp extends xp{run(e){const t=[...e.children];if(!b(t,(e=>e instanceof fl))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof fl){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof fl))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 Op extends cl{clone(){return new Op(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=D(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:Yo(e)}hash(){return`JoinAggregateTransform ${h(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{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class Pp extends cl{clone(){return new Pp(null,d(this._stack))}constructor(e,t){super(e),Sn(this,"_stack",void 0),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:r,as:o,offset:a="zero"}=n,s=[],u=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),u.push(H(e.order,"ascending"));const l={field:s,order:u};let c;return c=function(e){return t.isArray(e)&&e.every((e=>t.isString(e)))&&e.length>1}(o)?o:t.isString(o)?[o,`${o}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new Pp(e,{stackField:i,groupby:r,offset:a,sort:l,facetby:[],as:c})}static makeFromEncoding(e,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannel:o,fieldChannel:a,offset:s,impute:u}=i;let l;if(o){l=ia(r[o])}const c=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=Yo(t.fieldDef);return n&&e.push(n),e}),[])}(n),f=n.encoding.order;let d;return d=t.isArray(f)||No(f)?Fn(f):c.reduce(((e,t)=>(e.field.push(t),e.order.push("y"===a?"descending":"ascending"),e)),{field:[],order:[]}),new Pp(e,{dimensionFieldDef:l,stackField:n.vgField(a),facetby:[],stackby:c,sort:d,offset:s,impute:u,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{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 ${h(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[Yo(e,{binSuffix:"mid"})]:[Yo(e,{}),Yo(e,{binSuffix:"end"})]:[Yo(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:u}=this._stack;if(s&&n){const{bandPosition:o=.5,bin:a}=n;a&&e.push({type:"formula",expr:`${o}*`+Yo(n,{expr:"datum"})+`+${1-o}*`+Yo(n,{expr:"datum",binSuffix:"end"}),as:Yo(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:Yo(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:a}),e}}class Np extends cl{clone(){return new Np(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=D(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:Yo(e)}hash(){return`WindowTransform ${h(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>Ht(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort){var u;a.push(e.field),s.push(null!==(u=e.order)&&void 0!==u?u:"ascending")}const l={field:a,order:s},c=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==c?{ignorePeers:c}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function jp(e){if(e instanceof up)if(1!==e.numChildren()||e.children[0]instanceof fl){const n=e.model.component.data.main;Mp(n);const i=(t=e,function e(n){if(!(n instanceof up)){const i=n.clone();if(i instanceof fl){const e=Tp+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof sp||i instanceof Pp||i instanceof Np||i instanceof Op)&&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 sp||t instanceof Pp||t instanceof Np||t instanceof Op)&&t.addDimensions(e.fields),t.swapWithParent(),jp(e)}else e.children.map(jp);var t}function Mp(e){if(e instanceof fl&&e.type===Yu.Main&&1===e.numChildren()){const t=e.children[0];t instanceof up||(t.swapWithParent(),Mp(e))}}const Tp="scale_";function Lp(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!Lp(t.children))return!1}return!0}function qp(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function Rp(e,t,n){let i=e.sources,r=!1;return r=qp(new $p,i)||r,r=qp(new Dp(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=qp(new Sp,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=qp(new kp,i)||r,r=qp(new _p(t),i)||r,r=qp(new Fp,i)||r,r=qp(new Cp,i)||r,r=qp(new Bp,i)||r,r=qp(new Ep,i)||r,r=qp(new Ap,i)||r,r=qp(new zp,i)||r),e.sources=i,r}class Wp{constructor(e){Sn(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Wp((()=>e(t)))}}function Up(e){bm(e)?function(e){const t=e.component.scales;for(const n of E(t)){const i=Hp(e,n);if(t[n].setWithExplicit("domains",i),Yp(e,n),e.component.data.isFaceted){let t=e;for(;!xm(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)un(e)&&(e.data=Tp+e.data.replace(Tp,""))}}}(e):function(e){for(const t of e.children)Up(t);const t=e.component.scales;for(const n of E(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"):Lu(i,e.getWithExplicit("domains"),"domains","scale",Jp);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&ui(qn),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function Hp(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}=Xp(t,n);if(!e)return void ui(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Xp(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]={...e.specifiedScales[t],domain:r}),"x"===t&&ra(i.x2)?ra(i.x)?Lu(Vp(n,r,e,"x"),Vp(n,r,e,"x2"),"domain","scale",Jp):Vp(n,r,e,"x2"):"y"===t&&ra(i.y2)?ra(i.y)?Lu(Vp(n,r,e,"y"),Vp(n,r,e,"y2"),"domain","scale",Jp):Vp(n,r,e,"y2"):Vp(n,r,e,t)}function Ip(e,t,n){var i;const r=null===(i=Fi(n))||void 0===i?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>({signal:`{data: ${fa(e,{timeUnit:n,type:t})}}`})))}(e,t,r):[e]}function Vp(e,n,i,r){const{encoding:o}=i,a=ra(o[r]),{type:s}=a,u=a.timeUnit;if(function(e){return e&&e.unionWith}(n)){const t=Vp(e,void 0,i,r),o=Ip(n.unionWith,s,u);return Nu([...t.value,...o])}if(an(n))return Nu([n]);if(n&&"unaggregated"!==n&&!gr(n))return Nu(Ip(n,s,u));const l=i.stack;if(l&&r===l.fieldChannel){if("normalize"===l.offset)return ju([[0,1]]);const e=i.requestDataName(Yu.Main);return ju([{data:e,field:i.vgField(r,{suffix:"start"})},{data:e,field:i.vgField(r,{suffix:"end"})}])}const c=Pt(r)&&No(a)?function(e,t,n){if(!fr(n))return;const i=e.fieldDef(t),r=i.sort;if(Do(r))return{op:"min",field:ld(i,t),order:"ascending"};const{stack:o}=e,a=o?[...o.groupbyField?[o.groupbyField]:[],...o.stackBy.map((e=>e.fieldDef.field))]:void 0;if(Ao(r)){return Gp(r,o&&!y(a,r.field))}if(wo(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:u}=i,l=o&&!y(a,u);if(Wt(s)||Ut(s))return Gp({field:Yo(i),order:n},l);if(Ht(s)||!s)return Gp({op:s,field:u,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(y(["ascending",void 0],r))return!0}return}(i,r,e):void 0;if(Mo(a)){return ju(Ip([a.datum],s,u))}const f=a;if("unaggregated"===n){const e=i.requestDataName(Yu.Main),{field:t}=a;return ju([{data:e,field:Yo({field:t,aggregate:"min"})},{data:e,field:Yo({field:t,aggregate:"max"})}])}if(Jt(f.bin)){if(fr(e))return ju("bin-ordinal"===e?[]:[{data:z(c)?i.requestDataName(Yu.Main):i.requestDataName(Yu.Raw),field:i.vgField(r,pa(f,r)?{binSuffix:"range"}:{}),sort:!0!==c&&t.isObject(c)?c:{field:i.vgField(r,{}),op:"min"}}]);{const{bin:e}=f;if(Jt(e)){const t=ip(i,f.field,e);return ju([new Wp((()=>{const e=i.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return ju([{data:i.requestDataName(Yu.Main),field:i.vgField(r,{})}])}}if(f.timeUnit&&y(["time","utc"],e)&&_o(f,bm(i)?i.encoding[et(r)]:void 0,i.markDef,i.config)){const e=i.requestDataName(Yu.Main);return ju([{data:e,field:i.vgField(r)},{data:e,field:i.vgField(r,{suffix:"end"})}])}return ju(c?[{data:z(c)?i.requestDataName(Yu.Main):i.requestDataName(Yu.Raw),field:i.vgField(r),sort:c}]:[{data:i.requestDataName(Yu.Main),field:i.vgField(r)}])}function Gp(e,t){const{op:n,field:i,order:r}=e;return{op:null!=n?n:t?"sum":yo,...i?{field:q(i)}:{},...r?{order:r}:{}}}function Yp(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,a=gr(r)&&r,s=Kt(o)&&Zt(o.extent)&&o.extent;(a||s)&&i.set("selectionExtent",null!=a?a:s,!0)}function Xp(e,n){const{aggregate:i,type:r}=e;return i?t.isString(i)&&!Yt[i]?{valid:!1,reason:Kn(i)}:"quantitative"===r&&"log"===n?{valid:!1,reason:Zn(e)}:{valid:!0}:{valid:!1,reason:Qn(e)}}function Jp(e,t,n,i){return e.explicit&&t.explicit&&ui(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${g(n)} and ${g(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Qp(e){const n=D(e.map((e=>{if(un(e)){const{sort:t,...n}=e;return n}return e})),h),i=D(e.map((e=>{if(un(e)){const t=e.sort;return void 0===t||z(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),h);if(0===n.length)return;if(1===n.length){const n=e[0];if(un(n)&&i.length>0){let e=i[0];if(i.length>1)ui(ni),e=!0;else if(t.isObject(e)&&"field"in e){const t=e.field;n.field===t&&(e=!e.order||{order:e.order})}return{...n,sort:e}}return n}const r=D(i.map((e=>z(e)||!("op"in e)||t.isString(e.op)&&e.op in Rt?e:(ui(function(e){return`Dropping sort property ${g(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),h);let o;1===r.length?o=r[0]:r.length>1&&(ui(ni),o=!0);const a=D(e.map((e=>un(e)?e.data:null)),(e=>e));if(1===a.length&&null!==a[0]){return{data:a[0],fields:n.map((e=>e.field)),...o?{sort:o}:{}}}return{fields:n,...o?{sort:o}:{}}}function Kp(e){if(un(e)&&t.isString(e.field))return e.field;if(function(e){return!t.isArray(e)&&"fields"in e&&!("data"in e)}(e)){let n;for(const i of e.fields)if(un(i)&&t.isString(i.field))if(n){if(n!==i.field)return ui("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."),n}else n=i.field;return ui("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."),n}if(function(e){return!t.isArray(e)&&"fields"in e&&"data"in e}(e)){ui("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 n=e.fields[0];return t.isString(n)?n:void 0}}function Zp(e,t){return Qp(e.component.scales[t].get("domains").map((t=>(un(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function em(e){return Am(e)||wm(e)?e.children.reduce(((e,t)=>e.concat(em(t))),tm(e)):tm(e)}function tm(e){return E(e.component.scales).reduce(((n,i)=>{const r=e.component.scales[i];if(r.merged)return n;const o=r.combine(),{name:a,type:s,selectionExtent:u,domains:l,range:c,reverse:f,...d}=o,p=function(e,n,i,r){if(yt(i)){if(sn(e))return{step:{signal:`${n}_step`}}}else if(t.isObject(e)&&un(e))return{...e,data:r.lookupDataSource(e.data)};return e}(o.range,a,i,e),m=Zp(e,i),g=u?function(e,n,i,r){const o=Yf(e,n.param,n);return{signal:dr(i.get("type"))&&t.isArray(r)&&r[0]>r[1]?`isValid(${o}) && reverse(${o})`:o}}(e,u,r,m):null;return n.push({name:a,type:s,...m?{domain:m}:{},...g?{domainRaw:g}:{},range:p,...void 0!==f?{reverse:f}:{},...d}),n}),[])}class nm extends Pu{constructor(e,t){super({},{name:e}),Sn(this,"merged",!1),this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||b(this.get("domains"),(e=>t.isArray(e)&&2===e.length&&e[0]<=0&&e[1]>=0))}}const im=["range","scheme"];function rm(e){return"x"===e?"width":"y"===e?"height":void 0}function om(e,n){const i=e.fieldDef(n);if(null!=i&&i.bin){const{bin:r,field:o}=i,a=rm(n),s=e.getName(a);if(t.isObject(r)&&r.binned&&void 0!==r.step)return new Wp((()=>{const t=e.scaleName(n),i=`(domain("${t}")[1] - domain("${t}")[0]) / ${r.step}`;return`${e.getSignalName(s)} / (${i})`}));if(Jt(r)){const t=ip(e,o,r);return new Wp((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(s)} / (${i})`}))}}}function am(e,n){const i=n.specifiedScales[e],{size:r}=n,o=n.getScaleComponent(e).get("type");for(const r of im)if(void 0!==i[r]){const a=Fr(o,r),s=$r(e,r);if(a)if(s)ui(s);else switch(r){case"range":{const r=i.range;if(t.isArray(r)){if(yt(e))return Nu(r.map((e=>{if("width"===e||"height"===e){const t=n.getName(e),i=n.getSignalName.bind(n);return Wp.fromName(i,t)}return e})))}else if(t.isObject(r))return Nu({data:n.requestDataName(Yu.Main),field:r.field,sort:{op:"min",field:n.vgField(e)}});return Nu(r)}case"scheme":return Nu(sm(i[r]))}else ui(ei(o,r,e))}if(e===ee||e===te){const t=e===ee?"width":"height",n=r[t];if(ys(n)){if(fr(o))return Nu({step:n.step});ui(ti(t))}}const{rangeMin:a,rangeMax:s}=i,u=function(e,n){const{size:i,config:r,mark:o,encoding:a}=n,s=n.getSignalName.bind(n),{type:u}=ra(a[e]),l=n.getScaleComponent(e).get("type"),{domain:c,domainMid:f}=n.specifiedScales[e];switch(e){case ee:case te:{if(y(["point","band"],l))if(e!==ee||i.width){if(e===te&&!i.height){const e=Ds(r.view,"height");if(ys(e))return e}}else{const e=Ds(r.view,"width");if(ys(e))return e}const t=rm(e),o=n.getName(t);return e===te&&dr(l)?[Wp.fromName(s,o),0]:[0,Wp.fromName(s,o)]}case he:{const a=um(o,n.component.scales[e].get("zero"),r),s=function(e,n,i,r){const o={x:om(i,"x"),y:om(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=cm(n,o,r.view);return t.isNumber(e)?e-1:new Wp((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=cm(n,o,r.view);return t.isNumber(e)?Math.pow(lm*e,2):new Wp((()=>`pow(0.95 * ${e.signal}, 2)`))}}throw new Error(Gn("size",e))}(o,i,n,r);return mr(l)?function(e,t,n){const i=()=>{const i=vn(t),r=vn(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return an(t)?new Wp(i):{signal:i()}}(a,s,function(e,n,i,r){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==i&&t.isArray(i)?i.length+1:(ui(function(e){return`Domain for ${e} is required for threshold scale.`}(r)),3)}}(l,r,c,e)):[a,s]}case ae:return[0,2*Math.PI];case ve:return[0,360];case re:return[0,new Wp((()=>`min(${n.getSignalName("width")},${n.getSignalName("height")})/2`))];case we:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case Ae:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case ge:return"symbol";case de:case pe:case me:return"ordinal"===l?"nominal"===u?"category":"ordinal":void 0!==f?"diverging":"rect"===o||"geoshape"===o?"heatmap":"ramp";case ye:case be:case xe:return[r.scale.minOpacity,r.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,n);return(void 0!==a||void 0!==s)&&Fr(o,"rangeMin")&&t.isArray(u)&&2===u.length?Nu([null!=a?a:u[0],null!=s?s:u[1]]):ju(u)}function sm(e){return function(e){return!t.isString(e)&&!!e.name}(e)?{scheme:e.name,...m(e,["name"])}:{scheme:e}}function um(e,t,n){if(t)return an(t)?{signal:`${t.signal} ? 0 : ${um(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(Gn("size",e))}const lm=.95;function cm(e,t,n){const i=ys(e.width)?e.width.step:As(n,"width"),r=ys(e.height)?e.height.step:As(n,"height");return t.x||t.y?new Wp((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function fm(e,t){bm(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of E(n)){const u=a[s],l=n[s],c=e.getScaleComponent(s),f=ra(r[s]),d=u[t],p=c.get("type"),m=c.get("padding"),g=c.get("paddingInner"),h=Fr(p,t),v=$r(s,t);if(void 0!==d&&(h?v&&ui(v):ui(ei(p,t,s))),h&&void 0===v)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":li(u[t])||"temporal"===n||e?l.set(t,{signal:fa(u[t],{type:n,timeUnit:e})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const n=t in dm?dm[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:p,scalePadding:m,scalePaddingInner:g,domain:u.domain,markDef:o,config:i}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):mm(e,t)}const dm={bins:({model:e,fieldOrDatumDef:t})=>No(t)?function(e,t){const n=t.bin;if(Jt(n)){const i=ip(e,t.field,n);return new Wp((()=>e.getSignalName(i)))}if(Qt(n)&&Kt(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(y([de,pe,me],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:n,domain:i,fieldOrDatumDef:r})=>function(e,n,i,r){var o;if(null!==(o=ia(r))&&void 0!==o&&o.bin||t.isArray(i)||y([Gi,Yi],e))return;return n in ht||void 0}(e,n,i,r),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(e in ht){if(pr(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!No(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===Ki)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 ht){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return H(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 ht&&n===Zi){const{bandPaddingOuter:e}=o;return H(e,an(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 dr(e)&&"descending"===t?an(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(dr(e)&&"descending"===t)return!0;return}(t,No(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:n,domain:i,markDef:r,scaleType:o})=>function(e,n,i,r,o){if(i&&"unaggregated"!==i&&dr(o)){if(t.isArray(i)){const e=i[0],t=i[i.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===n.type&&!mr(o))return!0;if((!No(n)||!n.bin)&&y([...vt,...xt],e)){const{orient:t,type:n}=r;return!y(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(e,n,i,r,o)};function pm(e){bm(e)?function(e){const t=e.component.scales;for(const n of Ot){const i=t[n];if(!i)continue;const r=am(n,e);i.setWithExplicit("range",r)}}(e):mm(e,"range")}function mm(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?pm(n):fm(n,t);for(const i of E(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=Lu(r,e.getWithExplicit(t),t,"scale",Mu(((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0})))}}n[i].setWithExplicit(t,r)}}function gm(e,t,n,i){const r=function(e,t,n){switch(t.type){case"nominal":case"ordinal":var i;if(je(e)||"discrete"===Lt(e))return"shape"===e&&"ordinal"===t.type&&ui(Jn(e,"ordinal")),"ordinal";if(e in ht){if(y(["rect","bar","image","rule"],n.type))return"band"}else if("arc"===n.type&&e in bt)return"band";return Yr(n[tt(e)])||Ho(t)&&null!==(i=t.axis)&&void 0!==i&&i.tickBand?"band":"point";case"temporal":return je(e)?"time":"discrete"===Lt(e)?(ui(Jn(e,"temporal")),"ordinal"):No(t)&&t.timeUnit&&Fi(t.timeUnit).utc?"utc":"time";case"quantitative":return je(e)?No(t)&&Jt(t.bin)?"bin-ordinal":"linear":"discrete"===Lt(e)?(ui(Jn(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Hn(t.type))}(t,n,i),{type:o}=e;return Pt(t)?void 0!==o?function(e,t){if(!Pt(e))return!1;switch(e){case ee:case te:case ae:case re:return pr(t)||y(["band","point"],t);case he:case we:case ye:case be:case xe:case ve:return pr(t)||mr(t)||y(["band","point","ordinal"],t);case de:case pe:case me:return"band"!==t;case Ae:case ge:return"ordinal"===t||mr(t)}}(t,o)?No(n)&&(a=o,s=n.type,!(y([Ti,qi],s)?void 0===a||fr(a):s===Li?y([Gi,Yi,void 0],a):s!==Mi||y([Ui,Hi,Ii,Vi,Xi,Ji,Qi,Wi,void 0],a)))?(ui(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,r)),r):o:(ui(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 a,s}function hm(e){bm(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e;return Ot.reduce(((r,o)=>{const a=ra(t[o]);if(a&&n===qr&&o===ge&&a.type===Ri)return r;let s=a&&a.scale;if(a&&null!==s&&!1!==s){var u;null!==(u=s)&&void 0!==u||(s={});const t=gm(s,o,a,i);r[o]=new nm(e.scaleName(`${o}`,!0),{value:t,explicit:s.type===t})}return r}),{})}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children){hm(t);for(const a of E(t.component.scales)){var r,o;if(null!==(o=(r=i.scale)[a])&&void 0!==o||(r[a]=_d(a,e)),"shared"===i.scale[a]){const e=n[a],r=t.component.scales[a].getWithExplicit("type");e?tr(e.value,r.value)?n[a]=Lu(e,r,"type","scale",vm):(i.scale[a]="independent",delete n[a]):n[a]=r}}}for(const i of E(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new nm(r,o);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),r),e.merged=!0)}}return t}(e)}const vm=Mu(((e,t)=>ir(e)-ir(t)));class ym{constructor(){Sn(this,"nameMap",void 0),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 bm(e){return"unit"===(null==e?void 0:e.type)}function xm(e){return"facet"===(null==e?void 0:e.type)}function wm(e){return"concat"===(null==e?void 0:e.type)}function Am(e){return"layer"===(null==e?void 0:e.type)}class Dm{constructor(e,n,i,r,o,a,s){var u,l;this.type=n,this.parent=i,this.config=o,Sn(this,"name",void 0),Sn(this,"size",void 0),Sn(this,"title",void 0),Sn(this,"description",void 0),Sn(this,"data",void 0),Sn(this,"transforms",void 0),Sn(this,"layout",void 0),Sn(this,"scaleNameMap",void 0),Sn(this,"projectionNameMap",void 0),Sn(this,"signalNameMap",void 0),Sn(this,"component",void 0),Sn(this,"view",void 0),Sn(this,"children",[]),Sn(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=i,this.config=o,this.view=nn(s),this.name=null!==(u=e.name)&&void 0!==u?u:r,this.title=on(e.title)?{text:e.title}:e.title?nn(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new ym,this.projectionNameMap=i?i.projectionNameMap:new ym,this.signalNameMap=i?i.signalNameMap:new ym,this.data=e.data,this.description=e.description,this.transforms=(null!==(l=e.transform)&&void 0!==l?l:[]).map((e=>ou(e)?{filter:c(e.filter,ji)}:e)),this.layout="layer"===n||"unit"===n?{}:function(e,n,i){const r=i[n],o={},{spacing:a,columns:s}=r;void 0!==a&&(o.spacing=a),void 0!==s&&(ko(e)&&!Fo(e.facet)||ps(e))&&(o.columns=s),ms(e)&&(o.columns=1);for(const n of xs)if(void 0!==e[n])if("spacing"===n){var u,l;const i=e[n];o[n]=t.isNumber(i)?i:{row:null!==(u=i.row)&&void 0!==u?u:a,column:null!==(l=i.column)&&void 0!==l?l:a}}else o[n]=e[n];return o}(e,n,o),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:ko(e)||i&&i.component.data.isFaceted&&void 0===e.data},layoutSize:new Pu,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?d(a):{}},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}={}){hm(e),Up(e);for(const t of Dr)fm(e,t);t||pm(e)}(this)}parseProjection(){ep(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Hd(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!==(e=null===(t=this.view)||void 0===t?void 0:t.style)&&void 0!==e?e:"cell"}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of E(n)){const t=n[e];void 0!==t&&(i[e]=gn(t))}return i}assembleGroupEncodeEntry(e){let t={};var n;if((this.view&&(t=this.assembleEncodeFromView(this.view)),!e)&&(this.description&&(t.description=gn(this.description)),"unit"===this.type||"layer"===this.type))return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...null!==(n=t)&&void 0!==n?n:{}};return S(t)?void 0:t}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of Te){const r=e[i];if(null!=r&&r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=dd(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=cd(i,o),s=Dd(e,a);void 0!==s&&(n[a]=s)}}return S(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Te)e[n].title&&t.push(gd(this,n));for(const e of pd)t=t.concat(yd(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>Qf(e,"grid",t))),...i.map((e=>Qf(e,"grid",t))),...n.map((e=>Qf(e,"main",t))),...i.map((e=>Qf(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return Xd(this)}assembleProjections(){return Jd(this)}assembleTitle(){var e;const{encoding:t,...n}=null!==(e=this.title)&&void 0!==e?e:{},i={...rn(this.config.title).nonMark,...n,...t?{encode:{update:t}}:{}};if(i.text){var r,o;if(y(["unit","layer"],this.type)){if(y(["middle",void 0],i.anchor))null!==(r=i.frame)&&void 0!==r||(i.frame="group")}else null!==(o=i.anchor)&&void 0!==o||(i.anchor="start");return S(i)?void 0:i}}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||xm(this.parent)?em(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 O((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(Yu[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(xm(this.parent)){const t=wt(Ed(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(fr(e)&&sn(i)){const e=n.get("name"),i=Kp(Zp(this,t));if(i){return{signal:Sd(e,n,Yo({aggregate:"distinct",field:i},{expr:"datum"}))}}return ui(jn(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):Xe(e)&&Pt(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(function(e){return`Cannot find a selection named "${e}".`}(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 Fm extends Dm{vgField(e,t={}){const n=this.fieldDef(e);if(n)return Yo(n,t)}reduceFieldDef(e,n){return function(e,n,i,r){return e?E(e).reduce(((i,o)=>{const a=e[o];return t.isArray(a)?a.reduce(((e,t)=>n.call(r,e,t,o)),i):n.call(r,i,a,o)}),i):i}(this.getMapping(),((t,n,i)=>{const r=ia(n);return r?e(t,r,i):t}),n)}forEachFieldDef(e,t){Ea(this.getMapping(),((t,n)=>{const i=ia(t);i&&e(i,n)}),t)}}class $m extends cl{clone(){return new $m(null,d(this.transform))}constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=d(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"]}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 ${h(this.transform)}`}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class km extends cl{clone(){return new km(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==xn("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=Pt(r)&&t.getScaleComponent(r);if(o){dr(o.get("type"))&&"count"!==n.aggregate&&!Rr(i)&&(e[n.field]=n)}return e}),{});return E(o).length?new km(e,o):null}dependentFields(){return new Set(E(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${h(this.filter)}`}assemble(){const e=E(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=Yo(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 Cm extends cl{clone(){return new Cm(this.parent,d(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=d(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}))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${h(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Sm extends cl{clone(){return new Sm(null,d(this.transform))}constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=d(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"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${h(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Em extends cl{clone(){return new Em(null,d(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[[le,ue],[fe,ce]]){const r=i.map((e=>{const n=ra(t.encoding[e]);return No(n)?n.field:Mo(n)?{expr:`${n.datum}`}:Wo(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new Em(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(ge)){const i=t.typedFieldDef(ge);i.type===Ri&&(e=new Em(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){var e;const n=(null!==(e=this.fields)&&void 0!==e?e:[]).filter(t.isString);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${h(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Bm extends cl{clone(){return new Bm(null,this.projection,d(this.fields),d(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[le,ue],[fe,ce]]){const i=n.map((e=>{const n=ra(t.encoding[e]);return No(n)?n.field:Mo(n)?{expr:`${n.datum}`}:Wo(n)?{expr:`${n.value}`}:void 0})),r=n[0]===fe?"2":"";(i[0]||i[1])&&(e=new Bm(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${h(this.fields)} ${h(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class _m extends cl{clone(){return new _m(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}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 _m(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(No(i)&&No(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:u,frame:l,keyvals:c}=o.impute,f=Ba(t.mark,n);return new _m(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==u?{value:u}:{},...l?{frame:l}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${h(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={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[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class zm extends cl{clone(){return new zm(null,d(this.transform))}constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=d(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]}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 ${h(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class Om extends cl{clone(){return new Om(null,d(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return"data"in e}(o)){let e=Ym(o.data,r);e||(e=new hp(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new fl(e,n,Yu.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(O(e),e)}catch(t){throw new Error(function(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}(e))}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new Om(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?t.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${h({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:t.array(this.transform.as)}:{}};else{let n=this.transform.as;t.isString(n)||(ui('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.'),n="_lookup"),e={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class Pm extends cl{clone(){return new Pm(null,d(this.transform))}constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=d(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"]}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 ${h(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class Nm extends cl{clone(){return new Nm(null,d(this.transform))}constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=d(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]}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 ${h(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class jm extends cl{clone(){return new jm(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){var t;this.transform.groupby=D((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 ${h(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class Mm extends cl{clone(){return new Mm(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${h(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Tm(e){let t=0;return function n(i,r){if(i instanceof hp&&!i.isGenerator&&!Ru(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}var o;if(i instanceof dp&&(i.parent instanceof hp&&!r.source?(r.format={...null!==(o=r.format)&&void 0!==o?o:{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof up)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());if((i instanceof mp||i instanceof gp||i instanceof km||i instanceof Vf||i instanceof ud||i instanceof Bm||i instanceof sp||i instanceof Om||i instanceof Np||i instanceof Op||i instanceof Sm||i instanceof Cm||i instanceof $m||i instanceof zm||i instanceof Pm||i instanceof Nm||i instanceof pp||i instanceof Mm||i instanceof jm)&&r.transform.push(i.assemble()),(i instanceof op||i instanceof dl||i instanceof _m||i instanceof Pp||i instanceof Em)&&r.transform.push(...i.assemble()),i instanceof fl)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof fl)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 fl&&(!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 Lm(e){return"top"===e||"left"===e||an(e)?"header":"footer"}function qm(e,n){const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(n)){var s;const u=i[n],l=fd("title",null,r,n);let c=Zo(u,r,{allowDisabling:!0,includeDefault:void 0===l||!!l});o.component.layoutHeaders[n].title&&(c=t.isArray(c)?c.join(", "):c,c+=` / ${o.component.layoutHeaders[n].title}`,o.component.layoutHeaders[n].title=null);const f=fd("labelOrient",u.header,r,n),d=null!==u.header&&H(null===(s=u.header)||void 0===s?void 0:s.labels,r.header.labels,!0),p=y(["bottom","right"],f)?"footer":"header";a.layoutHeaders[n]={title:null!==u.header?c:null,facetFieldDef:u,[p]:"facet"===n?[]:[Rm(e,n,d)]}}}function Rm(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 Wm(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=zd(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){var i;const t=Lm(r.get("orient"));null!==(i=a[t])&&void 0!==i||(a[t]=[Rm(e,o,!1)]);const n=Qf(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}}function Um(e){for(const t of e.children)t.parseLayoutSize()}function Hm(e,t){const n=Ed(t),i=wt(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){var s;const o=t.component.layoutSize.getWithExplicit(n),u=null!==(s=r.scale[i])&&void 0!==s?s:_d(i,e);if("independent"===u&&"step"===o.value){a=void 0;break}if(a){if("independent"===u&&a.value!==o.value){a=void 0;break}a=Lu(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function Im(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(fr(e)){const e=Ds(i.view,t);return sn(n)||ys(e)?"step":e}return ws(i.view,t)}if(e.hasProjection||"arc"===e.mark)return ws(i.view,t);{const e=Ds(i.view,t);return ys(e)?e.step:e}}function Vm(e,t,n){return Yo(t,{suffix:`by_${Yo(e)}`,...null!=n?n:{}})}class Gm extends Fm{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),Sn(this,"facet",void 0),Sn(this,"child",void 0),Sn(this,"children",void 0),this.child=bg(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!Fo(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=E(e),n={};for(const i of t){if(![Q,K].includes(i)){ui(Gn(i,"facet"));break}const t=e[i];if(void 0===t.field){ui(Vn(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=sa(e,t);return n.header?n.header=nn(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=Xm(this),this.child.parseData()}parseLayoutSize(){Um(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 Te)qm(e,t);Wm(e,"x"),Wm(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const r of Te)for(const o of md){const a=this.component.layoutHeaders[r],s=a[o],{facetFieldDef:u}=a;if(u){const n=fd("titleOrient",u.header,this.config,r);if(["right","bottom"].includes(n)){var t;const i=cd(r,n);null!==(t=e.titleAnchor)&&void 0!==t||(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null!=s&&s[0]){const t="row"===r?"height":"width",s="header"===o?"headerBand":"footerBand";var n,i;if("facet"!==r&&!this.child.component.layoutSize.get(t))null!==(n=e[s])&&void 0!==n||(e[s]={}),e[s][r]=.5;if(a.title)null!==(i=e.offset)&&void 0!==i||(e.offset={}),e.offset["row"===r?"rowTitle":"columnTitle"]=10}}return e}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"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Gm)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof Gm?{...this.channelHasField("column")?{encode:{update:{columns:{field:Yo(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof Gm){if(this.child.channelHasField("column")){const i=Yo(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of vt){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(fr(o)&&sn(a)){const r=Kp(Zp(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):ui(jn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,{fields:o,ops:a,as:s}=this.getCardinalityAggregateForChild(),u=[];for(const e of Te){const n=this.facet[e];if(n){u.push(Yo(n));const{bin:l,sort:c}=n;if(Jt(l)&&u.push(Yo(n,{binSuffix:"end"})),Ao(c)){const{field:e,op:t=yo}=c,u=Vm(n,c);i&&r?(o.push(u),a.push("max"),s.push(u)):(o.push(e),a.push(t),s.push(u))}else if(t.isArray(c)){const t=ld(n,e);o.push(t),a.push("max"),s.push(t)}}}const l=!!i&&!!r;return{name:e,data:n,groupby:u,...l||o.length>0?{aggregate:{...l?{cross:l}:{},...o.length?{fields:o,ops:a,as:s}:{}}}:{}}}facetSortFields(e){const{facet:n}=this,i=n[e];return i?Ao(i.sort)?[Vm(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[ld(i,e,{expr:"datum"})]:[Yo(i,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(Ao(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return xd(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const r of pd)if(e[r]){var i;const o=fd("labelOrient",null===(i=e[r])||void 0===i?void 0:i.header,t,r);if(n[r].includes(o))return xd(e[r],r,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Tm(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[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:Te.map((e=>this.facetSortFields(e))).flat(),order:Te.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(sl(this,[]))}]}getMapping(){return this.facet}}function Ym(e,t){for(const a of t){var n,i,r,o;const t=a.data;if(e.name&&a.hasName()&&e.name!==a.dataName)continue;const s=null===(n=e.format)||void 0===n?void 0:n.mesh,u=null===(i=t.format)||void 0===i?void 0:i.feature;if(s&&u)continue;const l=null===(r=e.format)||void 0===r?void 0:r.feature;if((l||u)&&l!==u)continue;const c=null===(o=t.format)||void 0===o?void 0:o.mesh;if(!s&&!c||s===c)if(Wu(e)&&Wu(t)){if(f(e.values,t.values))return a}else if(Ru(e)&&Ru(t)){if(e.url===t.url)return a}else if(Uu(e)&&e.name===a.dataName)return a}return null}function Xm(e){var t,n,i;let r=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new hp({values:[]});return t.push(e),e}const n=Ym(e.data,t);if(n)return Hu(e.data)||(n.data.format=w({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new hp(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:o,outputNodeRefCounts:a}=e.component.data,s=e.parent?e.parent.component.data.ancestorParse.clone():new qu,u=e.data;Hu(u)?(Iu(u)?r=new gp(r,u.sequence):Gu(u)&&(r=new mp(r,u.graticule)),s.parseNothing=!0):null===(null==u||null===(t=u.format)||void 0===t?void 0:t.parse)&&(s.parseNothing=!0),r=null!==(n=dp.makeExplicit(r,e,s))&&void 0!==n?n:r,r=new pp(r);const l=e.parent&&Am(e.parent);var c;(bm(e)||xm(e))&&(l&&(r=null!==(c=op.makeFromEncoding(r,e))&&void 0!==c?c:r));e.transforms.length>0&&(r=function(e,t,n){let i=0;for(const a of t.transforms){let s,u;if(hu(a))u=e=new ud(e,a),s="derived";else if(ou(a)){var r;const i=cp(a);u=e=null!==(r=dp.makeWithAncestors(e,{},i,n))&&void 0!==r?r:e,e=new Vf(e,t,a.filter)}else if(vu(a))u=e=op.makeFromTransform(e,a,t),s="number";else if(bu(a))s="date",void 0===n.getWithExplicit(a.field).value&&(e=new dp(e,{[a.field]:s}),n.set(a.field,s,!1)),u=e=dl.makeFromTransform(e,a);else if(xu(a))u=e=sp.makeFromTransform(e,a),s="number",Ac(t)&&(e=new pp(e));else if(au(a))u=e=Om.make(e,t,a,i++),s="derived";else if(pu(a))u=e=new Np(e,a),s="number";else if(mu(a))u=e=new Op(e,a),s="number";else if(wu(a))u=e=Pp.makeFromTransform(e,a),s="derived";else if(Au(a))u=e=new Sm(e,a),s="derived";else if(gu(a))u=e=new Cm(e,a),s="derived";else if(su(a))u=e=new jm(e,a),s="derived";else if(du(a))e=new Mm(e,a);else if(yu(a))u=e=_m.makeFromTransform(e,a),s="derived";else if(uu(a))u=e=new $m(e,a),s="derived";else if(lu(a))u=e=new Pm(e,a),s="derived";else if(cu(a))u=e=new Nm(e,a),s="derived";else{if(!fu(a)){ui(`Ignoring an invalid transform: ${g(a)}.`);continue}u=e=new zm(e,a),s="derived"}if(u&&void 0!==s)for(const e of null!==(o=u.producedFields())&&void 0!==o?o:[]){var o;n.set(e,s,!1)}}return e}(r,e,s));const f=function(e){const t={};if(bm(e)&&e.component.selection)for(const n of E(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&U(e.field)>1&&(t[e.field]="flatten")}return t}(e),d=fp(e);if(r=null!==(i=dp.makeWithAncestors(r,{},{...f,...d},s))&&void 0!==i?i:r,bm(e)&&(r=Em.parseAll(r,e),r=Bm.parseAll(r,e)),bm(e)||xm(e)){var p,m;if(!l)r=null!==(m=op.makeFromEncoding(r,e))&&void 0!==m?m:r;r=null!==(p=dl.makeFromEncoding(r,e))&&void 0!==p?p:r,r=ud.parseAllForSortIndex(r,e)}const h=e.getDataName(Yu.Raw),v=new fl(r,h,Yu.Raw,a);if(o[h]=v,r=v,bm(e)){var y,b;const t=sp.makeFromEncoding(r,e);t&&(r=t,Ac(e)&&(r=new pp(r))),r=null!==(y=_m.makeFromEncoding(r,e))&&void 0!==y?y:r,r=null!==(b=Pp.makeFromEncoding(r,e))&&void 0!==b?b:r}var x;bm(e)&&(r=null!==(x=km.make(r,e))&&void 0!==x?x:r);const A=e.getDataName(Yu.Main),D=new fl(r,A,Yu.Main,a);o[A]=D,r=D,bm(e)&&function(e,t){for(const[i,r]of _(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;const o=e.getName(`lookup_${i}`);e.component.data.outputNodes[o]=r.materialized=new fl(new Vf(t,e,{param:i}),o,Yu.Lookup,e.component.data.outputNodeRefCounts)}}(e,D);let F=null;if(xm(e)){var $;const t=e.getName("facet");r=null!==($=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Ao(r.sort)){const{field:n,op:i=yo}=r.sort;e=t=new Op(e,{joinaggregate:[{op:i,field:n,as:Vm(r,r.sort,{forAs:!0})}],groupby:[Yo(r)]})}return t}return null}(r,e.facet))&&void 0!==$?$:r,F=new up(r,e,t,D.getSource()),o[t]=F}return{...e.component.data,outputNodes:o,outputNodeRefCounts:a,raw:v,main:D,facetRoot:F,ancestorParse:s}}class Jm extends Dm{constructor(e,t,n,i){var r,o,a,s;super(e,"concat",t,n,i,e.resolve),Sn(this,"children",void 0),"shared"!==(null===(r=e.resolve)||void 0===r||null===(o=r.axis)||void 0===o?void 0:o.x)&&"shared"!==(null===(a=e.resolve)||void 0===a||null===(s=a.axis)||void 0===s?void 0:s.y)||ui("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)=>bg(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=Xm(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 E(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 ms(e)?e.vconcat:gs(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Um(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";Hm(e,t),Hm(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=$d(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{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{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const Qm={disable:1,gridScale:1,scale:1,...ya,labelExpr:1,encode:1},Km=E(Qm);class Zm extends Pu{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new Zm(d(this.explicit),d(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 an(this.explicit.orient)}}const eg={bottom:"top",top:"bottom",left:"right",right:"left"};function tg(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{switch(n){case"title":return Cn(e,t);case"gridScale":return{explicit:e.explicit,value:H(e.value,t.value)}}return Tu(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function ig(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(an(n.labelAngle)?n.labelAngle:X(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===sd(i,r))return!0}return e===n[t]}const rg=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function og(e,t){var n,i,r,o,a;let s=t.axis(e);const u=new Zm,l=ra(t.encoding[e]),{mark:c,config:f}=t,d=(null===(n=s)||void 0===n?void 0:n.orient)||(null===(i=f["x"===e?"axisX":"axisY"])||void 0===i?void 0:i.orient)||(null===(r=f.axis)||void 0===r?void 0:r.orient)||function(e){return"x"===e?"bottom":"left"}(e),p=t.getScaleComponent(e).get("type"),m=ed(e,p,d,t.config),g=void 0!==s?!s:nd("disable",f.style,null===(o=s)||void 0===o?void 0:o.style,m).configValue;if(u.set("disable",g,void 0!==s),g)return u;s=s||{};const h=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return an(o)?o:X(o);{const{configValue:o}=nd("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?X(o):n!==ee||!y([qi,Ti],e.type)||No(e)&&e.timeUnit?void 0:270}}(l,s,e,f.style,m),v={fieldOrDatumDef:l,axis:s,channel:e,model:t,scaleType:p,orient:d,labelAngle:h,mark:c,config:f};for(const n of Km){const i=n in id?id[n](v):xa(n)?s[n]:void 0,r=void 0!==i,o=ig(i,n,s,t,e);if(r&&o)u.set(n,i,o);else{const{configValue:e,configFrom:t}=xa(n)&&"values"!==n?nd(n,f.style,s.style,m):{},a=void 0!==e;r&&!a?u.set(n,i,o):("vgAxisConfig"!==t||rg.has(n)&&a||ga(e)||an(e))&&u.set(n,e,!1)}}const b=null!==(a=s.encoding)&&void 0!==a?a:{},x=ha.reduce(((n,i)=>{var r;if(!u.hasAxisPart(i))return n;const o=Bd(null!==(r=b[i])&&void 0!==r?r:{},t),a="labels"===i?function(e,t,n){var i;const{encoding:r,config:o}=e,a=null!==(i=ra(r[t]))&&void 0!==i?i:ra(r[et(t)]),s=e.axis(t)||{},{format:u,formatType:l}=s;return ao(l)?{text:co({fieldOrDatumDef:a,field:"datum.value",format:u,formatType:l,config:o}),...n}:n}(t,e,o):o;return void 0===a||S(a)||(n[i]={update:a}),n}),{});return S(x)||u.set("encode",x,!!s.encoding||void 0!==s.labelAngle),u}function ag(e,t,n){const i=nn(e),r=xn("orient",i,n);if(i.orient=function(e,t,n){switch(e){case zr:case Tr:case Lr:case Nr:case Or:case Br:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case Er:if(No(i)&&(Qt(i.bin)||No(r)&&r.aggregate&&!i.aggregate))return"vertical";if(No(r)&&(Qt(r.bin)||No(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o&&(No(i)&&i.type===Mi&&!Jt(i.bin)||Lo(i)))return"horizontal";if(!a&&(No(r)&&r.type===Mi&&!Jt(r.bin)||Lo(r)))return"vertical"}case Pr:if(o&&(!No(i)||!Qt(i.bin))&&a&&(!No(r)||!Qt(r.bin)))return;case Sr:if(a)return No(r)&&Qt(r.bin)?"horizontal":"vertical";if(o)return No(i)&&Qt(i.bin)?"vertical":"horizontal";if(e===Pr){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case _r:case jr:{const t=To(i),o=To(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=i,n=r,o=t.type===Li,a=n.type===Li;return o&&!a?"tick"!==e?"vertical":"horizontal":!o&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&n.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!n.aggregate&&"tick"!==e?"horizontal":"vertical"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&ui(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=xn("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:Xr[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}void 0===xn("opacity",i,n)&&(i.opacity=function(e,t){if(y([zr,jr,Tr,Lr],e)&&!$a(t))return.7;return}(i.type,t));return void 0===xn("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||xn("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function sg(e,t){const{config:n}=e;return{...Jl(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Ml("x",e,{defaultPos:"mid"}),...Ml("y",e,{defaultPos:"mid"}),...Ol("size",e),...Ol("angle",e),...ug(e,n,t)}}function ug(e,t,n){return n?{shape:{value:n}}:Ol("shape",e)}function lg(e,t,n){if(void 0===xn("align",e,n))return"center"}function cg(e,t,n){if(void 0===xn("baseline",e,n))return"middle"}function fg(e){var n;const{config:i,markDef:r}=e,{orient:o}=r,a="horizontal"===o?"width":"height",s=e.getScaleComponent("horizontal"===o?"x":"y"),u=null!==(n=xn("size",r,i,{vgChannel:a}))&&void 0!==n?n:i.tick.bandSize;if(void 0!==u)return u;{const e=s?s.get("range"):void 0;if(e&&sn(e)&&t.isNumber(e.step))return 3*e.step/4;return 3*As(i.view,a)/4}}const dg={arc:{vgMark:"arc",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Ml("x",e,{defaultPos:"mid"}),...Ml("y",e,{defaultPos:"mid"}),...Il(e,"radius","arc"),...Il(e,"theta","arc")})},area:{vgMark:"area",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Wl("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...Wl("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...Zl(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Il(e,"x","bar"),...Il(e,"y","bar")})},circle:{vgMark:"symbol",encodeEntry:e=>sg(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&No(n)&&n.type===Ri?{field:Yo(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Il(e,"x","image"),...Il(e,"y","image"),...$l(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Ml("x",e,{defaultPos:"mid"}),...Ml("y",e,{defaultPos:"mid"}),...Ol("size",e,{vgChannel:"strokeWidth"}),...Zl(e)})},point:{vgMark:"symbol",encodeEntry:e=>sg(e)},rect:{vgMark:"rect",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Il(e,"x","rect"),...Il(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?{...Jl(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Wl("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...Wl("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Ol("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>sg(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Jl(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Ml("x",e,{defaultPos:"mid"}),...Ml("y",e,{defaultPos:"mid"}),...$l(e),...Ol("size",e,{vgChannel:"fontSize"}),...Ol("angle",e),...ec("align",lg(e.markDef,n,t)),...ec("baseline",cg(e.markDef,n,t)),...Ml("radius",e,{defaultPos:null}),...Ml("theta",e,{defaultPos:null})}}},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{...Jl(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ml("x",e,{defaultPos:"mid",vgChannel:"xc"}),...Ml("y",e,{defaultPos:"mid",vgChannel:"yc"}),...Ol("size",e,{defaultValue:fg(e),vgChannel:r}),[o]:gn(xn("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...Jl(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Ml("x",e,{defaultPos:"mid"}),...Ml("y",e,{defaultPos:"mid"}),...Ol("size",e),...Zl(e)})}};function pg(e){if(y([_r,Sr,Mr],e.mark)){const t=Ba(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:mg+e.requestDataName(Yu.Main),data:e.requestDataName(Yu.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:hg(e,{fromPrefix:mg})}]}(e,t)}else if(e.mark===Er){const t=fn.some((t=>xn(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=hg(e,{fromPrefix:gg}),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,a;"x"===e.stack.fieldChannel?(o={...p(t.encode.update,["y","yc","y2","height",...fn]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...m(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...p(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...m(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of fn){const i=wn(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=gn(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannel){const t=e.fieldDef(e.stack.groupbyChannel),n=Yo(t);n&&s.push(n),(null!=t&&t.bin||null!=t&&t.timeUnit)&&s.push(Yo(t,{binSuffix:"end"}))}o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=wn(i,e.markDef,e.config);return void 0!==t?{...n,[i]:gn(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(Yu.Main),name:gg+e.requestDataName(Yu.Main),groupby:s,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:a},marks:[t]}]}]}(e)}return hg(e)}const mg="faceted_path_";const gg="stack_group_";function hg(e,n={fromPrefix:""}){const{mark:i,markDef:r,encoding:o,config:a}=e,s=H(r.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)),u=bn(r),l=o.key,c=function(e){const{encoding:n,stack:i,mark:r,markDef:o,config:a}=e,s=n.order;if(!(!t.isArray(s)&&Wo(s)&&v(s.value)||!s&&v(xn("order",o,a)))){if((t.isArray(s)||No(s))&&!i)return Fn(s,{expr:"datum"});if(Rr(r)){const i="horizontal"===o.orient?"y":"x",r=n[i];if(No(r)){const n=r.sort;return t.isArray(n)?{field:Yo(r,{prefix:i,suffix:"sort_index",expr:"datum"})}:Ao(n)?{field:Yo({aggregate:$a(e.encoding)?n.op:void 0,field:n.field},{expr:"datum"})}:wo(n)?{field:Yo(e.fieldDef(n.encoding),{expr:"datum"}),order:n.order}:null===n?void 0:{field:Yo(r,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}}}(e),f=function(e){if(!e.component.selection)return null;const t=E(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=E(i.component.selection).length,i=i.parent;return n?{interactive:t>0||!!e.encoding.tooltip}:null}(e),d=xn("aria",r,a),p=dg[i].postEncodingTransform?dg[i].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:dg[i].vgMark,...s?{clip:!0}:{},...u?{style:u}:{},...l?{key:l.field}:{},...c?{sort:c}:{},...f||{},...!1===d?{aria:d}:{},from:{data:n.fromPrefix+e.requestDataName(Yu.Main)},encode:{update:dg[i].encodeEntry(e)},...p?{transform:p}:{}}]}class vg extends Fm{constructor(e,t,n,i={},r){var o;super(e,"unit",t,n,r,void 0,bs(e)?e.view:void 0),Sn(this,"markDef",void 0),Sn(this,"encoding",void 0),Sn(this,"specifiedScales",{}),Sn(this,"stack",void 0),Sn(this,"specifiedAxes",{}),Sn(this,"specifiedLegends",{}),Sn(this,"specifiedProjection",{}),Sn(this,"selection",[]),Sn(this,"children",[]);const a=Hr(e.mark)?{...e.mark}:{type:e.mark},s=a.type;void 0===a.filled&&(a.filled=function(e,t,{graticule:n}){if(n)return!1;const i=wn("filled",e,t),r=e.type;return H(i,r!==zr&&r!==_r&&r!==Pr)}(a,r,{graticule:e.data&&Gu(e.data)}));const u=this.encoding=Ca(e.encoding||{},s,a.filled,r);this.markDef=ag(a,u,r),this.size=function({encoding:e,size:t}){for(const n of vt){const i=tt(n);ys(t[i])&&To(e[n])&&(delete t[i],ui(ti(i)))}return t}({encoding:u,size:bs(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=Us(s,u),this.specifiedScales=this.initScales(s,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=e.projection,this.selection=(null!==(o=e.params)&&void 0!==o?o:[]).filter((e=>fs(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===qr,n=e&&Pe.some((t=>qo(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 Ot.reduce(((e,n)=>{const i=ra(t[n]);var r;i&&(e[n]=this.initScale(null!==(r=i.scale)&&void 0!==r?r:{}));return e}),{})}initScale(e){const{domain:n,range:i}=e,r=nn(e);return t.isArray(n)&&(r.domain=n.map(pn)),t.isArray(i)&&(r.range=i.map(pn)),r}initAxes(e){return vt.reduce(((t,n)=>{const i=e[n];if(qo(i)||n===ee&&qo(e.x2)||n===te&&qo(e.y2)){const e=qo(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=E(e),n={};for(const i of t){const t=e[i];n[i]=ga(t)?dn(t):pn(t)}return n}initLegends(e){return _t.reduce(((t,n)=>{const i=ra(e[n]);if(i&&function(e){switch(e){case de:case pe:case me:case he:case ge:case ye:case we:case Ae:return!0;case be:case xe:case ve:return!1}}(n)){const e=i.legend;t[n]=e?nn(e):e}return t}),{})}parseData(){this.component.data=Xm(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of vt){const r=tt(i);if(t[r]){const e=t[r];n.layoutSize.set(r,ys(e)?"step":e,!0)}else{const t=Im(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,n){const i={},r=e.config.selection;if(!n||!n.length)return i;for(const a of n){const n=O(a.name),s=a.select,u=t.isString(s)?s:s.type,l=t.isObject(s)?d(s):{type:u},{fields:c,encodings:f,...p}=r[u];for(const e in p){var o;"mark"===e&&(l[e]={...p[e],...l[e]}),(void 0===l[e]||!0===l[e])&&(l[e]=null!==(o=p[e])&&void 0!==o?o:l[e])}const m=i[n]={...l,name:n,type:u,init:a.value,bind:a.bind,events:t.isString(l.on)?tl(l.on,"scope"):t.array(d(l.on))};for(const t of xc)t.defined(m)&&t.parse&&t.parse(e,m,a)}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=pg(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,vt.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[og(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const o of B(null!==(r=e.component.selection)&&void 0!==r?r:{})){var r;const a=o.name,s=t.stringValue(a+hc);if(0===n.filter((e=>e.name===a)).length){const e="global"===o.resolve?"union":o.resolve,i="point"===o.type?", true, true)":")";n.push({name:o.name,update:`${bc}(${s}, ${t.stringValue(e)}${i}`})}i=!0;for(const t of xc)t.defined(o)&&t.topLevelSignals&&(n=t.topLevelSignals(e,o,n))}i&&0===n.filter((e=>"unit"===e.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]});return ll(n)}(this,e)}assembleSignals(){return[...Kf(this),...al(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t];for(const t of B(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const r={name:t.name+hc};if(t.init){const n=t.project.items.map((e=>{const{signals:t,...n}=e;return n}));r.values=t.init.map((t=>({unit:wc(e,{escape:!1}),fields:n,values:ol(t,!1)})))}n.filter((e=>e.name===t.name+hc)).length||n.push(r)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return $d(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&Am(this.parent)||(t=ul(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Fa(this.encoding,e)}fieldDef(e){return ia(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return Ro(t)?t:null}}class yg extends Dm{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view),Sn(this,"children",void 0);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Ms(e))return new yg(e,this,this.getName(`layer_${t}`),o,r);if(Aa(e))return new vg(e,this,this.getName(`layer_${t}`),o,r);throw new Error(_n(e))}))}parseData(){this.component.data=Xm(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;Um(e=this),Hm(e,"width"),Hm(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of E(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of E(i.component.axes))n.axis[r]=zd(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=tg(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const o of vt){for(const a of e.children)if(a.component.axes[o]){if("independent"===n.axis[o]){var r;t[o]=(null!==(r=t[o])&&void 0!==r?r:[]).concat(a.component.axes[o]);for(const e of a.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!an(t)){if(i[t]>0&&!n){const n=eg[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete a.component.axes[o]}if("independent"===n.axis[o]&&t[o]&&t[o].length>1)for(const e of t[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())),Kf(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),$d(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)bm(n)&&(t=ul(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),Xd(this))}}function bg(e,t,n,i,r){if(ko(e))return new Gm(e,t,n,r);if(Ms(e))return new yg(e,t,n,i,r);if(Aa(e))return new vg(e,t,n,i,r);if(function(e){return ms(e)||gs(e)||ps(e)}(e))return new Jm(e,t,n,r);throw new Error(_n(e))}const xg=i;e.accessPathDepth=U,e.accessPathWithDatum=M,e.compile=function(e,n={}){var i;n.logger&&(i=n.logger,si=i),n.fieldTitle&&Ko(n.fieldTitle);try{const i=_s(t.mergeConfig(n.config,e.config)),r=Eu(e,i),o=bg(r,null,"",void 0,i);o.parse(),function(e,t){Lp(e.sources);let n=0,i=0;for(let i=0;i<5&&Rp(e,t,!0);i++)n++;e.sources.map(jp);for(let n=0;n<5&&Rp(e,t,!1);n++)i++;Lp(e.sources),5===Math.max(n,i)&&ui("Maximum optimization runs(5) reached.")}(o.component.data,o);return{spec:function(e,t,n={},i){const r=e.config?Ns(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){const n=[],i=Tm(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries()){var a;0!==(null!==(a=t.transform)&&void 0!==a?a:[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0])}for(const t of n)for(const n of null!==(s=t.transform)&&void 0!==s?s:[]){var s;"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource())}for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),u=e.assembleGroupStyle(),l=e.assembleGroupEncodeEntry(!0);let c=e.assembleLayoutSignals();c=c.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...u?{style:u}:{},...l?{encode:{update:l}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...c,...e.assembleSelectionTopLevelSignals([]),...ds(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(o,function(e,n,i,r){const o=r.component.layoutSize.get("width"),a=r.component.layoutSize.get("height");void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):t.isString(n)&&(n={type:n});if(o&&a&&(s=n.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===o&&"step"===a)ui(Nn()),n.type="pad";else if("step"===o||"step"===a){const e="step"===o?"width":"height";ui(Nn(wt(e)));const t="width"===e?"height":"width";n.type=function(e){return e?`fit-${wt(e)}`:"fit"}(t)}var s;return{...1===E(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...vs(i,!1),...vs(e,!0)}}(e,r.autosize,i,o),e.datasets,e.usermeta),normalized:r}}finally{n.logger&&(si=ai),n.fieldTitle&&Ko(Jo)}},e.contains=y,e.deepEqual=f,e.deleteNestedProperty=N,e.duplicate=d,e.entries=_,e.every=x,e.fieldIntersection=C,e.flatAccessWithDatum=T,e.getFirstDefined=H,e.hasIntersection=$,e.hash=h,e.internalField=G,e.isBoolean=z,e.isEmpty=S,e.isEqual=function(e,t){const n=E(e),i=E(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=Y,e.isNullOrFalse=v,e.isNumeric=J,e.keys=E,e.logicalExpr=P,e.mergeDeep=w,e.normalize=Eu,e.normalizeAngle=X,e.omit=m,e.pick=p,e.prefixGenerator=k,e.removePathFromField=W,e.replaceAll=R,e.replacePathInField=q,e.resetIdCounter=function(){I=42},e.setEqual=F,e.some=b,e.stringify=g,e.titleCase=j,e.unique=D,e.uniqueId=V,e.vals=B,e.varName=O,e.version=xg,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=vega-lite.min.js.map