[email protected] Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbase-server Show documentation
Show all versions of hbase-server Show documentation
Server functionality for HBase
!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.0.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,c,u,l){"object"==typeof s&&(c=s.depth,u=s.prototype,l=s.includeNonEnumerable,s=s.circular);var f=[],d=[],p="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===c&&(c=1/0),function o(c,m){if(null===c)return null;if(0===m)return c;var g,h;if("object"!=typeof c)return c;if(e(c,t))g=new t;else if(e(c,n))g=new n;else if(e(c,i))g=new i((function(e,t){c.then((function(t){e(o(t,m-1))}),(function(e){t(o(e,m-1))}))}));else if(r.__isArray(c))g=[];else if(r.__isRegExp(c))g=new RegExp(c.source,a(c)),c.lastIndex&&(g.lastIndex=c.lastIndex);else if(r.__isDate(c))g=new Date(c.getTime());else{if(p&&Buffer.isBuffer(c))return g=Buffer.allocUnsafe?Buffer.allocUnsafe(c.length):new Buffer(c.length),c.copy(g),g;e(c,Error)?g=Object.create(c):void 0===u?(h=Object.getPrototypeOf(c),g=Object.create(h)):(g=Object.create(u),h=u)}if(s){var v=f.indexOf(c);if(-1!=v)return d[v];f.push(c),d.push(g)}for(var y in e(c,t)&&c.forEach((function(e,t){var n=o(t,m-1),i=o(e,m-1);g.set(n,i)})),e(c,n)&&c.forEach((function(e){var t=o(e,m-1);g.add(t)})),c){var b;h&&(b=Object.getOwnPropertyDescriptor(h,y)),b&&null==b.set||(g[y]=o(c[y],m-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(c);for(y=0;yl(e,t)))}:a(e)?{or:e.or.map((e=>l(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(".concat([...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:"[".concat(e,"]"))),r=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of r)n.add(e)}return n}function S(e,t){return void 0===e||void 0===t||k(C(e),C(t))}function E(e){return 0===B(e).length}const B=Object.keys,_=Object.values,z=Object.entries;function O(e){return!0===e||!1===e}function P(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function N(e,t){return c(e)?"!(".concat(N(e.not,t),")"):s(e)?"(".concat(e.and.map((e=>N(e,t))).join(") && ("),")"):a(e)?"(".concat(e.or.map((e=>N(e,t))).join(") || ("),")"):t(e)}function j(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&j(e[n],t)&&delete e[n],E(e)}function M(e){return e.charAt(0).toUpperCase()+e.substr(1)}function T(e,n="datum"){const i=t.splitAccessPath(e),r=[];for(let e=1;e<=i.length;e++){const o="[".concat(i.slice(0,e).map(t.stringValue).join("]["),"]");r.push("".concat(n).concat(o))}return r.join(" && ")}function L(e,n="datum"){return"".concat(n,"[").concat(t.stringValue(t.splitAccessPath(e).join(".")),"]")}function q(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function R(e){return"".concat(t.splitAccessPath(e).map(q).join("\\."))}function W(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function U(e){return"".concat(t.splitAccessPath(e).join("."))}function H(e){return e?t.splitAccessPath(e).length:0}function I(...e){for(const t of e)if(void 0!==t)return t}let V=42;function G(e){const t=++V;return e?String(e)+t:t}function Y(e){return X(e)?e:"__".concat(e)}function X(e){return e.startsWith("__")}function J(e){if(void 0!==e)return(e%360+360)%360}function Q(e){return!!t.isNumber(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const $="row",K="column",Z="facet",ee="x",te="y",ne="x2",ie="y2",re="radius",oe="radius2",ae="theta",se="theta2",ce="latitude",ue="longitude",le="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",ke="detail",Ce="key",Se="tooltip",Ee="href",Be="url",_e="description",ze={theta:1,theta2:1,radius:1,radius2:1};function Oe(e){return e in ze}const Pe={longitude:1,longitude2:1,latitude:1,latitude2:1};const Ne=B(Pe),je={x:1,y:1,x2:1,y2:1,...ze,...Pe,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 Me(e){return e===de||e===pe||e===me}const Te={row:1,column:1,facet:1},Le=B(Te),qe={...je,...Te},Re=B(qe),{order:We,detail:Ue,tooltip:He,...Ie}=qe,{row:Ve,column:Ge,facet:Ye,...Xe}=Ie;function Je(e){return!!qe[e]}const Qe=[ne,ie,le,fe,se,oe];function $e(e){return Ke(e)!==e}function Ke(e){switch(e){case ne:return ee;case ie:return te;case le:return ce;case fe:return ue;case se:return ae;case oe:return re}return e}function Ze(e){if(Oe(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 ce:return le;case ue: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:ct,longitude2:ut,theta:lt,theta2:ft,radius:dt,radius2:pt,...mt}=je,gt=B(mt),ht={x:1,y:1},vt=B(ht);function yt(e){return e in ht}const bt={theta:1,radius:1},xt=B(bt);function wt(e){return"width"===e?ee:te}const{text:At,tooltip:Dt,href:Ft,url:kt,description:Ct,detail:St,key:Et,order:Bt,..._t}=mt,zt=B(_t);const Ot={...ht,...bt,..._t},Pt=B(Ot);function Nt(e){return!!Ot[e]}function jt(e,t){return function(e){switch(e){case de:case pe:case me:case _e:case ke:case Ce:case Se:case Ee:case Fe:case ye:case be:case xe:case we:case Z:case $:case K:return Mt;case ee:case te:case ce:case ue:return Lt;case ne:case ie:case le: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 Be:return{image:"always"};case ae:case re:return{text:"always",arc:"always"};case se:case oe:return{arc:"always"}}}(e)[t]}const Mt={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:Tt,...Lt}=Mt;function qt(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 $:case K:case ge:case Ae:case De:case Se:case Ee:case Be:case _e:return"discrete";case de:case pe:case me:return"flexible";case ce:case ue:case le:case fe:case ke:case Ce:case Fe:return}}const Rt={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},Wt={count:1,min:1,max:1};function Ut(e){return!!e&&!!e.argmin}function Ht(e){return!!e&&!!e.argmax}function It(e){return t.isString(e)&&!!Rt[e]}const Vt=["count","valid","missing","distinct"];function Gt(e){return t.isString(e)&&y(Vt,e)}const Yt=["count","sum","distinct","valid","missing"],Xt=t.toSet(["mean","average","median","q1","q3","min","max"]);function Jt(e){return t.isBoolean(e)&&(e=sa(e,void 0)),"bin"+B(e).map((t=>Zt(e[t])?P("_".concat(t,"_").concat(z(e[t]))):P("_".concat(t,"_").concat(e[t])))).join("")}function Qt(e){return!0===e||Kt(e)&&!e.binned}function $t(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 $: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=B(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:c,subtitleFontStyle:u,subtitleFontWeight:l,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}:{},...c?{subtitleFontSize:c}:{},...u?{subtitleFontStyle:u}:{},...l?{subtitleFontWeight:l}:{},...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 cn(e){return!t.isArray(e)&&("field"in e&&"data"in e)}const un=B({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}),ln={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 I(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 kn(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(f(t,e))return;n.push(e)})),n}function Cn(e,n){return f(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function Sn(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:Cn(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:kn(n,i)};throw new Error("It should never reach here")}function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bn(e,t,n){var i=t.get(e);if(!i)throw new TypeError("attempted to set private field on non-instance");if(i.set)i.set.call(e,n);else{if(!i.writable)throw new TypeError("attempted to set read only private field");i.value=n}return n}function _n(e){return"Invalid specification ".concat(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"".concat("width"==e?"Width":"Height",' "container" only works for single views and layered views.')}function Pn(e){const t="width"==e?"x":"y";return"".concat("width"==e?"Width":"Height",' "container" only works well with autosize "fit" or "fit-').concat(t,'".')}function Nn(e){return e?'Dropping "fit-'.concat(e,'" because spec has discrete ').concat(tt(e),"."):'Dropping "fit" because spec has discrete size.'}function jn(e){return"Unknown field for ".concat(e,". Cannot calculate view size.")}function Mn(e){return'Cannot project a selection on encoding channel "'.concat(e,'", which has no field.')}function Tn(e,t){return'Cannot project a selection on encoding channel "'.concat(e,'" as it uses an aggregate function ("').concat(t,'").')}function Ln(e){return"Selection not supported for ".concat(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 "'.concat(e,'" has nested row/column.')}function Wn(e,t,n){return'An ancestor parsed field "'.concat(e,'" as ').concat(n," but a child wants to parse the field as ").concat(t,".")}function Un(e){return"Config.customFormatTypes is not true, thus custom format type and format for channel ".concat(e," are dropped.")}function Hn(e){return'Invalid field type "'.concat(e,'".')}function In(e,t){const{fill:n,stroke:i}=t;return"Dropping color ".concat(e," as the plot also has ").concat(n&&i?"fill and stroke":n?"fill":"stroke",".")}function Vn(e,t){return"Dropping ".concat(g(e),' from channel "').concat(t,'" since it does not contain any data field, datum, value, or signal.')}function Gn(e,t,n){return"".concat(e,' dropped as it is incompatible with "').concat(t,'"').concat(n?" when ".concat(n):"",".")}function Yn(e){return"".concat(e," encoding should be discrete (ordinal / nominal / binned).")}function Xn(e){return"".concat(e," encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).")}function Jn(e,t){return'Using discrete channel "'.concat(e,'" to encode "').concat(t,'" field can be misleading as it does not encode ').concat("ordinal"===t?"order":"magnitude",".")}function Qn(e){return"Using unaggregated domain with raw field has no effect (".concat(g(e),").")}function $n(e){return'Unaggregated domain not applicable for "'.concat(e,'" since it produces values outside the origin domain of the source data.')}function Kn(e){return"Unaggregated domain is currently unsupported for log scale (".concat(g(e),").")}function Zn(e,t,n){return"".concat(n,"-scale's \"").concat(t,'" is dropped as it does not work with ').concat(e," scale.")}function ei(e){return'The step for "'.concat(e,'" is dropped because the ').concat("width"===e?"x":"y"," is continuous.")}const ti="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function ni(e,t){return"Invalid ".concat(e,": ").concat(g(t),".")}function ii(e){return"1D error band does not support ".concat(e,".")}function ri(e){return"Channel ".concat(e,' is required for "binned" bin.')}const oi=t.logger(t.Warn);let ai=oi;function si(...e){ai.warn(...e)}function ci(e){if(e&&t.isObject(e))for(const t of hi)if(t in e)return!0;return!1}const ui=["january","february","march","april","may","june","july","august","september","october","november","december"],li=ui.map((e=>e.substr(0,3))),fi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],di=fi.map((e=>e.substr(0,3)));function pi(e,n){const i=[];if(n&&void 0!==e.day&&B(e).length>1&&(si(function(e){return"Dropping day from datetime ".concat(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(Q(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=ui.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=li.indexOf(i);if(-1!==r)return r;throw new Error(ni("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=n?function(e){if(Q(e)&&(e=+e),t.isNumber(e))return e>4&&si(ni("quarter",e)),e-1;throw new Error(ni("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(r)?3*r:"".concat(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(Q(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=fi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=di.indexOf(i);if(-1!==r)return r;throw new Error(ni("day",e))}}(e.day):e.day;i.push(t.isNumber(r)?r+1:"".concat(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 mi(e){const t=pi(e,!0).join(", ");return e.utc?"utc(".concat(t,")"):"datetime(".concat(t,")")}const gi={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},hi=B(gi);function vi(e){return e.startsWith("utc")}const yi={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function bi(e){return hi.filter((t=>xi(e,t)))}function xi(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 wi(e,t,{end:n}={end:!1}){const i=T(t),r=vi(e)?"utc":"";let o;const a={};for(const t of hi)xi(e,t)&&(a[t]="quarter"===(s=t)?"(".concat(r,"quarter(").concat(i,")-1)"):"".concat(r).concat(s,"(").concat(i,")"),o=t);var s;return n&&(a[o]+="+1"),function(e){const t=pi(e,!1).join(", ");return e.utc?"utc(".concat(t,")"):"datetime(".concat(t,")")}(a)}function Ai(e){if(!e)return;const t=bi(e);return"timeUnitSpecifier(".concat(g(t),", ").concat(g(yi),")")}function Di(e){if(!e)return;let n;return t.isString(e)?n={unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),vi(n.unit)&&(n.utc=!0,n.unit=n.unit.substr(3)),n}function Fi(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)||Fi(e)||Bi(e)||ki(e)||Si(e)||Ci(e)||Ei(e)}function Oi(e,t){return la(e,{timeUnit:t,wrapTime:!0})}function Pi(e,t=!0){var n;const{field:i}=e,r=null===(n=Di(e.timeUnit))||void 0===n?void 0:n.unit,o=r?"time(".concat(wi(r,i),")"):Yo(e,{expr:"datum"});if(Fi(e))return"".concat(o,"===").concat(Oi(e.equal,r));if(ki(e)){const t=e.lt;return"".concat(o,"<").concat(Oi(t,r))}if(Si(e)){const t=e.gt;return"".concat(o,">").concat(Oi(t,r))}if(Ci(e)){const t=e.lte;return"".concat(o,"<=").concat(Oi(t,r))}if(Ei(e)){const t=e.gte;return"".concat(o,">=").concat(Oi(t,r))}if(_i(e))return"indexof([".concat(function(e,t){return e.map((e=>Oi(e,t)))}(e.oneOf,r).join(","),"], ").concat(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:"".concat(n.signal,"[0]")}:n[0],a=an(n)?{signal:"".concat(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("".concat(o," >= ").concat(Oi(i,r))),null!==a&&s.push("".concat(o," <= ").concat(Oi(a,r))),s.length>0?s.join(" && "):"true"}throw new Error("Invalid field predicate: ".concat(g(e)))}function Ni(e,t=!0){return t?"isValid(".concat(e,") && isFinite(+").concat(e,")"):"!isValid(".concat(e,") || !isFinite(+").concat(e,")")}function ji(e){var t;return zi(e)&&e.timeUnit?{...e,timeUnit:null===(t=Di(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",$i="point",Ki="band",Zi={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 er(e,t){const n=Zi[e],i=Zi[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const tr={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 nr(e){return tr[e]}const ir=["linear","log","pow","sqrt","symlog","time","utc"],rr=t.toSet(ir),or=t.toSet(["linear","log","pow","sqrt","symlog"]);const ar=t.toSet(["quantile","quantize","threshold"]),sr=ir.concat(["quantile","quantize","threshold","sequential","identity"]),cr=t.toSet(sr),ur=t.toSet(["ordinal","bin-ordinal","point","band"]);function lr(e){return e in ur}function fr(e){return e in cr}function dr(e){return e in rr}function pr(e){return e in ar}function mr(e){return null==e?void 0:e.param}const{type:gr,domain:hr,range:vr,rangeMax:yr,rangeMin:br,scheme:xr,...wr}={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},Ar=B(wr);function Dr(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 dr(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return dr(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 dr(e);case"nice":return dr(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return fr(e)&&!y(["log","time","utc","threshold","quantile"],e)}}function Fr(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Me(e)?void 0:'Cannot use the scale property "'.concat(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=B(kr);function Hr(e){return e.type}t.toSet(Ur);const Ir=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Vr=B({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),Gr=B({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 $r(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=io(e);return No(n)&&!Gt(n.aggregate)&&r&&dr(r.get("type"))&&!1===r.get("zero")?Kr({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function Kr({fieldDef:e,channel:t,markDef:n,ref:i,config:r}){if(Rr(n.type))return i;return null===xn("invalid",n,r)?i:[Zr(e,t),i]}function Zr(e,t){return{test:eo(e,!0),..."y"===Ke(t)?{field:{group:"height"}}:{value:0}}}function eo(e,n=!0){return Ni(t.isString(e)?e:Yo(e,{expr:"datum"}),!n)}function to(e,t,n,i){const r={};if(t&&(r.scale=t),Mo(e)){const{datum:t}=e;ci(t)?r.signal=mi(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 no({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,bandPosition:o=.5}){const a=0P("".concat("unit"===e?"":"_".concat(e,"_")).concat(n[e])))).join(""):(t?"utc":"")+"timeunit"+B(n).map((e=>P("_".concat(e,"_").concat(n[e])))).join("")}(f),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(null!==(c=t.suffix)&&void 0!==c?c:"")}}i&&(n=n?"".concat(i,"_").concat(n):i)}return r&&(n="".concat(n,"_").concat(r)),i&&(n="".concat(i,"_").concat(n)),t.forAs?U(n):t.expr?L(n,t.expr)+o:R(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(Ht(t))return"".concat(r," for argmax(").concat(t.argmax,")");if(Ut(t))return"".concat(r," for argmin(").concat(t.argmin,")");const o=Di(i),a=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||Qt(n)&&"bin";return a?"".concat(a.toUpperCase(),"(").concat(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(Qt(i))return"".concat(n," (binned)");if(r){var a;const e=null===(a=Di(r))||void 0===a?void 0:a.unit;if(e)return"".concat(n," (").concat(bi(e).join("-"),")")}else if(o)return Ht(o)?"".concat(n," for max ").concat(o.argmax):Ut(o)?"".concat(n," for min ").concat(o.argmin):"".concat(M(o)," of ").concat(n);return n}(e,t)}};let Qo=Jo;function $o(e){Qo=e}function Ko(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const o=null===(r=Zo(e))||void 0===r?void 0:r.title;if(!No(e))return o;const a=e,s=i?ea(a,t):void 0;return n?I(o,a.title,s):null!==(c=null!=o?o:a.title)&&void 0!==c?c:s;var c}function Zo(e){return Ho(e)&&e.axis?e.axis:Io(e)&&e.legend?e.legend:Fo(e)&&e.header?e.header:void 0}function ea(e,t){return Qo(e,t)}function ta(e){if(Vo(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{var t;const n=null!==(t=Zo(e))&&void 0!==t?t:{},{format:i,formatType:r}=n;return{format:i,formatType:r}}}function na(e){return No(e)?e:Oo(e)?e.condition:void 0}function ia(e){return qo(e)?e:Po(e)?e.condition:void 0}function ra(e,n,i,r={}){if(t.isString(e)||t.isNumber(e)||t.isBoolean(e)){return si(function(e,t,n){return"Channel ".concat(e," is a ").concat(t,". Converted to {value: ").concat(g(n),"}.")}(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return qo(e)?oa(e,n,i,r):Po(e)?{...e,condition:oa(e.condition,n,i,r)}:e}function oa(e,n,i,r){if(Vo(e)){const{format:t,formatType:o,...a}=e;if(oo(o)&&!i.customFormatTypes)return si(Un(n)),oa(a,n,i,r)}else{const t=Ho(e)?"axis":Io(e)?"legend":Fo(e)?"header":null;if(t&&e[t]){const{format:o,formatType:a,...s}=e[t];if(oo(a)&&!i.customFormatTypes)return si(Un(n)),oa({...e,[t]:s},n,i,r)}}return No(e)?aa(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":ci(i)?"temporal":void 0,{...e,type:n}}(e)}function aa(e,n,{compositeMark:i=!1}={}){const{aggregate:r,timeUnit:o,bin:a,field:s}=e,c={...e};if(i||!r||It(r)||Ht(r)||Ut(r)||(si(function(e){return'Invalid aggregation operator "'.concat(e,'".')}(r)),delete c.aggregate),o&&(c.timeUnit=Di(o)),s&&(c.field="".concat(s)),Qt(a)&&(c.bin=sa(a,n)),$t(a)&&!yt(n)&&si(function(e){return"Channel ".concat(e,' should not be used with "binned" bin.')}(n)),Ro(c)){const{type:e}=c,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&&(c.type=t),"quantitative"!==e&&Gt(r)&&(si(function(e,t){return'Invalid field type "'.concat(e,'" for aggregate: "').concat(t,'", using "quantitative" instead.')}(e,r)),c.type="quantitative")}else if(!$e(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&&!Ht(r)&&!Ut(r))return"quantitative";if(Uo(e)&&null!==(i=e.scale)&&void 0!==i&&i.type)switch(Zi[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(c,n);c.type=e}if(Ro(c)){const{compatible:e,warning:t}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:"Channel ".concat(t," should not be used with a geojson data.")};switch(t){case $:case K:case Z:return Xo(e)?ca:{compatible:!1,warning:Yn(t)};case ee:case te:case de:case pe:case me:case De:case ke:case Ce:case Se:case Ee:case Be:case ve:case ae:case re:case _e:return ca;case ue:case fe:case ce:case le:return n!==Mi?{compatible:!1,warning:"Channel ".concat(t," should be used with a quantitative field only, not ").concat(e.type," field.")}:ca;case ye:case be:case xe:case we:case he:case se:case oe:case ne:case ie:return"nominal"!==n||e.sort?ca:{compatible:!1,warning:"Channel ".concat(t," should not be used with an unsorted discrete field.")};case ge:case Ae:return Xo(e)||Uo(i=e)&&pr(null===(r=i.scale)||void 0===r?void 0:r.type)?ca:{compatible:!1,warning:Xn(t)};case Fe:return"nominal"!==e.type||"sort"in e?ca:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(c,n)||{};!1===e&&si(t)}if(So(c)&&t.isString(c.sort)){const{sort:e}=c;if(bo(e))return{...c,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&bo(t))return{...c,sort:{encoding:t,order:"descending"}}}if(Fo(c)){const{header:e}=c;if(e){const{orient:t,...n}=e;if(t)return{...c,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return c}function sa(e,n){return t.isBoolean(e)?{maxbins:en(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:en(n)}}const ca={compatible:!0};function ua(e){const{formatType:t}=ta(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||No(n)&&!!n.timeUnit));var n}function la(e,{timeUnit:n,type:i,wrapTime:r,undefinedIfExprNotRequired:o}){var a;const s=n&&(null===(a=Di(n))||void 0===a?void 0:a.unit);let c,u=s||"temporal"===i;return tn(e)?c=e.expr:an(e)?c=e.signal:ci(e)?(u=!0,c=mi(e)):(t.isString(e)||t.isNumber(e))&&u&&(c="datetime(".concat(g(e),")"),function(e){return!!gi[e]}(s)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(c=mi({[s]:e}))),c?r&&u?"time(".concat(c,")"):c:o?void 0:g(e)}function fa(e,t){const{type:n}=e;return t.map((t=>{const i=la(t,{timeUnit:No(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function da(e,t){return Qt(e.bin)?Nt(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const pa={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 ma(e){return e&&e.condition}const ga=["domain","grid","labels","ticks","title"],ha={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"},va={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},ya={...va,style:1,labelExpr:1,encoding:1};function ba(e){return!!ya[e]}const xa=B({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 wa(e){return"mark"in e}class Aa{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!wa(e)&&(Hr(t=e.mark)?t.type:t)===this.name;var t}}function Da(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?b(i,(e=>!!e.field)):No(i)||Oo(i))}function Fa(e){return b(Re,(n=>{if(Da(e,n)){const i=e[n];if(t.isArray(i))return b(i,(e=>!!e.aggregate));{const e=na(i);return e&&!!e.aggregate}}return!1}))}function ka(e,t){const n=[],i=[],r=[],o=[],a={};return Ea(e,((s,c)=>{if(No(s)){const{field:u,aggregate:l,bin:f,timeUnit:d,...p}=s;if(l||d||f){const e=Zo(s),m=e&&e.title;let g=Yo(s,{forAs:!0});const h={...m?[]:{title:Ko(s,t,{allowDisabling:!0})},...p,field:g};if(l){let e;if(Ht(l)?(e="argmax",g=Yo({op:"argmax",field:l.argmax},{forAs:!0}),h.field="".concat(g,".").concat(u)):Ut(l)?(e="argmin",g=Yo({op:"argmin",field:l.argmin},{forAs:!0}),h.field="".concat(g,".").concat(u)):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(e=l),e){const t={op:e,as:g};u&&(t.field=u),o.push(t)}}else if(n.push(g),Ro(s)&&Qt(f)){if(i.push({bin:f,field:u,as:g}),n.push(Yo(s,{binSuffix:"end"})),da(s,c)&&n.push(Yo(s,{binSuffix:"range"})),yt(c)){const e={field:"".concat(g,"_end")};a["".concat(c,"2")]=e}h.bin="binned",$e(c)||(h.type=Mi)}else if(d){r.push({timeUnit:d,field:u,as:g});const e=Ro(s)&&s.type!==Li&&"time";e&&(c===De||c===Se?h.formatType=e:!function(e){return!!mt[e]}(c)?yt(c)&&(h.axis={formatType:e,...h.axis}):h.legend={formatType:e,...h.legend})}a[c]=h}else n.push(u),a[c]=e[c]}else a[c]=e[c]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function Ca(e,n,i,r){return B(e).reduce(((o,a)=>{if(!Je(a))return si(function(e){return"".concat(e,"-encoding is dropped as ").concat(e," is not a valid encoding channel.")}(a)),o;const s=e[a];if("angle"!==a||"arc"!==n||e.theta||(si("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=ae),!function(e,t,n){const i=jt(t,n);if(!i)return!1;if("binned"===i){const n=e[t===ne?ee:te];return!!(No(n)&&No(e[t])&&$t(n.bin))}return!0}(e,a,n))return si(Gn(a,n)),o;if(a===he&&"line"===n){const t=na(e[a]);if(null!=t&&t.aggregate)return si("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 si(In("encoding",{fill:"fill"in e,stroke:"stroke"in e})),o;if(a===ke||a===Fe&&!t.isArray(s)&&!Wo(s)||a===Se&&t.isArray(s))s&&(o[a]=t.array(s).reduce(((e,t)=>(No(t)?e.push(aa(t,a)):si(Vn(t,a)),e)),[]));else{if(a===Se&&null===s)o[a]=null;else if(!(No(s)||Mo(s)||Wo(s)||zo(s)||an(s)))return si(Vn(s,a)),o;o[a]=ra(s,a,r)}return o}),{})}function Sa(e,t){const n={};for(const i of B(e)){const r=ra(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Ea(e,n,i){if(e)for(const r of B(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 B(n).reduce(((i,r)=>{switch(r){case ee:case te:case Ee:case _e:case Be:case ne:case ie:case ae:case se:case re:case oe:case ce:case ue:case le:case fe:case De:case ge:case ve:case Se:return i;case Fe:if("line"===e||"trail"===e)return i;case ke:case Ce:{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=na(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 ".concat(za(n)):"";return{field:e+n.field,type:n.type,title:an(t)?{signal:"".concat(t,'"').concat(escape(i),'"')}:t+i}})),...D(function(e){const n=[];for(const i of B(e))if(Da(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 I(t,n)}function Oa(e,n,i,r,o){const{scale:a,axis:s}=i;return({partName:c,mark:u,positionPrefix:l,endPositionPrefix:f,extraEncoding:d={}})=>{const p=za(i);return Pa(e,c,o,{mark:u,encoding:{[n]:{field:"".concat(l,"_").concat(i.field),type:i.type,...void 0!==p?{title:p}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(f)?{["".concat(n,"2")]:{field:"".concat(f,"_").concat(i.field)}}:{},...r,...d}})}}function Pa(e,n,i,r){const{clip:o,color:a,opacity:s}=e,c=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:"".concat(c,"-").concat(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["".concat(r,"2")],s=i["".concat(r,"Error")],c=i["".concat(r,"Error2")];return{continuousAxisChannelDef:ja(o,n),continuousAxisChannelDef2:ja(a,n),continuousAxisChannelDefError:ja(s,n),continuousAxisChannelDefError2:ja(c,n),continuousAxis:r}}function ja(e,t){if(e&&e.aggregate){const{aggregate:n,...i}=e;return n!==t&&si(function(e,t){return"Continuous axis should not have customized aggregation function ".concat(e,"; ").concat(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 ua(o)&&!ua(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(To(o))return"vertical";throw new Error("Need a valid continuous axis for ".concat(t,"s"))}const Ta="boxplot",La=new Aa(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,...c}=e,u=Hr(r)?r:{type:r};a&&si(Ln("boxplot"));const l=null!==(i=u.extent)&&void 0!==i?i:n.boxplot.extent,f=xn("size",u,n),d=qa(l),{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,c=qa(n),u=[...Wa(s),{op:"median",field:s,as:"mid_box_".concat(s)},{op:"min",field:s,as:("min-max"===c?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===c?"upper_whisker_":"max_")+s}],l="min-max"===c||"tukey"===c?[]:[{calculate:'datum["upper_box_'.concat(s,'"] - datum["lower_box_').concat(s,'"]'),as:"iqr_".concat(s)},{calculate:'min(datum["upper_box_'.concat(s,'"] + datum["iqr_').concat(s,'"] * ').concat(n,', datum["max_').concat(s,'"])'),as:"upper_whisker_".concat(s)},{calculate:'max(datum["lower_box_'.concat(s,'"] - datum["iqr_').concat(s,'"] * ').concat(n,', datum["min_').concat(s,'"])'),as:"lower_whisker_".concat(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,...u],groupby:y},...l];return{bins:g,timeUnits:h,transform:A,groupby:y,aggregate:v,continuousAxisChannelDef:o,continuousAxis:a,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,l,n),{color:k,size:C,...S}=w,B=e=>Oa(u,y,v,e,n.boxplot),_=B(S),z=B(w),O=B({...S,...C?{size:C}:{}}),P=_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),N={type:"tick",color:"black",opacity:1,orient:A,invalid:null,aria:!1},j="min-max"===d?P:_a([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],v,w),M=[..._({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:j}),..._({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:j}),..._({partName:"ticks",mark:N,positionPrefix:"lower_whisker",extraEncoding:j}),..._({partName:"ticks",mark:N,positionPrefix:"upper_whisker",extraEncoding:j})],T=[..."tukey"!==d?M:[],...z({partName:"box",mark:{type:"bar",...f?{size:f}:{},orient:D,invalid:null,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:P}),...O({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:P})];var L;if("min-max"===d)return{...c,transform:(null!==(L=c.transform)&&void 0!==L?L:[]).concat(h),layer:T};const q='datum["lower_box_'.concat(v.field,'"]'),R='datum["upper_box_'.concat(v.field,'"]'),W="(".concat(R," - ").concat(q,")"),U="".concat(q," - ").concat(l," * ").concat(W),H="".concat(R," + ").concat(l," * ").concat(W),I='datum["'.concat(v.field,'"]'),V={joinaggregate:Wa(v.field),groupby:b},G={transform:[{filter:"(".concat(U," <= ").concat(I,") && (").concat(I," <= ").concat(H,")")},{aggregate:[{op:"min",field:v.field,as:"lower_whisker_".concat(v.field)},{op:"max",field:v.field,as:"upper_whisker_".concat(v.field)},{op:"min",field:"lower_box_".concat(v.field),as:"lower_box_".concat(v.field)},{op:"max",field:"upper_box_".concat(v.field),as:"upper_box_".concat(v.field)},...x],groupby:b}],layer:M},{tooltip:Y,...X}=S,{scale:J,axis:Q}=v,$=za(v),K=m(Q,["title"]),Z=Pa(u,"outliers",n.boxplot,{transform:[{filter:"(".concat(I," < ").concat(U,") || (").concat(I," > ").concat(H,")")}],mark:"point",encoding:{[y]:{field:v.field,type:v.type,...void 0!==$?{title:$}:{},...void 0!==J?{scale:J}:{},...E(K)?{}:{axis:K}},...X,...k?{color:k}:{},...F?{tooltip:F}:{}}})[0];let ee;const te=[...p,...g,V];return Z?ee={transform:te,layer:[Z,G]}:(ee=G,ee.transform.unshift(...te)),{...c,layer:[ee,{transform:h,layer:T}]}}function Wa(e){return[{op:"q1",field:e,as:"lower_box_".concat(e)},{op:"q3",field:e,as:"upper_box_".concat(e)}]}const Ua="errorbar",Ha=new Aa(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:c,tooltipEncoding:u}=Ga(e,Ua,t);delete o.size;const l=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=[...l({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:u}),...l({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:u}),...l({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...c,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("".concat(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("".concat(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 ".concat(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 ".concat(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("".concat(t," cannot have xError2 without xError"));if(qo(s)&&!qo(r))throw new Error("".concat(t," cannot have yError2 without yError"));if(qo(e)&&qo(r))throw new Error("".concat(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,...c}=e,u=Hr(r)?r:{type:r};a&&si(Ln(t));const{orient:l,inputType:f}=Va(e,t),{continuousAxisChannelDef:d,continuousAxisChannelDef2:p,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:g,continuousAxis:h}=Na(e,l,t),{errorBarSpecificAggregate:v,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,a,s){let c=[],u=[];const l=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)&&si(function(e,t,n){return"".concat(e," is not usually used with ").concat(t," for ").concat(n,".")}(t,n,a)),"stderr"===n||"stdev"===n)c=[{op:n,field:l,as:"extent_".concat(l)},{op:t,field:l,as:"center_".concat(l)}],u=[{calculate:'datum["center_'.concat(l,'"] + datum["extent_').concat(l,'"]'),as:"upper_".concat(l)},{calculate:'datum["center_'.concat(l,'"] - datum["extent_').concat(l,'"]'),as:"lower_".concat(l)}],f=[{fieldPrefix:"center_",titlePrefix:M(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"),c=[{op:t,field:l,as:"lower_".concat(l)},{op:i,field:l,as:"upper_".concat(l)},{op:e,field:l,as:"center_".concat(l)}],f=[{fieldPrefix:"upper_",titlePrefix:Ko({field:l,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Ko({field:l,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Ko({field:l,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&si((p=e.center,m=e.extent,"".concat(m?"extent ":"").concat(m&&p?"and ":"").concat(p?"center ":"").concat(m&&p?"are ":"is ","not needed when data are aggregated."))),"aggregated-upper-lower"===o?(f=[],u=[{calculate:'datum["'.concat(n.field,'"]'),as:"upper_".concat(l)},{calculate:'datum["'.concat(l,'"]'),as:"lower_".concat(l)}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:l}],u=[{calculate:'datum["'.concat(l,'"] + datum["').concat(i.field,'"]'),as:"upper_".concat(l)}],r?u.push({calculate:'datum["'.concat(l,'"] + datum["').concat(r.field,'"]'),as:"lower_".concat(l)}):u.push({calculate:'datum["'.concat(l,'"] - datum["').concat(i.field,'"]'),as:"lower_".concat(l)}));for(const e of u)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:W(W(e.calculate,'datum["',""),'"]',"")})}var p,m;return{postAggregateCalculates:u,errorBarSpecificAggregate:c,tooltipSummary:f,tooltipTitleWithFieldName:d}}(u,d,p,m,g,f,t,n),{[h]:w,["x"===h?"x2":"y2"]:A,["x"===h?"xError":"yError"]:D,["x"===h?"xError2":"yError2"]:F,...k}=o,{bins:C,timeUnits:S,aggregate:E,groupby:B,encoding:_}=ka(k,n),z=[...E,...v],O="raw"!==f?[]:B,P=_a(b,d,_,x);return{transform:[...null!==(i=c.transform)&&void 0!==i?i:[],...C,...S,...0===z.length?[]:[{aggregate:z,groupby:O}],...y],groupby:O,continuousAxisChannelDef:d,continuousAxis:h,encodingWithoutContinuousAxis:_,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:u,outerSpec:c,tooltipEncoding:P}}function Ya(e,t,n){return"".concat(M(e)," ").concat(n," ").concat(t)}const Xa="errorband",Ja=new Aa(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:c}=Ga(e,Xa,t),u=a,l=Oa(u,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={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(d={...d,...m,ariaRoleDescription:"errorband"},p={...p,...m,aria:!1}):u.interpolate?si(ii("interpolate")):u.tension&&si(ii("tension")),{...s,transform:n,layer:[...l({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c}),...l({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:c}),...l({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:c})]}}const $a={};function Ka(e,t,n){const i=new Aa(e,t);$a[e]={normalizer:i,parts:n}}Ka(Ta,Ra,["box","median","outliers","rule","ticks"]),Ka(Ua,Ia,["ticks","rule"]),Ka(Xa,Qa,["band","borders"]);const Za=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],es={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"},ts={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"},ns=B(es),is=B(ts),rs=B({header:1,headerRow:1,headerColumn:1,headerFacet:1}),os=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],as="_vgsid_",ss={point:{on:"click",fields:[as],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 cs(e){return!(!e||"legend"!==e&&!e.legend)}function us(e){return cs(e)&&t.isObject(e)}function ls(e){return!!e.select}function fs(e){const t=[];for(const n of e||[]){if(ls(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 ds(e){return"concat"in e}function ps(e){return"vconcat"in e}function ms(e){return"hconcat"in e}const gs=["background","padding"];function hs(e,t){const n={};for(const t of gs)e&&void 0!==e[t]&&(n[t]=pn(e[t]));return t&&(n.params=e.params),n}function vs(e){return t.isObject(e)&&void 0!==e.step}function ys(e){return e.view||e.width||e.height}const bs=B({align:1,bounds:1,center:1,columns:1,spacing:1});function xs(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function ws(e,t){const n=As(e,t);return vs(n)?n.step:Ds}function As(e,t){var n;return I(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Ds=20,Fs={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Ds},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:ss,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=B(e||{}),n={};for(const i of t){const t=e[i];n[i]=ma(t)?dn(t):pn(t)}return n}const Bs=[...Gr,...xa,...rs,"background","padding","legend","lineBreak","scale","style","title","view"];function _s(e={}){const{color:n,font:i,fontSize:r,...o}=e,a=t.mergeConfig({},Fs,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 xa)a[e]&&(s[e]=Es(a[e]));for(const e of rs)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=B(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)ma(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Za)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(fs(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 B($a))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=rn(e.title);E(t)||(e.style["group-title"]={...e.style["group-title"],...t});E(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});E(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&E(e[n])&&delete e[n];return E(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;E(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):ms(e)?this.mapHConcat(e,t):ps(e)?this.mapVConcat(e,t):ds(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Ms(e))return this.mapLayer(e,t);if(wa(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 c=n[s],u=No(c)?Yo(c,{}):void 0;let l=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(s),f=n[l],d=No(f)?Yo(f,{}):void 0;d===u&&(d=void 0,f=void 0,l=void 0);const p=gt.reduce(((e,i)=>{if("tooltip"!==i&&Da(n,i)){const r=n[i];for(const n of t.array(r)){const t=na(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!==c.stack?m=t.isBoolean(c.stack)?c.stack?"zero":null:c.stack:Rs.has(a)&&(m="zero"),!m||!(m in Ls))return null;var g,h;if(Fa(n)&&0===p.length)return null;if(null!=c&&null!==(r=c.scale)&&void 0!==r&&r.type&&(null==c||null===(o=c.scale)||void 0===o?void 0:o.type)!==Wi){if(i.disallowNonLinearStack)return null;si(function(e){return"Cannot stack non-linear scale (".concat(e,").")}(c.scale.type))}return qo(n[et(s)])?(void 0!==c.stack&&si('Cannot stack "'.concat(g=s,'" if there is already "').concat(g,'2".')),null):(No(c)&&c.aggregate&&!y(Yt,c.aggregate)&&si((h=c.aggregate,'Stacking is applied even though the aggregate function is non-summative ("'.concat(h,'").'))),{groupbyChannel:f?l:void 0,groupbyField:d,fieldChannel:s,impute:null!==c.impute&&Rr(a),stackBy:p,offset:m})}function Hs(e){const{point:t,line:n,...i}=e;return B(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(){En(this,"name","path-overlay")}hasMatchingType(e,t){if(wa(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,...c}=e,u=Sa(s,i),l=Hr(a)?a:{type:a},f=Vs(l,i[l.type],u),d="area"===l.type&&Gs(l,i[l.type]),g=[{...r?{params:r}:{},mark:Hs({..."area"===l.type&&void 0===l.opacity&&void 0===l.fillOpacity?{opacity:.7}:{},...l}),encoding:m(u,["shape"])}],h=Us(l,u);let v=u;if(h){const{fieldChannel:e,offset:t}=h;v={...u,[e]:{...u[e],...t?{stack:t}:{}}}}return d&&g.push({...o?{projection:o}:{},mark:{type:"line",...p(l,["clip","interpolate","tension","tooltip"]),...d},encoding:v}),f&&g.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...p(l,["clip","tooltip"]),...f},encoding:v}),n({...c,layer:g},{...t,config:Is(i)})}}function Xs(e,t){return t?Do(e)?ec(e,t):$s(e,t):e}function Js(e,t){return t?ec(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 si(function(e){return'Unknown repeated value "'.concat(e,'".')}(r.repeat)):n;var o}function $s(e,t){if(void 0!==(e=Qs("field",e,t))){if(null===e)return null;if(So(e)&&wo(e.sort)){const n=Qs("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Ks(e,t){if(No(e))return $s(e,t);{const n=Qs("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function Zs(e,t){if(!qo(e)){if(Po(e)){const n=Ks(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=Ks(e,t);if(n)return n;if(zo(e))return{condition:e.condition}}}function ec(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=>Zs(e,n))).filter((e=>e));else{const e=Zs(o,n);void 0!==e&&(i[r]=e)}}return i}class tc{constructor(){En(this,"name","RuleForRangedLine")}hasMatchingType(e){if(wa(e)){const{encoding:t,mark:n}=e;if("line"===n||Hr(n)&&"line"===n.type)for(const e of Qe){const n=t[Ke(e)];if(t[e]&&(No(n)&&!$t(n.bin)||Mo(n)))return!0}}return!1}run(e,n,i){const{encoding:r,mark:o}=e;var a,s;return si((a=!!r.x2,s=!!r.y2,"Line mark is for continuous lines and thus cannot be used with ".concat(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 nc({parentEncoding:e,encoding:n={},layer:i}){let r={};if(e){const o=new Set([...B(e),...B(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||E(r)?void 0:r}function ic(e){const{parentProjection:t,projection:n}=e;return t&&n&&si(function(e){const{parentProjection:t,projection:n}=e;return"Layer's shared projection ".concat(g(t)," is overridden by a child projection ").concat(g(n),".")}({parentProjection:t,projection:n})),null!=n?n:t}function rc(e){return"filter"in e}function oc(e){return"lookup"in e}function ac(e){return"pivot"in e}function sc(e){return"density"in e}function cc(e){return"quantile"in e}function uc(e){return"regression"in e}function lc(e){return"loess"in e}function fc(e){return"sample"in e}function dc(e){return"window"in e}function pc(e){return"joinaggregate"in e}function mc(e){return"flatten"in e}function gc(e){return"calculate"in e}function hc(e){return"bin"in e}function vc(e){return"impute"in e}function yc(e){return"timeUnit"in e}function bc(e){return"aggregate"in e}function xc(e){return"stack"in e}function wc(e){return"fold"in e}function Ac(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(rc(e))return{filter:kc(e,t)};if(hc(e)&&Kt(e.bin))return{...e,bin:Fc(e.bin)};if(oc(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function Dc(e,t){var i,r;const o=d(e);if(No(o)&&Kt(o.bin)&&(o.bin=Fc(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:kc(e,t)}}));else{const{selection:e,param:n,test:i,...r}=Dc(o.condition,t);o.condition=n?o.condition:{...r,test:kc(o.condition,t)}}return o}function Fc(e){const t=e.extent;if(null!=t&&t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function kc(e,t){const n=e=>l(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):l(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class Cc extends Ts{map(e,t){var n;const i=null!==(n=t.selections)&&void 0!==n?n:[];if(e.params&&!wa(e)){const t=[];for(const n of e.params)ls(n)?i.push(n):t.push(n);e.params=t}return t.selections=i,super.map(e,Sc(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=Cc.prototype[e];Cc.prototype[e]=function(e,n){return t.call(this,e,Sc(e,n))}}function Sc(e,t){var n;return e.name?{...t,path:(null!==(n=t.path)&&void 0!==n?n:[]).concat(e.name)}:t}function Ec(e,t){void 0===t&&(t=_s(e.config));const n=function(e,t={}){const n={config:t};return zc.map(Bc.map(_c.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=wa(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&&(si(On("width")),i=void 0),"container"==r&&(si(On("height")),r=void 0));const s={type:"pad",...a,...n?Oc(n.autosize):{},...Oc(e.autosize)};"fit"!==s.type||o||(si(zn),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&si(Pn("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&si(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 Bc=new class extends Ts{constructor(...e){super(...e),En(this,"nonFacetUnitNormalizers",[La,Ha,Ja,new Ys,new tc])}map(e,t){if(wa(e)){const n=Da(e.encoding,$),i=Da(e.encoding,K),r=Da(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:c={},repeaterPrefix:u=""}=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={...c,layer:e},r="".concat((i.name||"")+u,"child__layer_").concat(P(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"]),si(Rn("repeat")));const c=[],{repeater:u={},repeaterPrefix:l=""}=n,f=!t.isArray(r)&&r.row||[u?u.row:null],d=!t.isArray(r)&&r.column||[u?u.column:null],p=t.isArray(r)&&r||[u?u.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:u.layer},f=(o.name||"")+l+"child__"+(t.isArray(r)?"".concat(P(e)):(r.row?"row_".concat(P(i)):"")+(r.column?"column_".concat(P(a)):"")),d=this.map(o,{...n,repeater:s,repeaterPrefix:f});d.name=f,c.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:c}}mapFacet(e,t){const{facet:n}=e;return Do(n)&&e.columns&&(e=m(e,["columns"]),si(Rn("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=ic({parentProjection:o,projection:i}),c=nc({parentEncoding:r,encoding:Js(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:c,height:u,view:l,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}:{},...u?{height:u}:{},...l?{view:l}:{},...c?{projection:c}:{},mark:a,encoding:h,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&si((a=[...n?[$]:[],...i?[K]:[]],"Facet encoding dropped as ".concat(a.join(" and ")," ").concat(a.length>1?"are":"is"," also specified.")));const t={},s={};for(const n of[$,K]){const i=e[n];if(i){const{align:e,center:r,spacing:a,columns:c,...u}=i;t[n]=u;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:nc({parentEncoding:t,encoding:r,layer:!0}),parentProjection:ic({parentProjection:n,projection:o})};return super.mapLayer(a,s)}},_c=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=Ac(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=Ac(e,t)).encoding){const n={};for(const[i,r]of z(e.encoding))n[i]=Dc(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:z(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 _(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}},zc=new Cc;function Oc(e){return t.isString(e)?{type:e}:null!=e?e:{}}class Pc{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Pc(d(this.explicit),d(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return I(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 B(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Nc(e){return{explicit:!0,value:e}}function jc(e){return{explicit:!1,value:e}}function Mc(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:Tc(t,n,i,r)}}function Tc(e,t,n,i){return e.explicit&&t.explicit&&si(function(e,t,n,i){return"Conflicting ".concat(t.toString(),' property "').concat(e.toString(),'" (').concat(g(n)," and ").concat(g(i),"). Using ").concat(g(n),".")}(n,i,e.value,t.value)),e}function Lc(e,t,n,i,r=Tc){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 qc extends Pc{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 Rc(e){return"url"in e}function Wc(e){return"values"in e}function Uc(e){return"name"in e&&!Rc(e)&&!Wc(e)&&!Hc(e)}function Hc(e){return e&&(Ic(e)||Vc(e)||Gc(e))}function Ic(e){return"sequence"in e}function Vc(e){return"sphere"in e}function Gc(e){return"graticule"in e}let Yc;!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"}(Yc||(Yc={}));const Xc="[",Jc="]",Qc=/[[\]{}]/,$c={"*":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 Kc,Zc;function eu(e,t,n){return Kc=t||"view",Zc=n||$c,nu(e.trim()).map(iu)}function tu(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 nu(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(iu);const r=iu(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:Kc},n=[];let i,r,o=[0,0],a=0,s=0,c=e.length,u=0;if("}"===e[c-1]){if(u=e.lastIndexOf("{"),!(u>=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(u+1,c-1))}catch(t){throw"Invalid throttle specification: "+e}c=(e=e.slice(0,u).trim()).length,u=0}if(!c)throw e;"@"===e[0]&&(a=++u);i=tu(e,u,":"),i1?(t.type=n[1],a?t.markname=n[0].slice(1):!function(e){return Zc[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 ru(e,n=!0,i=t.identity){if(t.isArray(e)){const t=e.map((e=>ru(e,n,i)));return n?"[".concat(t.join(", "),"]"):t}return ci(e)?i(n?mi(e):function(e){const t=pi(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):n?i(g(e)):e}function ou(e,n){for(const r of _(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const o=r.name;let a="".concat(o).concat(hl,", ")+("global"===r.resolve?"true":"{unit: ".concat(xl(e),"}"));for(const t of bl)t.defined(r)&&(t.signals&&(n=t.signals(e,r,n)),t.modifyExpr&&(a=t.modifyExpr(e,r,a)));n.push({name:o+vl,on:[{events:{signal:r.name+hl},update:"modify(".concat(t.stringValue(r.name+gl),", ").concat(a,")")}]})}return cu(n)}function au(e,n){if(e.component.selection&&B(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:eu("mousemove","scope"),update:"isTuple(facet) ? facet : group(".concat(i,").datum")}]})}return cu(n)}function su(e,t){for(const i of _(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;for(const n of bl)n.defined(i)&&n.marks&&(t=n.marks(e,i,t))}return t}function cu(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}class uu{constructor(e,t){this.debugName=t,En(this,"_children",[]),En(this,"_parent",null),En(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)?si("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 lu extends uu{clone(){const e=new this.constructor;return e.debugName="clone_".concat(this.debugName),e._source=this._source,e._name="clone_".concat(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,En(this,"_source",void 0),En(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 ".concat(G())),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class fu extends uu{clone(){return new fu(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 E(n)?null:new fu(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Di(n)};return new fu(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 z(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(_(this.formula).map((e=>e.as)))}dependentFields(){return new Set(_(this.formula).map((e=>e.field)))}hash(){return"TimeUnit ".concat(h(this.formula))}assemble(){const e=[];for(const t of _(this.formula)){const{field:n,as:i,timeUnit:r}=t,{unit:o,utc:a,...s}=Di(r);e.push({field:R(n),type:"timeunit",...o?{units:bi(o)}:{},...a?{timezone:"utc"}:{},...s,as:[i,"".concat(i,"_end")]})}return e}}const du="_tuple_fields";class pu{constructor(...e){En(this,"hasChannel",void 0),En(this,"hasField",void 0),En(this,"timeUnit",void 0),En(this,"items",void 0),this.items=e,this.hasChannel={},this.hasField={}}}const mu={defined:()=>!0,parse:(e,n,i)=>{var r;const o=n.name,a=null!==(r=n.project)&&void 0!==r?r:n.project=new pu,s={},c={},u=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=P("".concat(o,"_").concat(n));for(let e=1;u.has(i);e++)i=P("".concat(o,"_").concat(n,"_").concat(e));return u.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 B(e))Xe[t]?(g||(g=[])).push(t):"interval"===f?(si('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){si(Tn(t,n.aggregate));continue}if(!i){si(Mn(t));continue}if(n.timeUnit){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};c[h(r)]=r}if(!s[i]){let r="E";if("interval"===f){fr(e.getScaleComponent(t).get("type"))&&(r="R")}else n.bin&&(r="R-RE");const o={field:i,channel:t,type:r};o.signals={...l(o,"data"),...l(o,"visual")},a.items.push(s[i]=o),a.hasField[i]=a.hasChannel[t]=s[i]}}else si(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={...l(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))))),E(c)||(a.timeUnit=new fu(null,c))},signals:(e,t,n)=>{const i=t.name+du;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=R(i.field),i}))})}},gu={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(!Nt(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&fr(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):si("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||vu(e)||0===r.length)return i;const o=i.filter((e=>e.name===n.name))[0];let a=o.update;if(a.indexOf(yl)>=0)o.update="{".concat(r.map((e=>"".concat(t.stringValue(R(e.field)),": ").concat(e.signals.data))).join(", "),"}");else{for(const e of r){const n="".concat(t.stringValue(R(e.field)),": ").concat(e.signals.data);a.includes(n)||(a="".concat(a.substring(0,a.length-1),", ").concat(n,"}"))}o.update=a}return i.concat(r.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!vu(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 hu(e,n){const i=t.stringValue(e.scaleName(n));return"domain(".concat(i,")")}function vu(e){var t;return e.parent&&wm(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:vu(e.parent.parent))}const yu="_brush",bu="_scale_trigger",xu={defined:e=>"interval"===e.type,signals:(e,n,i)=>{const r=n.name,o=r+du,a=gu.defined(n),s=n.init?n.init[0]:null,c=[],u=[];if(n.translate&&!a){const e="!event.item || event.item.mark.name !== ".concat(t.stringValue(r+yu));wu(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 si("Interval selections only support x and y encoding channels.");const l=s?s[o]:null,f=function(e,n,i,r){const o=i.channel,a=i.signals.visual,s=i.signals.data,c=gu.defined(n),u=t.stringValue(e.scaleName(o)),l=e.getScaleComponent(o),f=l?l.get("type"):void 0,d=e=>"scale(".concat(u,", ").concat(e,")"),p=e.getSizeSignalRef(o===ee?"width":"height").signal,m="".concat(o,"(unit)"),g=wu(n,((e,t)=>[...e,{events:t.between[0],update:"[".concat(m,", ").concat(m,"]")},{events:t,update:"[".concat(a,"[0], clamp(").concat(m,", 0, ").concat(p,")]")}]));return g.push({events:{signal:n.name+bu},update:fr(f)?"[".concat(d("".concat(s,"[0]")),", ").concat(d("".concat(s,"[1]")),"]"):"[0, 0]"}),c?[{name:s,on:[]}]:[{name:a,...r?{init:ru(r,!0,d)}:{value:[]},on:g},{name:s,...r?{init:ru(r)}:{},on:[{events:{signal:a},update:"".concat(a,"[0] === ").concat(a,"[1] ? null : invert(").concat(u,", ").concat(a,")")}]}]}(e,n,r,l),d=r.signals.data,p=r.signals.visual,m=t.stringValue(e.scaleName(a)),g=fr(e.getScaleComponent(a).get("type"))?"+":"";i.push(...f),c.push(d),u.push({scaleName:e.scaleName(a),expr:"(!isArray(".concat(d,") || ")+"(".concat(g,"invert(").concat(m,", ").concat(p,")[0] === ").concat(g).concat(d,"[0] && ")+"".concat(g,"invert(").concat(m,", ").concat(p,")[1] === ").concat(g).concat(d,"[1]))")})})),a||i.push({name:r+bu,value:{},on:[{events:u.map((e=>({scale:e.scaleName}))),update:"".concat(u.map((e=>e.expr)).join(" && ")," ? ").concat(r+bu," : {}")}]});const l="unit: ".concat(xl(e),", fields: ").concat(o,", values");return i.concat({name:r+hl,...s?{init:"{".concat(l,": ").concat(ru(s),"}")}:{},on:[{events:[{signal:c.join(" || ")}],update:"".concat(c.join(" && ")," ? {").concat(l,": [").concat(c,"]} : null")}]})},marks:(e,n,i)=>{const r=n.name,{x:o,y:a}=n.project.hasChannel,s=o&&o.signals.visual,c=a&&a.signals.visual,u="data(".concat(t.stringValue(n.name+gl),")");if(gu.defined(n))return i;const l={x:void 0!==o?{signal:"".concat(s,"[0]")}:{value:0},y:void 0!==a?{signal:"".concat(c,"[0]")}:{value:0},x2:void 0!==o?{signal:"".concat(s,"[1]")}:{field:{group:"width"}},y2:void 0!==a?{signal:"".concat(c,"[1]")}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of B(l))l[t]=[{test:"".concat(u,".length && ").concat(u,"[0].unit === ").concat(xl(e)),...l[t]},{value:0}];const{fill:f,fillOpacity:d,cursor:p,...m}=n.mark,g=B(m).reduce(((e,t)=>(e[t]=[{test:[void 0!==o&&"".concat(s,"[0] !== ").concat(s,"[1]"),void 0!==a&&"".concat(c,"[0] !== ").concat(c,"[1]")].filter((e=>e)).join(" && "),value:m[t]},{value:null}],e)),{});return[{name:"".concat(r+yu,"_bg"),type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:l}},...i,{name:r+yu,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...l,...g}}}]}};function wu(e,t){return e.events.reduce(((e,n)=>n.between?t(e,n):(si("".concat(n," is not an ordered event stream for interval selections.")),e)),[])}const Au={defined:e=>"point"===e.type,signals:(e,n,i)=>{const r=n.name,o=r+du,a=n.project,s="(item().isVoronoi ? datum.datum : datum)",c=a.items.map((n=>{const i=e.fieldDef(n.channel);return i&&i.bin?"[".concat(s,"[").concat(t.stringValue(e.vgField(n.channel,{})),"], ")+"".concat(s,"[").concat(t.stringValue(e.vgField(n.channel,{binSuffix:"end"})),"]]"):"".concat(s,"[").concat(t.stringValue(n.field),"]")})).join(", "),u="unit: ".concat(xl(e),", fields: ").concat(o,", values"),l=n.events;return i.concat([{name:r+hl,on:l?[{events:l,update:"datum && item().mark.marktype !== 'group' ? {".concat(u,": [").concat(c,"]} : null"),force:!0}]:[]}])}};function Du(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 Fu(e,t="text"){const n=e.encoding[t];return Du(e,n,t,(t=>ku(t,e.config)))}function ku(e,t,n="datum"){if(e){if(Wo(e))return gn(e.value);if(qo(e)){const{format:i,formatType:r}=ta(e);return so({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Cu(e,n={}){const{encoding:i,markDef:r,config:o,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:Eu({tooltip:s},a,o,n)};{const c=n.reactiveGeom?"datum.datum":"datum";return Du(e,s,"tooltip",(e=>{const s=ku(e,o,c);if(s)return s;if(null===e)return;let u=xn("tooltip",r,o);return!0===u&&(u={content:"encoding"}),t.isString(u)?{value:u}:t.isObject(u)?an(u)?u:"encoding"===u.content?Eu(i,a,o,n):{signal:c}:void 0}))}}function Su(e,n,i,{reactiveGeom:r}={}){const o={},a=r?"datum.datum":"datum",s=[];function c(r,c){var u;const l=Ke(c),f=Ro(r)?r:{...r,type:e[l].type},d=f.title||ea(f,i),p=t.array(d).join(", ");let m;if(yt(c)){const t="x"===c?"x2":"y2",r=na(e[t]);if($t(f.bin)&&r){const e=Yo(f,{expr:a}),n=Yo(r,{expr:a}),{format:s,formatType:c}=ta(f);m=ho(e,n,s,c,i),o[t]=!0}else if(n&&n.fieldChannel===c&&"normalize"===n.offset){const{format:e,formatType:t}=ta(f);m=so({fieldOrDatumDef:f,format:e,formatType:t,expr:a,config:i,normalizeStack:!0}).signal}}null!==(u=m)&&void 0!==u||(m=ku(f,i,a).signal),s.push({channel:c,key:p,value:m})}Ea(e,((e,t)=>{No(e)?c(e,t):Oo(e)&&c(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of s)o[e]||u[t]||(u[t]=n);return u}function Eu(e,t,n,{reactiveGeom:i}={}){const r=Su(e,t,n,{reactiveGeom:i}),o=z(r).map((([e,t])=>'"'.concat(e,'": ').concat(t)));return o.length>0?{signal:"{".concat(o.join(", "),"}")}:void 0}function Bu(e){const{markDef:t,config:n}=e,i=xn("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},..._u(e),...zu(e)}}function _u(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 ln?{}:{ariaRoleDescription:{value:t}}}function zu(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Du(e,o,"description",(t=>ku(t,e.config)));const a=xn("description",n,i);if(null!=a)return{description:gn(a)};if(!1===i.aria)return{};const s=Su(t,r,i);return E(s)?void 0:{description:{signal:z(s).map((([e,t],n)=>'"'.concat(n>0?"; ":"").concat(e,': " + (').concat(t,")"))).join(" + ")}}}function Ou(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:c}=n;var u;void 0===s&&(null!==(u=c)&&void 0!==u||(c=xn(e,i,o,{vgChannel:a,ignoreVgConfig:!0})),void 0!==c&&(s=gn(c)));const l=r[e];return Du(t,l,null!=a?a:e,(n=>io({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function Pu(e,t={filled:void 0}){var n,i,r,o;const{markDef:a,encoding:s,config:c}=e,{type:u}=a,l=null!==(n=t.filled)&&void 0!==n?n:xn("filled",a,c),f=y(["bar","point","circle","square","geoshape"],u)?"transparent":void 0,d=null!==(i=null!==(r=xn(!0===l?"color":void 0,a,c,{vgChannel:"fill"}))&&void 0!==r?r:c.mark[!0===l&&"color"])&&void 0!==i?i:f,p=null!==(o=xn(!1===l?"color":void 0,a,c,{vgChannel:"stroke"}))&&void 0!==o?o:c.mark[!1===l&&"color"],m=l?"fill":"stroke",g={...d?{fill:gn(d)}:{},...p?{stroke:gn(p)}:{}};return a.color&&(l?a.fill:a.stroke)&&si(In("property",{fill:"fill"in a,stroke:"stroke"in a})),{...g,...Ou("color",e,{vgChannel:m,defaultValue:l?d:p}),...Ou("fill",e,{defaultValue:s.fill?d:void 0}),...Ou("stroke",e,{defaultValue:s.stroke?p:void 0})}}function Nu(e){const{encoding:t,mark:n}=e,i=t.order;return!Rr(n)&&Wo(i)?Du(e,i,"zindex",(e=>gn(e.value))):{}}function ju(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 Mu(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,c=r[e],u=r[et(e)],l=t.scaleName(e),f=t.getScaleComponent(e),d=ju(e,o),p=Tu({model:t,defaultPos:n,channel:e,scaleName:l,scale:f}),m=!c&&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 no({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return to(n,i,{suffix:"end"},{offset:o})}return $r(e)}({channel:e,channelDef:c,channel2Def:u,markDef:o,config:a,scaleName:l,scale:f,stack:s,offset:d,defaultRef:p});return m?{[i||e]:m}:void 0}function Tu({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=Ke(n),c=Ze(n),u=xn(n,o,a,{vgChannel:c});if(void 0!==u)return ro(n,u);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(".concat(e.width.signal,",").concat(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 Lu={left:"x",center:"xc",right:"x2"},qu={top:"y",middle:"yc",bottom:"y2"};function Ru(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)?(si(function(e){return"The ".concat(e," for range marks cannot be an expression")}(r)),a=void 0):a=o,"x"===e?Lu[a||("top"===i?"left":"center")]:qu[a||i]}function Wu(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Uu(e,t,{defaultPos:n,defaultPos2:i}):Mu(e,t,{defaultPos:n})}function Uu(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=et(e),s=tt(e),c=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,c=Ke(n),u=tt(n),l=Ze(n),f=i[c],d=e.scaleName(c),p=e.getScaleComponent(c),m=ju(n in i||n in o?n:c,e.markDef);if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude))return{[l]:{field:e.getName(n)}};const g=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:c,defaultRef:u}){if(qo(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return to(t,o,{suffix:"start"},{offset:c});return $r({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:c,defaultRef:u})}({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{[l]:g};return Hu(n,o)||Hu(n,{[n]:An(n,o,s.style),[u]:An(u,o,s.style)})||Hu(n,s[r])||Hu(n,s.mark)||{[l]:Tu({model:e,defaultPos:t,channel:n,scaleName:d,scale:p})()}}(t,i,a);return{...Mu(e,t,{defaultPos:n,vgChannel:c[s]?Ru(e,r,o):Ze(e)}),...c}}function Hu(e,t){const n=tt(e),i=Ze(e);if(void 0!==t[i])return{[i]:ro(e,t[i])};if(void 0!==t[e])return{[i]:ro(e,t[e])};if(t[n]){const i=t[n];if(!Yr(i))return{[n]:ro(e,i)};si(function(e){return"Position range does not support relative band size for ".concat(e,".")}(n))}}function Iu(e,n,i){var r,o;const{config:a,encoding:s,markDef:c}=e,u=et(n),l=tt(n),f=s[n],d=s[u],p=e.getScaleComponent(n),m=p?p.get("type"):void 0,g=e.scaleName(n),h=c.orient,v=null!==(r=null!==(o=s[l])&&void 0!==o?o:s.size)&&void 0!==r?r:xn("size",c,a,{vgChannel:l}),y="bar"===i&&("x"===n?"vertical"===h:"horizontal"===h);if(!No(f)||!(Qt(f.bin)||$t(f.bin)||f.timeUnit&&!d)||v&&!Yr(v)||lr(m))return(qo(f)&&lr(m)||y)&&!d?function(e,n,i,r){const{markDef:o,encoding:a,config:s,stack:c}=r,u=o.orient,l=r.scaleName(i),f=r.getScaleComponent(i),d=tt(i),p=et(i),m="horizontal"===u&&"y"===i||"vertical"===u&&"x"===i;let g;(a.size||o.size)&&(m?g=Ou("size",r,{vgChannel:d,defaultRef:gn(o.size)}):si(function(e){return'Cannot apply size to non-oriented mark "'.concat(e,'".')}(o.type)));const h=Bo({channel:i,fieldDef:n,markDef:o,config:s,scaleType:null==f?void 0:f.get("type"),useVlSizeChannel:m});g=g||{[d]:Vu(d,l,f,s,h)};const v="band"===(null==f?void 0:f.get("type"))&&"band"in g[d]?"top":"middle",y=Ru(i,o,s,v),b="xc"===y||"yc"===y,x=ju(i,o),w=$r({channel:i,channelDef:n,markDef:o,config:s,scaleName:l,scale:f,stack:c,offset:x,defaultRef:Tu({model:r,defaultPos:"mid",channel:i,scaleName:l,scale:f}),bandPosition:b?.5:an(h)?{signal:"(1-".concat(h,")/2")}:Yr(h)?(1-h.band)/2:0});if(d)return{[y]:w,...g};{const e=Ze(p),n=g[d],i=x?{...n,offset:x}:n;return{[y]:w,[e]:t.isArray(w)?[w[0],{...w[1],offset:i}]:{...w,offset:i}}}}(0,f,n,e):Uu(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"});{var b,x;const t=Bo({channel:n,fieldDef:f,markDef:c,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:c,config:u}){const l=et(n),f=Ze(n),d=Ze(l),p=ju(n,o),m=an(i)?{signal:"(1-".concat(i.signal,")/2")}:Yr(i)?(1-i.band)/2:.5;if(Qt(e.bin)||e.timeUnit)return{[d]:Yu({channel:n,fieldDef:e,scaleName:r,markDef:o,bandPosition:m,offset:Gu(l,a,c,s,p),config:u}),[f]:Yu({channel:n,fieldDef:e,scaleName:r,markDef:o,bandPosition:an(m)?{signal:"1-".concat(m.signal)}:1-m,offset:Gu(n,a,c,s,p),config:u})};if($t(e.bin)){const i=to(e,r,{},{offset:Gu(l,a,c,s,p)});if(No(t))return{[d]:i,[f]:to(t,r,{},{offset:Gu(n,a,c,s,p)})};if(Kt(e.bin)&&e.bin.step)return{[d]:i,[f]:{signal:'scale("'.concat(r,'", ').concat(Yo(e,{expr:"datum"})," + ").concat(e.bin.step,")"),offset:Gu(n,a,c,s,p)}}}return void si(ri(l))}({fieldDef:f,fieldDef2:d,channel:n,markDef:c,scaleName:g,bandSize:t,axisTranslate:null!==(x=null==i?void 0:i.get("translate"))&&void 0!==x?x:.5,spacing:yt(n)?xn("binSpacing",c,a):void 0,reverse:p.get("reverse"),config:a})}}function Vu(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&&(si(function(e){return"Cannot use the relative band size with ".concat(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:ws(r.view,e)-2}}function Gu(e,t,n,i,r){if(Oe(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?"".concat(a," + "):"")+(e?"(".concat(e," ? -1 : 1) * "):"")+(t?"(".concat(t," + ").concat(o,")"):o)}}return r=r||0,i+(n?-r-o:+r+o)}function Yu({channel:e,fieldDef:t,scaleName:n,markDef:i,bandPosition:r,offset:o,config:a}){return Kr({fieldDef:t,channel:e,markDef:i,ref:no({scaleName:n,fieldOrDatumDef:t,bandPosition:r,offset:o}),config:a})}const Xu=new Set(["aria","width","height"]);function Ju(e,t){const{fill:n,stroke:i}="include"===t.color?Pu(e):{};return{...$u(e.markDef,t),...Qu(e,"fill",n),...Qu(e,"stroke",i),...Ou("opacity",e),...Ou("fillOpacity",e),...Ou("strokeOpacity",e),...Ou("strokeWidth",e),...Ou("strokeDash",e),...Nu(e),...Cu(e),...Fu(e,"href"),...Bu(e)}}function Qu(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&&fr(r)&&(t[o]=!0)}return t}),{}),r=B(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>eo(e,t))).join(" ".concat(e," "))}return}(e,{invalid:!0,channels:Pt});if(r)return{[n]:[{test:r,value:null},...t.array(i)]}}return i?{[n]:i}:{}}function $u(e,t){return un.reduce(((n,i)=>(Xu.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=gn(e[i])),n)),{})}function Ku(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&&fr(r)&&(t[o]=!0)}return t}),{}),r=B(i);if(r.length>0){const e=t?"||":"&&";return r.map((e=>eo(e,t))).join(" ".concat(e," "))}return}(e,{channels:vt});if(t)return{defined:{signal:t}}}return{}}function Zu(e,t){if(void 0!==t)return{[e]:gn(t)}}const el="voronoi",tl={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(el)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Rr(o))return si('The "nearest" transform is not supported for '.concat(o," marks.")),n;const a={name:e.getName(el),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Cu(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,c=!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(el)>=0&&(c=!0)})),c||n.splice(s+1,0,a),n}},nl={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!cs(e.bind),parse:(e,t,n)=>Al(t,n),topLevelSignals:(e,n,i)=>{const r=n.name,o=n.project,a=n.bind,s=n.init&&n.init[0],c=tl.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return o.items.forEach(((e,o)=>{const u=P("".concat(r,"_").concat(e.field));var l,f;i.filter((e=>e.name===u)).length||i.unshift({name:u,...s?{init:ru(s[o])}:{value:null},on:n.events?[{events:n.events,update:"datum && item().mark.marktype !== 'group' ? ".concat(c,"[").concat(t.stringValue(e.field),"] : null")}]:[],bind:null!==(l=null!==(f=a[e.field])&&void 0!==f?f:a[e.channel])&&void 0!==l?l:a})})),i},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+hl))[0],a=i+du,s=r.items.map((e=>P("".concat(i,"_").concat(e.field)))),c=s.map((e=>"".concat(e," !== null"))).join(" && ");return s.length&&(o.update="".concat(c," ? {fields: ").concat(a,", values: [").concat(s.join(", "),"]} : null")),delete o.value,delete o.on,n}},il="_toggle",rl={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+il,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+hl,i=t.name+il;return"".concat(i," ? null : ").concat(n,", ")+("global"===t.resolve?"".concat(i," ? null : true, "):"".concat(i," ? null : {unit: ").concat(xl(e),"}, "))+"".concat(i," ? ").concat(n," : null")}},ol={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?eu(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(nl.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===P("".concat(t.name,"_").concat(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+hl));i(e,"null"),rl.defined(t)&&(e=n.findIndex((e=>e.name===t.name+il)),i(e,"false"))}return n}},al={defined:e=>{const t="global"===e.resolve&&e.bind&&cs(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==as;return t&&!n&&si("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},Al(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=us(i.bind)?i.bind.legend:"click",c=t.isString(s)?eu(s,"view"):t.array(s);i.bind={legend:{merge:c}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=us(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="".concat(P(e.field),"_legend"),s="".concat(i,"_").concat(a);if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o("".concat(a,"_symbols"))).concat(r.merge.map(o("".concat(a,"_labels")))).concat(r.merge.map(o("".concat(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 : ".concat(s),force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+hl)),a=i+du,s=r.items.filter((e=>e.hasLegend)).map((e=>P("".concat(i,"_").concat(P(e.field),"_legend")))),c=s.map((e=>"".concat(e," !== null"))).join(" && "),u="".concat(c," ? {fields: ").concat(a,", values: [").concat(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+il)),f=us(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:f}):l.on[0].events=f),n}};const sl="_translate_anchor",cl="_translate_delta",ul={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=gu.defined(t),o=i+sl,{x:a,y:s}=t.project.hasChannel;let c=eu(t.translate,"scope");return r||(c=c.map((e=>(e.between[0].markname=i+yu,e)))),n.push({name:o,value:{},on:[{events:c.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?", extent_x: ".concat(r?hu(e,ee):"slice(".concat(a.signals.visual,")")):"")+(void 0!==s?", extent_y: ".concat(r?hu(e,te):"slice(".concat(s.signals.visual,")")):"")+"}"}]},{name:i+cl,value:{},on:[{events:c,update:"{x: ".concat(o,".x - x(unit), y: ").concat(o,".y - y(unit)}")}]}),void 0!==a&&ll(e,t,a,"width",n),void 0!==s&&ll(e,t,s,"height",n),n}};function ll(e,t,n,i,r){var o,a;const s=t.name,c=s+sl,u=s+cl,l=n.channel,f=gu.defined(t),d=r.filter((e=>e.name===n.signals[f?"data":"visual"]))[0],p=e.getSizeSignalRef(i).signal,m=e.getScaleComponent(l),g=m.get("type"),h=m.get("reverse"),v=f?l===ee?h?"":"-":h?"-":"":"",y="".concat(c,".extent_").concat(l),b="".concat(v).concat(u,".").concat(l," / ").concat(f?"".concat(p):"span(".concat(y,")")),x=f?"log"===g?"panLog":"symlog"===g?"panSymlog":"pow"===g?"panPow":"panLinear":"panLinear",w=f?"pow"===g?", ".concat(null!==(o=m.get("exponent"))&&void 0!==o?o:1):"symlog"===g?", ".concat(null!==(a=m.get("constant"))&&void 0!==a?a:1):"":"",A="".concat(x,"(").concat(y,", ").concat(b).concat(w,")");d.on.push({events:{signal:u},update:f?A:"clampRange(".concat(A,", 0, ").concat(p,")")})}const fl="_zoom_anchor",dl="_zoom_delta",pl={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const r=n.name,o=gu.defined(n),a=r+dl,{x:s,y:c}=n.project.hasChannel,u=t.stringValue(e.scaleName(ee)),l=t.stringValue(e.scaleName(te));let f=eu(n.zoom,"scope");return o||(f=f.map((e=>(e.markname=r+yu,e)))),i.push({name:r+fl,on:[{events:f,update:o?"{"+[u?"x: invert(".concat(u,", x(unit))"):"",l?"y: invert(".concat(l,", 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&&ml(e,n,s,"width",i),void 0!==c&&ml(e,n,c,"height",i),i}};function ml(e,t,n,i,r){var o,a;const s=t.name,c=n.channel,u=gu.defined(t),l=r.filter((e=>e.name===n.signals[u?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(c),p=d.get("type"),m=u?hu(e,c):l.name,g=s+dl,h="".concat(s).concat(fl,".").concat(c),v=u?"log"===p?"zoomLog":"symlog"===p?"zoomSymlog":"pow"===p?"zoomPow":"zoomLinear":"zoomLinear",y=u?"pow"===p?", ".concat(null!==(o=d.get("exponent"))&&void 0!==o?o:1):"symlog"===p?", ".concat(null!==(a=d.get("constant"))&&void 0!==a?a:1):"":"",b="".concat(v,"(").concat(m,", ").concat(h,", ").concat(g).concat(y,")");l.on.push({events:{signal:g},update:u?b:"clampRange(".concat(b,", 0, ").concat(f,")")})}const gl="_store",hl="_tuple",vl="_modify",yl="vlSelectionResolve",bl=[Au,xu,mu,rl,nl,gu,al,ol,ul,pl,tl];function xl(e,{escape:n}={escape:!0}){let i=n?t.stringValue(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!bm(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const n of Le)e[n]&&(i+=" + '__facet_".concat(n,"_' + (facet[").concat(t.stringValue(r.vgField(n)),"])"))}return i}function wl(e){var t;return _(null!==(t=e.component.selection)&&void 0!==t?t:{}).reduce(((e,t)=>e||t.project.items.some((e=>e.field===as))),!1)}function Al(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 Dl="RawCode",Fl="Literal",kl="Property",Cl="Identifier",Sl="ArrayExpression",El="BinaryExpression",Bl="CallExpression",_l="ConditionalExpression",zl="LogicalExpression",Ol="MemberExpression",Pl="ObjectExpression",Nl="UnaryExpression";function jl(e){this.type=e}var Ml,Tl,Ll,ql,Rl;jl.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case Sl:return e.elements;case El:case zl:return[e.left,e.right];case Bl:return[e.callee].concat(e.arguments);case _l:return[e.test,e.consequent,e.alternate];case Ol:return[e.object,e.property];case Pl:return e.properties;case kl:return[e.key,e.value];case Nl:return[e.argument];case Cl:case Fl:case Dl:default:return[]}}(this),n=0,i=t.length;n",Ml[3]="Identifier",Ml[4]="Keyword",Ml[5]="Null",Ml[6]="Numeric",Ml[7]="Punctuator",Ml[8]="String",Ml[9]="RegularExpression";var Wl="Identifier",Ul="Unexpected token %0",Hl="Invalid regular expression",Il="Invalid regular expression: missing /",Vl="Octal literals are not allowed in strict mode.",Gl="ILLEGAL",Yl="Disabled.",Xl=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]"),Jl=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 Ql(e,t){if(!e)throw new Error("ASSERT: "+t)}function $l(e){return e>=48&&e<=57}function Kl(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function Zl(e){return"01234567".indexOf(e)>=0}function ef(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 tf(e){return 10===e||13===e||8232===e||8233===e}function nf(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Xl.test(String.fromCharCode(e))}function rf(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Jl.test(String.fromCharCode(e))}const of={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 af(){for(;Ll1114111||"}"!==e)&&Df({},Ul,Gl),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function uf(){var e,t;for(e=Tl.charCodeAt(Ll++),t=String.fromCharCode(e),92===e&&(117!==Tl.charCodeAt(Ll)&&Df({},Ul,Gl),++Ll,(e=sf("u"))&&"\\"!==e&&nf(e.charCodeAt(0))||Df({},Ul,Gl),t=e);Ll>>="===(i=Tl.substr(Ll,4))?{type:7,value:i,start:r,end:Ll+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:Ll+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===t?{type:7,value:t,start:r,end:Ll+=2}:("//"===t&&Df({},Ul,Gl),"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:r,end:++Ll}:void Df({},Ul,Gl))}function df(){var e,t,n;if(Ql($l((n=Tl[Ll]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=Ll,e="","."!==n){if(e=Tl[Ll++],n=Tl[Ll],"0"===e){if("x"===n||"X"===n)return++Ll,function(e){let t="";for(;Ll=0&&Df({},Hl,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";Df({},Hl)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Df({},Hl)}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:Ll}}function mf(){if(af(),Ll>=ql)return{type:2,start:Ll,end:Ll};const e=Tl.charCodeAt(Ll);return nf(e)?lf():40===e||41===e||59===e?ff():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(Ql("'"===(e=Tl[Ll])||'"'===e,"String literal must starts with a quote"),t=Ll,++Ll;Ll=0&&Ll(Ql(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,c,u;if(e=Rl,c=Lf(),0===(r=qf(i=Rl)))return c;for(i.prec=r,gf(),t=[e,Rl],o=[c,i,a=Lf()];(r=qf(Rl))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,c=o.pop(),t.pop(),n=vf(s,c,a),o.push(n);(i=gf()).prec=r,o.push(i),t.push(Rl),n=Lf(),o.push(n)}for(n=o[u=o.length-1],t.pop();u>1;)t.pop(),n=vf(o[u-1].value,o[u-2],n),u-=2;return n}(),Cf("?")&&(gf(),t=Rf(),kf(":"),e=function(e,t,n){const i=new jl("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(Yl);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){Ll=0,ql=(Tl=e).length,Rl=null,hf();const t=Wf();if(2!==Rl.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 uu{clone(){return new Vf(null,this.model,d(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,En(this,"expr",void 0),En(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 ".concat(this.expr)}}function Gf(e,n,i,r="datum"){const o=t.isString(n)?n:n.param,a=P(o),s=t.stringValue(a+gl);let c;try{c=e.getSelectionComponent(a,o)}catch(e){return"!!".concat(a)}if(c.project.timeUnit){const t=null!=i?i:e.component.data.raw,n=c.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const u="vlSelectionTest(".concat(s,", ").concat(r)+("global"===c.resolve?")":", ".concat(t.stringValue(c.resolve),")")),l="length(data(".concat(s,"))");return!1===n.empty?"".concat(l," && ").concat(u):"!".concat(l," || ").concat(u)}function Yf(e,n,i){const r=P(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,si((e.length?"Multiple ":"No ")+"matching ".concat(t.stringValue(o)," encoding found for selection ").concat(t.stringValue(i.param),". ")+'Using "field": '.concat(t.stringValue(s),"."))):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&si('A "field" or "encoding" must be specified when using a selection as a scale domain. '+'Using "field": '.concat(t.stringValue(s),"."));return"".concat(a.name,"[").concat(t.stringValue(R(s)),"]")}function Xf(e,n,i){return N(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,c;null!==(r=e.encode)&&void 0!==r||(e.encode={}),null!==(a=(o=e.encode)[t])&&void 0!==a||(o[t]={}),null!==(c=(s=e.encode[t]).update)&&void 0!==c||(s.update={}),e.encode[t].update[n]=i}function Qf(e,n,i,r={header:!1}){const{disable:o,orient:a,scale:s,labelExpr:c,title:u,zindex:l,...f}=e.combine();if(!o){for(const e in f){const i=ha[e],r=f[e];if(i&&i!==n&&"both"!==i)delete f[e];else if(ma(r)){const{condition:n,...i}=r,o=t.array(n),a=pa[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"".concat(Xf(null,t)," ? ").concat(hn(n)," : ")})).join("")+hn(i)};f[e]=t}}else if(an(r)){const t=pa[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}:{}},E(f.encode)&&delete f.encode}return{scale:s,orient:a,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:I(l,0)}}{if(!r.header&&e.mainExtracted)return;if(void 0!==c){var d,p;let e=c;null!==(d=f.encode)&&void 0!==d&&null!==(p=d.labels)&&void 0!==p&&p.update&&an(f.encode.labels.update.text)&&(e=W(c,"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 ga)e.hasAxisPart(t)||delete f.encode[t];E(f.encode)&&delete f.encode}const n=function(e,n){if(e)return t.isArray(e)&&!on(e)?e.map((e=>ea(e,n))).join(", "):e}(u,i);return{scale:s,orient:a,grid:!1,...n?{title:n}:{},...f,...!1===i.aria?{aria:!1}:{},zindex:I(l,0)}}}}function $f(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 Kf(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([...B(r),...B(o)]),s={};for(const t of a.values())s[t]={signal:"".concat(i.signal,' === "').concat(e,'" ? ').concat(vn(r[t])," : ").concat(vn(o[t]))};return s}return t[e]}))])}function Zf(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:function(e){return e in or}(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=an(n)?"axisOrient":"axis".concat(M(n)),s=[...r,...r.map((e=>o+e.substr(4)))],c=["axis",a,o];return{vlOnlyAxisConfig:Kf(s,i,e,n),vgAxisConfig:Kf(c,i,e,n),axisConfigStyle:ed([...c,...s],i)}}function ed(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 td(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 nd={scale:({model:e,channel:t})=>e.scaleName(t),format:({fieldOrDatumDef:e,config:t,axis:n})=>{const{format:i,formatType:r}=n;return lo(e,e.type,i,r,t,!0)},formatType:({axis:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return fo(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!lr(e)&&No(t)&&!Qt(null==t?void 0:t.bin)&&!$t(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||od(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||rd(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&&!lr(t)&&"log"!==t){if(No(e)){var r;if(Qt(e.bin))return{signal:"ceil(".concat(n.signal,"/10)")};if(e.timeUnit&&y(["month","hours","day","quarter"],null===(r=Di(e.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:"ceil(".concat(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=ad(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return kn(r?[Co(r)]:[],No(a)?[Co(a)]:[])},values:({axis:e,fieldOrDatumDef:n})=>function(e,n){const i=e.values;if(t.isArray(i))return fa(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 id(e){return"(((".concat(e.signal," % 360) + 360) % 360)")}function rd(e,t,n,i){if(void 0!==e){if("x"===n){if(an(e)){const n=id(e),i=an(t)?"(".concat(t.signal,' === "top")'):"top"===t;return{signal:"(45 < ".concat(n," && ").concat(n," < 135) || (225 < ").concat(n," && ").concat(n,' < 315) ? "middle" :')+"(".concat(n," <= 45 || 315 <= ").concat(n,") === ").concat(i,' ? "bottom" : "top"')}}if(45{if(Uo(t)&&Ao(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>"".concat(Pi({field:i,timeUnit:r,equal:e})," ? ").concat(t," : "))).join("")+o.length;e=new sd(e,{calculate:a,as:cd(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 ".concat(h(this.transform))}}function cd(e,t,n){return Yo(e,{prefix:t,suffix:"sort_index",...null!=n?n:{}})}function ud(e,t){return y(["top","bottom"],t)?"column":y(["left","right"],t)||"row"===e?"row":"column"}function ld(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return I((t||{})[e],r[e],n.header[e])}function fd(e,t,n,i){const r={};for(const o of e){const e=ld(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const dd=["row","column"],pd=["header","footer"];function md(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}=fd(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),c=ud(t,s),u=J(a);return{name:"".concat(t,"-title"),type:"group",role:"".concat(c,"-title"),title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...hd(u,c),...gd(c,u,o),...Dd(i,r,t,ns,es)}}}function gd(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=od(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function hd(e,t){const n=rd(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function vd(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of pd)if(n[r])for(const o of n[r]){const a=xd(e,t,r,n,o);null!=a&&i.push(a)}return i}function yd(e,n){const{sort:i}=e;var r;return wo(i)?{field:Yo(i,{expr:"datum"}),order:null!==(r=i.order)&&void 0!==r?r:"ascending"}:t.isArray(i)?{field:cd(e,n,{expr:"datum"}),order:"ascending"}:{field:Yo(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function bd(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:c}=fd(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),u=so({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,l=ud(t,s);return{text:{signal:c?W(W(c,"datum.label",u),"datum.value",Yo(e,{expr:"parent"})):u},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...hd(o,l),...gd(l,o,a),...Dd(n,e,t,is,ts)}}function xd(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}=fd(["labelOrient"],a.header,s,t);("row"===t&&!y(["top","bottom"],e)||"column"===t&&!y(["left","right"],e))&&(o=bd(a,t,s))}const c=bm(e)&&!Do(e.facet),u=r.axes,l=(null==u?void 0:u.length)>0;if(o||l){const s="row"===t?"height":"width";return{name:e.getName("".concat(t,"_").concat(n)),type:"group",role:"".concat(t,"-").concat(n),...i.facetFieldDef?{from:{data:e.getName("".concat(t,"_domain"))},sort:yd(a,t)}:{},...l&&c?{from:{data:e.getName("facet_domain_".concat(t))}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...l?{axes:u}:{}}}}return null}const wd={column:{start:0,end:1},row:{start:1,end:0}};function Ad(e,t){return wd[t][e]}function Dd(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=ld(a,null==t?void 0:t.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function Fd(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(lr(i)&&sn(o)){const i=e.scaleName(n);if(bm(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('".concat(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=xs(e.config.view,t?"width":"height"),o="isFinite(".concat(n,") ? ").concat(n," : ").concat(i);return[{name:r,init:o,on:[{update:o,events:"window:resize"}]}]}return[{name:r,value:i}]}function Cd(e,t){return{name:"".concat(e,"_step"),value:t.step}}function Sd(e,t,n){const i=t.get("type"),r=t.get("padding"),o=I(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,"bandspace(".concat(n,", ").concat(vn(a),", ").concat(vn(o),") * ").concat(e,"_step")}function Ed(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Bd(e,t){return B(e).reduce(((n,i)=>{const r=e[i];return{...n,...Du(t,r,i,(e=>gn(e.value)))}}),{})}function _d(e,t){if(wm(t)||bm(t))return"shared";if(xm(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]&&si(function(e){return'Setting the scale to be independent for "'.concat(e,'" means we also have to set the guide (axis or legend) to be independent.')}(t)),"independent"):e[i][t]||"shared"}const Od=B({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 Pc{}const Nd={symbols:function(e,{fieldOrDatumDef:n,model:i,channel:r,legendCmpt:o,legendType:a}){var s,c,u,l;if("symbol"!==a)return;const{markDef:f,encoding:d,config:p,mark:m}=i,g=f.filled&&"trail"!==m;let h={...yn({},i,Ir),...Pu(i,{filled:g})};const v=null!==(s=o.get("symbolOpacity"))&&void 0!==s?s:p.legend.symbolOpacity,y=null!==(c=o.get("symbolFillColor"))&&void 0!==c?c:p.legend.symbolFillColor,b=null!==(u=o.get("symbolStrokeColor"))&&void 0!==u?u:p.legend.symbolStrokeColor,x=void 0===v?null!==(l=jd(d.opacity))&&void 0!==l?l: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=I(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},E(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 c={};const u=void 0===(null!==(r=i.get("gradientOpacity"))&&void 0!==r?r:o.legend.gradientOpacity)?jd(s.opacity)||a.opacity:void 0;u&&(c.opacity=gn(u));return c={...c,...e},E(c)?void 0:c},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,c=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:u,formatType:l}=o,f=oo(l)?uo({fieldOrDatumDef:t,field:"datum.value",format:u,formatType:l,config:a}):void 0,d={...c?{opacity:c}:{},...f?{text:f}:{},...e};return E(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)=>I(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=>{const n=t.stringValue(P(e)+gl);return"(!length(data(".concat(n,")) || (").concat(e,"[").concat(o,"] && indexof(").concat(e,"[").concat(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 lo(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return fo(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:c}=e;if(dr(r))return"horizontal"===n?"top"===i||"bottom"===i?Ud(t,"width",a,o):a:Ud(t,"height",c,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})=>Ko(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Me(n)&&dr(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 fa(n,i);if(an(i))return i;return}(n,e)};function Rd(e){const{legend:t}=e;return I(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Me(e)){if(y(["quarter","month","day"],t))return"symbol";if(dr(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){const r=e.getSizeSignalRef(t).signal;return{signal:"clamp(".concat(r,", ").concat(n,", ").concat(i,")")}}function Hd(e){const t=ym(e)?function(e){const{encoding:t}=e,n={};for(const i of[de,...os]){const r=ia(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 B(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 B(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:c}=e,u=c.legend,l=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 _(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&&al.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,l);const f=void 0!==o?!o:u.disable;if(l.set("disable",f,void 0!==o),f)return l;o=o||{};const d=e.getScaleComponent(t).get("type"),p=ia(s[t]),m=No(p)?null===(n=Di(p.timeUnit))||void 0===n?void 0:n.unit:void 0,g=o.orient||c.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:u,config:c,scaleType:d,orient:g,legendType:h,direction:Wd({legend:o,legendType:h,orient:g,legendConfig:u})};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===c.legend[n])&&l.set(n,i,r)}}const y=null!==(i=null===(r=o)||void 0===r?void 0:r.encoding)&&void 0!==i?i:{},b=l.get("selections"),x={},w={fieldOrDatumDef:p,model:e,channel:t,legendCmpt:l,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||E(i)||(x[t]={...null!=b&&b.length&&No(p)?{name:"".concat(P(p.field),"_legend_").concat(t)}:{},...null!=b&&b.length?{interactive:!!b}:{},update:i})}var D;E(x)||l.set("encode",x,!(null===(D=o)||void 0===D||!D.encoding));return l}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=Lc(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return Yd(e,t);case"title":return Sn(e,t);case"type":return r=!0,jc("symbol")}return Tc(e,t,n,"legend")}));e.setWithExplicit(n,i)}var o,a,s,c;r&&(null!==(o=e.implicit)&&void 0!==o&&null!==(a=o.encode)&&void 0!==a&&a.gradient&&j(e.implicit,["encode","gradient"]),null!==(s=e.explicit)&&void 0!==s&&null!==(c=s.encode)&&void 0!==c&&c.gradient&&j(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 B(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 _(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 os)a[t]&&delete e[t]}a.title||delete a.title;if(void 0!==r){var s,c;let e=r;null!==(s=a.encode)&&void 0!==s&&null!==(c=s.labels)&&void 0!==c&&c.update&&an(a.encode.labels.update.text)&&(e=W(r,"datum.label",a.encode.labels.update.text.signal)),function(e,t,n,i){var r,o,a,s,c;null!==(r=e.encode)&&void 0!==r||(e.encode={}),null!==(a=(o=e.encode)[t])&&void 0!==a||(o[t]={}),null!==(c=(s=e.encode[t]).update)&&void 0!==c||(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 wm(e)||xm(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:"[".concat(t.size.map((e=>e.signal)).join(", "),"]")},o=t.data.reduce(((t,n)=>{const i=an(n)?n.signal:"data('".concat(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?"[".concat(o.join(", "),"]"):o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const $d=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class Kd extends Pc{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,En(this,"merged",!1)}get isFit(){return!!this.data}}function Zd(e){e.component.projection=ym(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[[ue,ce],[fe,le]])(ia(n[i[0]])||ia(n[i[1]]))&&t.push({signal:e.getName("geojson_".concat(t.length))});e.channelHasField(ge)&&e.typedFieldDef(ge).type===Ri&&t.push({signal:e.getName("geojson_".concat(t.length))});0===t.length&&t.push(e.requestDataName(Yc.Main));return t}(e):void 0,a=new Kd(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)Zd(t);const i=x(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=x($d,(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 Kd(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 ep(e,t,n,i){if(da(t,n)){var r,o;const a=ym(e)&&null!==(r=null!==(o=e.axis(n))&&void 0!==o?o:e.legend(n))&&void 0!==r?r:{},s=Yo(t,{expr:"datum"}),c=Yo(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Yo(t,{binSuffix:"range",forAs:!0}),formula:ho(s,c,a.format,a.formatType,i)}}return{}}function tp(e,t){return"".concat(Jt(e),"_").concat(t)}function np(e,t,n){var i;const r=tp(null!==(i=sa(n,void 0))&&void 0!==i?i:{},t);return e.getName("".concat(r,"_bins"))}function ip(e,n,i){let r,o;r=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,"".concat(e.as,"_end")]:[e.as[0],e.as[1]]:[Yo(e,{forAs:!0}),Yo(e,{binSuffix:"end",forAs:!0})];const a={...sa(n,void 0)},s=tp(a,e.field),{signal:c,extentSignal:u}=function(e,t){return{signal:e.getName("".concat(t,"_bins")),extentSignal:e.getName("".concat(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],...c?{signal:c}:{},...u?{extentSignal:u}:{},...o?{span:o}:{}}}}class rp extends uu{clone(){return new rp(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)&&Qt(n.bin)){const{key:r,binComponent:o}=ip(n,n.bin,t);e[r]={...o,...e[r],...ep(t,n,i,t.config)}}return e}),{});return E(n)?null:new rp(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=ip(t,t.bin,n);return new rp(e,{[i]:r})}merge(e,t){for(const n of B(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(_(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(_(this.bins).map((e=>e.field)))}hash(){return"Bin ".concat(h(this.bins))}assemble(){return _(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:R(e.field),as:n,signal:e.signal,...Zt(r)?{extent:null}:{extent:r},...e.span?{span:{signal:"span(".concat(e.span,")")}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:R(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 op(e,t,n,i){const r=ym(i)?i.encoding[et(t)]:void 0;if(Ro(n)&&ym(i)&&_o(n,r,i.markDef,i.config))e.add(Yo(n,{})),e.add(Yo(n,{suffix:"end"})),n.bin&&da(n,t)&&e.add(Yo(n,{binSuffix:"range"}));else if(t in Pe){const n=function(e){switch(e){case ce:return"y";case le:return"y2";case ue:return"x";case fe:return"x2"}}(t);e.add(i.getName(n))}else e.add(Yo(n));return e}class ap extends uu{clone(){return new ap(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(Ut(o)||Ht(o)){var c;const e=Ut(o)?"argmin":"argmax",t=o[e];null!==(c=i[t])&&void 0!==c||(i[t]={}),i[t][e]=new Set([Yo({op:e,field:t},{forAs:!0})])}else{var u;null!==(u=i[a])&&void 0!==u||(i[a]={}),i[a][o]=new Set([Yo(e,{forAs:!0})])}var l;if(Nt(n)&&"unaggregated"===t.scaleDomain(n))null!==(l=i[a])&&void 0!==l||(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 op(r,n,e,t)})),r.size+B(i).length===0?null:new ap(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+B(i).length===0?null:new ap(e,n,i)}merge(e){return F(this.dimensions,e.dimensions)?(function(e,t){for(const i of B(t)){const r=t[i];for(const t of B(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){ai.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...B(this.measures)])}producedFields(){const e=new Set;for(const t of B(this.measures))for(const n of B(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add("".concat(n,"_").concat(t)):i.forEach(e.add,e)}return e}hash(){return"Aggregate ".concat(h({dimensions:this.dimensions,measures:this.measures}))}assemble(){const e=[],t=[],n=[];for(const i of B(this.measures))for(const r of B(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:R(i));return{type:"aggregate",groupby:[...this.dimensions].map(R),ops:e,fields:t,as:n}}}class sp extends uu{constructor(e,n,i,r){super(e),this.model=n,this.name=i,this.data=r,En(this,"column",void 0),En(this,"row",void 0),En(this,"facet",void 0),En(this,"childModel",void 0);for(const e of Le){const i=n.facet[e];if(i){const{bin:r,sort:o}=i;this[e]={name:n.getName("".concat(e,"_domain")),fields:[Yo(i),...Qt(r)?[Yo(i,{binSuffix:"end"})]:[]],...wo(o)?{sortField:o}:t.isArray(o)?{sortIndexField:cd(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of Le)this[t]&&(e+=" ".concat(t.charAt(0),":").concat(h(this[t])));return e}get fields(){const e=[];for(const n of Le){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 Le)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(lr(i)&&sn(r)){const n=$p(Kp(this.childModel,t));n?e[t]=n:si(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_".concat(n[i])),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push("distinct_".concat(n[i])));const{sortField:s,sortIndexField:c}=this[e];if(s){const{op:e=vo,field:t}=s;r.push(t),o.push(e),a.push(Yo(s,{forAs:!0}))}else c&&(r.push(c),o.push("max"),a.push(c));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 dd){for(const t of pd){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("'.concat(this.facet.name,'"))'),r="row"===e?t?{signal:"ceil(".concat(n," / ").concat(t,")")}:1:t?{signal:"min(".concat(n,", ").concat(t,")")}:{signal:n};i.push({name:"".concat(this.facet.name,"_").concat(e),transform:[{type:"sequence",start:0,stop:r}]})}}const{row:s,column:c}=r;return(s||c)&&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_".concat(this.column.name,"_").concat(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,$])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function cp(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function up(e){const n={};return u(e.filter,(e=>{if(zi(e)){let r=null;if(Fi(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&&(ci(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 lp(e){const n={};function i(e){var i;ua(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&y(["min","max"],i))?n[e.field]="number":H(e.field)>1?e.field in n||(n[e.field]="flatten"):Uo(e)&&wo(e.sort)&&H(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((ym(e)||bm(e))&&e.forEachFieldDef(((t,n)=>{if(Ro(t))i(t);else{const r=Ke(n),o=e.fieldDef(r);i({...t,type:o.type})}})),ym(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 fp extends uu{clone(){return new fp(null,d(this._parse))}constructor(e,t){super(e),En(this,"_parse",void 0),this._parse=t}hash(){return"Parse ".concat(h(this._parse))}static makeExplicit(e,t,n){let i={};const r=t.data;return!Hc(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 B(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]:si(Wn(e,n[e],t.value)))}for(const e of B(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:si(Wn(e,t[e],n)))}const r=new Pc(t,n);i.copyAll(r);const o={};for(const e of B(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===B(o).length||i.parseNothing?null:new fp(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of B(this._parse)){const n=this._parse[t];1===H(t)&&(e[t]=n)}return e}producedFields(){return new Set(B(this._parse))}dependentFields(){return new Set(B(this._parse))}assembleTransforms(e=!1){return B(this._parse).filter((t=>!e||H(t)>1)).map((e=>{const t=function(e,t){const n=T(e);if("number"===t)return"toNumber(".concat(n,")");if("boolean"===t)return"toBoolean(".concat(n,")");if("string"===t)return"toString(".concat(n,")");if("date"===t)return"toDate(".concat(n,")");if("flatten"===t)return n;if(t.startsWith("date:")){const e=cp(t.slice(5,t.length));return"timeParse(".concat(n,",'").concat(e,"')")}if(t.startsWith("utc:")){const e=cp(t.slice(4,t.length));return"utcParse(".concat(n,",'").concat(e,"')")}return si('Unrecognized parse "'.concat(t,'".')),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:U(e)}})).filter((e=>null!==e))}}class dp extends uu{clone(){return new dp(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([as])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:as}}}class pp extends uu{clone(){return new pp(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return"Graticule ".concat(h(this.params))}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class mp extends uu{clone(){return new mp(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 ".concat(h(this.params))}assemble(){return{type:"sequence",...this.params}}}class gp extends uu{constructor(e){var t;let n;if(super(null),En(this,"_data",void 0),En(this,"_name",void 0),En(this,"_generator",void 0),null!==(t=e)&&void 0!==t||(e={name:"source"}),Hc(e)||(n=e.format?{...m(e.format,["parse"])}:{}),Wc(e))this._data={values:e.values};else if(Rc(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 Vc(e)?this._data={values:[{type:"Sphere"}]}:(Uc(e)||Hc(e))&&(this._data={});this._generator=Hc(e),e.name&&(this._name=e.name),n&&!E(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 hp(e){return e instanceof gp||e instanceof pp||e instanceof mp}var vp=new WeakMap;class yp{constructor(){vp.set(this,{writable:!0,value:void 0}),Bn(this,vp,!1)}setModified(){Bn(this,vp,!0)}get modifiedFlag(){return function(e,t){var n=t.get(e);if(!n)throw new TypeError("attempted to get private field on non-instance");return n.get?n.get.call(e):n.value}(this,vp)}}class bp extends yp{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 xp extends yp{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class wp extends xp{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 Ap extends xp{constructor(e){super(),En(this,"requiresSelectionId",void 0),this.requiresSelectionId=e&&wl(e)}run(e){e instanceof dp&&(this.requiresSelectionId&&(hp(e.parent)||e.parent instanceof ap||e.parent instanceof fp)||(this.setModified(),e.remove()))}}class Dp extends yp{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof fu&&(n=e.producedFields(),k(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 Fp extends xp{constructor(){super()}run(e){e instanceof lu&&!e.isRequired()&&(this.setModified(),e.remove())}}class kp extends bp{run(e){if(!(hp(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof fp)if(e instanceof fp)this.setModified(),e.merge(t);else{if(S(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Cp extends bp{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof fp));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 B(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!E(i)){this.setModified();const n=new fp(e,i);for(const r of t){if(r instanceof fp)for(const e of B(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof fp&&0===B(r.parse).length&&r.remove()}}}}}class Sp extends bp{run(e){e instanceof lu||e.numChildren()>0||e instanceof sp||e instanceof gp||(this.setModified(),e.remove())}}class Ep extends bp{run(e){const t=e.children.filter((e=>e instanceof fu)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class Bp extends bp{run(e){const t=e.children.filter((e=>e instanceof ap)),n={};for(const e of t){const t=h(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of B(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 bp{constructor(e){super(),this.model=e}run(e){const t=!(hp(e)||e instanceof Vf||e instanceof fp||e instanceof dp),n=[],i=[];for(const r of e.children)r instanceof rp&&(t&&!S(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 rp?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 bp{run(e){const t=[...e.children];if(!b(t,(e=>e instanceof lu))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof lu){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof lu))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 uu{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 ".concat(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 uu{clone(){return new Pp(null,d(this._stack))}constructor(e,t){super(e),En(this,"_stack",void 0),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:r,as:o,offset:a="zero"}=n,s=[],c=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),c.push(I(e.order,"ascending"));const u={field:s,order:c};let l;return l=function(e){return t.isArray(e)&&e.every((e=>t.isString(e)))&&e.length>1}(o)?o:t.isString(o)?[o,"".concat(o,"_end")]:["".concat(n.stack,"_start"),"".concat(n.stack,"_end")],new Pp(e,{stackField:i,groupby:r,offset:a,sort:u,facetby:[],as:l})}static makeFromEncoding(e,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannel:o,fieldChannel:a,offset:s,impute:c}=i;let u;if(o){u=na(r[o])}const l=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):l.reduce(((e,t)=>(e.field.push(t),e.order.push("y"===a?"descending":"ascending"),e)),{field:[],order:[]}),new Pp(e,{dimensionFieldDef:u,stackField:n.vgField(a),facetby:[],stackby:l,sort:d,offset:s,impute:c,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 ".concat(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:c}=this._stack;if(s&&n){const{bandPosition:o=.5,bin:a}=n;a&&e.push({type:"formula",expr:"".concat(o,"*")+Yo(n,{expr:"datum"})+"+".concat(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:c,offset:a}),e}}class Np extends uu{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 ".concat(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=>It(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 c;a.push(e.field),s.push(null!==(c=e.order)&&void 0!==c?c:"ascending")}const u={field:a,order:s},l=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:u,...void 0!==l?{ignorePeers:l}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function jp(e){if(e instanceof sp)if(1!==e.numChildren()||e.children[0]instanceof lu){const n=e.model.component.data.main;Mp(n);const i=(t=e,function e(n){if(!(n instanceof sp)){const i=n.clone();if(i instanceof lu){const e=Tp+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof ap||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 ap||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 lu&&e.type===Yc.Main&&1===e.numChildren()){const t=e.children[0];t instanceof sp||(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 Fp,i)||r,r=qp(new Ap(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 Dp,i)||r,r=qp(new Cp,i)||r,r=qp(new Bp,i)||r,r=qp(new Ep,i)||r,r=qp(new wp,i)||r,r=qp(new zp,i)||r),e.sources=i,r}class Wp{constructor(e){En(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Wp((()=>e(t)))}}function Up(e){ym(e)?function(e){const t=e.component.scales;for(const n of B(t)){const i=Hp(e,n);if(t[n].setWithExplicit("domains",i),Yp(e,n),e.component.data.isFaceted){let t=e;for(;!bm(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)cn(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 B(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"):Lc(i,e.getWithExplicit("domains"),"domains","scale",Jp);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&si(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 si(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&&ia(i.x2)?ia(i.x)?Lc(Vp(n,r,e,"x"),Vp(n,r,e,"x2"),"domain","scale",Jp):Vp(n,r,e,"x2"):"y"===t&&ia(i.y2)?ia(i.y)?Lc(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=Di(n))||void 0===i?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>{const i=la(e,{timeUnit:n,type:t});return{signal:"{data: ".concat(i,"}")}}))}(e,t,r):[e]}function Vp(e,n,i,r){const{encoding:o}=i,a=ia(o[r]),{type:s}=a,c=a.timeUnit;if(function(e){return e&&e.unionWith}(n)){const t=Vp(e,void 0,i,r),o=Ip(n.unionWith,s,c);return Nc([...t.value,...o])}if(an(n))return Nc([n]);if(n&&"unaggregated"!==n&&!mr(n))return Nc(Ip(n,s,c));const u=i.stack;if(u&&r===u.fieldChannel){if("normalize"===u.offset)return jc([[0,1]]);const e=i.requestDataName(Yc.Main);return jc([{data:e,field:i.vgField(r,{suffix:"start"})},{data:e,field:i.vgField(r,{suffix:"end"})}])}const l=Nt(r)&&No(a)?function(e,t,n){if(!lr(n))return;const i=e.fieldDef(t),r=i.sort;if(Ao(r))return{op:"min",field:cd(i,t),order:"ascending"};const{stack:o}=e,a=o?[...o.groupbyField?[o.groupbyField]:[],...o.stackBy.map((e=>e.fieldDef.field))]:void 0;if(wo(r)){return Gp(r,o&&!y(a,r.field))}if(xo(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:c}=i,u=o&&!y(a,c);if(Ut(s)||Ht(s))return Gp({field:Yo(i),order:n},u);if(It(s)||!s)return Gp({op:s,field:c,order:n},u)}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 jc(Ip([a.datum],s,c))}const f=a;if("unaggregated"===n){const e=i.requestDataName(Yc.Main),{field:t}=a;return jc([{data:e,field:Yo({field:t,aggregate:"min"})},{data:e,field:Yo({field:t,aggregate:"max"})}])}if(Qt(f.bin)){if(lr(e))return jc("bin-ordinal"===e?[]:[{data:O(l)?i.requestDataName(Yc.Main):i.requestDataName(Yc.Raw),field:i.vgField(r,da(f,r)?{binSuffix:"range"}:{}),sort:!0!==l&&t.isObject(l)?l:{field:i.vgField(r,{}),op:"min"}}]);{const{bin:e}=f;if(Qt(e)){const t=np(i,f.field,e);return jc([new Wp((()=>{const e=i.getSignalName(t);return"[".concat(e,".start, ").concat(e,".stop]")}))])}return jc([{data:i.requestDataName(Yc.Main),field:i.vgField(r,{})}])}}if(f.timeUnit&&y(["time","utc"],e)&&_o(f,ym(i)?i.encoding[et(r)]:void 0,i.markDef,i.config)){const e=i.requestDataName(Yc.Main);return jc([{data:e,field:i.vgField(r)},{data:e,field:i.vgField(r,{suffix:"end"})}])}return jc(l?[{data:O(l)?i.requestDataName(Yc.Main):i.requestDataName(Yc.Raw),field:i.vgField(r),sort:l}]:[{data:i.requestDataName(Yc.Main),field:i.vgField(r)}])}function Gp(e,t){const{op:n,field:i,order:r}=e;return{op:null!=n?n:t?"sum":vo,...i?{field:R(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=mr(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)&&!Xt[i]?{valid:!1,reason:$n(i)}:"quantitative"===r&&"log"===n?{valid:!1,reason:Kn(e)}:{valid:!0}:{valid:!1,reason:Qn(e)}}function Jp(e,t,n,i){return e.explicit&&t.explicit&&si(function(e,t,n,i){return"Conflicting ".concat(t.toString(),' property "').concat(e.toString(),'" (').concat(g(n)," and ").concat(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(cn(e)){const{sort:t,...n}=e;return n}return e})),h),i=D(e.map((e=>{if(cn(e)){const t=e.sort;return void 0===t||O(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(cn(n)&&i.length>0){let e=i[0];if(i.length>1)si(ti),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=>O(e)||!("op"in e)||t.isString(e.op)&&e.op in Wt?e:(si(function(e){return"Dropping sort property ".concat(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&&(si(ti),o=!0);const a=D(e.map((e=>cn(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 $p(e){if(cn(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(cn(i)&&t.isString(i.field))if(n){if(n!==i.field)return si("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 si("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)){si("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 Kp(e,t){return Qp(e.component.scales[t].get("domains").map((t=>(cn(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function Zp(e){return wm(e)||xm(e)?e.children.reduce(((e,t)=>e.concat(Zp(t))),em(e)):em(e)}function em(e){return B(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:c,domains:u,range:l,reverse:f,...d}=o,p=function(e,n,i,r){if(yt(i)){if(sn(e))return{step:{signal:"".concat(n,"_step")}}}else if(t.isObject(e)&&cn(e))return{...e,data:r.lookupDataSource(e.data)};return e}(o.range,a,i,e),m=Kp(e,i),g=c?function(e,n,i,r){const o=Yf(e,n.param,n);return{signal:fr(i.get("type"))&&t.isArray(r)&&r[0]>r[1]?"isValid(".concat(o,") && reverse(").concat(o,")"):o}}(e,c,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 tm extends Pc{constructor(e,t){super({},{name:e}),En(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 nm=["range","scheme"];function im(e){return"x"===e?"width":"y"===e?"height":void 0}function rm(e,n){const i=e.fieldDef(n);if(null!=i&&i.bin){const{bin:r,field:o}=i,a=im(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("'.concat(t,'")[1] - domain("').concat(t,'")[0]) / ').concat(r.step);return"".concat(e.getSignalName(s)," / (").concat(i,")")}));if(Qt(r)){const t=np(e,o,r);return new Wp((()=>{const n=e.getSignalName(t),i="(".concat(n,".stop - ").concat(n,".start) / ").concat(n,".step");return"".concat(e.getSignalName(s)," / (").concat(i,")")}))}}}function om(e,n){const i=n.specifiedScales[e],{size:r}=n,o=n.getScaleComponent(e).get("type");for(const r of nm)if(void 0!==i[r]){const a=Dr(o,r),s=Fr(e,r);if(a)if(s)si(s);else switch(r){case"range":{const r=i.range;if(t.isArray(r)){if(yt(e))return Nc(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 Nc({data:n.requestDataName(Yc.Main),field:r.field,sort:{op:"min",field:n.vgField(e)}});return Nc(r)}case"scheme":return Nc(am(i[r]))}else si(Zn(o,r,e))}if(e===ee||e===te){const t=e===ee?"width":"height",n=r[t];if(vs(n)){if(lr(o))return Nc({step:n.step});si(ei(t))}}const{rangeMin:a,rangeMax:s}=i,c=function(e,n){const{size:i,config:r,mark:o,encoding:a}=n,s=n.getSignalName.bind(n),{type:c}=ia(a[e]),u=n.getScaleComponent(e).get("type"),{domain:l,domainMid:f}=n.specifiedScales[e];switch(e){case ee:case te:{if(y(["point","band"],u))if(e!==ee||i.width){if(e===te&&!i.height){const e=As(r.view,"height");if(vs(e))return e}}else{const e=As(r.view,"width");if(vs(e))return e}const t=im(e),o=n.getName(t);return e===te&&fr(u)?[Wp.fromName(s,o),0]:[0,Wp.fromName(s,o)]}case he:{const a=sm(o,n.component.scales[e].get("zero"),r),s=function(e,n,i,r){const o={x:rm(i,"x"),y:rm(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=um(n,o,r.view);return t.isNumber(e)?e-1:new Wp((()=>"".concat(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=um(n,o,r.view);return t.isNumber(e)?Math.pow(cm*e,2):new Wp((()=>"pow(".concat(cm," * ").concat(e.signal,", 2)")))}}throw new Error(Gn("size",e))}(o,i,n,r);return pr(u)?function(e,t,n){const i=()=>{const i=vn(t),r=vn(e),o="(".concat(i," - ").concat(r,") / (").concat(n," - 1)");return"sequence(".concat(r,", ").concat(i," + ").concat(o,", ").concat(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:(si(function(e){return"Domain for ".concat(e," is required for threshold scale.")}(r)),3)}}(u,r,l,e)):[a,s]}case ae:return[0,2*Math.PI];case ve:return[0,360];case re:return[0,new Wp((()=>{const e=n.getSignalName("width"),t=n.getSignalName("height");return"min(".concat(e,",").concat(t,")/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"===u?"nominal"===c?"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 ".concat(e))}(e,n);return(void 0!==a||void 0!==s)&&Dr(o,"rangeMin")&&t.isArray(c)&&2===c.length?Nc([null!=a?a:c[0],null!=s?s:c[1]]):jc(c)}function am(e){return function(e){return!t.isString(e)&&!!e.name}(e)?{scheme:e.name,...m(e,["name"])}:{scheme:e}}function sm(e,t,n){if(t)return an(t)?{signal:"".concat(t.signal," ? 0 : ").concat(sm(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 cm=.95;function um(e,t,n){const i=vs(e.width)?e.width.step:ws(n,"width"),r=vs(e.height)?e.height.step:ws(n,"height");return t.x||t.y?new Wp((()=>{const e=[t.x?t.x.signal:i,t.y?t.y.signal:r];return"min(".concat(e.join(", "),")")})):Math.min(i,r)}function lm(e,t){ym(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of B(n)){const c=a[s],u=n[s],l=e.getScaleComponent(s),f=ia(r[s]),d=c[t],p=l.get("type"),m=l.get("padding"),g=l.get("paddingInner"),h=Dr(p,t),v=Fr(s,t);if(void 0!==d&&(h?v&&si(v):si(Zn(p,t,s))),h&&void 0===v)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":ci(c[t])||"temporal"===n||e?u.set(t,{signal:la(c[t],{type:n,timeUnit:e})},!0):u.set(t,c[t],!0);break;default:u.copyKeyFromObject(t,c)}}else{const n=t in fm?fm[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:p,scalePadding:m,scalePaddingInner:g,domain:c.domain,markDef:o,config:i}):i.scale[t];void 0!==n&&u.set(t,n,!1)}}}(e,t):pm(e,t)}const fm={bins:({model:e,fieldOrDatumDef:t})=>No(t)?function(e,t){const n=t.bin;if(Qt(n)){const i=np(e,t.field,n);return new Wp((()=>e.getSignalName(i)))}if($t(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=na(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(dr(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===$i)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 I(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===Ki){const{bandPaddingOuter:e}=o;return I(e,an(r)?{signal:"".concat(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 fr(e)&&"descending"===t?an(i.xReverse)?{signal:"!".concat(i.xReverse.signal)}:!i.xReverse:i.xReverse;if(fr(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&&fr(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&&!pr(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 dm(e){ym(e)?function(e){const t=e.component.scales;for(const n of Pt){const i=t[n];if(!i)continue;const r=om(n,e);i.setWithExplicit("range",r)}}(e):pm(e,"range")}function pm(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?dm(n):lm(n,t);for(const i of B(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=Lc(r,e.getWithExplicit(t),t,"scale",Mc(((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0})))}}n[i].setWithExplicit(t,r)}}function mm(e,t,n,i){const r=function(e,t,n){switch(t.type){case"nominal":case"ordinal":var i;if(Me(e)||"discrete"===qt(e))return"shape"===e&&"ordinal"===t.type&&si(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 Me(e)?"time":"discrete"===qt(e)?(si(Jn(e,"temporal")),"ordinal"):No(t)&&t.timeUnit&&Di(t.timeUnit).utc?"utc":"time";case"quantitative":return Me(e)?No(t)&&Qt(t.bin)?"bin-ordinal":"linear":"discrete"===qt(e)?(si(Jn(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Hn(t.type))}(t,n,i),{type:o}=e;return Nt(t)?void 0!==o?function(e,t){if(!Nt(e))return!1;switch(e){case ee:case te:case ae:case re:return dr(t)||y(["band","point"],t);case he:case we:case ye:case be:case xe:case ve:return dr(t)||pr(t)||y(["band","point","ordinal"],t);case de:case pe:case me:return"band"!==t;case Ae:case ge:return"ordinal"===t||pr(t)}}(t,o)?No(n)&&(a=o,s=n.type,!(y([Ti,qi],s)?void 0===a||lr(a):s===Li?y([Gi,Yi,void 0],a):s!==Mi||y([Ui,Hi,Ii,Vi,Xi,Ji,Qi,Wi,void 0],a)))?(si(function(e,t){return'FieldDef does not work with "'.concat(e,'" scale. We are using "').concat(t,'" scale instead.')}(o,r)),r):o:(si(function(e,t,n){return'Channel "'.concat(e,'" does not work with "').concat(t,'" scale. We are using "').concat(n,'" scale instead.')}(t,o,r)),r):r:null;var a,s}function gm(e){ym(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e;return Pt.reduce(((r,o)=>{const a=ia(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 c;null!==(c=s)&&void 0!==c||(s={});const t=mm(s,o,a,i);r[o]=new tm(e.scaleName("".concat(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){gm(t);for(const a of B(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?er(e.value,r.value)?n[a]=Lc(e,r,"type","scale",hm):(i.scale[a]="independent",delete n[a]):n[a]=r}}}for(const i of B(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new tm(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 hm=Mc(((e,t)=>nr(e)-nr(t)));class vm{constructor(){En(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 ym(e){return"unit"===(null==e?void 0:e.type)}function bm(e){return"facet"===(null==e?void 0:e.type)}function xm(e){return"concat"===(null==e?void 0:e.type)}function wm(e){return"layer"===(null==e?void 0:e.type)}class Am{constructor(e,n,i,r,o,a,s){var c,u;this.type=n,this.parent=i,this.config=o,En(this,"name",void 0),En(this,"size",void 0),En(this,"title",void 0),En(this,"description",void 0),En(this,"data",void 0),En(this,"transforms",void 0),En(this,"layout",void 0),En(this,"scaleNameMap",void 0),En(this,"projectionNameMap",void 0),En(this,"signalNameMap",void 0),En(this,"component",void 0),En(this,"view",void 0),En(this,"children",[]),En(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!==(c=e.name)&&void 0!==c?c:r,this.title=on(e.title)?{text:e.title}:e.title?nn(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new vm,this.projectionNameMap=i?i.projectionNameMap:new vm,this.signalNameMap=i?i.signalNameMap:new vm,this.data=e.data,this.description=e.description,this.transforms=(null!==(u=e.transform)&&void 0!==u?u:[]).map((e=>rc(e)?{filter:l(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)&&!Do(e.facet)||ds(e))&&(o.columns=s),ps(e)&&(o.columns=1);for(const n of bs)if(void 0!==e[n])if("spacing"===n){var c,u;const i=e[n];o[n]=t.isNumber(i)?i:{row:null!==(c=i.row)&&void 0!==c?c:a,column:null!==(u=i.column)&&void 0!==u?u: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 Pc,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}={}){gm(e),Up(e);for(const t of Ar)lm(e,t);t||dm(e)}(this)}parseProjection(){Zd(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 B(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 E(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 Le){const r=e[i];if(null!=r&&r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=fd(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=ud(i,o),s=Ad(e,a);void 0!==s&&(n[a]=s)}}return E(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 Le)e[n].title&&t.push(md(this,n));for(const e of dd)t=t.concat(vd(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 E(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||bm(this.parent)?Zp(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 P((this.name?"".concat(this.name,"_"):"")+e)}getDataName(e){return this.getName(Yc[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(bm(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(lr(e)&&sn(i)){const e=n.get("name"),i=$p(Kp(this,t));if(i){return{signal:Sd(e,n,Yo({aggregate:"distinct",field:i},{expr:"datum"}))}}return si(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):Je(e)&&Nt(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 "'.concat(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 Dm extends Am{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?B(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=na(n);return r?e(t,r,i):t}),n)}forEachFieldDef(e,t){Ea(this.getMapping(),((t,n)=>{const i=na(t);i&&e(i,n)}),t)}}class Fm extends uu{clone(){return new Fm(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 ".concat(h(this.transform))}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class km extends uu{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=Nt(r)&&t.getScaleComponent(r);if(o){fr(o.get("type"))&&"count"!==n.aggregate&&!Rr(i)&&(e[n.field]=n)}return e}),{});return B(o).length?new km(e,o):null}dependentFields(){return new Set(B(this.filter))}producedFields(){return new Set}hash(){return"FilterInvalid ".concat(h(this.filter))}assemble(){const e=B(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=Yo(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push("(isDate(".concat(i,") || (isValid(").concat(i,") && isFinite(+").concat(i,")))")):"quantitative"===n.type&&(e.push("isValid(".concat(i,")")),e.push("isFinite(+".concat(i,")")))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Cm extends uu{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 ".concat(h(this.transform))}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Sm extends uu{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 ".concat(h(this.transform))}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Em extends uu{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[[ue,ce],[fe,le]]){const r=i.map((e=>{const n=ia(t.encoding[e]);return No(n)?n.field:Mo(n)?{expr:"".concat(n.datum)}:Wo(n)?{expr:"".concat(n.value)}:void 0}));(r[0]||r[1])&&(e=new Em(e,r,null,t.getName("geojson_".concat(n++))))}if(t.channelHasField(ge)){const i=t.typedFieldDef(ge);i.type===Ri&&(e=new Em(e,null,i.field,t.getName("geojson_".concat(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 ".concat(this.geojson," ").concat(this.signal," ").concat(h(this.fields))}assemble(){return[...this.geojson?[{type:"filter",expr:'isValid(datum["'.concat(this.geojson,'"])')}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Bm extends uu{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[[ue,ce],[fe,le]]){const i=n.map((e=>{const n=ia(t.encoding[e]);return No(n)?n.field:Mo(n)?{expr:"".concat(n.datum)}:Wo(n)?{expr:"".concat(n.value)}:void 0})),r=n[0]===fe?"2":"";(i[0]||i[1])&&(e=new Bm(e,t.projectionName(),i,[t.getName("x".concat(r)),t.getName("y".concat(r))]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return"Geopoint ".concat(this.projection," ").concat(h(this.fields)," ").concat(h(this.as))}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class _m extends uu{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,r=[t,n,...i?[i]:[]].join(",");return{signal:"sequence(".concat(r,")")}}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:c,frame:u,keyvals:l}=o.impute,f=Ba(t.mark,n);return new _m(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==c?{value:c}:{},...u?{frame:u}:{},...void 0!==l?{keyvals:l}:{},...f.length?{groupby:f}:{}})}return null}hash(){return"Impute ".concat(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:(c=n,void 0!==(null==c?void 0:c.stop)?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var c;if(i&&"value"!==i){return[s,{type:"window",as:["imputed_".concat(e,"_value")],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:"datum.".concat(e," === null ? datum.imputed_").concat(e,"_value : datum.").concat(e),as:e}]}return[s]}}class zm extends uu{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 ".concat(h(this.transform))}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class Om extends uu{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 gp(o.data),r.push(e));const n=t.getName("lookup_".concat(i));a=new lu(e,n,Yc.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(P(e),e)}catch(t){throw new Error(function(e){return'Lookups can only be performed on selection parameters. "'.concat(e,'" is a variable parameter.')}(e))}if(a=i.materialized,!a)throw new Error(function(e){return'Cannot define and lookup the "'.concat(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 ".concat(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)||(si('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 uu{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 ".concat(h(this.transform))}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class Nm extends uu{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 ".concat(h(this.transform))}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class jm extends uu{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 ".concat(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 uu{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 ".concat(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 gp&&!i.isGenerator&&!Rc(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}var o;if(i instanceof fp&&(i.parent instanceof gp&&!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 sp)return r.name||(r.name="data_".concat(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 pp||i instanceof mp||i instanceof km||i instanceof Vf||i instanceof sd||i instanceof Bm||i instanceof ap||i instanceof Om||i instanceof Np||i instanceof Op||i instanceof Sm||i instanceof Cm||i instanceof Fm||i instanceof zm||i instanceof Pm||i instanceof Nm||i instanceof dp||i instanceof Mm||i instanceof jm)&&r.transform.push(i.assemble()),(i instanceof rp||i instanceof fu||i instanceof _m||i instanceof Pp||i instanceof Em)&&r.transform.push(...i.assemble()),i instanceof lu)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof lu)i.setSource(r.name);else if(r.name||(r.name="data_".concat(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 lu&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_".concat(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 c=i[n],u=ld("title",null,r,n);let l=Ko(c,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[n].title&&(l=t.isArray(l)?l.join(", "):l,l+=" / ".concat(o.component.layoutHeaders[n].title),o.component.layoutHeaders[n].title=null);const f=ld("labelOrient",c.header,r,n),d=null!==c.header&&I(null===(s=c.header)||void 0===s?void 0:s.labels,r.header.labels,!0),p=y(["bottom","right"],f)?"footer":"header";a.layoutHeaders[n]={title:null!==c.header?l:null,facetFieldDef:c,[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),c=null!==(s=r.scale[i])&&void 0!==s?s:_d(i,e);if("independent"===c&&"step"===o.value){a=void 0;break}if(a){if("independent"===c&&a.value!==o.value){a=void 0;break}a=Lc(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(lr(e)){const e=As(i.view,t);return sn(n)||vs(e)?"step":e}return xs(i.view,t)}if(e.hasProjection||"arc"===e.mark)return xs(i.view,t);{const e=As(i.view,t);return vs(e)?e.step:e}}function Vm(e,t,n){return Yo(t,{suffix:"by_".concat(Yo(e)),...null!=n?n:{}})}class Gm extends Dm{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),En(this,"facet",void 0),En(this,"child",void 0),En(this,"children",void 0),this.child=yg(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!Do(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=B(e),n={};for(const i of t){if(![$,K].includes(i)){si(Gn(i,"facet"));break}const t=e[i];if(void 0===t.field){si(Vn(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=aa(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 Le)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 Le)for(const o of pd){const a=this.component.layoutHeaders[r],s=a[o],{facetFieldDef:c}=a;if(c){const n=ld("titleOrient",c.header,this.config,r);if(["right","bottom"].includes(n)){var t;const i=ud(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)){const e=this.getName("column_domain");return{signal:"length(data('".concat(e,"'))")}}}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_".concat(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(lr(o)&&sn(a)){const r=$p(Kp(this.child,i));r?(e.push(r),t.push("distinct"),n.push("distinct_".concat(r))):si(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(),c=[];for(const e of Le){const n=this.facet[e];if(n){c.push(Yo(n));const{bin:u,sort:l}=n;if(Qt(u)&&c.push(Yo(n,{binSuffix:"end"})),wo(l)){const{field:e,op:t=vo}=l,c=Vm(n,l);i&&r?(o.push(c),a.push("max"),s.push(c)):(o.push(e),a.push(t),s.push(c))}else if(t.isArray(l)){const t=cd(n,e);o.push(t),a.push("max"),s.push(t)}}}const u=!!i&&!!r;return{name:e,data:n,groupby:c,...u||o.length>0?{aggregate:{...u?{cross:u}:{},...o.length?{fields:o,ops:a,as:s}:{}}}:{}}}facetSortFields(e){const{facet:n}=this,i=n[e];return i?wo(i.sort)?[Vm(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[cd(i,e,{expr:"datum"})]:[Yo(i,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(wo(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return bd(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const r of dd)if(e[r]){var i;const o=ld("labelOrient",null===(i=e[r])||void 0===i?void 0:i.header,t,r);if(n[r].includes(o))return bd(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:Le.map((e=>this.facetSortFields(e))).flat(),order:Le.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(au(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,c=null===(i=t.format)||void 0===i?void 0:i.feature;if(s&&c)continue;const u=null===(r=e.format)||void 0===r?void 0:r.feature;if((u||c)&&u!==c)continue;const l=null===(o=t.format)||void 0===o?void 0:o.mesh;if(!s&&!l||s===l)if(Wc(e)&&Wc(t)){if(f(e.values,t.values))return a}else if(Rc(e)&&Rc(t)){if(e.url===t.url)return a}else if(Uc(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 gp({values:[]});return t.push(e),e}const n=Ym(e.data,t);if(n)return Hc(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 gp(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 qc,c=e.data;Hc(c)?(Ic(c)?r=new mp(r,c.sequence):Gc(c)&&(r=new pp(r,c.graticule)),s.parseNothing=!0):null===(null==c||null===(t=c.format)||void 0===t?void 0:t.parse)&&(s.parseNothing=!0),r=null!==(n=fp.makeExplicit(r,e,s))&&void 0!==n?n:r,r=new dp(r);const u=e.parent&&wm(e.parent);var l;(ym(e)||bm(e))&&(u&&(r=null!==(l=rp.makeFromEncoding(r,e))&&void 0!==l?l:r));e.transforms.length>0&&(r=function(e,t,n){let i=0;for(const a of t.transforms){let s,c;if(gc(a))c=e=new sd(e,a),s="derived";else if(rc(a)){var r;const i=up(a);c=e=null!==(r=fp.makeWithAncestors(e,{},i,n))&&void 0!==r?r:e,e=new Vf(e,t,a.filter)}else if(hc(a))c=e=rp.makeFromTransform(e,a,t),s="number";else if(yc(a))s="date",void 0===n.getWithExplicit(a.field).value&&(e=new fp(e,{[a.field]:s}),n.set(a.field,s,!1)),c=e=fu.makeFromTransform(e,a);else if(bc(a))c=e=ap.makeFromTransform(e,a),s="number",wl(t)&&(e=new dp(e));else if(oc(a))c=e=Om.make(e,t,a,i++),s="derived";else if(dc(a))c=e=new Np(e,a),s="number";else if(pc(a))c=e=new Op(e,a),s="number";else if(xc(a))c=e=Pp.makeFromTransform(e,a),s="derived";else if(wc(a))c=e=new Sm(e,a),s="derived";else if(mc(a))c=e=new Cm(e,a),s="derived";else if(ac(a))c=e=new jm(e,a),s="derived";else if(fc(a))e=new Mm(e,a);else if(vc(a))c=e=_m.makeFromTransform(e,a),s="derived";else if(sc(a))c=e=new Fm(e,a),s="derived";else if(cc(a))c=e=new Pm(e,a),s="derived";else if(uc(a))c=e=new Nm(e,a),s="derived";else{if(!lc(a)){si("Ignoring an invalid transform: ".concat(g(a),"."));continue}c=e=new zm(e,a),s="derived"}if(c&&void 0!==s)for(const e of null!==(o=c.producedFields())&&void 0!==o?o:[]){var o;n.set(e,s,!1)}}return e}(r,e,s));const f=function(e){const t={};if(ym(e)&&e.component.selection)for(const n of B(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&H(e.field)>1&&(t[e.field]="flatten")}return t}(e),d=lp(e);if(r=null!==(i=fp.makeWithAncestors(r,{},{...f,...d},s))&&void 0!==i?i:r,ym(e)&&(r=Em.parseAll(r,e),r=Bm.parseAll(r,e)),ym(e)||bm(e)){var p,m;if(!u)r=null!==(m=rp.makeFromEncoding(r,e))&&void 0!==m?m:r;r=null!==(p=fu.makeFromEncoding(r,e))&&void 0!==p?p:r,r=sd.parseAllForSortIndex(r,e)}const h=e.getDataName(Yc.Raw),v=new lu(r,h,Yc.Raw,a);if(o[h]=v,r=v,ym(e)){var y,b;const t=ap.makeFromEncoding(r,e);t&&(r=t,wl(e)&&(r=new dp(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;ym(e)&&(r=null!==(x=km.make(r,e))&&void 0!==x?x:r);const A=e.getDataName(Yc.Main),D=new lu(r,A,Yc.Main,a);o[A]=D,r=D,ym(e)&&function(e,t){for(const[i,r]of z(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;const o=e.getName("lookup_".concat(i));e.component.data.outputNodes[o]=r.materialized=new lu(new Vf(t,e,{param:i}),o,Yc.Lookup,e.component.data.outputNodeRefCounts)}}(e,D);let F=null;if(bm(e)){var k;const t=e.getName("facet");r=null!==(k=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(wo(r.sort)){const{field:n,op:i=vo}=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!==k?k:r,F=new sp(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 Am{constructor(e,t,n,i){var r,o,a,s;super(e,"concat",t,n,i,e.resolve),En(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)||si("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)=>yg(e,this,this.getName("concat_".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 B(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 ps(e)?e.vconcat:ms(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=Fd(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,...va,labelExpr:1,encode:1},$m=B(Qm);class Km extends Pc{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new Km(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 Zm={bottom:"top",top:"bottom",left:"right",right:"left"};function eg(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 Sn(e,t);case"gridScale":return{explicit:e.explicit,value:I(e.value,t.value)}}return Tc(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function ng(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:J(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===ad(i,r))return!0}return e===n[t]}const ig=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function rg(e,t){var n,i,r,o,a;let s=t.axis(e);const c=new Km,u=ia(t.encoding[e]),{mark:l,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=Zf(e,p,d,t.config),g=void 0!==s?!s:td("disable",f.style,null===(o=s)||void 0===o?void 0:o.style,m).configValue;if(c.set("disable",g,void 0!==s),g)return c;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:J(o);{const{configValue:o}=td("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?J(o):n!==ee||!y([qi,Ti],e.type)||No(e)&&e.timeUnit?void 0:270}}(u,s,e,f.style,m),v={fieldOrDatumDef:u,axis:s,channel:e,model:t,scaleType:p,orient:d,labelAngle:h,mark:l,config:f};for(const n of $m){const i=n in nd?nd[n](v):ba(n)?s[n]:void 0,r=void 0!==i,o=ng(i,n,s,t,e);if(r&&o)c.set(n,i,o);else{const{configValue:e,configFrom:t}=ba(n)&&"values"!==n?td(n,f.style,s.style,m):{},a=void 0!==e;r&&!a?c.set(n,i,o):("vgAxisConfig"!==t||ig.has(n)&&a||ma(e)||an(e))&&c.set(n,e,!1)}}const b=null!==(a=s.encoding)&&void 0!==a?a:{},x=ga.reduce(((n,i)=>{var r;if(!c.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=ia(r[t]))&&void 0!==i?i:ia(r[et(t)]),s=e.axis(t)||{},{format:c,formatType:u}=s;return oo(u)?{text:uo({fieldOrDatumDef:a,field:"datum.value",format:c,formatType:u,config:o}),...n}:n}(t,e,o):o;return void 0===a||E(a)||(n[i]={update:a}),n}),{});return E(x)||c.set("encode",x,!!s.encoding||void 0!==s.labelAngle),c}function og(e,t,n){const i=nn(e),r=xn("orient",i,n);var o,a;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)&&($t(i.bin)||No(r)&&r.aggregate&&!i.aggregate))return"vertical";if(No(r)&&($t(r.bin)||No(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o&&(No(i)&&i.type===Mi&&!Qt(i.bin)||Lo(i)))return"horizontal";if(!a&&(No(r)&&r.type===Mi&&!Qt(r.bin)||Lo(r)))return"vertical"}case Pr:if(o&&(!No(i)||!$t(i.bin))&&a&&(!No(r)||!$t(r.bin)))return;case Sr:if(a)return No(r)&&$t(r.bin)?"horizontal":"vertical";if(o)return No(i)&&$t(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&&si((o=i.orient,a=r,'Specified orient "'.concat(o,'" overridden with "').concat(a,'".'))),"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)&&!Fa(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 ag(e,t){const{config:n}=e;return{...Ju(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Mu("x",e,{defaultPos:"mid"}),...Mu("y",e,{defaultPos:"mid"}),...Ou("size",e),...Ou("angle",e),...sg(e,n,t)}}function sg(e,t,n){return n?{shape:{value:n}}:Ou("shape",e)}function cg(e,t,n){if(void 0===xn("align",e,n))return"center"}function ug(e,t,n){if(void 0===xn("baseline",e,n))return"middle"}function lg(e){var n;const{config:i,markDef:r}=e,{orient:o}=r,a="horizontal"===o?"width":"height",s=e.getScaleComponent("horizontal"===o?"x":"y"),c=null!==(n=xn("size",r,i,{vgChannel:a}))&&void 0!==n?n:i.tick.bandSize;if(void 0!==c)return c;{const e=s?s.get("range"):void 0;if(e&&sn(e)&&t.isNumber(e.step))return 3*e.step/4;return 3*ws(i.view,a)/4}}const fg={arc:{vgMark:"arc",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Mu("x",e,{defaultPos:"mid"}),...Mu("y",e,{defaultPos:"mid"}),...Iu(e,"radius","arc"),...Iu(e,"theta","arc")})},area:{vgMark:"area",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Wu("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...Wu("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...Ku(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Iu(e,"x","bar"),...Iu(e,"y","bar")})},circle:{vgMark:"symbol",encodeEntry:e=>ag(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...Ju(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=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Iu(e,"x","image"),...Iu(e,"y","image"),...Fu(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Mu("x",e,{defaultPos:"mid"}),...Mu("y",e,{defaultPos:"mid"}),...Ou("size",e,{vgChannel:"strokeWidth"}),...Ku(e)})},point:{vgMark:"symbol",encodeEntry:e=>ag(e)},rect:{vgMark:"rect",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Iu(e,"x","rect"),...Iu(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?{...Ju(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Wu("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...Wu("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Ou("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>ag(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Ju(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Mu("x",e,{defaultPos:"mid"}),...Mu("y",e,{defaultPos:"mid"}),...Fu(e),...Ou("size",e,{vgChannel:"fontSize"}),...Ou("angle",e),...Zu("align",cg(e.markDef,n,t)),...Zu("baseline",ug(e.markDef,n,t)),...Mu("radius",e,{defaultPos:null}),...Mu("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{...Ju(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Mu("x",e,{defaultPos:"mid",vgChannel:"xc"}),...Mu("y",e,{defaultPos:"mid",vgChannel:"yc"}),...Ou("size",e,{defaultValue:lg(e),vgChannel:r}),[o]:gn(xn("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...Ju(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Mu("x",e,{defaultPos:"mid"}),...Mu("y",e,{defaultPos:"mid"}),...Ou("size",e),...Ku(e)})}};function dg(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:pg+e.requestDataName(Yc.Main),data:e.requestDataName(Yc.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:gg(e,{fromPrefix:pg})}]}(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]=gg(e,{fromPrefix:mg}),n=e.scaleName(e.stack.fieldChannel),i=(t={})=>e.vgField(e.stack.fieldChannel,t),r=(e,t)=>{const r=[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})];return"".concat(e,"(").concat(r.map((e=>"scale('".concat(n,"',").concat(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(Yc.Main),name:mg+e.requestDataName(Yc.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 gg(e)}const pg="faceted_path_";const mg="stack_group_";function gg(e,n={fromPrefix:""}){const{mark:i,markDef:r,encoding:o,config:a}=e,s=I(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)),c=bn(r),u=o.key,l=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"})}:wo(n)?{field:Yo({aggregate:Fa(e.encoding)?n.op:void 0,field:n.field},{expr:"datum"})}:xo(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=B(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=B(i.component.selection).length,i=i.parent;return n?{interactive:t>0||!!e.encoding.tooltip}:null}(e),d=xn("aria",r,a),p=fg[i].postEncodingTransform?fg[i].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:fg[i].vgMark,...s?{clip:!0}:{},...c?{style:c}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...f||{},...!1===d?{aria:d}:{},from:{data:n.fromPrefix+e.requestDataName(Yc.Main)},encode:{update:fg[i].encodeEntry(e)},...p?{transform:p}:{}}]}class hg extends Dm{constructor(e,t,n,i={},r){var o;super(e,"unit",t,n,r,void 0,ys(e)?e.view:void 0),En(this,"markDef",void 0),En(this,"encoding",void 0),En(this,"specifiedScales",{}),En(this,"stack",void 0),En(this,"specifiedAxes",{}),En(this,"specifiedLegends",{}),En(this,"specifiedProjection",{}),En(this,"selection",[]),En(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 I(i,r!==zr&&r!==_r&&r!==Pr)}(a,r,{graticule:e.data&&Gc(e.data)}));const c=this.encoding=Ca(e.encoding||{},s,a.filled,r);this.markDef=og(a,c,r),this.size=function({encoding:e,size:t}){for(const n of vt){const i=tt(n);vs(t[i])&&To(e[n])&&(delete t[i],si(ei(i)))}return t}({encoding:c,size:ys(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=Us(s,c),this.specifiedScales=this.initScales(s,c),this.specifiedAxes=this.initAxes(c),this.specifiedLegends=this.initLegends(c),this.specifiedProjection=e.projection,this.selection=(null!==(o=e.params)&&void 0!==o?o:[]).filter((e=>ls(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===qr,n=e&&Ne.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 Pt.reduce(((e,n)=>{const i=ia(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=B(e),n={};for(const i of t){const t=e[i];n[i]=ma(t)?dn(t):pn(t)}return n}initLegends(e){return zt.reduce(((t,n)=>{const i=ia(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,vs(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=P(a.name),s=a.select,c=t.isString(s)?s:s.type,u=t.isObject(s)?d(s):{type:c},{fields:l,encodings:f,...p}=r[c];for(const e in p){var o;"mark"===e&&(u[e]={...p[e],...u[e]}),(void 0===u[e]||!0===u[e])&&(u[e]=null!==(o=p[e])&&void 0!==o?o:u[e])}const m=i[n]={...u,name:n,type:c,init:a.value,bind:a.bind,events:t.isString(u.on)?eu(u.on,"scope"):t.array(d(u.on))};for(const t of bl)t.defined(m)&&t.parse&&t.parse(e,m,a)}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=dg(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,vt.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[rg(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const o of _(null!==(r=e.component.selection)&&void 0!==r?r:{})){var r;const a=o.name,s=t.stringValue(a+gl);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:"".concat(yl,"(").concat(s,", ").concat(t.stringValue(e)).concat(i)})}i=!0;for(const t of bl)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 cu(n)}(this,e)}assembleSignals(){return[...$f(this),...ou(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t];for(const t of _(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const r={name:t.name+gl};if(t.init){const n=t.project.items.map((e=>{const{signals:t,...n}=e;return n}));r.values=t.init.map((t=>({unit:xl(e,{escape:!1}),fields:n,values:ru(t,!1)})))}n.filter((e=>e.name===t.name+gl)).length||n.push(r)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Fd(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&wm(this.parent)||(t=su(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Da(this.encoding,e)}fieldDef(e){return na(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return Ro(t)?t:null}}class vg extends Am{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view),En(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 vg(e,this,this.getName("layer_".concat(t)),o,r);if(wa(e))return new hg(e,this,this.getName("layer_".concat(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 B(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 B(i.component.axes))n.axis[r]=zd(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=eg(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=Zm[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())),$f(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),Fd(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)ym(n)&&(t=su(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 yg(e,t,n,i,r){if(ko(e))return new Gm(e,t,n,r);if(Ms(e))return new vg(e,t,n,i,r);if(wa(e))return new hg(e,t,n,i,r);if(function(e){return ps(e)||ms(e)||ds(e)}(e))return new Jm(e,t,n,r);throw new Error(_n(e))}const bg=i;e.accessPathDepth=H,e.accessPathWithDatum=T,e.compile=function(e,n={}){var i;n.logger&&(i=n.logger,ai=i),n.fieldTitle&&$o(n.fieldTitle);try{const i=_s(t.mergeConfig(n.config,e.config)),r=Ec(e,i),o=yg(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)&&si("Maximum optimization runs(".concat(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_".concat(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(),c=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let l=e.assembleLayoutSignals();l=l.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}:{},...c?{style:c}:{},...u?{encode:{update:u}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...l,...e.assembleSelectionTopLevelSignals([]),...fs(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)si(Nn()),n.type="pad";else if("step"===o||"step"===a){const e="step"===o?"width":"height";si(Nn(wt(e)));const t="width"===e?"height":"width";n.type=function(e){return e?"fit-".concat(wt(e)):"fit"}(t)}var s;return{...1===B(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...hs(i,!1),...hs(e,!0)}}(e,r.autosize,i,o),e.datasets,e.usermeta),normalized:r}}finally{n.logger&&(ai=oi),n.fieldTitle&&$o(Jo)}},e.contains=y,e.deepEqual=f,e.deleteNestedProperty=j,e.duplicate=d,e.entries=z,e.every=x,e.fieldIntersection=S,e.flatAccessWithDatum=L,e.getFirstDefined=I,e.hasIntersection=k,e.hash=h,e.internalField=Y,e.isBoolean=O,e.isEmpty=E,e.isEqual=function(e,t){const n=B(e),i=B(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=X,e.isNullOrFalse=v,e.isNumeric=Q,e.keys=B,e.logicalExpr=N,e.mergeDeep=w,e.normalize=Ec,e.normalizeAngle=J,e.omit=m,e.pick=p,e.prefixGenerator=C,e.removePathFromField=U,e.replaceAll=W,e.replacePathInField=R,e.resetIdCounter=function(){V=42},e.setEqual=F,e.some=b,e.stringify=g,e.titleCase=M,e.unique=D,e.uniqueId=G,e.vals=_,e.varName=P,e.version=bg,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=vega-lite.min.js.map