genesys-spark-chart-components 4.183.0 → 4.184.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/cjs/{color-palette-xxfYG6BM.js → color-palette-a3IdeFeE.js} +1 -1
  2. package/dist/cjs/gux-chart-column-beta.cjs.entry.js +1 -1
  3. package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +1 -1
  4. package/dist/cjs/gux-chart-line-beta.cjs.entry.js +1 -1
  5. package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +1 -1
  6. package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +1 -1
  7. package/dist/cjs/gux-visualization-beta.cjs.entry.js +1 -1
  8. package/dist/esm/{color-palette-C_eCsSQm.js → color-palette-u1goCfXU.js} +1 -1
  9. package/dist/esm/gux-chart-column-beta.entry.js +1 -1
  10. package/dist/esm/gux-chart-donut-beta.entry.js +1 -1
  11. package/dist/esm/gux-chart-line-beta.entry.js +1 -1
  12. package/dist/esm/gux-chart-pie-beta.entry.js +1 -1
  13. package/dist/esm/gux-chart-scatter-plot-beta.entry.js +1 -1
  14. package/dist/esm/gux-visualization-beta.entry.js +1 -1
  15. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -1
  16. package/dist/genesys-chart-webcomponents/{p-675f1948.entry.js → p-4006f902.entry.js} +1 -1
  17. package/dist/genesys-chart-webcomponents/{p-93fb89c2.entry.js → p-54e977f0.entry.js} +1 -1
  18. package/dist/genesys-chart-webcomponents/{p-91482dd1.entry.js → p-8efd1dc4.entry.js} +1 -1
  19. package/dist/genesys-chart-webcomponents/{p-4c9aa29a.entry.js → p-bb0378f7.entry.js} +1 -1
  20. package/dist/genesys-chart-webcomponents/{p-e55d8048.entry.js → p-c7295d02.entry.js} +1 -1
  21. package/dist/genesys-chart-webcomponents/{p-52fe4a1a.entry.js → p-fc3c0c77.entry.js} +1 -1
  22. package/dist/genesys-chart-webcomponents/{p-C_eCsSQm.js → p-u1goCfXU.js} +1 -1
  23. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import{r as t,c as n,h as e,g as r}from"./p-DohbbG4E.js";import{a as i,D as o,t as a}from"./p-C_eCsSQm.js";const u=/("(?:[^\\"]|\\.)*")|[:,]/g;function s(t,n={}){const e=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===e?1/0:void 0===n.maxLength?80:n.maxLength;let{replacer:i}=n;return function t(n,o,a){n&&"function"==typeof n.toJSON&&(n=n.toJSON());const s=JSON.stringify(n,i);if(void 0===s)return s;const c=r-o.length-a;if(s.length<=c){const t=s.replace(u,((t,n)=>n||`${t} `));if(t.length<=c)return t}if(null!=i&&(n=JSON.parse(s),i=void 0),"object"==typeof n&&null!==n){const r=o+e,i=[];let a,u,s=0;if(Array.isArray(n)){a="[",u="]";const{length:e}=n;for(;s<e;s++)i.push(t(n[s],r,s===e-1?0:1)||"null")}else{a="{",u="}";const e=Object.keys(n),{length:o}=e;for(;s<o;s++){const a=e[s],u=`${JSON.stringify(a)}: `,c=t(n[a],r,u.length+(s===o-1?0:1));void 0!==c&&i.push(u+c)}}if(i.length>0)return[a,e+i.join(`,\n${r}`),u].join(`\n${o}`)}return s}(t,"",0)}function c(t,n,e){return t.fields=n||[],t.fname=e,t}function f(t){return null==t?null:t.fname}function l(t){return null==t?null:t.fields}function h(t){return 1===t.length?d(t[0]):m(t)}const d=t=>function(n){return n[t]},m=t=>{const n=t.length;return function(e){for(let r=0;r<n;++r)e=e[t[r]];return e}};function p(t){throw Error(t)}function g(t){const n=[],e=t.length;let r,i,o,a=null,u=0,s="";function c(){n.push(s+t.substring(r,i)),s="",r=i+1}for(t+="",r=i=0;i<e;++i)if(o=t[i],"\\"===o)s+=t.substring(r,i++),r=i;else if(o===a)c(),a=null,u=-1;else{if(a)continue;r===u&&'"'===o||r===u&&"'"===o?(r=i+1,a=o):"."!==o||u?"["===o?(i>r&&c(),u=r=i+1):"]"===o&&(u||p("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&p("Access path missing closing bracket: "+t),a&&p("Access path missing closing quote: "+t),i>r&&(i++,c()),n}function v(t,n,e){const r=g(t);return t=1===r.length?r[0]:t,c((e&&e.get||h)(r),[t],n||t)}const y=v("id"),b=c((t=>t),[],"identity"),w=c((()=>0),[],"zero"),x=c((()=>1),[],"one"),$=c((()=>!0),[],"true"),k=c((()=>!1),[],"false");function M(t,n,e){const r=[n].concat([].slice.call(e));console[t].apply(console,r)}function A(t,n){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M,r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=1&&e(n||"error","ERROR",arguments),this},warn(){return r>=2&&e(n||"warn","WARN",arguments),this},info(){return r>=3&&e(n||"log","INFO",arguments),this},debug(){return r>=4&&e(n||"log","DEBUG",arguments),this}}}var D=Array.isArray;function S(t){return t===Object(t)}const F=t=>"__proto__"!==t;function E(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.reduce(((t,n)=>{for(const e in n)"signals"===e?t.signals=C(t.signals,n.signals):N(t,e,n[e],"legend"===e?{layout:1}:"style"===e||null);return t}),{})}function N(t,n,e,r){if(!F(n))return;let i,o;if(S(e)&&!D(e))for(i in o=S(t[n])?t[n]:t[n]={},e)r&&(!0===r||r[i])?N(o,i,e[i]):F(i)&&(o[i]=e[i]);else t[n]=e}function C(t,n){if(null==t)return n;const e={},r=[];function i(t){e[t.name]||(e[t.name]=1,r.push(t))}return n.forEach(i),t.forEach(i),r}function O(t){return t[t.length-1]}function _(t){return null==t||""===t?null:+t}const z=t=>n=>t*Math.exp(n),B=t=>n=>Math.log(t*n),T=t=>n=>Math.sign(n)*Math.log1p(Math.abs(n/t)),P=t=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*t,j=t=>n=>n<0?-Math.pow(-n,t):Math.pow(n,t);function R(t,n,e,r){const i=e(t[0]),o=e(O(t)),a=(o-i)*n;return[r(i-a),r(o-a)]}function L(t,n){return R(t,n,_,b)}function I(t,n){var e=Math.sign(t[0]);return R(t,n,B(e),z(e))}function q(t,n,e){return R(t,n,j(e),j(1/e))}function U(t,n,e){return R(t,n,T(e),P(e))}function W(t,n,e,r,i){const o=r(t[0]),a=r(O(t)),u=null!=n?r(n):(o+a)/2;return[i(u+(o-u)*e),i(u+(a-u)*e)]}function H(t,n,e){return W(t,n,e,_,b)}function G(t,n,e){const r=Math.sign(t[0]);return W(t,n,e,B(r),z(r))}function Y(t,n,e,r){return W(t,n,e,j(r),j(1/r))}function V(t,n,e,r){return W(t,n,e,T(r),P(r))}function X(t){return 1+~~(new Date(t).getMonth()/3)}function J(t){return 1+~~(new Date(t).getUTCMonth()/3)}function K(t){return null!=t?D(t)?t:[t]:[]}function Q(t,n,e){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function Z(t){return"function"==typeof t}function tt(t,n,e){e=e||{},n=K(n)||[];const r=[],i=[],o={},a=e.comparator||et;return K(t).forEach(((t,a)=>{null!=t&&(r.push("descending"===n[a]?-1:1),i.push(t=Z(t)?t:v(t,null,e)),(l(t)||[]).forEach((t=>o[t]=1)))})),0===i.length?null:c(a(i,r),Object.keys(o))}const nt=(t,n)=>(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0),et=(t,n)=>1===t.length?rt(t[0],n[0]):it(t,n,t.length),rt=(t,n)=>function(e,r){return nt(t(e),t(r))*n},it=(t,n,e)=>(n.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++u<e;)o=t[u],a=nt(o(r),o(i));return a*n[u]});function ot(t){return Z(t)?t:()=>t}function at(t,n){let e;return r=>{e&&clearTimeout(e),e=setTimeout((()=>(n(r),e=null)),t)}}function ut(t){for(let n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r],n)t[e]=n[e];return t}function st(t,n){let e,r,i,o,a=0;if(t&&(e=t.length))if(null==n){for(r=t[a];a<e&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<e;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=n(t[a]);a<e&&(null==r||r!=r);r=n(t[++a]));for(i=o=r;a<e;++a)r=n(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function ct(t,n){const e=t.length;let r,i,o,a,u,s=-1;if(null==n){for(;++s<e;)if(i=t[s],null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=t[s],null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}else{for(;++s<e;)if(i=n(t[s],s,t),null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=n(t[s],s,t),null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}return[a,u]}function ft(t,n){return Object.hasOwn(t,n)}const lt={};function ht(t){let n,e={};function r(t){return ft(e,t)&&e[t]!==lt}const i={size:0,empty:0,object:e,has:r,get:t=>r(t)?e[t]:void 0,set(t,n){return r(t)||(++i.size,e[t]===lt&&--i.empty),e[t]=n,this},delete(t){return r(t)&&(--i.size,++i.empty,e[t]=lt),this},clear(){i.size=i.empty=0,i.object=e={}},test(t){return arguments.length?(n=t,i):n},clean(){const t={};let r=0;for(const i in e){const o=e[i];o===lt||n&&n(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=e=t}};return t&&Object.keys(t).forEach((n=>{i.set(n,t[n])})),i}function dt(t,n,e,r,i,o){if(!e&&0!==e)return o;const a=+e;let u,s=t[0],c=O(t);c<s&&(u=s,s=c,c=u),u=Math.abs(n-s);const f=Math.abs(c-n);return u<f&&u<=a?r:f<=a?i:o}function mt(t,n,e){const r=t.prototype=Object.create(n.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),ut(r,e)}function pt(t,n,e,r){let i,o=n[0],a=n[n.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((e=void 0===e||e)?o<=t:o<t)&&(r?t<=a:t<a)}function gt(t){return"boolean"==typeof t}function vt(t){return"[object Date]"===Object.prototype.toString.call(t)}function yt(t){return t&&Z(t[Symbol.iterator])}function bt(t){return"number"==typeof t}function wt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function xt(t){return"string"==typeof t}function $t(t,n,e){t&&(t=n?K(t).map((t=>t.replace(/\\(.)/g,"$1"))):K(t));const r=t&&t.length,i=e&&e.get||h,o=t=>i(n?[t]:g(t));let a;if(r)if(1===r){const n=o(t[0]);a=function(t){return""+n(t)}}else{const n=t.map(o);a=function(t){let e=""+n[0](t),i=0;for(;++i<r;)e+="|"+n[i](t);return e}}else a=function(){return""};return c(a,t,"key")}function kt(t,n){const e=t[0],r=O(t),i=+n;return i?1===i?r:e+i*(r-e):e}function Mt(t){let n,e,r;t=+t||1e4;const i=()=>{n={},e={},r=0},o=(i,o)=>(++r>t&&(e=n,n={},r=1),n[i]=o);return i(),{clear:i,has:t=>ft(n,t)||ft(e,t),get:t=>ft(n,t)?n[t]:ft(e,t)?o(t,e[t]):void 0,set:(t,e)=>ft(n,t)?n[t]=e:o(t,e)}}function At(t,n,e,r){const i=n.length,o=e.length;if(!o)return n;if(!i)return e;const a=r||new n.constructor(i+o);let u=0,s=0,c=0;for(;u<i&&s<o;++c)a[c]=t(n[u],e[s])>0?e[s++]:n[u++];for(;u<i;++u,++c)a[c]=n[u];for(;s<o;++s,++c)a[c]=e[s];return a}function Dt(t,n){let e="";for(;--n>=0;)e+=t;return e}function St(t,n,e,r){const i=e||" ",o=t+"",a=n-o.length;return a<=0?o:"left"===r?Dt(i,a)+o:"center"===r?Dt(i,~~(a/2))+o+Dt(i,Math.ceil(a/2)):o+Dt(i,a)}function Ft(t){return t&&O(t)-t[0]||0}function Et(t){return D(t)?"["+t.map(Et)+"]":S(t)||xt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function Nt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t||!t)}const Ct=t=>bt(t)||vt(t)?t:Date.parse(t);function Ot(t,n){return n=n||Ct,null==t||""===t?null:n(t)}function _t(t){return null==t||""===t?null:t+""}function zt(t){const n={},e=t.length;for(let r=0;r<e;++r)n[t[r]]=!0;return n}function Bt(t,n,e,r){const i=null!=r?r:"…",o=t+"",a=o.length,u=Math.max(0,n-i.length);return a<=n?o:"left"===e?i+o.slice(a-u):"center"===e?o.slice(0,Math.ceil(u/2))+i+o.slice(a-~~(u/2)):o.slice(0,u)+i}function Tt(t,n,e){if(t)if(n){const r=t.length;for(let i=0;i<r;++i){const r=n(t[i]);r&&e(r,i,t)}}else t.forEach(e)}var Pt={},jt={};function Rt(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function Lt(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function It(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function qt(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,s=o<=0,c=!1;function f(){if(s)return jt;if(c)return c=!1,Pt;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(n=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(n=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=f())!==jt;){for(var l=[];r!==Pt&&r!==jt;)l.push(r),r=f();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return a(n[t])})).join(t)}))}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?function(t){var n=t.getUTCHours(),e=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+It(-t,6):t>9999?"+"+It(t,6):It(t,4)}(t.getUTCFullYear())+"-"+It(t.getUTCMonth()+1,2)+"-"+It(t.getUTCDate(),2)+(i?"T"+It(n,2)+":"+It(e,2)+":"+It(r,2)+"."+It(i,3)+"Z":r?"T"+It(n,2)+":"+It(e,2)+":"+It(r,2)+"Z":e||n?"T"+It(n,2)+":"+It(e,2)+"Z":"")}(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=Rt(t);return function(r,i){return n(e(r),i,t)}}(t,n):Rt(t)}));return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=Lt(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=Lt(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function Ut(t){return t}function Wt(t,n){return"string"==typeof n&&(n=t.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(n){return Ht(t,n)}))}:Ht(t,n)}function Ht(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,o=Gt(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:e,properties:i,geometry:o}:{type:"Feature",id:e,bbox:r,properties:i,geometry:o}}function Gt(t,n){var e=function(t){if(null==t)return Ut;var n,e,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,u){u||(n=e=0);var s=2,c=t.length,f=new Array(c);for(f[0]=(n+=t[0])*r+o,f[1]=(e+=t[1])*i+a;s<c;)f[s]=t[s],++s;return f}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)n.push(e(i[o],o));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,a)}function o(t){return e(t)}function a(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function u(t){for(var n=a(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(u)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=o(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(o);break;case"LineString":e=a(n.arcs);break;case"MultiLineString":e=n.arcs.map(a);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function Yt(t,n){var e={},r={},i={},o=[],a=-1;function u(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach((function(t){e[t<0?~t:t]=1})),o.push(i)}}return n.forEach((function(e,r){var i,o=t.arcs[e<0?~e:e];o.length<3&&!o[1][0]&&!o[1][1]&&(i=n[++a],n[a]=e,n[r]=i)})),n.forEach((function(n){var e,o,a=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];return t.transform?(e=[0,0],r.forEach((function(t){e[0]+=t[0],e[1]+=t[1]}))):e=r[r.length-1],n<0?[e,i]:[i,e]}(n),u=a[0],s=a[1];if(e=i[u])if(delete i[e.end],e.push(n),e.end=s,o=r[s]){delete r[o.start];var c=o===e?e:e.concat(o);r[c.start=e.start]=i[c.end=o.end]=c}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=u,o=i[u]){delete i[o.end];var f=o===e?e:o.concat(e);r[f.start=o.start]=i[f.end=e.end]=f}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=u]=i[e.end=s]=e})),u(i,r),u(r,i),n.forEach((function(t){e[t<0?~t:t]||o.push([t])})),o}function Vt(t){return Gt(t,Xt.apply(this,arguments))}function Xt(t,n,e){var r,i,o;if(arguments.length>1)r=function(t,n,e){var r,i=[],o=[];function a(t){var n=t<0?~t:t;(o[n]||(o[n]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":u(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(n.arcs)}}(n),o.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:Yt(t,r)}}function Jt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Kt(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Qt(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length?(n=Jt,e=(n,e)=>Jt(t(n),e),r=(n,e)=>t(n)-e):(n=t===Jt||t===Kt?t:Zt,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<=0?i=n+1:o=n}while(i<o)}return i}}}function Zt(){return 0}function tn(t){return null===t?NaN:+t}const nn=Qt(Jt),en=nn.right,rn=nn.left;Qt(tn);class on{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class an extends Map{constructor(t,n=ln){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(sn(this,t))}has(t){return super.has(sn(this,t))}set(t,n){return super.set(cn(this,t),n)}delete(t){return super.delete(fn(this,t))}}class un extends Set{constructor(t,n=ln){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(sn(this,t))}add(t){return super.add(cn(this,t))}delete(t){return super.delete(fn(this,t))}}function sn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function cn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function fn({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function ln(t){return null!==t&&"object"==typeof t?t.valueOf():t}function hn(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}const dn=Math.sqrt(50),mn=Math.sqrt(10),pn=Math.sqrt(2);function gn(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=dn?10:o>=mn?5:o>=pn?2:1;let u,s,c;return i<0?(c=Math.pow(10,-i)/a,u=Math.round(t*c),s=Math.round(n*c),u/c<t&&++u,s/c>n&&--s,c=-c):(c=Math.pow(10,i)*a,u=Math.round(t/c),s=Math.round(n/c),u*c<t&&++u,s*c>n&&--s),s<u&&.5<=e&&e<2?gn(t,n,2*e):[u,s,c]}function vn(t,n,e){if(!((e=+e)>0))return[];if((t=+t)==(n=+n))return[t];const r=n<t,[i,o,a]=r?gn(n,t,e):gn(t,n,e);if(!(o>=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)s[t]=(o-t)/-a;else for(let t=0;t<u;++t)s[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)s[t]=(i+t)/-a;else for(let t=0;t<u;++t)s[t]=(i+t)*a;return s}function yn(t,n,e){return gn(t=+t,n=+n,e=+e)[2]}function bn(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?yn(n,t,e):yn(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function wn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function xn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function $n(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?hn:function(t=Jt){if(t===Jt)return hn;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),s=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);$n(t,n,Math.max(e,Math.floor(n-a*s/o+c)),Math.min(r,Math.floor(n+(o-a)*s/o+c)),i)}const o=t[n];let a=e,u=r;for(kn(t,e,n),i(t[r],o)>0&&kn(t,e,r);a<u;){for(kn(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?kn(t,e,u):(++u,kn(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function kn(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function Mn(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return xn(t);if(n>=1)return wn(t);var r,i=(r-1)*n,o=Math.floor(i),a=wn($n(t,o).subarray(0,o+1));return a+(xn(t.subarray(o+1))-a)*(i-o)}}function An(t,n,e=tn){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function Dn(t,n){return Mn(t,.5,n)}function Sn(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function Fn(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function En(t){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}function Nn(t){return t instanceof un?t:new un(t)}function Cn(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function On(t){return(t=Cn(Math.abs(t)))?t[1]:NaN}var _n,zn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Bn(t){if(!(n=zn.exec(t)))throw new Error("invalid format: "+t);var n;return new Tn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Tn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Pn(t,n){var e=Cn(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Bn.prototype=Tn.prototype,Tn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var jn={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Pn(100*t,n),r:Pn,s:function(t,n){var e=Cn(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(_n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cn(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Rn(t){return t}var Ln,In,qn,Un=Array.prototype.map,Wn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Hn(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Rn:(n=Un.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Rn:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Un.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Bn(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):jn[y]||(void 0===g&&(g=12),v=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?s:"",x=jn[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,h=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==l&&(M=!1),h=(M?"("===l?l:c:"-"===l||"("===l?"":l)+h,k=("s"===y?Wn[8+_n/3]:"")+k+(M&&"("===l?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!d&&(t=r(t,1/0));var A=h.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&d&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=h+t+k+D;break;case"=":t=h+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+h+t+k+D.slice(A);break;default:t=D+h+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:l,formatPrefix:function(t,n){var e=l(((t=Bn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(On(n)/3))),i=Math.pow(10,-r),o=Wn[8+r/3];return function(t){return e(i*t)+o}}}}Ln=Hn({thousands:",",grouping:[3],currency:["$",""]}),In=Ln.format,qn=Ln.formatPrefix;const Gn=new Date,Yn=new Date;function Vn(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>Vn((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Gn.setTime(+n),Yn.setTime(+r),t(Gn),t(Yn),Math.floor(e(Gn,Yn))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Xn=Vn((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Xn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vn((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Xn:null);const Jn=1e3,Kn=6e4,Qn=36e5,Zn=864e5,te=6048e5,ne=Vn((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*Jn)}),((t,n)=>(n-t)/Jn),(t=>t.getUTCSeconds())),ee=Vn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jn)}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getMinutes())),re=Vn((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getUTCMinutes())),ie=Vn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jn-t.getMinutes()*Kn)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getHours())),oe=Vn((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getUTCHours())),ae=Vn((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kn)/Zn),(t=>t.getDate()-1)),ue=Vn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/Zn),(t=>t.getUTCDate()-1));function se(t){return Vn((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kn)/te))}Vn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/Zn),(t=>Math.floor(t/Zn)));const ce=se(0);function fe(t){return Vn((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/te))}se(1),se(2),se(3),se(4),se(5),se(6);const le=fe(0);fe(1),fe(2),fe(3),fe(4),fe(5),fe(6);const he=Vn((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),de=Vn((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),me=Vn((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));me.every=t=>isFinite(t=Math.floor(t))&&t>0?Vn((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const pe=Vn((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));pe.every=t=>isFinite(t=Math.floor(t))&&t>0?Vn((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const ge="year",ve="quarter",ye="month",be="week",we="date",xe="day",$e="dayofyear",ke="hours",Me="minutes",Ae="seconds",De="milliseconds",Se=[ge,ve,ye,be,we,xe,$e,ke,Me,Ae,De],Fe=Se.reduce(((t,n,e)=>(t[n]=1+e,t)),{});function Ee(t){const n=K(t).slice(),e={};return n.length||p("Missing time unit."),n.forEach((t=>{ft(Fe,t)?e[t]=1:p(`Invalid time unit: ${t}.`)})),(e[be]||e[xe]?1:0)+(e[ve]||e[ye]||e[we]?1:0)+(e[$e]?1:0)>1&&p(`Incompatible time units: ${t}`),n.sort(((t,n)=>Fe[t]-Fe[n])),n}const Ne={[ge]:"%Y ",[ve]:"Q%q ",[ye]:"%b ",[we]:"%d ",[be]:"W%U ",[xe]:"%a ",[$e]:"%j ",[ke]:"%H:00",[Me]:"00:%M",[Ae]:":%S",[De]:".%L",[`${ge}-${ye}`]:"%Y-%m ",[`${ge}-${ye}-${we}`]:"%Y-%m-%d ",[`${ke}-${Me}`]:"%H:%M"};function Ce(t,n){const e=ut({},Ne,n),r=Ee(t),i=r.length;let o,a,u="",s=0;for(s=0;s<i;)for(o=r.length;o>s;--o)if(a=r.slice(s,o).join("-"),null!=e[a]){u+=e[a],s=o;break}return u.trim()}const Oe=new Date;function _e(t){return Oe.setFullYear(t),Oe.setMonth(0),Oe.setDate(1),Oe.setHours(0,0,0,0),Oe}function ze(t){return Te(new Date(t))}function Be(t){return Pe(new Date(t))}function Te(t){return ae.count(_e(t.getFullYear())-1,t)}function Pe(t){return ce.count(_e(t.getFullYear())-1,t)}function je(t){return _e(t).getDay()}function Re(t,n,e,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,n,e,r,i,o,a);return u.setFullYear(t),u}return new Date(t,n,e,r,i,o,a)}function Le(t){return qe(new Date(t))}function Ie(t){return Ue(new Date(t))}function qe(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return ue.count(n-1,t)}function Ue(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return le.count(n-1,t)}function We(t){return Oe.setTime(Date.UTC(t,0,1)),Oe.getUTCDay()}function He(t,n,e,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,n,e,r,i,o,a));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(t,n,e,r,i,o,a))}function Ge(t,n,e,r,i){const o=n||1,a=O(t),u=(t,n,i)=>function(t,n,e,r){const i=e<=1?t:r?(n,i)=>r+e*Math.floor((t(n,i)-r)/e):(n,r)=>e*Math.floor(t(n,r)/e);return n?(t,e)=>n(i(t,e),e):i}(e[i=i||t],r[i],t===a&&o,n),s=new Date,c=zt(t),f=c[ge]?u(ge):ot(2012),l=c[ye]?u(ye):c[ve]?u(ve):w,h=c[be]&&c[xe]?u(xe,1,be+xe):c[be]?u(be,1):c[xe]?u(xe,1):c[we]?u(we,1):c[$e]?u($e,1):x,d=c[ke]?u(ke):w,m=c[Me]?u(Me):w,p=c[Ae]?u(Ae):w,g=c[De]?u(De):w;return function(t){s.setTime(+t);const n=f(s);return i(n,l(s),h(s,n),d(s),m(s),p(s),g(s))}}function Ye(t,n,e){return n+7*t-(e+6)%7}const Ve={[ge]:t=>t.getFullYear(),[ve]:t=>Math.floor(t.getMonth()/3),[ye]:t=>t.getMonth(),[we]:t=>t.getDate(),[ke]:t=>t.getHours(),[Me]:t=>t.getMinutes(),[Ae]:t=>t.getSeconds(),[De]:t=>t.getMilliseconds(),[$e]:t=>Te(t),[be]:t=>Pe(t),[be+xe]:(t,n)=>Ye(Pe(t),t.getDay(),je(n)),[xe]:(t,n)=>Ye(1,t.getDay(),je(n))},Xe={[ve]:t=>3*t,[be]:(t,n)=>Ye(t,0,je(n))};function Je(t,n){return Ge(t,n||1,Ve,Xe,Re)}const Ke={[ge]:t=>t.getUTCFullYear(),[ve]:t=>Math.floor(t.getUTCMonth()/3),[ye]:t=>t.getUTCMonth(),[we]:t=>t.getUTCDate(),[ke]:t=>t.getUTCHours(),[Me]:t=>t.getUTCMinutes(),[Ae]:t=>t.getUTCSeconds(),[De]:t=>t.getUTCMilliseconds(),[$e]:t=>qe(t),[be]:t=>Ue(t),[xe]:(t,n)=>Ye(1,t.getUTCDay(),We(n)),[be+xe]:(t,n)=>Ye(Ue(t),t.getUTCDay(),We(n))},Qe={[ve]:t=>3*t,[be]:(t,n)=>Ye(t,0,We(n))};function Ze(t,n){return Ge(t,n||1,Ke,Qe,He)}const tr={[ge]:me,[ve]:he.every(3),[ye]:he,[be]:ce,[we]:ae,[xe]:ae,[$e]:ae,[ke]:ie,[Me]:ee,[Ae]:ne,[De]:Xn},nr={[ge]:pe,[ve]:de.every(3),[ye]:de,[be]:le,[we]:ue,[xe]:ue,[$e]:ue,[ke]:oe,[Me]:re,[Ae]:ne,[De]:Xn};function er(t){return tr[t]}function rr(t){return nr[t]}function ir(t,n,e){return t?t.offset(n,e):void 0}function or(t,n,e){return ir(er(t),n,e)}function ar(t,n,e){return ir(rr(t),n,e)}function ur(t,n,e,r){return t?t.range(n,e,r):void 0}function sr(t,n,e,r){return ur(er(t),n,e,r)}function cr(t,n,e,r){return ur(rr(t),n,e,r)}const fr=31536e6,lr=[ge,ye,we,ke,Me,Ae,De],hr=lr.slice(0,-1),dr=hr.slice(0,-1),mr=dr.slice(0,-1),pr=mr.slice(0,-1),gr=[ge,ye],vr=[ge],yr=[[hr,1,1e3],[hr,5,5e3],[hr,15,15e3],[hr,30,3e4],[dr,1,6e4],[dr,5,3e5],[dr,15,9e5],[dr,30,18e5],[mr,1,36e5],[mr,3,108e5],[mr,6,216e5],[mr,12,432e5],[pr,1,864e5],[[ge,be],1,6048e5],[gr,1,2592e6],[gr,3,7776e6],[vr,1,fr]];function br(t){const n=t.extent,e=t.maxbins||40,r=Math.abs(Ft(n))/e;let i,o,a=Qt((t=>t[2])).right(yr,r);return a===yr.length?(i=vr,o=bn(n[0]/fr,n[1]/fr,e)):a?(a=yr[r/yr[a-1][2]<yr[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=lr,o=Math.max(bn(n[0],n[1],e),1)),{units:i,step:o}}var wr=new Date,xr=new Date;function $r(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return $r((function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return wr.setTime(+n),xr.setTime(+r),t(wr),t(xr),Math.floor(e(wr,xr))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var kr=864e5,Mr=6048e5,Ar=$r((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/kr}),(function(t){return t.getDate()-1}));function Dr(t){return $r((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Mr}))}var Sr=Dr(0),Fr=Dr(1);Dr(2),Dr(3);var Er=Dr(4);Dr(5),Dr(6);var Nr=$r((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Nr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$r((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Cr=$r((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/kr}),(function(t){return t.getUTCDate()-1}));function Or(t){return $r((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/Mr}))}var _r=Or(0),zr=Or(1);Or(2),Or(3);var Br=Or(4);Or(5),Or(6);var Tr=$r((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function Pr(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function jr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Rr(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function Lr(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Qr(i),f=Zr(i),l=Qr(o),h=Zr(o),d=Qr(a),m=Zr(a),p=Qr(u),g=Zr(u),v=Qr(s),y=Zr(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:wi,e:wi,f:Ai,g:Ti,G:ji,H:xi,I:$i,j:ki,L:Mi,m:Di,M:Si,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:uo,s:so,S:Fi,u:Ei,U:Ni,V:Oi,w:_i,W:zi,x:null,X:null,y:Bi,Y:Pi,Z:Ri,"%":ao},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Li,e:Li,f:Hi,g:eo,G:io,H:Ii,I:qi,j:Ui,L:Wi,m:Gi,M:Yi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:uo,s:so,S:Vi,u:Xi,U:Ji,V:Qi,w:Zi,W:to,x:null,X:null,y:no,Y:ro,Z:oo,"%":ao},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=m.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:fi,e:fi,f:gi,g:ai,G:oi,H:hi,I:hi,j:li,L:pi,m:ci,M:di,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=f.get(r[0].toLowerCase()),e+r[0].length):-1},q:si,Q:yi,s:bi,S:mi,u:ni,U:ei,V:ri,w:ti,W:ii,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:ai,Y:oi,Z:ui,"%":vi};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Gr[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Rr(1900,void 0,1);if(M(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(n&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=jr(Rr(o.y,0,1))).getUTCDay(),r=i>4||0===i?zr.ceil(r):zr(r),r=Cr.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Pr(Rr(o.y,0,1))).getDay(),r=i>4||0===i?Fr.ceil(r):Fr(r),r=Ar.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?jr(Rr(o.y,0,1)).getUTCDay():Pr(Rr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,jr(o)):Pr(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Gr?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}Tr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$r((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var Ir,qr,Ur,Wr,Hr,Gr={"-":"",_:" ",0:"0"},Yr=/^\s*\d+/,Vr=/^%/,Xr=/[\\^$*+?|[\]().{}]/g;function Jr(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Kr(t){return t.replace(Xr,"\\$&")}function Qr(t){return new RegExp("^(?:"+t.map(Kr).join("|")+")","i")}function Zr(t){return new Map(t.map(((t,n)=>[t.toLowerCase(),n])))}function ti(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function ni(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function ei(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function ri(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function ii(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function oi(t,n,e){var r=Yr.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function ai(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function ui(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function si(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function ci(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function fi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function li(t,n,e){var r=Yr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function hi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function di(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function mi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function pi(t,n,e){var r=Yr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function gi(t,n,e){var r=Yr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function vi(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function yi(t,n,e){var r=Yr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function bi(t,n,e){var r=Yr.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function wi(t,n){return Jr(t.getDate(),n,2)}function xi(t,n){return Jr(t.getHours(),n,2)}function $i(t,n){return Jr(t.getHours()%12||12,n,2)}function ki(t,n){return Jr(1+Ar.count(Nr(t),t),n,3)}function Mi(t,n){return Jr(t.getMilliseconds(),n,3)}function Ai(t,n){return Mi(t,n)+"000"}function Di(t,n){return Jr(t.getMonth()+1,n,2)}function Si(t,n){return Jr(t.getMinutes(),n,2)}function Fi(t,n){return Jr(t.getSeconds(),n,2)}function Ei(t){var n=t.getDay();return 0===n?7:n}function Ni(t,n){return Jr(Sr.count(Nr(t)-1,t),n,2)}function Ci(t){var n=t.getDay();return n>=4||0===n?Er(t):Er.ceil(t)}function Oi(t,n){return t=Ci(t),Jr(Er.count(Nr(t),t)+(4===Nr(t).getDay()),n,2)}function _i(t){return t.getDay()}function zi(t,n){return Jr(Fr.count(Nr(t)-1,t),n,2)}function Bi(t,n){return Jr(t.getFullYear()%100,n,2)}function Ti(t,n){return Jr((t=Ci(t)).getFullYear()%100,n,2)}function Pi(t,n){return Jr(t.getFullYear()%1e4,n,4)}function ji(t,n){var e=t.getDay();return Jr((t=e>=4||0===e?Er(t):Er.ceil(t)).getFullYear()%1e4,n,4)}function Ri(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Jr(n/60|0,"0",2)+Jr(n%60,"0",2)}function Li(t,n){return Jr(t.getUTCDate(),n,2)}function Ii(t,n){return Jr(t.getUTCHours(),n,2)}function qi(t,n){return Jr(t.getUTCHours()%12||12,n,2)}function Ui(t,n){return Jr(1+Cr.count(Tr(t),t),n,3)}function Wi(t,n){return Jr(t.getUTCMilliseconds(),n,3)}function Hi(t,n){return Wi(t,n)+"000"}function Gi(t,n){return Jr(t.getUTCMonth()+1,n,2)}function Yi(t,n){return Jr(t.getUTCMinutes(),n,2)}function Vi(t,n){return Jr(t.getUTCSeconds(),n,2)}function Xi(t){var n=t.getUTCDay();return 0===n?7:n}function Ji(t,n){return Jr(_r.count(Tr(t)-1,t),n,2)}function Ki(t){var n=t.getUTCDay();return n>=4||0===n?Br(t):Br.ceil(t)}function Qi(t,n){return t=Ki(t),Jr(Br.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function Zi(t){return t.getUTCDay()}function to(t,n){return Jr(zr.count(Tr(t)-1,t),n,2)}function no(t,n){return Jr(t.getUTCFullYear()%100,n,2)}function eo(t,n){return Jr((t=Ki(t)).getUTCFullYear()%100,n,2)}function ro(t,n){return Jr(t.getUTCFullYear()%1e4,n,4)}function io(t,n){var e=t.getUTCDay();return Jr((t=e>=4||0===e?Br(t):Br.ceil(t)).getUTCFullYear()%1e4,n,4)}function oo(){return"+0000"}function ao(){return"%"}function uo(t){return+t}function so(t){return Math.floor(+t/1e3)}function co(t){const n={};return e=>n[e]||(n[e]=t(e))}function fo(t){const n=co(t.format),e=t.formatPrefix;return{format:n,formatPrefix:e,formatFloat(t){const e=Bn(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,n){return e=>{const r=t(e),i=r.indexOf(n);if(i<0)return r;let o=function(t,n){let e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if(e=t.charCodeAt(r),e>=48&&e<=57)return r+1}(r,i);const a=o<r.length?r.slice(o):"";for(;--o>i;)if("0"!==r[o]){++o;break}return r.slice(0,o)+a}}(n(e),n(".1f")(1)[1])}return n(e)},formatSpan(t,r,i,o){o=Bn(null==o?",f":o);const a=bn(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(On(n)/3)))-On(Math.abs(t)))}(a,u))||(o.precision=s),e(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,On(n)-On(t))+1}(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=function(t){return Math.max(0,-On(Math.abs(t)))}(a))||(o.precision=s-2*("%"===o.type))}return n(o)}}}let lo,ho;function mo(){return lo=fo({format:In,formatPrefix:qn})}function po(t){return fo(Hn(t))}function go(t){return arguments.length?lo=po(t):lo}function vo(t,n,e){S(e=e||{})||p(`Invalid time multi-format specifier: ${e}`);const r=n(Ae),i=n(Me),o=n(ke),a=n(we),u=n(be),s=n(ye),c=n(ve),f=n(ge),l=t(e[De]||".%L"),h=t(e[Ae]||":%S"),d=t(e[Me]||"%I:%M"),m=t(e[ke]||"%I %p"),g=t(e[we]||e[xe]||"%a %d"),v=t(e[be]||"%b %d"),y=t(e[ye]||"%B"),b=t(e[ve]||"%B"),w=t(e[ge]||"%Y");return t=>(r(t)<t?l:i(t)<t?h:o(t)<t?d:a(t)<t?m:s(t)<t?u(t)<t?g:v:f(t)<t?c(t)<t?y:b:w)(t)}function yo(t){const n=co(t.format),e=co(t.utcFormat);return{timeFormat:t=>xt(t)?n(t):vo(n,er,t),utcFormat:t=>xt(t)?e(t):vo(e,rr,t),timeParse:co(t.parse),utcParse:co(t.utcParse)}}function bo(){return ho=yo({format:qr,parse:Ur,utcFormat:Wr,utcParse:Hr})}function wo(t){return yo(Lr(t))}function xo(t){return arguments.length?ho=wo(t):ho}Ir=Lr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),qr=Ir.format,Ur=Ir.parse,Wr=Ir.utcFormat,Hr=Ir.utcParse,mo(),bo();const $o=(t,n)=>ut({},t,n);function ko(t,n){const e=t?po(t):go(),r=n?wo(n):xo();return $o(e,r)}function Mo(t,n){const e=arguments.length;return e&&2!==e&&p("defaultLocale expects either zero or two arguments."),e?$o(go(t),xo(n)):$o(go(),xo())}const Ao=/^(data:|([A-Za-z]+:)?\/\/)/,Do=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,So=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Fo(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n)}async function Eo(t,n){n=ut({},this.options,n);const e=this.fileAccess,r={href:null};let i,o,a;const u=Do.test(t.replace(So,""));null!=t&&"string"==typeof t&&u||p("Sanitize failure, invalid URI: "+Et(t));const s=Ao.test(t);return(a=n.baseURL)&&!s&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!s&&e,i?t=t.slice(7):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),o=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(r.crossOrigin=n.crossOrigin+""),r}function No(t){return t?n=>new Promise(((e,r)=>{t.readFile(n,((t,n)=>{t?r(t):e(n)}))})):Co}async function Co(){p("No file system access.")}function Oo(t){return t?async function(n,e){const r=ut({},this.options.http,e),i=e&&e.response,o=await t(n,r);return o.ok?Z(o[i])?o[i]():o.text():p(o.status+""+o.statusText)}:_o}async function _o(){p("No HTTP fetch method available.")}const zo=t=>!(Number.isNaN(+t)||t instanceof Date),Bo={boolean:Nt,integer:_,number:_,date:Ot,string:_t,unknown:b},To=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>zo(t)&&Number.isInteger(+t),zo,t=>!Number.isNaN(Date.parse(t))],Po=["boolean","integer","number","date"];function jo(t,n){if(!t||!t.length)return"unknown";const e=t.length,r=To.length,i=To.map(((t,n)=>n+1));for(let a,u,s=0,c=0;s<e;++s)for(u=n?t[s][n]:t[s],a=0;a<r;++a)if(i[a]&&null!=(o=u)&&o==o&&!To[a](u)&&(i[a]=0,++c,c===To.length))return"string";var o;return Po[i.reduce(((t,n)=>0===t?n:t),0)-1]}function Ro(t,n){return n.reduce(((n,e)=>(n[e]=jo(t,e),n)),{})}function Lo(t){const n=function(n,e){const r={delimiter:t};return Io(n,e?ut(e,r):r)};return n.responseType="text",n}function Io(t,n){return n.header&&(t=n.header.map(Et).join(n.delimiter)+"\n"+t),qt(n.delimiter).parse(t+"")}function qo(t,n){const e=n&&n.property?v(n.property):b;return!S(t)||(r=t,"function"==typeof Buffer&&Z(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return!D(t)&&yt(t)&&(t=[...t]),n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t),n);var r}Io.responseType="text",qo.responseType="json";const Uo={interior:(t,n)=>t!==n,exterior:(t,n)=>t===n};function Wo(t,n){let e,r,i,o;return t=qo(t,n),n&&n.feature?(e=Wt,i=n.feature):n&&n.mesh?(e=Vt,i=n.mesh,o=Uo[n.filter]):p("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?e(t,r,o):p("Invalid TopoJSON object: "+i),r&&r.features||[r]}Wo.responseType="json";const Ho={dsv:Io,csv:Lo(","),tsv:Lo("\t"),json:qo,topojson:Wo};function Go(t,n){return arguments.length>1?(Ho[t]=n,this):ft(Ho,t)?Ho[t]:null}function Yo(t){const n=Go(t);return n&&n.responseType||"text"}function Vo(t,n,e,r){const i=Go((n=n||{}).type||"json");return i||p("Unknown data format type: "+n.type),t=i(t,n),n.parse&&function(t,n,e,r){if(!t.length)return;const i=xo();e=e||i.timeParse,r=r||i.utcParse;let o,a,u,s,c,f,l=t.columns||Object.keys(t[0]);"auto"===n&&(n=Ro(t,l)),l=Object.keys(n);const h=l.map((t=>{const i=n[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:")))return o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?r:e)(a);if(!Bo[i])throw Error("Illegal format pattern: "+t+":"+i);return Bo[i]}));for(u=0,c=t.length,f=l.length;u<c;++u)for(o=t[u],s=0;s<f;++s)a=l[s],o[a]=h[s](o[a])}(t,n.parse,e,r),ft(t,"columns")&&delete t.columns,t}const Xo=function(t){return n=>({options:n||{},sanitize:Eo,load:Fo,fileAccess:!1,file:No(null),http:Oo(t)})}("undefined"!=typeof fetch&&fetch);function Jo(t){const n=t||b,e=[],r={};return e.add=t=>{const i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=t=>{const i=n(t);if(r[i]){r[i]=0;const n=e.indexOf(t);n>=0&&e.splice(n,1)}return e},e}async function Ko(t,n){try{await n(t)}catch(n){t.error(n)}}const Qo=Symbol("vega_id");let Zo=1;function ta(t){return!(!t||!na(t))}function na(t){return t[Qo]}function ea(t,n){return t[Qo]=n,t}function ra(t){const n=t===Object(t)?t:{data:t};return na(n)?n:ea(n,Zo++)}function ia(t){return oa(t,ra({}))}function oa(t,n){for(const e in t)n[e]=t[e];return n}function aa(t,n){return ea(n,na(t))}function ua(t,n){return t?n?(e,r)=>t(e,r)||na(n(e))-na(n(r)):(n,e)=>t(n,e)||na(n)-na(e):null}function sa(t){return t&&t.constructor===ca}function ca(){const t=[],n=[],e=[],r=[],i=[];let o=null,a=!1;return{constructor:ca,insert(n){const e=K(n),r=e.length;for(let n=0;n<r;++n)t.push(e[n]);return this},remove(t){const e=Z(t)?r:n,i=K(t),o=i.length;for(let t=0;t<o;++t)e.push(i[t]);return this},modify(t,n,r){const o={field:n,value:ot(r)};return Z(t)?(o.filter=t,i.push(o)):(o.tuple=t,e.push(o)),this},encode(t,n){return Z(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(u,s){const c={},f={};let l,h,d,m,p,g;for(l=0,h=s.length;l<h;++l)c[na(s[l])]=1;for(l=0,h=n.length;l<h;++l)p=n[l],c[na(p)]=-1;for(l=0,h=r.length;l<h;++l)m=r[l],s.forEach((t=>{m(t)&&(c[na(t)]=-1)}));for(l=0,h=t.length;l<h;++l)p=t[l],g=na(p),c[g]?c[g]=1:u.add.push(ra(t[l]));for(l=0,h=s.length;l<h;++l)p=s[l],c[na(p)]<0&&u.rem.push(p);function v(t,n,e){e?t[n]=e(t):u.encode=n,a||(f[na(t)]=t)}for(l=0,h=e.length;l<h;++l)d=e[l],p=d.tuple,m=d.field,g=c[na(p)],g>0&&(v(p,m,d.value),u.modifies(m));for(l=0,h=i.length;l<h;++l)d=i[l],m=d.filter,s.forEach((t=>{m(t)&&c[na(t)]>0&&v(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=n.length||r.length?s.filter((t=>c[na(t)]>0)):s.slice();else for(g in f)u.mod.push(f[g]);return(o||null==o&&(n.length||r.length))&&u.clean(!0),u}}}const fa="_:mod:_";function la(){Object.defineProperty(this,fa,{writable:!0,value:{}})}la.prototype={set(t,n,e,r){const i=this,o=i[t],a=i[fa];return null!=n&&n>=0?(o[n]!==e||r)&&(o[n]=e,a[n+":"+t]=-1,a[t]=-1):(o!==e||r)&&(i[t]=e,a[t]=D(e)?1+e.length:-1),i},modified(t,n){const e=this[fa];if(!arguments.length){for(const t in e)if(e[t])return!0;return!1}if(D(t)){for(let n=0;n<t.length;++n)if(e[t[n]])return!0;return!1}return null!=n&&n>=0?n+1<e[t]||!!e[n+":"+t]:!!e[t]},clear(){return this[fa]={},this}};let ha=0;const da=new la;function ma(t,n,e,r){this.id=++ha,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}function pa(t){return function(n){const e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}ma.prototype={targets(){return this._targets||(this._targets=Jo(y))},set(t){return this.value!==t?(this.value=t,1):0},skip:pa(1),modified:pa(2),parameters(t,n,e){n=!1!==n;const r=this._argval=this._argval||new la,i=this._argops=this._argops||[],o=[];let a,u,s,c;const f=(t,e,a)=>{a instanceof ma?(a!==this&&(n&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:e})):r.set(t,e,a)};for(a in t)if(u=t[a],"pulse"===a)K(u).forEach((t=>{t instanceof ma?t!==this&&(t.targets().add(this),o.push(t)):p("Pulse parameters must be operator instances.")})),this.source=u;else if(D(u))for(r.set(a,-1,Array(s=u.length)),c=0;c<s;++c)f(a,c,u[c]);else f(a,-1,u);return this.marshall().clear(),e&&(i.initonly=!0),o},marshall(t){const n=this._argval||da,e=this._argops;let r,i,o,a;if(e){const u=e.length;for(i=0;i<u;++i)r=e[i],o=r.op,a=o.modified()&&o.stamp===t,n.set(r.name,r.index,o.value,a);if(e.initonly){for(i=0;i<u;++i)r=e[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return n},detach(){const t=this._argops;let n,e,r,i;if(t)for(n=0,e=t.length;n<e;++n)r=t[n],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const n=this._update;if(n){const e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.pulse=n||t}};let ga=0;function va(t,n,e){this.id=++ga,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function ya(t,n,e){return new va(t,n,e)}va.prototype={_filter:$,_apply:b,targets(){return this._targets||(this._targets=Jo(y))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const n=this.value=this._apply(t),e=this._targets,r=e?e.length:0;for(let t=0;t<r;++t)e[t].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const n=ya(t);return this.targets().add(n),n},apply(t){const n=ya(null,t);return this.targets().add(n),n},merge(){const t=ya();this.targets().add(t);for(let n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},throttle(t){let n=-1;return this.filter((()=>{const e=Date.now();return e-n>t?(n=e,1):0}))},debounce(t){const n=ya();return this.targets().add(ya(null,null,at(t,(t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},between(t,n){let e=!1;return t.targets().add(ya(null,null,(()=>e=!0))),n.targets().add(ya(null,null,(()=>e=!1))),this.filter((()=>e))},detach(){this._filter=$,this._targets=null}};const ba={skip:!0};function wa(t,n,e,r,i,o){const a=ut({},o,ba);let u,s;Z(e)||(e=ot(e)),void 0===r?u=n=>t.touch(e(n)):Z(r)?(s=new ma(null,r,i,!1),u=n=>{s.evaluate(n);const r=e(n),i=s.value;sa(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=n=>t.update(e(n),r,a),n.apply(u)}function xa(t,n,e,r,i,o){if(void 0===r)n.targets().add(e);else{const a=o||{},u=new ma(null,function(t,n){return n=Z(n)?n:ot(n),t?function(e,r){const i=n(e,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:n}(e,r),i,!1);u.modified(a.force),u.rank=n.rank,n.targets().add(u),e&&(u.skip(!0),u.value=e.value,u.targets().add(e),t.connect(e,[u]))}}const $a={};function ka(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function Ma(t,n){const e=[];return Tt(t,n,(t=>e.push(t))),e}function Aa(t,n){const e={};return t.visit(n,(t=>{e[na(t)]=1})),t=>e[na(t)]?null:t}function Da(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function Sa(t,n,e,r){const i=this;let o=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const t of e)if(t.stamp===n){if(t.fields){const n=i.fields||(i.fields={});for(const e in t.fields)n[e]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function Fa(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}ka.prototype={StopPropagation:$a,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new ka(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new ka(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,Aa(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return D(t)?t.forEach((t=>n[t]=!0)):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?D(t)?t.some((t=>e[t])):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=Da(e.addF,n)),2&t&&(e.remF=Da(e.remF,n)),4&t&&(e.modF=Da(e.modF,n)),16&t&&(e.srcF=Da(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=Ma(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=Ma(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=Ma(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return Tt(e.source,e.srcF,r),e;1&t&&Tt(e.add,e.addF,r),2&t&&Tt(e.rem,e.remF,r),4&t&&Tt(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const t=e.add.length+e.mod.length;t===i.length||Tt(i,t?Aa(e,5):e.srcF,r)}return e}},mt(Sa,ka,{fork(t){const n=new ka(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(t=>n.add.push(t))),t&n.REM&&this.visit(n.REM,(t=>n.rem.push(t))),t&n.MOD&&this.visit(n.MOD,(t=>n.mod.push(t)))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?D(t)?t.some((t=>e[t])):e[t]:0},filter(){p("MultiPulse does not support filtering.")},materialize(){p("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let o=0;if(t&e.SOURCE)for(;o<i;++o)r[o].visit(t,n);else for(;o<i;++o)r[o].stamp===e.stamp&&r[o].visit(t,n);return e}});const Ea={skip:!1,force:!1};function Na(t,n,e,r){let i,o;const a=t[e];for(;e>n&&(o=e-1>>1,i=t[o],r(a,i)<0);)t[e]=i,e=o;return t[e]=a}function Ca(){this.logger(A()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Mo();try{this._loader=Xo()}catch(t){}this._touched=Jo(y),this._input={},this._pulse=null,this._heap=function(t){let n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),Na(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(t,n,e){const r=n,i=t.length,o=t[n];let a,u=1+(n<<1);for(;u<i;)a=u+1,a<i&&e(t[u],t[a])>=0&&(u=a),t[n]=t[u],u=1+((n=u)<<1);t[n]=o,Na(t,r,n,e)}(n,0,t)):r=e,r}}}(((t,n)=>t.qrank-n.qrank)),this._postrun=[]}function Oa(t){return function(){return this._log[t].apply(this,arguments)}}function _a(t,n){ma.call(this,t,null,n)}Ca.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Oa("error"),warn:Oa("warn"),info:Oa("info"),debug:Oa("debug"),logLevel:Oa("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,o=1;return t instanceof ma?i=t:t&&t.prototype instanceof ma?i=new t:Z(t)?i=new ma(null,t):(o=0,i=new ma(t,n)),this.rank(i),o&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i<r;++i)if(e<n[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let e,r,i;for(;n.length;)if(this.rank(e=n.pop()),r=e._targets)for(i=r.length;--i>=0;)n.push(e=r[i]),e===t&&p("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||Ea);const r=new ka(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||Ea;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||Ea;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:ca,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return Vo(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(t){let n;const e=new Promise((t=>n=t));return e.requests=0,e.done=()=>{0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const o=await r.request(n,e);return r.pulse(t,r.changeset().remove($).insert(o.data||[])),i.done(),o},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Yo(n&&n.type)});try{r=e.parse(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,o=ya(e,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):K(t);const s=u.length;for(let t=0;t<s;++t)u[t].addEventListener(n,a);return o},on:function(t,n,e,r,i){return(t instanceof ma?xa:wa)(this,t,n,e,r,i),this},evaluate:async function(t,n,e){const r=this,i=[];if(r._pulse)return Fa(r);if(r._pending&&await r._pending,n&&await Ko(r,n),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new ka(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=Jo(y);let a,u,s,c=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=$a),u!==$a&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++c):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${c} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,n)=>n.priority-t.priority));r._postrun=[];for(let n=0;n<t.length;++n)await Ko(r,t[n].callback)}return e&&await Ko(r,e),i.length&&Promise.all(i).then((t=>r.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,n,e){return this._pulse?Fa(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,n){const e=t.stamp<this._clock;e&&(t.stamp=this._clock),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const e=t.source,r=this._clock;return e&&D(e)?new Sa(this,r,e.map((t=>t.pulse)),n):this._input[t.id]||function(t,n){return n&&n.stamp===t.stamp?n:(t=t.fork(),n&&n!==$a&&(t.source=n.source),t)}(this._pulse,e&&e.pulse)}},mt(_a,ma,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?this.skip(!1):n=this.evaluate(t),n=n||t,n.then?n=n.then((t=>this.pulse=t)):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const za={};function Ba(t){const n=Ta(t);return n&&n.Definition||null}function Ta(t){return t=t&&t.toLowerCase(),ft(za,t)?za[t]:null}function*Pa(t,n){if(null==n)for(let n of t)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)r=n(r,++e,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function ja(t,n,e){const r=Float64Array.from(Pa(t,e));return r.sort(Jt),n.map((t=>An(r,t)))}function Ra(t,n){return ja(t,[.25,.5,.75],n)}function La(t,n){const e=t.length,r=function(t,n){const e=function(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}(t,n);return e?Math.sqrt(e):e}(t,n),i=Ra(t,n);return 1.06*(Math.min(r,(i[2]-i[0])/1.34)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function Ia(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let o,a,u,s,c,f,l=t.extent[0],h=t.extent[1];const d=t.span||h-l||Math.abs(l)||1;if(t.step)o=t.step;else if(t.steps){for(s=d/n,c=0,f=t.steps.length;c<f&&t.steps[c]<s;++c);o=t.steps[Math.max(0,c-1)]}else{for(a=Math.ceil(Math.log(n)/r),u=t.minstep||0,o=Math.max(u,Math.pow(e,Math.round(Math.log(d)/r)-a));Math.ceil(d/o)>n;)o*=e;for(c=0,f=i.length;c<f;++c)s=o/i[c],s>=u&&d/s<=n&&(o=s)}s=Math.log(o);const m=Math.pow(e,-(s>=0?0:1+~~(-s/r))-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(l/o+m)*o,l=l<s?s-o:s,h=Math.ceil(h/o)*o),{start:l,stop:h===l?l+o:h,step:o}}var qa=Math.random;function Ua(t,n,e,r){if(!t.length)return[void 0,void 0];const i=Float64Array.from(Pa(t,r)),o=i.length,a=n;let u,s,c,f;for(c=0,f=Array(a);c<a;++c){for(u=0,s=0;s<o;++s)u+=i[~~(qa()*o)];f[c]=u/o}return f.sort(Jt),[Mn(f,e/2),Mn(f,1-e/2)]}function Wa(t,n,e,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,c=r(t[0]),f=c,l=c+n;for(;s<i;++s){if(a=r(t[s]),a>=l){for(f=(c+f)/2;u<s;++u)o[u]=f;l=a+n,c=a}f=a}for(f=(c+f)/2;u<s;++u)o[u]=f;return e?function(t,n){const e=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<e;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<n){for(i=a+(o+r-a-a>>1);i<a;)t[i++]=t[a];for(;i>a;)t[i--]=t[o]}o=a,a=r}return t}(o,n+n/4):o}const Ha=Math.sqrt(2*Math.PI),Ga=Math.SQRT2;let Ya=NaN;function Va(t,n){t=t||0,n=null==n?1:n;let e,r,i=0,o=0;if(Ya==Ya)i=Ya,Ya=NaN;else{do{i=2*qa()-1,o=2*qa()-1,e=i*i+o*o}while(0===e||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Ya=o*r}return t+i*n}function Xa(t,n,e){const r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*Ha)}function Ja(t,n,e){const r=(t-(n=n||0))/(e=null==e?1:e),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let n;i<7.07106781186547?(n=.0352624965998911*i+.700383064443688,n=n*i+6.37396220353165,n=n*i+33.912866078383,n=n*i+112.079291497871,n=n*i+221.213596169931,n=n*i+220.206867912376,o=t*n,n=.0883883476483184*i+1.75566716318264,n=n*i+16.064177579207,n=n*i+86.7807322029461,n=n*i+296.564248779674,n=n*i+637.333633378831,n=n*i+793.826512519948,n=n*i+440.413735824752,o/=n):(n=i+.65,n=i+4/n,n=i+3/n,n=i+2/n,n=i+1/n,o=t/n/2.506628274631)}return r>0?1-o:o}function Ka(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Ga*function(t){let n,e=-Math.log((1-t)*(1+t));return e<6.25?(e-=3.125,n=-364441206401782e-35,n=n*e-16850591381820166e-35,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=n*e-1333171662854621e-31,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=n*e-4054566272975207e-29,n=n*e-8151934197605472e-29,n=26335093153082323e-28+n*e,n=n*e-12975133253453532e-27,n=n*e-5415412054294628e-26,n=1.0512122733215323e-9+n*e,n=n*e-4.112633980346984e-9,n=n*e-2.9070369957882005e-8,n=4.2347877827932404e-7+n*e,n=n*e-13654692000834679e-22,n=n*e-13882523362786469e-21,n=.00018673420803405714+n*e,n=n*e-.000740702534166267,n=n*e-.006033670871430149,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*e,n=n*e-2.7517406297064545e-7,n=1.8239629214389228e-8+n*e,n=15027403968909828e-22+n*e,n=n*e-4013867526981546e-21,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=n*e-47318229009055734e-21,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=n*e-.0003550375203628475,n=.0009532893797373805+n*e,n=n*e-.0016882755560235047,n=.002491442096107851+n*e,n=n*e-.003751208507569241,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=n*e-2.555641816996525e-10,n=1.5076572693500548e-9+n*e,n=n*e-3.789465440126737e-9,n=7.61570120807834e-9+n*e,n=n*e-1.496002662714924e-8,n=2.914795345090108e-8+n*e,n=n*e-6.771199775845234e-8,n=2.2900482228026655e-7+n*e,n=n*e-9.9298272942317e-7,n=4526062597223154e-21+n*e,n=n*e-1968177810553167e-20,n=7599527703001776e-20+n*e,n=n*e-.00021503011930044477,n=n*e-.00013871931833623122,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}(2*t-1)}function Qa(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Va(e,r),pdf:t=>Xa(t,e,r),cdf:t=>Ja(t,e,r),icdf:t=>Ka(t,e,r)};return i.mean(t).stdev(n)}function Za(t,n){const e=Qa();let r=0;const i={data(e){return arguments.length?(t=e,r=e?e.length:0,i.bandwidth(n)):t},bandwidth(e){return arguments.length?(!(n=e)&&t&&(n=La(t)),i):n},sample:()=>t[~~(qa()*r)]+n*e.sample(),pdf(i){let o=0,a=0;for(;a<r;++a)o+=e.pdf((i-t[a])/n);return o/n/r},cdf(i){let o=0,a=0;for(;a<r;++a)o+=e.cdf((i-t[a])/n);return o/r},icdf(){throw Error("KDE icdf not supported.")}};return i.data(t)}function tu(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+Va()*n)}function nu(t,n,e){if(t<=0)return 0;n=n||0,e=null==e?1:e;const r=(Math.log(t)-n)/e;return Math.exp(-.5*r*r)/(e*Ha*t)}function eu(t,n,e){return Ja(Math.log(t),n,e)}function ru(t,n,e){return Math.exp(Ka(t,n,e))}function iu(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>tu(e,r),pdf:t=>nu(t,e,r),cdf:t=>eu(t,e,r),icdf:t=>ru(t,e,r)};return i.mean(t).stdev(n)}function ou(t,n){let e,r=0;const i={weights(t){return arguments.length?(e=function(t){const n=[];let e,i=0;for(e=0;e<r;++e)i+=n[e]=null==t[e]?1:+t[e];for(e=0;e<r;++e)n[e]/=i;return n}(n=t||[]),i):n},distributions(e){return arguments.length?(e?(r=e.length,t=e):(r=0,t=[]),i.weights(n)):t},sample(){const n=qa();let i=t[r-1],o=e[0],a=0;for(;a<r-1;o+=e[++a])if(n<o){i=t[a];break}return i.sample()},pdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].pdf(n);return i},cdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].cdf(n);return i},icdf(){throw Error("Mixture icdf not supported.")}};return i.distributions(t).weights(n)}function au(t,n){return null==n&&(n=null==t?1:t,t=0),t+(n-t)*qa()}function uu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=n&&t<=e?1/(e-n):0}function su(t,n,e){return null==e&&(e=null==n?1:n,n=0),t<n?0:t>e?1:(t-n)/(e-n)}function cu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function fu(t,n){let e,r;const i={min(t){return arguments.length?(e=t||0,i):e},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>au(e,r),pdf:t=>uu(t,e,r),cdf:t=>su(t,e,r),icdf:t=>cu(t,e,r)};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function lu(t,n,e){let r=0,i=0;for(const o of t){const t=e(o);null==n(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function hu(t,n,e,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-o*t,o]}function du(t,n,e,r){t=t.filter((t=>{let r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,e)=>n(t)-n(e)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,c,f=0,l=0,h=0;for(c of t)o[f]=u=+n(c),a[f]=s=+e(c),++f,l+=(u-l)/f,h+=(s-h)/f;for(f=0;f<i;++f)o[f]-=l,a[f]-=h;return[o,a,l,h]}function mu(t,n,e,r){let i,o,a=-1;for(const u of t)i=n(u),o=e(u),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function pu(t,n,e,r,i){let o=0,a=0;return mu(t,n,e,((t,n)=>{const e=n-i(t),u=n-r;o+=e*e,a+=u*u})),1-o/a}function gu(t,n,e){let r=0,i=0,o=0,a=0,u=0;mu(t,n,e,((t,n)=>{++u,r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),c=t=>s[0]+s[1]*t;return{coef:s,predict:c,rSquared:pu(t,n,e,i,c)}}function vu(t,n,e){let r=0,i=0,o=0,a=0,u=0;mu(t,n,e,((t,n)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),c=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:c,rSquared:pu(t,n,e,i,c)}}function yu(t,n,e){const[r,i,o,a]=du(t,n,e);let u,s,c,f=0,l=0,h=0,d=0,m=0;mu(t,n,e,((t,n)=>{u=r[m++],s=Math.log(n),c=u*n,f+=(n*s-f)/m,l+=(c-l)/m,h+=(c*s-h)/m,d+=(u*c-d)/m}));const[p,g]=hu(l/a,f/a,h/a,d/a),v=t=>Math.exp(p+g*(t-o));return{coef:[Math.exp(p-g*o),g],predict:v,rSquared:pu(t,n,e,a,v)}}function bu(t,n,e){let r=0,i=0,o=0,a=0,u=0,s=0;mu(t,n,e,((t,n)=>{const e=Math.log(t),c=Math.log(n);++s,r+=(e-r)/s,i+=(c-i)/s,o+=(e*c-o)/s,a+=(e*e-a)/s,u+=(n-u)/s}));const c=hu(r,i,o,a),f=t=>c[0]*Math.pow(t,c[1]);return c[0]=Math.exp(c[0]),{coef:c,predict:f,rSquared:pu(t,n,e,u,f)}}function wu(t,n,e){const[r,i,o,a]=du(t,n,e),u=r.length;let s,c,f,l,h=0,d=0,m=0,p=0,g=0;for(s=0;s<u;)c=r[s],f=i[s++],l=c*c,h+=(l-h)/s,d+=(l*c-d)/s,m+=(l*l-m)/s,p+=(c*f-p)/s,g+=(l*f-g)/s;const v=m-h*h,y=h*v-d*d,b=(g*h-p*d)/y,w=(p*v-g*d)/y,x=-b*h,$=t=>b*(t-=o)*t+w*t+x+a;return{coef:[x-w*o+b*o*o+a,w-2*b*o,b],predict:$,rSquared:pu(t,n,e,a,$)}}function xu(t,n,e,r){if(0===r)return lu(t,n,e);if(1===r)return gu(t,n,e);if(2===r)return wu(t,n,e);const[i,o,a,u]=du(t,n,e),s=i.length,c=[],f=[],l=r+1;let h,d,m,p,g;for(h=0;h<l;++h){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],h)*o[m];for(c.push(p),g=new Float64Array(l),d=0;d<l;++d){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],h+d);g[d]=p}f.push(g)}f.push(c);const v=function(t){const n=t.length-1,e=[];let r,i,o,a,u;for(r=0;r<n;++r){for(a=r,i=r+1;i<n;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<n+1;++o)u=t[o][r],t[o][r]=t[o][a],t[o][a]=u;for(i=r+1;i<n;++i)for(o=n;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=n-1;i>=0;--i){for(u=0,o=i+1;o<n;++o)u+=t[o][i]*e[o];e[i]=(t[n][i]-u)/t[i][i]}return e}(f),y=t=>{let n=u+v[0]+v[1]*(t-=a)+v[2]*t*t;for(h=3;h<l;++h)n+=v[h]*Math.pow(t,h);return n};return{coef:$u(l,v,-a,u),predict:y,rSquared:pu(t,n,e,u,y)}}function $u(t,n,e,r){const i=Array(t);let o,a,u,s;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(u=n[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(e,a)*s;return i[0]+=r,i}function ku(t,n,e,r){const[i,o,a,u]=du(t,n,e,!0),s=i.length,c=Math.max(2,~~(r*s)),f=new Float64Array(s),l=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const n=[0,c-1];for(let t=0;t<s;++t){const e=i[t],r=n[0],a=n[1];let u=0,s=0,c=0,d=0,m=0;const p=1/Math.abs(i[e-i[r]>i[a]-e?r:a]-e||1);for(let t=r;t<=a;++t){const n=i[t],r=o[t],a=Mu(Math.abs(e-n)*p)*h[t],f=n*a;u+=a,s+=f,c+=r*a,d+=r*f,m+=n*f}const[g,v]=hu(s/u,c/u,d/u,m/u);f[t]=g+v*e,l[t]=Math.abs(o[t]-f[t]),Au(i,t+1,n)}if(2===t)break;const e=Dn(l);if(Math.abs(e)<1e-12)break;for(let t,n,r=0;r<s;++r)t=l[r]/(6*e),h[r]=t>=1?1e-12:(n=1-t*t)*n}return function(t,n,e,r){const i=t.length,o=[];let a,u=0,s=0,c=[];for(;u<i;++u)a=t[u]+e,c[0]===a?c[1]+=(n[u]-c[1])/++s:(s=0,c[1]+=r,c=[a,n[u]],o.push(c));return c[1]+=r,o}(i,f,a,u)}function Mu(t){return(t=1-t*t*t)*t*t}function Au(t,n,e){const r=t[n];let i=e[0],o=e[1]+1;if(!(o>=t.length))for(;n>i&&t[o]-r<=r-t[i];)e[0]=++i,e[1]=o,++o}const Du=.5*Math.PI/180;function Su(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=n=>[n,t(n)],o=n[0],a=n[1],u=a-o,s=u/r,c=[i(o)],f=[];if(e===r){for(let t=1;t<r;++t)c.push(i(o+t/e*u));return c.push(i(a)),c}f.push(i(a));for(let t=e;--t>0;)f.push(i(o+t/e*u));let l=c[0],h=f[f.length-1];const d=1/u,m=function(t,n){let e=t,r=t;const i=n.length;for(let t=0;t<i;++t){const i=n[t][1];i<e&&(e=i),i>r&&(r=i)}return 1/(r-e)}(l[1],f);for(;h;){const t=i((l[0]+h[0])/2);t[0]-l[0]>=s&&Fu(l,t,h,d,m)>Du?f.push(t):(l=h,c.push(h),f.pop()),h=f[f.length-1]}return c}function Fu(t,n,e,r,i){const o=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),a=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(o-a)}function Eu(t){return t&&t.length?1===t.length?t[0]:(n=t,t=>{const e=n.length;let r=1,i=String(n[0](t));for(;r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function Nu(t,n,e){return e||t+(n?"_"+n:"")}const Cu=()=>{},Ou={init:Cu,add:Cu,rem:Cu,idx:0},_u={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n<t.min||void 0===t.min)&&(t.min=n)},rem:(t,n)=>{n<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,n)=>{(n>t.max||void 0===t.max)&&(t.max=n)},rem:(t,n)=>{n>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,n,e)=>{n<t.min&&(t.argmin=e)},rem:(t,n)=>{n<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},zu=Object.keys(_u).filter((t=>"__count__"!==t));function Bu(t,n,e){return _u[t](e,n)}function Tu(t,n){return t.idx-n.idx}function Pu(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function ju(t,n){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((e=>e.add(this,t,n)))):++this.missing}function Ru(t,n){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((e=>e.rem(this,t,n)))):--this.missing}function Lu(t){return this._out.forEach((n=>t[n.out]=n.value(this))),t}function Iu(t,n){const e=n||b,r=function(t){const n={};t.forEach((t=>n[t.name]=t));const e=t=>{t.req&&t.req.forEach((t=>{n[t]||e(n[t]=_u[t]())}))};return t.forEach(e),Object.values(n).sort(Tu)}(t),i=t.slice().sort(Tu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=Pu,o.prototype.add=ju,o.prototype.rem=Ru,o.prototype.set=Lu,o.prototype.get=e,o.fields=t.map((t=>t.out)),o}function qu(t){this._key=t?v(t):na,this.reset()}[...zu,"__count__"].forEach((t=>{_u[t]=function(t,n){return(e,r)=>ut({name:t,aggregate_param:r,out:e||t},Ou,n)}(t,_u[t])}));const Uu=qu.prototype;function Wu(t){_a.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function Hu(t){_a.call(this,null,t)}function Gu(t,n,e){const r=t;let i=n||[],o=e||[],a={},u=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,n)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),n&&t&&i.sort(t),o.length&&(i=t?At(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Yu(t){_a.call(this,[],t)}function Vu(t){ma.call(this,null,Xu,t)}function Xu(t){return this.value&&!t.modified()?this.value:tt(t.fields,t.orders)}function Ju(t){_a.call(this,null,t)}function Ku(t){_a.call(this,null,t)}Uu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Uu.add=function(t){this._add.push(t)},Uu.rem=function(t){this._rem.push(t)},Uu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,o=Array(r-i),a={};let u,s,c;for(u=0;u<i;++u)a[e(n[u])]=1;for(u=0,s=0;u<r;++u)a[e(c=t[u])]?a[e(c)]=0:o[s++]=c;return this._rem=[],this._add=o},Uu.distinct=function(t){const n=this.values(),e={};let r,i=n.length,o=0;for(;--i>=0;)r=t(n[i])+"",ft(e,r)||(e[r]=1,++o);return o},Uu.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=ct(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},Uu.argmin=function(t){return this.extent(t)[0]||{}},Uu.argmax=function(t){return this.extent(t)[1]||{}},Uu.min=function(t){const n=this.extent(t)[0];return null!=n?t(n):void 0},Uu.max=function(t){const n=this.extent(t)[1];return null!=n?t(n):void 0},Uu.quartile=function(t){return this._get===t&&this._q||(this._q=Ra(this.values(),t),this._get=t),this._q},Uu.q1=function(t){return this.quartile(t)[0]},Uu.q2=function(t){return this.quartile(t)[1]},Uu.q3=function(t){return this.quartile(t)[2]},Uu.ci=function(t){return this._get===t&&this._ci||(this._ci=Ua(this.values(),1e3,.05,t),this._get=t),this._ci},Uu.ci0=function(t){return this.ci(t)[0]},Uu.ci1=function(t){return this.ci(t)[1]},Wu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:zu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},mt(Wu,_a,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,(t=>e.add(t)))):(e.value=e.value||e.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),r.modifies(e._outputs),e._drop=!1!==t.drop,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter((()=>this.clean())),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map((()=>({}))),i=e.length;function o(t){let n,o,a,u;for(n in t)for(a=t[n].tuple,o=0;o<i;++o)r[o][u=a[e[o]]]=u}o(t._prev),o(n),function o(a,u,s){const c=e[s],f=r[s++];for(const e in f){const r=a?a+"|"+e:e;u[c]=f[e],s<i?o(r,u,s):n[r]||t.cell(r,u)}}("",{},0)},init(t){const n=this._inputs=[],e=this._outputs=[],r={};function i(t){const e=K(l(t)),i=e.length;let o,a=0;for(;a<i;++a)r[o=e[a]]||(r[o]=1,n.push(o))}this._dims=K(t.groupby),this._dnames=this._dims.map((t=>{const n=f(t);return i(t),e.push(n),n})),this.cellkey=t.key?t.key:Eu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=t.fields||[null],a=t.ops||["count"],u=t.aggregate_params||[null],s=t.as||[],c=o.length,h={};let d,m,g,v,y,b,w;for(c!==a.length&&p("Unmatched number of fields and aggregate ops."),w=0;w<c;++w)d=o[w],m=a[w],g=u[w]||null,null==d&&"count"!==m&&p("Null aggregate field specified."),y=f(d),b=Nu(m,y,s[w]),e.push(b),"count"!==m?(v=h[y],v||(i(d),v=h[y]=[],v.field=d,this._measures.push(v)),"count"!==m&&(this._countOnly=!1),v.push(Bu(m,g,b))):this._counts.push(b);return this._measures=this._measures.map((t=>Iu(t,t.field))),Object.create(null)},cellkey:Eu(),cell(t,n){let e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},newcell(t,n){const e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,n=t.length;e.agg=Array(n);for(let r=0;r<n;++r)e.agg[r]=new t[r](e)}return e.store&&(e.data=new qu),e},newtuple(t,n){const e=this._dnames,r=this._dims,i=r.length,o={};for(let n=0;n<i;++n)o[e[n]]=r[n](t);return n?aa(n.tuple,o):ra(o)},clean(){const t=this.value;for(const n in t)0===t[n].num&&delete t[n]},add(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num+=1,this._countOnly)return;e.store&&e.data.add(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].add(r[n].get(t),t)},rem(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num-=1,this._countOnly)return;e.store&&e.data.rem(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].rem(r[n].get(t),t)},celltuple(t){const n=t.tuple,e=this._counts;t.store&&t.data.values();for(let r=0,i=e.length;r<i;++r)n[e[r]]=t.num;if(!this._countOnly){const e=t.agg;for(let t=0,r=e.length;t<r;++t)e[t].set(n)}return n},changes(t){const n=this._adds,e=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,u=t.mod;let s,c,f,l;if(r)for(c in r)s=r[c],i&&!s.num||a.push(s.tuple);for(f=0,l=this._alen;f<l;++f)o.push(this.celltuple(n[f])),n[f]=null;for(f=0,l=this._mlen;f<l;++f)s=e[f],(0===s.num&&i?a:u).push(this.celltuple(s)),e[f]=null;return this._alen=this._mlen=0,this._prev=null,t}}),Hu.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},mt(Hu,_a,{transform(t,n){const e=!1!==t.interval,r=this._bins(t),i=r.start,o=r.step,a=t.as||["bin0","bin1"],u=a[0],s=a[1];let c;return c=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(l(t.field))?n.ADD_MOD:n.ADD,n.visit(c,e?t=>{const n=r(t);t[u]=n,t[s]=null==n?null:i+o*(1+(n-i)/o)}:t=>t[u]=r(t)),n.modifies(e?a:u)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=Ia(t),r=e.step;let i,o,a=e.start,u=a+Math.ceil((e.stop-a)/r)*r;null!=(i=t.anchor)&&(o=i-(a+r*Math.floor((i-a)/r)),a+=o,u+=o);const s=function(t){let e=_(n(t));return null==e?null:e<a?-1/0:e>u?1/0:(e=Math.max(a,Math.min(e,u-r)),a+r*Math.floor(1e-14+(e-a)/r))};return s.start=a,s.stop=e.stop,s.step=r,this.value=c(s,l(n),t.name||"bin_"+f(n))}}),Yu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},mt(Yu,_a,{transform(t,n){const e=n.fork(n.ALL),r=Gu(na,this.value,e.materialize(e.ADD).add),i=t.sort,o=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(o),this.value=e.source=r.data(ua(i),o),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),mt(Vu,ma),Ju.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},mt(Ju,_a,{transform(t,n){const e=n=>e=>{for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(u(e),t.case,o)||[],s=0,c=i.length;s<c;++s)a.test(r=i[s])||n(r)},r=this._parameterCheck(t,n),i=this._counts,o=this._match,a=this._stop,u=t.field,s=t.as||["text","count"],c=e((t=>i[t]=1+(i[t]||0))),f=e((t=>i[t]-=1));return r?n.visit(n.SOURCE,c):(n.visit(n.ADD,c),n.visit(n.REM,f)),this._finish(n,s)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],o=n[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,c;for(u in e)s=r[u],c=e[u]||0,!s&&c?(r[u]=s=ra({}),s[i]=u,s[o]=c,a.add.push(s)):0===c?(s&&a.rem.push(s),e[u]=null,r[u]=null):s[o]!==c&&(s[o]=c,a.mod.push(s));return a.modifies(n)}}),Ku.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},mt(Ku,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(e.rem=u),u=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,o,a=[],u={},s=t.length,c=0;c<s;++c)for(u[n]=o=t[c],i=0;i<s;++i)u[e]=t[i],r(u)&&(a.push(ra(u)),(u={})[n]=o);return a}(u,i,o,t.filter||$)):e.mod=u,e.source=this.value,e.modifies(r)}});const Qu={kde:Za,mixture:ou,normal:Qa,lognormal:iu,uniform:fu},Zu="function";function ts(t,n){const e=t[Zu];ft(Qu,e)||p("Unknown distribution function: "+e);const r=Qu[e]();for(const e in t)"field"===e?r.data((t.from||n()).map(t[e])):"distributions"===e?r[e](t[e].map((t=>ts(t,n)))):typeof r[e]===Zu&&r[e](t[e]);return r}function ns(t){_a.call(this,null,t)}const es=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}];function rs(t,n){return t?t.map(((t,e)=>n[e]||f(t))):null}function is(t,n,e){const r=[],i=t=>t(s);let o,a,u,s,c,f;if(null==n)r.push(t.map(e));else for(o={},a=0,u=t.length;a<u;++a)s=t[a],c=n.map(i),f=o[c],f||(o[c]=f=[],f.dims=c,r.push(f)),f.push(e(s));return r}function os(t){_a.call(this,null,t)}function as(t){ma.call(this,null,us,t),this.modified(!0)}function us(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:c((e=>n(e,t)),l(n),f(n))}function ss(t){_a.call(this,[void 0,void 0],t)}function cs(t,n){ma.call(this,t),this.parent=n,this.count=0}function fs(t){_a.call(this,{},t),this._keys=ht();const n=this._targets=[];n.active=0,n.forEach=t=>{for(let e=0,r=n.active;e<r;++e)t(n[e],e,n)}}function ls(t){ma.call(this,null,hs,t)}function hs(t){return this.value&&!t.modified()?this.value:D(t.name)?K(t.name).map((t=>v(t))):v(t.name,t.as)}function ds(t){_a.call(this,ht(),t)}function ms(t){_a.call(this,[],t)}function ps(t){_a.call(this,[],t)}function gs(t){_a.call(this,null,t)}function vs(t){_a.call(this,[],t)}ns.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:es.concat({key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:es},{name:"weights",type:"number",array:!0}]})},{name:"as",type:"string",array:!0,default:["value","density"]}]},mt(ns,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=ts(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(n)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&p("Invalid density method: "+a),t.extent||r.data||p("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],s=Su(a,t.extent||st(r.data()),i,o).map((t=>{const n={};return n[u[0]]=t[0],n[u[1]]=t[1],ra(n)}));this.value&&(e.rem=this.value),this.value=e.add=e.source=s}return e}}),os.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]},mt(os,_a,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=is(n.source,t.groupby,b),i=t.smooth||!1,o=t.field,a=t.step||((t,n)=>Ft(st(t,n))/30)(e,o),u=ua(((t,n)=>o(t)-o(n))),s=t.as||"bin",c=r.length;let f,l=1/0,h=-1/0,d=0;for(;d<c;++d){const t=r[d].sort(u);f=-1;for(const n of Wa(t,a,i,o))n<l&&(l=n),n>h&&(h=n),t[++f][s]=n}return this.value={start:l,stop:h,step:a},n.reflow(!0).modifies(s)}}),mt(as,ma),ss.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},mt(ss,_a,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let o=e[0],a=e[1];if((i||null==o)&&(o=1/0,a=-1/0),n.visit(i?n.SOURCE:n.ADD,(t=>{const n=_(r(t));null!=n&&(n<o&&(o=n),n>a&&(a=n))})),!Number.isFinite(o)||!Number.isFinite(a)){let t=f(r);t&&(t=` for field "${t}"`),n.dataflow.warn(`Infinite extent${t}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),mt(cs,ma,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),mt(fs,_a,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let o,a,u=ft(i,t)&&i[t];return u?u.value.stamp<e.stamp&&(u.init(e),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,o=e.dataflow,u=new cs(e.fork(e.NO_SOURCE),this),o.add(u).connect(n(o,t,a)),i[t]=u,this.activate(u)),u},clean(){const t=this.value;let n=0;for(const e in t)if(0===t[e].count){const r=t[e].detachSubflow;r&&r(),delete t[e],++n}if(n){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;i<r;++i)n[i]=t[i];for(;i<e&&null!=n[i];++i)n[i]=null;n.active=r},transform(t,n){const e=n.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),u=t=>this.subflow(t,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,(t=>{const n=na(t),e=o.get(n);void 0!==e&&(o.delete(n),u(e).rem(t))})),n.visit(n.ADD,(t=>{const n=r(t);o.set(na(t),n),u(n).add(t)})),a||n.modified(r.fields)?n.visit(n.MOD,(t=>{const n=na(t),e=o.get(n),i=r(t);e===i?u(i).mod(t):(o.set(n,i),u(e).rem(t),u(i).add(t))})):n.changed(n.MOD)&&n.visit(n.MOD,(t=>{u(o.get(na(t))).mod(t)})),a&&n.visit(n.REFLOW,(t=>{const n=na(t),e=o.get(n),i=r(t);e!==i&&(o.set(n,i),u(e).rem(t),u(i).add(t))})),n.clean()?e.runAfter((()=>{this.clean(),o.clean()})):o.empty>e.cleanThreshold&&e.runAfter(o.clean),n}}),mt(ls,ma),ds.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},mt(ds,_a,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let c=!0;function f(n){const e=na(n),i=s(n,t),f=r.get(e);i&&f?(r.delete(e),o.push(n)):i||f?c&&i&&!f&&u.push(n):(r.set(e,1),a.push(n))}return n.visit(n.REM,(t=>{const n=na(t);r.has(n)?r.delete(n):a.push(t)})),n.visit(n.ADD,(n=>{s(n,t)?o.push(n):r.set(na(n),1)})),n.visit(n.MOD,f),t.modified()&&(c=!1,n.visit(n.REFLOW,f)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),ms.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},mt(ms,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=rs(r,t.as||[]),o=t.index||null,a=i.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{const n=r.map((n=>n(t))),u=n.reduce(((t,n)=>Math.max(t,n.length)),0);let s,c,f,l=0;for(;l<u;++l){for(c=ia(t),s=0;s<a;++s)c[i[s]]=null==(f=n[s][l])?null:f;o&&(c[o]=l),e.add.push(c)}})),this.value=e.source=e.add,o&&e.modifies(o),e.modifies(i)}}),ps.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},mt(ps,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=r.map(f),o=t.as||["key","value"],a=o[0],u=o[1],s=r.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{for(let n,o=0;o<s;++o)n=ia(t),n[a]=i[o],n[u]=r[o](t),e.add.push(n)})),this.value=e.source=e.add,e.modifies(o)}}),gs.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},mt(gs,_a,{transform(t,n){const e=t.expr,r=t.as,i=t.modified(),o=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)||n.modified(r)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(o,(n=>n[r]=e(n,t)))}}),mt(vs,_a,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ra(r(t))),u.push(a);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else o=u.slice(0,-s),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(o):o,u=u.slice(-s);return e.source=this.value=u,e}});const ys={value:"value",median:Dn,mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(o=+o)>=o&&(++e,r+=o)}if(e)return r/e},min:xn,max:wn},bs=[];function ws(t){_a.call(this,[],t)}function xs(t){Wu.call(this,t)}function $s(t){_a.call(this,null,t)}function ks(t){ma.call(this,null,Ms,t)}function Ms(t){return this.value&&!t.modified()?this.value:$t(t.fields,t.flat)}function As(t){_a.call(this,[],t),this._pending=null}function Ds(t,n,e){e.forEach(ra);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function Ss(t){_a.call(this,{},t)}function Fs(t){ma.call(this,null,Es,t)}function Es(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,o=1/0,a=-1/0;for(r=0;r<e;++r)i=n[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function Ns(t){ma.call(this,null,Cs,t)}function Cs(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,n)=>t.concat(n)),[])}function Os(t){_a.call(this,null,t)}function _s(t){Wu.call(this,t)}function zs(t){fs.call(this,t)}function Bs(t){_a.call(this,null,t)}function Ts(t){_a.call(this,null,t)}function Ps(t){_a.call(this,null,t)}function js(t){_a.call(this,null,t)}function Rs(t){_a.call(this,[],t),this.count=0}function Ls(t){_a.call(this,null,t)}function Is(t){_a.call(this,null,t),this.modified(!0)}function qs(t){_a.call(this,null,t)}ws.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},mt(ws,_a,{transform(t,n){var e,r,i,o,a,u,s,c,l,h,d=n.fork(n.ALL),m=function(t){var n,e=t.method||ys.value;if(null!=ys[e])return e===ys.value?(n=void 0!==t.value?t.value:0,()=>n):ys[e];p("Unrecognized imputation method: "+e)}(t),g=function(t){const n=t.field;return t=>t?n(t):NaN}(t),v=f(t.field),y=f(t.key),b=(t.groupby||[]).map(f),w=function(t,n,e,r){var i,o,a,u,s,c,f,l,h=t=>t(l),d=[],m=r?r.slice():[],p={},g={};for(m.forEach(((t,n)=>p[t]=n+1)),u=0,f=t.length;u<f;++u)c=e(l=t[u]),s=p[c]||(p[c]=m.push(c)),(a=g[o=(i=n?n.map(h):bs)+""])||(a=g[o]=[],d.push(a),a.values=i),a[s-1]=l;return d.domain=m,d}(n.source,t.groupby,t.key,t.keyvals),x=[],$=this.value,k=w.domain.length;for(a=0,c=w.length;a<c;++a)for(i=(e=w[a]).values,r=NaN,s=0;s<k;++s)if(null==e[s]){for(o=w.domain[s],h={_impute:!0},u=0,l=i.length;u<l;++u)h[b[u]]=i[u];h[y]=o,h[v]=Number.isNaN(r)?r=m(e,g):r,x.push(ra(h))}return x.length&&(d.add=d.materialize(d.ADD).add.concat(x)),$.length&&(d.rem=d.materialize(d.REM).rem.concat($)),this.value=x,d}}),xs.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:zu},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},mt(xs,Wu,{transform(t,n){const e=this,r=t.modified();let i;return e.value&&(r||n.modified(e._inputs,!0))?(i=e.value=r?e.init(t):{},n.visit(n.SOURCE,(t=>e.add(t)))):(i=e.value=e.value||this.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),e.changes(),n.visit(n.SOURCE,(t=>{ut(t,i[e.cellkey(t)].tuple)})),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e<r;++e)this.celltuple(t[e]),t[e]=null;for(e=0,r=this._mlen;e<r;++e)this.celltuple(n[e]),n[e]=null;this._alen=this._mlen=0}}),$s.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},mt($s,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=n.materialize(n.SOURCE).source,i=is(r,t.groupby,t.field),o=(t.groupby||[]).map(f),a=t.bandwidth,u=t.cumulative?"cdf":"pdf",s=t.as||["value","density"],c=[];let l=t.extent,h=t.steps||t.minsteps||25,d=t.steps||t.maxsteps||200;"pdf"!==u&&"cdf"!==u&&p("Invalid density method: "+u),"shared"===t.resolve&&(l||(l=st(r,t.field)),h=d=t.steps||d),i.forEach((n=>{const e=Za(n,a)[u],r=t.counts?n.length:1;Su(e,l||st(n),h,d).forEach((t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[s[0]]=t[0],e[s[1]]=t[1]*r,c.push(ra(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}}),mt(ks,ma),mt(As,_a,{transform(t,n){const e=n.dataflow;if(this._pending)return Ds(this,n,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return n.StopPropagation;if(t.values)return Ds(this,n,e.parse(t.values,t.format));if(t.async){const n=e.request(t.url,t.format).then((t=>(this._pending=K(t.data),t=>t.touch(this))));return{async:n}}return e.request(t.url,t.format).then((t=>Ds(this,n,K(t.data))))}}),Ss.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},mt(Ss,_a,{transform(t,n){const e=t.fields,r=t.index,i=t.values,o=null==t.default?null:t.default,a=t.modified(),u=e.length;let s,c,l,h=a?n.SOURCE:n.ADD,d=n,m=t.as;return i?(c=i.length,u>1&&!m&&p('Multi-field lookup requires explicit "as" parameter.'),m&&m.length!==u*c&&p('The "as" parameter has too few output field names.'),m=m||i.map(f),s=function(t){for(var n,a,s=0,f=0;s<u;++s)if(null==(a=r.get(e[s](t))))for(n=0;n<c;++n,++f)t[m[f]]=o;else for(n=0;n<c;++n,++f)t[m[f]]=i[n](a)}):(m||p("Missing output field names."),s=function(t){for(var n,i=0;i<u;++i)n=r.get(e[i](t)),t[m[i]]=null==n?o:n}),a?d=n.reflow(!0):(l=e.some((t=>n.modified(t.fields))),h|=l?n.MOD:0),n.visit(h,s),d.modifies(m)}}),mt(Fs,ma),mt(Ns,ma),mt(Os,_a,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),_s.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:zu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},mt(_s,Wu,{_transform:Wu.prototype.transform,transform(t,n){return this._transform(function(t,n){const e=t.field,r=t.value,i=("count"===t.op?"__count__":t.op)||"sum",o=l(e).concat(l(r)),a=function(t,n,e){const r={},i=[];return e.visit(e.SOURCE,(n=>{const e=t(n);r[e]||(r[e]=1,i.push(e))})),i.sort(nt),n?i.slice(0,n):i}(e,t.limit||0,n);return n.changed()&&t.set("__pivot__",null,null,!0),{key:t.key,groupby:t.groupby,ops:a.map((()=>i)),fields:a.map((t=>function(t,n,e,r){return c((r=>n(r)===t?e(r):NaN),r,t+"")}(t,e,r,o))),as:a.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),mt(zs,fs,{transform(t,n){const e=t.subflow,r=t.field,i=t=>this.subflow(na(t),e,n,t);return(t.modified("field")||r&&n.modified(l(r)))&&p("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,(t=>{const n=i(t);r(t).forEach((t=>n.mod(t)))})),n.visit(n.ADD,(t=>{const n=i(t);r(t).forEach((t=>n.add(ra(t))))})),n.visit(n.REM,(t=>{const n=i(t);r(t).forEach((t=>n.rem(t)))}))):(n.visit(n.MOD,(t=>i(t).mod(t))),n.visit(n.ADD,(t=>i(t).add(t))),n.visit(n.REM,(t=>i(t).rem(t)))),n.clean()&&n.runAfter((()=>this.clean())),n}}),Bs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},mt(Bs,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=rs(t.fields,t.as||[]),o=r?(t,n)=>function(t,n,e,r){for(let i=0,o=e.length;i<o;++i)n[r[i]]=e[i](t);return n}(t,n,r,i):oa;let a;return this.value?a=this.value:(n=n.addAll(),a=this.value={}),n.visit(n.REM,(t=>{const n=na(t);e.rem.push(a[n]),a[n]=null})),n.visit(n.ADD,(t=>{const n=o(t,ra({}));a[na(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{e.mod.push(o(t,a[na(t)]))})),e}}),mt(Ts,_a,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),Ps.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]},mt(Ps,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=is(n.materialize(n.SOURCE).source,t.groupby,t.field),o=(t.groupby||[]).map(f),a=[],u=t.step||.01,s=t.probs||Fn(u/2,1-1e-14,u),c=s.length;return i.forEach((t=>{const n=ja(t,s);for(let e=0;e<c;++e){const i={};for(let n=0;n<o.length;++n)i[o[n]]=t.dims[n];i[r[0]]=s[e],i[r[1]]=n[e],a.push(ra(i))}})),this.value&&(e.rem=this.value),this.value=e.add=e.source=a,e}}),mt(js,_a,{transform(t,n){let e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,(t=>{const n=na(t);e.rem.push(r[n]),r[n]=null})),n.visit(n.ADD,(t=>{const n=ia(t);r[na(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{const n=r[na(t)];for(const r in t)n[r]=t[r],e.modifies(r);e.mod.push(n)}))),e}}),Rs.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},mt(Rs,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,o=this.value.reduce(((t,n)=>(t[na(n)]=1,t)),{});let a=this.value,u=this.count,s=0;function c(t){let n,r;a.length<i?a.push(t):(r=~~((u+1)*qa()),r<a.length&&r>=s&&(n=a[r],o[na(n)]&&e.rem.push(n),a[r]=t)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const n=na(t);o[n]&&(o[n]=-1,e.rem.push(t)),--u})),a=a.filter((t=>-1!==o[na(t)]))),(n.rem.length||r)&&a.length<i&&n.source&&(s=u=a.length,n.visit(n.SOURCE,(t=>{o[na(t)]||c(t)})),s=-1),r&&a.length>i){const t=a.length-i;for(let n=0;n<t;++n)o[na(a[n])]=-1,e.rem.push(a[n]);a=a.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{o[na(t)]&&e.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||s<0)&&(e.add=a.filter((t=>!o[na(t)]))),this.count=u,this.value=e.source=a,e}}),Ls.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},mt(Ls,_a,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=Fn(t.start,t.stop,t.step||1).map((t=>{const n={};return n[r]=t,ra(n)})),e.add=n.add.concat(this.value),e}}),mt(Is,_a,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const Us=["unit0","unit1"];function Ws(t){_a.call(this,ht(),t)}function Hs(t){_a.call(this,null,t)}qs.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Se,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Us}]},mt(qs,_a,{transform(t,n){const e=t.field,r=!1!==t.interval,i="utc"===t.timezone,o=this._floor(t,n),a=(i?rr:er)(o.unit).offset,u=t.as||Us,s=u[0],c=u[1],f=o.step;let h=o.start||1/0,d=o.stop||-1/0,m=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(l(e)))&&(m=(n=n.reflow(!0)).SOURCE,h=1/0,d=-1/0),n.visit(m,(t=>{const n=e(t);let i,u;null==n?(t[s]=null,r&&(t[c]=null)):(t[s]=i=u=o(n),r&&(t[c]=u=a(i,f)),i<h&&(h=i),u>d&&(d=u))})),o.start=h,o.stop=d,n.modifies(r?u:s)},_floor(t,n){const e="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:br({extent:t.extent||st(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),o=Ee(r),a=this.value||{},u=(e?Ze:Je)(o,i);return u.unit=O(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),mt(Ws,_a,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,o)):n.changed()?(n.visit(n.REM,(t=>i.delete(r(t)))),n.visit(n.ADD,o)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),mt(Hs,_a,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(ua(t.sort)):n.source).map(t.field))}});const Gs={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=Gs.rank(),n=t.next;return{init:t.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t<i){for(;i+1<e.length&&!r(e[i],e[i+1]);)++i;t=i}return(1+t)/e.length}}},ntile:function(t,n){(n=+n)>0||p("ntile num must be greater than zero.");const e=Gs.cume_dist(),r=e.next;return{init:e.init,next:t=>Math.ceil(n*r(t))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:n=>t(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||p("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}},prev_value:function(t){let n;return{init:()=>n=null,next:e=>{const r=t(e.data[e.index]);return null!=r?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(t,n,e){for(let r=n.length;e<r;++e)if(null!=t(n[e]))return e;return-1}(t,i,r.index))<0?(e=i.length,n=null):n=t(i[e])}}}},Ys=Object.keys(Gs);function Vs(t){const n=K(t.ops),e=K(t.fields),r=K(t.params),i=K(t.aggregate_params),o=K(t.as),a=this.outputs=[],u=this.windows=[],s={},c={},h=[],d=[];let m=!0;function g(t){K(l(t)).forEach((t=>s[t]=1))}g(t.sort),n.forEach(((t,n)=>{const s=e[n],l=r[n],v=i[n]||null,y=f(s),b=Nu(t,y,o[n]);if(g(s),a.push(b),ft(Gs,t))u.push(function(t,n,e,r){const i=Gs[t](n,e);return{init:i.init||w,update:function(t,n){n[r]=i.next(t)}}}(t,s,l,b));else{if(null==s&&"count"!==t&&p("Null aggregate field specified."),"count"===t)return void h.push(b);m=!1;let n=c[y];n||(n=c[y]=[],n.field=s,d.push(n)),n.push(Bu(t,v,b))}})),(h.length||d.length)&&(this.cell=function(t,n,e){t=t.map((t=>Iu(t,t.field)));const r={num:0,agg:null,store:!1,count:n};if(!e)for(var i=t.length,o=r.agg=Array(i),a=0;a<i;++a)o[a]=new t[a](r);if(r.store)var u=r.data=new qu;return r.add=function(t){if(r.num+=1,!e){u&&u.add(t);for(let n=0;n<i;++n)o[n].add(o[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){u&&u.rem(t);for(let n=0;n<i;++n)o[n].rem(o[n].get(t),t)}},r.set=function(t){let i,a;for(u&&u.values(),i=0,a=n.length;i<a;++i)t[n[i]]=r.num;if(!e)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,u&&u.reset();for(let t=0;t<i;++t)o[t].init()},r}(d,h,m)),this.inputs=Object.keys(s)}const Xs=Vs.prototype;function Js(t){_a.call(this,{},t),this._mlen=0,this._mods=[]}function Ks(t,n,e,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],u=t.data(e),s=u.length,c=o?Qt(i):null,f={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:i||ot(-1)};n.init();for(let t=0;t<s;++t)Qs(f,a,t,s),o&&Zs(f,c),n.update(f,u[t])}function Qs(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function Zs(t,n){const e=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;e>0&&!i(o[e],o[e-1])&&(t.i0=n.left(o,o[e])),r<a&&!i(o[r],o[r+1])&&(t.i1=n.right(o,o[r]))}Xs.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},Xs.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(e){for(a=t.p0;a<t.i0;++a)e.rem(i[a]);for(a=t.p1;a<t.i1;++a)e.add(i[a]);e.set(n)}for(a=0;a<o;++a)r[a].update(t,n)},Js.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ys.concat(zu)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},mt(Js,_a,{transform(t,n){this.stamp=n.stamp;const e=t.modified(),r=ua(t.sort),i=Eu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!e||(a=this.state=new Vs(t)),e||n.modified(a.inputs)?(this.value={},n.visit(n.SOURCE,(t=>o(t).add(t)))):(n.visit(n.REM,(t=>o(t).remove(t))),n.visit(n.ADD,(t=>o(t).add(t))));for(let n=0,e=this._mlen;n<e;++n)Ks(this._mods[n],a,r,t);return this._mlen=0,this._mods=[],n.reflow(e).modifies(a.outputs)},group(t){let n=this.value[t];return n||(n=this.value[t]=Gu(na),n.stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n}});var tc=Object.freeze({__proto__:null,aggregate:Wu,bin:Hu,collect:Yu,compare:Vu,countpattern:Ju,cross:Ku,density:ns,dotbin:os,expression:as,extent:ss,facet:fs,field:ls,filter:ds,flatten:ms,fold:ps,formula:gs,generate:vs,impute:ws,joinaggregate:xs,kde:$s,key:ks,load:As,lookup:Ss,multiextent:Fs,multivalues:Ns,params:Os,pivot:_s,prefacet:zs,project:Bs,proxy:Ts,quantile:Ps,relay:js,sample:Rs,sequence:Ls,sieve:Is,subflow:cs,timeunit:qs,tupleindex:Ws,values:Hs,window:Js});function nc(t){return function(){return t}}const ec=Math.abs,rc=Math.atan2,ic=Math.cos,oc=Math.max,ac=Math.min,uc=Math.sin,sc=Math.sqrt,cc=1e-12,fc=Math.PI,lc=fc/2,hc=2*fc;function dc(t){return t>=1?lc:t<=-1?-lc:Math.asin(t)}const mc=Math.PI,pc=2*mc,gc=1e-6,vc=pc-gc;function yc(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}let bc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?yc:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return yc;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,s=r-n,c=o-t,f=a-n,l=c*c+f*f;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(l>gc)if(Math.abs(f*u-s*c)>gc&&i){let h=e-o,d=r-a,m=u*u+s*s,p=h*h+d*d,g=Math.sqrt(m),v=Math.sqrt(l),y=i*Math.tan((mc-Math.acos((m+l-p)/(2*g*v)))/2),b=y/v,w=y/g;Math.abs(b-1)>gc&&this._append`L${t+b*c},${n+b*f}`,this._append`A${i},${i},0,0,${+(f*h>c*d)},${this._x1=t+w*u},${this._y1=n+w*s}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,c=n+u,f=1^o,l=o?r-i:i-r;null===this._x1?this._append`M${s},${c}`:(Math.abs(this._x1-s)>gc||Math.abs(this._y1-c)>gc)&&this._append`L${s},${c}`,e&&(l<0&&(l=l%pc+pc),l>vc?this._append`A${e},${e},0,1,${f},${t-a},${n-u}A${e},${e},0,1,${f},${this._x1=s},${this._y1=c}`:l>gc&&this._append`A${e},${e},0,${+(l>=mc)},${f},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function wc(){return new bc}function xc(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new bc(n)}function $c(t){return t.innerRadius}function kc(t){return t.outerRadius}function Mc(t){return t.startAngle}function Ac(t){return t.endAngle}function Dc(t){return t&&t.padAngle}function Sc(t,n,e,r,i,o,a){var u=t-e,s=n-r,c=(a?o:-o)/sc(u*u+s*s),f=c*s,l=-c*u,h=t+f,d=n+l,m=e+f,p=r+l,g=(h+m)/2,v=(d+p)/2,y=m-h,b=p-d,w=y*y+b*b,x=i-o,$=h*p-m*d,k=(b<0?-1:1)*sc(oc(0,x*x*w-$*$)),M=($*b-y*k)/w,A=(-$*y-b*k)/w,D=($*b+y*k)/w,S=(-$*y+b*k)/w,F=M-g,E=A-v,N=D-g,C=S-v;return F*F+E*E>N*N+C*C&&(M=D,A=S),{cx:M,cy:A,x01:-f,y01:-l,x11:M*(i/x-1),y11:A*(i/x-1)}}function Fc(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ec(t){this._context=t}function Nc(t){return new Ec(t)}function Cc(t){return t[0]}function Oc(t){return t[1]}function _c(t,n){var e=nc(!0),r=null,i=Nc,o=null,a=xc(u);function u(u){var s,c,f,l=(u=Fc(u)).length,h=!1;for(null==r&&(o=i(f=a())),s=0;s<=l;++s)!(s<l&&e(c=u[s],s,u))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(c,s,u),+n(c,s,u));if(f)return o=null,f+""||null}return t="function"==typeof t?t:void 0===t?Cc:nc(t),n="function"==typeof n?n:void 0===n?Oc:nc(n),u.x=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:nc(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),u):r},u}function zc(t,n,e){var r=null,i=nc(!0),o=null,a=Nc,u=null,s=xc(c);function c(c){var f,l,h,d,m,p=(c=Fc(c)).length,g=!1,v=new Array(p),y=new Array(p);for(null==o&&(u=a(m=s())),f=0;f<=p;++f){if(!(f<p&&i(d=c[f],f,c))===g)if(g=!g)l=f,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),h=f-1;h>=l;--h)u.point(v[h],y[h]);u.lineEnd(),u.areaEnd()}g&&(v[f]=+t(d,f,c),y[f]=+n(d,f,c),u.point(r?+r(d,f,c):v[f],e?+e(d,f,c):y[f]))}if(m)return u=null,m+""||null}function f(){return _c().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Cc:nc(+t),n="function"==typeof n?n:nc(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?Oc:nc(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),r=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:nc(+t),c):r},c.y=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:nc(+t),c):e},c.lineX0=c.lineY0=function(){return f().x(t).y(n)},c.lineY1=function(){return f().x(t).y(e)},c.lineX1=function(){return f().x(r).y(n)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:nc(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}wc.prototype=bc.prototype,Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var Bc={draw(t,n){const e=sc(n/fc);t.moveTo(e,0),t.arc(0,0,e,0,hc)}};function Tc(){}function Pc(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function jc(t){this._context=t}function Rc(t){this._context=t}function Lc(t){this._context=t}function Ic(t,n){this._basis=new jc(t),this._beta=n}jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Rc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ic.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,s=-1;++s<=e;)this._basis.point(this._beta*t[s]+(1-this._beta)*(i+(r=s/e)*a),this._beta*n[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var qc=function t(n){function e(t){return 1===n?new jc(t):new Ic(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Uc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Wc(t,n){this._context=t,this._k=(1-n)/6}Wc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Uc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Hc=function t(n){function e(t){return new Wc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gc(t,n){this._context=t,this._k=(1-n)/6}Gc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Yc=function t(n){function e(t){return new Gc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vc(t,n){this._context=t,this._k=(1-n)/6}Vc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Xc=function t(n){function e(t){return new Vc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Jc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>cc){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>cc){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/f,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Kc(t,n){this._context=t,this._alpha=n}Kc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Qc=function t(n){function e(t){return n?new Kc(t,n):new Wc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Zc(t,n){this._context=t,this._alpha=n}Zc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var tf=function t(n){function e(t){return n?new Zc(t,n):new Gc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function nf(t,n){this._context=t,this._alpha=n}nf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var ef=function t(n){function e(t){return n?new nf(t,n):new Vc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function rf(t){this._context=t}function of(t){return t<0?-1:1}function af(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(of(o)+of(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function uf(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function sf(t,n,e){var r=t._x0,i=t._x1,o=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,t._y0+a*n,i-a,o-a*e,i,o)}function cf(t){this._context=t}function ff(t){this._context=new lf(t)}function lf(t){this._context=t}function hf(t){this._context=t}function df(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)o[n]-=e=i[n]/o[n-1],a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function mf(t,n){this._context=t,this._t=n}function pf(t,n){if("undefined"!=typeof document&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}rf.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},cf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sf(this,this._t0,uf(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,sf(this,uf(this,e=af(this,t,n)),e);break;default:sf(this,this._t0,e=af(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(ff.prototype=Object.create(cf.prototype)).point=function(t,n){cf.prototype.point.call(this,n,t)},lf.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},hf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=df(t),i=df(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},mf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};const gf=()=>"undefined"!=typeof Image?Image:null;function vf(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function yf(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const bf=Symbol("implicit");function wf(){var t=new an,n=[],e=[],r=bf;function i(i){let o=t.get(i);if(void 0===o){if(r!==bf)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new an;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return wf(n,e).unknown(r)},vf.apply(i,arguments),i}function xf(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function $f(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function kf(){}var Mf=.7,Af=1/Mf,Df="\\s*([+-]?\\d+)\\s*",Sf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ff="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ef=/^#([0-9a-f]{3,8})$/,Nf=new RegExp(`^rgb\\(${Df},${Df},${Df}\\)$`),Cf=new RegExp(`^rgb\\(${Ff},${Ff},${Ff}\\)$`),Of=new RegExp(`^rgba\\(${Df},${Df},${Df},${Sf}\\)$`),_f=new RegExp(`^rgba\\(${Ff},${Ff},${Ff},${Sf}\\)$`),zf=new RegExp(`^hsl\\(${Sf},${Ff},${Ff}\\)$`),Bf=new RegExp(`^hsla\\(${Sf},${Ff},${Ff},${Sf}\\)$`),Tf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Pf(){return this.rgb().formatHex()}function jf(){return this.rgb().formatRgb()}function Rf(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Ef.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Lf(n):3===e?new Wf(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?If(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?If(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Nf.exec(t))?new Wf(n[1],n[2],n[3],1):(n=Cf.exec(t))?new Wf(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Of.exec(t))?If(n[1],n[2],n[3],n[4]):(n=_f.exec(t))?If(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=zf.exec(t))?Jf(n[1],n[2]/100,n[3]/100,1):(n=Bf.exec(t))?Jf(n[1],n[2]/100,n[3]/100,n[4]):Tf.hasOwnProperty(t)?Lf(Tf[t]):"transparent"===t?new Wf(NaN,NaN,NaN,0):null}function Lf(t){return new Wf(t>>16&255,t>>8&255,255&t,1)}function If(t,n,e,r){return r<=0&&(t=n=e=NaN),new Wf(t,n,e,r)}function qf(t){return t instanceof kf||(t=Rf(t)),t?new Wf((t=t.rgb()).r,t.g,t.b,t.opacity):new Wf}function Uf(t,n,e,r){return 1===arguments.length?qf(t):new Wf(t,n,e,null==r?1:r)}function Wf(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hf(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}`}function Gf(){const t=Yf(this.opacity);return`${1===t?"rgb(":"rgba("}${Vf(this.r)}, ${Vf(this.g)}, ${Vf(this.b)}${1===t?")":`, ${t})`}`}function Yf(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xf(t){return((t=Vf(t))<16?"0":"")+t.toString(16)}function Jf(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Zf(t,n,e,r)}function Kf(t){if(t instanceof Zf)return new Zf(t.h,t.s,t.l,t.opacity);if(t instanceof kf||(t=Rf(t)),!t)return new Zf;if(t instanceof Zf)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Zf(a,u,s,t.opacity)}function Qf(t,n,e,r){return 1===arguments.length?Kf(t):new Zf(t,n,e,null==r?1:r)}function Zf(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function tl(t){return(t=(t||0)%360)<0?t+360:t}function nl(t){return Math.max(0,Math.min(1,t||0))}function el(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}xf(kf,Rf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pf,formatHex:Pf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Kf(this).formatHsl()},formatRgb:jf,toString:jf}),xf(Wf,Uf,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Wf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Wf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Wf(Vf(this.r),Vf(this.g),Vf(this.b),Yf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Hf,formatHex:Hf,formatHex8:function(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}${Xf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Gf,toString:Gf})),xf(Zf,Qf,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Zf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Zf(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Wf(el(t>=240?t-240:t+120,i,r),el(t,i,r),el(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Zf(tl(this.h),nl(this.s),nl(this.l),Yf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Yf(this.opacity);return`${1===t?"hsl(":"hsla("}${tl(this.h)}, ${100*nl(this.s)}%, ${100*nl(this.l)}%${1===t?")":`, ${t})`}`}}));const rl=Math.PI/180,il=180/Math.PI,ol=.96422,al=.82521,ul=4/29,sl=6/29,cl=3*sl*sl,fl=sl*sl*sl;function ll(t){if(t instanceof dl)return new dl(t.l,t.a,t.b,t.opacity);if(t instanceof bl)return wl(t);t instanceof Wf||(t=qf(t));var n,e,r=vl(t.r),i=vl(t.g),o=vl(t.b),a=ml((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=ml((.4360747*r+.3850649*i+.1430804*o)/ol),e=ml((.0139322*r+.0971045*i+.7141733*o)/al)),new dl(116*a-16,500*(n-a),200*(a-e),t.opacity)}function hl(t,n,e,r){return 1===arguments.length?ll(t):new dl(t,n,e,null==r?1:r)}function dl(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ml(t){return t>fl?Math.pow(t,1/3):t/cl+ul}function pl(t){return t>sl?t*t*t:cl*(t-ul)}function gl(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function vl(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yl(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof bl)return new bl(t.h,t.c,t.l,t.opacity);if(t instanceof dl||(t=ll(t)),0===t.a&&0===t.b)return new bl(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*il;return new bl(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new bl(t,n,e,null==r?1:r)}function bl(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function wl(t){if(isNaN(t.h))return new dl(t.l,0,0,t.opacity);var n=t.h*rl;return new dl(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}xf(dl,hl,$f(kf,{brighter(t){return new dl(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new dl(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Wf(gl(3.1338561*(n=ol*pl(n))-1.6168667*(t=1*pl(t))-.4906146*(e=al*pl(e))),gl(-.9787684*n+1.9161415*t+.033454*e),gl(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),xf(bl,yl,$f(kf,{brighter(t){return new bl(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new bl(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return wl(this).rgb()}}));var xl=-.14861,$l=1.78277,kl=-.29227,Ml=-.90649,Al=1.97294,Dl=Al*Ml,Sl=Al*$l,Fl=$l*kl-Ml*xl;function El(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Nl)return new Nl(t.h,t.s,t.l,t.opacity);t instanceof Wf||(t=qf(t));var n=t.g/255,e=t.b/255,r=(Fl*e+Dl*(t.r/255)-Sl*n)/(Fl+Dl-Sl),i=e-r,o=(Al*(n-r)-kl*i)/Ml,a=Math.sqrt(o*o+i*i)/(Al*r*(1-r)),u=a?Math.atan2(o,i)*il-120:NaN;return new Nl(u<0?u+360:u,a,r,t.opacity)}(t):new Nl(t,n,e,null==r?1:r)}function Nl(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Cl(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Ol(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1];return Cl((e-r/n)*n,r>0?t[r-1]:2*i-o,i,o,r<n-1?t[r+2]:2*o-i)}}function _l(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n);return Cl((e-r/n)*n,t[(r+n-1)%n],t[r%n],t[(r+1)%n],t[(r+2)%n])}}xf(Nl,El,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Nl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Nl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*rl,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Wf(255*(n+e*(xl*r+$l*i)),255*(n+e*(kl*r+Ml*i)),255*(n+e*(Al*r)),this.opacity)}}));var zl=t=>()=>t;function Bl(t,n){return function(e){return t+e*n}}function Tl(t,n){var e=n-t;return e?Bl(t,e>180||e<-180?e-360*Math.round(e/360):e):zl(isNaN(t)?n:t)}function Pl(t,n){var e=n-t;return e?Bl(t,e):zl(isNaN(t)?n:t)}var jl=function t(n){var e=function(t){return 1==(t=+t)?Pl:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):zl(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Uf(t)).r,(n=Uf(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Pl(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Rl(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Uf(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Ll=Rl(Ol),Il=Rl(_l);function ql(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Ul(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wl(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Kl(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Hl(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Gl(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Yl(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Kl(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Vl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xl=new RegExp(Vl.source,"g");function Jl(t,n){var e,r,i,o=Vl.lastIndex=Xl.lastIndex=0,a=-1,u=[],s=[];for(t+="",n+="";(e=Vl.exec(t))&&(r=Xl.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Gl(e,r)})),o=Xl.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}function Kl(t,n){var e,r=typeof n;return null==n||"boolean"===r?zl(n):("number"===r?Gl:"string"===r?(e=Rf(n))?(n=e,jl):Jl:n instanceof Rf?jl:n instanceof Date?Hl:Ul(n)?ql:Array.isArray(n)?Wl:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Yl:Gl)(t,n)}function Ql(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Zl,th=180/Math.PI,nh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function eh(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*th,skewX:Math.atan(s)*th,scaleX:a,scaleY:u}}function rh(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Gl(t,i)},{i:s-2,x:Gl(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Gl(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Gl(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Gl(t,e)},{i:u-2,x:Gl(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e<r;)u[(n=s[e]).i]=n.x(t);return u.join("")}}}var ih=rh((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?nh:eh(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),oh=rh((function(t){return null==t?nh:(Zl||(Zl=document.createElementNS("http://www.w3.org/2000/svg","g")),Zl.setAttribute("transform",t),(t=Zl.transform.baseVal.consolidate())?eh((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):nh)}),", ",")",")");function ah(t){return((t=Math.exp(t))+1/t)/2}var uh=function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],f=i[2],l=i[0]-u,h=i[1]-s,d=l*l+h*h;if(d<1e-12)a=Math.log(f/c)/n,o=function(t){return[u+t*l,s+t*h,c*Math.exp(n*t*a)]};else{var m=Math.sqrt(d),p=(f*f-c*c+r*d)/(2*c*e*m),g=(f*f-c*c-r*d)/(2*f*e*m),v=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(g*g+1)-g);a=(y-v)/n,o=function(t){var r=t*a,i=ah(v),o=c/(e*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[u+o*l,s+o*h,c*i/ah(n*r+v)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function sh(t){return function(n,e){var r=t((n=Qf(n)).h,(e=Qf(e)).h),i=Pl(n.s,e.s),o=Pl(n.l,e.l),a=Pl(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var ch=sh(Tl),fh=sh(Pl);function lh(t){return function(n,e){var r=t((n=yl(n)).h,(e=yl(e)).h),i=Pl(n.c,e.c),o=Pl(n.l,e.l),a=Pl(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var hh=lh(Tl),dh=lh(Pl);function mh(t){return function n(e){function r(n,r){var i=t((n=El(n)).h,(r=El(r)).h),o=Pl(n.s,r.s),a=Pl(n.l,r.l),u=Pl(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var ph=mh(Tl),gh=mh(Pl);function vh(t,n){void 0===n&&(n=t,t=Kl);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var yh=Object.freeze({__proto__:null,interpolate:Kl,interpolateArray:function(t,n){return(Ul(n)?ql:Wl)(t,n)},interpolateBasis:Ol,interpolateBasisClosed:_l,interpolateCubehelix:ph,interpolateCubehelixLong:gh,interpolateDate:Hl,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHcl:hh,interpolateHclLong:dh,interpolateHsl:ch,interpolateHslLong:fh,interpolateHue:function(t,n){var e=Tl(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateLab:function(t,n){var e=Pl((t=hl(t)).l,(n=hl(n)).l),r=Pl(t.a,n.a),i=Pl(t.b,n.b),o=Pl(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},interpolateNumber:Gl,interpolateNumberArray:ql,interpolateObject:Yl,interpolateRgb:jl,interpolateRgbBasis:Ll,interpolateRgbBasisClosed:Il,interpolateRound:Ql,interpolateString:Jl,interpolateTransformCss:ih,interpolateTransformSvg:oh,interpolateZoom:uh,piecewise:vh,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function bh(t){return+t}var wh=[0,1];function xh(t){return t}function $h(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function kh(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=$h(i,r),o=e(a,o)):(r=$h(r,i),o=e(o,a)),function(t){return o(r(t))}}function Mh(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=$h(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=en(t,n,1,r)-1;return o[e](i[e](n))}}function Ah(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Dh(){var t,n,e,r,i,o,a=wh,u=wh,s=Kl,c=xh;function f(){var t=Math.min(a.length,u.length);return c!==xh&&(c=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?Mh:kh,i=o=null,l}function l(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return l.invert=function(e){return c(n((o||(o=r(u,a.map(t),Gl)))(e)))},l.domain=function(t){return arguments.length?(a=Array.from(t,bh),f()):a.slice()},l.range=function(t){return arguments.length?(u=Array.from(t),f()):u.slice()},l.rangeRound=function(t){return u=Array.from(t),s=Ql,f()},l.clamp=function(t){return arguments.length?(c=!!t||xh,f()):c!==xh},l.interpolate=function(t){return arguments.length?(s=t,f()):s},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,f()}}function Sh(){return Dh()(xh,xh)}function Fh(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Eh(t){return(t=Fh(Math.abs(t)))?t[1]:NaN}var Nh,Ch=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oh(t){if(!(n=Ch.exec(t)))throw new Error("invalid format: "+t);var n;return new _h({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function _h(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function zh(t,n){var e=Fh(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Oh.prototype=_h.prototype,_h.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Bh={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return zh(100*t,n)},r:zh,s:function(t,n){var e=Fh(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Nh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Fh(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Th(t){return t}var Ph,jh,Rh,Lh=Array.prototype.map,Ih=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function qh(t,n,e,r){var i,o=bn(t,n,e);switch((r=Oh(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Eh(n)/3)))-Eh(Math.abs(t)))}(o,a))||(r.precision=i),Rh(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Eh(n)-Eh(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Eh(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return jh(r)}function Uh(t){var n=t.domain;return t.ticks=function(t){var e=n();return vn(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return qh(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,s=o[a],c=o[u],f=10;for(c<s&&(i=s,s=c,c=i,i=a,a=u,u=i);f-- >0;){if((i=yn(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Wh(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Hh(t){return Math.log(t)}function Gh(t){return Math.exp(t)}function Yh(t){return-Math.log(-t)}function Vh(t){return-Math.exp(-t)}function Xh(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Jh(t){return(n,e)=>-t(-n,e)}function Kh(t){const n=t(Hh,Gh),e=n.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?Xh:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=Jh(r),i=Jh(i),t(Yh,Vh)):t(Hh,Gh),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],u=n[n.length-1];const s=u<a;s&&([a,u]=[u,a]);let c,f,l=r(a),h=r(u);const d=null==t?10:+t;let m=[];if(!(o%1)&&h-l<d){if(l=Math.floor(l),h=Math.ceil(h),a>0){for(;l<=h;++l)for(c=1;c<o;++c)if(f=l<0?c/i(-l):c*i(l),!(f<a)){if(f>u)break;m.push(f)}}else for(;l<=h;++l)for(c=o-1;c>=1;--c)if(f=l>0?c/i(-l):c*i(l),!(f<a)){if(f>u)break;m.push(f)}2*m.length<d&&(m=vn(a,u,d))}else m=vn(l,h,Math.min(h-l,d)).map(i);return s?m.reverse():m},n.tickFormat=(t,e)=>{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=Oh(e)).precision||(e.trim=!0),e=jh(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*o<o-.5&&(n*=o),n<=a?e(t):""}},n.nice=()=>e(Wh(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function Qh(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Zh(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function td(t){var n=1,e=t(Qh(n),Zh(n));return e.constant=function(e){return arguments.length?t(Qh(n=+e),Zh(n)):n},Uh(e)}function nd(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function ed(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function rd(t){return t<0?-t*t:t*t}function id(t){var n=t(xh,xh),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(xh,xh):.5===e?t(ed,rd):t(nd(e),nd(1/e)):e},Uh(n)}function od(){var t=id(Dh());return t.copy=function(){return Ah(t,od()).exponent(t.exponent())},vf.apply(t,arguments),t}Ph=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Th:(n=Lh.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=t.decimal+"",u=void 0===t.numerals?Th:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Lh.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Oh(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):Bh[y]||(void 0===g&&(g=12),v=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?s:"",x=Bh[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,h=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==l&&(M=!1),h=(M?"("===l?l:c:"-"===l||"("===l?"":l)+h,k=("s"===y?Ih[8+Nh/3]:"")+k+(M&&"("===l?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!d&&(t=r(t,1/0));var A=h.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&d&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=h+t+k+D;break;case"=":t=h+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+h+t+k+D.slice(A);break;default:t=D+h+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:l,formatPrefix:function(t,n){var e=l(((t=Oh(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Eh(n)/3))),i=Math.pow(10,-r),o=Ih[8+r/3];return function(t){return e(i*t)+o}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),jh=Ph.format,Rh=Ph.formatPrefix;const ad=new Date,ud=new Date;function sd(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>sd((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(ad.setTime(+n),ud.setTime(+r),t(ad),t(ud),Math.floor(e(ad,ud))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const cd=sd((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));cd.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?sd((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):cd:null);const fd=1e3,ld=6e4,hd=36e5,dd=864e5,md=6048e5,pd=31536e6,gd=sd((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*fd)}),((t,n)=>(n-t)/fd),(t=>t.getUTCSeconds())),vd=sd((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fd)}),((t,n)=>{t.setTime(+t+n*ld)}),((t,n)=>(n-t)/ld),(t=>t.getMinutes())),yd=sd((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*ld)}),((t,n)=>(n-t)/ld),(t=>t.getUTCMinutes())),bd=sd((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fd-t.getMinutes()*ld)}),((t,n)=>{t.setTime(+t+n*hd)}),((t,n)=>(n-t)/hd),(t=>t.getHours())),wd=sd((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*hd)}),((t,n)=>(n-t)/hd),(t=>t.getUTCHours())),xd=sd((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ld)/dd),(t=>t.getDate()-1)),$d=sd((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dd),(t=>t.getUTCDate()-1)),kd=sd((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dd),(t=>Math.floor(t/dd)));function Md(t){return sd((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ld)/md))}const Ad=Md(0);function Dd(t){return sd((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/md))}Md(1),Md(2),Md(3),Md(4),Md(5),Md(6);const Sd=Dd(0);Dd(1),Dd(2),Dd(3),Dd(4),Dd(5),Dd(6);const Fd=sd((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),Ed=sd((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),Nd=sd((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Nd.every=t=>isFinite(t=Math.floor(t))&&t>0?sd((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const Cd=sd((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Od(t,n,e,r,i,o){const a=[[gd,1,fd],[gd,5,5e3],[gd,15,15e3],[gd,30,3e4],[o,1,ld],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,hd],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,dd],[r,2,1728e5],[e,1,md],[n,1,2592e6],[n,3,7776e6],[t,1,pd]];function u(n,e,r){const i=Math.abs(e-n)/r,o=Qt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(bn(n/pd,e/pd,r));if(0===o)return cd.every(Math.max(bn(n,e,r),1));const[u,s]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return u.every(s)}return[function(t,n,e){const r=n<t;r&&([t,n]=[n,t]);const i=e&&"function"==typeof e.range?e:u(t,n,e),o=i?i.range(t,+n+1):[];return r?o.reverse():o},u]}Cd.every=t=>isFinite(t=Math.floor(t))&&t>0?sd((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const[_d,zd]=Od(Cd,Ed,Sd,kd,wd,yd),[Bd,Td]=Od(Nd,Fd,Ad,xd,bd,vd);function Pd(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function jd(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Rd(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var Ld,Id,qd,Ud={"-":"",_:" ",0:"0"},Wd=/^\s*\d+/,Hd=/^%/,Gd=/[\\^$*+?|[\]().{}]/g;function Yd(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Vd(t){return t.replace(Gd,"\\$&")}function Xd(t){return new RegExp("^(?:"+t.map(Vd).join("|")+")","i")}function Jd(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Kd(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Qd(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Zd(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function tm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function nm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function em(t,n,e){var r=Wd.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function rm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function im(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function om(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function am(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function um(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function sm(t,n,e){var r=Wd.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function cm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function fm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function lm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function hm(t,n,e){var r=Wd.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function dm(t,n,e){var r=Wd.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function mm(t,n,e){var r=Hd.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function pm(t,n,e){var r=Wd.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function gm(t,n,e){var r=Wd.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function vm(t,n){return Yd(t.getDate(),n,2)}function ym(t,n){return Yd(t.getHours(),n,2)}function bm(t,n){return Yd(t.getHours()%12||12,n,2)}function wm(t,n){return Yd(1+Ar.count(Nr(t),t),n,3)}function xm(t,n){return Yd(t.getMilliseconds(),n,3)}function $m(t,n){return xm(t,n)+"000"}function km(t,n){return Yd(t.getMonth()+1,n,2)}function Mm(t,n){return Yd(t.getMinutes(),n,2)}function Am(t,n){return Yd(t.getSeconds(),n,2)}function Dm(t){var n=t.getDay();return 0===n?7:n}function Sm(t,n){return Yd(Sr.count(Nr(t)-1,t),n,2)}function Fm(t){var n=t.getDay();return n>=4||0===n?Er(t):Er.ceil(t)}function Em(t,n){return t=Fm(t),Yd(Er.count(Nr(t),t)+(4===Nr(t).getDay()),n,2)}function Nm(t){return t.getDay()}function Cm(t,n){return Yd(Fr.count(Nr(t)-1,t),n,2)}function Om(t,n){return Yd(t.getFullYear()%100,n,2)}function _m(t,n){return Yd((t=Fm(t)).getFullYear()%100,n,2)}function zm(t,n){return Yd(t.getFullYear()%1e4,n,4)}function Bm(t,n){var e=t.getDay();return Yd((t=e>=4||0===e?Er(t):Er.ceil(t)).getFullYear()%1e4,n,4)}function Tm(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Yd(n/60|0,"0",2)+Yd(n%60,"0",2)}function Pm(t,n){return Yd(t.getUTCDate(),n,2)}function jm(t,n){return Yd(t.getUTCHours(),n,2)}function Rm(t,n){return Yd(t.getUTCHours()%12||12,n,2)}function Lm(t,n){return Yd(1+Cr.count(Tr(t),t),n,3)}function Im(t,n){return Yd(t.getUTCMilliseconds(),n,3)}function qm(t,n){return Im(t,n)+"000"}function Um(t,n){return Yd(t.getUTCMonth()+1,n,2)}function Wm(t,n){return Yd(t.getUTCMinutes(),n,2)}function Hm(t,n){return Yd(t.getUTCSeconds(),n,2)}function Gm(t){var n=t.getUTCDay();return 0===n?7:n}function Ym(t,n){return Yd(_r.count(Tr(t)-1,t),n,2)}function Vm(t){var n=t.getUTCDay();return n>=4||0===n?Br(t):Br.ceil(t)}function Xm(t,n){return t=Vm(t),Yd(Br.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function Jm(t){return t.getUTCDay()}function Km(t,n){return Yd(zr.count(Tr(t)-1,t),n,2)}function Qm(t,n){return Yd(t.getUTCFullYear()%100,n,2)}function Zm(t,n){return Yd((t=Vm(t)).getUTCFullYear()%100,n,2)}function tp(t,n){return Yd(t.getUTCFullYear()%1e4,n,4)}function np(t,n){var e=t.getUTCDay();return Yd((t=e>=4||0===e?Br(t):Br.ceil(t)).getUTCFullYear()%1e4,n,4)}function ep(){return"+0000"}function rp(){return"%"}function ip(t){return+t}function op(t){return Math.floor(+t/1e3)}function ap(t){return new Date(t)}function up(t){return t instanceof Date?+t:+new Date(+t)}function sp(t,n,e,r,i,o,a,u,s,c){var f=Sh(),l=f.invert,h=f.domain,d=c(".%L"),m=c(":%S"),p=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function x(t){return(s(t)<t?d:u(t)<t?m:a(t)<t?p:o(t)<t?g:r(t)<t?i(t)<t?v:y:e(t)<t?b:w)(t)}return f.invert=function(t){return new Date(l(t))},f.domain=function(t){return arguments.length?h(Array.from(t,up)):h().map(ap)},f.ticks=function(n){var e=h();return t(e[0],e[e.length-1],null==n?10:n)},f.tickFormat=function(t,n){return null==n?x:c(n)},f.nice=function(t){var e=h();return t&&"function"==typeof t.range||(t=n(e[0],e[e.length-1],null==t?10:t)),t?h(Wh(e,t)):f},f.copy=function(){return Ah(f,sp(t,n,e,r,i,o,a,u,s,c))},f}function cp(){var t,n,e,r,i,o=0,a=1,u=xh,s=!1;function c(n){return null==n||isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}function f(t){return function(n){var e,r;return arguments.length?([e,r]=n,u=t(e,r),c):[u(0),u(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),n=r(a=+a),e=t===n?0:1/(n-t),c):[o,a]},c.clamp=function(t){return arguments.length?(s=!!t,c):s},c.interpolator=function(t){return arguments.length?(u=t,c):u},c.range=f(Kl),c.rangeRound=f(Ql),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),c}}function fp(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function lp(){var t=Uh(cp()(xh));return t.copy=function(){return fp(t,lp())},yf.apply(t,arguments)}function hp(){var t=id(cp());return t.copy=function(){return fp(t,hp()).exponent(t.exponent())},yf.apply(t,arguments)}function dp(){var t,n,e,r,i,o,a,u=0,s=.5,c=1,f=1,l=xh,h=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(f*t<f*n?r:i),l(h?Math.max(0,Math.min(1,t)):t))}function m(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,l=vh(t,[e,r,i]),d):[l(0),l(.5),l(1)]}}return d.domain=function(a){return arguments.length?([u,s,c]=a,t=o(u=+u),n=o(s=+s),e=o(c=+c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),f=n<t?-1:1,d):[u,s,c]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(l=t,d):l},d.range=m(Kl),d.rangeRound=m(Ql),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(u),n=a(s),e=a(c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),f=n<t?-1:1,d}}function mp(){var t=id(dp());return t.copy=function(){return fp(t,mp()).exponent(t.exponent())},yf.apply(t,arguments)}function pp(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}Ld=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Xd(i),f=Jd(i),l=Xd(o),h=Jd(o),d=Xd(a),m=Jd(a),p=Xd(u),g=Jd(u),v=Xd(s),y=Jd(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:vm,e:vm,f:$m,g:_m,G:Bm,H:ym,I:bm,j:wm,L:xm,m:km,M:Mm,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ip,s:op,S:Am,u:Dm,U:Sm,V:Em,w:Nm,W:Cm,x:null,X:null,y:Om,Y:zm,Z:Tm,"%":rp},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Pm,e:Pm,f:qm,g:Zm,G:np,H:jm,I:Rm,j:Lm,L:Im,m:Um,M:Wm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ip,s:op,S:Hm,u:Gm,U:Ym,V:Xm,w:Jm,W:Km,x:null,X:null,y:Qm,Y:tp,Z:ep,"%":rp},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=m[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:um,e:um,f:dm,g:rm,G:em,H:cm,I:cm,j:sm,L:hm,m:am,M:fm,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=f[r[0].toLowerCase()],e+r[0].length):-1},q:om,Q:pm,s:gm,S:lm,u:Qd,U:Zd,V:tm,w:Kd,W:nm,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:rm,Y:em,Z:im,"%":mm};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Ud[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Rd(1900,void 0,1);if(M(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(n&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=jd(Rd(o.y,0,1))).getUTCDay(),r=i>4||0===i?zr.ceil(r):zr(r),r=Cr.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Pd(Rd(o.y,0,1))).getDay(),r=i>4||0===i?Fr.ceil(r):Fr(r),r=Ar.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?jd(Rd(o.y,0,1)).getUTCDay():Pd(Rd(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,jd(o)):Pd(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Ud?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Id=Ld.format,qd=Ld.utcFormat;var gp=pp("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),vp=pp("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),yp=pp("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),bp=pp("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),wp=pp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),xp=pp("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),$p=pp("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),kp=pp("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Mp=pp("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Ap=pp("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Dp(t,n,e){const r=t-n+2*e;return t?r>0?r:1:0}const Sp="linear",Fp="log",Ep="pow",Np="sqrt",Cp="symlog",Op="time",_p="utc",zp="sequential",Bp="diverging",Tp="quantile",Pp="quantize",jp="threshold",Rp="ordinal",Lp="point",Ip="band",qp="bin-ordinal",Up="continuous",Wp="discrete",Hp="discretizing",Gp="interpolating",Yp="temporal";function Vp(){const t=wf().unknown(void 0),n=t.domain,e=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,c=.5;function f(){const t=n().length,f=o[1]<o[0],l=o[1-f],h=Dp(t,u,s);let d=o[f-0];r=(l-d)/(h||1),a&&(r=Math.floor(r)),d+=(l-d-r*(t-u))*c,i=r*(1-u),a&&(d=Math.round(d),i=Math.round(i));const m=Fn(t).map((t=>d+r*t));return e(f?m.reverse():m)}return delete t.unknown,t.domain=function(t){return arguments.length?(n(t),f()):n()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],f()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,f()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,f()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,f()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),f()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),f()):s},t.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),f()):c},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?e().reverse():e(),u=a.length-1;let s,c,f,l=+t[0],h=+t[1];return l!=l||h!=h||(h<l&&(f=l,l=h,h=f),h<a[0]||l>o[1-r])?void 0:(s=Math.max(0,en(a,l)-1),c=l===h?s:en(a,h)-1,l-a[s]>i+1e-10&&++s,r&&(f=s,s=u-c,c=u-f),s>c?void 0:n().slice(s,c+1))},t.invert=function(n){const e=t.invertRange([n,n]);return e?e[0]:e},t.copy=function(){return Vp().domain(n()).range(o).round(a).paddingInner(u).paddingOuter(s).align(c)},f()}function Xp(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Xp(n())},t}var Jp=Array.prototype.map;const Kp=Array.prototype.slice,Qp=new Map,Zp=Symbol("vega_scale");function tg(t){return t[Zp]=!0,t}function ng(t,n,e){return arguments.length>1?(Qp.set(t,function(t,n,e){const r=function(){const e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){let e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){const e=t.range();let r,i,o,a,u=n[0],s=n[1],c=-1;for(s<u&&(i=u,u=s,s=i),o=0,a=e.length;o<a;++o)e[o]>=u&&e[o]<=s&&(c<0&&(c=o),r=o);if(!(c<0))return u=t.invertExtent(e[c]),s=t.invertExtent(e[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,tg(e)};return r.metadata=zt(K(e)),r}(t,n,e)),this):eg(t)?Qp.get(t):void 0}function eg(t){return Qp.has(t)}function rg(t,n){const e=Qp.get(t);return e&&e.metadata[n]}function ig(t){return rg(t,Up)}function og(t){return rg(t,Wp)}function ag(t){return rg(t,Hp)}function ug(t){return rg(t,Fp)}function sg(t){return rg(t,Gp)}function cg(t){return rg(t,Tp)}ng("identity",(function t(n){var e;function r(t){return null==t||isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,bh),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,bh):[0,1],Uh(r)})),ng(Sp,(function t(){var n=Sh();return n.copy=function(){return Ah(n,t())},vf.apply(n,arguments),Uh(n)}),Up),ng(Fp,(function t(){const n=Kh(Dh()).domain([1,10]);return n.copy=()=>Ah(n,t()).base(n.base()),vf.apply(n,arguments),n}),[Up,Fp]),ng(Ep,od,Up),ng(Np,(function(){return od.apply(null,arguments).exponent(.5)}),Up),ng(Cp,(function t(){var n=td(Dh());return n.copy=function(){return Ah(n,t()).constant(n.constant())},vf.apply(n,arguments)}),Up),ng(Op,(function(){return vf.apply(sp(Bd,Td,Nd,Fd,Ad,xd,bd,vd,gd,Id).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Up,Yp]),ng(_p,(function(){return vf.apply(sp(_d,zd,Cd,Ed,Sd,$d,wd,yd,gd,qd).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Up,Yp]),ng(zp,lp,[Up,Gp]),ng(`${zp}-${Sp}`,lp,[Up,Gp]),ng(`${zp}-${Fp}`,(function t(){var n=Kh(cp()).domain([1,10]);return n.copy=function(){return fp(n,t()).base(n.base())},yf.apply(n,arguments)}),[Up,Gp,Fp]),ng(`${zp}-${Ep}`,hp,[Up,Gp]),ng(`${zp}-${Np}`,(function(){return hp.apply(null,arguments).exponent(.5)}),[Up,Gp]),ng(`${zp}-${Cp}`,(function t(){var n=td(cp());return n.copy=function(){return fp(n,t()).constant(n.constant())},yf.apply(n,arguments)}),[Up,Gp]),ng(`${Bp}-${Sp}`,(function t(){var n=Uh(dp()(xh));return n.copy=function(){return fp(n,t())},yf.apply(n,arguments)}),[Up,Gp]),ng(`${Bp}-${Fp}`,(function t(){var n=Kh(dp()).domain([.1,1,10]);return n.copy=function(){return fp(n,t()).base(n.base())},yf.apply(n,arguments)}),[Up,Gp,Fp]),ng(`${Bp}-${Ep}`,mp,[Up,Gp]),ng(`${Bp}-${Np}`,(function(){return mp.apply(null,arguments).exponent(.5)}),[Up,Gp]),ng(`${Bp}-${Cp}`,(function t(){var n=td(dp());return n.copy=function(){return fp(n,t()).constant(n.constant())},yf.apply(n,arguments)}),[Up,Gp]),ng(Tp,(function t(){var n,e=[],r=[],i=[];function o(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=An(e,t/n);return a}function a(t){return null==t||isNaN(t=+t)?n:r[en(i,t)]}return a.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Jt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(n=t,a):n},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(e).range(r).unknown(n)},vf.apply(a,arguments)}),[Hp,Tp]),ng(Pp,(function t(){var n,e=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[en(o,t,0,i)]:n}function s(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,s()):[e,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,s()):a.slice()},u.invertExtent=function(t){var n=a.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},u.unknown=function(t){return arguments.length?(n=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([e,r]).range(a).unknown(n)},vf.apply(Uh(u),arguments)}),Hp),ng(jp,(function t(){var n,e=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[en(e,t,0,i)]:n}return o.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),o):e.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t().domain(e).range(r).unknown(n)},vf.apply(o,arguments)}),Hp),ng(qp,(function t(){let n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(en(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=function(t){return Jp.call(t,_)}(t),r):n.slice()},r.range=function(t){return arguments.length?(e=Kp.call(t),r):e.slice()},r.tickFormat=function(t,e){return qh(n[0],O(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Wp,Hp]),ng(Rp,wf,Wp),ng(Ip,Vp,Wp),ng(Lp,(function(){return Xp(Vp().paddingInner(1))}),Wp);const fg=["clamp","base","constant","exponent"];function lg(t,n){const e=n[0],r=O(n)-e;return function(n){return t(e+n*r)}}function hg(t,n,e){return vh(pg(n||"rgb",e),t)}function dg(t,n){const e=new Array(n),r=n+1;for(let i=0;i<n;)e[i]=t(++i/r);return e}function mg(t,n,e){const r=e-n;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=ng(o)().domain([n,e]).range([0,1]),fg.forEach((n=>t[n]?a[n](t[n]()):0)),a):ot(.5)}function pg(t,n){const e=yh[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function gg(t){if(D(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function vg(t,n){for(const e in t)bg(e,n(t[e]))}const yg={};function bg(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(yg[t]=n,this):yg[t]}vg({accent:vp,category10:gp,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:yp,observable10:bp,paired:wp,pastel1:xp,pastel2:$p,set1:kp,set2:Mp,set3:Ap,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},gg),vg({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>hg(gg(t))));const wg="symbol",xg=t=>D(t)?t.map((t=>String(t))):String(t),$g=(t,n)=>t[1]-n[1],kg=(t,n)=>n[1]-t[1];function Mg(t,n,e){let r;return bt(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,Math.floor(Ft(t.domain())/e||1)+1))),S(n)&&(r=n.step,n=n.interval),xt(n)&&(n=t.type===Op?er(n):t.type==_p?rr(n):p("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Ag(t,n,e){let r=t.range(),i=r[0],o=O(r),a=$g;if(i>o&&(r=o,o=i,i=r,a=kg),i=Math.floor(i),o=Math.ceil(o),n=n.map((n=>[n,t(n)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),e>0&&n.length>1){const t=[n[0],O(n)];for(;n.length>e&&n.length>=3;)n=n.filter(((t,n)=>!(n%2)));n.length<3&&(n=t)}return n}function Dg(t,n){return t.bins?Ag(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function Sg(t,n,e,r,i,o){const a=n.type;let u=xg;if(a===Op||i===Op)u=t.timeFormat(r);else if(a===_p||i===_p)u=t.utcFormat(r);else if(ug(a)){const i=t.formatFloat(r);if(o||n.bins)u=i;else{const t=Fg(n,e,!1);u=n=>t(n)?i(n):""}}else if(n.tickFormat){const i=n.domain();u=t.formatSpan(i[0],i[i.length-1],e,r)}else r&&(u=t.format(r));return u}function Fg(t,n,e){const r=Dg(t,n),i=t.base(),o=Math.log(i),a=Math.max(1,i*n/r.length),u=t=>{let n=t/Math.pow(i,Math.round(Math.log(t)/o));return n*i<i-.5&&(n*=i),n<=a};return e?r.filter(u):u}const Eg={[Tp]:"quantiles",[Pp]:"thresholds",[jp]:"domain"},Ng={[Tp]:"quantiles",[Pp]:"domain"};function Cg(t,n){return t.bins?function(t){const n=t.slice(0,-1);return n.max=O(t),n}(t.bins):t.type===Fp?Fg(t,n,!0):Eg[t.type]?function(t){const n=[-1/0].concat(t);return n.max=1/0,n}(t[Eg[t.type]]()):Dg(t,n)}function Og(t,n,e,r,i,o,a){const u=Ng[n.type]&&o!==Op&&o!==_p?function(t,n,e){const r=n[Ng[n.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o<i;++o)a=Math.min(a,r[o]-r[o-1]);return t.formatSpan(0,a,30,e)}(t,n,i):Sg(t,n,e,i,o,a);return r===wg&&(t=>Eg[t.type]||t.bins)(n)?_g(u):"discrete"===r?Bg(u):Tg(u)}const _g=t=>(n,e,r)=>{const i=zg(r[e+1],zg(r.max,1/0)),o=Pg(n,t),a=Pg(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},zg=(t,n)=>null!=t?t:n,Bg=t=>(n,e)=>e?t(n):null,Tg=t=>n=>t(n),Pg=(t,n)=>Number.isFinite(t)?n(t):null;function jg(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=function(t,n,e,r){const i=r||n.type;return xt(e)&&function(t){return rg(t,Yp)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==Op?e||i!==_p?Og(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}(t,n,e.format,e.formatType);if(ag(n.type)){const t=Cg(n).slice(1).map(i),e=t.length;return`${e} boundar${1===e?"y":"ies"}: ${t.join(", ")}`}if(og(n.type)){const t=n.domain(),e=t.length;return`${e} value${1===e?"":"s"}: ${e>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=n.domain();return`values from ${i(t[0])} to ${i(O(t))}`}}let Rg=0;const Lg="p_";function Ig(t){return t&&t.gradient}function qg(t,n,e){const r=t.gradient;let i=t.id,o="radial"===r?Lg:"";return i||(i=t.id="gradient_"+Rg++,"radial"===r?(t.x1=Ug(t.x1,.5),t.y1=Ug(t.y1,.5),t.r1=Ug(t.r1,0),t.x2=Ug(t.x2,.5),t.y2=Ug(t.y2,.5),t.r2=Ug(t.r2,.5),o=Lg):(t.x1=Ug(t.x1,0),t.y1=Ug(t.y1,0),t.x2=Ug(t.x2,1),t.y2=Ug(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+o+i+")"}function Ug(t,n){return null!=t?t:n}function Wg(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}const Hg={basis:{curve:function(t){return new jc(t)}},"basis-closed":{curve:function(t){return new Rc(t)}},"basis-open":{curve:function(t){return new Lc(t)}},bundle:{curve:qc,tension:"beta",value:.85},cardinal:{curve:Hc,tension:"tension",value:0},"cardinal-open":{curve:Xc,tension:"tension",value:0},"cardinal-closed":{curve:Yc,tension:"tension",value:0},"catmull-rom":{curve:Qc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:tf,tension:"alpha",value:.5},"catmull-rom-open":{curve:ef,tension:"alpha",value:.5},linear:{curve:Nc},"linear-closed":{curve:function(t){return new rf(t)}},monotone:{horizontal:function(t){return new ff(t)},vertical:function(t){return new cf(t)}},natural:{curve:function(t){return new hf(t)}},step:{curve:function(t){return new mf(t,.5)}},"step-after":{curve:function(t){return new mf(t,1)}},"step-before":{curve:function(t){return new mf(t,0)}}};function Gg(t,n,e){var r=ft(Hg,t)&&Hg[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}const Yg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Vg=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Xg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Jg=/^((\s+,?\s*)|(,\s*))/,Kg=/^[01]/;function Qg(t){const n=[];return(t.match(Vg)||[]).forEach((t=>{let e=t[0];const r=e.toLowerCase(),i=Yg[r],o=function(t,n,e){const r=[];for(let i=0;n&&i<e.length;)for(let o=0;o<n;++o){const n="a"!==t||3!==o&&4!==o?Xg:Kg,a=e.slice(i).match(n);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");i+=a[0].length,r.push(+a[0]);const u=e.slice(i).match(Jg);null!==u&&(i+=u[0].length)}return r}(r,i,t.slice(1).trim()),a=o.length;if(a<i||a&&a%i!=0)throw Error("Invalid SVG path, incorrect parameter count");if(n.push([e,...o.slice(0,i)]),a!==i){"m"===r&&(e="M"===e?"L":"l");for(let t=i;t<a;t+=i)n.push([e,...o.slice(t,t+i)])}})),n}const Zg=Math.PI/180,tv=Math.PI/2,nv=2*Math.PI,ev=Math.sqrt(3)/2;var rv={},iv={},ov=[].join;function av(t){const n=ov.call(t);if(iv[n])return iv[n];var e=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],c=t[7];const f=c*a,l=-s*u,h=s*a,d=c*u,m=Math.cos(i),p=Math.sin(i),g=Math.cos(o),v=Math.sin(o),y=.5*(o-i),b=Math.sin(.5*y),w=8/3*b*b/Math.sin(y),x=e+m-w*p,$=r+p+w*m,k=e+g,M=r+v,A=k+w*v,D=M-w*g;return iv[n]=[f*x+l*$,h*x+d*$,f*A+l*D,h*A+d*D,f*k+l*M,h*k+d*M]}const uv=["l",0,0,0,0,0,0,0];function sv(t,n,e){const r=uv[0]=t[0];if("a"===r||"A"===r)uv[1]=n*t[1],uv[2]=e*t[2],uv[3]=t[3],uv[4]=t[4],uv[5]=t[5],uv[6]=n*t[6],uv[7]=e*t[7];else if("h"===r||"H"===r)uv[1]=n*t[1];else if("v"===r||"V"===r)uv[1]=e*t[1];else for(var i=1,o=t.length;i<o;++i)uv[i]=(i%2==1?n:e)*t[i];return uv}function cv(t,n,e,r,i,o){var a,u,s,c,f,l=null,h=0,d=0,m=0,p=0,g=0,v=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var y=0,b=n.length;y<b;++y){switch(a=n[y],1===i&&1===o||(a=sv(a,i,o)),a[0]){case"l":t.lineTo((h+=a[1])+e,(d+=a[2])+r);break;case"L":t.lineTo((h=a[1])+e,(d=a[2])+r);break;case"h":t.lineTo((h+=a[1])+e,d+r);break;case"H":t.lineTo((h=a[1])+e,d+r);break;case"v":t.lineTo(h+e,(d+=a[1])+r);break;case"V":t.lineTo(h+e,(d=a[1])+r);break;case"m":g=h+=a[1],v=d+=a[2],t.moveTo(h+e,d+r);break;case"M":g=h=a[1],v=d=a[2],t.moveTo(h+e,d+r);break;case"c":t.bezierCurveTo(h+a[1]+e,d+a[2]+r,(m=h+a[3])+e,(p=d+a[4])+r,(u=h+a[5])+e,(s=d+a[6])+r),h=u,d=s;break;case"C":t.bezierCurveTo(a[1]+e,a[2]+r,(m=a[3])+e,(p=a[4])+r,(h=a[5])+e,(d=a[6])+r);break;case"s":t.bezierCurveTo((m=2*h-m)+e,(p=2*d-p)+r,h+a[1]+e,d+a[2]+r,(u=h+a[3])+e,(s=d+a[4])+r),m=h+a[1],p=d+a[2],h=u,d=s;break;case"S":t.bezierCurveTo((m=2*h-m)+e,(p=2*d-p)+r,a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),h=u,d=s,m=a[1],p=a[2];break;case"q":t.quadraticCurveTo((m=h+a[1])+e,(p=d+a[2])+r,(u=h+a[3])+e,(s=d+a[4])+r),h=u,d=s;break;case"Q":t.quadraticCurveTo(a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),h=u,d=s,m=a[1],p=a[2];break;case"t":u=h+a[1],s=d+a[2],null===l[0].match(/[QqTt]/)?(m=h,p=d):"t"===l[0]?(m=2*h-c,p=2*d-f):"q"===l[0]&&(m=2*h-m,p=2*d-p),c=m,f=p,t.quadraticCurveTo(m+e,p+r,u+e,s+r),m=(h=u)+a[1],p=(d=s)+a[2];break;case"T":t.quadraticCurveTo((m=2*h-m)+e,(p=2*d-p)+r,(u=a[1])+e,(s=a[2])+r),h=u,d=s;break;case"a":fv(t,h+e,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+h+e,a[7]+d+r]),h+=a[6],d+=a[7];break;case"A":fv(t,h+e,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+r]),h=a[6],d=a[7];break;case"z":case"Z":h=g,d=v,t.closePath()}l=a}}function fv(t,n,e,r){const i=function(t,n,e,r,i,o,a,u,s){const c=ov.call(arguments);if(rv[c])return rv[c];const f=a*Zg,l=Math.sin(f),h=Math.cos(f),d=h*(u-t)*.5+l*(s-n)*.5,m=h*(s-n)*.5-l*(u-t)*.5;let p=d*d/((e=Math.abs(e))*e)+m*m/((r=Math.abs(r))*r);p>1&&(p=Math.sqrt(p),e*=p,r*=p);const g=h/e,v=l/e,y=-l/r,b=h/r,w=g*u+v*s,x=y*u+b*s,$=g*t+v*n,k=y*t+b*n;let M=1/(($-w)*($-w)+(k-x)*(k-x))-.25;M<0&&(M=0);let A=Math.sqrt(M);o==i&&(A=-A);const D=.5*(w+$)-A*(k-x),S=.5*(x+k)+A*($-w),F=Math.atan2(x-S,w-D);let E=Math.atan2(k-S,$-D)-F;E<0&&1===o?E+=nv:E>0&&0===o&&(E-=nv);const N=Math.ceil(Math.abs(E/(tv+.001))),C=[];for(let t=0;t<N;++t)C[t]=[D,S,F+t*E/N,F+(t+1)*E/N,e,r,l,h];return rv[c]=C}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e);for(let n=0;n<i.length;++n){const e=av(i[n]);t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])}}const lv=.5773502691896257,hv={circle:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,nv)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,o=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-e),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*lv,o=e/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*lv;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function dv(t){return ft(hv,t)?hv[t]:function(t){if(!ft(mv,t)){const n=Qg(t);mv[t]={draw:function(t,e){cv(t,n,0,0,Math.sqrt(e)/2)}}}return mv[t]}(t)}var mv={};const pv=.448084975506;function gv(t){return t.x}function vv(t){return t.y}function yv(t){return t.width}function bv(t){return t.height}function wv(t){return"function"==typeof t?t:()=>+t}function xv(t,n,e){return Math.max(n,Math.min(t,e))}function $v(){var t=gv,n=vv,e=yv,r=bv,i=wv(0),o=i,a=i,u=i,s=null;function c(c,f,l){var h,d=null!=f?f:+t.call(this,c),m=null!=l?l:+n.call(this,c),p=+e.call(this,c),g=+r.call(this,c),v=Math.min(p,g)/2,y=xv(+i.call(this,c),0,v),b=xv(+o.call(this,c),0,v),w=xv(+a.call(this,c),0,v),x=xv(+u.call(this,c),0,v);if(s||(s=h=wc()),y<=0&&b<=0&&w<=0&&x<=0)s.rect(d,m,p,g);else{var $=d+p,k=m+g;s.moveTo(d+y,m),s.lineTo($-b,m),s.bezierCurveTo($-pv*b,m,$,m+pv*b,$,m+b),s.lineTo($,k-x),s.bezierCurveTo($,k-pv*x,$-pv*x,k,$-x,k),s.lineTo(d+w,k),s.bezierCurveTo(d+pv*w,k,d,k-pv*w,d,k-w),s.lineTo(d,m+y),s.bezierCurveTo(d,m+pv*y,d+pv*y,m,d+y,m),s.closePath()}if(h)return s=null,h+""||null}return c.x=function(n){return arguments.length?(t=wv(n),c):t},c.y=function(t){return arguments.length?(n=wv(t),c):n},c.width=function(t){return arguments.length?(e=wv(t),c):e},c.height=function(t){return arguments.length?(r=wv(t),c):r},c.cornerRadius=function(t,n,e,r){return arguments.length?(i=wv(t),o=null!=n?wv(n):i,u=null!=e?wv(e):i,a=null!=r?wv(r):o,c):i},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function kv(){var t,n,e,r,i,o,a,u,s=null;function c(t,n,e){const r=e/2;if(i){var c=a-n,f=t-o;if(c||f){var l=Math.hypot(c,f),h=(c/=l)*u,d=(f/=l)*u,m=Math.atan2(f,c);s.moveTo(o-h,a-d),s.lineTo(t-c*r,n-f*r),s.arc(t,n,r,m-Math.PI,m),s.lineTo(o+h,a+d),s.arc(o,a,u,m,m+Math.PI)}else s.arc(t,n,r,0,nv);s.closePath()}else i=1;o=t,a=n,u=r}function f(o){var a,u,f,l=o.length,h=!1;for(null==s&&(s=f=wc()),a=0;a<=l;++a)!(a<l&&r(u=o[a],a,o))===h&&(h=!h)&&(i=0),h&&c(+t(u,a,o),+n(u,a,o),+e(u,a,o));if(f)return s=null,f+""||null}return f.x=function(n){return arguments.length?(t=n,f):t},f.y=function(t){return arguments.length?(n=t,f):n},f.size=function(t){return arguments.length?(e=t,f):e},f.defined=function(t){return arguments.length?(r=t,f):r},f.context=function(t){return arguments.length?(s=null==t?null:t,f):s},f}function Mv(t,n){return null!=t?t:n}const Av=t=>t.x||0,Dv=t=>t.y||0,Sv=t=>!(!1===t.defined),Fv=function(){var t=$c,n=kc,e=nc(0),r=null,i=Mc,o=Ac,a=Dc,u=null,s=xc(c);function c(){var c,f,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-lc,m=o.apply(this,arguments)-lc,p=ec(m-d),g=m>d;if(u||(u=c=s()),h<l&&(f=h,h=l,l=f),h>cc)if(p>hc-cc)u.moveTo(h*ic(d),h*uc(d)),u.arc(0,0,h,d,m,!g),l>cc&&(u.moveTo(l*ic(m),l*uc(m)),u.arc(0,0,l,m,d,g));else{var v,y,b=d,w=m,x=d,$=m,k=p,M=p,A=a.apply(this,arguments)/2,D=A>cc&&(r?+r.apply(this,arguments):sc(l*l+h*h)),S=ac(ec(h-l)/2,+e.apply(this,arguments)),F=S,E=S;if(D>cc){var N=dc(D/l*uc(A)),C=dc(D/h*uc(A));(k-=2*N)>cc?(x+=N*=g?1:-1,$-=N):(k=0,x=$=(d+m)/2),(M-=2*C)>cc?(b+=C*=g?1:-1,w-=C):(M=0,b=w=(d+m)/2)}var O=h*ic(b),_=h*uc(b),z=l*ic($),B=l*uc($);if(S>cc){var T,P=h*ic(w),j=h*uc(w),R=l*ic(x),L=l*uc(x);if(p<fc)if(T=function(t,n,e,r,i,o,a,u){var s=e-t,c=r-n,f=a-i,l=u-o,h=l*s-f*c;if(!(h*h<cc))return[t+(h=(f*(n-o)-l*(t-i))/h)*s,n+h*c]}(O,_,R,L,P,j,z,B)){var I=O-T[0],q=_-T[1],U=P-T[0],W=j-T[1],H=1/uc(function(t){return t>1?0:t<-1?fc:Math.acos(t)}((I*U+q*W)/(sc(I*I+q*q)*sc(U*U+W*W)))/2),G=sc(T[0]*T[0]+T[1]*T[1]);F=ac(S,(l-G)/(H-1)),E=ac(S,(h-G)/(H+1))}else F=E=0}M>cc?E>cc?(v=Sc(R,L,O,_,h,E,g),y=Sc(P,j,z,B,h,E,g),u.moveTo(v.cx+v.x01,v.cy+v.y01),E<S?u.arc(v.cx,v.cy,E,rc(v.y01,v.x01),rc(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,E,rc(v.y01,v.x01),rc(v.y11,v.x11),!g),u.arc(0,0,h,rc(v.cy+v.y11,v.cx+v.x11),rc(y.cy+y.y11,y.cx+y.x11),!g),u.arc(y.cx,y.cy,E,rc(y.y11,y.x11),rc(y.y01,y.x01),!g))):(u.moveTo(O,_),u.arc(0,0,h,b,w,!g)):u.moveTo(O,_),l>cc&&k>cc?F>cc?(v=Sc(z,B,P,j,l,-F,g),y=Sc(O,_,R,L,l,-F,g),u.lineTo(v.cx+v.x01,v.cy+v.y01),F<S?u.arc(v.cx,v.cy,F,rc(v.y01,v.x01),rc(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,F,rc(v.y01,v.x01),rc(v.y11,v.x11),!g),u.arc(0,0,l,rc(v.cy+v.y11,v.cx+v.x11),rc(y.cy+y.y11,y.cx+y.x11),g),u.arc(y.cx,y.cy,F,rc(y.y11,y.x11),rc(y.y01,y.x01),!g))):u.arc(0,0,l,$,x,g):u.lineTo(z,B)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-fc/2;return[ic(r)*e,uc(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nc(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:nc(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:nc(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:nc(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:nc(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}().startAngle((t=>t.startAngle||0)).endAngle((t=>t.endAngle||0)).padAngle((t=>t.padAngle||0)).innerRadius((t=>t.innerRadius||0)).outerRadius((t=>t.outerRadius||0)).cornerRadius((t=>t.cornerRadius||0)),Ev=zc().x(Av).y1(Dv).y0((t=>(t.y||0)+(t.height||0))).defined(Sv),Nv=zc().y(Dv).x1(Av).x0((t=>(t.x||0)+(t.width||0))).defined(Sv),Cv=_c().x(Av).y(Dv).defined(Sv),Ov=$v().x(Av).y(Dv).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Mv(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),_v=function(t,n){let e=null,r=xc(i);function i(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return t="function"==typeof t?t:nc(t||Bc),n="function"==typeof n?n:nc(void 0===n?64:+n),i.type=function(n){return arguments.length?(t="function"==typeof n?n:nc(n),i):t},i.size=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),i):n},i.context=function(t){return arguments.length?(e=null==t?null:t,i):e},i}().type((t=>dv(t.shape||"circle"))).size((t=>Mv(t.size,64))),zv=kv().x(Av).y(Dv).defined(Sv).size((t=>t.size||1));function Bv(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Tv(t,n,e,r){return Ov.context(t)(n,e,r)}var Pv=1;function jv(){Pv=1}function Rv(t,n,e){var r=n.clip,i=t._defs,o=n.clip_id||(n.clip_id="clip"+Pv++),a=i.clipping[o]||(i.clipping[o]={id:o});return Z(r)?a.path=r(null):Bv(e)?a.path=Tv(null,e,0,0):(a.width=e.width||0,a.height=e.height||0),"url(#"+o+")"}function Lv(t){this.clear(),t&&this.union(t)}function Iv(t){this.mark=t,this.bounds=this.bounds||new Lv}function qv(t){Iv.call(this,t),this.items=this.items||[]}Lv.prototype={clone(){return new Lv(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},add(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),c=n-n*u+e*s,f=e-n*s-e*u;return[u*r-s*i+c,s*r+u*i+f,u*r-s*a+c,s*r+u*a+f,u*o-s*i+c,s*o+u*i+f,u*o-s*a+c,s*o+u*a+f]},union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},contains(t,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},mt(qv,Iv);class Uv{constructor(t){this._pending=0,this._loader=t||Xo()}pending(){return this._pending}sanitizeURL(t){const n=this;return Wv(n),n._loader.sanitize(t,{context:"href"}).then((t=>(Hv(n),t))).catch((()=>(Hv(n),null)))}loadImage(t){const n=this,e=gf();return Wv(n),n._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!e)throw{url:r};const i=new e,o=ft(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Hv(n),i.onerror=()=>Hv(n),i.src=r,i})).catch((t=>(Hv(n),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((n=>{!function e(r){t.pending()?setTimeout((()=>{e(!0)}),10):n(r)}(!1)}))}}function Wv(t){t._pending+=1}function Hv(t){t._pending-=1}function Gv(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){const r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}const Yv=nv-1e-8;let Vv,Xv,Jv,Kv,Qv,Zv,ty,ny;const ey=(t,n)=>Vv.add(t,n),ry=(t,n)=>ey(Xv=t,Jv=n),iy=t=>ey(t,Vv.y1),oy=t=>ey(Vv.x1,t),ay=(t,n)=>Qv*t+ty*n,uy=(t,n)=>Zv*t+ny*n,sy=(t,n)=>ey(ay(t,n),uy(t,n)),cy=(t,n)=>ry(ay(t,n),uy(t,n));function fy(t,n){return Vv=t,n?(Kv=n*Zg,Qv=ny=Math.cos(Kv),Zv=Math.sin(Kv),ty=-Zv):(Qv=ny=1,Kv=Zv=ty=0),ly}const ly={beginPath(){},closePath(){},moveTo:cy,lineTo:cy,rect(t,n,e,r){Kv?(sy(t+e,n),sy(t+e,n+r),sy(t,n+r),cy(t,n)):(ey(t+e,n+r),ry(t,n))},quadraticCurveTo(t,n,e,r){const i=ay(t,n),o=uy(t,n),a=ay(e,r),u=uy(e,r);hy(Xv,i,a,iy),hy(Jv,o,u,oy),ry(a,u)},bezierCurveTo(t,n,e,r,i,o){const a=ay(t,n),u=uy(t,n),s=ay(e,r),c=uy(e,r),f=ay(i,o),l=uy(i,o);dy(Xv,a,s,f,iy),dy(Jv,u,c,l,oy),ry(f,l)},arc(t,n,e,r,i,o){if(r+=Kv,i+=Kv,Xv=e*Math.cos(i)+t,Jv=e*Math.sin(i)+n,Math.abs(i-r)>Yv)ey(t-e,n-e),ey(t+e,n+e);else{const a=r=>ey(e*Math.cos(r)+t,e*Math.sin(r)+n);let u,s;if(a(r),a(i),i!==r)if((r%=nv)<0&&(r+=nv),(i%=nv)<0&&(i+=nv),i<r&&(o=!o,u=r,r=i,i=u),o)for(i-=nv,u=r-r%tv,s=0;s<4&&u>i;++s,u-=tv)a(u);else for(u=r-r%tv+tv,s=0;s<4&&u<i;++s,u+=tv)a(u)}}};function hy(t,n,e,r){const i=(t-n)/(t+e-2*n);0<i&&i<1&&r(t+(n-t)*i)}function dy(t,n,e,r,i){const o=r-t+3*n-3*e,a=t+e-2*n,u=t-n;let s,c=0,f=0;Math.abs(o)>1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),c=(-a+s)/o,f=(-a-s)/o)):c=.5*u/a,0<c&&c<1&&i(my(c,t,n,e,r)),0<f&&f<1&&i(my(f,t,n,e,r))}function my(t,n,e,r,i){const o=1-t,a=o*o,u=t*t;return a*o*n+3*a*t*e+3*o*u*r+u*t*i}var py=(py=pf(1,1))?py.getContext("2d"):null;const gy=new Lv;function vy(t){return function(n,e){if(!py)return!0;t(py,n),gy.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:o,y2:a}=gy;for(let t=i;t<=a;++t)for(let n=r;n<=o;++n)if(py.isPointInPath(n,t))return!0;return!1}}function yy(t,n){return n.contains(t.x||0,t.y||0)}function by(t,n){const e=t.x||0,r=t.y||0;return n.intersects(gy.set(e,r,e+(t.width||0),r+(t.height||0)))}function wy(t,n){const e=t.x||0,r=t.y||0;return xy(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function xy(t,n,e,r,i){const{x1:o,y1:a,x2:u,y2:s}=t,c=r-n,f=i-e;let l,h,d,m,p=0,g=1;for(m=0;m<4;++m){if(0===m&&(l=-c,h=-(o-n)),1===m&&(l=c,h=u-n),2===m&&(l=-f,h=-(a-e)),3===m&&(l=f,h=s-e),Math.abs(l)<1e-10&&h<0)return!1;if(d=h/l,l<0){if(d>g)return!1;d>p&&(p=d)}else if(l>0){if(d<p)return!1;d<g&&(g=d)}}return!0}function $y(t,n){t.globalCompositeOperation=n.blend||"source-over"}function ky(t,n){return null==t?n:t}function My(t,n){const e=n.length;for(let r=0;r<e;++r)t.addColorStop(n[r].offset,n[r].color);return t}function Ay(t,n,e){return Ig(e)?function(t,n,e){const r=e.width(),i=e.height();let o;if("radial"===n.gradient)o=t.createRadialGradient(e.x1+ky(n.x1,.5)*r,e.y1+ky(n.y1,.5)*i,Math.max(r,i)*ky(n.r1,0),e.x1+ky(n.x2,.5)*r,e.y1+ky(n.y2,.5)*i,Math.max(r,i)*ky(n.r2,.5));else{const a=ky(n.x1,0),u=ky(n.y1,0),s=ky(n.x2,1),c=ky(n.y2,0);if(a!==s&&u!==c&&r!==i){const e=pf(Math.ceil(r),Math.ceil(i)),o=e.getContext("2d");return o.scale(r,i),o.fillStyle=My(o.createLinearGradient(a,u,s,c),n.stops),o.fillRect(0,0,r,i),t.createPattern(e,"no-repeat")}o=t.createLinearGradient(e.x1+a*r,e.y1+u*i,e.x1+s*r,e.y1+c*i)}return My(o,n.stops)}(t,e,n.bounds):e}function Dy(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=Ay(t,n,n.fill),!0)}var Sy=[];function Fy(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&(e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=Ay(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Sy),t.lineDashOffset=n.strokeDashOffset||0),!0)}function Ey(t,n){return t.zindex-n.zindex||t.index-n.index}function Ny(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,o=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&o.push(n);return t.zdirty=!1,t.zitems=o.sort(Ey)}function Cy(t,n){var e,r,i=t.items;if(!i||!i.length)return;const o=Ny(t);if(o&&o.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=o}for(e=0,r=i.length;e<r;++e)n(i[e])}function Oy(t,n){var e,r,i=t.items;if(!i||!i.length)return null;const o=Ny(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function _y(t){return function(n,e,r){Cy(e,(e=>{r&&!r.intersects(e.bounds)||By(t,n,e,e)}))}}function zy(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||By(t,n,e.items[0],e.items)}}function By(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||($y(n,e),e.fill&&Dy(n,e,i)&&n.fill(),e.stroke&&Fy(n,e,i)&&n.stroke()))}function Ty(t){return t=t||$,function(n,e,r,i,o,a){return r*=n.pixelRatio,i*=n.pixelRatio,Oy(e,(e=>{const u=e.bounds;if((!u||u.contains(o,a))&&u)return t(n,e,r,i,o,a)?e:void 0}))}}function Py(t,n){return function(e,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,c=null==n?s.fill:n,f=s.stroke&&e.isPointInStroke;return f&&(u=s.strokeCap,e.lineWidth=null!=(a=s.strokeWidth)?a:1,e.lineCap=null!=u?u:"butt"),!t(e,r)&&(c&&e.isPointInPath(i,o)||f&&e.isPointInStroke(i,o))}}function jy(t){return Ty(Py(t))}function Ry(t,n){return"translate("+t+","+n+")"}function Ly(t){return"rotate("+t+")"}function Iy(t){return Ry(t.x||0,t.y||0)}function qy(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,o=e.angle||0;t.translate(r,i),o&&t.rotate(o*=Zg),t.beginPath(),n(t,e),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",function(t){return Ry(t.x||0,t.y||0)+(t.angle?" "+Ly(t.angle):"")}(e)),t("d",n(null,e))},bound:function(t,e){return n(fy(t,e.angle),e),Gv(t,e).translate(e.x||0,e.y||0)},draw:_y(r),pick:jy(r),isect:e||vy(r)}}var Uy=qy("arc",(function(t,n){return Fv.context(t)(n)}));function Wy(t,n,e){function r(t,e){t.beginPath(),n(t,e)}const i=Py(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(fy(t),r),Gv(t,r[0]))},draw:zy(r),pick:function(t,n,e,r,o,a){var u=n.items,s=n.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:i(t,u,e*=t.pixelRatio,r*=t.pixelRatio)?u[0]:null},isect:yy,tip:e}}var Hy=Wy("area",(function(t,n){const e=n[0];return("horizontal"===e.orient?Nv:Ev).curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<u&&(u=r,e=t[a]);return e}));function Gy(t,n){t.beginPath(),Bv(n)?Tv(t,n,0,0):t.rect(0,0,n.width||0,n.height||0),t.clip()}function Yy(t){const n=ky(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&n>.5&&n<1.5?.5-Math.abs(n-1):0}function Vy(t,n){const e=Yy(n);t("d",Tv(null,n,e,e))}function Xy(t,n,e,r){const i=Yy(n);t.beginPath(),Tv(t,n,(e||0)+i,(r||0)+i)}const Jy=Py(Xy),Ky=Py(Xy,!1),Qy=Py(Xy,!0);var Zy={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",Iy(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let n=0;n<r;++n)t.union(e[n].bounds)}return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),Gv(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e,r){Cy(n,(n=>{const i=n.x||0,o=n.y||0,a=n.strokeForeground,u=null==n.opacity?1:n.opacity;(n.stroke||n.fill)&&u&&(Xy(t,n,i,o),$y(t,n),n.fill&&Dy(t,n,u)&&t.fill(),n.stroke&&!a&&Fy(t,n,u)&&t.stroke()),t.save(),t.translate(i,o),n.clip&&Gy(t,n),e&&e.translate(-i,-o),Cy(n,(n=>{("group"===n.marktype||null==r||r.includes(n.marktype))&&this.draw(t,n,e,r)})),e&&e.translate(i,o),t.restore(),a&&n.stroke&&u&&(Xy(t,n,i,o),$y(t,n),Fy(t,n,u)&&t.stroke())}))},pick:function(t,n,e,r,i,o){if(n.bounds&&!n.bounds.contains(i,o)||!n.items)return null;const a=e*t.pixelRatio,u=r*t.pixelRatio;return Oy(n,(s=>{let c,f,l;const h=s.bounds;if(h&&!h.contains(i,o))return;f=s.x||0,l=s.y||0;const d=s.clip;if(d&&(i<f||i>f+(s.width||0)||o<l||o>l+(s.height||0)))return;if(t.save(),t.translate(f,l),f=i-f,l=o-l,d&&Bv(s)&&!Qy(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,p=!1!==n.interactive;return p&&m&&s.stroke&&Ky(t,s,a,u)?(t.restore(),s):(c=Oy(s,(t=>function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,f,l)?this.pick(t,e,r,f,l):null)),!c&&p&&(s.fill||!m&&s.stroke)&&Jy(t,s,a,u)&&(c=s),t.restore(),c||null)}))},isect:by,content:function(t,n,e){t("clip-path",n.clip?Rv(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),Vy(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?Vy(t,n):t("d","")}},tb={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function nb(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then((n=>{t.image=n,t.image.url=t.url}))),e}function eb(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function rb(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function ib(t,n){return"center"===t?n/2:"right"===t?n:0}function ob(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var ab={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=nb(n,e),i=eb(n,r),o=rb(n,r),a=(n.x||0)-ib(n.align,i),u=(n.y||0)-ob(n.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",tb["xmlns:xlink"],"xlink:href"),t("transform",Ry(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===n.aspect?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=eb(n,e),i=rb(n,e),o=(n.x||0)-ib(n.align,r),a=(n.y||0)-ob(n.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,n,e){Cy(n,(n=>{if(e&&!e.intersects(n.bounds))return;const r=nb(n,this);let i=eb(n,r),o=rb(n,r);if(0===i||0===o)return;let a,u,s,c,f=(n.x||0)-ib(n.align,i),l=(n.y||0)-ob(n.baseline,o);!1!==n.aspect&&(u=r.width/r.height,s=n.width/n.height,u==u&&s==s&&u!==s&&(s<u?(c=i/u,l+=(o-c)/2,o=c):(c=o*u,f+=(i-c)/2,i=c))),(r.complete||r.toDataURL)&&($y(t,n),t.globalAlpha=null!=(a=n.opacity)?a:1,t.imageSmoothingEnabled=!1!==n.smooth,t.drawImage(r,f,l,i,o))}))},pick:Ty(),isect:$,get:nb,xOffset:ib,yOffset:ob},ub=Wy("line",(function(t,n){const e=n[0];return Cv.curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(e=t[o].x-n[0])*e+(r=t[o].y-n[1])*r<i)return t[o];return null}));function sb(t,n){var e=n.path;if(null==e)return!0;var r=n.x||0,i=n.y||0,o=n.scaleX||1,a=n.scaleY||1,u=(n.angle||0)*Zg,s=n.pathCache;s&&s.path===e||((n.pathCache=s=Qg(e)).path=e),u&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(u),cv(t,s,0,0,o,a),t.rotate(-u),t.translate(-r,-i)):cv(t,s,r,i,o,a)}var cb={type:"path",tag:"path",nested:!1,attr:function(t,n){1===(n.scaleX||1)&&1===(n.scaleY||1)||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return Ry(t.x||0,t.y||0)+(t.angle?" "+Ly(t.angle):"")+(t.scaleX||t.scaleY?" "+("scale("+(t.scaleX||1)+","+(t.scaleY||1)+")"):"")}(n)),t("d",n.path)},bound:function(t,n){return sb(fy(t,n.angle),n)?t.set(0,0,0,0):Gv(t,n,!0)},draw:_y(sb),pick:jy(sb),isect:vy(sb)};function fb(t,n){t.beginPath(),Tv(t,n)}var lb={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Tv(null,n))},bound:function(t,n){var e,r;return Gv(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:_y(fb),pick:jy(fb),isect:by};function hb(t,n,e){var r,i,o,a;return!(!n.stroke||!Fy(t,n,e)||(r=n.x||0,i=n.y||0,o=null!=n.x2?n.x2:r,a=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),0))}var db={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",Iy(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return Gv(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){Cy(n,(n=>{if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&hb(t,n,r)&&($y(t,n),t.stroke())}}))},pick:Ty((function(t,n,e,r){return!!t.isPointInStroke&&hb(t,n,1)&&t.isPointInStroke(e,r)})),isect:wy},mb=qy("shape",(function(t,n){return(n.mark.shape||n.shape).context(t)(n)})),pb=qy("symbol",(function(t,n){return _v.context(t)(n)}),yy);const gb=Mt();var vb={height:kb,measureWidth:xb,estimateWidth:bb,width:bb,canvas:yb};function yb(t){vb.width=t&&py?xb:bb}function bb(t,n){return wb(Sb(t,n),kb(t))}function wb(t,n){return~~(.8*t.length*n)}function xb(t,n){return kb(t)<=0||!(n=Sb(t,n))?0:$b(n,Eb(t))}function $b(t,n){const e=`(${n}) ${t}`;let r=gb.get(e);return void 0===r&&(py.font=n,r=py.measureText(t).width,gb.set(e,r)),r}function kb(t){return null!=t.fontSize?+t.fontSize||0:11}function Mb(t){return null!=t.lineHeight?t.lineHeight:kb(t)+2}function Ab(t){return n=t.lineBreak&&t.text&&!D(t.text)?t.text.split(t.lineBreak):t.text,D(n)?n.length>1?n:n[0]:n;var n}function Db(t){const n=Ab(t);return(D(n)?n.length-1:0)*Mb(t)}function Sb(t,n){const e=null==n?"":(n+"").trim();return t.limit>0&&e.length?function(t,n){var e=+t.limit,r=function(t){if(vb.width===xb){const n=Eb(t);return t=>$b(t,n)}if(vb.width===bb){const n=kb(t);return t=>wb(t,n)}return n=>vb.width(t,n)}(t);if(r(n)<e)return n;var i,o=t.ellipsis||"…",a="rtl"===t.dir,u=0,s=n.length;if(e-=r(o),a){for(;u<s;)r(n.slice(i=u+s>>>1))>e?u=i+1:s=i;return o+n.slice(u)}for(;u<s;)r(n.slice(0,i=1+(u+s>>>1)))<e?u=i:s=i-1;return n.slice(0,u)+o}(t,e):e}function Fb(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function Eb(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+kb(t)+"px "+Fb(t,n)}function Nb(t){var n=t.baseline,e=kb(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:"line-top"===n?.29*e+.5*Mb(t):"line-bottom"===n?.29*e-.5*Mb(t):0)}yb(!0);const Cb={left:"start",center:"middle",right:"end"},Ob=new Lv;function _b(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-tv,e+=i*Math.cos(n),r+=i*Math.sin(n)),Ob.x1=e,Ob.y1=r,Ob}function zb(t,n,e){var r,i=vb.height(n),o=n.align,a=_b(n),u=a.x1,s=a.y1,c=n.dx||0,f=(n.dy||0)+Nb(n)-Math.round(.8*i),l=Ab(n);if(D(l)?(i+=Mb(n)*(l.length-1),r=l.reduce(((t,e)=>Math.max(t,vb.width(n,e))),0)):r=vb.width(n,l),"center"===o?c-=r/2:"right"===o&&(c-=r),t.set(c+=u,f+=s,c+r,f+i),n.angle&&!e)t.rotate(n.angle*Zg,u,s);else if(2===e)return t.rotatedPoints(n.angle*Zg,u,s);return t}var Bb={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+Nb(n),o=_b(n),a=o.x1,u=o.y1,s=n.angle||0;t("text-anchor",Cb[n.align]||"start"),s?(e=Ry(a,u)+" "+Ly(s),(r||i)&&(e+=" "+Ry(r,i))):e=Ry(a+r,u+i),t("transform",e)},bound:zb,draw:function(t,n,e){Cy(n,(n=>{var r,i,o,a,u,s,c,f=null==n.opacity?1:n.opacity;if(!(e&&!e.intersects(n.bounds)||0===f||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Eb(n),t.textAlign=n.align||"left",i=(r=_b(n)).x1,o=r.y1,n.angle&&(t.save(),t.translate(i,o),t.rotate(n.angle*Zg),i=o=0),i+=n.dx||0,o+=(n.dy||0)+Nb(n),s=Ab(n),$y(t,n),D(s))for(u=Mb(n),a=0;a<s.length;++a)c=Sb(n,s[a]),n.fill&&Dy(t,n,f)&&t.fillText(c,i,o),n.stroke&&Fy(t,n,f)&&t.strokeText(c,i,o),o+=u;else c=Sb(n,s),n.fill&&Dy(t,n,f)&&t.fillText(c,i,o),n.stroke&&Fy(t,n,f)&&t.strokeText(c,i,o);n.angle&&t.restore()}}))},pick:Ty((function(t,n,e,r,i,o){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var a=_b(n),u=a.x1,s=a.y1,c=zb(Ob,n,1),f=-n.angle*Zg,l=Math.cos(f),h=Math.sin(f);return c.contains(l*i-h*o+(u-l*u+h*s),h*i+l*o+(s-h*u-l*s))})),isect:function(t,n){const e=zb(Ob,t,2);return xy(n,e[0],e[1],e[2],e[3])||xy(n,e[0],e[1],e[4],e[5])||xy(n,e[4],e[5],e[6],e[7])||xy(n,e[2],e[3],e[6],e[7])}},Tb=Wy("trail",(function(t,n){return zv.context(t)(n)}),(function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null})),Pb={arc:Uy,area:Hy,group:Zy,image:ab,line:ub,path:cb,rect:lb,rule:db,shape:mb,symbol:pb,text:Bb,trail:Tb};function jb(t,n,e){var r=Pb[t.mark.marktype];return r.nested&&(t=t.mark),(n||r.bound)(t.bounds||(t.bounds=new Lv),t,e)}var Rb={mark:null};function Lb(t,n,e){var r,i,o,a,u=Pb[t.marktype],s=u.bound,c=t.items,f=c&&c.length;if(u.nested)return f?o=c[0]:(Rb.mark=t,o=Rb),a=jb(o,s,e),n&&n.union(a)||a;if(n=n||t.bounds&&t.bounds.clear()||new Lv,f)for(r=0,i=c.length;r<i;++r)n.union(jb(c[r],s,e));return t.bounds=n}const Ib=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function qb(t,n){return JSON.stringify(t,Ib,n)}function Ub(t){return Wb("string"==typeof t?JSON.parse(t):t)}function Wb(t){var n,e,r,i=t.marktype,o=t.items;if(o)for(e=0,r=o.length;e<r;++e)o[e][n=i?"mark":"group"]=t,o[e].zindex&&(o[e][n].zdirty=!0),"group"===(i||n)&&Wb(o[e]);return i&&Lb(t),t}class Hb{constructor(t){arguments.length?this.root=Ub(t):(this.root=Gb({marktype:"group",name:"root",role:"frame"}),this.root.items=[new qv(this.root)])}toJSON(t){return qb(this.root,t||0)}mark(t,n,e){const r=Gb(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r}}function Gb(t,n){const e={bounds:new Lv,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(e.aria=t.aria),t.description&&(e.description=t.description),e}function Yb(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function Vb(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Xb(t,n,e,r){var i,o=t.childNodes[n];return o&&o.tagName.toLowerCase()===e.toLowerCase()||(i=o||null,o=Yb(t.ownerDocument,e,r),t.insertBefore(o,i)),o}function Jb(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function Kb(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Qb(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}let Zb=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Xo(),this._tooltip=n||tw}initialize(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,e){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1}handlers(t){const n=this._handlers,e=[];if(t)e.push(...n[this.eventName(t)]);else for(const t in n)e.push(...n[t]);return e}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,e){this._loader.sanitize(e,{context:"href"}).then((n=>{const e=new MouseEvent(t.type,t),r=Yb(null,"a");for(const t in n)r.setAttribute(t,n[t]);r.dispatchEvent(e)})).catch((()=>{}))}handleTooltip(t,n,e){n&&null!=n.tooltip&&(n=function(t,n,e,r){var i,o,a=t&&t.mark;if(a&&(i=Pb[a.marktype]).tip){for((o=Qb(n,e))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(n,t,this.canvas(),this._origin),this._tooltip.call(this._obj,this,t,n,e&&n&&n.tooltip||null))}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+e.left,s=i.y1+r[1]+e.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}};function tw(t,n,e,r){t.element().setAttribute("title",r||"")}class nw{constructor(t){this._el=null,this._bgcolor=null,this._loader=new Uv(t)}initialize(t,n,e,r,i){return this._el=t,this.resize(n,e,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const e=this;return e._call=function(){e._render(t,n)},e._call(),e._call=null,e}_render(){}renderAsync(t,n){const e=this.render(t,n);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)}_load(t,n){var e=this,r=e._loader[t](n);if(!e._ready){const t=e._call;e._ready=e._loader.ready().then((n=>{n&&t(),e._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const ew="dragenter",rw="dragleave",iw="dragover",ow="pointerdown",aw="pointermove",uw="pointerout",sw="pointerover",cw="mousedown",fw="mousemove",lw="mouseout",hw="mouseover",dw="click",mw="mousewheel",pw="touchstart",gw="touchmove",vw="touchend",yw=["keydown","keypress","keyup",ew,rw,iw,ow,"pointerup",aw,uw,sw,cw,"mouseup",fw,lw,hw,dw,"dblclick","wheel",mw,pw,gw,vw],bw=aw,ww=lw,xw=dw;class $w extends Zb{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=yw,this.pointermove=Dw([aw,fw],[sw,hw],[uw,lw]),this.dragover=Dw([iw],[ew],[rw]),this.pointerout=Sw([uw,lw]),this.dragleave=Sw([rw])}initialize(t,n,e){return this._canvas=t&&Vb(t,"canvas"),[dw,cw,ow,aw,uw,rw].forEach((t=>Mw(this,t))),super.initialize(t,n,e)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(mw,t)}pointerdown(t){this._down=this._active,this.fire(ow,t)}mousedown(t){this._down=this._active,this.fire(cw,t)}click(t){this._down===this._active&&(this.fire(dw,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(pw,t,!0)}touchmove(t){this.fire(gw,t,!0)}touchend(t){this.fire(vw,t,!0),this._touch=null}fire(t,n,e){const r=e?this._touch:this._active,i=this._handlers[t];if(n.vegaType=t,t===xw&&r&&r.href?this.handleHref(n,r,r.href):t!==bw&&t!==ww||this.handleTooltip(n,r,t!==ww),i)for(let t=0,e=i.length;t<e;++t)i[t].handler.call(this._obj,n,r)}on(t,n){const e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(Mw(this,t),(r[e]||(r[e]=[])).push({type:t,handler:n})),this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this}pickEvent(t){const n=Qb(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])}pick(t,n,e,r,i){const o=this.context();return Pb[t.marktype].pick.call(this,o,t,n,e,r,i)}}const kw=t=>t===pw||t===gw||t===vw?[pw,gw,vw]:[t];function Mw(t,n){kw(n).forEach((n=>function(t,n){const e=t.canvas();e&&!t._events[n]&&(t._events[n]=1,e.addEventListener(n,t[n]?e=>t[n](e):e=>t.fire(n,e)))}(t,n)))}function Aw(t,n,e){n.forEach((n=>t.fire(n,e)))}function Dw(t,n,e){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Aw(this,e,r),this._active=o,Aw(this,n,r)),Aw(this,t,r)}}function Sw(t){return function(n){Aw(this,t,n),this._active=null}}class Fw extends nw{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Lv,this._tempb=new Lv}initialize(t,n,e,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:pf(1,1),t&&this._canvas&&(Jb(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,e,r,i)}resize(t,n,e,r){if(super.resize(t,n,e,r),this._canvas)!function(t,n,e,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=n*s,t.height=e*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=n+"px",t.style.height=e+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||p("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let e=t.mark.group;for(;e;)n.translate(e.x||0,e.y||0),e=e.mark.group;this._dirty.union(n)}_render(t,n){const e=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,u=Ew(r,i,o);e.save();const s=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(t,n,e){return n.expand(1).round(),t.pixelRatio%1&&n.scale(t.pixelRatio).round().scale(1/t.pixelRatio),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(e,u.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(e,t,s,n),e.restore(),a.clear(),this}draw(t,n,e,r){if("group"!==n.marktype&&null!=r&&!r.includes(n.marktype))return;const i=Pb[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),Z(e)?(t.beginPath(),e(t),t.clip()):Gy(t,n.group)}(t,n),i.draw.call(this,t,n,e,r),n.clip&&t.restore()}clear(t,n,e,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,n,e,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,e,r))}}const Ew=(t,n,e)=>(new Lv).set(0,0,n,e).translate(-t[0],-t[1]);class Nw extends Zb{constructor(t,n){super(t,n);const e=this;e._hrefHandler=Cw(e,((t,n)=>{n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=Cw(e,((t,n)=>{e.handleTooltip(t,n,t.type!==ww)}))}initialize(t,n,e){let r=this._svg;return r&&(r.removeEventListener(xw,this._hrefHandler),r.removeEventListener(bw,this._tooltipHandler),r.removeEventListener(ww,this._tooltipHandler)),this._svg=r=t&&Vb(t,"svg"),r&&(r.addEventListener(xw,this._hrefHandler),r.addEventListener(bw,this._tooltipHandler),r.addEventListener(ww,this._tooltipHandler)),super.initialize(t,n,e)}canvas(){return this._svg}on(t,n){const e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){const i={type:t,handler:n,listener:Cw(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this}}const Cw=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},Ow="aria-hidden",_w="aria-label",zw="role",Bw="aria-roledescription",Tw="graphics-object",Pw="graphics-symbol",jw=(t,n,e)=>({[zw]:t,[Bw]:n,[_w]:e||void 0}),Rw=zt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Lw={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?Hw(t):null,i=t.context,o=i.scales[n.scale].value,a=i.dataflow.locale(),u=o.type;return`${"left"===e||"right"===e?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${og(u)?"discrete":u} scale`+` with ${jg(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?Hw(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return((c=r).length?c[0].toUpperCase()+c.slice(1):c)+(e?` titled '${e}'`:"")+` for ${function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+O(t)}(o)}`+` with ${jg(s,u,t)}`;var c}},"title-text":{desc:"title",caption:t=>`Title text '${Ww(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Ww(t)}'`}},Iw={ariaRole:zw,ariaRoleDescription:Bw,description:_w};function qw(t,n){const e=!1===n.aria;if(t(Ow,e||void 0),e||null==n.description)for(const n in Iw)t(Iw[n],void 0);else{const e=n.mark.marktype;t(_w,n.description),t(zw,n.ariaRole||("group"===e?Tw:Pw)),t(Bw,n.ariaRoleDescription||`${e} mark`)}}function Uw(t){return!1===t.aria?{[Ow]:!0}:Rw[t.role]?null:Lw[t.role]?function(t,n){try{const e=t.items[0];return jw(n.role||Pw,n.desc,e.description||(n.caption||(()=>""))(e))}catch(t){return null}}(t,Lw[t.role]):function(t){const n=t.marktype,e="group"===n||"text"===n||t.items.some((t=>null!=t.description&&!1!==t.aria));return jw(e?Tw:Pw,`${n} mark container`,t.description)}(t)}function Ww(t){return K(t.text).join(" ")}function Hw(t){try{return K(O(t.items).items[0].text).join(" ")}catch(t){return null}}const Gw=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Yw(){let t="",n="",e="";const r=[],i=()=>n=e="",o=(t,e)=>{var r;return null!=e&&(n+=` ${t}="${r=e,Gw(r).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(u){(o=>{n&&(t+=`${n}>${e}`,i()),r.push(o)})(u),n="<"+u;for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];for(const t of c)for(const n in t)o(n,t[n]);return a},close(){const o=r.pop();return t+=n?n+(e?`>${e}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(e+=Gw(t),a),toString:()=>t};return a}const Vw=t=>Xw(Yw(),t)+"";function Xw(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let n=0;n<r;++n)t.attr(e[n].name,e[n].value)}if(n.hasChildNodes()){const e=n.childNodes;for(const n of e)3===n.nodeType?t.text(n.nodeValue):Xw(t,n)}return t.close()}const Jw={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Kw={blend:"mix-blend-mode"},Qw={fill:"none","stroke-miterlimit":10},Zw="http://www.w3.org/2000/xmlns/",tx=tb.xmlns;class nx extends nw{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,e,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=Xb(t,0,"svg",tx),this._svg.setAttributeNS(Zw,"xmlns",tx),this._svg.setAttributeNS(Zw,"xmlns:xlink",tb["xmlns:xlink"]),this._svg.setAttribute("version",tb.version),this._svg.setAttribute("class","marks"),Jb(t,1),this._root=Xb(this._svg,0,"g",tx),lx(this._root,Qw),Jb(this._svg,1)),this.background(this._bgcolor),super.initialize(t,n,e,r,i)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svg&&(lx(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const t=this._svg,n=this._bgcolor;if(!t)return null;let e;n&&(t.removeAttribute("style"),e=Xb(t,0,"rect",tx),lx(e,{width:this._width,height:this._height,fill:n}));const r=Vw(t);return n&&(t.removeChild(e),this._svg.style.setProperty("background-color",n)),r}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),Jb(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))}isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const n=++this._dirtyID;let e,r,i,o,a,u,s;for(a=0,u=t.length;a<u;++a)e=t[a],r=e.mark,r.marktype!==i&&(i=r.marktype,o=Pb[i]),r.zdirty&&r.dirty!==n&&(this._dirtyAll=!1,ex(e,n),r.items.forEach((t=>{t.dirty=n}))),r.zdirty||(e.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):e._svg&&(s=e._svg.parentNode,s&&s.removeChild(e._svg)),e._svg=null):(e=o.nested?r.items[0]:e,e._update!==n&&(e._svg&&e._svg.ownerSVGElement?this._update(o,e._svg,e):(this._dirtyAll=!1,ex(e,n)),e._update=n)));return!this._dirtyAll}mark(t,n,e,r){if(!this.isDirty(n))return n._svg;const i=this._svg,o=n.marktype,a=Pb[o],u=!1===n.interactive?"none":null,s="g"===a.tag,c=ox(n,t,e,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return Jb(c,0),n._svg;c.setAttribute("class",Kb(n));const f=Uw(n);for(const t in f)hx(c,t,f[t]);s||hx(c,"pointer-events",u),hx(c,"clip-path",n.clip?Rv(this,n,n.group):null);let l=null,h=0;const d=t=>{const n=this.isDirty(t),e=ox(t,c,l,a.tag,i);n&&(this._update(a,e,t),s&&function(t,n,e,r){n=n.lastChild.previousSibling;let i,o=0;Cy(e,(e=>{i=t.mark(n,e,i,r),++o})),Jb(n,1+o)}(this,e,t,r)),l=e,++h};return a.nested?n.items.length&&d(n.items[0]):Cy(n,d),Jb(c,h),c}_update(t,n,e){ax=n,ux=n.__values__,qw(cx,e),t.attr(cx,e,this);const r=sx[t.type];r&&r.call(this,t,n,e),ax&&this.style(ax,e)}style(t,n){if(null!=n){for(const e in Jw){let r="font"===e?Fb(n):n[e];if(r===ux[e])continue;const i=Jw[e];null==r?t.removeAttribute(i):(Ig(r)&&(r=qg(r,this._defs.gradient,dx())),t.setAttribute(i,r+"")),ux[e]=r}for(const e in Kw)fx(t,Kw[e],n[e])}}defs(){const t=this._svg,n=this._defs;let e=n.el,r=0;for(const i in n.gradient)e||(n.el=e=Xb(t,1,"defs",tx)),r=rx(e,n.gradient[i],r);for(const i in n.clipping)e||(n.el=e=Xb(t,1,"defs",tx)),r=ix(e,n.clipping[i],r);e&&(0===r?(t.removeChild(e),n.el=null):Jb(e,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function ex(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function rx(t,n,e){let r,i,o;if("radial"===n.gradient){let r=Xb(t,e++,"pattern",tx);lx(r,{id:Lg+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=Xb(r,0,"rect",tx),lx(r,{width:1,height:1,fill:`url(${dx()}#${n.id})`}),lx(t=Xb(t,e++,"radialGradient",tx),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else lx(t=Xb(t,e++,"linearGradient",tx),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r<i;++r)o=Xb(t,r,"stop",tx),o.setAttribute("offset",n.stops[r].offset),o.setAttribute("stop-color",n.stops[r].color);return Jb(t,r),e}function ix(t,n,e){let r;return(t=Xb(t,e,"clipPath",tx)).setAttribute("id",n.id),n.path?(r=Xb(t,0,"path",tx),r.setAttribute("d",n.path)):(r=Xb(t,0,"rect",tx),lx(r,{x:0,y:0,width:n.width,height:n.height})),Jb(t,1),e+1}function ox(t,n,e,r,i){let o,a=t._svg;if(!a&&(o=n.ownerDocument,a=Yb(o,r,tx),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const n=Yb(o,"path",tx);a.appendChild(n),n.__data__=t;const e=Yb(o,"g",tx);a.appendChild(e),e.__data__=t;const r=Yb(o,"path",tx);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,n){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=n}(a,e))&&n.insertBefore(a,e?e.nextSibling:n.firstChild),a}let ax=null,ux=null;const sx={group(t,n,e){const r=ax=n.childNodes[2];ux=r.__values__,t.foreground(cx,e,this),ux=n.__values__,ax=n.childNodes[1],t.content(cx,e,this);const i=ax=n.childNodes[0];t.background(cx,e,this);const o=!1===e.mark.interactive?"none":null;if(o!==ux.events&&(hx(r,"pointer-events",o),hx(i,"pointer-events",o),ux.events=o),e.strokeForeground&&e.stroke){const t=e.fill;hx(r,"display",null),this.style(i,e),hx(i,"stroke",null),t&&(e.fill=null),ux=r.__values__,this.style(r,e),t&&(e.fill=t),ax=null}else hx(r,"display","none")},image(t,n,e){!1===e.smooth?(fx(n,"image-rendering","optimizeSpeed"),fx(n,"image-rendering","pixelated")):fx(n,"image-rendering",null)},text(t,n,e){const r=Ab(e);let i,o,a,u;D(r)?(o=r.map((t=>Sb(e,t))),i=o.join("\n"),i!==ux.text&&(Jb(n,0),a=n.ownerDocument,u=Mb(e),o.forEach(((t,r)=>{const i=Yb(a,"tspan",tx);i.__data__=e,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),n.appendChild(i)})),ux.text=i)):(o=Sb(e,r),o!==ux.text&&(n.textContent=o,ux.text=o)),hx(n,"font-family",Fb(e)),hx(n,"font-size",kb(e)+"px"),hx(n,"font-style",e.fontStyle),hx(n,"font-variant",e.fontVariant),hx(n,"font-weight",e.fontWeight)}};function cx(t,n,e){n!==ux[t]&&(e?function(t,n,e,r){null!=e?t.setAttributeNS(r,n,e):t.removeAttributeNS(r,n)}(ax,t,n,e):hx(ax,t,n),ux[t]=n)}function fx(t,n,e){e!==ux[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),ux[n]=e)}function lx(t,n){for(const e in n)hx(t,e,n[e])}function hx(t,n,e){null!=e?t.setAttribute(n,e):t.removeAttribute(n)}function dx(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class mx extends nw{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=Yw();n.open("svg",ut({},tb,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const e=this._bgcolor;return e&&"transparent"!==e&&"none"!==e&&n.open("rect",{width:this._width,height:this._height,fill:e}).close(),n.open("g",Qw,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const e=Pb[n.marktype],r=e.tag,i=[qw,e.attr];t.open("g",{class:Kb(n),"clip-path":n.clip?Rv(this,n,n.group):null},Uw(n),{"pointer-events":"g"!==r&&!1===n.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(n,o,i,"g"!==r?r:null)),"text"===r){const n=Ab(o);if(D(n)){const e={x:0,dy:Mb(o)};for(let r=0;r<n.length;++r)t.open("tspan",r?e:null).text(Sb(o,n[r])).close()}else t.text(Sb(o,n))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(n,o,e.background,"bgrect")).close(),t.open("g",this.attr(n,o,e.content)),Cy(o,(n=>this.mark(t,n))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(n,o,e.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(n,o,e.foreground,"bgfore")).close()}t.close(),a&&t.close()};return e.nested?n.items&&n.items.length&&o(n.items[0]):Cy(n,o),t.close()}href(t){const n=t.href;let e;if(n){if(e=this._hrefs&&this._hrefs[n])return e;this.sanitizeURL(n).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[n]=t}))}return null}attr(t,n,e,r){const i={},o=(t,n,e,r)=>{i[r||t]=n};return Array.isArray(e)?e.forEach((t=>t(o,n,this))):e(o,n,this),r&&function(t,n,e,r,i){let o;if(null==n)return t;if("bgrect"===r&&!1===e.interactive&&(t["pointer-events"]="none"),"bgfore"===r&&(!1===e.interactive&&(t["pointer-events"]="none"),t.display="none",null!==n.fill))return t;"image"===r&&!1===n.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===r&&(t["font-family"]=Fb(n),t["font-size"]=kb(n)+"px",t["font-style"]=n.fontStyle,t["font-variant"]=n.fontVariant,t["font-weight"]=n.fontWeight);for(const e in Jw){let r=n[e];const o=Jw[e];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Ig(r)&&(r=qg(r,i.gradient,"")),t[o]=r)}for(const t in Kw){const e=n[t];null!=e&&(o=o||[],o.push(`${Kw[t]}: ${e};`))}o&&(t.style=o.join(" "))}(i,n,t,r,this._defs),i}defs(t){const n=this._defs.gradient,e=this._defs.clipping;if(0!==Object.keys(n).length+Object.keys(e).length){t.open("defs");for(const e in n){const r=n[e],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Lg+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+e+")"}).close(),t.close(),t.open("radialGradient",{id:e,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:e,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let n=0;n<i.length;++n)t.open("stop",{offset:i[n].offset,"stop-color":i[n].color}).close();t.close()}for(const n in e){const r=e[n];t.open("clipPath",{id:n}),r.path?t.open("path",{d:r.path}).close():t.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),t.close()}t.close()}}}const px={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class gx extends nw{constructor(t){super(t),this._svgRenderer=new nx(t),this._canvasRenderer=new Fw(t)}initialize(t,n,e,r,i){this._root_el=Xb(t,0,"div");const o=Xb(this._root_el,0,"div"),a=Xb(this._root_el,1,"div");return this._root_el.style.position="relative",px.debug||(o.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=px.svgOnTop?a:o,this._canvasEl=px.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,e,r,i),this._svgRenderer.initialize(this._svgEl,n,e,r,i),super.initialize(t,n,e,r,i)}dirty(t){return px.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const e=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((t=>!px.svgMarkTypes.includes(t)));this._svgRenderer.render(t,px.svgMarkTypes),this._canvasRenderer.render(t,e)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svgRenderer.resize(t,n,e,r),this._canvasRenderer.resize(t,n,e,r),this}background(t){return px.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class vx extends $w{constructor(t,n){super(t,n)}initialize(t,n,e){const r=Xb(Xb(t,0,"div"),px.svgOnTop?0:1,"div");return super.initialize(r,n,e)}}const yx="canvas",bx="hybrid",wx="none",xx={Canvas:yx,PNG:"png",SVG:"svg",Hybrid:bx,None:wx},$x={};function kx(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?($x[t]=n,this):$x[t]}function Mx(t,n,e){const r=[],i=(new Lv).union(n),o=t.marktype;return o?Ax(t,i,e,r):"group"===o?Dx(t,i,e,r):p("Intersect scene must be mark node or group item.")}function Ax(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u<a;++u)Dx(i[u],n,e,r);else for(const t=Pb[o].isect;u<a;++u){const e=i[u];Sx(e,n,t)&&r.push(e)}}return r}function Dx(t,n,e,r){e&&e(t.mark)&&Sx(t,n,Pb.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,u=t.y||0;n.translate(-a,-u);for(let t=0;t<o;++t)Ax(i[t],n,e,r);n.translate(a,u)}return r}function Sx(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}$x[yx]=$x.png={renderer:Fw,headless:Fw,handler:$w},$x.svg={renderer:nx,headless:mx,handler:Nw},$x[bx]={renderer:gx,headless:gx,handler:vx},$x[wx]={};const Fx=new Lv;function Ex(t){const n=t.clip;if(Z(n))n(fy(Fx.clear()));else{if(!n)return;Fx.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Fx)}function Nx(t,n,e){return t===n||("path"===e?Cx(t,n):t instanceof Date&&n instanceof Date?+t==+n:bt(t)&&bt(n)?Math.abs(t-n)<=1e-9:t&&n&&(S(t)||S(n))?function(t,n){var e,r,i=Object.keys(t),o=Object.keys(n);if(i.length!==o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!Nx(t[e=i[r]],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function Cx(t,n){return Nx(Qg(t),Qg(n))}const Ox="top",_x="left",zx="right",Bx="bottom",Tx="start",Px="middle",jx="end",Rx="group",Lx="axis",Ix="title",qx="legend",Ux="row-header",Wx="row-footer",Hx="row-title",Gx="column-header",Yx="column-footer",Vx="column-title",Xx="fit-x",Jx="fit-y",Kx="none",Qx="all",Zx="each",t$="flush",n$="column",e$="row";function r$(t){_a.call(this,null,t)}function i$(t,n,e){return n(t.bounds.clear(),t,e)}mt(r$,_a,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,o=Pb[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&e.dirty(r.items[0]),s=i$(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===Rx||t.modified())switch(n.visit(n.MOD,(t=>e.dirty(t))),s.clear(),r.items.forEach((t=>s.union(i$(t,a)))),r.role){case Lx:case qx:case Ix:n.reflow()}else u=n.changed(n.REM),n.visit(n.ADD,(t=>{s.union(i$(t,a))})),n.visit(n.MOD,(t=>{u=u||s.alignsWith(t.bounds),e.dirty(t),s.union(i$(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Ex(r),n.modifies("bounds")}});const o$=":vega_identifier:";function a$(t){_a.call(this,0,t)}function u$(t){_a.call(this,null,t)}function s$(t){_a.call(this,null,t)}a$.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},mt(a$,_a,{transform(t,n){const e=(i=n.dataflow)._signals[o$]||(i._signals[o$]=i.add(0)),r=t.as;var i;let o=e.value;return n.visit(n.ADD,(t=>t[r]=t[r]||++o)),e.set(this.value=o),n}}),mt(u$,_a,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(t){const n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===Rx?qv:Iv;return n.visit(n.ADD,(t=>r.call(t,e))),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const c$={parity:t=>t.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(t,n)=>{let e;return t.filter(((t,r)=>r&&f$(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)))}},f$=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),l$=(t,n)=>{for(var e,r=1,i=t.length,o=t[0].bounds;r<i;o=e,++r)if(f$(o,e=t[r].bounds,n))return!0},h$=t=>{const n=t.bounds;return n.width()>1&&n.height()>1},d$=t=>(t.forEach((t=>t.opacity=1)),t),m$=(t,n)=>t.reflow(n.modified()).modifies("opacity");function p$(t){_a.call(this,null,t)}mt(s$,_a,{transform(t,n){const e=c$[t.method]||c$.parity,r=t.separation||0;let i,o,a=n.materialize(n.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(d$(a),n=m$(n,t)),n;if(a=a.filter(h$),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=d$(a),n=m$(n,t),i.length>=3&&l$(i,r)){do{i=e(i,r)}while(i.length>=3&&l$(i,r));i.length<3&&!O(a).opacity&&(i.length>1&&(O(i).opacity=0),O(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,n,e)=>{var r=t.range(),i=new Lv;return n===Ox||n===Bx?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),n}}),mt(p$,_a,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,(t=>e.dirty(t))),n.fields&&n.fields.zindex){const t=n.source&&n.source[0];t&&(t.mark.zdirty=!0)}}});const g$=new Lv;function v$(t,n,e){return t[n]===e?0:(t[n]=e,1)}function y$(t){var n=t.items[0].orient;return n===_x||n===zx}function b$(t,n,e,r){var i,o,a=n.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,c=a.orient,f=function(t){let n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(u),l=a.range,h=a.offset,d=a.position,m=a.minExtent,p=a.maxExtent,g=u.title&&a.items[f[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&Db(g),w=0,x=0;switch(g$.clear().union(y),y.clear(),(i=f[0])>-1&&y.union(a.items[i].bounds),(i=f[1])>-1&&y.union(a.items[i].bounds),c){case Ox:w=d||0,x=-h,o=Math.max(m,Math.min(p,-y.y1)),y.add(0,-o).add(l,0),g&&w$(t,g,o,v,b,0,-1,y);break;case _x:w=-h,x=d||0,o=Math.max(m,Math.min(p,-y.x1)),y.add(-o,0).add(0,l),g&&w$(t,g,o,v,b,1,-1,y);break;case zx:w=e+h,x=d||0,o=Math.max(m,Math.min(p,y.x2)),y.add(0,0).add(o,l),g&&w$(t,g,o,v,b,1,1,y);break;case Bx:w=d||0,x=r+h,o=Math.max(m,Math.min(p,y.y2)),y.add(0,0).add(l,o),g&&w$(t,g,o,v,0,0,1,y);break;default:w=a.x,x=a.y}return Gv(y.translate(w,x),a),v$(a,"x",w+s)|v$(a,"y",x+s)&&(a.bounds=g$,t.dirty(a),a.bounds=y,t.dirty(a)),a.mark.bounds.clear().union(y)}function w$(t,n,e,r,i,o,a,u){const s=n.bounds;if(n.auto){const u=a*(e+i+r);let c=0,f=0;t.dirty(n),o?c=(n.x||0)-(n.x=u):f=(n.y||0)-(n.y=u),n.mark.bounds.clear().union(s.translate(-c,-f)),t.dirty(n)}u.union(s)}const x$=(t,n)=>Math.floor(Math.min(t,n)),$$=(t,n)=>Math.ceil(Math.max(t,n));function k$(t){return(new Lv).set(0,0,t.width||0,t.height||0)}function M$(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function A$(t,n,e){const r=S(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function D$(t){return t<0?Math.ceil(-t):0}function S$(t,n,e){var r,i,o,a,u,s,c,f,l,h,d,m=!e.nodirty,p=e.bounds===t$?k$:M$,g=g$.set(0,0,0,0),v=A$(e.align,n$),y=A$(e.align,e$),b=A$(e.padding,n$),w=A$(e.padding,e$),x=e.columns||n.length,$=x<=0?1:Math.ceil(n.length/x),k=n.length,M=Array(k),A=Array(x),D=0,S=Array(k),F=Array($),E=0,N=Array(k),C=Array(k),O=Array(k);for(i=0;i<x;++i)A[i]=0;for(i=0;i<$;++i)F[i]=0;for(i=0;i<k;++i)u=O[i]=p(s=n[i]),s.x=s.x||0,N[i]=0,s.y=s.y||0,C[i]=0,o=i%x,a=~~(i/x),D=Math.max(D,c=Math.ceil(u.x2)),E=Math.max(E,f=Math.ceil(u.y2)),A[o]=Math.max(A[o],c),F[a]=Math.max(F[a],f),M[i]=b+D$(u.x1),S[i]=w+D$(u.y1),m&&t.dirty(n[i]);for(i=0;i<k;++i)i%x==0&&(M[i]=0),i<x&&(S[i]=0);if(v===Zx)for(o=1;o<x;++o){for(d=0,i=o;i<k;i+=x)d<M[i]&&(d=M[i]);for(i=o;i<k;i+=x)M[i]=d+A[o-1]}else if(v===Qx){for(d=0,i=0;i<k;++i)i%x&&d<M[i]&&(d=M[i]);for(i=0;i<k;++i)i%x&&(M[i]=d+D)}else for(v=!1,o=1;o<x;++o)for(i=o;i<k;i+=x)M[i]+=A[o-1];if(y===Zx)for(a=1;a<$;++a){for(d=0,r=(i=a*x)+x;i<r;++i)d<S[i]&&(d=S[i]);for(i=a*x;i<r;++i)S[i]=d+F[a-1]}else if(y===Qx){for(d=0,i=x;i<k;++i)d<S[i]&&(d=S[i]);for(i=x;i<k;++i)S[i]=d+E}else for(y=!1,a=1;a<$;++a)for(r=(i=a*x)+x;i<r;++i)S[i]+=F[a-1];for(l=0,i=0;i<k;++i)N[i]+=(l=M[i]+(i%x?l:0))-n[i].x;for(o=0;o<x;++o)for(h=0,i=o;i<k;i+=x)C[i]+=(h+=S[i])-n[i].y;if(v&&A$(e.center,n$)&&$>1)for(i=0;i<k;++i)(l=(u=v===Qx?D:A[i%x])-O[i].x2-n[i].x-N[i])>0&&(N[i]+=l/2);if(y&&A$(e.center,e$)&&1!==x)for(i=0;i<k;++i)(h=(u=y===Qx?E:F[~~(i/x)])-O[i].y2-n[i].y-C[i])>0&&(C[i]+=h/2);for(i=0;i<k;++i)g.union(O[i].translate(N[i],C[i]));switch(l=A$(e.anchor,"x"),h=A$(e.anchor,"y"),A$(e.anchor,n$)){case jx:l-=g.width();break;case Px:l-=g.width()/2}switch(A$(e.anchor,e$)){case jx:h-=g.height();break;case Px:h-=g.height()/2}for(l=Math.round(l),h=Math.round(h),g.clear(),i=0;i<k;++i)n[i].mark.bounds.clear();for(i=0;i<k;++i)(s=n[i]).x+=N[i]+=l,s.y+=C[i]+=h,g.union(s.mark.bounds.union(s.bounds.translate(N[i],C[i]))),m&&t.dirty(s);return g}function F$(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function E$(t,n){return t.bounds[n]}function N$(t,n,e,r,i,o,a,u,s,c,f,l,h,d){var m,p,g,v,y,b,w,x,$,k=e.length,M=0,A=0;if(!k)return M;for(m=f;m<k;m+=l)e[m]&&(M=a(M,s(e[m],c)));if(!n.length)return M;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),M+=o,p=0,v=n.length;p<v;++p)t.dirty(n[p]),n[p].mark.bounds.clear();for(m=f,p=0,v=n.length;p<v;++p,m+=l){for(y=(b=n[p]).mark.bounds,g=m;g>=0&&null==(w=e[g]);g-=h);u?(x=null==d?w.x:Math.round(w.bounds.x1+d*w.bounds.width()),$=M):(x=M,$=null==d?w.y:Math.round(w.bounds.y1+d*w.bounds.height())),y.union(b.bounds.translate(x-(b.x||0),$-(b.y||0))),b.x=x,b.y=$,t.dirty(b),A=a(A,y[c])}return A}function C$(t,n,e,r,i,o){if(n){t.dirty(n);var a=e,u=e;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),n.bounds.translate(a-(n.x||0),u-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=a,n.y=u,t.dirty(n)}}function O$(t,n,e,r,i,o,a){const u=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),s=function(t,n){let e=-1/0;return t.forEach((t=>{null!=t.offset&&(e=Math.max(e,t.offset))})),e>-1/0?e:n}(t,u("offset",0)),c=u("anchor",Tx),f=c===jx?1:c===Px?.5:0,l={align:Zx,bounds:u("bounds",t$),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(n){case _x:l.anchor={x:Math.floor(r.x1)-s,column:jx,y:f*(a||r.height()+2*r.y1),row:c};break;case zx:l.anchor={x:Math.ceil(r.x2)+s,y:f*(a||r.height()+2*r.y1),row:c};break;case Ox:l.anchor={y:Math.floor(i.y1)-s,row:jx,x:f*(o||i.width()+2*i.x1),column:c};break;case Bx:l.anchor={y:Math.ceil(i.y2)+s,x:f*(o||i.width()+2*i.x1),column:c};break;case"top-left":l.anchor={x:s,y:s};break;case"top-right":l.anchor={x:o-s,y:s,column:jx};break;case"bottom-left":l.anchor={x:s,y:a-s,row:jx};break;case"bottom-right":l.anchor={x:o-s,y:a-s,column:jx,row:jx}}return l}function _$(t,n){var e,r,i=n.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,c=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,n,e){var r=n.padding,i=r-e.x,o=r-e.y;if(n.datum.title){var a=n.items[1].items[0],u=a.anchor,s=n.titlePadding||0,c=r-a.x,f=r-a.y;switch(a.orient){case _x:i+=Math.ceil(a.bounds.width())+s;break;case zx:case Bx:break;default:o+=a.bounds.height()+s}switch((i||o)&&B$(t,e,i,o),a.orient){case _x:f+=z$(n,e,a,u,1,1);break;case zx:c+=z$(n,e,a,jx,0,0)+s,f+=z$(n,e,a,u,1,1);break;case Bx:c+=z$(n,e,a,u,0,0),f+=z$(n,e,a,jx,-1,0,1)+s;break;default:c+=z$(n,e,a,u,0,0)}(c||f)&&B$(t,a,c,f),(c=Math.round(a.bounds.x1-r))<0&&(B$(t,e,-c,0),B$(t,a,-c,0))}else(i||o)&&B$(t,e,i,o)}(t,i,i.items[0].items[0]),u=function(t,n){return t.items.forEach((t=>n.union(t.bounds))),n.x1=t.padding,n.y1=t.padding,n}(i,u),e=2*i.padding,r=2*i.padding,u.empty()||(e=Math.ceil(u.width()+e),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const n=t.reduce(((t,n)=>(t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t)),{});t.forEach((t=>{t.width=n[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==Kx&&(i.x=s=0,i.y=c=0),i.width=e,i.height=r,Gv(u.set(s,c,s+e,c+r),i),i.mark.bounds.clear().union(u),i}function z$(t,n,e,r,i,o,a){const u=e.datum.vgrad,s=("symbol"===t.datum.type||!o&&u||a?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?s:0,f=u&&o?0:s,l=i<=0?0:Db(e);return Math.round(r===Tx?c:r===jx?f-l:.5*(s-l))}function B$(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function T$(t){_a.call(this,null,t)}mt(T$,_a,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach((n=>{t.layout&&function(t,n,e){var r,i,o,a,u,s,c,f=function(t){var n,e,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(e=(n=r[o]).items,n.marktype===Rx)switch(n.role){case Lx:case qx:case Ix:break;case Ux:a.rowheaders.push(...e);break;case Wx:a.rowfooters.push(...e);break;case Gx:a.colheaders.push(...e);break;case Yx:a.colfooters.push(...e);break;case Hx:a.rowtitle=e[0];break;case Vx:a.coltitle=e[0];break;default:a.marks.push(...e)}return a}(n),l=f.marks,h=e.bounds===t$?F$:E$,d=e.offset,m=e.columns||l.length,p=m<=0?1:Math.ceil(l.length/m),g=p*m;const v=S$(t,l,e);v.empty()&&v.set(0,0,0,0),f.rowheaders&&(s=A$(e.headerBand,e$,null),r=N$(t,f.rowheaders,l,0,p,-A$(d,"rowHeader"),x$,0,h,"x1",0,m,1,s)),f.colheaders&&(s=A$(e.headerBand,n$,null),i=N$(t,f.colheaders,l,0,m,-A$(d,"columnHeader"),x$,1,h,"y1",0,1,m,s)),f.rowfooters&&(s=A$(e.footerBand,e$,null),o=N$(t,f.rowfooters,l,0,p,A$(d,"rowFooter"),$$,0,h,"x2",m-1,m,1,s)),f.colfooters&&(s=A$(e.footerBand,n$,null),a=N$(t,f.colfooters,l,0,m,A$(d,"columnFooter"),$$,1,h,"y2",g-m,1,m,s)),f.rowtitle&&(u=A$(e.titleAnchor,e$),c=A$(d,"rowTitle"),c=u===jx?o+c:r-c,s=A$(e.titleBand,e$,.5),C$(t,f.rowtitle,c,0,v,s)),f.coltitle&&(u=A$(e.titleAnchor,n$),c=A$(d,"columnTitle"),c=u===jx?a+c:i-c,s=A$(e.titleBand,n$,.5),C$(t,f.coltitle,c,1,v,s))}(e,n,t.layout),function(t,n,e){var r,i,o,a,u,s=n.items,c=Math.max(0,n.width||0),f=Math.max(0,n.height||0),l=(new Lv).set(0,0,c,f),h=l.clone(),d=l.clone(),m=[];for(a=0,u=s.length;a<u;++a)switch((i=s[a]).role){case Lx:(y$(i)?h:d).union(b$(t,i,c,f));break;case Ix:r=i;break;case qx:m.push(_$(t,i));break;case"frame":case"scope":case Ux:case Wx:case Hx:case Gx:case Yx:case Vx:h.union(i.bounds),d.union(i.bounds);break;default:l.union(i.bounds)}if(m.length){const n={};m.forEach((t=>{(o=t.orient||zx)!==Kx&&(n[o]||(n[o]=[])).push(t)}));for(const r in n){const i=n[r];S$(t,i,O$(i,r,e.legends,h,d,c,f))}m.forEach((n=>{const r=n.bounds;if(r.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=r,t.dirty(n)),!e.autosize||"fit"!==e.autosize.type&&e.autosize.type!==Xx&&e.autosize.type!==Jx)l.union(r);else switch(n.orient){case _x:case zx:l.add(r.x1,0).add(r.x2,0);break;case Ox:case Bx:l.add(0,r.y1).add(0,r.y2)}}))}l.union(h).union(d),r&&l.union(function(t,n,e,r,i){var o,a=n.items[0],u=a.orient,s=a.anchor,c=a.offset,f=a.padding,l=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],d=u===_x||u===zx?r:e,m=0,p=0,g=0,v=0,y=0;if(a.frame!==Rx?u===_x?(m=i.y2,d=i.y1):u===zx?(m=i.y1,d=i.y2):(m=i.x1,d=i.x2):u===_x&&(m=r,d=0),o=s===Tx?m:s===jx?d:(m+d)/2,h&&h.text){switch(u){case Ox:case Bx:y=l.bounds.height()+f;break;case _x:v=l.bounds.width()+f;break;case zx:v=-l.bounds.width()-f}g$.clear().union(h.bounds),g$.translate(v-(h.x||0),y-(h.y||0)),v$(h,"x",v)|v$(h,"y",y)&&(t.dirty(h),h.bounds.clear().union(g$),h.mark.bounds.clear().union(g$),t.dirty(h)),g$.clear().union(h.bounds)}else g$.clear();switch(g$.union(l.bounds),u){case Ox:p=o,g=i.y1-g$.height()-c;break;case _x:p=i.x1-g$.width()-c,g=o;break;case zx:p=i.x2+g$.width()+c,g=o;break;case Bx:p=o,g=i.y2+c;break;default:p=a.x,g=a.y}return v$(a,"x",p)|v$(a,"y",g)&&(g$.translate(p,g),t.dirty(a),a.bounds.clear().union(g$),n.bounds.clear().union(g$),t.dirty(a)),a.bounds}(t,r,c,f,l)),n.clip&&l.set(0,0,n.width||0,n.height||0),function(t,n,e,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),f=Math.max(0,n.height||0),l=Math.max(0,Math.ceil(-e.y1));const h=Math.max(0,Math.ceil(e.x2-s)),d=Math.max(0,Math.ceil(e.y2-f));if("padding"===i.contains){const n=t.padding();a-=n.left+n.right,u-=n.top+n.bottom}o===Kx?(c=0,l=0,s=a,f=u):"fit"===o?(s=Math.max(0,a-c-h),f=Math.max(0,u-l-d)):o===Xx?(s=Math.max(0,a-c-h),u=f+l+d):o===Jx?(a=s+c+h,f=Math.max(0,u-l-d)):"pad"===o&&(a=s+c+h,u=f+l+d),t._resizeView(a,u,s,f,[c,l],i.resize)}(t,n,l,e)}(e,n,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?n.reflow():n}});var P$=Object.freeze({__proto__:null,bound:r$,identifier:a$,mark:u$,overlap:s$,render:p$,viewlayout:T$});function j$(t){_a.call(this,null,t)}function R$(t){_a.call(this,null,t)}function L$(){return ra({})}function I$(t){_a.call(this,null,t)}function q$(t){_a.call(this,[],t)}mt(j$,_a,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,o=t.scale,a=Mg(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Sg(e,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Ag(o,t.values,a):Dg(o,a);return i&&(r.rem=i),i=s.map(((t,n)=>ra({index:n/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ra({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),mt(R$,_a,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||L$,o=t.key||na,a=this.value;return D(r.encode)&&(r.encode=null),a&&(t.modified("key")||n.modified(o))&&p("DataJoin does not support modified key function or fields."),a||(n=n.addAll(),this.value=a=function(t){const n=ht().test((t=>t.exit));return n.lookup=e=>n.get(t(e)),n}(o)),n.visit(n.ADD,(t=>{const n=o(t);let e=a.get(n);e?e.exit?(a.empty--,r.add.push(e)):r.mod.push(e):(e=i(t),a.set(n,e),r.add.push(e)),e.datum=t,e.exit=!1})),n.visit(n.MOD,(t=>{const n=o(t),e=a.get(n);e&&(e.datum=t,r.mod.push(e))})),n.visit(n.REM,(t=>{const n=o(t),e=a.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++a.empty)})),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&a.empty>e.cleanThreshold)&&e.runAfter(a.clean),r}}),mt(I$,_a,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,o=n.encode;if(D(o)){if(!e.changed()&&!o.every((t=>i[t])))return n.StopPropagation;o=o[0],e.encode=null}var a="enter"===o,u=i.update||k,s=i.enter||k,c=i.exit||k,f=(o&&!a?i[o]:u)||k;if(n.changed(n.ADD)&&(n.visit(n.ADD,(n=>{s(n,t),u(n,t)})),e.modifies(s.output),e.modifies(u.output),f!==k&&f!==u&&(n.visit(n.ADD,(n=>{f(n,t)})),e.modifies(f.output))),n.changed(n.REM)&&c!==k&&(n.visit(n.REM,(n=>{c(n,t)})),e.modifies(c.output)),a||f!==k){const i=n.MOD|(t.modified()?n.REFLOW:0);a?(n.visit(i,(n=>{const i=s(n,t)||r;(f(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(s.output)):n.visit(i,(n=>{(f(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(f.output)}return e.changed()?e:n.StopPropagation}}),mt(q$,_a,{transform(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,o,a,u=n.dataflow.locale(),s=n.fork(n.NO_SOURCE|n.NO_FIELDS),c=this.value,f=t.type||wg,l=t.scale,h=+t.limit,d=Mg(l,null==t.count?5:t.count,t.minstep),m=t.format||Og(u,l,d,f,t.formatSpecifier,t.formatType,!!t.values||f===wg),p=t.values||Cg(l,d);return c&&(s.rem=c),f===wg?(h&&p.length>h?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=p.slice(0,h-1),a=!0):c=p,Z(i=t.size)?(t.values||0!==l(c[0])||(c=c.slice(1)),o=c.reduce(((n,e)=>Math.max(n,i(e,t))),0)):i=ot(o=i||8),c=c.map(((n,e)=>ra({index:e,label:m(n,e,c),value:n,offset:o,size:i(n,t)}))),a&&c.push(ra({index:c.length,label:`…${p.length-c.length} entries`,value:a=p[c.length],offset:o,size:i(a,t)}))):"gradient"===f?(e=l.domain(),r=mg(l,e[0],O(e)),p.length<3&&!t.values&&e[0]!==O(e)&&(p=[e[0],O(e)]),c=p.map(((t,n)=>ra({index:n,label:m(t,n,p),value:t,perc:r(t)})))):(i=p.length-1,r=function(t){const n=t.domain(),e=n.length-1;let r=+n[0],i=+O(n),o=i-r;if(t.type===jp){const t=e?o/e:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(l),c=p.map(((t,n)=>ra({index:n,label:m(t,n,p),value:t,perc:n?r(t):0,perc2:n===i?1:r(p[n+1])})))),s.source=c,s.add=c,this.value=c,s}});const U$=t=>t.source.x,W$=t=>t.source.y,H$=t=>t.target.x,G$=t=>t.target.y;function Y$(t){_a.call(this,{},t)}Y$.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},mt(Y$,_a,{transform(t,n){var e=t.sourceX||U$,r=t.sourceY||W$,i=t.targetX||H$,o=t.targetY||G$,a=t.as||"path",u=t.shape||"line",s=K$.get(u+"-"+(t.orient||"vertical"))||K$.get(u);return s||p("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(t=>{t[a]=s(e(t),r(t),i(t),o(t))})),n.reflow(t.modified()).modifies(a)}});const V$=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,X$=(t,n,e,r)=>{var i=e-t,o=r-n,a=Math.hypot(i,o)/2;return"M"+t+","+n+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+e+","+r},J$=(t,n,e,r)=>{const i=e-t,o=r-n,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+n+"C"+(t+a)+","+(n+u)+" "+(e+u)+","+(r-a)+" "+e+","+r},K$=ht({line:V$,"line-radial":(t,n,e,r)=>V$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:X$,"arc-radial":(t,n,e,r)=>X$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:J$,"curve-radial":(t,n,e,r)=>J$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e);return"M"+n*i+","+n*o+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*a+","+n*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function Q$(t){_a.call(this,null,t)}function Z$(t){return ig(t)&&t!==zp}Q$.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},mt(Q$,_a,{transform(t,n){var e,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=n.source,l=f.map(t.field||x),h=l.length,d=s,m=(c-s)/En(l),p=Fn(h);for(t.sort&&p.sort(((t,n)=>l[t]-l[n])),e=0;e<h;++e)i=l[p[e]],(r=f[p[e]])[a]=d,r[u]=d+=i*m;return this.value=l,n.reflow(t.modified()).modifies(o)}});const tk=zt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function nk(t){_a.call(this,null,t),this.modified(!0)}function ek(t,n,e){return ug(t)&&Math.abs(n.reduce(((t,n)=>t+(n<0?-1:n>0?1:0)),0))!==n.length&&e.warn("Log scale domain includes zero: "+Et(n)),n}function rk(t,n,e){return Z(t)&&(n||e)?lg(t,ik(n||[0,1],e)):t}function ik(t,n){return n?t.slice().reverse():t}function ok(t){_a.call(this,null,t)}mt(nk,_a,{transform(t,n){var e=n.dataflow,r=this.value,i=function(t){var n,e=t.type,r="";return e===zp?zp+"-"+Sp:(function(t){const n=t.type;return ig(n)&&n!==Op&&n!==_p&&(t.scheme||t.range&&t.range.length&&t.range.every(xt))}(t)&&(r=2===(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?zp+"-":3===n?Bp+"-":""),(r+e||Sp).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=ng(i)()),t)if(!tk[i]){if("padding"===i&&Z$(r.type))continue;Z(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(t,n,e){var r=t.type,i=n.round||!1,o=n.range;if(null!=n.rangeStep)o=function(t,n,e){return t!==Ip&&t!==Lp&&p("Only band and point scales support rangeStep."),[0,n.rangeStep*Dp(e,t===Lp?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0,(null!=n.paddingOuter?n.paddingOuter:n.padding)||0)]}(r,n,e);else if(n.scheme&&(o=function(t,n,e){var r,i=n.schemeExtent;return D(n.scheme)?r=hg(n.scheme,n.interpolate,n.interpolateGamma):(r=bg(n.scheme.toLowerCase()))||p(`Unrecognized scheme name: ${n.scheme}`),e=t===jp?e+1:t===qp?e-1:t===Tp||t===Pp?+n.schemeCount||5:e,sg(t)?rk(r,i,n.reverse):Z(r)?dg(rk(r,i),e):t===Rp?r:r.slice(0,e)}(r,n,e),Z(o))){if(t.interpolator)return t.interpolator(o);p(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&sg(r))return t.interpolator(hg(ik(o,n.reverse),n.interpolate,n.interpolateGamma));o&&n.interpolate&&t.interpolate?t.interpolate(pg(n.interpolate,n.interpolateGamma)):Z(t.round)?t.round(i):Z(t.rangeRound)&&t.interpolate(i?Ql:Kl),o&&t.range(ik(o,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!D(r)){const n=t.domain(),e=n[0],i=O(n),o=r.step;let a=null==r.start?e:r.start,u=null==r.stop?i:r.stop;o||p("Scale bins parameter missing step property."),a<e&&(a=o*Math.ceil(e/o)),u>i&&(u=o*Math.floor(i/o)),r=Fn(a,u+o/2,o)}return r?t.bins=r:t.bins&&delete t.bins,t.type===qp&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain()),e}(r,t,function(t,n,e){const r=function(t,n,e){return n?(t.domain(ek(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,o,a=n.domain,u=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Sp||n===Ep||n===Np)}(t);if(!a)return 0;if((s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=n.domainMin&&(a[0]=n.domainMin),null!=n.domainMax&&(a[i]=n.domainMax),null!=n.domainMid)){const t=(o=n.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&e.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}return Z$(u)&&n.padding&&a[0]!==O(a)&&(a=function(t,n,e,r,i,o){var a=Math.abs(O(e)-e[0]),u=a/(a-2*r),s=t===Fp?G(n,null,u):t===Np?Y(n,null,u,.5):t===Ep?Y(n,null,u,i||1):t===Cp?V(n,null,u,o||1):H(n,null,u);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(u,a,n.range,n.padding,n.exponent,n.constant)),t.domain(ek(u,a,e)),u===Rp&&t.unknown(n.domainImplicit?bf:void 0),n.nice&&t.nice&&t.nice(!0!==n.nice&&Mg(t,n.nice)||null),a.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),mt(ok,_a,{transform(t,n){const e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(ua(t.sort)),this.modified(e),n}});const ak="zero",uk="center",sk="normalize",ck=["y0","y1"];function fk(t){_a.call(this,null,t)}function lk(t,n,e,r,i){for(var o,a=(n-t.sum)/2,u=t.length,s=0;s<u;++s)(o=t[s])[r]=a,o[i]=a+=Math.abs(e(o))}function hk(t,n,e,r,i){for(var o,a=1/t.sum,u=0,s=t.length,c=0,f=0;c<s;++c)(o=t[c])[r]=u,o[i]=u=a*(f+=Math.abs(e(o)))}function dk(t,n,e,r,i){for(var o,a,u=0,s=0,c=t.length,f=0;f<c;++f)(o=+e(a=t[f]))<0?(a[r]=s,a[i]=s+=o):(a[r]=u,a[i]=u+=o)}fk.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:ak,values:[ak,uk,sk]},{name:"as",type:"string",array:!0,length:2,default:ck}]},mt(fk,_a,{transform(t,n){var e,r,i,o,a=t.as||ck,u=a[0],s=a[1],c=ua(t.sort),f=t.field||x,l=t.offset===uk?lk:t.offset===sk?hk:dk;for(e=function(t,n,e,r){var i,o,a,u,s,c,f,l,h,d=[],m=t=>t(s);if(null==n)d.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)s=t[o],(f=i[c=n.map(m)])||(i[c]=f=[],d.push(f)),f.push(s);for(c=0,h=0,u=d.length;c<u;++c){for(o=0,l=0,a=(f=d[c]).length;o<a;++o)l+=Math.abs(r(f[o]));f.sum=l,l>h&&(h=l),e&&f.sort(e)}return d.max=h,d}(n.source,t.groupby,c,f),r=0,i=e.length,o=e.max;r<i;++r)l(e[r],o,f,u,s);return n.reflow(t.modified()).modifies(a)}});var mk=Object.freeze({__proto__:null,axisticks:j$,datajoin:R$,encode:I$,legendentries:q$,linkpath:Y$,pie:Q$,scale:nk,sortitems:ok,stack:fk}),pk=1e-6,gk=1e-12,vk=Math.PI,yk=vk/2,bk=vk/4,wk=2*vk,xk=180/vk,$k=vk/180,kk=Math.abs,Mk=Math.atan,Ak=Math.atan2,Dk=Math.cos,Sk=Math.ceil,Fk=Math.exp,Ek=Math.hypot,Nk=Math.log,Ck=Math.pow,Ok=Math.sin,_k=Math.sign||function(t){return t>0?1:t<0?-1:0},zk=Math.sqrt,Bk=Math.tan;function Tk(t){return t>1?0:t<-1?vk:Math.acos(t)}function Pk(t){return t>1?yk:t<-1?-yk:Math.asin(t)}function jk(){}function Rk(t,n){t&&Ik.hasOwnProperty(t.type)&&Ik[t.type](t,n)}var Lk={Feature:function(t,n){Rk(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Rk(e[r].geometry,n)}},Ik={Sphere:function(t,n){n.sphere()},Point:function(t,n){n.point((t=t.coordinates)[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)n.point((t=e[r])[0],t[1],t[2])},LineString:function(t,n){qk(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)qk(e[r],n,0)},Polygon:function(t,n){Uk(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Uk(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Rk(e[r],n)}};function qk(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)n.point((r=t[i])[0],r[1],r[2]);n.lineEnd()}function Uk(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)qk(t[e],n,1);n.polygonEnd()}function Wk(t,n){t&&Lk.hasOwnProperty(t.type)?Lk[t.type](t,n):Rk(t,n)}var Hk,Gk,Yk,Vk,Xk,Jk,Kk,Qk,Zk,tM,nM,eM,rM,iM,oM,aM,uM=new on,sM=new on,cM={point:jk,lineStart:jk,lineEnd:jk,polygonStart:function(){uM=new on,cM.lineStart=fM,cM.lineEnd=lM},polygonEnd:function(){var t=+uM;sM.add(t<0?wk+t:t),this.lineStart=this.lineEnd=this.point=jk},sphere:function(){sM.add(wk)}};function fM(){cM.point=hM}function lM(){dM(Hk,Gk)}function hM(t,n){cM.point=dM,Hk=t,Gk=n,Yk=t*=$k,Vk=Dk(n=(n*=$k)/2+bk),Xk=Ok(n)}function dM(t,n){var e=(t*=$k)-Yk,r=e>=0?1:-1,i=r*e,o=Dk(n=(n*=$k)/2+bk),a=Ok(n),u=Xk*a,s=Vk*o+u*Dk(i),c=u*r*Ok(i);uM.add(Ak(c,s)),Yk=t,Vk=o,Xk=a}function mM(t){return[Ak(t[1],t[0]),Pk(t[2])]}function pM(t){var n=t[0],e=t[1],r=Dk(e);return[r*Dk(n),r*Ok(n),Ok(e)]}function gM(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function vM(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function yM(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function bM(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function wM(t){var n=zk(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var xM,$M,kM,MM,AM,DM,SM,FM,EM,NM,CM,OM,_M,zM,BM,TM,PM={point:jM,lineStart:LM,lineEnd:IM,polygonStart:function(){PM.point=qM,PM.lineStart=UM,PM.lineEnd=WM,iM=new on,cM.polygonStart()},polygonEnd:function(){cM.polygonEnd(),PM.point=jM,PM.lineStart=LM,PM.lineEnd=IM,uM<0?(Jk=-(Qk=180),Kk=-(Zk=90)):iM>pk?Zk=90:iM<-1e-6&&(Kk=-90),aM[0]=Jk,aM[1]=Qk},sphere:function(){Jk=-(Qk=180),Kk=-(Zk=90)}};function jM(t,n){oM.push(aM=[Jk=t,Qk=t]),n<Kk&&(Kk=n),n>Zk&&(Zk=n)}function RM(t,n){var e=pM([t*$k,n*$k]);if(rM){var r=vM(rM,e),i=vM([r[1],-r[0],0],r);wM(i),i=mM(i);var o,a=t-tM,u=a>0?1:-1,s=i[0]*xk*u,c=kk(a)>180;c^(u*tM<s&&s<u*t)?(o=i[1]*xk)>Zk&&(Zk=o):c^(u*tM<(s=(s+360)%360-180)&&s<u*t)?(o=-i[1]*xk)<Kk&&(Kk=o):(n<Kk&&(Kk=n),n>Zk&&(Zk=n)),c?t<tM?HM(Jk,t)>HM(Jk,Qk)&&(Qk=t):HM(t,Qk)>HM(Jk,Qk)&&(Jk=t):Qk>=Jk?(t<Jk&&(Jk=t),t>Qk&&(Qk=t)):t>tM?HM(Jk,t)>HM(Jk,Qk)&&(Qk=t):HM(t,Qk)>HM(Jk,Qk)&&(Jk=t)}else oM.push(aM=[Jk=t,Qk=t]);n<Kk&&(Kk=n),n>Zk&&(Zk=n),rM=e,tM=t}function LM(){PM.point=RM}function IM(){aM[0]=Jk,aM[1]=Qk,PM.point=jM,rM=null}function qM(t,n){if(rM){var e=t-tM;iM.add(kk(e)>180?e+(e>0?360:-360):e)}else nM=t,eM=n;cM.point(t,n),RM(t,n)}function UM(){cM.lineStart()}function WM(){qM(nM,eM),cM.lineEnd(),kk(iM)>pk&&(Jk=-(Qk=180)),aM[0]=Jk,aM[1]=Qk,rM=null}function HM(t,n){return(n-=t)<0?n+360:n}function GM(t,n){return t[0]-n[0]}function YM(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var VM={sphere:jk,point:XM,lineStart:KM,lineEnd:tA,polygonStart:function(){VM.lineStart=nA,VM.lineEnd=eA},polygonEnd:function(){VM.lineStart=KM,VM.lineEnd=tA}};function XM(t,n){t*=$k;var e=Dk(n*=$k);JM(e*Dk(t),e*Ok(t),Ok(n))}function JM(t,n,e){++xM,kM+=(t-kM)/xM,MM+=(n-MM)/xM,AM+=(e-AM)/xM}function KM(){VM.point=QM}function QM(t,n){t*=$k;var e=Dk(n*=$k);zM=e*Dk(t),BM=e*Ok(t),TM=Ok(n),VM.point=ZM,JM(zM,BM,TM)}function ZM(t,n){t*=$k;var e=Dk(n*=$k),r=e*Dk(t),i=e*Ok(t),o=Ok(n),a=Ak(zk((a=BM*o-TM*i)*a+(a=TM*r-zM*o)*a+(a=zM*i-BM*r)*a),zM*r+BM*i+TM*o);$M+=a,DM+=a*(zM+(zM=r)),SM+=a*(BM+(BM=i)),FM+=a*(TM+(TM=o)),JM(zM,BM,TM)}function tA(){VM.point=XM}function nA(){VM.point=rA}function eA(){iA(OM,_M),VM.point=XM}function rA(t,n){OM=t,_M=n,t*=$k,n*=$k,VM.point=iA;var e=Dk(n);zM=e*Dk(t),BM=e*Ok(t),TM=Ok(n),JM(zM,BM,TM)}function iA(t,n){t*=$k;var e=Dk(n*=$k),r=e*Dk(t),i=e*Ok(t),o=Ok(n),a=BM*o-TM*i,u=TM*r-zM*o,s=zM*i-BM*r,c=Ek(a,u,s),f=Pk(c),l=c&&-f/c;EM.add(l*a),NM.add(l*u),CM.add(l*s),$M+=f,DM+=f*(zM+(zM=r)),SM+=f*(BM+(BM=i)),FM+=f*(TM+(TM=o)),JM(zM,BM,TM)}function oA(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function aA(t,n){return kk(t)>vk&&(t-=Math.round(t/wk)*wk),[t,n]}function uA(t,n,e){return(t%=wk)?n||e?oA(cA(t),fA(n,e)):cA(t):n||e?fA(n,e):aA}function sA(t){return function(n,e){return kk(n+=t)>vk&&(n-=Math.round(n/wk)*wk),[n,e]}}function cA(t){var n=sA(t);return n.invert=sA(-t),n}function fA(t,n){var e=Dk(t),r=Ok(t),i=Dk(n),o=Ok(n);function a(t,n){var a=Dk(n),u=Dk(t)*a,s=Ok(t)*a,c=Ok(n),f=c*e+u*r;return[Ak(s*i-f*o,u*e-c*r),Pk(f*i+s*o)]}return a.invert=function(t,n){var a=Dk(n),u=Dk(t)*a,s=Ok(t)*a,c=Ok(n),f=c*i-s*o;return[Ak(s*i+c*o,u*e+f*r),Pk(f*e-u*r)]},a}function lA(t,n){(n=pM(n))[0]-=t,wM(n);var e=Tk(-n[1]);return((-n[2]<0?-e:e)+wk-pk)%wk}function hA(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:jk,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function dA(t,n){return kk(t[0]-n[0])<pk&&kk(t[1]-n[1])<pk}function mA(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function pA(t,n,e,r,i){var o,a,u=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(dA(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}u.push(e=new mA(r,t,null,!0)),s.push(e.o=new mA(r,null,e,!1)),u.push(e=new mA(a,t,null,!1)),s.push(e.o=new mA(a,null,e,!0))}})),u.length){for(s.sort(n),gA(u),gA(s),o=0,a=s.length;o<a;++o)s[o].e=e=!e;for(var c,f,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((f=c[o])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(o=(c=h.p.z).length-1;o>=0;--o)i.point((f=c[o])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function gA(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function vA(t){return kk(t[0])<=vk?t[0]:_k(t[0])*((kk(t[0])+vk)%wk-vk)}function yA(t,n,e,r){return function(i){var o,a,u,s=n(i),c=hA(),f=n(c),l=!1,h={point:d,lineStart:p,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=p,h.lineEnd=g,a=Sn(a);var t=function(t,n){var e=vA(n),r=n[1],i=Ok(r),o=[Ok(e),-Dk(e),0],a=0,u=0,s=new on;1===i?r=yk+pk:-1===i&&(r=-yk-pk);for(var c=0,f=t.length;c<f;++c)if(h=(l=t[c]).length)for(var l,h,d=l[h-1],m=vA(d),p=d[1]/2+bk,g=Ok(p),v=Dk(p),y=0;y<h;++y,m=w,g=$,v=k,d=b){var b=l[y],w=vA(b),x=b[1]/2+bk,$=Ok(x),k=Dk(x),M=w-m,A=M>=0?1:-1,D=A*M,S=D>vk,F=g*$;if(s.add(Ak(F*A*Ok(D),v*k+F*Dk(D))),a+=S?M+A*wk:M,S^m>=e^w>=e){var E=vM(pM(d),pM(b));wM(E);var N=vM(o,E);wM(N);var C=(S^M>=0?-1:1)*Pk(N[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=S^M>=0?1:-1)}}return(a<-1e-6||a<pk&&s<-1e-12)^1&u}(o,r);a.length?(l||(i.polygonStart(),l=!0),pA(a,wA,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function m(t,n){s.point(t,n)}function p(){h.point=m,s.lineStart()}function g(){h.point=d,s.lineEnd()}function v(t,n){u.push([t,n]),f.point(t,n)}function y(){f.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),f.lineEnd();var t,n,e,r,s=f.clean(),h=c.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&s){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter(bA))}return h}}function bA(t){return t.length>1}function wA(t,n){return((t=t.x)[0]<0?t[1]-yk-pk:yk-t[1])-((n=n.x)[0]<0?n[1]-yk-pk:yk-n[1])}aA.invert=aA;var xA=yA((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?vk:-vk,s=kk(o-e);kk(s-vk)<pk?(t.point(e,r=(r+a)/2>0?yk:-yk),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&s>=vk&&(kk(e-i)<pk&&(e-=i*pk),kk(o-u)<pk&&(o-=u*pk),r=function(t,n,e,r){var i,o,a=Ok(t-e);return kk(a)>pk?Mk((Ok(n)*(o=Dk(r))*Ok(e)-Ok(r)*(i=Dk(n))*Ok(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)r.point(-vk,i=e*yk),r.point(0,i),r.point(vk,i),r.point(vk,0),r.point(vk,-i),r.point(0,-i),r.point(-vk,-i),r.point(-vk,0),r.point(-vk,i);else if(kk(t[0]-n[0])>pk){var o=t[0]<n[0]?vk:-vk;r.point(-o,i=e*o/2),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}),[-vk,-yk]);var $A=1e9,kA=-1e9;function MA(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var f=0,l=0;if(null==i||(f=a(i,u))!==(l=a(o,u))||s(i,o)<0^u>0)do{c.point(0===f||3===f?t:e,f>1?r:n)}while((f=(f+u+4)%4)!==l);else c.point(o[0],o[1])}function a(r,i){return kk(r[0]-t)<pk?i>0?0:3:kk(r[0]-e)<pk?i>0?2:1:kk(r[1]-n)<pk?i>0?1:0:i>0?3:2}function u(t,n){return s(t.x,n.x)}function s(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var s,c,f,l,h,d,m,p,g,v,y,b=a,w=hA(),x={point:$,lineStart:function(){x.point=k,c&&c.push(f=[]),v=!0,g=!1,m=p=NaN},lineEnd:function(){s&&(k(l,h),d&&g&&w.rejoin(),s.push(w.result())),x.point=$,g&&b.lineEnd()},polygonStart:function(){b=w,s=[],c=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],s=1,f=u.length,l=u[0],h=l[0],d=l[1];s<f;++s)o=h,a=d,h=(l=u[s])[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=y&&n,i=(s=Sn(s)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&pA(s,u,n,o,a),a.polygonEnd()),b=a,s=c=f=null}};function $(t,n){i(t,n)&&b.point(t,n)}function k(o,a){var u=i(o,a);if(c&&f.push([o,a]),v)l=o,h=a,d=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[m=Math.max(kA,Math.min($A,m)),p=Math.max(kA,Math.min($A,p))],w=[o=Math.max(kA,Math.min($A,o)),a=Math.max(kA,Math.min($A,a))];!function(t,n,e,r,i,o){var a,u=t[0],s=t[1],c=0,f=1,l=n[0]-u,h=n[1]-s;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<c)return;a<f&&(f=a)}else if(l>0){if(a>f)return;a>c&&(c=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>f)return;a>c&&(c=a)}else if(l>0){if(a<c)return;a<f&&(f=a)}if(a=r-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}return c>0&&(t[0]=u+c*l,t[1]=s+c*h),f<1&&(n[0]=u+f*l,n[1]=s+f*h),!0}}}}}(s,w,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(w[0],w[1]),u||b.lineEnd(),y=!1)}m=o,p=a,g=u}return x}}function AA(t,n,e){var r=Fn(t,n-pk,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function DA(t,n,e){var r=Fn(t,n-pk,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}var SA,FA,EA,NA,CA=t=>t,OA=new on,_A=new on,zA={point:jk,lineStart:jk,lineEnd:jk,polygonStart:function(){zA.lineStart=BA,zA.lineEnd=jA},polygonEnd:function(){zA.lineStart=zA.lineEnd=zA.point=jk,OA.add(kk(_A)),_A=new on},result:function(){var t=OA/2;return OA=new on,t}};function BA(){zA.point=TA}function TA(t,n){zA.point=PA,SA=EA=t,FA=NA=n}function PA(t,n){_A.add(NA*t-EA*n),EA=t,NA=n}function jA(){PA(SA,FA)}var RA,LA,IA,qA,UA=1/0,WA=UA,HA=-UA,GA=HA,YA={point:function(t,n){t<UA&&(UA=t),t>HA&&(HA=t),n<WA&&(WA=n),n>GA&&(GA=n)},lineStart:jk,lineEnd:jk,polygonStart:jk,polygonEnd:jk,result:function(){var t=[[UA,WA],[HA,GA]];return HA=GA=-(WA=UA=1/0),t}},VA=0,XA=0,JA=0,KA=0,QA=0,ZA=0,tD=0,nD=0,eD=0,rD={point:iD,lineStart:oD,lineEnd:sD,polygonStart:function(){rD.lineStart=cD,rD.lineEnd=fD},polygonEnd:function(){rD.point=iD,rD.lineStart=oD,rD.lineEnd=sD},result:function(){var t=eD?[tD/eD,nD/eD]:ZA?[KA/ZA,QA/ZA]:JA?[VA/JA,XA/JA]:[NaN,NaN];return VA=XA=JA=KA=QA=ZA=tD=nD=eD=0,t}};function iD(t,n){VA+=t,XA+=n,++JA}function oD(){rD.point=aD}function aD(t,n){rD.point=uD,iD(IA=t,qA=n)}function uD(t,n){var e=t-IA,r=n-qA,i=zk(e*e+r*r);KA+=i*(IA+t)/2,QA+=i*(qA+n)/2,ZA+=i,iD(IA=t,qA=n)}function sD(){rD.point=iD}function cD(){rD.point=lD}function fD(){hD(RA,LA)}function lD(t,n){rD.point=hD,iD(RA=IA=t,LA=qA=n)}function hD(t,n){var e=t-IA,r=n-qA,i=zk(e*e+r*r);KA+=i*(IA+t)/2,QA+=i*(qA+n)/2,ZA+=i,tD+=(i=qA*t-IA*n)*(IA+t),nD+=i*(qA+n),eD+=3*i,iD(IA=t,qA=n)}function dD(t){this._context=t}dD.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,wk)}},result:jk};var mD,pD,gD,vD,yD,bD=new on,wD={point:jk,lineStart:function(){wD.point=xD},lineEnd:function(){mD&&$D(pD,gD),wD.point=jk},polygonStart:function(){mD=!0},polygonEnd:function(){mD=null},result:function(){var t=+bD;return bD=new on,t}};function xD(t,n){wD.point=$D,pD=vD=t,gD=yD=n}function $D(t,n){bD.add(zk((vD-=t)*vD+(yD-=n)*yD)),vD=t,yD=n}let kD,MD,AD,DD;class SD{constructor(t){this._append=null==t?FD:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return FD;if(n!==kD){const t=10**n;kD=n,MD=function(n){let e=1;this._+=n[0];for(const r=n.length;e<r;++e)this._+=Math.round(arguments[e]*t)/t+n[e]}}return MD}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==AD||this._append!==MD){const t=this._radius,n=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,AD=t,MD=this._append,DD=this._,this._=n}this._+=DD}}result(){const t=this._;return this._="",t.length?t:null}}function FD(t){let n=1;this._+=t[0];for(const e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function ED(t,n){let e,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Wk(t,e(r))),r.result()}return a.area=function(t){return Wk(t,e(zA)),zA.result()},a.measure=function(t){return Wk(t,e(wD)),wD.result()},a.bounds=function(t){return Wk(t,e(YA)),YA.result()},a.centroid=function(t){return Wk(t,e(rD)),rD.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,CA):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new SD(i)):new dD(n=t),"function"!=typeof o&&r.pointRadius(o),a):n},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return null===n&&(r=new SD(i)),a},a.projection(t).digits(i).context(n)}function ND(t){return function(n){var e=new CD;for(var r in t)e[r]=t[r];return e.stream=n,e}}function CD(){}function OD(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Wk(e,t.stream(YA)),n(YA.result()),null!=r&&t.clipExtent(r),t}function _D(t,n,e){return OD(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])}),e)}function zD(t,n,e){return _D(t,[[0,0],n],e)}function BD(t,n,e){return OD(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])}),e)}function TD(t,n,e){return OD(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])}),e)}CD.prototype={constructor:CD,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var PD=Dk(30*$k);function jD(t,n){return+n?function(t,n){function e(r,i,o,a,u,s,c,f,l,h,d,m,p,g){var v=c-r,y=f-i,b=v*v+y*y;if(b>4*n&&p--){var w=a+h,x=u+d,$=s+m,k=zk(w*w+x*x+$*$),M=Pk($/=k),A=kk(kk($)-1)<pk||kk(o-l)<pk?(o+l)/2:Ak(x,w),D=t(A,M),S=D[0],F=D[1],E=S-r,N=F-i,C=y*E-v*N;(C*C/b>n||kk((v*E+y*N)/b-.5)>.3||a*h+u*d+s*m<PD)&&(e(r,i,o,a,u,s,S,F,A,w/=k,x/=k,$,p,g),g.point(S,F),e(S,F,A,w,x,$,c,f,l,h,d,m,p,g))}}return function(n){var r,i,o,a,u,s,c,f,l,h,d,m,p={point:g,lineStart:v,lineEnd:b,polygonStart:function(){n.polygonStart(),p.lineStart=w},polygonEnd:function(){n.polygonEnd(),p.lineStart=v}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){f=NaN,p.point=y,n.lineStart()}function y(r,i){var o=pM([r,i]),a=t(r,i);e(f,l,c,h,d,m,f=a[0],l=a[1],c=r,h=o[0],d=o[1],m=o[2],16,n),n.point(f,l)}function b(){p.point=g,n.lineEnd()}function w(){v(),p.point=x,p.lineEnd=$}function x(t,n){y(r=t,n),i=f,o=l,a=h,u=d,s=m,p.point=y}function $(){e(f,l,c,h,d,m,i,o,r,a,u,s,16,n),p.lineEnd=b,b()}return p}}(t,n):function(t){return ND({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var RD=ND({point:function(t,n){this.stream.point(t*$k,n*$k)}});function LD(t,n,e,r,i,o){if(!o)return function(t,n,e,r,i){function o(o,a){return[n+t*(o*=r),e-t*(a*=i)]}return o.invert=function(o,a){return[(o-n)/t*r,(e-a)/t*i]},o}(t,n,e,r,i);var a=Dk(o),u=Ok(o),s=a*t,c=u*t,f=a/t,l=u/t,h=(u*e-a*n)/t,d=(u*n+a*e)/t;function m(t,o){return[s*(t*=r)-c*(o*=i)+n,e-c*t-s*o]}return m.invert=function(t,n){return[r*(f*t-l*n+h),i*(d-l*t-f*n)]},m}function ID(t){return qD((function(){return t}))()}function qD(t){var n,e,r,i,o,a,u,s,c,f,l=150,h=480,d=250,m=0,p=0,g=0,v=0,y=0,b=0,w=1,x=1,$=null,k=xA,M=null,A=CA,D=.5;function S(t){return s(t[0]*$k,t[1]*$k)}function F(t){return(t=s.invert(t[0],t[1]))&&[t[0]*xk,t[1]*xk]}function E(){var t=LD(l,0,0,w,x,b).apply(null,n(m,p)),r=LD(l,h-t[0],d-t[1],w,x,b);return e=uA(g,v,y),u=oA(n,r),s=oA(e,u),a=jD(u,D),N()}function N(){return c=f=null,S}return S.stream=function(t){return c&&f===t?c:c=RD(function(t){return ND({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(k(a(A(f=t)))))},S.preclip=function(t){return arguments.length?(k=t,$=void 0,N()):k},S.postclip=function(t){return arguments.length?(A=t,M=r=i=o=null,N()):A},S.clipAngle=function(t){return arguments.length?(k=+t?function(t){var n=Dk(t),e=2*$k,r=n>0,i=kk(n)>pk;function o(t,e){return Dk(t)*Dk(e)>n}function a(t,e,r){var i=[1,0,0],o=vM(pM(t),pM(e)),a=gM(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var c=n*a/s,f=-n*u/s,l=vM(i,o),h=bM(i,c);yM(h,bM(o,f));var d=l,m=gM(h,d),p=gM(d,d),g=m*m-p*(gM(h,h)-1);if(!(g<0)){var v=zk(g),y=bM(d,(-m-v)/p);if(yM(y,h),y=mM(y),!r)return y;var b,w=t[0],x=e[0],$=t[1],k=e[1];x<w&&(b=w,w=x,x=b);var M=x-w,A=kk(M-vk)<pk;if(!A&&k<$&&(b=$,$=k,k=b),A||M<pk?A?$+k>0^y[1]<(kk(y[0]-w)<pk?$:k):$<=y[1]&&y[1]<=k:M>vk^(w<=y[0]&&y[0]<=x)){var D=bM(d,(-m+v)/p);return yM(D,h),[y,mM(D)]}}}function u(n,e){var i=r?t:vk-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return yA(o,(function(t){var n,e,s,c,f;return{lineStart:function(){c=s=!1,f=1},point:function(l,h){var d,m=[l,h],p=o(l,h),g=r?p?0:u(l,h):p?u(l+(l<0?vk:-vk),h):0;if(!n&&(c=s=p)&&t.lineStart(),p!==s&&(!(d=a(n,m))||dA(n,d)||dA(m,d))&&(m[2]=1),p!==s)f=0,p?(t.lineStart(),d=a(m,n),t.point(d[0],d[1])):(d=a(n,m),t.point(d[0],d[1],2),t.lineEnd()),n=d;else if(i&&n&&r^p){var v;g&e||!(v=a(m,n,!0))||(f=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!p||n&&dA(n,m)||t.point(m[0],m[1]),n=m,s=p,e=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return f|(c&&s)<<1}}}),(function(n,r,i,o){!function(t,n,e,r,i,o){if(e){var a=Dk(n),u=Ok(n),s=r*e;null==i?(i=n+r*wk,o=n-s/2):(i=lA(a,i),o=lA(a,o),(r>0?i<o:i>o)&&(i+=r*wk));for(var c,f=i;r>0?f>o:f<o;f-=s)c=mM([a,-u*Dk(f),-u*Ok(f)]),t.point(c[0],c[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-vk,t-vk])}($=t*$k):($=null,xA),N()):$*xk},S.clipExtent=function(t){return arguments.length?(A=null==t?(M=r=i=o=null,CA):MA(M=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),N()):null==M?null:[[M,r],[i,o]]},S.scale=function(t){return arguments.length?(l=+t,E()):l},S.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],E()):[h,d]},S.center=function(t){return arguments.length?(m=t[0]%360*$k,p=t[1]%360*$k,E()):[m*xk,p*xk]},S.rotate=function(t){return arguments.length?(g=t[0]%360*$k,v=t[1]%360*$k,y=t.length>2?t[2]%360*$k:0,E()):[g*xk,v*xk,y*xk]},S.angle=function(t){return arguments.length?(b=t%360*$k,E()):b*xk},S.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},S.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},S.precision=function(t){return arguments.length?(a=jD(u,D=t*t),N()):zk(D)},S.fitExtent=function(t,n){return _D(S,t,n)},S.fitSize=function(t,n){return zD(S,t,n)},S.fitWidth=function(t,n){return BD(S,t,n)},S.fitHeight=function(t,n){return TD(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&F,E()}}function UD(t){var n=0,e=vk/3,r=qD(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*$k,e=t[1]*$k):[n*xk,e*xk]},i}function WD(t,n){var e=Ok(t),r=(e+Ok(n))/2;if(kk(r)<pk)return function(t){var n=Dk(t);function e(t,e){return[t*n,Ok(e)/n]}return e.invert=function(t,e){return[t/n,Pk(e*n)]},e}(t);var i=1+e*(2*r-e),o=zk(i)/r;function a(t,n){var e=zk(i-2*r*Ok(n))/r;return[e*Ok(t*=r),o-e*Dk(t)]}return a.invert=function(t,n){var e=o-n,a=Ak(t,kk(e))*_k(e);return e*r<0&&(a-=vk*_k(t)*_k(e)),[a/r,Pk((i-(t*t+e*e)*r*r)/(2*r))]},a}function HD(){return UD(WD).scale(155.424).center([0,33.6442])}function GD(){return HD().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function YD(t){return function(n,e){var r=Dk(n),i=Dk(e),o=t(r*i);return o===1/0?[2,0]:[o*i*Ok(n),o*Ok(e)]}}function VD(t){return function(n,e){var r=zk(n*n+e*e),i=t(r),o=Ok(i),a=Dk(i);return[Ak(n*o,r*a),Pk(r&&e*o/r)]}}var XD=YD((function(t){return zk(2/(1+t))}));XD.invert=VD((function(t){return 2*Pk(t/2)}));var JD=YD((function(t){return(t=Tk(t))&&t/Ok(t)}));function KD(t,n){return[t,Nk(Bk((yk+n)/2))]}function QD(t){var n,e,r,i=ID(t),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,c=null;function f(){var o=vk*a(),u=i(function(t){function n(n){return(n=t(n[0]*$k,n[1]*$k))[0]*=xk,n[1]*=xk,n}return t=uA(t[0]*$k,t[1]*$k,t.length>2?t[2]*$k:0),n.invert=function(n){return(n=t.invert(n[0]*$k,n[1]*$k))[0]*=xk,n[1]*=xk,n},n}(i.rotate()).invert([0,0]));return s(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===KD?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),f()):a()},i.translate=function(t){return arguments.length?(u(t),f()):u()},i.center=function(t){return arguments.length?(o(t),f()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),f()):null==c?null:[[c,n],[e,r]]},f()}function ZD(t){return Bk((yk+t)/2)}function tS(t,n){var e=Dk(t),r=t===n?Ok(t):Nk(e/Dk(n))/Nk(ZD(n)/ZD(t)),i=e*Ck(ZD(t),r)/r;if(!r)return KD;function o(t,n){i>0?n<-yk+pk&&(n=-yk+pk):n>yk-pk&&(n=yk-pk);var e=i/Ck(ZD(n),r);return[e*Ok(r*t),i-e*Dk(r*t)]}return o.invert=function(t,n){var e=i-n,o=_k(r)*zk(t*t+e*e),a=Ak(t,kk(e))*_k(e);return e*r<0&&(a-=vk*_k(t)*_k(e)),[a/r,2*Mk(Ck(i/o,1/r))-yk]},o}function nS(t,n){return[t,n]}function eS(t,n){var e=Dk(t),r=t===n?Ok(t):(e-Dk(n))/(n-t),i=e/r+t;if(kk(r)<pk)return nS;function o(t,n){var e=i-n,o=r*t;return[e*Ok(o),i-e*Dk(o)]}return o.invert=function(t,n){var e=i-n,o=Ak(t,kk(e))*_k(e);return e*r<0&&(o-=vk*_k(t)*_k(e)),[o/r,i-_k(r)*zk(t*t+e*e)]},o}JD.invert=VD((function(t){return t})),KD.invert=function(t,n){return[t,2*Mk(Fk(n))-yk]},nS.invert=nS;var rS=1.340264,iS=-.081106,oS=893e-6,aS=.003796,uS=zk(3)/2;function sS(t,n){var e=Pk(uS*Ok(n)),r=e*e,i=r*r*r;return[t*Dk(e)/(uS*(rS+3*iS*r+i*(7*oS+9*aS*r))),e*(rS+iS*r+i*(oS+aS*r))]}function cS(t,n){var e=Dk(n),r=Dk(t)*e;return[e*Ok(t)/r,Ok(n)/r]}function fS(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function lS(t,n){return[Dk(n)*Ok(t),Ok(n)]}function hS(t,n){var e=Dk(n),r=1+Dk(t)*e;return[e*Ok(t)/r,Ok(n)/r]}function dS(t,n){return[Nk(Bk((yk+n)/2)),-t]}sS.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(rS+iS*i+o*(oS+aS*i))-n)/(rS+3*iS*i+o*(7*oS+9*aS*i)))*r)*i*i,!(kk(e)<gk));++a);return[uS*t*(rS+3*iS*i+o*(7*oS+9*aS*i))/Dk(r),Pk(Ok(r)/uS)]},cS.invert=VD(Mk),fS.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(kk(e)>pk&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},lS.invert=VD(Pk),hS.invert=VD((function(t){return 2*Mk(t)})),dS.invert=function(t,n){return[-n,2*Mk(Fk(t))-yk]};var mS=Math.abs,pS=Math.cos,gS=Math.sin,vS=Math.PI,yS=vS/2,bS=Math.sqrt(2);function wS(t){return t>1?yS:t<-1?-yS:Math.asin(t)}function xS(t,n){var e,r=t*gS(n),i=30;do{n-=e=(n+gS(n)-r)/(1+pS(n))}while(mS(e)>1e-6&&--i>0);return n/2}var $S=function(t,n,e){function r(r,i){return[t*r*pS(i=xS(e,i)),n*gS(i)]}return r.invert=function(r,i){return i=wS(i/n),[r/(t*pS(i)),wS((2*i+gS(2*i))/e)]},r}(bS/yS,bS,vS);const kS=ED(),MS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function AS(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(SS[t]=function(t,n){return function e(){const r=n();return r.type=t,r.path=ED().projection(r),r.copy=r.copy||function(){const t=e();return MS.forEach((n=>{r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},tg(r)}}(t,n),this):SS[t]||null}function DS(t){return t&&t.path||kS}const SS={albers:GD,albersusa:function(){var t,n,e,r,i,o,a=GD(),u=HD().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=HD().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function f(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,f}return f.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},f.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},f.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),s.precision(t),l()):a.precision()},f.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),s.scale(t),f.translate(a.translate())):a.scale()},f.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],f=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,f-.238*n],[o+.455*n,f+.238*n]]).stream(c),r=u.translate([o-.307*n,f+.201*n]).clipExtent([[o-.425*n+pk,f+.12*n+pk],[o-.214*n-pk,f+.234*n-pk]]).stream(c),i=s.translate([o-.205*n,f+.212*n]).clipExtent([[o-.214*n+pk,f+.166*n+pk],[o-.115*n-pk,f+.234*n-pk]]).stream(c),l()},f.fitExtent=function(t,n){return _D(f,t,n)},f.fitSize=function(t,n){return zD(f,t,n)},f.fitWidth=function(t,n){return BD(f,t,n)},f.fitHeight=function(t,n){return TD(f,t,n)},f.scale(1070)},azimuthalequalarea:function(){return ID(XD).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return ID(JD).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return UD(tS).scale(109.5).parallels([30,30])},conicequalarea:HD,conicequidistant:function(){return UD(eS).scale(131.154).center([0,13.9389])},equalEarth:function(){return ID(sS).scale(177.158)},equirectangular:function(){return ID(nS).scale(152.63)},gnomonic:function(){return ID(cS).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,o,a,u=1,s=0,c=0,f=1,l=1,h=0,d=null,m=1,p=1,g=ND({point:function(t,n){var e=b([t,n]);this.stream.point(e[0],e[1])}}),v=CA;function y(){return m=u*f,p=u*l,o=a=null,b}function b(e){var r=e[0]*m,i=e[1]*p;if(h){var o=i*t-r*n;r=r*t+i*n,i=o}return[r+s,i+c]}return b.invert=function(e){var r=e[0]-s,i=e[1]-c;if(h){var o=i*t+r*n;r=r*t-i*n,i=o}return[r/m,i/p]},b.stream=function(t){return o&&a===t?o:o=g(v(a=t))},b.postclip=function(t){return arguments.length?(v=t,d=e=r=i=null,y()):v},b.clipExtent=function(t){return arguments.length?(v=null==t?(d=e=r=i=null,CA):MA(d=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),y()):null==d?null:[[d,e],[r,i]]},b.scale=function(t){return arguments.length?(u=+t,y()):u},b.translate=function(t){return arguments.length?(s=+t[0],c=+t[1],y()):[s,c]},b.angle=function(e){return arguments.length?(n=Ok(h=e%360*$k),t=Dk(h),y()):h*xk},b.reflectX=function(t){return arguments.length?(f=t?-1:1,y()):f<0},b.reflectY=function(t){return arguments.length?(l=t?-1:1,y()):l<0},b.fitExtent=function(t,n){return _D(b,t,n)},b.fitSize=function(t,n){return zD(b,t,n)},b.fitWidth=function(t,n){return BD(b,t,n)},b.fitHeight=function(t,n){return TD(b,t,n)},b},mercator:function(){return QD(KD).scale(961/wk)},mollweide:function(){return ID($S).scale(169.529)},naturalEarth1:function(){return ID(fS).scale(175.295)},orthographic:function(){return ID(lS).scale(249.5).clipAngle(90.000001)},stereographic:function(){return ID(hS).scale(250).clipAngle(142)},transversemercator:function(){var t=QD(dS),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in SS)AS(t,SS[t]);function FS(){}const ES=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function NS(){var t=1,n=1,e=a;function r(t,n){return n.map((n=>i(t,n)))}function i(r,i){var a=[],u=[];return function(e,r,i){var a,u,s,c,f,l=[],h=[];for(a=u=-1,ES[(s=e[0]>=r)<<1].forEach(d);++a<t-1;)ES[s|(s=e[a+1]>=r)<<1].forEach(d);for(ES[0|s].forEach(d);++u<n-1;){for(a=-1,ES[(s=e[u*t+t]>=r)<<1|(c=e[u*t]>=r)<<2].forEach(d);++a<t-1;)f=c,ES[s|(s=e[u*t+t+a+1]>=r)<<1|(c=e[u*t+a+1]>=r)<<2|f<<3].forEach(d);ES[s|c<<3].forEach(d)}for(a=-1,ES[(c=e[u*t]>=r)<<2].forEach(d);++a<t-1;)f=c,ES[(c=e[u*t+a+1]>=r)<<2|f<<3].forEach(d);function d(t){var n,e,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],c=o(r),f=o(s);(n=h[c])?(e=l[f])?(delete h[n.end],delete l[e.start],n===e?(n.ring.push(s),i(n.ring)):l[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[n.end],n.ring.push(s),h[n.end=f]=n):(n=l[f])?(e=h[c])?(delete l[n.start],delete h[e.end],n===e?(n.ring.push(s),i(n.ring)):l[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete l[n.start],n.ring.unshift(r),l[n.start=c]=n):l[c]=h[f]={start:c,end:f,ring:[r,s]}}ES[c<<3].forEach(d)}(r,i,(t=>{e(t,r,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var n,e=0,r=a.length;e<r;++e)if(-1!==CS((n=a[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(n){return 2*n[0]+n[1]*(t+1)*4}function a(e,r,i){e.forEach((e=>{var o,a=e[0],u=e[1],s=0|a,c=0|u,f=r[c*t+s];a>0&&a<t&&s===a&&(e[0]=a+(i-(o=r[c*t+s-1]))/(f-o)-.5),u>0&&u<n&&c===u&&(e[1]=u+(i-(o=r[(c-1)*t+s]))/(f-o)-.5)}))}return r.contour=i,r.size=function(e){if(!arguments.length)return[t,n];var i=Math.floor(e[0]),o=Math.floor(e[1]);return i>=0&&o>=0||p("invalid size"),t=i,n=o,r},r.smooth=function(t){return arguments.length?(e=t?a:FS,r):e===a},r}function CS(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=OS(t,n[r]))return e;return 0}function OS(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var s=t[o],c=s[0],f=s[1],l=t[u],h=l[0],d=l[1];if(_S(s,l,n))return 0;f>r!=d>r&&e<(h-c)*(r-f)/(d-f)+c&&(i=-i)}return i}function _S(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=n[r],i<=(o=e[r])&&o<=a||a<=o&&o<=i)}function zS(t,n,e){return function(r){var i=st(r),o=e?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=n?bn(o,a,t):u/(t+1);return Fn(o+s,a,s)}}function BS(t){_a.call(this,null,t)}function TS(t,n,e,r,i){const o=t.x1||0,a=t.y1||0,u=n*e<0;function s(t){t.forEach(c)}function c(t){u&&t.reverse(),t.forEach(f)}function f(t){t[0]=(t[0]-o)*n+r,t[1]=(t[1]-a)*e+i}return function(t){return t.coordinates.forEach(s),t}}function PS(t,n,e){const r=t>=0?t:La(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function jS(t){return Z(t)?t:ot(+t)}function RS(){var t=t=>t[0],n=t=>t[1],e=x,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const c=PS(r[0],u,t)>>a,f=PS(r[1],u,n)>>a,l=c?c+2:0,h=f?f+2:0,d=2*l+(i>>a),m=2*h+(o>>a),p=new Float32Array(d*m),g=new Float32Array(d*m);let v=p;u.forEach((r=>{const i=l+(+t(r)>>a),o=h+(+n(r)>>a);i>=0&&i<d&&o>=0&&o<m&&(p[i+o*d]+=+e(r))})),c>0&&f>0?(LS(d,m,p,g,c),IS(d,m,g,p,f),LS(d,m,p,g,c),IS(d,m,g,p,f),LS(d,m,p,g,c),IS(d,m,g,p,f)):c>0?(LS(d,m,p,g,c),LS(d,m,g,p,c),LS(d,m,p,g,c),v=g):f>0&&(IS(d,m,p,g,f),IS(d,m,g,p,f),IS(d,m,p,g,f),v=g);const y=s?Math.pow(2,-2*a):1/En(v);for(let t=0,n=d*m;t<n;++t)v[t]*=y;return{values:v,scale:1<<a,width:d,height:m,x1:l,y1:h,x2:l+(i>>a),y2:h+(o>>a)}}return u.x=function(n){return arguments.length?(t=jS(n),u):t},u.y=function(t){return arguments.length?(n=jS(t),u):n},u.weight=function(t){return arguments.length?(e=jS(t),u):e},u.size=function(t){if(!arguments.length)return[i,o];var n=+t[0],e=+t[1];return n>=0&&e>=0||p("invalid size"),i=n,o=e,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||p("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=K(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&p("invalid bandwidth"),r=t,u):r},u}function LS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<n;++a)for(let n=0,u=0;n<t+i;++n)n<t&&(u+=e[n+a*t]),n>=i&&(n>=o&&(u-=e[n-o+a*t]),r[n-i+a*t]=u/Math.min(n+1,t-1+o-n,o))}function IS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let u=0,s=0;u<n+i;++u)u<n&&(s+=e[a+u*t]),u>=i&&(u>=o&&(s-=e[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,n-1+o-u,o))}function qS(t){_a.call(this,null,t)}BS.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},mt(BS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||b,o=NS().smooth(!1!==t.smooth),a=t.thresholds||function(t,n,e){const r=zS(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map((t=>wn(n(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((n=>{const e=i(n),r=o.size([e.width,e.height])(e.values,D(a)?a:a(e.values));!function(t,n,e,r){let i=r.scale||n.scale,o=r.translate||n.translate;if(Z(i)&&(i=i(e,r)),Z(o)&&(o=o(e,r)),(1===i||null==i)&&!o)return;const a=(bt(i)?i:i[0])||1,u=(bt(i)?i:i[1])||1;t.forEach(TS(n,a,u,o&&o[0]||0,o&&o[1]||0))}(r,e,n,t),r.forEach((t=>{s.push(oa(n,ra(null!=u?{[u]:t}:t)))}))})),this.value&&(e.rem=this.value),this.value=e.source=e.add=s,e}}),qS.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const US=["x","y","weight","size","cellSize","bandwidth"];function WS(t,n){return US.forEach((e=>null!=n[e]?t[e](n[e]):0)),t}function HS(t){_a.call(this,null,t)}mt(qS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(t,n){var e,r,i,o,a,u,s=[],c=t=>t(o);if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}(n.materialize(n.SOURCE).source,t.groupby),o=(t.groupby||[]).map(f),a=WS(RS(),t),u=t.as||"grid";return e=i.map((n=>ra(function(t,n){for(let e=0;e<o.length;++e)t[o[e]]=n[e];return t}({[u]:a(n,t.counts)},n.dims)))),this.value&&(r.rem=this.value),this.value=r.source=r.add=e,r}}),HS.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},mt(HS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=NS().smooth(!1!==t.smooth),a=t.values,u=t.thresholds||zS(t.count||10,t.nice,!!a),s=t.size;return a||(a=n.materialize(n.SOURCE).source,r=TS(e=WS(RS(),t)(a,!0),e.scale||1,e.scale||1,0,0),s=[e.width,e.height],a=e.values),u=D(u)?u:u(a),a=o.size(s)(a,u),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(ra),i}});const GS="Feature",YS="FeatureCollection";function VS(t){_a.call(this,null,t)}function XS(t){_a.call(this,null,t)}function JS(t){_a.call(this,null,t)}function KS(t){_a.call(this,null,t)}function QS(t){_a.call(this,[],t),this.generator=function(){var t,n,e,r,i,o,a,u,s,c,f,l,h=10,d=h,m=90,p=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return Fn(Sk(r/m)*m,e,m).map(f).concat(Fn(Sk(u/p)*p,a,p).map(l)).concat(Fn(Sk(n/h)*h,t,h).filter((function(t){return kk(t%m)>pk})).map(s)).concat(Fn(Sk(o/d)*d,i,d).filter((function(t){return kk(t%p)>pk})).map(c))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(l(a).slice(1),f(e).reverse().slice(1),l(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(u=+t[0][1],a=+t[1][1],(r=+t[0][0])>(e=+t[1][0])&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(g)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(o=+e[0][1],i=+e[1][1],(n=+e[0][0])>(t=+e[1][0])&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(g)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(m=+t[0],p=+t[1],v):[m,p]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(g=+h,s=AA(o,i,90),c=DA(n,t,g),f=AA(u,a,90),l=DA(r,e,g),v):g},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function ZS(t){_a.call(this,null,t)}function tF(t){if(!Z(t))return!1;const n=zt(l(t));return n.$x||n.$y||n.$value||n.$max}function nF(t){_a.call(this,null,t),this.modified(!0)}function eF(t,n,e){Z(t[n])&&t[n](e)}VS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},mt(VS,_a,{transform(t,n){var e,r=this._features,i=this._points,o=t.fields,a=o&&o[0],u=o&&o[1],s=t.geojson||!o&&b,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(l(s))||a&&n.modified(l(a))||u&&n.modified(l(u)),this.value&&!e||(c=n.SOURCE,this._features=r=[],this._points=i=[]),s&&n.visit(c,(t=>r.push(s(t)))),a&&u&&(n.visit(c,(t=>{var n=a(t),e=u(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&i.push([n,e])})),r=r.concat({type:GS,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:YS,features:r}}}),XS.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},mt(XS,_a,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||b,o=t.as||"path",a=e.SOURCE;!r||t.modified()?(this.value=r=DS(t.projection),e.materialize().reflow()):a=i===b||n.modified(i.fields)?e.ADD_MOD:e.ADD;const u=function(t,n){const e=t.pointRadius();return t.context(null),null!=n&&t.pointRadius(n),e}(r,t.pointRadius);return e.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),e.modifies(o)}}),JS.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},mt(JS,_a,{transform(t,n){var e,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function c(t){const n=r([i(t),o(t)]);n?(t[u]=n[0],t[s]=n[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,c):(e=n.modified(i.fields)||n.modified(o.fields),n.visit(e?n.ADD_MOD:n.ADD,c)),n.modifies(a)}}),KS.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},mt(KS,_a,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",o=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){const r=null==e?e=>t(n(e)):r=>{var i=t.pointRadius(),o=t.pointRadius(e)(n(r));return t.pointRadius(i),o};return r.context=n=>(t.context(n),r),r}(DS(t.projection),t.field||v("datum"),t.pointRadius),e.materialize().reflow(),o=e.SOURCE),e.visit(o,(t=>t[i]=r)),e.modifies(i)}}),QS.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},mt(QS,_a,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const n in t)Z(i[n])&&i[n](t[n]);return e=i(),r.length?n.mod.push(aa(r[0],e)):n.add.push(ra(e)),r[0]=e,n}}),ZS.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},mt(ZS,_a,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||b,o=function(t,n){let e;return Z(t)?(e=e=>t(e,n),e.dep=tF(t)):t?e=ot(t):(e=t=>t.$value/t.$max||0,e.dep=!0),e}(t.opacity,t),a=function(t,n){let e;return Z(t)?(e=e=>Uf(t(e,n)),e.dep=tF(t)):e=ot(Uf(t||"#888")),e}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?wn(e.map((t=>wn(i(t).values)))):0};return e.forEach((t=>{const n=i(t),e=ut({},t,s);r||(e.$max=wn(n.values||[])),t[u]=function(t,n,e,r){const i=t.width,o=t.x1||0,a=t.y1||0,u=t.x2||i,s=t.y2||t.height,c=t.values,f=c?t=>c[t]:w,l=pf(u-o,s-a),h=l.getContext("2d"),d=h.getImageData(0,0,u-o,s-a),m=d.data;for(let t=a,c=0;t<s;++t){n.$y=t-a;for(let a=o,s=t*i;a<u;++a,c+=4){n.$x=a-o,n.$value=f(a+s);const t=e(n);m[c+0]=t.r,m[c+1]=t.g,m[c+2]=t.b,m[c+3]=~~(255*r(n))}}return h.putImageData(d,0,0),l}(n,e,a.dep?a:ot(a(e)),o.dep?o:ot(o(e)))})),n.reflow(!0).modifies(u)}}),mt(nF,_a,{transform(t,n){let e=this.value;return!e||t.modified("type")?(this.value=e=function(t){const n=AS((t||"mercator").toLowerCase());return n||p("Unrecognized projection type: "+t),n()}(t.type),MS.forEach((n=>{null!=t[n]&&eF(e,n,t[n])}))):MS.forEach((n=>{t.modified(n)&&eF(e,n,t[n])})),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){const e=function(t){return 1===(t=K(t)).length?t[0]:{type:YS,features:t.reduce(((t,n)=>t.concat(function(t){return t.type===YS?t.features:K(t).filter((t=>null!=t)).map((t=>t.type===GS?t:{type:GS,geometry:t}))}(n))),[])}}(n.fit);n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});var rF=Object.freeze({__proto__:null,contour:HS,geojson:VS,geopath:XS,geopoint:JS,geoshape:KS,graticule:QS,heatmap:ZS,isocontour:BS,kde2d:qS,projection:nF});function iF(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,s,c,f,l,h,d=t._root,m={data:r},p=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=m,t;for(;d.length;)if((c=n>=(o=(p+v)/2))?p=o:v=o,(f=e>=(a=(g+y)/2))?g=a:y=a,i=d,!(d=d[l=f<<1|c]))return i[l]=m,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===u&&e===s)return m.next=d,i?i[l]=m:t._root=m,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+v)/2))?p=o:v=o,(f=e>=(a=(g+y)/2))?g=a:y=a}while((l=f<<1|c)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[l]=m,t}function oF(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function aF(t){return t[0]}function uF(t){return t[1]}function sF(t,n,e){var r=new cF(null==n?aF:n,null==e?uF:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function cF(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function fF(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var lF=sF.prototype=cF.prototype;function hF(t){return function(){return t}}function dF(t){return 1e-6*(t()-.5)}function mF(t){return t.x+t.vx}function pF(t){return t.y+t.vy}function gF(t){return t.index}function vF(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}lF.copy=function(){var t,n,e=new cF(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=fF(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=fF(n));return e},lF.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return iF(this.cover(n,e),n,e,t)},lF.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,f=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<s&&(s=r),r>f&&(f=r),i<c&&(c=i),i>l&&(l=i));if(s>f||c>l)return this;for(this.cover(s,c).cover(f,l),e=0;e<o;++e)iF(this,a[e],u[e],t[e]);return this},lF.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,s=i-e||1,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=e+s,o=r+s;break;case 1:e=i-s,o=r+s;break;case 2:i=e+s,r=o-s;break;case 3:e=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},lF.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},lF.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},lF.find=function(t,n,e){var r,i,o,a,u,s,c,f=this._x0,l=this._y0,h=this._x1,d=this._y1,m=[],p=this._root;for(p&&m.push(new oF(p,f,l,h,d)),null==e?e=1/0:(f=t-e,l=n-e,h=t+e,d=n+e,e*=e);s=m.pop();)if(!(!(p=s.node)||(i=s.x0)>h||(o=s.y0)>d||(a=s.x1)<f||(u=s.y1)<l))if(p.length){var g=(i+a)/2,v=(o+u)/2;m.push(new oF(p[3],g,v,a,u),new oF(p[2],i,v,g,u),new oF(p[1],g,o,a,v),new oF(p[0],i,o,g,v)),(c=(n>=v)<<1|t>=g)&&(s=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=s)}else{var y=t-+this._x.call(null,p.data),b=n-+this._y.call(null,p.data),w=y*y+b*b;if(w<e){var x=Math.sqrt(e=w);f=t-x,l=n-x,h=t+x,d=n+x,r=p.data}}return r},lF.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,s,c,f,l,h,d=this._root,m=this._x0,p=this._y0,g=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(u=(m+g)/2))?m=u:g=u,(f=a>=(s=(p+v)/2))?p=s:v=s,n=d,!(d=d[l=f<<1|c]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},lF.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},lF.root=function(){return this._root},lF.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},lF.visit=function(t){var n,e,r,i,o,a,u=[],s=this._root;for(s&&u.push(new oF(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&s.length){var c=(r+o)/2,f=(i+a)/2;(e=s[3])&&u.push(new oF(e,c,f,o,a)),(e=s[2])&&u.push(new oF(e,r,f,c,a)),(e=s[1])&&u.push(new oF(e,c,i,o,f)),(e=s[0])&&u.push(new oF(e,r,i,c,f))}return this},lF.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new oF(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,s=n.x1,c=n.y1,f=(a+s)/2,l=(u+c)/2;(o=i[0])&&e.push(new oF(o,a,u,f,l)),(o=i[1])&&e.push(new oF(o,f,u,s,l)),(o=i[2])&&e.push(new oF(o,a,l,f,c)),(o=i[3])&&e.push(new oF(o,f,l,s,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},lF.x=function(t){return arguments.length?(this._x=t,this):this._x},lF.y=function(t){return arguments.length?(this._y=t,this):this._y};var yF={value:()=>{}};function bF(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new wF(r)}function wF(t){this._=t}function xF(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function $F(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=yF,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}wF.prototype=bF.prototype={constructor:wF,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=$F(i[e],t.name,n);else if(null==n)for(e in i)i[e]=$F(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=xF(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new wF(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var kF,MF,AF=0,DF=0,SF=0,FF=0,EF=0,NF=0,CF="object"==typeof performance&&performance.now?performance:Date,OF="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _F(){return EF||(OF(zF),EF=CF.now()+NF)}function zF(){EF=0}function BF(){this._call=this._time=this._next=null}function TF(t,n,e){var r=new BF;return r.restart(t,n,e),r}function PF(){EF=(FF=CF.now())+NF,AF=DF=0;try{!function(){_F(),++AF;for(var t,n=kF;n;)(t=EF-n._time)>=0&&n._call.call(void 0,t),n=n._next;--AF}()}finally{AF=0,function(){for(var t,n,e=kF,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:kF=n);MF=t,RF(r)}(),EF=0}}function jF(){var t=CF.now(),n=t-FF;n>1e3&&(NF-=n,FF=t)}function RF(t){AF||(DF&&(DF=clearTimeout(DF)),t-EF>24?(t<1/0&&(DF=setTimeout(PF,t-CF.now()-NF)),SF&&(SF=clearInterval(SF))):(SF||(FF=CF.now(),SF=setInterval(jF,1e3)),AF=1,OF(PF)))}BF.prototype=TF.prototype={constructor:BF,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?_F():+e)+(null==n?0:+n),this._next||MF===this||(MF?MF._next=this:kF=this,MF=this),this._call=t,this._time=e,RF()},stop:function(){this._call&&(this._call=null,this._time=1/0,RF())}};const LF=4294967296;function IF(t){return t.x}function qF(t){return t.y}var UF=Math.PI*(3-Math.sqrt(5));const WF={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=e[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=s}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,s,c,f,l,h,d=n.length,m=0;m<o;++m)for(a=sF(n,mF,pF).visitAfter(u),t=0;t<d;++t)h=(l=e[(s=n[t]).index])*l,c=s.x+s.vx,f=s.y+s.vy,a.visit(p);function p(t,n,e,o,a){var u=t.data,d=t.r,m=l+d;if(!u)return n>c+m||o<c-m||e>f+m||a<f-m;if(u.index>s.index){var p=c-u.x-u.vx,g=f-u.y-u.vy,v=p*p+g*g;v<m*m&&(0===p&&(v+=(p=dF(r))*p),0===g&&(v+=(g=dF(r))*g),v=(m-(v=Math.sqrt(v)))/v*i,s.vx+=(p*=v)*(m=(d*=d)/(h+d)),s.vy+=(g*=v)*m,u.vx-=p*(m=1-m),u.vy-=g*m)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function s(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)e[(i=n[r]).index]=+t(i,r,n)}}return"function"!=typeof t&&(t=hF(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,s()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),s(),a):t},a},nbody:function(){var t,n,e,r,i,o=hF(-30),a=1,u=1/0,s=.81;function c(e){var i,o=t.length,a=sF(t,IF,qF).visitAfter(l);for(r=e,i=0;i<o;++i)n=t[i],a.visit(h)}function f(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)i[(e=t[n]).index]=+o(e,n,t)}}function l(t){var n,e,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,s+=e,r+=e*n.x,o+=e*n.y);t.x=r/s,t.y=o/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function h(t,o,c,f){if(!t.value)return!0;var l=t.x-n.x,h=t.y-n.y,d=f-o,m=l*l+h*h;if(d*d/s<m)return m<u&&(0===l&&(m+=(l=dF(e))*l),0===h&&(m+=(h=dF(e))*h),m<a&&(m=Math.sqrt(a*m)),n.vx+=l*t.value*r/m,n.vy+=h*t.value*r/m),!0;if(!(t.length||m>=u)){(t.data!==n||t.next)&&(0===l&&(m+=(l=dF(e))*l),0===h&&(m+=(h=dF(e))*h),m<a&&(m=Math.sqrt(a*m)));do{t.data!==n&&(n.vx+=l*(d=i[t.data.index]*r/m),n.vy+=h*d)}while(t=t.next)}}return c.initialize=function(n,r){t=n,e=r,f()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:hF(+t),f(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c},link:function(t){var n,e,r,i,o,a,u=gF,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=hF(30),f=1;function l(r){for(var i=0,u=t.length;i<f;++i)for(var s,c,l,h,d,m,p,g=0;g<u;++g)h=(l=(s=t[g]).target).x+l.vx-(c=s.source).x-c.vx||dF(a),d=l.y+l.vy-c.y-c.vy||dF(a),d*=m=((m=Math.sqrt(h*h+d*d))-e[g])/m*r*n[g],l.vx-=(h*=m)*(p=o[g]),l.vy-=d*p,c.vx+=h*(p=1-p),c.vy+=d*p}function h(){if(r){var a,s,c=r.length,f=t.length,l=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(c);a<f;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=vF(l,s.source)),"object"!=typeof s.target&&(s.target=vF(l,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(f);a<f;++a)o[a]=i[(s=t[a]).source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(f),d(),e=new Array(f),m()}}function d(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+s(t[e],e,t)}function m(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),l.initialize=function(t,n){r=t,a=n,h()},l.links=function(n){return arguments.length?(t=n,h(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(f=+t,l):f},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:hF(+t),d(),l):s},l.distance=function(t){return arguments.length?(c="function"==typeof t?t:hF(+t),m(),l):c},l},x:function(t){var n,e,r,i=hF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=hF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:hF(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),a(),o):t},o},y:function(t){var n,e,r,i=hF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=hF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:hF(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),a(),o):t},o}},HF="forces",GF=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],YF=["static","iterations"],VF=["x","y","vx","vy"];function XF(t){_a.call(this,null,t)}function JF(t,n,e,r){var i,o,a,u,s=K(n.forces);for(i=0,o=GF.length;i<o;++i)(a=GF[i])!==HF&&n.modified(a)&&t[a](n[a]);for(i=0,o=s.length;i<o;++i)u=HF+i,(a=e||n.modified(HF,i)?QF(s[i]):r&&KF(s[i],r)?t.force(u):null)&&t.force(u,a);for(o=t.numForces||0;i<o;++i)t.force(HF+i,null);return t.numForces=s.length,t}function KF(t,n){var e,r;for(e in t)if(Z(r=t[e])&&n.modified(l(r)))return 1;return 0}function QF(t){var n,e;for(e in ft(WF,t.force)||p("Unrecognized force: "+t.force),n=WF[t.force](),t)Z(n[e])&&ZF(n[e],t[e],t);return n}function ZF(t,n,e){t(Z(n)?t=>n(t,e):n)}XF.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:VF}]},mt(XF,_a,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(GF),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&JF(i,t,0,n)):(this.value=i=function(t,n){const e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=TF(l),c=bF("tick","end"),f=function(){let t=1;return()=>(t=(1664525*t+1013904223)%LF)/LF}();function l(){h(),c.call("tick",n),e<r&&(s.stop(),c.call("end",n))}function h(r){var s,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),s=0;s<f;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return n}function d(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(.5+e),o=e*UF;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function m(n){return n.initialize&&n.initialize(t,f),n}return null==t&&(t=[]),d(),n={tick:h,restart:function(){return s.restart(l),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,d(),u.forEach(m),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(f=t,u.forEach(m),n):f},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,m(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,s,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),JF(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(YF)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,s=n.length;u<s;++u)if(t=n[u],t.name===HF&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(VF)}});var tE=Object.freeze({__proto__:null,force:XF});function nE(t,n){return t.parent===n.parent?1:2}function eE(t,n){return t+n.x}function rE(t,n){return Math.max(t,n.y)}function iE(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function oE(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=uE)):void 0===n&&(n=aE);for(var e,r,i,o,a,u=new fE(t),s=[u];e=s.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new fE(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(cE)}function aE(t){return t.children}function uE(t){return Array.isArray(t)?t[1]:null}function sE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function cE(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function fE(t){this.data=t,this.depth=this.height=0,this.parent=null}function lE(t){return null==t?null:hE(t)}function hE(t){if("function"!=typeof t)throw new Error;return t}function dE(){return 0}function mE(t){return function(){return t}}fE.prototype=oE.prototype={constructor:fE,count:function(){return this.eachAfter(iE)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++s,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)r.push(n=n.parent);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return oE(this).eachBefore(sE)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const pE=4294967296;function gE(t,n){var e,r;if(bE(n,t))return[n];for(e=0;e<t.length;++e)if(vE(n,t[e])&&bE(xE(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(vE(xE(t[e],t[r]),n)&&vE(xE(t[e],n),t[r])&&vE(xE(t[r],n),t[e])&&bE($E(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function vE(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function yE(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function bE(t,n){for(var e=0;e<n.length;++e)if(!yE(t,n[e]))return!1;return!0}function wE(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return xE(t[0],t[1]);case 3:return $E(t[0],t[1],t[2])}var n}function xE(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,s=o-e,c=a-r,f=u-i,l=Math.sqrt(s*s+c*c);return{x:(e+o+s/l*f)/2,y:(r+a+c/l*f)/2,r:(l+i+u)/2}}function $E(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,s=n.r,c=e.x,f=e.y,l=e.r,h=r-a,d=r-c,m=i-u,p=i-f,g=s-o,v=l-o,y=r*r+i*i-o*o,b=y-a*a-u*u+s*s,w=y-c*c-f*f+l*l,x=d*m-h*p,$=(m*w-p*b)/(2*x)-r,k=(p*g-m*v)/x,M=(d*b-h*w)/(2*x)-i,A=(h*v-d*g)/x,D=k*k+A*A-1,S=2*(o+$*k+M*A),F=$*$+M*M-o*o,E=-(Math.abs(D)>1e-6?(S+Math.sqrt(S*S-4*D*F))/(2*D):F/S);return{x:r+$+k*E,y:i+M+A*E,r:E}}function kE(t,n,e){var r,i,o,a,u=t.x-n.x,s=t.y-n.y,c=u*u+s*s;c?(i=n.r+e.r,a=t.r+e.r,(i*=i)>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*s,e.y=t.y-r*s+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*s,e.y=n.y+r*s+o*u)):(e.x=n.x+e.r,e.y=n.y)}function ME(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function AE(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function DE(t){this._=t,this.next=null,this.previous=null}function SE(t){return Math.sqrt(t.value)}function FE(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function EE(t,n,e){return function(r){if(i=r.children){var i,o,a,u=i.length,s=t(r)*n||0;if(s)for(o=0;o<u;++o)i[o].r+=s;if(a=function(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,s,c,f,l,h;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(e.x=-(r=t[1]).r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;kE(r,e,i=t[2]),e=new DE(e),r=new DE(r),i=new DE(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(s=3;s<o;++s){kE(e._,r._,i=t[s]),i=new DE(i),c=r.next,f=e.previous,l=r._.r,h=e._.r;do{if(l<=h){if(ME(c._,i._)){e.next=r=c,r.previous=e,--s;continue t}l+=c._.r,c=c.next}else{if(ME(f._,i._)){(e=f).next=r,r.previous=e,--s;continue t}h+=f._.r,f=f.previous}}while(c!==f.next);for(i.previous=e,i.next=r,e.next=r.previous=r=i,a=AE(e);(i=i.next)!==r;)(u=AE(i))<a&&(e=i,a=u);r=e.next}for(e=[r._],i=r;(i=i.next)!==r;)e.push(i._);for(i=function(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i<o;)e=t[i],r&&yE(r,e)?++i:(r=wE(a=gE(a,e)),i=0);return r}(e,n),s=0;s<o;++s)(e=t[s]).x-=i.x,e.y-=i.y;return i.r}(i,e),s)for(o=0;o<u;++o)i[o].r-=s;r.r=a+s}}}function NE(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function CE(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function OE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(r-n)/t.value;++u<s;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var _E={depth:-1},zE={},BE={};function TE(t){return t.id}function PE(t){return t.parentId}function jE(){var t,n=TE,e=PE;function r(r){var i,o,a,u,s,c,f,l,h=Array.from(r),d=n,m=e,p=new Map;if(null!=t){const n=h.map(((n,e)=>function(t){let n=(t=`${t}`).length;return LE(t,n-1)&&!LE(t,n-2)&&(t=t.slice(0,-1)),"/"===t[0]?t:`/${t}`}(t(n,e,r)))),e=n.map(RE),i=new Set(n).add("");for(const t of e)i.has(t)||(i.add(t),n.push(t),e.push(RE(t)),h.push(BE));d=(t,e)=>n[e],m=(t,n)=>e[n]}for(a=0,i=h.length;a<i;++a)c=h[a]=new fE(o=h[a]),null!=(f=d(o,a,r))&&(f+="")&&(l=c.id=f,p.set(l,p.has(l)?zE:c)),null!=(f=m(o,a,r))&&(f+="")&&(c.parent=f);for(a=0;a<i;++a)if(f=(c=h[a]).parent){if(!(s=p.get(f)))throw new Error("missing: "+f);if(s===zE)throw new Error("ambiguous: "+f);s.children?s.children.push(c):s.children=[c],c.parent=s}else{if(u)throw new Error("multiple roots");u=c}if(!u)throw new Error("no root");if(null!=t){for(;u.data===BE&&1===u.children.length;)u=u.children[0],--i;for(let t=h.length-1;t>=0&&(c=h[t]).data===BE;--t)c.data=null}if(u.parent=_E,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(cE),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(n=lE(t),r):n},r.parentId=function(t){return arguments.length?(e=lE(t),r):e},r.path=function(n){return arguments.length?(t=lE(n),r):t},r}function RE(t){let n=t.length;if(n<2)return"";for(;--n>1&&!LE(t,n););return t.slice(0,n)}function LE(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(!(1&e))return!0}return!1}function IE(t,n){return t.parent===n.parent?1:2}function qE(t){var n=t.children;return n?n[0]:t.t}function UE(t){var n=t.children;return n?n[n.length-1]:t.t}function WE(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function HE(t,n,e){return t.a.parent===n.parent?t.a:e}function GE(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function YE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(i-e)/t.value;++u<s;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}GE.prototype=Object.create(fE.prototype);var VE=(1+Math.sqrt(5))/2;function XE(t,n,e,r,i,o){for(var a,u,s,c,f,l,h,d,m,p,g,v=[],y=n.children,b=0,w=0,x=y.length,$=n.value;b<x;){s=i-e,c=o-r;do{f=y[w++].value}while(!f&&w<x);for(l=h=f,g=f*f*(p=Math.max(c/s,s/c)/($*t)),m=Math.max(h/g,g/l);w<x;++w){if(f+=u=y[w].value,u<l&&(l=u),u>h&&(h=u),g=f*f*p,(d=Math.max(h/g,g/l))>m){f-=u;break}m=d}v.push(a={value:f,dice:s<c,children:y.slice(b,w)}),a.dice?OE(a,e,r,i,$?r+=c*f/$:o):YE(a,e,r,$?e+=s*f/$:i,o),$-=f,b=w}return v}var JE=function t(n){function e(t,e,r,i,o){XE(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(VE),KE=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,s,c,f,l=-1,h=a.length,d=t.value;++l<h;){for(s=(u=a[l]).children,c=u.value=0,f=s.length;c<f;++c)u.value+=s[c].value;u.dice?OE(u,e,r,i,d?r+=(o-r)*u.value/d:o):YE(u,e,r,d?e+=(i-e)*u.value/d:i,o),d-=u.value}else t._squarify=a=XE(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(VE);function QE(t,n,e){const r={};return t.each((t=>{const i=t.data;e(i)&&(r[n(i)]=t)})),t.lookup=r,t}function ZE(t){_a.call(this,null,t)}ZE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const tN=t=>t.values;function nN(){const t=[],n={entries:t=>r(e(t,0),0),key:e=>(t.push(e),n)};function e(n,r){if(r>=t.length)return n;const i=n.length,o=t[r++],a={},u={};let s,c,f,l=-1;for(;++l<i;)s=o(c=n[l])+"",(f=a[s])?f.push(c):a[s]=[c];for(s in a)u[s]=e(a[s],r);return u}function r(n,e){if(++e>t.length)return n;const i=[];for(const t in n)i.push({key:t,values:r(n[t],e)});return i}return n}function eN(t){_a.call(this,null,t)}mt(ZE,_a,{transform(t,n){n.source||p("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),o=this.value;return(!o||r||n.changed())&&(o&&o.each((t=>{t.children&&ta(t.data)&&i.rem.push(t.data)})),this.value=o=oE({values:K(t.keys).reduce(((t,n)=>(t.key(n),t)),nN()).entries(i.source)},tN),e&&o.each((t=>{t.children&&(t=ra(t.data),i.add.push(t),i.source.push(t))})),QE(o,na,na)),i.source.root=o,i}});const rN=(t,n)=>t.parent===n.parent?1:2;mt(eN,_a,{transform(t,n){n.source&&n.source.root||p(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(ua(t.sort,(t=>t.data))),function(t,n,e){for(let r,i=0,o=n.length;i<o;++i)r=n[i],r in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?rN:x);try{this.value=e(i)}catch(t){p(t)}return i.each((t=>function(t,n,e){const r=t.data,i=n.length-1;for(let o=0;o<i;++o)r[e[o]]=t[n[o]];r[e[i]]=t.children?t.children.length:0}(t,r,o))),n.reflow(t.modified()).modifies(o).modifies("leaf")}});const iN=["x","y","r","depth","children"];function oN(t){eN.call(this,t)}oN.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:iN.length,default:iN}]},mt(oN,eN,{layout:function(){var t=null,n=1,e=1,r=dE;function i(i){const o=function(){let t=1;return()=>(t=(1664525*t+1013904223)%pE)/pE}();return i.x=n/2,i.y=e/2,t?i.eachBefore(FE(t)).eachAfter(EE(r,.5,o)).eachBefore(NE(1)):i.eachBefore(FE(SE)).eachAfter(EE(dE,1,o)).eachAfter(EE(r,i.r/Math.min(n,e),o)).eachBefore(NE(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=lE(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:mE(+t),i):r},i},params:["radius","size","padding"],fields:iN});const aN=["x0","y0","x1","y1","depth","children"];function uN(t){eN.call(this,t)}function sN(t){_a.call(this,null,t)}uN.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:aN.length,default:aN}]},mt(uN,eN,{layout:function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&OE(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(CE),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},params:["size","round","padding"],fields:aN}),sN.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},mt(sN,_a,{transform(t,n){n.source||p("Stratify transform requires an upstream data source.");let e=this.value;const r=t.modified(),i=n.fork(n.ALL).materialize(n.SOURCE),o=!e||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(e=i.source.length?QE(jE().id(t.key).parentId(t.parentKey)(i.source),t.key,$):QE(jE()([{}]),t.key,t.key)),i.source.root=this.value=e,i}});const cN={tidy:function(){var t=IE,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,o,a=new GE(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new GE(r[i],i)),e.parent=n;return(a.parent=new GE(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var c=i,f=i,l=i;i.eachBefore((function(t){t.x<c.x&&(c=t),t.x>f.x&&(f=t),t.depth>l.depth&&(l=t)}));var h=c===f?1:t(c,f)/2,d=h-c.x,m=n/(f.x+h+d),p=e/(l.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*m,t.y=t.depth*p}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,s=o.parent.children[0],c=o.m,f=a.m,l=u.m,h=s.m;u=UE(u),o=qE(o),u&&o;)s=qE(s),(a=UE(a)).a=n,(i=u.z+l-o.z-c+t(u._,o._))>0&&(WE(HE(u,n,r),n,i),c+=i,f+=i),l+=u.m,c+=o.m,h+=s.m,f+=a.m;u&&!UE(a)&&(a.t=u,a.m+=l-f),o&&!qE(s)&&(s.t=o,s.m+=c-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=nE,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(eE,0)/t.length}(e),n.y=function(t){return 1+t.reduce(rE,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,s)/2,f=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(f-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},fN=["x","y","depth","children"];function lN(t){eN.call(this,t)}function hN(t){_a.call(this,[],t)}lN.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:fN.length,default:fN}]},mt(lN,eN,{layout(t){const n=t||"tidy";if(ft(cN,n))return cN[n]();p("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:fN}),hN.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},mt(hN,_a,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),o={};return r||p("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,(t=>o[na(t)]=1)),r.each((t=>{const n=t.data,e=t.parent&&t.parent.data;e&&o[na(n)]&&o[na(e)]&&i.add.push(ra({source:e,target:n}))})),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,(t=>o[na(t)]=1)),e.forEach((t=>{(o[na(t.source)]||o[na(t.target)])&&i.mod.push(t)}))),i}});const dN={binary:function(t,n,e,r,i){var o,a,u=t.children,s=u.length,c=new Array(s+1);for(c[0]=a=o=0;o<s;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,s){if(n>=e-1){var f=u[n];return f.x0=i,f.y0=o,f.x1=a,void(f.y1=s)}for(var l=c[n],h=r/2+l,d=n+1,m=e-1;d<m;){var p=d+m>>>1;c[p]<h?d=p+1:m=p}h-c[d-1]<c[d]-h&&n+1<d&&--d;var g=c[d]-l,v=r-g;if(a-i>s-o){var y=r?(i*v+a*g)/r:a;t(n,d,g,i,o,y,s),t(d,e,v,y,o,a,s)}else{var b=r?(o*v+s*g)/r:s;t(n,d,g,i,o,a,b),t(d,e,v,i,b,a,s)}}(0,s,t.value,n,e,r,i)},dice:OE,slice:YE,slicedice:function(t,n,e,r,i){(1&t.depth?YE:OE)(t,n,e,r,i)},squarify:JE,resquarify:KE},mN=["x0","y0","x1","y1","depth","children"];function pN(t){eN.call(this,t)}pN.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:mN.length,default:mN}]},mt(pN,eN,{layout(){const t=function(){var t=JE,n=!1,e=1,r=1,i=[0],o=dE,a=dE,u=dE,s=dE,c=dE;function f(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(CE),t}function l(n){var e=i[n.depth],r=n.x0+e,f=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<f&&(f=h=(f+h)/2),n.x0=r,n.y0=f,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,f+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=s(n)-e)<f&&(f=h=(f+h)/2),t(n,r,f,l,h))}return f.round=function(t){return arguments.length?(n=!!t,f):n},f.size=function(t){return arguments.length?(e=+t[0],r=+t[1],f):[e,r]},f.tile=function(n){return arguments.length?(t=hE(n),f):t},f.padding=function(t){return arguments.length?f.paddingInner(t).paddingOuter(t):f.paddingInner()},f.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:mE(+t),f):o},f.paddingOuter=function(t){return arguments.length?f.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):f.paddingTop()},f.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:mE(+t),f):a},f.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:mE(+t),f):u},f.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:mE(+t),f):s},f.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:mE(+t),f):c},f}();return t.ratio=n=>{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{ft(dN,n)?t.tile(dN[n]):p("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:mN});var gN=Object.freeze({__proto__:null,nest:ZE,pack:oN,partition:uN,stratify:sN,tree:lN,treelinks:hN,treemap:pN});const vN=4278190080;function yN(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function bN(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;"group"===r?n.forEach((n=>{n.items.forEach((n=>bN(t,n.items,e)))})):Pb[r].draw(t,{items:e?n.map(wN):n})}function wN(t){const n=oa(t,{});return n.stroke&&0!==n.strokeOpacity||n.fill&&0!==n.fillOpacity?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const xN=31,$N=new Uint32Array(33),kN=new Uint32Array(33);kN[0]=0,$N[0]=~kN[0];for(let t=1;t<=32;++t)kN[t]=kN[t-1]<<1|1,$N[t]=~kN[t];function MN(t,n,e,r,i,o){let a=e/2;return t-a<0||t+a>i||n-(a=r/2)<0||n+a>o}function AN(t,n,e,r,i,o,a,u){const s=i*o/(2*r),c=t(n-s),f=t(n+s),l=t(e-(o/=2)),h=t(e+o);return a.outOfBounds(c,l,f,h)||a.getRange(c,l,f,h)||u&&u.getRange(c,l,f,h)}const DN=[-1,-1,1,1],SN=[-1,1,-1,1],FN=["right","center","left"],EN=["bottom","middle","top"];function NN(t,n,e,r,i,o,a,u,s,c,f,l){return!(i.outOfBounds(t,e,n,r)||(l&&o||i).getRange(t,e,n,r))}const CN={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},ON={naive:function(t,n,e,r){const i=t.width,o=t.height;return function(t){const n=t.datum.datum.items[r].items,e=n.length,a=t.datum.fontSize,u=vb.width(t.datum,t.datum.text);let s,c,f,l,h,d,m,p=0;for(let r=0;r<e;++r)s=n[r].x,f=n[r].y,c=void 0===n[r].x2?s:n[r].x2,l=void 0===n[r].y2?f:n[r].y2,h=(s+c)/2,d=(f+l)/2,m=Math.abs(c-s+l-f),m>=p&&(p=m,t.x=h,t.y=d);return h=u/2,d=a/2,s=t.x-h,c=t.x+h,f=t.y-d,l=t.y+d,t.align="center",s<0&&c<=i?t.align="left":0<=s&&i<c&&(t.align="right"),t.baseline="middle",f<0&&l<=o?t.baseline="top":0<=f&&o<l&&(t.baseline="bottom"),!0}},"reduced-search":function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1];function s(n,e,r,s,c){const f=t.invert(n),l=t.invert(e);let h,d=r,m=o;if(!MN(f,l,s,c,i,o)&&!AN(t,f,l,c,s,d,a,u)&&!AN(t,f,l,c,s,c,a,null)){for(;m-d>=1;)h=(d+m)/2,AN(t,f,l,c,s,h,a,u)?m=h:d=h;if(d>r)return[f,l,d,!0]}}return function(n){const u=n.datum.datum.items[r].items,c=u.length,f=n.datum.fontSize,l=vb.width(n.datum,n.datum.text);let h,d,m,p,g,v,y,b,w,x,$,k,M,A,D,S,F,E=e?f:0,N=!1,C=!1,O=0;for(let r=0;r<c;++r){for(h=u[r].x,m=u[r].y,d=void 0===u[r].x2?h:u[r].x2,p=void 0===u[r].y2?m:u[r].y2,h>d&&(F=h,h=d,d=F),m>p&&(F=m,m=p,p=F),w=t(h),$=t(d),x=~~((w+$)/2),k=t(m),A=t(p),M=~~((k+A)/2),y=x;y>=w;--y)for(b=M;b>=k;--b)S=s(y,b,E,l,f),S&&([n.x,n.y,E,N]=S);for(y=x;y<=$;++y)for(b=M;b<=A;++b)S=s(y,b,E,l,f),S&&([n.x,n.y,E,N]=S);N||e||(D=Math.abs(d-h+p-m),g=(h+d)/2,v=(m+p)/2,D>=O&&!MN(g,v,l,f,i,o)&&!AN(t,g,v,f,l,f,a,null)&&(O=D,n.x=g,n.y=v,C=!0))}return!(!N&&!C||(g=l/2,v=f/2,a.setRange(t(n.x-g),t(n.y-v),t(n.x+g),t(n.y+v)),n.align="center",n.baseline="middle",0))}},floodfill:function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=t.bitmap();return function(n){const c=n.datum.datum.items[r].items,f=c.length,l=n.datum.fontSize,h=vb.width(n.datum,n.datum.text),d=[];let m,p,g,v,y,b,w,x,$,k,M,A,D=e?l:0,S=!1,F=!1,E=0;for(let r=0;r<f;++r){for(m=c[r].x,g=c[r].y,p=void 0===c[r].x2?m:c[r].x2,v=void 0===c[r].y2?g:c[r].y2,d.push([t((m+p)/2),t((g+v)/2)]);d.length;)if([w,x]=d.pop(),!(a.get(w,x)||u.get(w,x)||s.get(w,x))){s.set(w,x);for(let t=0;t<4;++t)y=w+DN[t],b=x+SN[t],s.outOfBounds(y,b,y,b)||d.push([y,b]);if(y=t.invert(w),b=t.invert(x),$=D,k=o,!MN(y,b,h,l,i,o)&&!AN(t,y,b,l,h,$,a,u)&&!AN(t,y,b,l,h,l,a,null)){for(;k-$>=1;)M=($+k)/2,AN(t,y,b,l,h,M,a,u)?k=M:$=M;$>D&&(n.x=y,n.y=b,D=$,S=!0)}}S||e||(A=Math.abs(p-m+v-g),y=(m+p)/2,b=(g+v)/2,A>=E&&!MN(y,b,h,l,i,o)&&!AN(t,y,b,l,h,l,a,null)&&(E=A,n.x=y,n.y=b,F=!0))}return!(!S&&!F||(y=h/2,b=l/2,a.setRange(t(n.x-y),t(n.y-b),t(n.x+y),t(n.y+b)),n.align="center",n.baseline="middle",0))}}};function _N(t,n,e,r,i,o,a,u,s,c,f){if(!t.length)return t;const l=Math.max(r.length,i.length),h=function(t,n){const e=new Float64Array(n),r=t.length;for(let n=0;n<r;++n)e[n]=t[n]||0;for(let t=r;t<n;++t)e[t]=e[r-1];return e}(r,l),d=function(t,n){const e=new Int8Array(n),r=t.length;for(let n=0;n<r;++n)e[n]|=CN[t[n]];for(let t=r;t<n;++t)e[t]=e[r-1];return e}(i,l),m=(w=t[0].datum)&&w.mark&&w.mark.marktype,p="group"===m&&t[0].datum.items[s].marktype,g="area"===p,v=function(t,n,e,r){const i=t=>[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===n?t=>{const n=t.datum.items[r].items;return i(n.length?n["start"===e?0:n.length-1]:{x:NaN,y:NaN})}:t=>{const n=t.datum.bounds;return[n.x1,(n.x1+n.x2)/2,n.x2,n.y1,(n.y1+n.y2)/2,n.y2]}:i}(m,p,u,s),y=null===c||c===1/0,b=g&&"naive"===f;var w;let x=-1,$=-1;const k=t.map((t=>{const n=y?vb.width(t,t.text):void 0;return x=Math.max(x,n),$=Math.max($,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v(t),textWidth:n}}));c=null===c||c===1/0?Math.max(x,$)+Math.max(...r):c;const M=function(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),o=~~((n+2*e+r)/r),a=t=>~~((t+e)/r);return a.invert=t=>t*r-e,a.bitmap=()=>function(t,n){const e=new Uint32Array(~~((t*n+32)/32));function r(t,n){e[t]|=n}function i(t,n){e[t]&=n}return{array:e,get:(n,r)=>{const i=r*t+n;return e[i>>>5]&1<<(i&xN)},set:(n,e)=>{const i=e*t+n;r(i>>>5,1<<(i&xN))},clear:(n,e)=>{const r=e*t+n;i(r>>>5,~(1<<(r&xN)))},getRange:(n,r,i,o)=>{let a,u,s,c,f=o;for(;f>=r;--f)if(a=f*t+n,u=f*t+i,s=a>>>5,c=u>>>5,s===c){if(e[s]&$N[a&xN]&kN[1+(u&xN)])return!0}else{if(e[s]&$N[a&xN])return!0;if(e[c]&kN[1+(u&xN)])return!0;for(let t=s+1;t<c;++t)if(e[t])return!0}return!1},setRange:(n,e,i,o)=>{let a,u,s,c,f;for(;e<=o;++e)if(a=e*t+n,u=e*t+i,s=a>>>5,c=u>>>5,s===c)r(s,$N[a&xN]&kN[1+(u&xN)]);else for(r(s,$N[a&xN]),r(c,kN[1+(u&xN)]),f=s+1;f<c;++f)r(f,4294967295)},clearRange:(n,e,r,o)=>{let a,u,s,c,f;for(;e<=o;++e)if(a=e*t+n,u=e*t+r,s=a>>>5,c=u>>>5,s===c)i(s,kN[a&xN]|$N[1+(u&xN)]);else for(i(s,kN[a&xN]),i(c,$N[1+(u&xN)]),f=s+1;f<c;++f)i(f,0)},outOfBounds:(e,r,i,o)=>e<0||r<0||o>=n||i>=t}}(i,o),a.ratio=r,a.padding=e,a.width=t,a.height=n,a}(n[0],n[1],c);let A;if(!b){e&&k.sort(((t,n)=>e(t.datum,n.datum)));let n=!1;for(let t=0;t<d.length&&!n;++t)n=5===d[t]||h[t]<0;const r=(m&&a||g)&&t.map((t=>t.datum));A=o.length||r?function(t,n,e,r,i){const o=t.width,a=t.height,u=r||i,s=pf(o,a).getContext("2d"),c=pf(o,a).getContext("2d"),f=u&&pf(o,a).getContext("2d");e.forEach((t=>bN(s,t,!1))),bN(c,n,!1),u&&bN(f,n,!0);const l=yN(s,o,a),h=yN(c,o,a),d=u&&yN(f,o,a),m=t.bitmap(),p=u&&t.bitmap();let g,v,y,b,w,x,$,k;for(v=0;v<a;++v)for(g=0;g<o;++g)w=v*o+g,x=l[w]&vN,k=h[w]&vN,$=u&&d[w]&vN,(x||$||k)&&(y=t(g),b=t(v),i||!x&&!k||m.set(y,b),u&&(x||$)&&p.set(y,b));return[m,p]}(M,r||[],o,n,g):function(t,n){const e=t.bitmap();return(n||[]).forEach((n=>e.set(t(n.boundary[0]),t(n.boundary[3])))),[e,void 0]}(M,a&&k)}const D=g?ON[f](M,A,a,s):function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=r.length;return function(n){const c=n.boundary,f=n.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>o)return!1;let l,h,d,m,p,g,v,y,b,w,x,$,k,M,A,D=n.textWidth??0;for(let i=0;i<s;++i){if(l=(3&e[i])-1,h=(e[i]>>>2&3)-1,d=0===l&&0===h||r[i]<0,m=l&&h?Math.SQRT1_2:1,p=r[i]<0?-1:1,g=c[1+l]+r[i]*l*m,x=c[4+h]+p*f*h/2+r[i]*h*m,y=x-f/2,b=x+f/2,$=t(g),M=t(y),A=t(b),!D){if(!NN($,$,M,A,a,u,0,0,0,0,0,d))continue;D=vb.width(n.datum,n.datum.text)}if(w=g+p*D*l/2,g=w-D/2,v=w+D/2,$=t(g),k=t(v),NN($,k,M,A,a,u,0,0,0,0,0,d))return n.x=l?l*p<0?v:g:w,n.y=h?h*p<0?b:y:x,n.align=FN[l*p+1],n.baseline=EN[h*p+1],a.setRange($,M,k,A),!0}return!1}}(M,A,d,h);return k.forEach((t=>t.opacity=+D(t))),k}const zN=["x","y","opacity","align","baseline"],BN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function TN(t){_a.call(this,null,t)}TN.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:BN},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:zN.length,default:zN}]},mt(TN,_a,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(){const e=t.sort;return Z(e)&&n.modified(e.fields)}()))return;t.size&&2===t.size.length||p("Size parameter should be specified as a [width, height] array.");const r=t.as||zN;return _N(n.materialize(n.SOURCE).source||[],t.size,t.sort,K(null==t.offset?1:t.offset),K(t.anchor||BN),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const n=t.datum;n[r[0]]=t.x,n[r[1]]=t.y,n[r[2]]=t.opacity,n[r[3]]=t.align,n[r[4]]=t.baseline})),n.reflow(e).modifies(r)}});var PN=Object.freeze({__proto__:null,label:TN});function jN(t,n){var e,r,i,o,a,u,s=[],c=function(t){return t(o)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}function RN(t){_a.call(this,null,t)}RN.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},mt(RN,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=jN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(f),o=i.length,a=t.as||[f(t.x),f(t.y)],u=[];r.forEach((n=>{ku(n,t.x,t.y,t.bandwidth||.3).forEach((t=>{const e={};for(let t=0;t<o;++t)e[i[t]]=n.dims[t];e[a[0]]=t[0],e[a[1]]=t[1],u.push(ra(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});const LN={constant:lu,linear:gu,log:vu,exp:yu,pow:bu,quad:wu,poly:xu};function IN(t){_a.call(this,null,t)}IN.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(LN)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},mt(IN,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=jN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(f),o=t.method||"linear",a=null==t.order?3:t.order,u=((t,n)=>"poly"===t?n:"quad"===t?2:1)(o,a),s=t.as||[f(t.x),f(t.y)],c=LN[o],l=[];let h=t.extent;ft(LN,o)||p("Invalid regression method: "+o),null!=h&&"log"===o&&h[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),h=null),r.forEach((e=>{if(e.length<=u)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(e,t.x,t.y,a);if(t.params)return void l.push(ra({keys:e.dims,coef:r.coef,rSquared:r.rSquared}));const f=h||st(e,t.x),d=t=>{const n={};for(let t=0;t<i.length;++t)n[i[t]]=e.dims[t];n[s[0]]=t[0],n[s[1]]=t[1],l.push(ra(n))};"linear"===o||"constant"===o?f.forEach((t=>d([t,r.predict(t)]))):Su(r.predict,f,25,200).forEach(d)})),this.value&&(e.rem=this.value),this.value=e.add=e.source=l}return e}});var qN=Object.freeze({__proto__:null,loess:RN,regression:IN});const UN=134217729;function WN(t,n,e,r,i){let o,a,u,s,c=n[0],f=r[0],l=0,h=0;f>c==f>-c?(o=c,c=n[++l]):(o=f,f=r[++h]);let d=0;if(l<t&&h<e)for(f>c==f>-c?(a=c+o,u=o-(a-c),c=n[++l]):(a=f+o,u=o-(a-f),f=r[++h]),o=a,0!==u&&(i[d++]=u);l<t&&h<e;)f>c==f>-c?(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++l]):(a=o+f,s=a-o,u=o-(a-s)+(f-s),f=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l<t;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++l],o=a,0!==u&&(i[d++]=u);for(;h<e;)a=o+f,s=a-o,u=o-(a-s)+(f-s),f=r[++h],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function HN(t){return new Float64Array(t)}const GN=HN(4),YN=HN(8),VN=HN(12),XN=HN(16),JN=HN(4);function KN(t,n,e,r,i,o){const a=(n-o)*(e-i),u=(t-i)*(r-o),s=a-u,c=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*c?s:-function(t,n,e,r,i,o,a){let u,s,c,f,l,h,d,m,p,g,v,y,b,w,x,$,k,M;const A=t-i,D=e-i,S=n-o,F=r-o;w=A*F,h=UN*A,d=h-(h-A),m=A-d,h=UN*F,p=h-(h-F),g=F-p,x=m*g-(w-d*p-m*p-d*g),$=S*D,h=UN*S,d=h-(h-S),m=S-d,h=UN*D,p=h-(h-D),g=D-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,GN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,GN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,GN[2]=y-(M-l)+(v-l),GN[3]=M;let E=function(t,n){let e=n[0];for(let t=1;t<4;t++)e+=n[t];return e}(0,GN),N=22204460492503146e-32*a;if(E>=N||-E>=N)return E;if(l=t-A,u=t-(A+l)+(l-i),l=e-D,c=e-(D+l)+(l-i),l=n-S,s=n-(S+l)+(l-o),l=r-F,f=r-(F+l)+(l-o),0===u&&0===s&&0===c&&0===f)return E;if(N=11093356479670487e-47*a+33306690738754706e-32*Math.abs(E),E+=A*f+F*u-(S*c+D*s),E>=N||-E>=N)return E;w=u*F,h=UN*u,d=h-(h-u),m=u-d,h=UN*F,p=h-(h-F),g=F-p,x=m*g-(w-d*p-m*p-d*g),$=s*D,h=UN*s,d=h-(h-s),m=s-d,h=UN*D,p=h-(h-D),g=D-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const C=WN(4,GN,4,JN,YN);w=A*f,h=UN*A,d=h-(h-A),m=A-d,h=UN*f,p=h-(h-f),g=f-p,x=m*g-(w-d*p-m*p-d*g),$=S*c,h=UN*S,d=h-(h-S),m=S-d,h=UN*c,p=h-(h-c),g=c-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const O=WN(C,YN,4,JN,VN);w=u*f,h=UN*u,d=h-(h-u),m=u-d,h=UN*f,p=h-(h-f),g=f-p,x=m*g-(w-d*p-m*p-d*g),$=s*c,h=UN*s,d=h-(h-s),m=s-d,h=UN*c,p=h-(h-c),g=c-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const _=WN(O,VN,4,JN,XN);return XN[_-1]}(t,n,e,r,i,o,c)}const QN=Math.pow(2,-52),ZN=new Uint32Array(512);class tC{static from(t,n=aC,e=uC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=n(r),i[2*o+1]=e(r)}return new tC(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,c=-1/0;for(let n=0;n<o;n++){const e=t[2*n],r=t[2*n+1];e<a&&(a=e),r<u&&(u=r),e>s&&(s=e),r>c&&(c=r),this._ids[n]=n}const f=(a+s)/2,l=(u+c)/2;let h,d,m;for(let n=0,e=1/0;n<o;n++){const r=nC(f,l,t[2*n],t[2*n+1]);r<e&&(h=n,e=r)}const p=t[2*h],g=t[2*h+1];for(let n=0,e=1/0;n<o;n++){if(n===h)continue;const r=nC(p,g,t[2*n],t[2*n+1]);r<e&&r>0&&(d=n,e=r)}let v=t[2*d],y=t[2*d+1],b=1/0;for(let n=0;n<o;n++){if(n===h||n===d)continue;const e=rC(p,g,v,y,t[2*n],t[2*n+1]);e<b&&(m=n,b=e)}let w=t[2*m],x=t[2*m+1];if(b===1/0){for(let n=0;n<o;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];iC(this._ids,this._dists,0,o-1);const n=new Uint32Array(o);let e=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(n[e++]=i,r=o)}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(KN(p,g,v,y,w,x)<0){const t=d,n=v,e=y;d=m,v=w,y=x,m=t,w=n,x=e}const $=function(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,f=a*a+u*u,l=s*s+c*c,h=.5/(a*c-u*s);return{x:t+(c*f-u*l)*h,y:n+(a*l-s*f)*h}}(p,g,v,y,w,x);this._cx=$.x,this._cy=$.y;for(let n=0;n<o;n++)this._dists[n]=nC(t[2*n],t[2*n+1],$.x,$.y);iC(this._ids,this._dists,0,o-1),this._hullStart=h;let k=3;e[h]=n[m]=d,e[d]=n[h]=m,e[m]=n[d]=h,r[h]=0,r[d]=1,r[m]=2,i.fill(-1),i[this._hashKey(p,g)]=h,i[this._hashKey(v,y)]=d,i[this._hashKey(w,x)]=m,this.trianglesLen=0,this._addTriangle(h,d,m,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const s=this._ids[u],c=t[2*s],f=t[2*s+1];if(u>0&&Math.abs(c-o)<=QN&&Math.abs(f-a)<=QN)continue;if(o=c,a=f,s===h||s===d||s===m)continue;let l=0;for(let t=0,n=this._hashKey(c,f);t<this._hashSize&&(l=i[(n+t)%this._hashSize],-1===l||l===e[l]);t++);l=n[l];let p,g=l;for(;p=e[g],KN(c,f,t[2*g],t[2*g+1],t[2*p],t[2*p+1])>=0;)if(g=p,g===l){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,s,e[g],-1,-1,r[g]);r[s]=this._legalize(v+2),r[g]=v,k++;let y=e[g];for(;p=e[y],KN(c,f,t[2*y],t[2*y+1],t[2*p],t[2*p+1])<0;)v=this._addTriangle(y,s,p,r[s],-1,r[y]),r[s]=this._legalize(v+2),e[y]=y,k--,y=p;if(g===l)for(;p=n[g],KN(c,f,t[2*p],t[2*p+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(p,s,g,-1,r[g],r[p]),this._legalize(v+2),r[p]=v,e[g]=g,k--,g=p;this._hullStart=n[s]=g,e[g]=n[y]=s,e[s]=y,i[this._hashKey(c,f)]=s,i[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(k);for(let t=0,n=this._hullStart;t<k;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=ZN[--i];continue}const s=a-a%3,c=s+(a+2)%3,f=n[o],l=n[t],h=n[u+(t+1)%3],d=n[c];if(eC(r[2*f],r[2*f+1],r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1])){n[t]=d,n[a]=f;const r=e[c];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===c){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,c),i<ZN.length&&(ZN[i++]=s+(a+1)%3)}else{if(0===i)break;t=ZN[--i]}}return o}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=e,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function nC(t,n,e,r){const i=t-e,o=n-r;return i*i+o*o}function eC(t,n,e,r,i,o,a,u){const s=t-a,c=n-u,f=e-a,l=r-u,h=i-a,d=o-u,m=f*f+l*l,p=h*h+d*d;return s*(l*p-m*d)-c*(f*p-m*h)+(s*s+c*c)*(f*d-l*h)<0}function rC(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,f=a*a+u*u,l=s*s+c*c,h=.5/(a*c-u*s),d=(c*f-u*l)*h,m=(a*l-s*f)*h;return d*d+m*m}function iC(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],o=n[r];let a=i-1;for(;a>=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;oC(t,e+r>>1,i),n[t[e]]>n[t[r]]&&oC(t,e,r),n[t[i]]>n[t[r]]&&oC(t,i,r),n[t[e]]>n[t[i]]&&oC(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]<u);do{o--}while(n[t[o]]>u);if(o<i)break;oC(t,i,o)}t[e+1]=t[o],t[o]=a,r-i+1>=o-e?(iC(t,n,i,r),iC(t,n,e,o-1)):(iC(t,n,e,o-1),iC(t,n,i,r))}}function oC(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function aC(t){return t[0]}function uC(t){return t[1]}const sC=1e-6;class cC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>sC||Math.abs(this._y1-i)>sC)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class fC{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let lC=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let r,u,s=0,c=0,f=e.length;s<f;s+=3,c+=2){const f=2*e[s],l=2*e[s+1],h=2*e[s+2],d=t[f],m=t[f+1],p=t[h],g=t[h+1],v=t[l]-d,y=t[l+1]-m,b=p-d,w=g-m,x=2*(v*w-y*b);if(Math.abs(x)<1e-9){if(void 0===i){i=o=0;for(const e of n)i+=t[2*e],o+=t[2*e+1];i/=n.length,o/=n.length}const e=1e9*Math.sign((i-d)*w-(o-m)*b);r=(d+p)/2-e*w,u=(m+g)/2+e*b}else{const t=1/x,n=v*v+y*y,e=b*b+w*w;r=d+(w*n-y*e)*t,u=m+(v*e-b*n)*t}a[c]=r,a[c+1]=u}let u,s,c,f=n[n.length-1],l=4*f,h=t[2*f],d=t[2*f+1];r.fill(0);for(let e=0;e<n.length;++e)f=n[e],u=l,s=h,c=d,l=4*f,h=t[2*f],d=t[2*f+1],r[u+2]=r[l]=c-d,r[u+3]=r[l+1]=h-s}render(t){const n=null==t?t=new cC:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),a=2*Math.floor(r/3);this._renderSegment(o[i],o[i+1],o[a],o[a+1],t)}let u,s=i[i.length-1];for(let n=0;n<i.length;++n){u=s,s=i[n];const e=2*Math.floor(r[s]/3),c=o[e],f=o[e+1],l=4*u,h=this._project(c,f,a[l+2],a[l+3]);h&&this._renderSegment(c,f,h[0],h[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new cC:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new cC:void 0,r=this._clip(t);if(null===r||!r.length)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(t.index=n,yield t)}}cellPolygon(t){const n=new fC;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let o;const a=this._regioncode(t,n),u=this._regioncode(e,r);0===a&&0===u?(i.moveTo(t,n),i.lineTo(e,r)):(o=this._clipSegment(t,n,e,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}*neighbors(t){const n=this._clip(t);if(n)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let r=0,i=n.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(n[r]===t[o]&&n[r+1]===t[o+1]&&n[(r+2)%i]===t[(o+a-2)%a]&&n[(r+3)%i]===t[(o+a-1)%a]){yield e;break t}}}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,o=e[t];if(-1===o)return null;const a=[];let u=o;do{const e=Math.floor(u/3);if(a.push(n[2*e],n[2*e+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return this._simplify(e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const e=n.length;let r,i,o,a,u=null,s=n[e-2],c=n[e-1],f=this._regioncode(s,c),l=0;for(let h=0;h<e;h+=2)if(r=s,i=c,s=n[h],c=n[h+1],o=f,f=this._regioncode(s,c),0===o&&0===f)a=l,l=0,u?u.push(s,c):u=[s,c];else{let n,e,h,d,m;if(0===o){if(null===(n=this._clipSegment(r,i,s,c,o,f)))continue;[e,h,d,m]=n}else{if(null===(n=this._clipSegment(s,c,r,i,f,o)))continue;[d,m,e,h]=n,a=l,l=this._edgecode(e,h),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(e,h):u=[e,h]}a=l,l=this._edgecode(d,m),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(d,m):u=[d,m]}if(u)a=l,l=this._edgecode(u[0],u[1]),a&&l&&this._edge(t,a,l,u,u.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return u}_clipSegment(t,n,e,r,i,o){const a=i<o;for(a&&([t,n,e,r,i,o]=[e,r,t,n,o,i]);;){if(0===i&&0===o)return a?[e,r,t,n]:[t,n,e,r];if(i&o)return null;let u,s,c=i||o;8&c?(u=t+(e-t)*(this.ymax-n)/(r-n),s=this.ymax):4&c?(u=t+(e-t)*(this.ymin-n)/(r-n),s=this.ymin):2&c?(s=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(s=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?i=this._regioncode(t=u,n=s):o=this._regioncode(e=u,r=s)}}_clipInfinite(t,n,e,r,i,o){let a,u=Array.from(n);if((a=this._project(u[0],u[1],e,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let n,e=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);e<r;e+=2)n=i,i=this._edgecode(u[e],u[e+1]),n&&i&&(e=this._edge(t,n,i,u,e),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,n,e,r,i){for(;n!==e;){let e,o;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,o=this.ymin}r[i]===e&&r[i+1]===o||!this.contains(t,e,o)||(r.splice(i,0,e,o),i+=2)}return i}_project(t,n,e,r){let i,o,a,u=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<u&&(a=this.ymin,o=t+(u=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<u&&(a=this.ymax,o=t+(u=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<u&&(o=this.xmax,a=n+(u=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<u&&(o=this.xmin,a=n+(u=i)*r)}return[o,a]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const e=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[e]&&t[e]===t[r]||t[n+1]===t[e+1]&&t[e+1]===t[r+1])&&(t.splice(e,2),n-=2)}t.length||(t=null)}return t}};const hC=2*Math.PI,dC=Math.pow;function mC(t){return t[0]}function pC(t){return t[1]}function gC(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class vC{static from(t,n=mC,e=pC,r){return new vC("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=n.call(r,i,a,t),o[2*a+1]=e.call(r,i,a,t)}return o}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const o of t)yield n.call(r,o,i,t),yield e.call(r,o,i,t),++i}(t,n,e,r)))}constructor(t){this._delaunator=new tC(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],o=2*n[t+2];if((e[o]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[o+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t<e;++t){const e=gC(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new tC(n)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==o[n]||(o[n]=t)}for(let t=0,n=r.length;t<n;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new lC(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n<a.length-1&&(yield a[n+1]))}const u=n[t];if(-1===u)return;let s=u,c=-1;do{if(yield c=o[s],s=s%3==2?s-2:s+1,o[s]!==t)return;if(s=i[s],-1===s){const n=e[(r[t]+1)%e.length];return void(n!==c&&(yield n))}}while(s!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let c=t,f=dC(n-s[2*t],2)+dC(e-s[2*t+1],2);const l=r[t];let h=l;do{let r=u[h];const l=dC(n-s[2*r],2)+dC(e-s[2*r+1],2);if(l<f&&(f=l,c=r),h=h%3==2?h-2:h+1,u[h]!==t)break;if(h=a[h],-1===h){if(h=i[(o[t]+1)%i.length],h!==r&&dC(n-s[2*h],2)+dC(e-s[2*h+1],2)<f)return h;break}}while(h!==l);return c}render(t){const n=null==t?t=new cC:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,o=r.length;n<o;++n){const o=r[n];if(o<n)continue;const a=2*i[n],u=2*i[o];t.moveTo(e[a],e[a+1]),t.lineTo(e[u],e[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){void 0!==n||t&&"function"==typeof t.moveTo||(n=t,t=null),n=null==n?2:+n;const e=null==t?t=new cC:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],o=r[e+1];t.moveTo(i+n,o),t.arc(i,o,n,0,hC)}return e&&e.value()}renderHull(t){const n=null==t?t=new cC:void 0,{hull:e,points:r}=this,i=2*e[0],o=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<o;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new fC;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new cC:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new fC;return this.renderTriangle(t,n),n.value()}}function yC(t){_a.call(this,null,t)}yC.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const bC=[-1e5,-1e5,1e5,1e5];function wC(t){const n=t[0][0],e=t[0][1];let r=t.length-1;for(;t[r][0]===n&&t[r][1]===e;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}mt(yC,_a,{transform(t,n){const e=t.as||"path",r=n.source;if(!r||!r.length)return n;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:bC;const o=this.value=vC.from(r,t.x,t.y).voronoi(i);for(let t=0,n=r.length;t<n;++t){const n=o.cellPolygon(t);r[t][e]=!n||2===(a=n).length&&a[0][0]===a[1][0]&&a[0][1]===a[1][1]?null:wC(n)}var a;return n.reflow(t.modified()).modifies(e)}});var xC=Object.freeze({__proto__:null,voronoi:yC}),$C=Math.PI/180,kC=2048;function MC(t,n,e,r){if(!n.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,kC/o);var a,u,s,c,f,l=0,h=0,d=0,m=e.length;for(--r;++r<m;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/o)+"px "+n.font,a=i.measureText(n.text+"m").width*o,s=n.size<<1,n.rotate){var p=Math.sin(n.rotate*$C),g=Math.cos(n.rotate*$C),v=a*g,y=a*p,b=s*g,w=s*p;a=Math.max(Math.abs(v+w),Math.abs(v-w))+31>>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>d&&(d=s),l+a>=2048&&(l=0,h+=d,d=0),h+s>=kC)break;i.translate((l+(a>>1))/o,(h+(s>>1))/o),n.rotate&&i.rotate(n.rotate*$C),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=a,n.height=s,n.xoff=l,n.yoff=h,n.x1=a>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,l+=a}for(var x=i.getImageData(0,0,2048/o,kC/o).data,$=[];--r>=0;)if((n=e[r]).hasText){for(u=(a=n.width)>>5,s=n.y1-n.y0,c=0;c<s*u;c++)$[c]=0;if(null==(l=n.xoff))return;h=n.yoff;var k=0,M=-1;for(f=0;f<s;f++){for(c=0;c<a;c++){var A=x[2048*(h+f)+(l+c)<<2]?1<<31-c%32:0;$[u*f+(c>>5)]|=A,k|=A}k?M=f:(n.y0++,s--,f--,h++)}n.y1=n.y0+M,n.sprite=$.slice(0,(n.y1-n.y0)*u)}}}function AC(t,n,e){for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,c=t.y1-t.y0,f=(t.y+t.y0)*(e>>=5)+(a>>5),l=0;l<c;l++){r=0;for(var h=0;h<=o;h++)if((r<<s|(h<o?(r=i[l*o+h])>>>u:0))&n[f+h])return!0;f+=e}return!1}function DC(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function SC(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0<n[1].x&&t.y+t.y1>n[0].y&&t.y+t.y0<n[1].y}function FC(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function EC(t){return"function"==typeof t?t:function(){return t}}var NC={archimedean:FC,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}};const CC=["x","y","font","fontSize","fontStyle","fontWeight","angle"],OC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function _C(t){_a.call(this,function(){var t,n,e,r,i,o,a,u=[256,256],s=FC,c=[],f=Math.random,l={};function h(t,n,e){for(var r,i,o,a=n.x,c=n.y,l=Math.hypot(u[0],u[1]),h=s(u),d=f()<.5?1:-1,m=-d;(r=h(m+=d))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=l));)if(n.x=a+i,n.y=c+o,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>u[0]||n.y+n.y1>u[1])&&(!e||!AC(n,t,u[0]))&&(!e||SC(n,e))){for(var p,g=n.sprite,v=n.width>>5,y=u[0]>>5,b=n.x-(v<<4),w=127&b,x=32-w,$=n.y1-n.y0,k=(n.y+n.y0)*y+(b>>5),M=0;M<$;M++){p=0;for(var A=0;A<=v;A++)t[k+A]|=p<<x|(A<v?(p=g[M*v+A])>>>w:0);k+=y}return n.sprite=null,!0}return!1}return l.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/n,t.height=kC/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(pf()),l=function(t){for(var n=[],e=-1;++e<t;)n[e]=0;return n}((u[0]>>5)*u[1]),d=null,m=c.length,p=-1,g=[],v=c.map((u=>({text:t(u),font:n(u),style:r(u),weight:i(u),rotate:o(u),size:~~(e(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,n)=>n.size-t.size));++p<m;){var y=v[p];y.x=u[0]*(f()+.5)>>1,y.y=u[1]*(f()+.5)>>1,MC(s,y,v,p),y.hasText&&h(l,y,d)&&(g.push(y),d?DC(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},l.words=function(t){return arguments.length?(c=t,l):c},l.size=function(t){return arguments.length?(u=[+t[0],+t[1]],l):u},l.font=function(t){return arguments.length?(n=EC(t),l):n},l.fontStyle=function(t){return arguments.length?(r=EC(t),l):r},l.fontWeight=function(t){return arguments.length?(i=EC(t),l):i},l.rotate=function(t){return arguments.length?(o=EC(t),l):o},l.text=function(n){return arguments.length?(t=EC(n),l):t},l.spiral=function(t){return arguments.length?(s=NC[t]||t,l):s},l.fontSize=function(t){return arguments.length?(e=EC(t),l):e},l.padding=function(t){return arguments.length?(a=EC(t),l):a},l.random=function(t){return arguments.length?(f=t,l):f},l}(),t)}_C.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:CC}]},mt(_C,_a,{transform(t,n){!t.size||t.size[0]&&t.size[1]||p("Wordcloud size dimensions must be non-zero.");const e=t.modified();if(!(e||n.changed(n.ADD_REM)||OC.some((function(e){const r=t[e];return Z(r)&&n.modified(r.fields)}))))return;const r=n.materialize(n.SOURCE).source,i=this.value,o=t.as||CC;let a,u=t.fontSize||14;if(Z(u)?a=t.fontSizeRange:u=ot(u),a){const t=u,n=ng("sqrt")().domain(st(r,t)).range(a);u=e=>n(t(e))}r.forEach((t=>{t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0}));const s=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(u).random(qa).layout(),c=i.size(),f=c[0]>>1,l=c[1]>>1,h=s.length;for(let t,n,e=0;e<h;++e)t=s[e],n=t.datum,n[o[0]]=t.x+f,n[o[1]]=t.y+l,n[o[2]]=t.font,n[o[3]]=t.size,n[o[4]]=t.style,n[o[5]]=t.weight,n[o[6]]=t.rotate;return n.reflow(e).modifies(o)}});var zC=Object.freeze({__proto__:null,wordcloud:_C});const BC=t=>new Uint8Array(t),TC=t=>new Uint16Array(t),PC=t=>new Uint32Array(t);function jC(t,n,e){const r=(n<257?BC:n<65537?TC:PC)(t);return e&&r.set(e),r}function RC(t,n,e){const r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,n){const e=this,i=e.bisect(e.range,t.value),o=t.index,a=i[0],u=i[1],s=o.length;let c;for(c=0;c<a;++c)n[o[c]]|=r;for(c=u;c<s;++c)n[o[c]]|=r;return e}}}function LC(){let t=PC(0),n=[],e=0;return{insert:function(r,i,o){if(!i.length)return[];const a=e,u=i.length,s=PC(u);let c,f,l,h=Array(u);for(l=0;l<u;++l)h[l]=r(i[l]),s[l]=l;if(h=function(t,n){return t.sort.call(n,((n,e)=>{const r=t[n],i=t[e];return r<i?-1:r>i?1:0})),function(t,n){return Array.from(n,(n=>t[n]))}(t,n)}(h,s),a)c=n,f=t,n=Array(a+u),t=PC(a+u),function(t,n,e,r,i,o,a,u,s){let c,f=0,l=0;for(c=0;f<r&&l<a;++c)n[f]<i[l]?(u[c]=n[f],s[c]=e[f++]):(u[c]=i[l],s[c]=o[l++]+t);for(;f<r;++f,++c)u[c]=n[f],s[c]=e[f];for(;l<a;++l,++c)u[c]=i[l],s[c]=o[l]+t}(o,c,f,a,h,s,u,n,t);else{if(o>0)for(l=0;l<u;++l)s[l]+=o;n=h,t=s}return e=a+u,{index:s,value:h}},remove:function(r,i){const o=e;let a,u,s;for(u=0;!i[t[u]]&&u<o;++u);for(s=u;u<o;++u)i[a=t[u]]||(t[s]=a,n[s]=n[u],++s);e=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=n,i=e),[rn(r,t[0],0,i),en(r,t[1],0,i)]},reindex:function(n){for(let r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:()=>t,size:()=>e}}function IC(t){_a.call(this,function(){let t=8,n=[],e=PC(0),r=jC(0,t),i=jC(0,t);return{data:()=>n,seen:()=>e=function(t,n,e){return t.length>=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length),add(t){for(let e,r=0,i=n.length,o=t.length;r<o;++r)e=t[r],e._index=i++,n.push(e)},remove(t,e){const o=n.length,a=Array(o-t),u=n;let s,c,f;for(c=0;!e[c]&&c<o;++c)a[c]=n[c],u[c]=c;for(f=c;c<o;++c)s=n[c],e[c]?u[c]=-1:(u[c]=f,r[f]=r[c],i[f]=i[c],a[f]=s,s._index=f++),r[c]=0;return n=a,u},size:()=>n.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,n){r[t]|=n},clear(t,n){r[t]&=~n},resize(n,e){(n>r.length||e>t)&&(t=Math.max(e,t),r=jC(n,t,r),i=jC(n,t))}}}(),t),this._indices=null,this._dims=null}function qC(t){_a.call(this,null,t)}IC.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},mt(IC,_a,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some((t=>n.modified(t.fields)))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,c=0;for(;c<a;++c)u=e[c].fname,s=i[u]||(i[u]=LC()),o.push(RC(s,c,r[c]));return this.eval(t,n)},reinit(t,n){const e=n.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,u=this.value,s=u.curr(),c=u.prev(),f=u.all(),l=e.rem=e.add,h=e.mod,d=i.length,m={};let p,g,v,y,b,w,x,$,k;if(c.set(s),n.rem.length&&(b=this.remove(t,n,e)),n.add.length&&u.add(n.add),n.mod.length)for(w={},y=n.mod,x=0,$=y.length;x<$;++x)w[y[x]._index]=1;for(x=0;x<d;++x)k=r[x],(!a[x]||t.modified("fields",x)||n.modified(k.fields))&&(v=k.fname,(p=m[v])||(o[v]=g=LC(),m[v]=p=g.insert(k,n.source,0)),a[x]=RC(g,x,i[x]).onAdd(p,s));for(x=0,$=u.data().length;x<$;++x)b[x]||(c[x]!==s[x]?l.push(x):w[x]&&s[x]!==f&&h.push(x));return u.mask=(1<<d)-1,e},eval(t,n){const e=n.materialize().fork(),r=this._dims.length;let i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},insert(t,n,e){const r=n.add,i=this.value,o=this._dims,a=this._indices,u=t.fields,s={},c=e.add,f=i.size()+r.length,l=o.length;let h,d,m,p=i.size();i.resize(f,l),i.add(r);const g=i.curr(),v=i.prev(),y=i.all();for(h=0;h<l;++h)d=u[h].fname,m=s[d]||(s[d]=a[d].insert(u[h],r,p)),o[h].onAdd(m,g);for(;p<f;++p)v[p]=y,g[p]!==y&&c.push(p)},modify(t,n){const e=n.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let u,s,c;for(u=0,s=a.length;u<s;++u)c=a[u]._index,i[c]!==o&&e.push(c)},remove(t,n,e){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),u=i.all(),s={},c=e.rem,f=n.rem;let l,h,d,m;for(l=0,h=f.length;l<h;++l)d=f[l]._index,s[d]=1,a[d]=m=o[d],o[d]=u,m!==u&&c.push(d);for(d in r)r[d].remove(h,s);return this.reindex(n,h,s),s},reindex(t,n,e){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(n,e);for(const n in r)r[n].reindex(t)}))},update(t,n,e){const r=this._dims,i=t.query,o=n.stamp,a=r.length;let u,s,c=0;for(e.filters=0,s=0;s<a;++s)t.modified("query",s)&&(u=s,++c);if(1===c)c=r[u].one,this.incrementOne(r[u],i[u],e.add,e.rem);else for(s=0,c=0;s<a;++s)t.modified("query",s)&&(c|=r[s].one,this.incrementAll(r[s],i[s],o,e.add),e.rem=e.add);return c},incrementAll(t,n,e,r){const i=this.value,o=i.seen(),a=i.curr(),u=i.prev(),s=t.index(),c=t.bisect(t.range),f=t.bisect(n),l=f[0],h=f[1],d=c[0],m=c[1],p=t.one;let g,v,y;if(l<d)for(g=l,v=Math.min(d,h);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(l>d)for(g=d,v=Math.min(l,m);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;if(h>m)for(g=Math.max(l,m),v=h;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(h<m)for(g=Math.max(d,h),v=m;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;t.range=n.slice()},incrementOne(t,n,e,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),u=t.bisect(n),s=u[0],c=u[1],f=a[0],l=a[1],h=t.one;let d,m,p;if(s<f)for(d=s,m=Math.min(f,c);d<m;++d)p=o[d],i[p]^=h,e.push(p);else if(s>f)for(d=f,m=Math.min(s,l);d<m;++d)p=o[d],i[p]^=h,r.push(p);if(c>l)for(d=Math.max(s,l),m=c;d<m;++d)p=o[d],i[p]^=h,e.push(p);else if(c<l)for(d=Math.max(f,c),m=l;d<m;++d)p=o[d],i[p]^=h,r.push(p);t.range=n.slice()}}),qC.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},mt(qC,_a,{transform(t,n){const e=~(t.ignore||0),r=t.filter,i=r.mask;if(!(i&e))return n.StopPropagation;const o=n.fork(n.ALL),a=r.data(),u=r.curr(),s=r.prev(),c=t=>u[t]&e?null:a[t];return o.filter(o.MOD,c),i&i-1?(o.filter(o.ADD,(t=>{const n=u[t]&e;return!n&&n^s[t]&e?a[t]:null})),o.filter(o.REM,(t=>!(u[t]&e)||s[t]&e?null:a[t]))):(o.filter(o.ADD,c),o.filter(o.REM,(t=>(u[t]&e)===i?a[t]:null))),o.filter(o.SOURCE,(t=>c(t._index)))}});var UC=Object.freeze({__proto__:null,crossfilter:IC,resolvefilter:qC});const WC="Literal",HC="CallExpression";function GC(t){this.type=t}var YC,VC,XC,JC,KC;GC.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case HC:return[t.callee].concat(t.arguments);case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];default:return[]}}(this),e=0,r=n.length;e<r;++e)if(n[e].visit(t))return 1},(YC={})[1]="Boolean",YC[2]="<end>",YC[3]="Identifier",YC[4]="Keyword",YC[5]="Null",YC[6]="Numeric",YC[7]="Punctuator",YC[8]="String",YC[9]="RegularExpression";var QC="Identifier",ZC="Unexpected token %0",tO="Invalid regular expression",nO="Invalid regular expression: missing /",eO="Octal literals are not allowed in strict mode.",rO="ILLEGAL",iO="Disabled.",oO=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]"),aO=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 uO(t,n){if(!t)throw new Error("ASSERT: "+n)}function sO(t){return t>=48&&t<=57}function cO(t){return"0123456789abcdefABCDEF".includes(t)}function fO(t){return"01234567".includes(t)}function lO(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function hO(t){return 10===t||13===t||8232===t||8233===t}function dO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&oO.test(String.fromCharCode(t))}function mO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&aO.test(String.fromCharCode(t))}const pO={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 gO(){for(;XC<JC;){const t=VC.charCodeAt(XC);if(!lO(t)&&!hO(t))break;++XC}}function vO(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)XC<JC&&cO(VC[XC])?(r=VC[XC++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):CO({},ZC,rO);return String.fromCharCode(i)}function yO(){var t,n;for(n=0,"}"===(t=VC[XC])&&CO({},ZC,rO);XC<JC&&cO(t=VC[XC++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&CO({},ZC,rO),n<=65535?String.fromCharCode(n):String.fromCharCode(55296+(n-65536>>10),56320+(n-65536&1023))}function bO(){var t,n;for(t=VC.charCodeAt(XC++),n=String.fromCharCode(t),92===t&&(117!==VC.charCodeAt(XC)&&CO({},ZC,rO),++XC,(t=vO("u"))&&"\\"!==t&&dO(t.charCodeAt(0))||CO({},ZC,rO),n=t);XC<JC&&mO(t=VC.charCodeAt(XC));)++XC,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==VC.charCodeAt(XC)&&CO({},ZC,rO),++XC,(t=vO("u"))&&"\\"!==t&&mO(t.charCodeAt(0))||CO({},ZC,rO),n+=t);return n}function wO(){var t,n,e,r,i=XC,o=VC.charCodeAt(XC),a=VC[XC];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++XC,{type:7,value:String.fromCharCode(o),start:i,end:XC};default:if(61===(t=VC.charCodeAt(XC+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return XC+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:XC};case 33:case 61:return 61===VC.charCodeAt(XC+=2)&&++XC,{type:7,value:VC.slice(i,XC),start:i,end:XC}}}return">>>="===(r=VC.substr(XC,4))?{type:7,value:r,start:i,end:XC+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:7,value:e,start:i,end:XC+=3}:a===(n=e.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===n?{type:7,value:n,start:i,end:XC+=2}:("//"===n&&CO({},ZC,rO),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:i,end:++XC}:void CO({},ZC,rO))}function xO(){var t,n,e;if(uO(sO((e=VC[XC]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=XC,t="","."!==e){if(t=VC[XC++],e=VC[XC],"0"===t){if("x"===e||"X"===e)return++XC,function(t){let n="";for(;XC<JC&&cO(VC[XC]);)n+=VC[XC++];return 0===n.length&&CO({},ZC,rO),dO(VC.charCodeAt(XC))&&CO({},ZC,rO),{type:6,value:parseInt("0x"+n,16),start:t,end:XC}}(n);if(fO(e))return function(t){let n="0"+VC[XC++];for(;XC<JC&&fO(VC[XC]);)n+=VC[XC++];return(dO(VC.charCodeAt(XC))||sO(VC.charCodeAt(XC)))&&CO({},ZC,rO),{type:6,value:parseInt(n,8),octal:!0,start:t,end:XC}}(n);e&&sO(e.charCodeAt(0))&&CO({},ZC,rO)}for(;sO(VC.charCodeAt(XC));)t+=VC[XC++];e=VC[XC]}if("."===e){for(t+=VC[XC++];sO(VC.charCodeAt(XC));)t+=VC[XC++];e=VC[XC]}if("e"===e||"E"===e)if(t+=VC[XC++],"+"!==(e=VC[XC])&&"-"!==e||(t+=VC[XC++]),sO(VC.charCodeAt(XC)))for(;sO(VC.charCodeAt(XC));)t+=VC[XC++];else CO({},ZC,rO);return dO(VC.charCodeAt(XC))&&CO({},ZC,rO),{type:6,value:parseFloat(t),start:n,end:XC}}function $O(){if(gO(),XC>=JC)return{type:2,start:XC,end:XC};const t=VC.charCodeAt(XC);return dO(t)?function(){var t,n;return t=XC,n=92===VC.charCodeAt(XC)?bO():function(){var t,n;for(t=XC++;XC<JC;){if(92===(n=VC.charCodeAt(XC)))return XC=t,bO();if(!mO(n))break;++XC}return VC.slice(t,XC)}(),{type:1===n.length?3:pO.hasOwnProperty(n)?4:"null"===n?5:"true"===n||"false"===n?1:3,value:n,start:t,end:XC}}():40===t||41===t||59===t?wO():39===t||34===t?function(){var t,n,e,r,i="",o=!1;for(uO("'"===(t=VC[XC])||'"'===t,"String literal must starts with a quote"),n=XC,++XC;XC<JC;){if((e=VC[XC++])===t){t="";break}if("\\"===e)if((e=VC[XC++])&&hO(e.charCodeAt(0)))"\r"===e&&"\n"===VC[XC]&&++XC;else switch(e){case"u":case"x":"{"===VC[XC]?(++XC,i+=yO()):i+=vO(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:fO(e)?(0!==(r="01234567".indexOf(e))&&(o=!0),XC<JC&&fO(VC[XC])&&(o=!0,r=8*r+"01234567".indexOf(VC[XC++]),"0123".includes(e)&&XC<JC&&fO(VC[XC])&&(r=8*r+"01234567".indexOf(VC[XC++]))),i+=String.fromCharCode(r)):i+=e}else{if(hO(e.charCodeAt(0)))break;i+=e}}return""!==t&&CO({},ZC,rO),{type:8,value:i,octal:o,start:n,end:XC}}():46===t?sO(VC.charCodeAt(XC+1))?xO():wO():sO(t)?xO():wO()}function kO(){const t=KC;return XC=t.end,KC=$O(),XC=t.end,t}function MO(){const t=XC;KC=$O(),XC=t}function AO(t,n,e){const r=new GC("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=n,r.right=e,r}function DO(t,n){const e=new GC("CallExpression");return e.callee=t,e.arguments=n,e}function SO(t){const n=new GC(QC);return n.name=t,n}function FO(t){const n=new GC("Literal");return n.value=t.value,n.raw=VC.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function EO(t,n,e){const r=new GC("MemberExpression");return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function NO(t,n,e){const r=new GC("Property");return r.key=n,r.value=e,r.kind=t,r}function CO(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,((t,n)=>(uO(n<r.length,"Message reference must be in range"),r[n])));throw(e=new Error(i)).index=XC,e.description=i,e}function OO(t){2===t.type&&CO(t,"Unexpected end of input"),6===t.type&&CO(t,"Unexpected number"),8===t.type&&CO(t,"Unexpected string"),3===t.type&&CO(t,"Unexpected identifier"),4===t.type&&CO(t,"Unexpected reserved word"),CO(t,ZC,t.value)}function _O(t){const n=kO();7===n.type&&n.value===t||OO(n)}function zO(t){return 7===KC.type&&KC.value===t}function BO(t){return 4===KC.type&&KC.value===t}function TO(){XC=KC.start;const t=kO();return 8===t.type||6===t.type?(t.octal&&CO(t,eO),FO(t)):SO(t.value)}function PO(){var t,n,e;return XC=KC.start,3===(t=KC).type?(e=TO(),_O(":"),NO("init",e,HO())):2!==t.type&&7!==t.type?(n=TO(),_O(":"),NO("init",n,HO())):void OO(t)}const jO={if:1};function RO(){var t,n,e;if(zO("("))return function(){_O("(");const t=GO();return _O(")"),t}();if(zO("["))return function(){const t=[];for(XC=KC.start,_O("[");!zO("]");)zO(",")?(kO(),t.push(null)):(t.push(HO()),zO("]")||_O(","));return kO(),function(t){const n=new GC("ArrayExpression");return n.elements=t,n}(t)}();if(zO("{"))return function(){var t,n,e=[],r={},i=String;for(XC=KC.start,_O("{");!zO("}");)n="$"+((t=PO()).key.type===QC?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?CO({},"Duplicate data property in object literal not allowed in strict mode"):r[n]=!0,e.push(t),zO("}")||_O(",");return _O("}"),function(t){const n=new GC("ObjectExpression");return n.properties=t,n}(e)}();if(XC=KC.start,3===(t=KC.type)||jO[KC.value])e=SO(kO().value);else if(8===t||6===t)KC.octal&&CO(KC,eO),e=FO(kO());else{if(4===t)throw new Error(iO);1===t?((n=kO()).value="true"===n.value,e=FO(n)):5===t?((n=kO()).value=null,e=FO(n)):zO("/")||zO("/=")?(e=FO(function(){var t,n,e,r;return KC=null,gO(),t=XC,n=function(){var t,n,e,r;for(uO("/"===(t=VC[XC]),"Regular expression literal must start with a slash"),n=VC[XC++],e=!1,r=!1;XC<JC;)if(n+=t=VC[XC++],"\\"===t)hO((t=VC[XC++]).charCodeAt(0))&&CO({},nO),n+=t;else if(hO(t.charCodeAt(0)))CO({},nO);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||CO({},nO),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";XC<JC&&mO((t=VC[XC]).charCodeAt(0));)++XC,"\\"===t&&XC<JC?CO({},ZC,rO):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&CO({},tO,e),{value:e,literal:n}}(),r=function(t,n){let e=t;n.includes("u")&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,n)=>{if(parseInt(n,16)<=1114111)return"x";CO({},tO)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:XC}}()),MO()):OO(kO())}return e}function LO(){const t=[];if(_O("("),!zO(")"))for(;XC<JC&&(t.push(HO()),!zO(")"));)_O(",");return _O(")"),t}function IO(){_O("[");const t=GO();return _O("]"),t}function qO(){const t=function(){var t;for(t=RO();;)if(zO("."))t=EO(".",t,(_O("."),function(){XC=KC.start;const t=kO();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||OO(t),SO(t.value)}()));else if(zO("("))t=DO(t,LO());else{if(!zO("["))break;t=EO("[",t,IO())}return t}();if(7===KC.type&&(zO("++")||zO("--")))throw new Error(iO);return t}function UO(){var t,n;if(7!==KC.type&&4!==KC.type)n=qO();else{if(zO("++")||zO("--"))throw new Error(iO);if(zO("+")||zO("-")||zO("~")||zO("!"))t=kO(),n=UO(),n=function(t,n){const e=new GC("UnaryExpression");return e.operator=t,e.argument=n,e.prefix=!0,e}(t.value,n);else{if(BO("delete")||BO("void")||BO("typeof"))throw new Error(iO);n=qO()}}return n}function WO(t){let n=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function HO(){var t,n;return t=function(){var t,n,e,r,i,o,a,u,s,c;if(t=KC,s=UO(),0===(i=WO(r=KC)))return s;for(r.prec=i,kO(),n=[t,KC],o=[s,r,a=UO()];(i=WO(KC))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),n.pop(),e=AO(u,s,a),o.push(e);(r=kO()).prec=i,o.push(r),n.push(KC),e=UO(),o.push(e)}for(e=o[c=o.length-1],n.pop();c>1;)n.pop(),e=AO(o[c-1].value,o[c-2],e),c-=2;return e}(),zO("?")&&(kO(),n=HO(),_O(":"),t=function(t,n,e){const r=new GC("ConditionalExpression");return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,HO())),t}function GO(){const t=HO();if(zO(","))throw new Error(iO);return t}function YO(t){XC=0,JC=(VC=t).length,KC=null,MO();const n=GO();if(2!==KC.type)throw new Error("Unexpect token after expression.");return n}var VO,XO={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function JO(t){function n(n,e,r){return i=>function(n,e,r,i){let o=t(e[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}const e="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(n){n.length<3&&p("Missing arguments to clamp function."),n.length>3&&p("Too many arguments to clamp function.");const e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),regexp:i,test:n("test",i),if:function(n){n.length<3&&p("Missing arguments to if function."),n.length>3&&p("Too many arguments to if function.");const e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}function KO(t){const n=(t=t||{}).allowed?zt(t.allowed):{},e=t.forbidden?zt(t.forbidden):{},r=t.constants||XO,i=(t.functions||JO)(l),o=t.globalvar,a=t.fieldvar,u=Z(o)?o:t=>`${o}["${t}"]`;let s={},c={},f=0;function l(t){if(xt(t))return t;const n=h[t.type];return null==n&&p("Unsupported type: "+t.type),n(t)}const h={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:ft(e,i)?p("Illegal identifier: "+i):ft(r,i)?r[i]:ft(n,i)?i:(s[i]=1,u(i))},MemberExpression:t=>{const n=!t.computed,e=l(t.object);n&&(f+=1);const r=l(t.property);return e===a&&(c[function(t){const n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(f-=1),e+(n?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&p("Illegal callee type: "+t.callee.type);const n=t.callee.name,e=t.arguments,r=ft(i,n)&&i[n];return r||p("Unrecognized function: "+n),Z(r)?r(e):r+"("+e.map(l).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(l).join(",")+"]",BinaryExpression:t=>"("+l(t.left)+" "+t.operator+" "+l(t.right)+")",UnaryExpression:t=>"("+t.operator+l(t.argument)+")",ConditionalExpression:t=>"("+l(t.test)+"?"+l(t.consequent)+":"+l(t.alternate)+")",LogicalExpression:t=>"("+l(t.left)+t.operator+l(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(l).join(",")+"}",Property:t=>{f+=1;const n=l(t.key);return f-=1,n+":"+l(t.value)}};function d(t){const n={code:l(t),globals:Object.keys(s),fields:Object.keys(c)};return s={},c={},n}return d.functions=i,d.constants=r,d}(VO={})[1]="Boolean",VO[2]="<end>",VO[3]="Identifier",VO[4]="Keyword",VO[5]="Null",VO[6]="Numeric",VO[7]="Punctuator",VO[8]="String",VO[9]="RegularExpression";const QO=Symbol("vega_selection_getter");function ZO(t){return t.getter&&t.getter[QO]||(t.getter=v(t.field),t.getter[QO]=!0),t.getter}const t_="intersect",n_="union",e_="or",r_="and",i_="_vgsid_",o_=v(i_),a_="index:unit";function u_(t,n){for(var e,r,i=n.fields,o=n.values,a=i.length,u=0;u<a;++u)if(vt(e=ZO(r=i[u])(t))&&(e=_(e)),vt(o[u])&&(o[u]=_(o[u])),D(o[u])&&vt(o[u][0])&&(o[u]=o[u].map(_)),"E"===r.type){if(D(o[u])?!o[u].includes(e):e!==o[u])return!1}else if("R"===r.type){if(!pt(e,o[u]))return!1}else if("R-RE"===r.type){if(!pt(e,o[u],!0,!1))return!1}else if("R-E"===r.type){if(!pt(e,o[u],!1,!1))return!1}else if("R-LE"===r.type){if(!pt(e,o[u],!1,!0))return!1}else if("E-LT"===r.type){if(e>=o[u])return!1}else if("E-LTE"===r.type){if(e>o[u])return!1}else if("E-GT"===r.type){if(e<=o[u])return!1}else if("E-GTE"===r.type){if(e<o[u])return!1}else if("E-VALID"===r.type){if(null===e||isNaN(e))return!1}else if("E-ONE"===r.type&&-1===o[u].indexOf(e))return!1;return!0}const s_=Qt(o_),c_=s_.left,f_=s_.right;var l_={[`${i_}_union`]:function(...t){const n=new un;for(const e of t)for(const t of e)n.add(t);return n},[`${i_}_intersect`]:function(t,...n){t=new un(t),n=n.map(Nn);t:for(const e of t)for(const r of n)if(!r.has(e)){t.delete(e);continue t}return t},E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.includes(n[e])||t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter((t=>n.includes(t))):n},R_union:function(t,n){var e=_(n[0]),r=_(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=_(n[0]),r=_(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};function h_(t,n,e,r){"Literal"!==n[0].type&&p("First argument to selection functions must be a string literal.");const i=n[0].value,o="unit",a="@"+o,u=":"+i;(n.length>=2&&O(n).value)!==t_||ft(r,a)||(r[a]=e.getData(i).indataRef(e,o)),ft(r,u)||(r[u]=e.getData(i).tuplesRef())}function d_(t){const n=this.context.data[t];return n?n.values.value:[]}const m_=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},p_=m_("format"),g_=m_("timeFormat"),v_=m_("utcFormat"),y_=m_("timeParse"),b_=m_("utcParse"),w_=new Date(2e3,0,1);function x_(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(w_.setYear(2e3),w_.setMonth(t),w_.setDate(n),g_.call(this,w_,e)):""}function $_(t,n,e,r){n[0].type!==WC&&p("First argument to data functions must be a string literal.");const i=n[0].value,o=":"+i;if(!ft(o,r))try{r[o]=e.getData(i).tuplesRef()}catch(t){}}function k_(t,n,e,r){if(n[0].type===WC)M_(e,r,n[0].value);else for(t in e.scales)M_(e,r,t)}function M_(t,n,e){const r="%"+e;if(!ft(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}function A_(t,n){if(xt(t)){const r=n.scales[t];return r&&((e=r.value)&&!0===e[Zp])?r.value:void 0}var e}function D_(t,n){return function(e,r,i){if(e){const n=A_(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const S_=D_("area",(function(t){return sM=new on,Wk(t,cM),2*sM})),F_=D_("bounds",(function(t){var n,e,r,i,o,a,u;if(Zk=Qk=-(Jk=Kk=1/0),oM=[],Wk(t,PM),e=oM.length){for(oM.sort(GM),n=1,o=[r=oM[0]];n<e;++n)YM(r,(i=oM[n])[0])||YM(r,i[1])?(HM(r[0],i[1])>HM(r[0],r[1])&&(r[1]=i[1]),HM(i[0],r[1])>HM(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)(u=HM(r[1],(i=o[n])[0]))>a&&(a=u,Jk=i[0],Qk=r[1])}return oM=aM=null,Jk===1/0||Kk===1/0?[[NaN,NaN],[NaN,NaN]]:[[Jk,Kk],[Qk,Zk]]})),E_=D_("centroid",(function(t){xM=$M=kM=MM=AM=DM=SM=FM=0,EM=new on,NM=new on,CM=new on,Wk(t,VM);var n=+EM,e=+NM,r=+CM,i=Ek(n,e,r);return i<gk&&(n=DM,e=SM,r=FM,$M<pk&&(n=kM,e=MM,r=AM),(i=Ek(n,e,r))<gk)?[NaN,NaN]:[Ak(e,n)*xk,Pk(r/i)*xk]}));function N_(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function C_(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function O_(t){const n=Uf(t);return.2126*C_(n.r)+.7152*C_(n.g)+.0722*C_(n.b)}function __(t,n){return t===n||t!=t&&n!=n||(D(t)?!(!D(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!__(t[e],n[e]))return!1;return!0}(t,n):!(!S(t)||!S(n))&&z_(t,n))}function z_(t,n){for(const e in t)if(!__(t[e],n[e]))return!1;return!0}function B_(t){return n=>z_(t,n)}const T_={};function P_(t){return D(t)||ArrayBuffer.isView(t)?t:null}function j_(t){return P_(t)||(xt(t)?t:null)}const R_=t=>t.data;function L_(t,n){const e=d_.call(n,t);return e.root&&e.root.lookup||{}}const I_=()=>"undefined"!=typeof window&&window||null;function q_(t,n,e){if(!t)return[];const[r,i]=t,o=(new Lv).set(r[0],r[1],i[0],i[1]);return Mx(e||this.context.dataflow.scenegraph().root,o,function(t){let n=null;if(t){const e=K(t.marktype),r=K(t.markname);n=t=>(!e.length||e.some((n=>t.marktype===n)))&&(!r.length||r.some((n=>t.name===n)))}return n}(n))}const U_={random:()=>qa(),cumulativeNormal:Ja,cumulativeLogNormal:eu,cumulativeUniform:su,densityNormal:Xa,densityLogNormal:nu,densityUniform:uu,quantileNormal:Ka,quantileLogNormal:ru,quantileUniform:cu,sampleNormal:Va,sampleLogNormal:tu,sampleUniform:au,isArray:D,isBoolean:gt,isDate:vt,isDefined:t=>void 0!==t,isNumber:bt,isObject:S,isRegExp:wt,isString:xt,isTuple:ta,isValid:t=>null!=t&&t==t,toBoolean:Nt,toDate:t=>Ot(t),toNumber:_,toString:_t,indexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).indexOf(...e)},join:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return P_(t).join(...e)},lastindexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).lastIndexOf(...e)},replace:function(t,n,e){return Z(e)&&p("Function argument passed to replace."),String(t).replace(n,e)},reverse:function(t){return P_(t).slice().reverse()},sort:function(t){return P_(t).slice().sort(nt)},slice:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).slice(...e)},flush:dt,lerp:kt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),ut(...t)},pad:St,peek:O,pluck:function(t,n){const e=T_[n]||(T_[n]=v(n));return D(t)?t.map(e):e(t)},span:Ft,inrange:pt,truncate:Bt,rgb:Uf,lab:hl,hcl:yl,hsl:Qf,luminance:O_,contrast:function(t,n){const e=O_(t),r=O_(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:Fn,format:p_,utcFormat:v_,utcParse:b_,utcOffset:ar,utcSequence:cr,timeFormat:g_,timeParse:y_,timeOffset:or,timeSequence:sr,timeUnitSpecifier:Ce,monthFormat:function(t){return x_.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return x_.call(this,t,1,"%b")},dayFormat:function(t){return x_.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return x_.call(this,0,2+t,"%a")},quarter:X,utcquarter:J,week:Be,utcweek:Ie,dayofyear:ze,utcdayofyear:Le,warn:function(){return N_(this.context.dataflow,"warn",arguments)},info:function(){return N_(this.context.dataflow,"info",arguments)},debug:function(){return N_(this.context.dataflow,"debug",arguments)},extent:t=>st(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:q_,clampRange:Q,pinchDistance:function(t){const n=t.touches;return Math.hypot(n[0].clientX-n[1].clientX,n[0].clientY-n[1].clientY)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=I_();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=I_();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return Dp(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow;return e.pulse(this.context.data[t].input,e.changeset().remove($).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?cv(e,n=n||Qg(t)):t}},panLinear:L,panLog:I,panPow:q,panSymlog:U,zoomLinear:H,zoomLog:G,zoomPow:Y,zoomSymlog:V,encode:function(t,n,e){if(t){const e=this.context.dataflow;e.pulse(t.mark.source,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,c=a.stamp();let f,l,h=u.changes;if(!1===a._trigger||!(s.value.length||n||r))return 0;if((!h||h.stamp<c)&&(u.changes=h=a.changeset(),h.stamp=c,a.runAfter((()=>{u.modified=!0,a.pulse(s,h).run()}),!0,1)),e&&(f=!0===e?$:D(e)||ta(e)?e:B_(e),h.remove(f)),n&&h.insert(n),r&&(f=B_(r),s.value.some(f)?h.remove(f):h.insert(r)),i)for(l in o)h.modify(i,l,o[l]);return 1},lassoAppend:function(t,n,e){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const i=(t=K(t))[t.length-1];return void 0===i||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return K(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:o}=e,a=(new Lv).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<a.x1&&(a.x1=t),t>a.x2&&(a.x2=t),e<a.y1&&(a.y1=e),e>a.y2&&(a.y2=e);return a.translate(r,i),q_([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,u]=e[o],[s,c]=e[i];c>n!=u>n&&t<(a-s)*(n-c)/(u-c)+s&&r++}return 1&r}(t.x,t.y,n)))}},W_=["view","item","group","xy","x","y"],H_="this.",G_={},Y_={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Et("$"+t)}]`,functions:function(t){const n=JO(t);W_.forEach((t=>n[t]="event.vega."+t));for(const t in U_)n[t]=H_+t;return ut(n,function(t,n,e){n.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,e._bandwidth=k_,e._range=k_,e._scale=k_;const r=n=>"_["+(n.type===WC?Et("%"+n.value):Et("%")+"+"+t(n))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:n=>`${r(n[0])}(${t(n[1])})`}}(t,U_,G_)),n},constants:XO,visitors:G_},V_=KO(Y_);function X_(t,n,e){return 1===arguments.length?U_[t]:(U_[t]=n,e&&(G_[t]=e),V_&&(V_.functions[t]=H_+t),this)}function J_(t,n){const e={};let r;try{r=YO(t=xt(t)?t:Et(t)+"")}catch(n){p("Expression parse error: "+t)}r.visit((t=>{if(t.type!==HC)return;const r=t.callee.name,i=Y_.visitors[r];i&&i(r,t.arguments,n,e)}));const i=V_(r);return i.globals.forEach((t=>{const r="$"+t;!ft(e,r)&&n.getSignal(t)&&(e[r]=n.signalRef(t))})),{$expr:ut({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}X_("bandwidth",(function(t,n){const e=A_(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}),k_),X_("copy",(function(t,n){const e=A_(t,(n||this).context);return e?e.copy():void 0}),k_),X_("domain",(function(t,n){const e=A_(t,(n||this).context);return e?e.domain():[]}),k_),X_("range",(function(t,n){const e=A_(t,(n||this).context);return e&&e.range?e.range():[]}),k_),X_("invert",(function(t,n,e){const r=A_(t,(e||this).context);return r?D(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}),k_),X_("scale",(function(t,n,e){const r=A_(t,(e||this).context);return r?r(n):void 0}),k_),X_("gradient",(function(t,n,e,r,i){let o="string"==typeof t?A_(t,(i||this).context):t;const a=Wg(n,e);let u=o.domain(),s=u[0],c=O(u),f=b;return c-s?f=mg(o,s,c):o=(o.interpolator?ng("sequential")().interpolator(o.interpolator()):ng("linear")().interpolate(o.interpolate()).range(o.range())).domain([s=0,c=1]),o.ticks&&(u=o.ticks(+r||15),s!==u[0]&&u.unshift(s),c!==O(u)&&u.push(c)),u.forEach((t=>a.stop(f(t),o(t)))),a}),k_),X_("geoArea",S_,k_),X_("geoBounds",F_,k_),X_("geoCentroid",E_,k_),X_("geoShape",(function(t,n,e){const r=A_(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}),k_),X_("geoScale",(function(t,n){const e=A_(t,(n||this).context);return e&&e.scale()}),k_),X_("indata",(function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}),(function(t,n,e,r){n[0].type!==WC&&p("First argument to indata must be a string literal."),n[1].type!==WC&&p("Second argument to indata must be a string literal.");const i=n[0].value,o=n[1].value,a="@"+o;ft(a,r)||(r[a]=e.getData(i).indataRef(e,o))})),X_("data",d_,$_),X_("treePath",(function(t,n,e){const r=L_(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(R_):void 0}),$_),X_("treeAncestors",(function(t,n){const e=L_(t,this)[n];return e?e.ancestors().map(R_):void 0}),$_),X_("vlSelectionTest",(function(t,n,e){for(var r,i,o,a,u,s=this.context.data[t],c=s?s.values.value:[],f=s?s[a_]&&s[a_].value:void 0,l=e===t_,h=c.length,d=0;d<h;++d)if(r=c[d],f&&l){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(u=u_(n,r),i[a]=u?-1:++o,u&&1===f.size)return!0;if(!u&&o===f.get(a).count)return!1}else if(l^(u=u_(n,r)))return u;return h&&l}),h_),X_("vlSelectionIdTest",(function(t,n,e){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[a_]&&r[a_].value:void 0,a=e===t_,u=o_(n),s=c_(i,u);if(s===i.length)return!1;if(o_(i[s])!==u)return!1;if(o&&a){if(1===o.size)return!0;if(f_(i,u)-s<o.size)return!1}return!0}),h_),X_("vlSelectionResolve",(function(t,n,e,r){for(var i,o,a,u,s,c,f,l,h,d,m,p=this.context.data[t],g=p?p.values.value:[],v={},y={},b={},w=g.length,x=0;x<w;++x)if(u=(i=g[x]).unit,a=i.values,(o=i.fields)&&a){for(d=0,m=o.length;d<m;++d)l=(f=v[(s=o[d]).field]||(v[s.field]={}))[u]||(f[u]=[]),b[s.field]=h=s.type.charAt(0),f[u]=(0,l_[`${h}_union`])(l,K(a[d]));e&&(l=y[u]||(y[u]=[])).push(K(a).reduce(((t,n,e)=>(t[o[e].field]=n,t)),{}))}else s=i_,c=o_(i),(l=(f=v[s]||(v[s]={}))[u]||(f[u]=[])).push(c),e&&(l=y[u]||(y[u]=[])).push({[i_]:c});return n=n||n_,v[i_]?v[i_]=l_[`${i_}_${n}`](...Object.values(v[i_])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((n=>v[t][n])).reduce(((e,r)=>void 0===e?r:l_[`${b[t]}_${n}`](e,r)))})),g=Object.keys(y),e&&g.length&&(v[r?"vlPoint":"vlMulti"]=n===n_?{[e_]:g.reduce(((t,n)=>(t.push(...y[n]),t)),[])}:{[r_]:g.map((t=>({[e_]:y[t]})))}),v}),h_),X_("vlSelectionTuples",(function(t,n){return t.map((t=>ut(n.fields?{values:n.fields.map((n=>ZO(n)(t.datum)))}:{[i_]:o_(t.datum)},n)))}));const K_=zt(["rule"]),Q_=zt(["group","image","rect"]);function Z_(t){return(t+"").toLowerCase()}function tz(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var nz={operator:(t,n)=>tz(t,["_"],n.code),parameter:(t,n)=>tz(t,["datum","_"],n.code),event:(t,n)=>tz(t,["event"],n.code),handler:(t,n)=>tz(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const n="o["+Et(t)+"]";i+=`$=${r[t].code};if(${n}!==$)${n}=$,m=1;`}return i+=function(t,n){let e="";return K_[n]||(t.x2&&(t.x?(Q_[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(Q_[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;")),e}(r,e),i+="return m;",tz(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(Et).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=n[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((e=e||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,n,e,r){return`((u = ${t}) < (v = ${n}) || u == null) && v != null ? ${e}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${e}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return e?r.bind(e):r}}};function ez(t,n,e){if(!t||!S(t))return t;for(let r,i=0,o=rz.length;i<o;++i)if(r=rz[i],ft(t,r.key))return r.parse(t,n,e);return t}var rz=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||p("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){const e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=$t(t.$key,t.$flat,n.expr.codegen))}},{key:"$expr",parse:function(t,n,e){t.$params&&n.parseParameters(t.$params,e);const r="e:"+t.$expr.code;return n.fn[r]||(n.fn[r]=c(n.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;const e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=v(t.$field,t.$name,n.expr.codegen))}},{key:"$encode",parse:function(t,n){const e=t.$encode,r={};for(const t in e){const i=e[t];r[t]=c(n.encodeExpression(i.$expr),i.$fields),r[t].output=i.$output}return r}},{key:"$compare",parse:function(t,n){const e="c:"+t.$compare+"_"+t.$order,r=K(t.$compare).map((t=>t&&t.$tupleid?na:t));return n.fn[e]||(n.fn[e]=tt(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(t,r,i){const o=n.fork().parse(e),a=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>n.detach(o),a}}},{key:"$tupleid",parse:function(){return na}}];const iz={skip:!0};function oz(t,n,e,r){return new az(t,n,e,r)}function az(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||nz,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function uz(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function sz(t,n){t&&(null==n?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}az.prototype=uz.prototype={fork(){const t=new uz(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((n=>n!==t));const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(t){return"collect"===Z_(t)}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let i=e.get(t.parent.$ref);i?(r.connect(i,[n]),n.targets().add(i)):(e.unresolved=e.unresolved||[]).push((()=>{i=e.get(t.parent.$ref),r.connect(i,[n]),n.targets().add(i)}))}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const r in t.data){const i=e.data[r]||(e.data[r]={});t.data[r].forEach((t=>i[t]=n))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[Z_(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach((t=>n.parseOperator(t))),e.forEach((t=>n.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>n.parseStream(t))),(t.updates||[]).forEach((t=>n.parseUpdate(t))),n.resolve()},parseOperator:function(t){const n=this;!function(t){return"operator"===Z_(t)}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||p("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=D(i)?i.map((t=>ez(t,e,n))):ez(i,e,n)}return n},parseStream:function(t){var n,e=this,r=null!=t.filter?e.eventExpression(t.filter):void 0,i=null!=t.stream?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map((t=>e.get(t))))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map((t=>e.get(t))),i=i.between(n[0],n[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&p("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=S(r=t.source)?r.$ref:r,i=e.get(r),o=t.update,a=void 0;i||p("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),o&&o.$expr&&(o.$params&&(a=e.parseParameters(o.$params)),o=e.handlerExpression(o.$expr)),e.update(t,i,n,o,a)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach((e=>{const i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)}))}if(t.data){var i=e.data={};Object.keys(n.data).forEach((e=>{const r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)}))}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map((n=>n.getState(t)))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{e.update(n.signals[t],i[t],iz)})),Object.keys(r||{}).forEach((t=>{e.pulse(n.data[t].input,e.changeset().remove($).insert(r[t]))})),(t.subcontext||[]).forEach(((t,e)=>{const r=n.subcontext[e];r&&r.setState(t)}))}};const cz="default";function fz(t,n){const e=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(e)return null==n?e.style.removeProperty("cursor"):e.style.cursor=n}function lz(t,n){var e=t._runtime.data;return ft(e,n)||p("Unrecognized data set: "+n),e[n]}function hz(t,n){sa(n)||p("Second argument to changes must be a changeset.");const e=lz(this,t);return e.modified=!0,this.pulse(e.input,n)}function dz(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function mz(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function pz(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}const gz="view",vz={trap:!1};function yz(t,n,e,r){t._eventListeners.push({type:e,sources:K(n),handler:r})}function bz(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(!1===r||S(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function wz(t){return t.item}function xz(t){return t.item.mark.source}function $z(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function kz(t,n,e){const r=document.createElement(t);for(const t in n)r.setAttribute(t,n[t]);return null!=e&&(r.textContent=e),r}function Mz(t,n,e,r){const i=e.event||"input",o=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,o),yz(r,n,i,o),t.set=t=>{n.value=t,n.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function Az(t,n,e,r){const i=r.signal(e.signal),o=kz("div",{class:"vega-bind"}),a="radio"===e.input?o:o.appendChild(kz("label"));a.appendChild(kz("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(o);let u=Dz;switch(e.input){case"checkbox":u=Sz;break;case"select":u=Fz;break;case"radio":u=Ez;break;case"range":u=Nz}u(t,a,e,i)}function Dz(t,n,e,r){const i=kz("input");for(const t in e)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,e[t]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function Sz(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const o=kz("input",i);n.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function Fz(t,n,e,r){const i=kz("select",{name:e.signal}),o=e.labels||[];e.options.forEach(((t,n)=>{const e={value:t};Cz(t,r)&&(e.selected=!0),i.appendChild(kz("option",e,(o[n]||t)+""))})),n.appendChild(i),i.addEventListener("change",(()=>{t.update(e.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let n=0,r=e.options.length;n<r;++n)if(Cz(e.options[n],t))return void(i.selectedIndex=n)}}function Ez(t,n,e,r){const i=kz("span",{class:"vega-bind-radio"}),o=e.labels||[];n.appendChild(i),t.elements=e.options.map(((n,a)=>{const u={type:"radio",name:e.signal,value:n};Cz(n,r)&&(u.checked=!0);const s=kz("input",u);s.addEventListener("change",(()=>t.update(n)));const c=kz("label",{},(o[a]||n)+"");return c.prepend(s),i.appendChild(c),s})),t.set=n=>{const e=t.elements,r=e.length;for(let t=0;t<r;++t)Cz(e[t].value,n)&&(e[t].checked=!0)}}function Nz(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;const i=null!=e.max?e.max:Math.max(100,+r)||100,o=e.min||Math.min(0,i,+r)||0,a=e.step||bn(o,i,100),u=kz("input",{type:"range",name:e.signal,min:o,max:i,step:a});u.value=r;const s=kz("span",{},+r);n.appendChild(u),n.appendChild(s);const c=()=>{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",c),u.addEventListener("change",c),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function Cz(t,n){return t===n||t+""==n+""}function Oz(t,n,e,r,i,o){return(n=n||new r(t.loader())).initialize(e,dz(t),mz(t),pz(t),i,o).background(t.background())}function _z(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function zz(t,n,e){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(e){n=null,t.error(e)}return n}const Bz=t=>+t||0;function Tz(t){return S(t)?{top:Bz(t.top),bottom:Bz(t.bottom),left:Bz(t.left),right:Bz(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(Bz(t))}async function Pz(t,n,e,r){const i=kx(n),o=i&&i.headless;return o||p("Unrecognized renderer type: "+n),await t.runAsync(),Oz(t,null,null,o,e,r).renderAsync(t._scenegraph.root)}var jz="width",Rz="height",Lz="padding",Iz={skip:!0};function qz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===Lz?r.left+r.right:0)}function Uz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===Lz?r.top+r.bottom:0)}function Wz(t,n){return n.modified&&D(n.input.value)&&!t.startsWith("_:vega:_")}function Hz(t,n){return!("parent"===t||n instanceof za.proxy)}function Gz(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":D(t)?Yz(t):S(t)&&!vt(t)?(n=t,Object.keys(n).map((t=>{const e=n[t];return t+": "+(D(e)?Yz(e):Vz(e))})).join("\n")):t+"";var n}(r))}function Yz(t){return"["+t.map(Vz).join(", ")+"]"}function Vz(t){return D(t)?"[…]":S(t)&&!vt(t)?"{…}":t}function Xz(t,n){const e=this;if(n=n||{},Ca.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),null!=n.logLevel&&e.logLevel(n.logLevel),n.locale||t.locale){const r=ut({},t.locale,n.locale);e.locale(ko(r.number,r.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||xx.Canvas,e._scenegraph=new Hb;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Gz,e._redraw=!0,e._handler=(new $w).scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(t){const n=ut({defaults:{}},t),e=(t,n)=>{n.forEach((n=>{D(t[n])&&(t[n]=zt(t[n]))}))};return e(n.defaults,["prevent","allow"]),e(n,["view","window","selector"]),n}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(t,n,e){return oz(t,za,U_,e).parse(n)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map((t=>({state:null,param:ut({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=qz(e,e._width),e._viewHeight=Uz(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(t){var n=t._signals,e=n[jz],r=n[Rz],i=n[Lz];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(n=>{t._width=n.size,t._viewWidth=qz(t,n.size),o()}),{size:e}),t._resizeHeight=t.add(null,(n=>{t._height=n.size,t._viewHeight=Uz(t,n.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(e),function(t){t.add(null,(n=>(t._background=n.bg,t._resize=1,n.bg)),{bg:t._signals.background})}(e),function(t){const n=t._signals.cursor||(t._signals.cursor=t.add({user:cz,item:null}));t.on(t.events("view","pointermove"),n,((t,e)=>{const r=n.value,i=r?xt(r)?r:r.user:cz,o=e.item&&e.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(n){let e=n.cursor,r=this.value;return xt(e)||(r=e.item,e=e.user),fz(t,e&&e!==cz?e:r||e),r}),{cursor:n})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function Jz(t,n){return ft(t._signals,n)?t._signals[n]:p("Unrecognized signal name: "+Et(n))}function Kz(t,n){const e=(t._targets||[]).filter((t=>t._update&&t._update.handler===n));return e.length?e[0]:null}function Qz(t,n,e,r){let i=Kz(e,r);return i||(i=_z(t,(()=>r(n,e.value))),i.handler=r,t.on(e,null,i)),t}function Zz(t,n,e){const r=Kz(n,e);return r&&n._targets.remove(r),t}mt(Xz,Ca,{async evaluate(t,n,e){if(await Ca.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var n=pz(t),e=dz(t),r=mz(t);t._renderer.background(t.background()),t._renderer.resize(e,r,n),t._handler.origin(n),t._resizeListeners.forEach((n=>{try{n(e,r)}catch(n){t.error(n)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return e&&Ko(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=null!=t?t+"":null;return n!==this._desc&&sz(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=Jz(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",Tz(t)):Tz(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(kx(t)||p("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(Ca.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Jz(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==e&&(u=1,a.signal(jz,e,Iz),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(Rz,r,Iz),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==n&&(a._resize=1,a._viewHeight=n),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,n,e){let r=n;return e&&!1===e.trap||(r=_z(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(e=i[o].handler,t===(r=i[o].type)&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return Qz(this,t,Jz(this,t),n)},removeSignalListener(t,n){return Zz(this,Jz(this,t),n)},addDataListener(t,n){return Qz(this,t,lz(this,t).values,n)},removeDataListener(t,n){return Zz(this,lz(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=fz(this,null);this._globalCursor=!!t,n&&fz(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(t,n,e){var r=new BF,i=n;return null==n?(r.restart(t,n,e),r):(r._restart=r.restart,r.restart=function(t,n,e){n=+n,e=null==e?_F():+e,r._restart((function o(a){a+=i,r._restart(o,i+=n,e),t(a)}),n,e)},r.restart(t,n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},events:function(t,n,e){var r,i=this,o=new va(e),a=function(e,r){i.runAsync(null,(()=>{t===gz&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),o.receive(function(t,n,e){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=pz(t),(r=Qb(n.changedTouches?n.changedTouches[0]:n,a))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(t,n,e){const r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return e;xt(t)&&(t=i(t));const n=e.slice();for(;t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:ot(t),item:ot(n||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,e,r),n}(i,e,r))}))};if("timer"===t)bz(i,"timer",n)&&i.timer(a,n);else if(t===gz)bz(i,"view",n)&&i.addEventListener(n,a,vz);else if("window"===t?bz(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&bz(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var u=0,s=r.length;u<s;++u)r[u].addEventListener(n,a);yz(i,r,n,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,n,e,r=this._tooltip,i=this._timers,o=this._handler.handlers(),a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(r&&r.call(this,this._handler,null,null,null),t=o.length;--t>=0;)this._handler.off(o[t].type,o[t].handler);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",wz),xz,$z(t)),this.on(this.events("view","pointerout",wz),xz,$z(n)),this},data:function(t,n){return arguments.length<2?lz(this,t).values.value:hz.call(this,t,ca().remove($).insert(n))},change:hz,insert:function(t,n){return hz.call(this,t,ca().insert(n))},remove:function(t,n){return hz.call(this,t,ca().remove(n))},scale:function(t){var n=this._runtime.scales;return ft(n,t)||p("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,o=kx(r);t=e._el=t?zz(e,t,!0):null,function(t){const n=t.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),sz(n,t.description()))}(e),o||e.error("Unrecognized renderer type: "+r);const a=o.handler||$w,u=t?o.renderer:o.headless;return e._renderer=u?Oz(e,e._renderer,t,u):null,e._handler=function(t,n,e,r){const i=new r(t.loader(),_z(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,pz(t),t);return n&&n.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(e,e._handler,t,a),e._redraw=!0,t&&"none"!==i&&(n=n?e._elBind=zz(e,n,!0):t.appendChild(kz("form",{class:"vega-bindings"})),e._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=zz(e,t.param.element,!!t.param.input))})),e._bind.forEach((t=>{!function(t,n,e){if(!n)return;const r=e.param;let i=e.state;i||(i=e.state={elements:null,active:!1,set:null,update:n=>{n!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,n)}))}},r.debounce&&(i.update=at(r.debounce,i.update))),(null==r.input&&r.element?Mz:Az)(i,n,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(e,t.element||n,t)}))),e},toImageURL:async function(t,n){t!==xx.Canvas&&t!==xx.SVG&&t!==xx.PNG&&p("Unrecognized image type: "+t);const e=await Pz(this,t,n);return t===xx.SVG?function(t){const n=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(e.svg()):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await Pz(this,xx.Canvas,t,n)).canvas()},toSVG:async function(t){return(await Pz(this,xx.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:Wz,signals:Hz,recurse:!0})},setState:function(t){return this.runAsync(null,(n=>{n._trigger=!1,n._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const n=()=>{null!=t&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const tB=/[[\]{}]/,nB={"*":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 eB,rB;function iB(t,n,e){return eB=n||"view",rB=e||nB,aB(t.trim()).map(uB)}function oB(t,n,e,r,i){const o=t.length;let a,u=0;for(;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return n}function aB(t){const n=[],e=t.length;let r=0,i=0;for(;i<e;)i=oB(t,i,",","[{","]}"),n.push(t.substring(r,i).trim()),r=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function uB(t){return"["===t[0]?function(t){const n=t.length;let e,r=1;if(r=oB(t,r,"]","[","]"),r===n)throw"Empty between selector: "+t;if(e=aB(t.substring(1,r)),2!==e.length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;e=e.map(uB);const i=uB(t.slice(1).trim());return i.between?{between:e,stream:i}:(i.between=e,i)}(t):function(t){const n={source:eB},e=[];let r,i,o=[0,0],a=0,u=0,s=t.length,c=0;if("}"===t[s-1]){if(c=t.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+t;try{o=function(t){const n=t.split(",");if(!t.length||n.length>2)throw t;return n.map((n=>{const e=+n;if(e!=e)throw t;return e}))}(t.substring(c+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,c).trim()).length,c=0}if(!s)throw t;if("@"===t[0]&&(a=++c),r=oB(t,c,":"),r<s&&(e.push(t.substring(u,r).trim()),u=c=++r),c=oB(t,c,"["),c===s)e.push(t.substring(u,s).trim());else if(e.push(t.substring(u,c).trim()),i=[],u=++c,u===s)throw"Unmatched left bracket: "+t;for(;c<s;){if(c=oB(t,c,"]"),c===s)throw"Unmatched left bracket: "+t;if(i.push(t.substring(u,c).trim()),c<s-1&&"["!==t[++c])throw"Expected left bracket: "+t;u=++c}if(!(s=e.length)||tB.test(e[s-1]))throw"Invalid event selector: "+t;return s>1?(n.type=e[1],a?n.markname=e[0].slice(1):function(t){return rB[t]}(e[0])?n.marktype=e[0]:n.source=e[0]):n.type=e[0],"!"===n.type.slice(-1)&&(n.consume=!0,n.type=n.type.slice(0,-1)),null!=i&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}(t)}function sB(t){return S(t)?t:{type:t||"pad"}}const cB=t=>+t||0;function fB(t){return S(t)?t.signal?t:{top:cB(t.top),bottom:cB(t.bottom),left:cB(t.left),right:cB(t.right)}:{top:n=cB(t),bottom:n,left:n,right:n};var n}const lB=t=>S(t)&&!D(t)?ut({},t):{value:t};function hB(t,n,e,r){return null!=e?(S(e)&&!D(e)||D(e)&&e.length&&S(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function dB(t,n,e){for(const e in n)hB(t,e,n[e]);for(const n in e)hB(t,n,e[n],"update")}function mB(t,n,e){for(const r in n)e&&ft(e,r)||(t[r]=ut(t[r]||{},n[r]));return t}function pB(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const gB="mark",vB="frame",yB="scope",bB="legend-label";function wB(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const xB=t=>xt(t)?Et(t):t.signal?`(${t.signal})`:AB(t);function $B(t){if(null!=t.gradient)return function(t){const n=[t.start,t.stop,t.count].map((t=>null==t?null:Et(t)));for(;n.length&&null==O(n);)n.pop();return n.unshift(xB(t.gradient)),`gradient(${n.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(t){return t.c?kB("hcl",t.h,t.c,t.l):t.h||t.s?kB("hsl",t.h,t.s,t.l):t.l||t.a?kB("lab",t.l,t.a,t.b):t.r||t.g||t.b?kB("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?AB(t.field):void 0!==t.value?Et(t.value):void 0;return null!=t.scale&&(n=function(t,n){const e=xB(t.scale);return null!=t.range?n=`lerp(_range(${e}), ${+t.range})`:(void 0!==n&&(n=`_scale(${e}, ${n})`),t.band&&(n=(n?n+"+":"")+`_bandwidth(${e})`+(1==+t.band?"":"*"+MB(t.band)),t.extra&&(n=`(datum.extra ? _scale(${e}, datum.extra.value) : ${n})`)),null==n&&(n="0")),n}(t,n)),void 0===n&&(n=null),null!=t.exponent&&(n=`pow(${n},${MB(t.exponent)})`),null!=t.mult&&(n+=`*${MB(t.mult)}`),null!=t.offset&&(n+=`+${MB(t.offset)}`),t.round&&(n=`round(${n})`),n}const kB=(t,n,e,r)=>`(${t}(${[n,e,r].map($B).join(",")})+'')`;function MB(t){return S(t)?"("+$B(t)+")":t}function AB(t){return DB(S(t)?t:{datum:t})}function DB(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):p("Invalid field reference: "+Et(t));return t.signal||(r=xt(r)?g(r).map(Et).join("]["):DB(r)),n+"["+r+"]"}function SB(t,n,e,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,n,e,r,i){const o={},a={};let u,s,c,f;for(s in s="lineBreak","text"!==n||null==i[s]||pB(s,t)||wB(o,s,i[s]),("legend"==e||String(e).startsWith("axis"))&&(e=null),f=e===vB?i.group:e===gB?ut({},i.mark,i[n]):null,f)c=pB(s,t)||("fill"===s||"stroke"===s)&&(pB("fill",t)||pB("stroke",t)),c||wB(o,s,f[s]);for(s in K(r).forEach((n=>{const e=i.style&&i.style[n];for(const n in e)pB(n,t)||wB(o,n,e[n])})),t=ut({},t),o)f=o[s],f.signal?(u=u||{})[s]=f:a[s]=f;return t.enter=ut(a,t.enter),u&&(t.update=ut(u,t.update)),t}(t,n,e,r,i.config);for(const e in t)a[e]=FB(t[e],n,o,i);return o}function FB(t,n,e,r){const i={},o={};for(const n in t)null!=t[n]&&(i[n]=EB(D(a=t[n])?function(t){let n="";return t.forEach((t=>{const e=$B(t);n+=t.test?`(${t.test})?${e}:`:e})),":"===O(n)&&(n+="null"),n}(a):$B(a),r,e,o));var a;return{$expr:{marktype:n,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function EB(t,n,e,r){const i=J_(t,n);return i.$fields.forEach((t=>r[t]=1)),ut(e,i.$params),i.$expr}const NB=["value","update","init","react","bind"];function CB(t,n){p(t+' for "outer" push: '+Et(n))}function OB(t,n){const e=t.name;if("outer"===t.push)n.signals[e]||CB("No prior signal definition",e),NB.forEach((n=>{void 0!==t[n]&&CB("Invalid property ",n)}));else{const r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function _B(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function zB(t,n,e,r){return new _B(t,n,e,r)}function BB(t,n){return zB("operator",t,n)}function TB(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function PB(t,n){return n?{$field:t,$name:n}:{$field:t}}const jB=PB("key");function RB(t,n){return{$compare:t,$order:n}}function LB(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const IB="scope",qB="view";function UB(t){return t&&t.signal}function WB(t){if(UB(t))return!0;if(S(t))for(const n in t)if(WB(t[n]))return!0;return!1}function HB(t,n){return null!=t?t:n}function GB(t){return t&&t.signal||t}const YB="timer";function VB(t,n){return(t.merge?XB:t.stream?JB:t.type?KB:p("Invalid stream specification: "+Et(t)))(t,n)}function XB(t,n){const e=QB({merge:t.merge.map((t=>VB(t,n)))},t,n);return n.addStream(e).id}function JB(t,n){const e=QB({stream:VB(t.stream,n)},t,n);return n.addStream(e).id}function KB(t,n){let e;t.type===YB?(e=n.event(YB,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return t===IB?qB:t||qB}(t.source),t.type);const r=QB({stream:e},t,n);return 1===Object.keys(r).length?e:n.addStream(r).id}function QB(t,n,e){let r=n.between;return r&&(2!==r.length&&p('Stream "between" parameter must have 2 entries: '+Et(n)),t.between=[VB(r[0],e),VB(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===IB&&r.push("inScope(event.item)"),r.length&&(t.filter=J_("("+r.join(")&&(")+")",e).$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const ZB={code:"_.$value",ast:{type:"Identifier",value:"value"}};function tT(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const nT=t=>(n,e,r)=>zB(t,e,n||void 0,r),eT=nT("aggregate"),rT=nT("axisticks"),iT=nT("bound"),oT=nT("collect"),aT=nT("compare"),uT=nT("datajoin"),sT=nT("encode"),cT=nT("expression"),fT=nT("facet"),lT=nT("field"),hT=nT("key"),dT=nT("legendentries"),mT=nT("load"),pT=nT("mark"),gT=nT("multiextent"),vT=nT("multivalues"),yT=nT("overlap"),bT=nT("params"),wT=nT("prefacet"),xT=nT("projection"),$T=nT("proxy"),kT=nT("relay"),MT=nT("render"),AT=nT("scale"),DT=nT("sieve"),ST=nT("sortitems"),FT=nT("viewlayout"),ET=nT("values");let NT=0;const CT={min:"min",max:"max",count:"sum"};function OT(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=TT(t.domain,t,n),null!=t.range&&(e.range=WT(t,n,e)),null!=t.interpolate&&function(t,n){n.interpolate=_T(t.type||t),null!=t.gamma&&(n.interpolateGamma=_T(t.gamma))}(t.interpolate,e),null!=t.nice&&(e.nice=function(t,n){return t.signal?n.signalRef(t.signal):S(t)?{interval:_T(t.interval),step:_T(t.step)}:_T(t)}(t.nice,n)),null!=t.bins&&(e.bins=function(t,n){return t.signal||D(t)?zT(t,n):n.objectProperty(t)}(t.bins,n)),t)ft(e,r)||"name"===r||(e[r]=_T(t[r],n))}function _T(t,n){return S(t)?t.signal?n.signalRef(t.signal):p("Unsupported object: "+Et(t)):t}function zT(t,n){return t.signal?n.signalRef(t.signal):t.map((t=>_T(t,n)))}function BT(t){p("Can not find data set: "+Et(t))}function TT(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(D(t)?PT:t.fields?RT:jT)(t,n,e);null==n.domainMin&&null==n.domainMax||p("No scale domain defined for domainMin/domainMax to override.")}function PT(t,n,e){return t.map((t=>_T(t,e)))}function jT(t,n,e){const r=e.getData(t.data);return r||BT(t.data),og(n.type)?r.valuesRef(e,t.field,IT(t.sort,!1)):cg(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function RT(t,n,e){const r=t.data,i=t.fields.reduce(((t,n)=>(n=xt(n)?{data:r,field:n}:D(n)||n.signal?function(t,n){const e="_:vega:_"+NT++,r=oT({});if(D(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Et(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,DT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t)),[]);return(og(n.type)?LT:cg(n.type)?qT:UT)(t,e,i)}function LT(t,n,e){const r=IT(t.sort,!0);let i,o;const a=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.countsRef(n,t.field,r)})),u={groupby:jB,pulse:a};r&&(i=r.op||"count",o=r.field?LB(i,r.field):"count",u.ops=[CT[i]],u.fields=[n.fieldRef(o)],u.as=[o]),i=n.add(eT(u));const s=n.add(oT({pulse:TB(i)}));return o=n.add(ET({field:jB,sort:n.sortRef(r),pulse:TB(s)})),TB(o)}function IT(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!CT[t.op]&&p("Multiple domain scales can not be sorted using "+t.op):p("No field provided for sort aggregate op: "+t.op):S(t)?t.field="key":t={field:"key"}),t}function qT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.domainRef(n,t.field)}));return TB(n.add(vT({values:r})))}function UT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.extentRef(n,t.field)}));return TB(n.add(gT({extents:r})))}function WT(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if(xt(i)){if(r&&ft(r,i))return WT(t=ut({},t,{range:r[i]}),n,e);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=og(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:p("Unrecognized scale range value: "+Et(i))}else{if(i.scheme)return e.scheme=D(i.scheme)?zT(i.scheme,n):_T(i.scheme,n),i.extent&&(e.schemeExtent=zT(i.extent,n)),void(i.count&&(e.schemeCount=_T(i.count,n)));if(i.step)return void(e.rangeStep=_T(i.step,n));if(og(t.type)&&!D(i))return TT(i,t,n);D(i)||p("Unsupported range type: "+Et(i))}return i.map((t=>(D(t)?zT:_T)(t,n)))}function HT(t,n,e){return D(t)?t.map((t=>HT(t,n,e))):S(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:p("Unsupported parameter object: "+Et(t)):t}const GT="top",YT="left",VT="right",XT="bottom",JT="center",KT="index",QT="label",ZT="perc",tP="value",nP="guide-label",eP="guide-title",rP="symbol",iP="gradient",oP="discrete",aP="size",uP=[aP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],sP={name:1,style:1,interactive:1},cP={value:0},fP={value:1},lP="group",hP="rect",dP="rule",mP="text";function pP(t){return t.type=lP,t.interactive=t.interactive||!1,t}function gP(t,n){const e=(e,r)=>HB(t[e],HB(n[e],r));return e.isVertical=e=>"vertical"===HB(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection)),e.gradientLength=()=>HB(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>HB(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>HB(t.columns,HB(n.columns,+e.isVertical(!0))),e}function vP(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function yP(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const bP=yP(Et(YT),Et(VT),Et(JT));function wP(t,n){return n?t?S(t)?Object.assign({},t,{offset:wP(t.offset,n)}):{value:t,offset:n}:n:t}function xP(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=mB(t.encode,n,sP)):t.interactive=!1,t}function $P(t,n,e,r){const i=gP(t,e),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,c,f,l,h;o?(c=[0,1],f=[0,0],l=a,h=u):(c=[0,0],f=[1,0],l=u,h=a);const d={enter:s={opacity:cP,x:cP,y:cP,width:lB(l),height:lB(h)},update:ut({},s,{opacity:fP,fill:{gradient:n,start:c,stop:f}}),exit:{opacity:cP}};return dB(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),xP({type:hP,role:"legend-gradient",encode:d},r)}function kP(t,n,e,r,i){const o=gP(t,e),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let c,f,l,h,d="";a?(c="y",l="y2",f="x",h="width",d="1-"):(c="x",l="x2",f="y",h="height");const m={opacity:cP,fill:{scale:n,field:tP}};m[c]={signal:d+"datum."+ZT,mult:s},m[f]=cP,m[l]={signal:d+"datum.perc2",mult:s},m[h]=lB(u);const p={enter:m,update:ut({},m,{opacity:fP}),exit:{opacity:cP}};return dB(p,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),xP({type:hP,role:"legend-band",key:tP,from:i,encode:p},r)}const MP=`datum.${ZT}<=0?"${YT}":datum.${ZT}>=1?"${VT}":"${JT}"`,AP=`datum.${ZT}<=0?"${XT}":datum.${ZT}>=1?"${GT}":"middle"`;function DP(t,n,e,r){const i=gP(t,n),o=i.isVertical(),a=lB(i.gradientThickness()),u=i.gradientLength();let s,c,f,l,h=i("labelOverlap"),d="";const m={enter:s={opacity:cP},update:c={opacity:fP,text:{field:QT}},exit:{opacity:cP}};return dB(m,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:HB(t.labelLimit,n.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=c.baseline={signal:AP},f="y",l="x",d="1-"):(s.align=c.align={signal:MP},s.baseline={value:"top"},f="x",l="y"),s[f]=c[f]={signal:d+"datum."+ZT,mult:u},s[l]=c[l]=a,a.offset=HB(t.labelOffset,n.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum."+KT}:void 0,xP({type:mP,role:bB,style:nP,key:tP,from:r,encode:m,overlap:h},e)}function SP(t,n,e,r,i){const o=gP(t,n),a=e.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,c=o("clipHeight"),f=o("symbolOffset"),l={data:"value"},h=`(${i}) ? datum.offset : datum.${aP}`,d=c?lB(c):{field:aP},m=`datum.${KT}`,p=`max(1, ${i})`;let g,v,y,b,w;d.mult=.5,g={enter:v={opacity:cP,x:{signal:h,mult:.5,offset:f},y:d},update:y={opacity:fP,x:v.x,y:v.y},exit:{opacity:cP}};let x=null,$=null;t.fill||(x=n.symbolBaseFillColor,$=n.symbolBaseStrokeColor),dB(g,{fill:o("symbolFillColor",x),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",$),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),uP.forEach((n=>{t[n]&&(y[n]=v[n]={scale:t[n],field:tP})}));const k=xP({type:"symbol",role:"legend-symbol",key:tP,from:l,clip:!!c||void 0,encode:g},e.symbols),M=lB(f);M.offset=o("labelOffset"),g={enter:v={opacity:cP,x:{signal:h,offset:M},y:d},update:y={opacity:fP,text:{field:QT},x:v.x,y:v.y},exit:{opacity:cP}},dB(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=xP({type:mP,role:bB,style:nP,key:tP,from:l,encode:g},e.labels);return g={enter:{noBound:{value:!c},width:cP,height:c?lB(c):cP,opacity:cP},exit:{opacity:cP},update:y={opacity:fP,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${p})`,y.row.signal=`${m}%${b}`,y.column.signal=`floor(${m} / ${b})`,w={field:["row",m]}):(y.row.signal=`floor(${m} / ${p})`,y.column.signal=`${m} % ${p}`,w={field:m}),y.column.signal=`(${i})?${y.column.signal}:${m}`,pP({role:yB,from:r={facet:{data:r,name:"value",groupby:KT}},encode:mB(g,a,sP),marks:[k,A],name:s,interactive:u,sort:w})}const FP='item.orient === "left"',EP='item.orient === "right"',NP=`(${FP} || ${EP})`,CP=`datum.vgrad && ${NP}`,OP=yP('"top"','"bottom"','"middle"'),_P=`datum.vgrad && ${EP} ? (${yP('"right"','"left"','"center"')}) : (${NP} && !(datum.vgrad && ${FP})) ? "left" : ${bP}`,zP=`item._anchor || (${NP} ? "middle" : "start")`,BP=`${CP} ? (${FP} ? -90 : 90) : 0`,TP=`${NP} ? (datum.vgrad ? (${EP} ? "bottom" : "top") : ${OP}) : "top"`;function PP(t,n){let e;return S(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+jP(t.path)+")":t.sphere&&(e="geoShape("+jP(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function jP(t){return S(t)&&t.signal?t.signal:Et(t)}function RP(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===lP?yB:n||gB}function LP(t){return{marktype:t.type,name:t.name||void 0,role:t.role||RP(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function IP(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function qP(t,n){const e=Ba(t.type);e||p("Unrecognized transform type: "+Et(t.type));const r=zB(e.type.toLowerCase(),null,UP(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function UP(t,n,e){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=WP(i,n,e)}return r}function WP(t,n,e){const r=t.type,i=n[t.name];return"index"===r?function(t,n,e){return xt(n.from)||p('Lookup "from" parameter must be a string literal.'),e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==i?"param"===r?function(t,n,e){const r=n[t.name];return t.array?(D(r)||p("Expected an array of sub-parameters. Instead: "+Et(r)),r.map((n=>GP(t,n,e)))):GP(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!UB(i)?i.map((n=>HP(t,n,e))):HP(t,i,e):void(t.required&&p("Missing required "+Et(n.type)+" parameter: "+Et(t.name)))}function HP(t,n,e){const r=t.type;if(UB(n))return JP(r)?p("Expression references can not be signals."):KP(r)?e.fieldRef(n):QP(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||KP(r);return i&&YP(n)?e.exprRef(n.expr,n.as):i&&VP(n)?PB(n.field,n.as):JP(r)?J_(n,e):XP(r)?TB(e.getData(n).values):KP(r)?PB(n):QP(r)?e.compareRef(n):n}}function GP(t,n,e){const r=t.params.length;let i;for(let e=0;e<r;++e){i=t.params[e];for(const t in i.key)if(i.key[t]!==n[t]){i=null;break}if(i)break}i||p("Unsupported parameter: "+Et(n));const o=ut(UP(i,n,e),i.key);return TB(e.add(bT(o)))}const YP=t=>t&&t.expr,VP=t=>t&&t.field,XP=t=>"data"===t,JP=t=>"expr"===t,KP=t=>"field"===t,QP=t=>"compare"===t;function ZP(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:TB(n.getData(t.data).output)}function tj(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function nj(t){return xt(t)?t:null}function ej(t,n,e){const r=LB(e.op,e.field);let i;if(n.ops){for(let t=0,e=n.as.length;t<e;++t)if(n.as[t]===r)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((i=e.op.signal)?t.signalRef(i):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(r))}function rj(t,n,e,r,i,o,a){const u=n[e]||(n[e]={}),s=function(t){return S(t)?("descending"===t.order?"-":"+")+LB(t.op,t.field):""}(o);let c,f,l=nj(i);if(null!=l&&(t=n.scope,l+=s?"|"+s:"",c=u[l]),!c){const e=o?{field:jB,pulse:n.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:TB(n.output)};s&&(e.sort=t.sortRef(o)),f=t.add(zB(r,void 0,e)),a&&(n.index[i]=f),c=TB(f),null!=l&&(u[l]=c)}return c}function ij(t,n,e){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,u=t.values,s=n.add(BB()),c=J_("if("+t.trigger+',modify("'+e+'",'+[i,r,o,a,u].map((t=>null==t?"null":t)).join(",")+"),0)",n);s.update=c.$expr,s.params=c.$params}function oj(t,n){const e=RP(t),r=t.type===lP,i=t.from&&t.from.facet,o=t.overlap;let a,u,s,c,f,l,h,d=t.layout||e===yB||e===vB;const m=e===gB||d||i,g=function(t,n,e){let r,i,o,a,u;return t?(r=t.facet)&&(n||p("Only group marks can be faceted."),null!=r.field?a=u=ZP(r,e):(t.data?u=TB(e.getData(t.data).aggregate):(o=qP(ut({type:"aggregate",groupby:K(r.groupby)},r.aggregate),e),o.params.key=e.keyRef(r.groupby),o.params.pulse=ZP(r,e),a=u=TB(e.add(o))),i=e.keyRef(r.groupby,!0))):a=TB(e.add(oT(null,[{}]))),a||(a=ZP(t,e)),{key:i,pulse:a,parent:u}}(t.from,r,n);u=n.add(uT({key:g.key||(t.key?PB(t.key):void 0),pulse:g.pulse,clean:!r}));const v=TB(u);u=s=n.add(oT({pulse:v})),u=n.add(pT({markdef:LP(t),interactive:IP(t.interactive,n),clip:PP(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:TB(u)}));const y=TB(u);u=c=n.add(sT(SB(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),u.params.parent=n.encode(),t.transform&&t.transform.forEach((t=>{const e=qP(t,n),r=e.metadata;(r.generates||r.changes)&&p("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),e.params.pulse=TB(u),n.add(u=e)})),t.sort&&(u=n.add(ST({sort:n.compareRef(t.sort),pulse:TB(u)})));const b=TB(u);(i||d)&&(d=n.add(FT({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:b})),l=TB(d));const w=n.add(iT({mark:y,pulse:l||b}));h=TB(w),r&&(m&&(a=n.operators,a.pop(),d&&a.pop()),n.pushState(b,l||h,v),i?function(t,n,e){const r=t.from.facet,i=r.name,o=ZP(r,n);let a;r.name||p("Facet must have a name: "+Et(r)),r.data||p("Facet must reference a data set: "+Et(r)),r.field?a=n.add(wT({field:n.fieldRef(r.field),pulse:o})):r.groupby?a=n.add(fT({key:n.keyRef(r.groupby),group:TB(n.proxy(e.parent)),pulse:o})):p("Facet must specify groupby or field: "+Et(r));const u=n.fork(),s=u.add(oT()),c=u.add(DT({pulse:TB(s)}));u.addData(i,new tj(u,s,s,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,n,g):m?function(t,n,e){const r=n.add(wT({pulse:e.pulse})),i=n.fork();i.add(DT()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,n,g):n.parse(t),n.popState(),m&&(d&&a.push(d),a.push(w))),o&&(h=function(t,n,e){const r=t.method,i=t.bound,o=t.separation,a={separation:UB(o)?e.signalRef(o.signal):o,method:UB(r)?e.signalRef(r.signal):r,pulse:n};if(t.order&&(a.sort=e.compareRef({field:t.order})),i){const t=i.tolerance;a.boundTolerance=UB(t)?e.signalRef(t.signal):+t,a.boundScale=e.scaleRef(i.scale),a.boundOrient=i.orient}return TB(e.add(yT(a)))}(o,h,n));const x=n.add(MT({pulse:h})),$=n.add(DT({pulse:TB(x)},void 0,n.parent()));null!=t.name&&(f=t.name,n.addData(f,new tj(n,s,x,$)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&p("Marks only support modify triggers."),ij(t,n,f)})))}function aj(t,n,e){const r={enter:{},update:{}};return dB(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function uj(t,n,e){return n[t]?`scale("${n[t]}",datum)`:vP(t,e[0].encode)}tj.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let o=n[0],a=null,u=1;for(o&&"load"===o.type&&(o=n[1]),t.add(n[0]);u<e;++u)n[u].params.pulse=TB(n[u-1]),t.add(n[u]),"aggregate"===n[u].type&&(a=n[u]);return new tj(t,o,i,r,a)},tj.prototype={countsRef(t,n,e){const r=this,i=r.counts||(r.counts={}),o=nj(n);let a,u,s;return null!=o&&(t=r.scope,a=i[o]),a?e&&e.field&&ej(t,a.agg.params,e):(s={groupby:t.fieldRef(n,"key"),pulse:TB(r.output)},e&&e.field&&ej(t,s,e),u=t.add(eT(s)),a=t.add(oT({pulse:TB(u)})),a={agg:u,ref:TB(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return TB(this.values)},extentRef(t,n){return rj(t,this,"extent","extent",n,!1)},domainRef(t,n){return rj(t,this,"domain","values",n,!1)},valuesRef(t,n,e){return rj(t,this,"vals","values",n,e||!0)},lookupRef(t,n){return rj(t,this,"lookup","tupleindex",n,!1)},indataRef(t,n){return rj(t,this,"indata","tupleindex",n,!0,!0)}};const sj=`item.orient==="${YT}"?-90:item.orient==="${VT}"?90:0`;function cj(t,n){const e={enter:{},update:{}};return dB(e,{orient:t("orient"),anchor:t("anchor"),align:{signal:bP},angle:{signal:sj},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),mB(e,n,sP)}function fj(t){const n=oT({},t);return n.metadata={source:!0},n}function lj(t,n){return mT({url:n.url?t.property(n.url):void 0,async:n.async?t.property(n.async):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}const hj=t=>t===XT||t===GT,dj=(t,n,e)=>UB(t)?bj(t.signal,n,e):t===YT||t===GT?n:e,mj=(t,n,e)=>UB(t)?vj(t.signal,n,e):hj(t)?n:e,pj=(t,n,e)=>UB(t)?yj(t.signal,n,e):hj(t)?e:n,gj=(t,n,e)=>UB(t)?wj(t.signal,n,e):t===GT?{value:n}:{value:e},vj=(t,n,e)=>xj(`${t} === '${GT}' || ${t} === '${XT}'`,n,e),yj=(t,n,e)=>xj(`${t} !== '${GT}' && ${t} !== '${XT}'`,n,e),bj=(t,n,e)=>kj(`${t} === '${YT}' || ${t} === '${GT}'`,n,e),wj=(t,n,e)=>kj(`${t} === '${GT}'`,n,e),xj=(t,n,e)=>(n=null!=n?lB(n):n,e=null!=e?lB(e):e,$j(n)&&$j(e)?{signal:`${t} ? (${n=n?n.signal||Et(n.value):null}) : (${e=e?e.signal||Et(e.value):null})`}:[ut({test:t},n)].concat(e||[])),$j=t=>null==t||1===Object.keys(t).length,kj=(t,n,e)=>({signal:`${t} ? (${Aj(n)}) : (${Aj(e)})`}),Mj=(t,n,e,r,i)=>({signal:(null!=r?`${t} === '${YT}' ? (${Aj(r)}) : `:"")+(null!=e?`${t} === '${XT}' ? (${Aj(e)}) : `:"")+(null!=i?`${t} === '${VT}' ? (${Aj(i)}) : `:"")+(null!=n?`${t} === '${GT}' ? (${Aj(n)}) : `:"")+"(null)"}),Aj=t=>UB(t)?t.signal:null==t?null:Et(t),Dj=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function Sj(t,n,e,r){let i;if(n&&ft(n,t))return n[t];if(ft(e,t))return e[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[eP][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[nP][i]}return null}function Fj(t){const n={};for(const e of t)if(e)for(const t in e)n[t]=1;return Object.keys(n)}function Ej(t,n){return{scale:t.scale,range:n}}function Nj(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function Cj(t,n,e,r,i,o){const a=gP(t,n),u=t.orient,s=t.scale,c=dj(u,-1,1),f=GB(a("labelFlush")),l=GB(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let m,p=0===f||!!f;const g=lB(i);g.mult=c,g.offset=lB(a("labelPadding")||0),g.offset.mult=c;const v={scale:s,field:tP,band:.5,offset:wP(o.offset,a("labelOffset"))},y=mj(u,p?Nj(s,f,'"left"','"right"','"center"'):{value:"center"},((t,n,e)=>UB(t)?((t,n,e)=>kj(`${t} === '${VT}'`,n,e))(t.signal,n,e):t===VT?{value:n}:{value:e})(u,"left","right")),b=mj(u,gj(u,"bottom","top"),p?Nj(s,f,'"top"','"bottom"','"middle"'):{value:"middle"}),w=Nj(s,f,`-(${l})`,l,0);p=p&&l;const x={opacity:cP,x:mj(u,v,g),y:pj(u,v,g)},$={enter:x,update:m={opacity:fP,text:{field:QT},x:x.x,y:x.y,align:y,baseline:b},exit:{opacity:cP,x:x.x,y:x.y}};dB($,{dx:!h&&p?mj(u,w):null,dy:!d&&p?pj(u,w):null}),dB($,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let M=a("labelOverlap");return M=M||k?{separation:a("labelSeparation"),method:M,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,m.align!==y&&(m.align=Dj(m.align,y)),m.baseline!==b&&(m.baseline=Dj(m.baseline,b)),xP({type:mP,role:"axis-label",style:nP,key:tP,from:r,encode:$,overlap:M},e)}function Oj(t,n){const e=function(t,n){var e,r,i,o=n.config,a=o.style,u=o.axis,s="band"===n.scaleType(t.scale)&&o.axisBand,c=t.orient;if(UB(c)){const t=Fj([o.axisX,o.axisY]),n=Fj([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(e={},t))e[i]=mj(c,Sj(i,o.axisX,u,a),Sj(i,o.axisY,u,a));for(i of(r={},n))r[i]=Mj(c.signal,Sj(i,o.axisTop,u,a),Sj(i,o.axisBottom,u,a),Sj(i,o.axisLeft,u,a),Sj(i,o.axisRight,u,a))}else e=c===GT||c===XT?o.axisX:o.axisY,r=o["axis"+c[0].toUpperCase()+c.slice(1)];return e||r||s?ut({},u,e,r,s):u}(t,n),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=gP(t,e),c=function(t){const n=t("tickBand");let e,r,i=t("tickOffset");return n?n.signal?(e={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${n.signal}) === 'extent'`},S(i)||(i={signal:`(${n.signal}) === 'extent' ? 0 : ${i}`})):"extent"===n?(e=1,r=!0,i=0):(e=.5,r=!1):(e=t("bandPosition"),r=t("tickExtra")),{extra:r,band:e,offset:i}}(s),f={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},l=TB(n.add(oT({},[f]))),h=TB(n.add(rT({scale:n.scaleRef(t.scale),extra:n.property(c.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),d=[];let m;return f.grid&&d.push(function(t,n,e,r,i){const o=gP(t,n),a=t.orient,u=t.gridScale,s=dj(a,1,-1),c=function(t,n){if(1===n);else if(S(t)){let e=t=ut({},t);for(;null!=e.mult;){if(!S(e.mult))return e.mult=UB(n)?{signal:`(${e.mult}) * (${n.signal})`}:e.mult*n,t;e=e.mult=ut({},e.mult)}e.mult=n}else t=UB(n)?{signal:`(${n.signal}) * (${t||0})`}:n*(t||0);return t}(t.offset,s);let f,l,h;const d={enter:f={opacity:cP},update:h={opacity:fP},exit:l={opacity:cP}};dB(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const m={scale:t.scale,field:tP,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},p=mj(a,{signal:"height"},{signal:"width"}),g=u?{scale:u,range:0,mult:s,offset:c}:{value:0,offset:c},v=u?{scale:u,range:1,mult:s,offset:c}:ut(p,{mult:s,offset:c});return f.x=h.x=mj(a,m,g),f.y=h.y=pj(a,m,g),f.x2=h.x2=pj(a,v),f.y2=h.y2=mj(a,v),l.x=mj(a,m),l.y=pj(a,m),xP({type:dP,role:"axis-grid",key:tP,from:r,encode:d},e)}(t,e,r.grid,h,c)),f.ticks&&(m=s("tickSize"),d.push(function(t,n,e,r,i,o){const a=gP(t,n),u=t.orient,s=dj(u,-1,1);let c,f,l;const h={enter:c={opacity:cP},update:l={opacity:fP},exit:f={opacity:cP}};dB(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=lB(i);d.mult=s;const m={scale:t.scale,field:tP,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return l.y=c.y=mj(u,cP,m),l.y2=c.y2=mj(u,d),f.x=mj(u,m),l.x=c.x=pj(u,cP,m),l.x2=c.x2=pj(u,d),f.y=pj(u,m),xP({type:dP,role:"axis-tick",key:tP,from:r,encode:h},e)}(t,e,r.ticks,h,m,c))),f.labels&&(m=f.ticks?m:0,d.push(Cj(t,e,r.labels,h,m,c))),f.domain&&d.push(function(t,n,e,r){const i=gP(t,n),o=t.orient;let a,u;const s={enter:a={opacity:cP},update:u={opacity:fP},exit:{opacity:cP}};dB(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const c=Ej(t,0),f=Ej(t,1);return a.x=u.x=mj(o,c,cP),a.x2=u.x2=mj(o,f),a.y=u.y=pj(o,c,cP),a.y2=u.y2=pj(o,f),xP({type:dP,role:"axis-domain",from:r,encode:s},e)}(t,e,r.domain,l)),f.title&&d.push(function(t,n,e,r){const i=gP(t,n),o=t.orient,a=dj(o,-1,1);let u,s;const c={enter:u={opacity:cP,anchor:lB(i("titleAnchor",null)),align:{signal:bP}},update:s=ut({},u,{opacity:fP,text:lB(t.title)}),exit:{opacity:cP}},f={signal:`lerp(range("${t.scale}"), ${yP(0,1,.5)})`};return s.x=mj(o,f),s.y=pj(o,f),u.angle=mj(o,cP,(t=>UB(t)?{signal:`(${t.signal}) * 90`}:{value:90*t})(a)),u.baseline=mj(o,gj(o,XT,GT),{value:XT}),s.angle=u.angle,s.baseline=u.baseline,dB(c,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,n,e,r){const i=(t,n)=>null!=t?(e.update[n]=Dj(lB(t),e.update[n]),!1):!pB(n,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");e.enter.auto=a===o?lB(a):mj(n,lB(a),lB(o))}(i,o,c,e),c.update.align=Dj(c.update.align,u.align),c.update.angle=Dj(c.update.angle,u.angle),c.update.baseline=Dj(c.update.baseline,u.baseline),xP({type:mP,role:"axis-title",style:eP,from:r,encode:c},e)}(t,e,r.title,l)),oj(pP({role:"axis",from:l,encode:mB(_j(s,t),i,sP),marks:d,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),n)}function _j(t,n){const e={enter:{},update:{}};return dB(e,{orient:t("orient"),offset:t("offset")||0,position:HB(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function zj(t,n,e){const r=K(t.signals),i=K(t.scales);return e||r.forEach((t=>OB(t,n))),K(t.projections).forEach((t=>function(t,n){const e=n.config.projection||{},r={};for(const e in t)"name"!==e&&(r[e]=HT(t[e],e,n));for(const t in e)null==r[t]&&(r[t]=HT(e[t],t,n));n.addProjection(t.name,r)}(t,n))),i.forEach((t=>function(t,n){const e=t.type||"linear";eg(e)||p("Unrecognized scale type: "+Et(e)),n.addScale(t.name,{type:e,domain:void 0})}(t,n))),K(t.data).forEach((t=>function(t,n){const e=[];t.transform&&t.transform.forEach((t=>{e.push(qP(t,n))})),t.on&&t.on.forEach((e=>{ij(e,n,t.name)})),n.addDataPipeline(t.name,function(t,n,e){const r=[];let i,o,a,u,s,c=null,f=!1,l=!1;for(t.values?UB(t.values)||WB(t.format)?(r.push(lj(n,t)),r.push(c=fj())):r.push(c=fj({$ingest:t.values,$format:t.format})):t.url?WB(t.url)||WB(t.format)?(r.push(lj(n,t)),r.push(c=fj())):r.push(c=fj({$request:t.url,$format:t.format})):t.source&&(c=i=K(t.source).map((t=>TB(n.getData(t).output))),r.push(null)),o=0,a=e.length;o<a;++o)u=e[o],s=u.metadata,c||s.source||r.push(c=fj()),r.push(u),s.generates&&(l=!0),s.modifies&&!l&&(f=!0),s.source?c=u:s.changes&&(c=null);return i&&(a=i.length-1,r[0]=kT({derive:f,pulse:a?i:i[0]}),(f||a)&&r.splice(1,0,fj())),c||r.push(fj()),r.push(DT({})),r}(t,n,e))}(t,n))),i.forEach((t=>OT(t,n))),(e||r).forEach((t=>function(t,n){const e=n.getSignal(t.name);let r=t.update;t.init&&(r?p("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=J_(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach((t=>function(t,n,e){const r=t.encode,i={target:e};let o=t.events,a=t.update,u=[];o||p("Signal update missing events specification."),xt(o)&&(o=iB(o,n.isSubscope()?IB:qB)),o=K(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[tT(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&p("Signal encode and update are mutually exclusive."),a="encode(item(),"+Et(r)+")"),i.update=xt(a)?J_(a,n):null!=a.expr?J_(a.expr,n):null!=a.value?a.value:null!=a.signal?{$expr:ZB,$params:{$value:n.signalRef(a.signal)}}:p("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>n.addUpdate(ut(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):VB(t,n)}}(t,n),i))))}(t,n,e.id)))}(t,n))),K(t.axes).forEach((t=>Oj(t,n))),K(t.marks).forEach((t=>oj(t,n))),K(t.legends).forEach((t=>function(t,n){const e=n.config.legend,r=t.encode||{},i=gP(t,e),o=r.legend||{},a=o.name||void 0,u=o.interactive,s=o.style,c={};let f,l,h,d=0;uP.forEach((n=>t[n]?(c[n]=t[n],d=d||t[n]):0)),d||p("Missing valid scale for legend.");const m=function(t,n){let e=t.type||rP;return t.type||1!==function(t){return uP.reduce(((n,e)=>n+(t[e]?1:0)),0)}(t)||!t.fill&&!t.stroke||(e=ig(n)?iP:ag(n)?oP:rP),e!==iP?e:ag(n)?oP:iP}(t,n.scaleType(d)),g={title:null!=t.title,scales:c,type:m,vgrad:"symbol"!==m&&i.isVertical()},v=TB(n.add(oT(null,[g]))),y=TB(n.add(dT(l={type:m,scale:n.scaleRef(d),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return m===iP?(h=[$P(t,d,e,r.gradient),DP(t,e,r.labels,y)],l.count=l.count||n.signalRef(`max(2,2*floor((${GB(i.gradientLength())})/100))`)):m===oP?h=[kP(t,d,e,r.gradient,y),DP(t,e,r.labels,y)]:(f=function(t,n){const e=gP(t,n);return{align:e("gridAlign"),columns:e.entryColumns(),center:{row:!0,column:!1},padding:{row:e("rowPadding"),column:e("columnPadding")}}}(t,e),h=[SP(t,e,r,y,GB(f.columns))],l.size=function(t,n,e){const r=GB(uj("size",t,e)),i=GB(uj("strokeWidth",t,e)),o=GB(function(t,n,e){return vP("fontSize",t)||function(t,n,e){const r=n.config.style[e];return r&&r.fontSize}(0,n,e)}(e[1].encode,n,nP));return J_(`max(ceil(sqrt(${r})+${i}),${o})`,n)}(t,n,h[0].marks)),h=[pP({role:"legend-entry",from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:f,interactive:u})],g.title&&h.push(function(t,n,e,r){const i=gP(t,n),o={enter:{opacity:cP},update:{opacity:fP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:cP}};return dB(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:zP},angle:{signal:BP},align:{signal:_P},baseline:{signal:TP},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),xP({type:mP,role:"legend-title",style:eP,from:r,encode:o},e)}(t,e,r.title,v)),oj(pP({role:"legend",from:v,encode:mB(aj(i,t,e),o,sP),marks:h,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:s}),n)}(t,n))),t.title&&function(t,n){const e=gP(t=xt(t)?{text:t}:t,n.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,u=i.style,s=[],c=TB(n.add(oT(null,[{}])));s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dB(o,{text:t.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),xP({type:mP,role:"title-text",style:"group-title",from:r,encode:o},e)}(t,e,function(t){const n=t.encode;return n&&n.title||ut({name:t.name,interactive:t.interactive,style:t.style},n)}(t),c)),t.subtitle&&s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dB(o,{text:t.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),xP({type:mP,role:"title-subtitle",style:"group-subtitle",from:r,encode:o},e)}(t,e,r.subtitle,c)),oj(pP({role:"title",from:c,encode:cj(e,i),marks:s,aria:e("aria"),description:e("description"),zindex:e("zindex"),name:o,interactive:a,style:u}),n)}(t.title,n),n.parseLambdas(),n}function Bj(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function Tj(t,n){this.config=t||{},this.options=n||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Pj(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function jj(t){return(D(t)?Rj:Lj)(t)}function Rj(t){const n=t.length;let e="[";for(let r=0;r<n;++r){const n=t[r];e+=(r>0?",":"")+(S(n)?n.signal||jj(n):Et(n))}return e+"]"}function Lj(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+Et(n)+":"+(S(e)?e.signal||jj(e):Et(e));return r+"}"}Tj.prototype=Pj.prototype={parse(t){return zj(t,this)},fork(){return new Pj(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((n=>{n.$ref=t.id})),t.refs=null),t},proxy(t){const n=t instanceof _B?TB(t):t;return this.add($T({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){let r,i;t&&(r=t.data||(t.data={}),i=r[n]||(r[n]=[]),i.push(e))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(TB(this.add(DT({pulse:t})))),this._parent.push(n),this._lookup.push(e?TB(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return O(this._parent)},encode(){return O(this._encode)},lookup(){return O(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if(xt(t))return PB(t,n);t.signal||p("Unsupported field reference: "+Et(t));const e=t.signal;let r=this.field[e];if(!r){const t={name:this.signalRef(e)};n&&(t.as=n),this.field[e]=r=TB(this.add(lT(t)))}return r},compareRef(t){let n=!1;const e=t=>UB(t)?(n=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(n=!0,this.exprRef(t.expr)):t,r=K(t.field).map(e),i=K(t.order).map(e);return n?TB(this.add(aT({fields:r,orders:i}))):RB(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=K(t).map((t=>UB(t)?(e=!0,TB(r[t.signal])):t)),e?TB(this.add(hT({fields:t,flat:n}))):function(t,n){const e={$key:t};return n&&(e.$flat=!0),e}(t,n)},sortRef(t){if(!t)return t;const n=LB(t.op,t.field),e=t.order||"ascending";return e.signal?TB(this.add(aT({fields:n,orders:this.signalRef(e.signal)}))):RB(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return ft(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&p("Duplicate signal name: "+Et(t));const e=n instanceof _B?n:this.add(BB(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||p("Unrecognized signal name: "+Et(t)),this.signals[t]},signalRef(t){return this.signals[t]?TB(this.signals[t]):(ft(this.lambdas,t)||(this.lambdas[t]=this.add(BB(null))),TB(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;n<e;++n){const e=t[n],r=J_(e,this),i=this.lambdas[e];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&S(t)?this.signalRef(t.signal||jj(t)):t},exprRef(t,n){const e={expr:J_(t,this)};return n&&(e.expr.$name=n),TB(this.add(cT(e)))},addBinding(t,n){this.bindings||p("Nested signals do not support binding: "+Et(t)),this.bindings.push(ut({signal:t},n))},addScaleProj(t,n){ft(this.scales,t)&&p("Duplicate scale or projection name: "+Et(t)),this.scales[t]=this.add(n)},addScale(t,n){this.addScaleProj(t,AT(n))},addProjection(t,n){this.addScaleProj(t,xT(n))},getScale(t){return this.scales[t]||p("Unrecognized scale name: "+Et(t)),this.scales[t]},scaleRef(t){return TB(this.getScale(t))},scaleType(t){return this.getScale(t).params.type},projectionRef(t){return this.scaleRef(t)},projectionType(t){return this.scaleType(t)},addData(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Et(t)),this.data[t]=n},getData(t){return this.data[t]||p("Undefined data set name: "+Et(t)),this.data[t]},addDataPipeline(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Et(t)),this.addData(t,tj.fromEntries(this,n))}},ut(za,tc,P$,mk,rF,tE,PN,gN,qN,xC,zC,UC);var Ij=Object.freeze({__proto__:null,Bounds:Lv,CanvasHandler:$w,CanvasRenderer:Fw,DATE:we,DAY:xe,DAYOFYEAR:$e,Dataflow:Ca,Debug:4,Error:1,EventStream:va,Gradient:Wg,GroupItem:qv,HOURS:ke,Handler:Zb,HybridHandler:vx,HybridRenderer:gx,Info:3,Item:Iv,MILLISECONDS:De,MINUTES:Me,MONTH:ye,Marks:Pb,MultiPulse:Sa,None:0,Operator:ma,Parameters:la,Pulse:ka,QUARTER:ve,RenderType:xx,Renderer:nw,ResourceLoader:Uv,SECONDS:Ae,SVGHandler:Nw,SVGRenderer:nx,SVGStringRenderer:mx,Scenegraph:Hb,TIME_UNITS:Se,Transform:_a,View:Xz,WEEK:be,Warn:2,YEAR:ge,accessor:c,accessorFields:l,accessorName:f,array:K,ascending:nt,bandwidthNRD:La,bin:Ia,bootstrapCI:Ua,boundClip:Ex,boundContext:fy,boundItem:jb,boundMark:Lb,boundStroke:Gv,changeset:ca,clampRange:Q,codegenExpression:KO,compare:tt,constant:ot,cumulativeLogNormal:eu,cumulativeNormal:Ja,cumulativeUniform:su,dayofyear:ze,debounce:at,defaultLocale:Mo,definition:Ba,densityLogNormal:nu,densityNormal:Xa,densityUniform:uu,domChild:Xb,domClear:Jb,domCreate:Yb,domFind:Vb,dotbin:Wa,error:p,expressionFunction:X_,extend:ut,extent:st,extentIndex:ct,falsy:k,fastmap:ht,field:v,flush:dt,font:Eb,fontFamily:Fb,fontSize:kb,format:Ho,formatLocale:go,formats:Go,hasOwnProperty:ft,id:y,identity:b,inferType:jo,inferTypes:Ro,ingest:ra,inherits:mt,inrange:pt,interpolate:pg,interpolateColors:hg,interpolateRange:lg,intersect:Mx,intersectBoxLine:xy,intersectPath:vy,intersectPoint:yy,intersectRule:wy,isArray:D,isBoolean:gt,isDate:vt,isFunction:Z,isIterable:yt,isNumber:bt,isObject:S,isRegExp:wt,isString:xt,isTuple:ta,key:$t,lerp:kt,lineHeight:Mb,loader:Xo,locale:ko,logger:A,lruCache:Mt,markup:Yw,merge:At,mergeConfig:E,multiLineOffset:Db,one:x,pad:St,panLinear:L,panLog:I,panPow:q,panSymlog:U,parse:function(t,n,e){return S(t)||p("Input Vega specification must be an object."),n=E(function(){const t="sans-serif",n="#4c78a8",e="#000",r="#888",i="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:n},area:{fill:n},image:null,line:{stroke:n,strokeWidth:2},path:{stroke:n},rect:{fill:n},rule:{stroke:e},shape:{stroke:n},symbol:{fill:n,size:64},text:{fill:e,font:t,fontSize:11},trail:{fill:n,size:2},style:{"guide-label":{fill:e,font:t,fontSize:10},"guide-title":{fill:e,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:e,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:e,font:t,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:i},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:r,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),n,t.config),function(t,n){const e=n.config,r=TB(n.root=n.add(BB())),i=function(t,n){const e=e=>HB(t[e],n[e]),r=[Bj("background",e("background")),Bj("autosize",sB(e("autosize"))),Bj("padding",fB(e("padding"))),Bj("width",e("width")||0),Bj("height",e("height")||0)],i=r.reduce(((t,n)=>(t[n.name]=n,t)),{}),o={};return K(t.signals).forEach((t=>{ft(i,t.name)?t=ut(i[t.name],t):r.push(t),o[t.name]=t})),K(n.signals).forEach((t=>{ft(o,t.name)||ft(i,t.name)||r.push(t)})),r}(t,e);i.forEach((t=>OB(t,n))),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const o=n.add(oT()),a=n.add(sT(SB((t=>mB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),lP,vB,t.style,n,{pulse:TB(o)}))),u=n.add(FT({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:TB(a)}));n.operators.pop(),n.pushState(TB(a),TB(u),null),zj(t,n,i),n.operators.push(u);let s=n.add(iT({mark:r,pulse:TB(u)}));return s=n.add(MT({pulse:TB(s)})),s=n.add(DT({pulse:TB(s)})),n.addData("root",new tj(n,o,o,s)),n}(t,new Tj(n,e)).toRuntime()},parseExpression:YO,parseSelector:iB,path:wc,pathCurves:Gg,pathEqual:Cx,pathParse:Qg,pathRectangle:$v,pathRender:cv,pathSymbols:dv,pathTrail:kv,peek:O,point:Qb,projection:AS,quantileLogNormal:ru,quantileNormal:Ka,quantileUniform:cu,quantiles:ja,quantizeInterpolator:dg,quarter:X,quartiles:Ra,get random(){return qa},randomInteger:function(t,n){let e,r,i;null==n&&(n=t,t=0);const o={min(t){return arguments.length?(e=t||0,i=r-e,o):e},max(t){return arguments.length?(r=t||0,i=r-e,o):r},sample:()=>e+Math.floor(i*qa()),pdf:t=>t===Math.floor(t)&&t>=e&&t<r?1/i:0,cdf(t){const n=Math.floor(t);return n<e?0:n>=r?1:(n-e+1)/i},icdf:t=>t>=0&&t<=1?e-1+Math.floor(t*i):NaN};return o.min(t).max(n)},randomKDE:Za,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:iu,randomMixture:ou,randomNormal:Qa,randomUniform:fu,read:Vo,regressionConstant:lu,regressionExp:yu,regressionLinear:gu,regressionLoess:ku,regressionLog:vu,regressionPoly:xu,regressionPow:bu,regressionQuad:wu,renderModule:kx,repeat:Dt,resetDefaultLocale:function(){return mo(),bo(),Mo()},resetSVGClipId:jv,resetSVGDefIds:function(){jv(),Rg=0},responseType:Yo,runtimeContext:oz,sampleCurve:Su,sampleLogNormal:tu,sampleNormal:Va,sampleUniform:au,scale:ng,sceneEqual:Nx,sceneFromJSON:Ub,scenePickVisit:Oy,sceneToJSON:qb,sceneVisit:Cy,sceneZOrder:Ny,scheme:bg,serializeXML:Vw,setHybridRendererOptions:function(t){px.svgMarkTypes=t.svgMarkTypes??["text"],px.svgOnTop=t.svgOnTop??!0,px.debug=t.debug??!1},setRandom:function(t){qa=t},span:Ft,splitAccessPath:g,stringValue:Et,textMetrics:vb,timeBin:br,timeFloor:Je,timeFormatLocale:xo,timeInterval:er,timeOffset:or,timeSequence:sr,timeUnitSpecifier:Ce,timeUnits:Ee,toBoolean:Nt,toDate:Ot,toNumber:_,toSet:zt,toString:_t,transform:Ta,transforms:za,truncate:Bt,truthy:$,tupleid:na,typeParsers:Bo,utcFloor:Ze,utcInterval:rr,utcOffset:ar,utcSequence:cr,utcdayofyear:Le,utcquarter:J,utcweek:Ie,version:"5.31.0",visitArray:Tt,week:Be,writeConfig:N,zero:w,zoomLinear:H,zoomLog:G,zoomPow:Y,zoomSymlog:V}),qj={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Uj={"*":(t,n)=>t*n,"+":(t,n)=>t+n,"-":(t,n)=>t-n,"/":(t,n)=>t/n,"%":(t,n)=>t%n,">":(t,n)=>t>n,"<":(t,n)=>t<n,"<=":(t,n)=>t<=n,">=":(t,n)=>t>=n,"==":(t,n)=>t==n,"!=":(t,n)=>t!=n,"===":(t,n)=>t===n,"!==":(t,n)=>t!==n,"&":(t,n)=>t&n,"|":(t,n)=>t|n,"^":(t,n)=>t^n,"<<":(t,n)=>t<<n,">>":(t,n)=>t>>n,">>>":(t,n)=>t>>>n},Wj={"+":t=>+t,"-":t=>-t,"~":t=>~t,"!":t=>!t};const Hj=Array.prototype.slice,Gj=(t,n,e)=>{const r=e?e(n[0]):n[0];return r[t].apply(r,Hj.call(n,1))};var Yj={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(t,n,e)=>Math.max(n,Math.min(e,t)),now:Date.now,utc:Date.UTC,datetime:(t,n,e,r,i,o,a)=>new Date(t,n||0,null!=e?e:1,r||0,i||0,o||0,a||0),date:t=>new Date(t).getDate(),day:t=>new Date(t).getDay(),year:t=>new Date(t).getFullYear(),month:t=>new Date(t).getMonth(),hours:t=>new Date(t).getHours(),minutes:t=>new Date(t).getMinutes(),seconds:t=>new Date(t).getSeconds(),milliseconds:t=>new Date(t).getMilliseconds(),time:t=>new Date(t).getTime(),timezoneoffset:t=>new Date(t).getTimezoneOffset(),utcdate:t=>new Date(t).getUTCDate(),utcday:t=>new Date(t).getUTCDay(),utcyear:t=>new Date(t).getUTCFullYear(),utcmonth:t=>new Date(t).getUTCMonth(),utchours:t=>new Date(t).getUTCHours(),utcminutes:t=>new Date(t).getUTCMinutes(),utcseconds:t=>new Date(t).getUTCSeconds(),utcmilliseconds:t=>new Date(t).getUTCMilliseconds(),length:t=>t.length,join:function(){return Gj("join",arguments)},indexof:function(){return Gj("indexOf",arguments)},lastindexof:function(){return Gj("lastIndexOf",arguments)},slice:function(){return Gj("slice",arguments)},reverse:t=>t.slice().reverse(),sort:t=>t.slice().sort(nt),parseFloat,parseInt,upper:t=>String(t).toUpperCase(),lower:t=>String(t).toLowerCase(),substring:function(){return Gj("substring",arguments,String)},split:function(){return Gj("split",arguments,String)},replace:function(){return Gj("replace",arguments,String)},trim:t=>String(t).trim(),btoa:t=>btoa(t),atob:t=>atob(t),regexp:RegExp,test:(t,n)=>RegExp(t).test(n)};const Vj=["view","item","group","xy","x","y"],Xj=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Xj.add(setImmediate);const Jj={Literal:(t,n)=>n.value,Identifier:(t,n)=>{const e=n.name;return t.memberDepth>0?e:"datum"===e?t.datum:"event"===e?t.event:"item"===e?t.item:qj[e]||t.params["$"+e]},MemberExpression:(t,n)=>{const e=!n.computed,r=t(n.object);e&&(t.memberDepth+=1);const i=t(n.property);if(e&&(t.memberDepth-=1),!Xj.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(t,n)=>{const e=n.arguments;let r=n.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?t(e[0])?t(e[1]):t(e[2]):(t.fn[r]||Yj[r]).apply(t.fn,e.map(t))},ArrayExpression:(t,n)=>n.elements.map(t),BinaryExpression:(t,n)=>Uj[n.operator](t(n.left),t(n.right)),UnaryExpression:(t,n)=>Wj[n.operator](t(n.argument)),ConditionalExpression:(t,n)=>t(n.test)?t(n.consequent):t(n.alternate),LogicalExpression:(t,n)=>"&&"===n.operator?t(n.left)&&t(n.right):t(n.left)||t(n.right),ObjectExpression:(t,n)=>n.properties.reduce(((n,e)=>{t.memberDepth+=1;const r=t(e.key);return t.memberDepth-=1,Xj.has(t(e.value))?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):n[r]=t(e.value),n}),{})};function Kj(t,n,e,r,i,o){const a=t=>Jj[t.type](a,t);return a.memberDepth=0,a.fn=Object.create(n),a.params=e,a.datum=r,a.event=i,a.item=o,Vj.forEach((t=>a.fn[t]=function(){return i.vega[t](...arguments)})),a(t)}var Qj={operator(t,n){const e=n.ast,r=t.functions;return t=>Kj(e,r,t)},parameter(t,n){const e=n.ast,r=t.functions;return(t,n)=>Kj(e,r,n,t)},event(t,n){const e=n.ast,r=t.functions;return t=>Kj(e,r,void 0,void 0,t)},handler(t,n){const e=n.ast,r=t.functions;return(t,n)=>Kj(e,r,t,n.item&&n.item.datum,n)},encode(t,n){const{marktype:e,channels:r}=n,i=t.functions,o="group"===e||"image"===e||"rect"===e;return(t,n)=>{const a=t.datum;let u,s=0;for(const e in r)u=Kj(r[e].ast,i,n,a,void 0,t),t[e]!==u&&(t[e]=u,s=1);return"rule"!==e&&function(t,n,e){let r;n.x2&&(n.x?(e&&t.x>t.x2&&(r=t.x,t.x=t.x2,t.x2=r),t.width=t.x2-t.x):t.x=t.x2-(t.width||0)),n.xc&&(t.x=t.xc-(t.width||0)/2),n.y2&&(n.y?(e&&t.y>t.y2&&(r=t.y,t.y=t.y2,t.y2=r),t.height=t.y2-t.y):t.y=t.y2-(t.height||0)),n.yc&&(t.y=t.yc-(t.height||0)/2)}(t,r,o),s}}};function Zj(t){return YR(t,"or")}function tR(t){return YR(t,"and")}function nR(t){return YR(t,"not")}function eR(t,n){if(nR(t))eR(t.not,n);else if(tR(t))for(const e of t.and)eR(e,n);else if(Zj(t))for(const e of t.or)eR(e,n);else n(t)}function rR(t,n){return nR(t)?{not:rR(t.not,n)}:tR(t)?{and:t.and.map((t=>rR(t,n)))}:Zj(t)?{or:t.or.map((t=>rR(t,n)))}:n(t)}const iR=structuredClone;function oR(t){throw new Error(t)}function aR(t,n){const e={};for(const r of n)ft(t,r)&&(e[r]=t[r]);return e}function uR(t,n){const e={...t};for(const t of n)delete e[t];return e}function sR(t){if(bt(t))return t;const n=xt(t)?t:GR(t);if(n.length<250)return n;let e=0;for(let t=0;t<n.length;t++)e=(e<<5)-e+n.charCodeAt(t),e|=0;return e}function cR(t){return!1===t||null===t}function fR(t,n){return t.includes(n)}function lR(t,n){let e=0;for(const[r,i]of t.entries())if(n(i,r,e++))return!0;return!1}function hR(t,n){let e=0;for(const[r,i]of t.entries())if(!n(i,r,e++))return!1;return!0}function dR(t,...n){for(const e of n)mR(t,e??{});return t}function mR(t,n){for(const e of xR(n))N(t,e,n[e],!0)}function pR(t,n){const e=[],r={};let i;for(const o of t)i=n(o),i in r||(r[i]=1,e.push(o));return e}function gR(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}function vR(t,n){for(const e of t)if(n.has(e))return!0;return!1}function yR(t){const n=new Set;for(const e of t){const t=g(e).map(((t,n)=>0===n?t:`[${t}]`)),r=t.map(((n,e)=>t.slice(0,e+1).join("")));for(const t of r)n.add(t)}return n}function bR(t,n){return void 0===t||void 0===n||vR(yR(t),yR(n))}function wR(t){return 0===xR(t).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((t=>GR(t))).join(",")})`};const xR=Object.keys,$R=Object.values,kR=Object.entries;function MR(t){return!0===t||!1===t}function AR(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function DR(t,n){return nR(t)?`!(${DR(t.not,n)})`:tR(t)?`(${t.and.map((t=>DR(t,n))).join(") && (")})`:Zj(t)?`(${t.or.map((t=>DR(t,n))).join(") || (")})`:n(t)}function SR(t,n){if(0===n.length)return!0;const e=n.shift();return e in t&&SR(t[e],n)&&delete t[e],wR(t)}function FR(t){return t.charAt(0).toUpperCase()+t.substr(1)}function ER(t,n="datum"){const e=g(t),r=[];for(let t=1;t<=e.length;t++){const i=`[${e.slice(0,t).map(Et).join("][")}]`;r.push(`${n}${i}`)}return r.join(" && ")}function NR(t,n="datum"){return`${n}[${Et(g(t).join("."))}]`}function CR(t){return`datum['${t.replaceAll("'","\\'")}']`}function OR(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function _R(t){return`${g(t).map(OR).join("\\.")}`}function zR(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function BR(t){return`${g(t).join(".")}`}function TR(t){return t?g(t).length:0}function PR(...t){return t.find((t=>void 0!==t))}let jR=42;function RR(t){const n=++jR;return t?String(t)+n:n}function LR(t){return IR(t)?t:`__${t}`}function IR(t){return t.startsWith("__")}function qR(t){if(void 0!==t)return(t%360+360)%360}function UR(t){return!!bt(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const WR=Object.getPrototypeOf(structuredClone({}));function HR(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(!HR(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;for(const e of t.entries())if(!HR(e[1],n.get(e[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(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&&t.valueOf!==WR.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==WR.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;0!=r--;){const e=i[r];if(!HR(t[e],n[e]))return!1}return!0}return t!=t&&n!=n}function GR(t){const n=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===e)return;if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);let r,i;if(Array.isArray(e)){for(i="[",r=0;r<e.length;r++)r&&(i+=","),i+=t(e[r])||"null";return i+"]"}if(null===e)return"null";if(n.includes(e))throw new TypeError("Converting circular structure to JSON");const o=n.push(e)-1,a=Object.keys(e).sort();for(i="",r=0;r<a.length;r++){const n=a[r],o=t(e[n]);o&&(i&&(i+=","),i+=JSON.stringify(n)+":"+o)}return n.splice(o,1),`{${i}}`}(t)}function YR(t,n){return S(t)&&ft(t,n)&&void 0!==t[n]}const VR="row",XR="column",JR="facet",KR="x",QR="y",ZR="x2",tL="y2",nL="xOffset",eL="yOffset",rL="radius",iL="radius2",oL="theta",aL="theta2",uL="latitude",sL="longitude",cL="latitude2",fL="longitude2",lL="time",hL="color",dL="fill",mL="stroke",pL="shape",gL="size",vL="angle",yL="opacity",bL="fillOpacity",wL="strokeOpacity",xL="strokeWidth",$L="strokeDash",kL="text",ML="order",AL="detail",DL="key",SL="tooltip",FL="href",EL="url",NL="description",CL={theta:1,theta2:1,radius:1,radius2:1};function OL(t){return ft(CL,t)}const _L={longitude:1,longitude2:1,latitude:1,latitude2:1};function zL(t){switch(t){case uL:return"y";case cL:return"y2";case sL:return"x";case fL:return"x2"}}function BL(t){return ft(_L,t)}const TL=xR(_L),PL={x:1,y:1,x2:1,y2:1,...CL,..._L,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time: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 jL(t){return t===hL||t===dL||t===mL}const RL={row:1,column:1,facet:1},LL=xR(RL),IL={...PL,...RL},qL=xR(IL),{order:UL,detail:WL,tooltip:HL,...GL}=IL,{row:YL,column:VL,facet:XL,...JL}=GL;function KL(t){return ft(IL,t)}const QL=[ZR,tL,cL,fL,aL,iL];function ZL(t){return tI(t)!==t}function tI(t){switch(t){case ZR:return KR;case tL:return QR;case cL:return uL;case fL:return sL;case aL:return oL;case iL:return rL}return t}function nI(t){if(OL(t))switch(t){case oL:return"startAngle";case aL:return"endAngle";case rL:return"outerRadius";case iL:return"innerRadius"}return t}function eI(t){switch(t){case KR:return ZR;case QR:return tL;case uL:return cL;case sL:return fL;case oL:return aL;case rL:return iL}}function rI(t){switch(t){case KR:case ZR:return"width";case QR:case tL:return"height"}}function iI(t){switch(t){case KR:return"xOffset";case QR:return"yOffset";case ZR:return"x2Offset";case tL:return"y2Offset";case oL:return"thetaOffset";case rL:return"radiusOffset";case aL:return"theta2Offset";case iL:return"radius2Offset"}}function oI(t){switch(t){case KR:return"xOffset";case QR:return"yOffset"}}function aI(t){switch(t){case"xOffset":return"x";case"yOffset":return"y"}}const uI=xR(PL),{x:sI,y:cI,x2:fI,y2:lI,xOffset:hI,yOffset:dI,latitude:mI,longitude:pI,latitude2:gI,longitude2:vI,theta:yI,theta2:bI,radius:wI,radius2:xI,...$I}=PL,kI=xR($I),MI={x:1,y:1},AI=xR(MI);function DI(t){return ft(MI,t)}const SI={theta:1,radius:1},FI=xR(SI);function EI(t){return"width"===t?KR:QR}const NI={xOffset:1,yOffset:1};function CI(t){return ft(NI,t)}const OI={time:1};function _I(t){return t in OI}const{text:zI,tooltip:BI,href:TI,url:PI,description:jI,detail:RI,key:LI,order:II,...qI}=$I,UI=xR(qI),WI={...MI,...SI,...NI,...qI},HI=xR(WI);function GI(t){return ft(WI,t)}const YI={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:VI,...XI}=YI;function JI(t){switch(t){case KR:case QR:case oL:case rL:case nL:case eL:case gL:case vL:case xL:case yL:case bL:case wL:case lL:case ZR:case tL:case aL:case iL:return;case JR:case VR:case XR:case pL:case $L:case kL:case SL:case FL:case EL:case NL:return"discrete";case hL:case dL:case mL:return"flexible";case uL:case sL:case cL:case fL:case AL:case DL:case ML:return}}const KI={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb: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},QI={count:1,min:1,max:1};function ZI(t){return YR(t,"argmin")}function tq(t){return YR(t,"argmax")}function nq(t){return xt(t)&&ft(KI,t)}const eq=new Set(["count","valid","missing","distinct"]);function rq(t){return xt(t)&&eq.has(t)}const iq=new Set(["count","sum","distinct","valid","missing"]),oq=new Set(["mean","average","median","q1","q3","min","max"]);function aq(t){return gt(t)&&(t=$G(t,void 0)),"bin"+xR(t).map((n=>fq(t[n])?AR(`_${n}_${kR(t[n])}`):AR(`_${n}_${t[n]}`))).join("")}function uq(t){return!0===t||cq(t)&&!t.binned}function sq(t){return"binned"===t||cq(t)&&!0===t.binned}function cq(t){return S(t)}function fq(t){return YR(t,"param")}function lq(t){switch(t){case VR:case XR:case gL:case hL:case dL:case mL:case xL:case yL:case bL:case wL:case pL:return 6;case $L:return 4;default:return 10}}function hq(t){return YR(t,"expr")}function dq(t,{level:n}={level:0}){const e=xR(t||{}),r={};for(const i of e)r[i]=0===n?kq(t[i]):dq(t[i],{level:n-1});return r}function mq(t){const{anchor:n,frame:e,offset:r,orient:i,angle:o,limit:a,color:u,subtitleColor:s,subtitleFont:c,subtitleFontSize:f,subtitleFontStyle:l,subtitleFontWeight:h,subtitleLineHeight:d,subtitlePadding:m,...p}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...s?{subtitleColor:s}:{},...c?{subtitleFont:c}:{},...f?{subtitleFontSize:f}:{},...l?{subtitleFontStyle:l}:{},...h?{subtitleFontWeight:h}:{},...d?{subtitleLineHeight:d}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:{...p,...u?{fill:u}:{}},subtitleMarkConfig:aR(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:v}}function pq(t){return xt(t)||D(t)&&xt(t[0])}function gq(t){return YR(t,"signal")}function vq(t){return YR(t,"step")}function yq(t){return!D(t)&&YR(t,"field")&&YR(t,"data")}const bq=xR({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}),wq={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},xq=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function $q(t){const n=D(t.condition)?t.condition.map(Mq):Mq(t.condition);return{...kq(t),condition:n}}function kq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Mq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Aq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return gq(t)?t:void 0!==t?{value:t}:void 0}function Dq(t){return gq(t)?t.signal:Et(t)}function Sq(t){return gq(t)?t.signal:Et(t.value)}function Fq(t){return gq(t)?t.signal:null==t?null:Et(t)}function Eq(t,n,e){for(const r of e){const e=Oq(r,n.markDef,n.config);void 0!==e&&(t[r]=Aq(e))}return t}function Nq(t){return[].concat(t.type,t.style??[])}function Cq(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:o}=r;return i&&YR(n,i)?n[i]:void 0!==n[t]?n[t]:!o||i&&i!==t?Oq(t,n,e,r):void 0}function Oq(t,n,e,{vgChannel:r}={}){const i=_q(t,n,e.style);return PR(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function _q(t,n,e){return zq(t,Nq(n),e)}function zq(t,n,e){let r;n=K(n);for(const i of n){const n=e[i];YR(n,t)&&(r=n[t])}return r}function Bq(t,n){return K(t).reduce(((t,e)=>(t.field.push(sG(e,n)),t.order.push(e.sort??"ascending"),t)),{field:[],order:[]})}function Tq(t,n){const e=[...t];return n.forEach((t=>{for(const n of e)if(HR(n,t))return;e.push(t)})),e}function Pq(t,n){return HR(t,n)||!n?t:t?[...K(t),...K(n)].join(", "):n}function jq(t,n){const e=t.value,r=n.value;if(null==e||null===r)return{explicit:t.explicit,value:null};if((pq(e)||gq(e))&&(pq(r)||gq(r)))return{explicit:t.explicit,value:Pq(e,r)};if(pq(e)||gq(e))return{explicit:t.explicit,value:e};if(pq(r)||gq(r))return{explicit:t.explicit,value:r};if(!(pq(e)||gq(e)||pq(r)||gq(r)))return{explicit:t.explicit,value:Tq(e,r)};throw new Error("It should never reach here")}function Rq(t){return`Invalid specification ${GR(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function Lq(t){return("width"==t?"Width":"Height")+' "container" only works for single views and layered views.'}function Iq(t){return`${"width"==t?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==t?"x":"y"}".`}function qq(t){return t?`Dropping "fit-${t}" because spec has discrete ${rI(t)}.`:'Dropping "fit" because spec has discrete size.'}function Uq(t){return`Unknown field for ${t}. Cannot calculate view size.`}function Wq(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function Hq(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function Gq(t){return`Selection not supported for ${t} yet.`}function Yq(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Vq="Animation involving facet, layer, or concat is currently unsupported.";function Xq(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function Jq(t){return`Ignoring an invalid transform: ${GR(t)}.`}function Kq(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function Qq(t){return`${t}Offset dropped because ${t} is continuous`}function Zq(t){return`Invalid field type "${t}".`}function tU(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function nU(t,n){return`Dropping ${GR(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function eU(t,n){return`${t} dropped as it is incompatible with "${n}".`}function rU(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function iU(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function oU(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${"ordinal"===n?"order":"magnitude"}.`}function aU(t){return`Using unaggregated domain with raw field has no effect (${GR(t)}).`}function uU(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function sU(t){return`Unaggregated domain is currently unsupported for log scale (${GR(t)}).`}function cU(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function fU(t){return`The step for "${t}" is dropped because the ${"width"===t?"x":"y"} is continuous.`}const lU="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function hU(t,n){return`Invalid ${t}: ${GR(n)}.`}function dU(t){return`1D error band does not support ${t}.`}function mU(t){return`Channel ${t} is required for "binned" bin.`}const pU=A(2);let gU=pU;function vU(...t){gU.error(...t)}function yU(...t){gU.warn(...t)}function bU(t){if(t&&S(t))for(const n of SU)if(YR(t,n))return!0;return!1}const wU=["january","february","march","april","may","june","july","august","september","october","november","december"],xU=wU.map((t=>t.substr(0,3))),$U=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],kU=$U.map((t=>t.substr(0,3)));function MU(t,n){const e=[];if(n&&void 0!==t.day&&xR(t).length>1&&(yU(function(t){return`Dropping day from datetime ${GR(t)} as day cannot be combined with other units.`}(t)),delete(t=iR(t)).day),e.push(void 0!==t.year?t.year:2012),void 0!==t.month){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t-1;{const n=t.toLowerCase(),e=wU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=xU.indexOf(r);if(-1!==i)return i;throw new Error(hU("month",t))}}(t.month):t.month;e.push(r)}else if(void 0!==t.quarter){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t>4&&yU(hU("quarter",t)),t-1;throw new Error(hU("quarter",t))}(t.quarter):t.quarter;e.push(bt(r)?3*r:`${r}*3`)}else e.push(0);if(void 0!==t.date)e.push(t.date);else if(void 0!==t.day){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t%7;{const n=t.toLowerCase(),e=$U.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=kU.indexOf(r);if(-1!==i)return i;throw new Error(hU("day",t))}}(t.day):t.day;e.push(bt(r)?r+1:`${r}+1`)}else e.push(1);for(const n of["hours","minutes","seconds","milliseconds"]){const r=t[n];e.push(void 0===r?0:r)}return e}function AU(t){const n=MU(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const DU={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},SU=xR(DU);function FU(t){return S(t)?t.binned:EU(t)}function EU(t){return t&&t.startsWith("binned")}function NU(t){return t.startsWith("utc")}const CU={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function OU(t){return SU.filter((n=>zU(t,n)))}function _U(t){const n=OU(t);return n[n.length-1]}function zU(t,n){const e=t.indexOf(n);return!(e<0||e>0&&"seconds"===n&&"i"===t.charAt(e-1)||t.length>e+3&&"day"===n&&"o"===t.charAt(e+3)||e>0&&"year"===n&&"f"===t.charAt(e-1))}function BU(t){if(t)return`timeUnitSpecifier(${GR(OU(t))}, ${GR(CU)})`}function TU(t){if(!t)return;let n;return xt(t)?n=EU(t)?{unit:t.substring(6),binned:!0}:{unit:t}:S(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),NU(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function PU(t,n=t=>t){const e=TU(t),r=_U(e.unit);if(r&&"day"!==r){const t={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:o}=RU(r,e.step);return`${n(AU({...t,[o]:+t[o]+i}))} - ${n(AU(t))}`}}const jU={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function RU(t,n=1){if(function(t){return ft(jU,t)}(t))return{part:t,step:n};switch(t){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function LU(t){return!!t?.field&&void 0!==t.equal}function IU(t){return!!t?.field&&void 0!==t.lt}function qU(t){return!!t?.field&&void 0!==t.lte}function UU(t){return!!t?.field&&void 0!==t.gt}function WU(t){return!!t?.field&&void 0!==t.gte}function HU(t){if(t?.field){if(D(t.range)&&2===t.range.length)return!0;if(gq(t.range))return!0}return!1}function GU(t){return!!t?.field&&(D(t.oneOf)||D(t.in))}function YU(t){return GU(t)||LU(t)||HU(t)||IU(t)||UU(t)||qU(t)||WU(t)}function VU(t,n){return AG(t,{timeUnit:n,wrapTime:!0})}function XU(t,n=!0){const{field:e}=t,r=TU(t.timeUnit),{unit:i,binned:o}=r||{},a=sG(t,{expr:"datum"}),u=i?`time(${o?a:function(t,n,{end:e}={end:!1}){const r=ER(n),i=NU(t)?"utc":"";let o;const a={};for(const n of SU)zU(t,n)&&(a[n]="quarter"===(u=n)?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`,o=n);var u;return e&&(a[o]+="+1"),function(t){const n=MU(t,!1).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}(a)}(i,e)})`:a;if(LU(t))return`${u}===${VU(t.equal,i)}`;if(IU(t))return`${u}<${VU(t.lt,i)}`;if(UU(t))return`${u}>${VU(t.gt,i)}`;if(qU(t))return`${u}<=${VU(t.lte,i)}`;if(WU(t))return`${u}>=${VU(t.gte,i)}`;if(GU(t))return`indexof([${function(t,n){return t.map((t=>VU(t,n)))}(t.oneOf,i).join(",")}], ${u}) !== -1`;if(function(t){return!!t?.field&&void 0!==t.valid}(t))return JU(u,t.valid);if(HU(t)){const{range:e}=dq(t),r=gq(e)?{signal:`${e.signal}[0]`}:e[0],o=gq(e)?{signal:`${e.signal}[1]`}:e[1];if(null!==r&&null!==o&&n)return"inrange("+u+", ["+VU(r,i)+", "+VU(o,i)+"])";const a=[];return null!==r&&a.push(`${u} >= ${VU(r,i)}`),null!==o&&a.push(`${u} <= ${VU(o,i)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${GR(t)}`)}function JU(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function KU(t){return YU(t)&&t.timeUnit?{...t,timeUnit:TU(t.timeUnit)}:t}function QU(t){return"quantitative"===t||"temporal"===t}function ZU(t){return"ordinal"===t||"nominal"===t}const tW="quantitative",nW="ordinal",eW="temporal",rW="nominal",iW="geojson",oW="linear",aW="time",uW="utc",sW="point",cW="band",fW={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 lW(t,n){const e=fW[t],r=fW[n];return e===r||"ordinal-position"===e&&"time"===r||"ordinal-position"===r&&"time"===e}const hW={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 dW(t){return hW[t]}const mW=new Set(["linear","log","pow","sqrt","symlog"]),pW=new Set([...mW,"time","utc"]);function gW(t){return mW.has(t)}const vW=new Set(["quantile","quantize","threshold"]),yW=new Set([...pW,...vW,"sequential","identity"]),bW=new Set(["ordinal","bin-ordinal","point","band"]);function wW(t){return bW.has(t)}function xW(t){return yW.has(t)}function $W(t){return pW.has(t)}function kW(t){return vW.has(t)}function MW(t){return YR(t,"param")}const{type:AW,domain:DW,range:SW,rangeMax:FW,rangeMin:EW,scheme:NW,...CW}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw: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},OW=xR(CW);function _W(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return $W(t)||"band"===t||"point"===t;case"padding":case"rangeMin":case"rangeMax":return $W(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return"band"===t;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return $W(t);case"nice":return $W(t)||"quantize"===t||"threshold"===t;case"exponent":return"pow"===t;case"base":return"log"===t;case"constant":return"symlog"===t;case"zero":return xW(t)&&!fR(["log","time","utc","threshold","quantile"],t)}}function zW(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return jL(t)?void 0:`Cannot use the scale property "${n}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":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 BW={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"},TW=BW.arc,PW=BW.area,jW=BW.bar,RW=BW.image,LW=BW.line,IW=BW.point,qW=BW.rect,UW=BW.rule,WW=BW.text,HW=BW.tick,GW=BW.trail,YW=BW.circle,VW=BW.square,XW=BW.geoshape;function JW(t){return["line","area","trail"].includes(t)}function KW(t){return["rect","bar","image","arc","tick"].includes(t)}const QW=new Set(xR(BW));function ZW(t){return YR(t,"type")}const tH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],nH=xR({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),eH=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rH={area:["line","point"],bar:eH,rect:eH,line:["point"],tick:["bandSize","thickness",...eH]},iH=xR({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 oH(t){return YR(t,"band")}const aH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},uH={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},sH={...uH,binSpacing:1},cH={...uH,thickness:1};function fH(t,{isPath:n}){return void 0===t||"break-paths-show-path-domains"===t?n?"break-paths-show-domains":"filter":null===t?"show":t}function lH({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){if(!r||!xW(r)||i)return"always-valid";const o=fH(Cq("invalid",t,n),{isPath:JW(t.type)}),a=n.scale?.invalid?.[e];return void 0!==a?"show":o}function hH({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,o=`peek(${r})`,a=n.domainHasZero();return"definitely"===a?{scale:t,value:0}:"maybe"===a?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${"zeroOrMin"===e?i:o})`}:{signal:`scale('${t}', ${"zeroOrMin"===e?i:o})`}}function dH({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:o}){const a=e?.get("type"),u=vG(n),s=lH({scaleChannel:t,markDef:i,config:o,scaleType:a,isCountAggregate:rq(u?.aggregate)});if(u&&"show"===s){const n=o.scale.invalid?.[t]??"zero-or-min";return{test:JU(sG(u,{expr:"datum"}),!1),...mH(n,e,r)}}}function mH(t,n,e){if(S(r=t)&&"value"in r){const{value:n}=t;return gq(n)?{signal:n.signal}:{value:n}}var r;return hH({scale:n,scaleName:e,mode:"zeroOrMin"})}function pH(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:o,config:a}=t,u=tI(n),s=yH(t),c=dH({scaleChannel:u,channelDef:e,scale:i,scaleName:o,markDef:r,config:a});return void 0!==c?[c,s]:s}function gH(t,n,e,r){const i={};if(n&&(i.scale=n),JH(t)){const{datum:n}=t;bU(n)?i.signal=AU(n):gq(n)?i.signal=n.signal:hq(n)?i.signal=n.expr:i.value=n}else i.field=sG(t,e);if(r){const{offset:t,band:n}=r;t&&(i.offset=t),n&&(i.band=n)}return i}function vH({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:o="end",bandPosition:a=.5}){const u=!gq(a)&&0<a&&a<1?"datum":void 0,s=sG(n,{expr:u,suffix:i}),c=void 0!==e?sG(e,{expr:u}):sG(n,{suffix:o,expr:u}),f={};if(0===a||1===a)f.scale=t,f.field=0===a?s:c;else{const n=gq(a)?`(1-${a.signal}) * ${s} + ${a.signal} * ${c}`:`${1-a} * ${s} + ${a} * ${c}`;f.signal=`scale("${t}", ${n})`}return r&&(f.offset=r),f}function yH({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c,bandPosition:f}){if(n){if(tG(n)){const c=a?.get("type");if(nG(n)){f??(f=IH({fieldDef:n,fieldDef2:e,markDef:r,config:i}));const{bin:a,timeUnit:l,type:h}=n;if(uq(a)||f&&l&&h===eW)return u?.impute?gH(n,o,{binSuffix:"mid"},{offset:s}):f&&!wW(c)?vH({scaleName:o,fieldOrDatumDef:n,bandPosition:f,offset:s}):gH(n,o,SG(n,t)?{binSuffix:"range"}:{},{offset:s});if(sq(a)){if(VH(e))return vH({scaleName:o,fieldOrDatumDef:n,fieldOrDatumDef2:e,bandPosition:f,offset:s});yU(mU(t===KR?ZR:tL))}}return gH(n,o,wW(c)?{binSuffix:"range"}:{},{offset:s,band:"band"===c?f??n.bandPosition??.5:void 0})}if(eG(n)){const e=s?{offset:s}:{};return{...bH(t,n.value),...e}}}return Z(c)&&(c=c()),c?{...c,...s?{offset:s}:{}}:c}function bH(t,n){return fR(["x","x2"],t)&&"width"===n?{field:{group:"width"}}:fR(["y","y2"],t)&&"height"===n?{field:{group:"height"}}:Aq(n)}function wH(t){return t&&"number"!==t&&"time"!==t}function xH(t,n,e){return`${t}(${n}${e?`, ${GR(e)}`:""})`}function $H({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o}){if(wH(e))return MH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,config:o});const a=kH(t,r,i),u=XH(t);if(void 0===n&&void 0===e&&o.customFormatTypes){if("quantitative"===u){if(i&&o.normalizedNumberFormatType)return MH({fieldOrDatumDef:t,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:r,config:o});if(o.numberFormatType)return MH({fieldOrDatumDef:t,format:o.numberFormat,formatType:o.numberFormatType,expr:r,config:o})}if("temporal"===u&&o.timeFormatType&&VH(t)&&void 0===t.timeUnit)return MH({fieldOrDatumDef:t,format:o.timeFormat,formatType:o.timeFormatType,expr:r,config:o})}if(MG(t)){const e=function({field:t,timeUnit:n,format:e,formatType:r,rawTimeFormat:i,isUTCScale:o}){return!n||e?!n&&r?`${r}(${t}, '${e}')`:`${o?"utc":"time"}Format(${t}, '${e=xt(e)?e:i}')`:function(t,n,e){if(!t)return;const r=BU(t);return`${e||NU(t)?"utc":"time"}Format(${n}, ${r})`}(n,t,o)}({field:a,timeUnit:VH(t)?TU(t.timeUnit)?.unit:void 0,format:n,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:rG(t)&&t.scale?.type===uW});return e?{signal:e}:void 0}return n=SH({type:u,specifiedFormat:n,config:o,normalizeStack:i}),VH(t)&&uq(t.bin)?{signal:NH(a,sG(t,{expr:r,binSuffix:"end"}),n,e,o)}:n||"quantitative"===XH(t)?{signal:`${FH(a,n)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function kH(t,n,e){return VH(t)?e?`${sG(t,{expr:n,suffix:"end"})}-${sG(t,{expr:n,suffix:"start"})}`:sG(t,{expr:n}):function(t){const{datum:n}=t;return bU(n)?AU(n):`${GR(n)}`}(t)}function MH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o,field:a}){return a??(a=kH(t,r,i)),"datum.value"!==a&&VH(t)&&uq(t.bin)?{signal:NH(a,sG(t,{expr:r,binSuffix:"end"}),n,e,o)}:{signal:xH(e,a,n)}}function AH(t,n,e,r,i,o){if(!xt(r)||!wH(r)){if(void 0===e&&void 0===r&&i.customFormatTypes&&"quantitative"===XH(t)){if(i.normalizedNumberFormatType&&iG(t)&&"normalize"===t.stack)return;if(i.numberFormatType)return}if(iG(t)&&"normalize"===t.stack&&i.normalizedNumberFormat)return SH({type:"quantitative",config:i,normalizeStack:!0});if(MG(t)){const n=VH(t)?TU(t.timeUnit)?.unit:void 0;if(void 0===n&&i.customFormatTypes&&i.timeFormatType)return;return function({specifiedFormat:t,timeUnit:n,config:e,omitTimeFormatConfig:r}){return t||(n?{signal:BU(n)}:r?void 0:e.timeFormat)}({specifiedFormat:e,timeUnit:n,config:i,omitTimeFormatConfig:o})}return SH({type:n,specifiedFormat:e,config:i})}}function DH(t,n,e){return t&&(gq(t)||"number"===t||"time"===t)?t:MG(n)&&"time"!==e&&"utc"!==e?VH(n)&&TU(n?.timeUnit)?.utc?"utc":"time":void 0}function SH({type:t,specifiedFormat:n,config:e,normalizeStack:r}){return xt(n)?n:t===tW?r?e.normalizedNumberFormat:e.numberFormat:void 0}function FH(t,n){return`format(${t}, "${n||""}")`}function EH(t,n,e,r){return wH(e)?xH(e,t,n):FH(t,(xt(n)?n:void 0)??r.numberFormat)}function NH(t,n,e,r,i){if(void 0===e&&void 0===r&&i.customFormatTypes&&i.numberFormatType)return NH(t,n,i.numberFormat,i.numberFormatType,i);const o=EH(t,e,r,i),a=EH(n,e,r,i);return`${JU(t,!1)} ? "null" : ${o} + " – " + ${a}`}const CH="min",OH={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function _H(t){return ft(OH,t)}function zH(t){return t&&("count"===t.op||YR(t,"field"))}function BH(t){return t&&D(t)}function TH(t){return YR(t,"row")||YR(t,"column")}function PH(t){return YR(t,"header")}function jH(t){return YR(t,"facet")}function RH(t){const{field:n,timeUnit:e,bin:r,aggregate:i}=t;return{...e?{timeUnit:e}:{},...r?{bin:r}:{},...i?{aggregate:i}:{},field:n}}function LH(t){return YR(t,"sort")}function IH({fieldDef:t,fieldDef2:n,markDef:e,config:r}){if(tG(t)&&void 0!==t.bandPosition)return t.bandPosition;if(VH(t)){const{timeUnit:i,bin:o}=t;if(i&&!n)return Oq("timeUnitBandPosition",e,r);if(uq(o))return.5}}function qH({channel:t,fieldDef:n,fieldDef2:e,markDef:r,config:i,scaleType:o,useVlSizeChannel:a}){const u=rI(t),s=Cq(a?"size":u,r,i,{vgChannel:u});if(void 0!==s)return s;if(VH(n)){const{timeUnit:t,bin:a}=n;if(t&&!e)return{band:Oq("timeUnitBandSize",r,i)};if(uq(a)&&!wW(o))return{band:1}}return KW(r.type)?o?wW(o)?i[r.type]?.discreteBandSize||{band:1}:i[r.type]?.continuousBandSize:i[r.type]?.discreteBandSize:void 0}function UH(t,n,e,r){return!!(uq(t.bin)||t.timeUnit&&nG(t)&&"temporal"===t.type)&&void 0!==IH({fieldDef:t,fieldDef2:n,markDef:e,config:r})}function WH(t){return YR(t,"sort")&&!YR(t,"field")}function HH(t){return YR(t,"condition")}function GH(t){const n=t?.condition;return!!n&&!D(n)&&VH(n)}function YH(t){const n=t?.condition;return!!n&&!D(n)&&tG(n)}function VH(t){return YR(t,"field")||"count"===t?.aggregate}function XH(t){return t?.type}function JH(t){return YR(t,"datum")}function KH(t){return nG(t)&&!cG(t)||ZH(t)}function QH(t){return nG(t)&&"quantitative"===t.type&&!t.bin||ZH(t)}function ZH(t){return JH(t)&&bt(t.datum)}function tG(t){return VH(t)||JH(t)}function nG(t){return t&&(YR(t,"field")||"count"===t.aggregate)&&YR(t,"type")}function eG(t){return YR(t,"value")}function rG(t){return YR(t,"scale")||YR(t,"sort")}function iG(t){return YR(t,"axis")||YR(t,"stack")||YR(t,"impute")}function oG(t){return YR(t,"legend")}function aG(t){return YR(t,"format")||YR(t,"formatType")}function uG(t){return uR(t,["legend","axis","header","scale"])}function sG(t,n={}){let e=t.field;const r=n.prefix;let i=n.suffix,o="";if(function(t){return"count"===t.aggregate}(t))e=LR("count");else{let r;if(!n.nofn)if(function(t){return YR(t,"op")}(t))r=t.op;else{const{bin:a,aggregate:u,timeUnit:s}=t;uq(a)?(r=aq(a),i=(n.binSuffix??"")+(n.suffix??"")):u?tq(u)?(o=`["${e}"]`,e=`argmax_${u.argmax}`):ZI(u)?(o=`["${e}"]`,e=`argmin_${u.argmin}`):r=String(u):s&&!FU(s)&&(r=function(t){const{utc:n,...e}=TU(t);return e.unit?(n?"utc":"")+xR(e).map((t=>AR(`${"unit"===t?"":`_${t}_`}${e[t]}`))).join(""):(n?"utc":"")+"timeunit"+xR(e).map((t=>AR(`_${t}_${e[t]}`))).join("")}(s),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}r&&(e=e?`${r}_${e}`:r)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?BR(e):n.expr?NR(e,n.expr)+o:_R(e)+o}function cG(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return VH(t)&&!!t.bin;case"temporal":return!1}throw new Error(Zq(t.type))}const fG=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(t){const{aggregate:n,bin:e,timeUnit:r,field:i}=t;if(tq(n))return`${i} for argmax(${n.argmax})`;if(ZI(n))return`${i} for argmin(${n.argmin})`;const o=r&&!FU(r)?TU(r):void 0,a=n||o?.unit||o?.maxbins&&"timeunit"||uq(e)&&"bin";return a?`${a.toUpperCase()}(${i})`:i}(t);default:return function(t,n){const{field:e,bin:r,timeUnit:i,aggregate:o}=t;if("count"===o)return n.countTitle;if(uq(r))return`${e} (binned)`;if(i&&!FU(i)){const t=TU(i)?.unit;if(t)return`${e} (${OU(t).join("-")})`}else if(o)return tq(o)?`${e} for max ${o.argmax}`:ZI(o)?`${e} for min ${o.argmin}`:`${FR(o)} of ${e}`;return e}(t,n)}};let lG=fG;function hG(t){lG=t}function dG(t,n,{allowDisabling:e,includeDefault:r=!0}){const i=mG(t)?.title;if(!VH(t))return i??t.title;const o=t,a=r?pG(o,n):void 0;return e?PR(i,o.title,a):i??o.title??a}function mG(t){return iG(t)&&t.axis?t.axis:oG(t)&&t.legend?t.legend:PH(t)&&t.header?t.header:void 0}function pG(t,n){return lG(t,n)}function gG(t){if(aG(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=mG(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function vG(t){return VH(t)?t:GH(t)?t.condition:void 0}function yG(t){return tG(t)?t:YH(t)?t.condition:void 0}function bG(t,n,e,r={}){return xt(t)||bt(t)||gt(t)?(yU(function(t,n,e){return`Channel ${t} is a ${n}. Converted to {value: ${GR(e)}}.`}(n,xt(t)?"string":bt(t)?"number":"boolean",t)),{value:t}):tG(t)?wG(t,n,e,r):YH(t)?{...t,condition:wG(t.condition,n,e,r)}:t}function wG(t,n,e,r){if(aG(t)){const{format:i,formatType:o,...a}=t;if(wH(o)&&!e.customFormatTypes)return yU(Kq(n)),wG(a,n,e,r)}else{const i=iG(t)?"axis":oG(t)?"legend":PH(t)?"header":null;if(i&&t[i]){const{format:o,formatType:a,...u}=t[i];if(wH(a)&&!e.customFormatTypes)return yU(Kq(n)),wG({...t,[i]:u},n,e,r)}}return VH(t)?xG(t,n,r):function(t){let n=t.type;if(n)return t;const{datum:e}=t;return n=bt(e)?"quantitative":xt(e)?"nominal":bU(e)?"temporal":void 0,{...t,type:n}}(t)}function xG(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:o,field:a}=t,u={...t};if(e||!r||nq(r)||tq(r)||ZI(r)||(yU(function(t){return`Invalid aggregation operator "${t}".`}(r)),delete u.aggregate),i&&(u.timeUnit=TU(i)),a&&(u.field=`${a}`),uq(o)&&(u.bin=$G(o,n)),sq(o)&&!DI(n)&&yU(function(t){return`Channel ${t} should not be used with "binned" bin.`}(n)),nG(u)){const{type:t}=u,n=function(t){if(t)switch(t=t.toLowerCase()){case"q":case tW:return"quantitative";case"t":case eW:return"temporal";case"o":case nW:return"ordinal";case"n":case rW:return"nominal";case iW:return"geojson"}}(t);t!==n&&(u.type=n),"quantitative"!==t&&rq(r)&&(yU(function(t,n){return`Invalid field type "${t}" for aggregate: "${n}", using "quantitative" instead.`}(t,r)),u.type="quantitative")}else if(!ZL(n)){const t=function(t,n){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(LH(t)&&D(t.sort))return"ordinal";const{aggregate:e,bin:r,timeUnit:i}=t;if(i)return"temporal";if(r||e&&!tq(e)&&!ZI(e))return"quantitative";if(rG(t)&&t.scale?.type)switch(fW[t.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,n);u.type=t}if(nG(u)){const{compatible:t,warning:e}=function(t,n){const e=t.type;if("geojson"===e&&"shape"!==n)return{compatible:!1,warning:`Channel ${n} should not be used with a geojson data.`};switch(n){case VR:case XR:case JR:return cG(t)?kG:{compatible:!1,warning:rU(n)};case KR:case QR:case nL:case eL:case hL:case dL:case mL:case kL:case AL:case DL:case SL:case FL:case EL:case vL:case oL:case rL:case NL:return kG;case sL:case fL:case uL:case cL:return e!==tW?{compatible:!1,warning:`Channel ${n} should be used with a quantitative field only, not ${t.type} field.`}:kG;case yL:case bL:case wL:case xL:case gL:case aL:case iL:case ZR:case tL:case lL:return"nominal"!==e||t.sort?kG:{compatible:!1,warning:`Channel ${n} should not be used with an unsorted discrete field.`};case pL:case $L:return cG(t)||function(t){return rG(t)&&kW(t.scale?.type)}(t)?kG:{compatible:!1,warning:iU(n)};case ML:return"nominal"!==t.type||"sort"in t?kG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(u,n)||{};!1===t&&yU(e)}if(LH(u)&&xt(u.sort)){const{sort:t}=u;if(_H(t))return{...u,sort:{encoding:t}};const n=t.substring(1);if("-"===t.charAt(0)&&_H(n))return{...u,sort:{encoding:n,order:"descending"}}}if(PH(u)){const{header:t}=u;if(t){const{orient:n,...e}=t;if(n)return{...u,header:{...e,labelOrient:t.labelOrient||n,titleOrient:t.titleOrient||n}}}}return u}function $G(t,n){return gt(t)?{maxbins:lq(n)}:"binned"===t?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:lq(n)}}const kG={compatible:!0};function MG(t){const{formatType:n}=gG(t);return"time"===n||!n&&function(t){return t&&("temporal"===t.type||VH(t)&&!!t.timeUnit)}(t)}function AG(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){const o=n&&TU(n)?.unit;let a,u=o||"temporal"===e;return hq(t)?a=t.expr:gq(t)?a=t.signal:bU(t)?(u=!0,a=AU(t)):(xt(t)||bt(t))&&u&&(a=`datetime(${GR(t)})`,function(t){return ft(DU,t)}(o)&&(bt(t)&&t<1e4||xt(t)&&isNaN(Date.parse(t)))&&(a=AU({[o]:t}))),a?r&&u?`time(${a})`:a:i?void 0:GR(t)}function DG(t,n){const{type:e}=t;return n.map((n=>{const r=AG(n,{timeUnit:VH(t)&&!FU(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return void 0!==r?{signal:r}:n}))}function SG(t,n){return uq(t.bin)?GI(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const FG={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 EG(t){return t?.condition}const NG=["domain","grid","labels","ticks","title"],CG={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"},OG={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},_G={...OG,style:1,labelExpr:1,encoding:1};function zG(t){return ft(_G,t)}const BG=xR({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 TG(t){return YR(t,"mark")}class PG{constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return!!TG(t)&&function(t){return ZW(t)?t.type:t}(t.mark)===this.name}}function jG(t,n){const e=t&&t[n];return!!e&&(D(e)?lR(e,(t=>!!t.field)):VH(e)||GH(e))}function RG(t,n){const e=t&&t[n];return!!e&&(D(e)?lR(e,(t=>!!t.field)):VH(e)||JH(e)||YH(e))}function LG(t,n){if(DI(n)){const e=t[n];if((VH(e)||JH(e))&&(ZU(e.type)||VH(e)&&e.timeUnit))return RG(t,oI(n))}return!1}function IG(t){return lR(qL,(n=>{if(jG(t,n)){const e=t[n];if(D(e))return lR(e,(t=>!!t.aggregate));{const t=vG(e);return t&&!!t.aggregate}}return!1}))}function qG(t,n){const e=[],r=[],i=[],o=[],a={};return HG(t,((u,s)=>{if(VH(u)){const{field:c,aggregate:f,bin:l,timeUnit:h,...d}=u;if(f||h||l){const t=mG(u),m=t?.title;let p=sG(u,{forAs:!0});const g={...m?[]:{title:dG(u,n,{allowDisabling:!0})},...d,field:p};if(f){let t;if(tq(f)?(t="argmax",p=sG({op:"argmax",field:f.argmax},{forAs:!0}),g.field=`${p}.${c}`):ZI(f)?(t="argmin",p=sG({op:"argmin",field:f.argmin},{forAs:!0}),g.field=`${p}.${c}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(t=f),t){const n={op:t,as:p};c&&(n.field=c),o.push(n)}}else if(e.push(p),nG(u)&&uq(l))r.push({bin:l,field:c,as:p}),e.push(sG(u,{binSuffix:"end"})),SG(u,s)&&e.push(sG(u,{binSuffix:"range"})),DI(s)&&(a[`${s}2`]={field:`${p}_end`}),g.bin="binned",ZL(s)||(g.type=tW);else if(h&&!FU(h)){i.push({timeUnit:h,field:c,as:p});const t=nG(u)&&u.type!==eW&&"time";t&&(s===kL||s===SL?g.formatType=t:function(t){return ft($I,t)}(s)?g.legend={formatType:t,...g.legend}:DI(s)&&(g.axis={formatType:t,...g.axis}))}a[s]=g}else e.push(c),a[s]=t[s]}else a[s]=t[s]})),{bins:r,timeUnits:i,aggregate:o,groupby:e,encoding:a}}function UG(t,n,e){const r=function(t,n){return function(t){switch(t){case hL:case dL:case mL:case NL:case AL:case DL:case SL:case FL:case ML:case yL:case bL:case wL:case xL:case JR:case VR:case XR:return YI;case KR:case QR:case nL:case eL:case uL:case sL:case lL:return XI;case ZR:case tL:case cL:case fL:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case gL:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case $L:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case pL:return{point:"always",geoshape:"always"};case kL:return{text:"always"};case vL:return{point:"always",square:"always",text:"always"};case EL:return{image:"always"};case oL:case rL:return{text:"always",arc:"always"};case aL:case iL:return{arc:"always"}}}(t)[n]}(n,e);if(!r)return!1;if("binned"===r){const e=t[n===ZR?KR:QR];return!!(VH(e)&&VH(t[n])&&sq(e.bin))}return!0}function WG(t,n){const e={};for(const r of xR(t)){const i=bG(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function HG(t,n,e){if(t)for(const r of xR(t)){const i=t[r];if(D(i))for(const t of i)n.call(e,t,r);else n.call(e,i,r)}}function GG(t,n){return xR(n).reduce(((e,r)=>{switch(r){case KR:case QR:case FL:case NL:case EL:case ZR:case tL:case nL:case eL:case oL:case aL:case rL:case iL:case lL:case uL:case sL:case cL:case fL:case kL:case pL:case vL:case SL:return e;case ML:if("line"===t||"trail"===t)return e;case AL:case DL:{const t=n[r];if(D(t)||VH(t))for(const n of K(t))n.aggregate||e.push(sG(n,{}));return e}case gL:if("trail"===t)return e;case hL:case dL:case mL:case yL:case bL:case wL:case $L:case xL:{const t=vG(n[r]);return t&&!t.aggregate&&e.push(sG(t,{})),e}}}),[])}function YG(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map((({fieldPrefix:t,titlePrefix:e})=>{const i=r?` of ${VG(n)}`:"";return{field:t+n.field,type:n.type,title:gq(e)?{signal:`${e}"${escape(i)}"`}:e+i}})),o=function(t){const n=[];for(const e of xR(t))if(jG(t,e)){const r=K(t[e]);for(const t of r)VH(t)?n.push(t):GH(t)&&n.push(t.condition)}return n}(e).map(uG);return{tooltip:[...i,...pR(o,sR)]}}function VG(t){const{title:n,field:e}=t;return PR(n,e)}function XG(t,n,e,r,i){const{scale:o,axis:a}=e;return({partName:u,mark:s,positionPrefix:c,endPositionPrefix:f,extraEncoding:l={}})=>{const h=VG(e);return JG(t,u,i,{mark:s,encoding:{[n]:{field:`${c}_${e.field}`,type:e.type,...void 0!==h?{title:h}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...xt(f)?{[`${n}2`]:{field:`${f}_${e.field}`}}:{},...r,...l}})}}function JG(t,n,e,r){const{clip:i,color:o,opacity:a}=t,u=t.type;return t[n]||void 0===t[n]&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...o?{color:o}:{},...a?{opacity:a}:{},...ZW(r.mark)?r.mark:{type:r.mark},style:`${u}-${String(n)}`,...gt(t[n])?{}:t[n]}}]:[]}function KG(t,n,e){const{encoding:r}=t,i="vertical"===n?"y":"x",o=r[`${i}2`],a=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:QG(r[i],e),continuousAxisChannelDef2:QG(o,e),continuousAxisChannelDefError:QG(a,e),continuousAxisChannelDefError2:QG(u,e),continuousAxis:i}}function QG(t,n){if(t?.aggregate){const{aggregate:e,...r}=t;return e!==n&&yU(function(t,n){return`Continuous axis should not have customized aggregation function ${t}; ${n} already agregates the axis.`}(e,n)),r}return t}function ZG(t,n){const{mark:e,encoding:r}=t,{x:i,y:o}=r;if(ZW(e)&&e.orient)return e.orient;if(KH(i)){if(KH(o)){const t=VH(i)&&i.aggregate,e=VH(o)&&o.aggregate;if(t||e!==n){if(e||t!==n){if(t===n&&e===n)throw new Error("Both x and y cannot have aggregate");return MG(o)&&!MG(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(KH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const tY="boxplot",nY=new PG(tY,rY);function eY(t){return bt(t)?"tukey":t}function rY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:o,...a}=t,u=ZW(e)?e:{type:e};i&&yU(Gq("boxplot"));const s=u.extent??n.boxplot.extent,c=Cq("size",u,n),f=u.invalid,l=eY(s),{bins:h,timeUnits:d,transform:m,continuousAxisChannelDef:p,continuousAxis:g,groupby:v,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:$}=function(t,n,e){const r=ZG(t,tY),{continuousAxisChannelDef:i,continuousAxis:o}=KG(t,r,tY),a=i.field,u=BR(a),s=eY(n),c=[...iY(a),{op:"median",field:a,as:`mid_box_${u}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+u},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+u}],f="min-max"===s||"tukey"===s?[]:[{calculate:`${CR(`upper_box_${u}`)} - ${CR(`lower_box_${u}`)}`,as:`iqr_${u}`},{calculate:`min(${CR(`upper_box_${u}`)} + ${CR(`iqr_${u}`)} * ${n}, ${CR(`max_${u}`)})`,as:`upper_whisker_${u}`},{calculate:`max(${CR(`lower_box_${u}`)} - ${CR(`iqr_${u}`)} * ${n}, ${CR(`min_${u}`)})`,as:`lower_whisker_${u}`}],{[o]:l,...h}=t.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:m}=function(t){const{tooltip:n,...e}=t;if(!n)return{filteredEncoding:e};let r,i;if(D(n)){for(const t of n)t.aggregate?(r||(r=[]),r.push(t)):(i||(i=[]),i.push(t));r&&(e.tooltip=r)}else n.aggregate?e.tooltip=n:i=n;return D(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:e}}(h),{bins:p,timeUnits:g,aggregate:v,groupby:y,encoding:b}=qG(m,e),w="vertical"===r?"horizontal":"vertical",x=r;return{bins:p,timeUnits:g,transform:[...p,...g,{aggregate:[...v,...c],groupby:y},...f],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:d}}(t,s,n),k=BR(p.field),{color:M,size:A,...F}=b,E=t=>XG(u,g,p,t,n.boxplot),N=E(F),C=E(b),O=(S(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",_=E({...F,...A?{size:A}:{},color:{condition:{test:`${CR(`lower_box_${p.field}`)} >= ${CR(`upper_box_${p.field}`)}`,...M||{value:O}}}}),z=YG([{fieldPrefix:"min-max"===l?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===l?"lower_whisker_":"min_",titlePrefix:"Min"}],p,b),B={type:"tick",color:"black",opacity:1,orient:w,invalid:f,aria:!1},T="min-max"===l?z:YG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,b),P=[...N({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),...N({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:T})],j=[..."tukey"!==l?P:[],...C({partName:"box",mark:{type:"bar",...c?{size:c}:{},orient:x,invalid:f,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),..._({partName:"median",mark:{type:"tick",invalid:f,...S(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...c?{size:c}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===l)return{...a,transform:(a.transform??[]).concat(m),layer:j};const R=CR(`lower_box_${p.field}`),L=CR(`upper_box_${p.field}`),I=`(${L} - ${R})`,q=`${R} - ${s} * ${I}`,U=`${L} + ${s} * ${I}`,W=CR(p.field),H={joinaggregate:iY(p.field),groupby:v},G={transform:[{filter:`(${q} <= ${W}) && (${W} <= ${U})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${k}`},{op:"max",field:p.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${k}`},...y],groupby:v}],layer:P},{tooltip:Y,...V}=F,{scale:X,axis:J}=p,K=VG(p),Q=uR(J,["title"]),Z=JG(u,"outliers",n.boxplot,{transform:[{filter:`(${W} < ${q}) || (${W} > ${U})`}],mark:"point",encoding:{[g]:{field:p.field,type:p.type,...void 0!==K?{title:K}:{},...void 0!==X?{scale:X}:{},...wR(Q)?{}:{axis:Q}},...V,...M?{color:M}:{},...$?{tooltip:$}:{}}})[0];let tt;const nt=[...h,...d,H];return Z?tt={transform:nt,layer:[Z,G]}:(tt=G,tt.transform.unshift(...nt)),{...a,layer:[tt,{transform:m,layer:j}]}}function iY(t){const n=BR(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const oY="errorbar",aY=new PG(oY,uY);function uY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:c}=sY(t,oY,n);delete o.size;const f=XG(u,i,r,o,n.errorbar),l=u.thickness,h=u.size,d={type:"tick",orient:a,aria:!1,...void 0!==l?{thickness:l}:{},...void 0!==h?{size:h}:{}},m=[...f({partName:"ticks",mark:d,positionPrefix:"lower",extraEncoding:c}),...f({partName:"ticks",mark:d,positionPrefix:"upper",extraEncoding:c}),...f({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==l?{size:l}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})];return{...s,transform:e,...m.length>1?{layer:m}:{...m[0]}}}function sY(t,n,e){const{mark:r,encoding:i,params:o,projection:a,...u}=t,s=ZW(r)?r:{type:r};o&&yU(Gq(n));const{orient:c,inputType:f}=function(t,n){const{encoding:e}=t;if(function(t){return(tG(t.x)||tG(t.y))&&!tG(t.x2)&&!tG(t.y2)&&!tG(t.xError)&&!tG(t.xError2)&&!tG(t.yError)&&!tG(t.yError2)}(e))return{orient:ZG(t,n),inputType:"raw"};const r=function(t){return tG(t.x2)||tG(t.y2)}(e),i=function(t){return tG(t.xError)||tG(t.xError2)||tG(t.yError)||tG(t.yError2)}(e),o=e.x,a=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const t=e.x2,r=e.y2;if(tG(t)&&tG(r))throw new Error(`${n} cannot have both x2 and y2`);if(tG(t)){if(KH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(tG(r)){if(KH(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const t=e.xError,r=e.yError,i=e.yError2;if(tG(e.xError2)&&!tG(t))throw new Error(`${n} cannot have xError2 without xError`);if(tG(i)&&!tG(r))throw new Error(`${n} cannot have yError2 without yError`);if(tG(t)&&tG(r))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(tG(t)){if(KH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tG(r)){if(KH(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")}}(t,n),{continuousAxisChannelDef:l,continuousAxisChannelDef2:h,continuousAxisChannelDefError:d,continuousAxisChannelDefError2:m,continuousAxis:p}=KG(t,c,n),{errorBarSpecificAggregate:g,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:b}=function(t,n,e,r,i,o,a,u){let s=[],c=[];const f=n.field;let l,h=!1;if("raw"===o){const n=t.center?t.center:t.extent?"iqr"===t.extent?"median":"mean":u.errorbar.center,e=t.extent?t.extent:"mean"===n?"stderr":"iqr";if("median"===n!=("iqr"===e)&&yU(function(t,n,e){return`${t} is not usually used with ${n} for ${e}.`}(n,e,a)),"stderr"===e||"stdev"===e)s=[{op:e,field:f,as:`extent_${f}`},{op:n,field:f,as:`center_${f}`}],c=[{calculate:`${CR(`center_${f}`)} + ${CR(`extent_${f}`)}`,as:`upper_${f}`},{calculate:`${CR(`center_${f}`)} - ${CR(`extent_${f}`)}`,as:`lower_${f}`}],l=[{fieldPrefix:"center_",titlePrefix:FR(n)},{fieldPrefix:"upper_",titlePrefix:cY(n,e,"+")},{fieldPrefix:"lower_",titlePrefix:cY(n,e,"-")}],h=!0;else{let t,n,r;"ci"===e?(t="mean",n="ci0",r="ci1"):(t="median",n="q1",r="q3"),s=[{op:n,field:f,as:`lower_${f}`},{op:r,field:f,as:`upper_${f}`},{op:t,field:f,as:`center_${f}`}],l=[{fieldPrefix:"upper_",titlePrefix:dG({field:f,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:dG({field:f,aggregate:n,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:dG({field:f,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(t.center||t.extent)&&yU(function(t,n){return`${n?"extent ":""}${n&&t?"and ":""}${t?"center ":""}${n&&t?"are ":"is "}not needed when data are aggregated.`}(t.center,t.extent)),"aggregated-upper-lower"===o?(l=[],c=[{calculate:CR(e.field),as:`upper_${f}`},{calculate:CR(f),as:`lower_${f}`}]):"aggregated-error"===o&&(l=[{fieldPrefix:"",titlePrefix:f}],c=[{calculate:`${CR(f)} + ${CR(r.field)}`,as:`upper_${f}`}],c.push(i?{calculate:`${CR(f)} + ${CR(i.field)}`,as:`lower_${f}`}:{calculate:`${CR(f)} - ${CR(r.field)}`,as:`lower_${f}`}));for(const t of c)l.push({fieldPrefix:t.as.substring(0,6),titlePrefix:zR(zR(t.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:s,tooltipSummary:l,tooltipTitleWithFieldName:h}}(s,l,h,d,m,f,n,e),{[p]:w,["x"===p?"x2":"y2"]:x,["x"===p?"xError":"yError"]:$,["x"===p?"xError2":"yError2"]:k,...M}=i,{bins:A,timeUnits:D,aggregate:S,groupby:F,encoding:E}=qG(M,e),N=[...S,...g],C="raw"!==f?[]:F,O=YG(y,l,E,b);return{transform:[...u.transform??[],...A,...D,...0===N.length?[]:[{aggregate:N,groupby:C}],...v],groupby:C,continuousAxisChannelDef:l,continuousAxis:p,encodingWithoutContinuousAxis:E,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:s,outerSpec:u,tooltipEncoding:O}}function cY(t,n,e){return`${FR(t)} ${e} ${n}`}const fY="errorband",lY=new PG(fY,hY);function hY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=sY(t,fY,n),c=a,f=XG(c,i,r,o,n.errorband),l=void 0!==t.encoding.x&&void 0!==t.encoding.y;let h={type:l?"area":"rect"},d={type:l?"line":"rule"};const m={...c.interpolate?{interpolate:c.interpolate}:{},...c.tension&&c.interpolate?{tension:c.tension}:{}};return l?(h={...h,...m,ariaRoleDescription:"errorband"},d={...d,...m,aria:!1}):c.interpolate?yU(dU("interpolate")):c.tension&&yU(dU("tension")),{...u,transform:e,layer:[...f({partName:"band",mark:h,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...f({partName:"borders",mark:d,positionPrefix:"lower",extraEncoding:s}),...f({partName:"borders",mark:d,positionPrefix:"upper",extraEncoding:s})]}}const dY={};function mY(t,n,e){const r=new PG(t,n);dY[t]={normalizer:r,parts:e}}mY(tY,rY,["box","median","outliers","rule","ticks"]),mY(oY,uY,["ticks","rule"]),mY(fY,hY,["band","borders"]);const pY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],gY={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"},vY={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"},yY=xR(gY),bY=xR(vY),wY=xR({header:1,headerRow:1,headerColumn:1,headerFacet:1}),xY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],$Y="_vgsid_",kY={point:{on:"click",fields:[$Y],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function MY(t){return"legend"===t||!!t?.legend}function AY(t){return MY(t)&&S(t)}function DY(t){return!!t?.select}function SY(t){const n=[];for(const e of t||[]){if(DY(e))continue;const{expr:t,bind:r,...i}=e;if(r&&t){const e={...i,bind:r,init:t};n.push(e)}else{const e={...i,...t?{update:t}:{},...r?{bind:r}:{}};n.push(e)}}return n}function FY(t){return YR(t,"concat")}function EY(t){return YR(t,"vconcat")}function NY(t){return YR(t,"hconcat")}function CY({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function OY(t){return YR(t,"step")}function _Y(t){return YR(t,"view")||YR(t,"width")||YR(t,"height")}const zY=xR({align:1,bounds:1,center:1,columns:1,spacing:1});function BY(t,n){return t[n]??t["width"===n?"continuousWidth":"continuousHeight"]}function TY(t,n){const e=PY(t,n);return OY(e)?e.step:jY}function PY(t,n){return PR(t[n]??t["width"===n?"discreteWidth":"discreteHeight"],{step:t.step})}const jY=20,RY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:jY},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:sH,circle:{},geoshape:{},image:{},line:{},point:{},rect:uH,rule:{color:"black"},square:{},text:{color:"black"},tick:cH,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,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:kY,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},LY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],IY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},qY={blue:LY[0],orange:LY[1],red:LY[2],teal:LY[3],green:LY[4],yellow:LY[5],purple:LY[6],pink:LY[7],brown:LY[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 UY(t){const n=xR(t||{}),e={};for(const r of n){const n=t[r];e[r]=EG(n)?$q(n):kq(n)}return e}const WY=[...iH,...BG,...wY,"background","padding","legend","lineBreak","scale","style","title","view"];function HY(t={}){const{color:n,font:e,fontSize:r,selection:i,...o}=t,a=E({},iR(RY),e?function(t){return{text:{font:t},style:{"guide-label":{font:t},"guide-title":{font:t},"group-title":{font:t},"group-subtitle":{font:t}}}}(e):{},n?function(t={}){return{signals:[{name:"color",value:S(t)?{...qY,...t}:qY}],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(t){return{signals:[{name:"fontSize",value:S(t)?{...IY,...t}:IY}],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||{});i&&N(a,"selection",i,!0);const u=uR(a,WY);for(const t of["background","lineBreak","padding"])a[t]&&(u[t]=kq(a[t]));for(const t of iH)a[t]&&(u[t]=dq(a[t]));for(const t of BG)a[t]&&(u[t]=UY(a[t]));for(const t of wY)a[t]&&(u[t]=dq(a[t]));if(a.legend&&(u.legend=dq(a.legend)),a.scale){const{invalid:t,...n}=a.scale,e=dq(t,{level:1});u.scale={...dq(n),...xR(e).length>0?{invalid:e}:{}}}return a.style&&(u.style=function(t){const n=xR(t),e={};for(const r of n)e[r]=UY(t[r]);return e}(a.style)),a.title&&(u.title=dq(a.title)),a.view&&(u.view=dq(a.view)),u}const GY=new Set(["view",...QW]),YY=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],VY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...rH};function XY(t,n,e){"view"===n&&(e="cell");const r={...t[n],...t.style[e??n]};wR(r)||(t.style[e??n]=r),delete t[n]}function JY(t){return YR(t,"layer")}class KY{map(t,n){return jH(t)?this.mapFacet(t,n):function(t){return YR(t,"repeat")}(t)?this.mapRepeat(t,n):NY(t)?this.mapHConcat(t,n):EY(t)?this.mapVConcat(t,n):FY(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(JY(t))return this.mapLayer(t,n);if(TG(t))return this.mapUnit(t,n);throw new Error(Rq(t))}mapLayer(t,n){return{...t,layer:t.layer.map((t=>this.mapLayerOrUnit(t,n)))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map((t=>this.map(t,n)))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map((t=>this.map(t,n)))}}mapConcat(t,n){const{concat:e,...r}=t;return{...r,concat:e.map((t=>this.map(t,n)))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const QY={zero:1,center:1,normalize:1},ZY=new Set([TW,jW,PW,UW,IW,YW,VW,LW,WW,HW]),tV=new Set([jW,PW,TW]);function nV(t){return VH(t)&&"quantitative"===XH(t)&&!t.bin}function eV(t,n,{orient:e,type:r}){const i="x"===n?"y":"radius",o="x"===n&&["bar","area"].includes(r),a=t[n],u=t[i];if(VH(a)&&VH(u))if(nV(a)&&nV(u)){if(a.stack)return n;if(u.stack)return i;const t=VH(a)&&!!a.aggregate;if(t!==(VH(u)&&!!u.aggregate))return t?n:i;if(o){if("vertical"===e)return i;if("horizontal"===e)return n}}else{if(nV(a))return n;if(nV(u))return i}else{if(nV(a)){if(o&&"vertical"===e)return;return n}if(nV(u)){if(o&&"horizontal"===e)return;return i}}}function rV(t,n){const e=ZW(t)?t:{type:t},r=e.type;if(!ZY.has(r))return null;const i=eV(n,"x",e)||eV(n,"theta",e);if(!i)return null;const o=n[i],a=VH(o)?sG(o,{}):void 0,u=function(t){switch(t){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),s=[],c=new Set;if(n[u]){const t=n[u],e=VH(t)?sG(t,{}):void 0;e&&e!==a&&(s.push(u),c.add(e))}const f="x"===u?"xOffset":"yOffset",l=n[f],h=VH(l)?sG(l,{}):void 0;h&&h!==a&&(s.push(f),c.add(h));const d=kI.reduce(((t,e)=>{if("tooltip"!==e&&jG(n,e)){const r=n[e];for(const n of K(r)){const r=vG(n);if(r.aggregate)continue;const i=sG(r,{});i&&c.has(i)||t.push({channel:e,fieldDef:r})}}return t}),[]);let m;return void 0!==o.stack?m=gt(o.stack)?o.stack?"zero":null:o.stack:tV.has(r)&&(m="zero"),m&&ft(QY,m)?IG(n)&&0===d.length?null:(o?.scale?.type&&o?.scale?.type!==oW&&o?.stack&&yU(function(t){return`Stack is applied to a non-linear scale (${t}).`}(o.scale.type)),tG(n[eI(i)])?(void 0!==o.stack&&yU(`Cannot stack "${p=i}" if there is already "${p}2".`),null):(VH(o)&&o.aggregate&&!iq.has(o.aggregate)&&yU(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:s,groupbyFields:c,fieldChannel:i,impute:null!==o.impute&&JW(r),stackBy:d,offset:m})):null;var p}function iV(t,n,e){const r=dq(t),i=Cq("orient",r,e);if(r.orient=function(t,n,e){switch(t){case IW:case YW:case VW:case WW:case qW:case RW:return}const{x:r,y:i,x2:o,y2:a}=n;switch(t){case jW:if(VH(r)&&(sq(r.bin)||VH(i)&&i.aggregate&&!r.aggregate))return"vertical";if(VH(i)&&(sq(i.bin)||VH(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(e)return e;if(!o)return(VH(r)&&r.type===tW&&!uq(r.bin)||ZH(r))&&VH(i)&&sq(i.bin)?"horizontal":"vertical";if(!a)return(VH(i)&&i.type===tW&&!uq(i.bin)||ZH(i))&&VH(r)&&sq(r.bin)?"vertical":"horizontal"}case UW:if(o&&(!VH(r)||!sq(r.bin))&&a&&(!VH(i)||!sq(i.bin)))return;case PW:if(a)return VH(i)&&sq(i.bin)?"horizontal":"vertical";if(o)return VH(r)&&sq(r.bin)?"vertical":"horizontal";if(t===UW){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case LW:case HW:{const n=QH(r),o=QH(i);if(e)return e;if(n&&!o)return"tick"!==t?"horizontal":"vertical";if(!n&&o)return"tick"!==t?"vertical":"horizontal";if(n&&o)return"vertical";{const t=nG(r)&&r.type===eW,n=nG(i)&&i.type===eW;if(t&&!n)return"vertical";if(!t&&n)return"horizontal"}return}}return"vertical"}(r.type,n,i),void 0!==i&&i!==r.orient&&yU(`Specified orient "${r.orient}" overridden with "${i}".`),"bar"===r.type&&r.orient){const t=Cq("cornerRadiusEnd",r,e);if(void 0!==t){const e="horizontal"===r.orient&&n.x2||"vertical"===r.orient&&n.y2?["cornerRadius"]:aH[r.orient];for(const n of e)r[n]=t;void 0!==r.cornerRadiusEnd&&delete r.cornerRadiusEnd}}const o=Cq("opacity",r,e),a=Cq("fillOpacity",r,e);return void 0===o&&void 0===a&&(r.opacity=function(t,n){if(fR([IW,HW,YW,VW],t)&&!IG(n))return.7}(r.type,n)),void 0===Cq("cursor",r,e)&&(r.cursor=function(t,n,e){return n.href||t.href||Cq("href",t,e)?"pointer":t.cursor}(r,n,e)),r}function oV(t){const{point:n,line:e,...r}=t;return xR(r).length>1?r:r.type}function aV(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:uR(t[n],["point","line"])});return t}function uV(t,n={},e){return"transparent"===t.point?{opacity:0}:t.point?S(t.point)?t.point:{}:void 0!==t.point?null:n.point||e.shape?S(n.point)?n.point:{}:void 0}function sV(t,n={}){return t.line?!0===t.line?{}:t.line:void 0!==t.line?null:n.line?!0===n.line?{}:n.line:void 0}class cV{constructor(){this.name="path-overlay"}hasMatchingType(t,n){if(TG(t)){const{mark:e,encoding:r}=t,i=ZW(e)?e:{type:e};switch(i.type){case"line":case"rule":case"trail":return!!uV(i,n[i.type],r);case"area":return!!uV(i,n[i.type],r)||!!sV(i,n[i.type])}}return!1}run(t,n,e){const{config:r}=n,{params:i,projection:o,mark:a,name:u,encoding:s,...c}=t,f=WG(s,r),l=ZW(a)?a:{type:a},h=uV(l,r[l.type],f),d="area"===l.type&&sV(l,r[l.type]),m=[{name:u,...i?{params:i}:{},mark:oV({..."area"===l.type&&void 0===l.opacity&&void 0===l.fillOpacity?{opacity:.7}:{},...l}),encoding:uR(f,["shape"])}],p=rV(iV(l,f,r),f);let g=f;if(p){const{fieldChannel:t,offset:n}=p;g={...f,[t]:{...f[t],...n?{stack:n}:{}}}}return g=uR(g,["y2","x2"]),d&&m.push({...o?{projection:o}:{},mark:{type:"line",...aR(l,["clip","interpolate","tension","tooltip"]),...d},encoding:g}),h&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...aR(l,["clip","tooltip"]),...h},encoding:g}),e({...c,layer:m},{...n,config:aV(r)})}}function fV(t,n){return n?TH(t)?gV(t,n):dV(t,n):t}function lV(t,n){return n?gV(t,n):t}function hV(t,n,e){const r=n[t];return function(t){return!xt(t)&&YR(t,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void yU(function(t){return`Unknown repeated value "${t}".`}(r.repeat)):n}function dV(t,n){if(void 0!==(t=hV("field",t,n))){if(null===t)return null;if(LH(t)&&zH(t.sort)){const e=hV("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function mV(t,n){if(VH(t))return dV(t,n);{const e=hV("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function pV(t,n){if(!tG(t)){if(YH(t)){const e=mV(t.condition,n);if(e)return{...t,condition:e};{const{condition:n,...e}=t;return e}}return t}{const e=mV(t,n);if(e)return e;if(HH(t))return{condition:t.condition}}}function gV(t,n){const e={};for(const r in t)if(YR(t,r)){const i=t[r];if(D(i))e[r]=i.map((t=>pV(t,n))).filter((t=>t));else{const t=pV(i,n);void 0!==t&&(e[r]=t)}}return e}class vV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(TG(t)){const{encoding:n,mark:e}=t;if("line"===e||ZW(e)&&"line"===e.type)for(const t of QL){const e=n[tI(t)];if(n[t]&&(VH(e)&&!sq(e.bin)||JH(e)))return!0}}return!1}run(t,n,e){const{encoding:r,mark:i}=t;var o;return yU(`Line mark is for continuous lines and thus cannot be used with ${(o=!!r.x2)&&!!r.y2?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`),e({...t,mark:S(i)?{...i,type:"rule"}:"rule"},n)}}function yV({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...xR(t),...xR(n)]);for(const o of i){const i=n[o],a=t[o];if(tG(i)){const t={...a,...i};r[o]=t}else YH(i)?r[o]={...i,condition:{...a,...i.condition}}:i||null===i?r[o]=i:(e||eG(a)||gq(a)||tG(a)||D(a))&&(r[o]=a)}}else r=n;return!r||wR(r)?void 0:r}function bV(t){const{parentProjection:n,projection:e}=t;return n&&e&&yU(function(t){const{parentProjection:n,projection:e}=t;return`Layer's shared projection ${GR(n)} is overridden by a child projection ${GR(e)}.`}({parentProjection:n,projection:e})),e??n}function wV(t){return YR(t,"filter")}function xV(t){return YR(t,"lookup")}function $V(t){return YR(t,"pivot")}function kV(t){return YR(t,"density")}function MV(t){return YR(t,"quantile")}function AV(t){return YR(t,"regression")}function DV(t){return YR(t,"loess")}function SV(t){return YR(t,"sample")}function FV(t){return YR(t,"window")}function EV(t){return YR(t,"joinaggregate")}function NV(t){return YR(t,"flatten")}function CV(t){return YR(t,"calculate")}function OV(t){return YR(t,"bin")}function _V(t){return YR(t,"impute")}function zV(t){return YR(t,"timeUnit")}function BV(t){return YR(t,"aggregate")}function TV(t){return YR(t,"stack")}function PV(t){return YR(t,"fold")}function jV(t){return YR(t,"extent")&&!YR(t,"density")&&!YR(t,"regression")}function RV(t,n){const{transform:e,...r}=t;if(e){const t=e.map((t=>{if(wV(t))return{filter:qV(t,n)};if(OV(t)&&cq(t.bin))return{...t,bin:IV(t.bin)};if(xV(t)){const{selection:n,...e}=t.from;return n?{...t,from:{param:n,...e}}:t}return t}));return{...r,transform:t}}return t}function LV(t,n){const e=iR(t);if(VH(e)&&cq(e.bin)&&(e.bin=IV(e.bin)),rG(e)&&e.scale?.domain?.selection){const{selection:t,...n}=e.scale.domain;e.scale.domain={...n,...t?{param:t}:{}}}if(HH(e))if(D(e.condition))e.condition=e.condition.map((t=>{const{selection:e,param:r,test:i,...o}=t;return r?t:{...o,test:qV(t,n)}}));else{const{selection:t,param:r,test:i,...o}=LV(e.condition,n);e.condition=r?e.condition:{...o,test:qV(e.condition,n)}}return e}function IV(t){const n=t.extent;if(n?.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function qV(t,n){const e=t=>rR(t,(t=>{var e;const r={param:t,empty:n.emptySelections[t]??!0};return(e=n.selectionPredicates)[t]??(e[t]=[]),n.selectionPredicates[t].push(r),r}));return t.selection?e(t.selection):rR(t.test||t.filter,(t=>t.selection?e(t.selection):t))}class UV extends KY{map(t,n){const e=n.selections??[];if(t.params&&!TG(t)){const n=[];for(const r of t.params)DY(r)?e.push(r):n.push(r);t.params=n}return n.selections=e,super.map(t,n)}mapUnit(t,n){const e=n.selections;if(!e||!e.length)return t;const r=(n.path??[]).concat(t.name),i=[];for(const n of e)if(n.views&&n.views.length)for(const e of n.views)(xt(e)&&(e===t.name||r.includes(e))||D(e)&&e.map((t=>r.indexOf(t))).every(((t,n,e)=>-1!==t&&(0===n||t>e[n-1]))))&&i.push(n);else i.push(n);return i.length&&(t.params=i),t}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=UV.prototype[t];UV.prototype[t]=function(t,e){return n.call(this,t,WV(t,e))}}function WV(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function HV(t,n){void 0===n&&(n=HY(t.config));const e=function(t,n={}){const e={config:n};return VV.map(GV.map(YV.map(t,e),e),e)}(t,n),{width:r,height:i}=t,o=function(t,n,e){let{width:r,height:i}=n;const o=TG(t)||JY(t),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(yU(Lq("width")),r=void 0),"container"==i&&(yU(Lq("height")),i=void 0));const u={type:"pad",...a,...e?XV(e.autosize):{},...XV(t.autosize)};if("fit"!==u.type||o||(yU('Autosize "fit" only works for single views and layered views.'),u.type="pad"),"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&yU(Iq("width")),"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&yU(Iq("height")),!HR(u,{type:"pad"}))return u}(e,{width:r,height:i},n);return{...e,...o?{autosize:o}:{}}}const GV=new class extends KY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[nY,aY,lY,new cV,new vV]}map(t,n){if(TG(t)){const e=jG(t.encoding,VR),r=jG(t.encoding,XR),i=jG(t.encoding,JR);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=lV(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const t of this.nonFacetUnitNormalizers)if(t.hasMatchingType(o,n.config))return t.run(o,n,a);return o}mapRepeat(t,n){return function(t){return!D(t.repeat)&&YR(t.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:o,column:a,layer:u}=e,{repeater:s={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:r}},n):{...i,layer:u.map((t=>{const e={...s,layer:t},i=`${(r.name?`${r.name}_`:"")+c}child__layer_${AR(t)}`,o=this.mapLayerOrUnit(r,{...n,repeater:e,repeaterPrefix:i});return o.name=i,o}))}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...o}=t;!D(e)&&t.columns&&(t=uR(t,["columns"]),yU(Yq("repeat")));const a=[],{repeater:u={},repeaterPrefix:s=""}=n,c=!D(e)&&e.row||[u?u.row:null],f=!D(e)&&e.column||[u?u.column:null],l=D(e)&&e||[u?u.repeat:null];for(const t of l)for(const i of c)for(const o of f){const c={repeat:t,row:i,column:o,layer:u.layer},f=(r.name?`${r.name}_`:"")+s+"child__"+(D(e)?`${AR(t)}`:(e.row?`row_${AR(i)}`:"")+(e.column?`column_${AR(o)}`:"")),l=this.map(r,{...n,repeater:c,repeaterPrefix:f});l.name=f,a.push(uR(l,["data"]))}const h=D(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...o,columns:h,concat:a}}mapFacet(t,n){const{facet:e}=t;return TH(e)&&t.columns&&(t=uR(t,["columns"]),yU(Yq("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:o,config:a}=n,u=bV({parentProjection:o,projection:r}),s=yV({parentEncoding:i,encoding:lV(e,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...s?{encoding:s}:{}},{config:a})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...o}=t.encoding,{mark:a,width:u,projection:s,height:c,view:f,params:l,encoding:h,...d}=t,{facetMapping:m,layout:p}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=lV(o,n.repeater);return this.mapFacet({...d,...p,facet:m,spec:{...u?{width:u}:{},...c?{height:c}:{},...f?{view:f}:{},...s?{projection:s}:{},mark:a,encoding:g,...l?{params:l}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&yU(`Facet encoding dropped as ${(o=[...e?[VR]:[],...r?[XR]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const n={},a={};for(const e of[VR,XR]){const r=t[e];if(r){const{align:t,center:i,spacing:o,columns:u,...s}=r;n[e]=s;for(const t of["align","center","spacing"])void 0!==r[t]&&(a[t]??(a[t]={}),a[t][e]=r[t])}}return{facetMapping:n,layout:a}}{const{align:t,center:e,spacing:r,columns:o,...a}=i;return{facetMapping:fV(a,n.repeater),layout:{...t?{align:t}:{},...e?{center:e}:{},...r?{spacing:r}:{},...o?{columns:o}:{}}}}var o}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:o,...a}=t,u={...r,parentEncoding:yV({parentEncoding:n,encoding:i,layer:!0}),parentProjection:bV({parentProjection:e,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{}},u)}},YV=new class extends KY{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=RV(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=RV(t,n)).encoding){const e={};for(const[r,i]of kR(t.encoding))e[r]=LV(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:kR(e).map((([t,e])=>{const{init:r,bind:i,empty:o,...a}=e;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),n.emptySelections[t]="none"!==o;for(const e of $R(n.selectionPredicates[t]??{}))e.empty="none"!==o;return{name:t,value:r,select:a,bind:i}}))}:t}},VV=new UV;function XV(t){return xt(t)?{type:t}:t??{}}const JV=["background","padding"];function KV(t,n){const e={};for(const n of JV)t&&void 0!==t[n]&&(e[n]=kq(t[n]));return n&&(e.params=t.params),e}class QV{constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new QV(iR(this.explicit),iR(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return PR(this.explicit[t],this.implicit[t])}getWithExplicit(t){return void 0!==this.explicit[t]?{explicit:!0,value:this.explicit[t]}:void 0!==this.implicit[t]?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:e}){void 0!==n&&this.set(t,n,e)}set(t,n,e){return delete this[e?"implicit":"explicit"][t],this[e?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:e}){void 0!==n[t]?this.set(t,n[t],!0):void 0!==e[t]&&this.set(t,e[t],!1)}copyKeyFromObject(t,n){void 0!==n[t]&&this.set(t,n[t],!0)}copyAll(t){for(const n of xR(t.combine())){const e=t.getWithExplicit(n);this.setWithExplicit(n,e)}}}function ZV(t){return{explicit:!0,value:t}}function tX(t){return{explicit:!1,value:t}}function nX(t){return(n,e,r,i)=>{const o=t(n.value,e.value);return o>0?n:o<0?e:eX(n,e,r,i)}}function eX(t,n,e,r){return t.explicit&&n.explicit&&yU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${GR(e)} and ${GR(r)}). Using ${GR(e)}.`}(e,r,t.value,n.value)),t}function rX(t,n,e,r,i=eX){return void 0===t||void 0===t.value?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:HR(t.value,n.value)?t:i(t,n,e,r)}class iX extends QV{constructor(t={},n={},e=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=e}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function oX(t){return YR(t,"url")}function aX(t){return YR(t,"values")}function uX(t){return YR(t,"name")&&!oX(t)&&!aX(t)&&!sX(t)}function sX(t){return t&&(cX(t)||fX(t)||lX(t))}function cX(t){return YR(t,"sequence")}function fX(t){return YR(t,"sphere")}function lX(t){return YR(t,"graticule")}var hX;function dX({invalid:t,isPath:n}){switch(fH(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}!function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"}(hX||(hX={}));class mX{constructor(t,n){this.debugName=n,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){this._children.includes(t)?yU("Attempt to add the same child twice."):void 0!==n?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const n of this._children)n.parent=t;this._children=[],t.removeChild(this);const e=t.parent.removeChild(t);this._parent=n,n.addChild(this,e),t.parent=this}}class pX extends mX{clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,e,r){super(t,n),this.type=e,this.refCounts=r,this._source=this._name=n,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 ${RR()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function gX(t){return void 0!==t.as}function vX(t){return`${t}_end`}class yX extends mX{clone(){return new yX(null,iR(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{const{field:i,timeUnit:o}=e;if(o){let a;if(FU(o)){if(SZ(n)){const{mark:t,markDef:r,config:u}=n,s=IH({fieldDef:e,markDef:r,config:u});(KW(t)||s)&&(a={timeUnit:TU(o),field:i})}}else a={as:sG(e,{forAs:!0}),field:i,timeUnit:o};if(SZ(n)){const{mark:t,markDef:i,config:o}=n,u=IH({fieldDef:e,markDef:i,config:o});KW(t)&&DI(r)&&.5!==u&&(a.rectBandPosition=u)}a&&(t[sR(a)]=a)}return t}),{});return wR(e)?null:new yX(t,e)}static makeFromTransform(t,n){const{timeUnit:e,...r}={...n},i={...r,timeUnit:TU(e)};return new yX(t,{[sR(i)]:i})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[e,r]of kR(this.timeUnits)){const i=gX(r)?r.as:`${r.field}_end`;t.has(i)||(n[e]=r)}this.timeUnits=n}producedFields(){return new Set($R(this.timeUnits).map((t=>gX(t)?t.as:vX(t.field))))}dependentFields(){return new Set($R(this.timeUnits).map((t=>t.field)))}hash(){return`TimeUnit ${sR(this.timeUnits)}`}assemble(){const t=[];for(const n of $R(this.timeUnits)){const{rectBandPosition:e}=n,r=TU(n.timeUnit);if(gX(n)){const{field:i,as:o}=n,{unit:a,utc:u,...s}=r,c=[o,`${o}_end`];t.push({field:_R(i),type:"timeunit",...a?{units:OU(a)}:{},...u?{timezone:"utc"}:{},...s,as:c}),t.push(...$X(c,e,r))}else if(n){const{field:i}=n,o=i.replaceAll("\\.","."),a=xX({timeUnit:r,field:o}),u=vX(o);t.push({type:"formula",expr:a,as:u}),t.push(...$X([o,u],e,r))}}return t}}const bX="offsetted_rect_start",wX="offsetted_rect_end";function xX({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,o=_U(r),{part:a,step:u}=RU(o,t.step);return`${i?"utcOffset":"timeOffset"}('${a}', ${CR(n)}, ${e?-u:u})`}function $X([t,n],e,r){if(void 0!==e&&.5!==e){const i=CR(t),o=CR(n);return[{type:"formula",expr:kX([xX({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${bX}`},{type:"formula",expr:kX([i,o],e+.5),as:`${t}_${wX}`}]}return[]}function kX([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const MX="_tuple_fields";class AX{constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const DX={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??(n.project=new AX),o={},a={},u=new Set,s=(t,n)=>{const e="visual"===n?t.channel:t.field;let i=AR(`${r}_${e}`);for(let t=1;u.has(i);t++)i=AR(`${r}_${e}_${t}`);return u.add(i),{[n]:i}},c=n.type,f=t.config.selection[c],l=void 0!==e.value?K(e.value):null;let{fields:h,encodings:d}=S(e.select)?e.select:{};if(!h&&!d&&l)for(const t of l)if(S(t))for(const n of xR(t))ft(JL,n)?(d||(d=[])).push(n):"interval"===c?(yU('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),d=f.encodings):(h??(h=[])).push(n);h||d||(d=f.encodings,"fields"in f&&(h=f.fields));for(const n of d??[]){const e=t.fieldDef(n);if(e){let r=e.field;if(e.aggregate){yU(Hq(n,e.aggregate));continue}if(!r){yU(Wq(n));continue}if(e.timeUnit&&!FU(e.timeUnit)){r=t.vgField(n);const i={timeUnit:e.timeUnit,as:r,field:e.field};a[sR(i)]=i}if(!o[r]){const a={field:r,channel:n,type:"interval"===c&&GI(n)&&xW(t.getScaleComponent(n).get("type"))?"R":e.bin?"R-RE":"E",index:i.items.length};a.signals={...s(a,"data"),...s(a,"visual")},i.items.push(o[r]=a),i.hasField[r]=o[r],i.hasSelectionId=i.hasSelectionId||r===$Y,BL(n)?(a.geoChannel=n,a.channel=zL(n),i.hasChannel[a.channel]=o[r]):i.hasChannel[n]=o[r]}}else yU(Wq(n))}for(const t of h??[]){if(i.hasField[t])continue;const n={type:"E",field:t,index:i.items.length};n.signals={...s(n,"data")},i.items.push(n),i.hasField[t]=n,i.hasSelectionId=i.hasSelectionId||t===$Y}l&&(n.init=l.map((t=>i.items.map((n=>S(t)?void 0!==t[n.geoChannel||n.channel]?t[n.geoChannel||n.channel]:t[n.field]:t))))),wR(a)||(i.timeUnit=new yX(null,a))},signals:(t,n,e)=>{const r=n.name+MX;return e.filter((t=>t.name===r)).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(PX)})}},SX="_curr",FX="anim_value",EX="anim_clock",NX="eased_anim_clock",CX="min_extent",OX="max_range_extent",_X="last_tick_at",zX="is_playing",BX=1/60*1e3,TX={defined:t=>"point"===t.type,topLevelSignals:(t,n,e)=>(QJ(n)&&(e=e.concat([{name:EX,init:"0",on:[{events:{type:"timer",throttle:BX},update:`${zX} ? (${EX} + (now() - ${_X}) > ${OX} ? 0 : ${EX} + (now() - ${_X})) : ${EX}`}]},{name:_X,init:"now()",on:[{events:[{signal:EX},{signal:zX}],update:"now()"}]},{name:zX,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+MX,o=n.project,a="(item().isVoronoi ? datum.datum : datum)",u=$R(t.component.selection??{}).reduce(((t,n)=>"interval"===n.type?t.concat(n.name+GX):t),[]).map((t=>`indexof(item().mark.name, '${t}') < 0`)).join(" && "),s="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(u?` && ${u}`:"");let c=`unit: ${XJ(t)}, `;if(n.project.hasSelectionId?c+=`${$Y}: ${a}[${Et($Y)}]`:QJ(n)?c+=`fields: ${i}, values: [${FX} ? ${FX} : ${CX}]`:c+=`fields: ${i}, values: [${o.items.map((n=>{const e=t.fieldDef(n.channel);return e?.bin?`[${a}[${Et(t.vgField(n.channel,{}))}], ${a}[${Et(t.vgField(n.channel,{binSuffix:"end"}))}]]`:`${a}[${Et(n.field)}]`})).join(", ")}]`,QJ(n))return e.concat((f=n.name,l=t.scaleName(lL),[{name:NX,update:EX},{name:`${f}_domain`,init:`domain('${l}')`},{name:CX,init:`extent(${f}_domain)[0]`},{name:OX,init:`extent(range('${l}'))[1]`},{name:FX,update:`invert('${l}', ${NX})`}]),[{name:r+HJ,on:[{events:[{signal:NX},{signal:FX}],update:`{${c}}`,force:!0}]}]);{const t=n.events;return e.concat([{name:r+HJ,on:t?[{events:t,update:`${s} ? {${c}} : null`,force:!0}]:[]}])}var f,l}};function PX(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=_R(i.field),i}function jX(t,n=!0,e=b){if(D(t)){const r=t.map((t=>jX(t,n,e)));return n?`[${r.join(", ")}]`:r}return bU(t)?e(n?AU(t):function(t){const n=MU(t,!0);return t.utc?+new Date(Date.UTC(...n)):+new Date(...n)}(t)):n?e(GR(t)):t}function RX(t,n){for(const e of $R(t.component.selection??{})){const r=e.name;let i=`${r}${HJ}, ${"global"===e.resolve?"true":`{unit: ${XJ(t)}}`}`;for(const r of VJ)r.defined(e)&&(r.signals&&(n=r.signals(t,e,n)),r.modifyExpr&&(i=r.modifyExpr(t,e,i)));n.push({name:r+GJ,on:[{events:{signal:e.name+HJ},update:`modify(${Et(e.name+WJ)}, ${i})`}]})}return qX(n)}function LX(t,n){if(t.component.selection&&xR(t.component.selection).length){const e=Et(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:iB("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return qX(n)}function IX(t,n){for(const e of $R(t.component.selection??{}))for(const r of VJ)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function qX(t){return t.map((t=>(t.on&&!t.on.length&&delete t.on,t)))}const UX={defined:t=>"interval"===t.type&&"global"===t.resolve&&t.bind&&"scales"===t.bind,parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!GI(i))continue;const o=t.getScaleComponent(i),a=o?o.get("type"):void 0;"sequential"==a&&yU("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&xW(a)?(o.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):yU("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter((t=>0===e.filter((n=>n.name===t.signals.data)).length));if(!t.parent||HX(t)||0===r.length)return e;const i=e.find((t=>t.name===n.name));let o=i.update;if(o.includes(YJ))i.update=`{${r.map((t=>`${Et(_R(t.field))}: ${t.signals.data}`)).join(", ")}}`;else{for(const t of r){const n=`${Et(_R(t.field))}: ${t.signals.data}`;o.includes(n)||(o=`${o.substring(0,o.length-1)}, ${n}}`)}i.update=o}return e.concat(r.map((t=>({name:t.signals.data}))))},signals:(t,n,e)=>{if(t.parent&&!HX(t))for(const t of n.scales){const n=e.find((n=>n.name===t.signals.data));n.push="outer",delete n.value,delete n.update}return e}};function WX(t,n){return`domain(${Et(t.scaleName(n))})`}function HX(t){return t.parent&&NZ(t.parent)&&(!t.parent.parent||HX(t.parent.parent))}const GX="_brush",YX="_scale_trigger",VX="geo_interval_init_tick",XX="_init",JX={defined:t=>"interval"===t.type,parse:(t,n,e)=>{var r;if(t.hasProjection){const t={...S(e.select)?e.select:{}};t.fields=[$Y],t.encodings||(t.encodings=e.value?xR(e.value):[sL,uL]),e.select={type:"interval",...t}}if(n.translate&&!UX.defined(n)){const t=`!event.item || event.item.mark.name !== ${Et(n.name+GX)}`;for(const e of n.events){if(!e.between){yU(`${e} is not an ordered event stream for interval selections.`);continue}const n=K((r=e.between[0]).filter??(r.filter=[]));n.includes(t)||n.push(t)}}},signals:(t,n,e)=>{const r=n.name,i=r+HJ,o=$R(n.project.hasChannel).filter((t=>t.channel===KR||t.channel===QR)),a=n.init?n.init[0]:null;if(e.push(...o.reduce(((e,r)=>e.concat(function(t,n,e,r){const i=!t.hasProjection,o=e.channel,a=e.signals.visual,u=Et(i?t.scaleName(o):t.projectionName()),s=t=>`scale(${u}, ${t})`,c=t.getSizeSignalRef(o===KR?"width":"height").signal,f=`${o}(unit)`,l=n.events.reduce(((t,n)=>[...t,{events:n.between[0],update:`[${f}, ${f}]`},{events:n,update:`[${a}[0], clamp(${f}, 0, ${c})]`}]),[]);if(i){const i=e.signals.data,c=UX.defined(n),f=t.getScaleComponent(o),h=f?f.get("type"):void 0,d=r?{init:jX(r,!0,s)}:{value:[]};return l.push({events:{signal:n.name+YX},update:xW(h)?`[${s(`${i}[0]`)}, ${s(`${i}[1]`)}]`:"[0, 0]"}),c?[{name:i,on:[]}]:[{name:a,...d,on:l},{name:i,...r?{init:jX(r)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${u}, ${a})`}]}]}{const t=o===KR?0:1,e=n.name+XX;return[{name:a,...r?{init:`[${e}[0][${t}], ${e}[1][${t}]]`}:{value:[]},on:l}]}}(t,n,r,a&&a[r.index]))),[])),t.hasProjection){const u=Et(t.projectionName()),s=t.projectionName()+"_center",{x:c,y:f}=n.project.hasChannel,l=c&&c.signals.visual,h=f&&f.signals.visual,d=c?a&&a[c.index]:`${s}[0]`,m=f?a&&a[f.index]:`${s}[1]`,p=n=>t.getSizeSignalRef(n).signal,g=`[[${l?l+"[0]":"0"}, ${h?h+"[0]":"0"}],[${l?l+"[1]":p("width")}, ${h?h+"[1]":p("height")}]]`;!a||(e.unshift({name:r+XX,init:`[scale(${u}, [${c?d[0]:d}, ${f?m[0]:m}]), scale(${u}, [${c?d[1]:d}, ${f?m[1]:m}])]`}),c&&f)||e.find((t=>t.name===s))||e.unshift({name:s,update:`invert(${u}, [${p("width")}/2, ${p("height")}/2])`});const v=`vlSelectionTuples(intersect(${g}, {markname: ${Et(t.getName("marks"))}}, unit.mark), {unit: ${XJ(t)}})`,y=o.map((t=>t.signals.visual));return e.concat({name:i,on:[{events:[...y.length?[{signal:y.join(" || ")}]:[],...a?[{signal:VX}]:[]],update:v}]})}{if(!UX.defined(n)){const n=r+YX,i=o.map((n=>{const e=n.channel,{data:r,visual:i}=n.signals,o=Et(t.scaleName(e)),a=xW(t.getScaleComponent(e).get("type"))?"+":"";return`(!isArray(${r}) || (${a}invert(${o}, ${i})[0] === ${a}${r}[0] && ${a}invert(${o}, ${i})[1] === ${a}${r}[1]))`}));i.length&&e.push({name:n,value:{},on:[{events:o.map((n=>({scale:t.scaleName(n.channel)}))),update:i.join(" && ")+` ? ${n} : {}`}]})}const u=o.map((t=>t.signals.data)),s=`unit: ${XJ(t)}, fields: ${r+MX}, values`;return e.concat({name:i,...a?{init:`{${s}: ${jX(a)}}`}:{},...u.length?{on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${s}: [${u}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(SZ(t)&&t.hasProjection&&n.init&&(e.filter((t=>t.name===VX)).length||e.unshift({name:VX,value:null,on:[{events:"timer{1}",update:`${VX} === null ? {} : ${VX}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:o}=n.project.hasChannel,a=i?.signals.visual,u=o?.signals.visual,s=`data(${Et(n.name+WJ)})`;if(UX.defined(n)||!i&&!o)return e;const c={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const n of xR(c))c[n]=[{test:`${s}.length && ${s}[0].unit === ${XJ(t)}`,...c[n]},{value:0}];const{fill:f,fillOpacity:l,cursor:h,...d}=n.mark,m=xR(d).reduce(((t,n)=>(t[n]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter((t=>t)).join(" && "),value:d[n]},{value:null}],t)),{}),p=h??(n.translate?"move":null);return[{name:`${r+GX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:l}},update:c}},...e,{name:r+GX,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...c,...m}}}]}};function KX({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const o=HH(n)&&n.condition;let a=[];o&&(a=K(o).map((n=>{const e=i(n);if(function(t){return YR(t,"param")}(n)){const{param:r,empty:i}=n;return{test:rK(t,{param:r,empty:i}),...e}}return{test:oK(t,n.test),...e}}))),void 0!==r&&a.push(r);const u=i(n);return void 0!==u&&a.push(u),a.length>1||1===a.length&&Boolean(a[0].test)?{[e]:a}:1===a.length?{[e]:a[0]}:{}}function QX(t,n="text"){return KX({model:t,channelDef:t.encoding[n],vgChannel:n,mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0})}function ZX(t,n,e="datum"){if(t){if(eG(t))return Aq(t.value);if(tG(t)){const{format:r,formatType:i}=gG(t);return $H({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function tJ(t,n={}){const{encoding:e,markDef:r,config:i,stack:o}=t,a=e.tooltip;if(D(a))return{tooltip:eJ({tooltip:a},o,i,n)};{const u=n.reactiveGeom?"datum.datum":"datum";return KX({model:t,channelDef:a,vgChannel:"tooltip",mainRefFn:t=>{const a=ZX(t,i,u);if(a)return a;if(null===t)return;let s=Cq("tooltip",r,i);return!0===s&&(s={content:"encoding"}),xt(s)?{value:s}:S(s)?gq(s)?s:"encoding"===s.content?eJ(e,o,i,n):{signal:u}:void 0},invalidValueRef:void 0})}}function nJ(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},o=new Set,a=r?"datum.datum":"datum",u=[];function s(e,r){const s=tI(r),c=nG(e)?e:{...e,type:t[s].type},f=K(c.title||pG(c,i)).join(", ").replaceAll(/"/g,'\\"');let l;if(DI(r)){const n="x"===r?"x2":"y2",e=vG(t[n]);if(sq(c.bin)&&e){const t=sG(c,{expr:a}),r=sG(e,{expr:a}),{format:u,formatType:s}=gG(c);l=NH(t,r,u,s,i),o.add(n)}}if((DI(r)||r===oL||r===rL)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:t,formatType:n}=gG(c);l=$H({fieldOrDatumDef:c,format:t,formatType:n,expr:a,config:i,normalizeStack:!0}).signal}l??(l=ZX(c,i,a).signal),u.push({channel:r,key:f,value:l})}HG(t,((t,n)=>{VH(t)?s(t,n):GH(t)&&s(t.condition,n)}));const c={};for(const{channel:t,key:n,value:e}of u)o.has(t)||c[n]||(c[n]=e);return c}function eJ(t,n,e,{reactiveGeom:r}={}){const i=nJ(t,n,e,{reactiveGeom:r}),o=kR(i).map((([t,n])=>`"${t}": ${n}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function rJ(t){const{markDef:n,config:e}=t,r=Cq("aria",n,e);return!1===r?{}:{...r?{aria:r}:{},...iJ(t),...oJ(t)}}function iJ(t){const{mark:n,markDef:e,config:r}=t;if(!1===r.aria)return{};const i=Cq("ariaRoleDescription",e,r);return null!=i?{ariaRoleDescription:{value:i}}:ft(wq,n)?{}:{ariaRoleDescription:{value:n}}}function oJ(t){const{encoding:n,markDef:e,config:r,stack:i}=t,o=n.description;if(o)return KX({model:t,channelDef:o,vgChannel:"description",mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0});const a=Cq("description",e,r);if(null!=a)return{description:Aq(a)};if(!1===r.aria)return{};const u=nJ(n,i,r);return wR(u)?void 0:{description:{signal:kR(u).map((([t,n],e)=>`"${e>0?"; ":""}${t}: " + (${n})`)).join(" + ")}}}function aJ(t,n,e={}){const{markDef:r,encoding:i,config:o}=n,{vgChannel:a}=e;let{defaultRef:u,defaultValue:s}=e;const c=i[t];void 0===u&&(s??(s=Cq(t,r,o,{vgChannel:a,ignoreVgConfig:!HH(c)})),void 0!==s&&(u=Aq(s)));const f={markDef:r,config:o,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},l=dH({...f,scaleChannel:t,channelDef:c});return KX({model:n,channelDef:c,vgChannel:a??t,invalidValueRef:l,mainRefFn:n=>yH({...f,channel:t,channelDef:n,stack:null,defaultRef:u})})}function uJ(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:o}=e,a=n.filled??Cq("filled",e,i),u=fR(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=Cq(!0===a?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[!0===a&&"color"]??u,c=Cq(!1===a?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[!1===a&&"color"],f=a?"fill":"stroke",l={...s?{fill:Aq(s)}:{},...c?{stroke:Aq(c)}:{}};return e.color&&(a?e.fill:e.stroke)&&yU(tU("property",{fill:"fill"in e,stroke:"stroke"in e})),{...l,...aJ("color",t,{vgChannel:f,defaultValue:a?s:c}),...aJ("fill",t,{defaultValue:r.fill?s:void 0}),...aJ("stroke",t,{defaultValue:r.stroke?c:void 0})}}function sJ(t){const{encoding:n,mark:e}=t,r=n.order;return!JW(e)&&eG(r)?KX({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:t=>Aq(t.value),invalidValueRef:void 0}):{}}function cJ({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const o=`${t}Offset`,a=n[o],u=e[o];if(("xOffset"===o||"yOffset"===o)&&u)return{offsetType:"encoding",offset:yH({channel:o,channelDef:u,markDef:n,config:r?.config,scaleName:r.scaleName(o),scale:r.getScaleComponent(o),stack:null,defaultRef:Aq(a),bandPosition:i})};const s=n[o];return s?{offsetType:"visual",offset:s}:{}}function fJ(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:o,config:a,stack:u}=n,s=i[t],c=i[eI(t)],f=n.scaleName(t),l=n.getScaleComponent(t),{offset:h,offsetType:d}=cJ({channel:t,markDef:o,encoding:i,model:n,bandPosition:.5}),m=lJ({model:n,defaultPos:e,channel:t,scaleName:f,scale:l}),p=!s&&DI(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(t){const{channel:n,channelDef:e,scaleName:r,stack:i,offset:o,markDef:a}=t;if(tG(e)&&i&&n===i.fieldChannel){if(VH(e)){let t=e.bandPosition;if(void 0!==t||"text"!==a.type||"radius"!==n&&"theta"!==n||(t=.5),void 0!==t)return vH({scaleName:r,fieldOrDatumDef:e,startSuffix:"start",bandPosition:t,offset:o})}return gH(e,r,{suffix:"end"},{offset:o})}return pH(t)}({channel:t,channelDef:s,channel2Def:c,markDef:o,config:a,scaleName:f,scale:l,stack:u,offset:h,defaultRef:m,bandPosition:"encoding"===d?0:void 0});return p?{[r||t]:p}:void 0}function lJ({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:o,config:a}=t;return()=>{const u=tI(e),s=nI(e),c=Cq(e,o,a,{vgChannel:s});if(void 0!==c)return bH(e,c);switch(n){case"zeroOrMin":return hJ({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:u,config:a});case"zeroOrMax":return hJ({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:u,config:a});case"mid":return{...t[rI(e)],mult:.5}}}}function hJ({mainChannel:t,config:n,...e}){const r=hH(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if("zeroOrMin"===i)return{value:0};const{widthSignal:t,heightSignal:n}=i.zeroOrMax;return{signal:`min(${t},${n})/2`}}case"theta":return"zeroOrMin"===i?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===i?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===i?{field:{group:"height"}}:{value:0}}}const dJ={left:"x",center:"xc",right:"x2"},mJ={top:"y",middle:"yc",bottom:"y2"};function pJ(t,n,e,r="middle"){if("radius"===t||"theta"===t)return nI(t);const i="x"===t?"align":"baseline",o=Cq(i,n,e);let a;return gq(o)?(yU(function(t){return`The ${t} for range marks cannot be an expression`}(i)),a=void 0):a=o,"x"===t?dJ[a||("top"===r?"left":"center")]:mJ[a||r]}function gJ(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?vJ(t,n,{defaultPos:e,defaultPos2:r}):fJ(t,n,{defaultPos:e})}function vJ(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:o}=n,a=eI(t),u=rI(t),s=function(t,n,e){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=t,s=tI(e),c=rI(e),f=nI(e),l=r[s],h=t.scaleName(s),d=t.getScaleComponent(s),{offset:m}=cJ(e in r||e in o?{channel:e,markDef:o,encoding:r,model:t}:{channel:s,markDef:o,encoding:r,model:t});if(!l&&("x2"===e||"y2"===e)&&(r.latitude||r.longitude)){const n=rI(e),r=t.markDef[n];return null!=r?{[n]:{value:r}}:{[f]:{field:t.getName(e)}}}const p=function({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c}){return tG(n)&&u&&t.charAt(0)===u.fieldChannel.charAt(0)?gH(n,o,{suffix:"start"},{offset:s}):pH({channel:t,channelDef:e,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:c})}({channel:e,channelDef:l,channel2Def:r[e],markDef:o,config:u,scaleName:h,scale:d,stack:a,offset:m,defaultRef:void 0});return void 0!==p?{[f]:p}:yJ(e,o)||yJ(e,{[e]:_q(e,o,u.style),[c]:_q(c,o,u.style)})||yJ(e,u[i])||yJ(e,u.mark)||{[f]:lJ({model:t,defaultPos:n,channel:e,scaleName:h,scale:d})()}}(n,r,a);return{...fJ(t,n,{defaultPos:e,vgChannel:s[u]?pJ(t,i,o):nI(t)}),...s}}function yJ(t,n){const e=rI(t),r=nI(t);if(void 0!==n[r])return{[r]:bH(t,n[r])};if(void 0!==n[t])return{[r]:bH(t,n[t])};if(n[e]){const r=n[e];if(!oH(r))return{[e]:bH(t,r)};yU(function(t){return`Position range does not support relative band size for ${t}.`}(e))}}function bJ(t,n){const{config:e,encoding:r,markDef:i}=t,o=i.type,a=eI(n),u=rI(n),s=r[n],c=r[a],f=t.getScaleComponent(n),l=f?f.get("type"):void 0,h=i.orient,d=r[u]??r.size??Cq("size",i,e,{vgChannel:u}),m=iI(n),p="bar"===o&&("x"===n?"vertical"===h:"horizontal"===h)||"tick"===o&&("y"===n?"vertical"===h:"horizontal"===h);return!VH(s)||!(uq(s.bin)||sq(s.bin)||s.timeUnit&&!c)||d&&!oH(d)||r[m]||wW(l)?(tG(s)&&wW(l)||p)&&!c?function(t,n,e){const{markDef:r,encoding:i,config:o,stack:a}=e,u=r.orient,s=e.scaleName(n),c=e.getScaleComponent(n),f=rI(n),l=eI(n),h=iI(n),d=e.scaleName(h),m=e.getScaleComponent(oI(n)),p="tick"===r.type||"horizontal"===u&&"y"===n||"vertical"===u&&"x"===n;let g;(i.size||r.size)&&(p?g=aJ("size",e,{vgChannel:f,defaultRef:Aq(r.size)}):yU(function(t){return`Cannot apply size to non-oriented mark "${t}".`}(r.type)));const v=!!g,y=qH({channel:n,fieldDef:t,markDef:r,config:o,scaleType:(c||m)?.get("type"),useVlSizeChannel:p});g=g||{[f]:wJ(f,d||s,m||c,o,y,!!t,r.type)};const b=pJ(n,r,o,"band"===(c||m)?.get("type")&&oH(y)&&!v?"top":"middle"),w="xc"===b||"yc"===b,{offset:x,offsetType:$}=cJ({channel:n,markDef:r,encoding:i,model:e,bandPosition:w?.5:0}),k=pH({channel:n,channelDef:t,markDef:r,config:o,scaleName:s,scale:c,stack:a,offset:x,defaultRef:lJ({model:e,defaultPos:"mid",channel:n,scaleName:s,scale:c}),bandPosition:w?"encoding"===$?0:.5:gq(y)?{signal:`(1-${y})/2`}:oH(y)?(1-y.band)/2:0});if(f)return{[b]:k,...g};{const t=nI(l),n=g[f],e=x?{...n,offset:x}:n;return{[b]:k,[t]:D(k)?[k[0],{...k[1],offset:e}]:{...k,offset:e}}}}(s,n,t):vJ(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:t,fieldDef2:n,channel:e,model:r}){const{config:i,markDef:o,encoding:a}=r,u=r.getScaleComponent(e),s=r.scaleName(e),c=u?u.get("type"):void 0,f=u.get("reverse"),l=qH({channel:e,fieldDef:t,markDef:o,config:i,scaleType:c}),h=r.component.axes[e]?.[0],d=h?.get("translate")??.5,m=DI(e)?Cq("binSpacing",o,i)??0:0,p=eI(e),g=nI(e),v=nI(p),y=Oq("minBandSize",o,i),{offset:b}=cJ({channel:e,markDef:o,encoding:a,model:r,bandPosition:0}),{offset:w}=cJ({channel:p,markDef:o,encoding:a,model:r,bandPosition:0}),x=function({scaleName:t,fieldDef:n}){const e=sG(n,{expr:"datum"});return`abs(scale("${t}", ${sG(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${e}))`}({fieldDef:t,scaleName:s}),$=xJ(e,m,f,d,b,y,x),k=xJ(p,m,f,d,w??b,y,x),M=gq(l)?{signal:`(1-${l.signal})/2`}:oH(l)?(1-l.band)/2:.5,A=IH({fieldDef:t,fieldDef2:n,markDef:o,config:i});if(uq(t.bin)||t.timeUnit){const n=t.timeUnit&&.5!==A;return{[v]:$J({fieldDef:t,scaleName:s,bandPosition:M,offset:k,useRectOffsetField:n}),[g]:$J({fieldDef:t,scaleName:s,bandPosition:gq(M)?{signal:`1-${M.signal}`}:1-M,offset:$,useRectOffsetField:n})}}if(sq(t.bin)){const e=gH(t,s,{},{offset:k});if(VH(n))return{[v]:e,[g]:gH(n,s,{},{offset:$})};if(cq(t.bin)&&t.bin.step)return{[v]:e,[g]:{signal:`scale("${s}", ${sG(t,{expr:"datum"})} + ${t.bin.step})`,offset:$}}}yU(mU(p))}({fieldDef:s,fieldDef2:c,channel:n,model:t})}function wJ(t,n,e,r,i,o,a){if(oH(i)){if(!e)return{mult:i.band,field:{group:t}};{const t=e.get("type");if("band"===t){let t=`bandwidth('${n}')`;1!==i.band&&(t=`${i.band} * ${t}`);const e=Oq("minBandSize",{type:a},r);return{signal:e?`max(${Fq(e)}, ${t})`:t}}1!==i.band&&(yU(function(t){return`Cannot use the relative band size with ${t} scale.`}(t)),i=void 0)}}else{if(gq(i))return i;if(i)return{value:i}}if(e){const t=e.get("range");if(vq(t)&&bt(t.step))return{value:t.step-2}}if(!o){const{bandPaddingInner:n,barBandPaddingInner:e,rectBandPaddingInner:i,tickBandPaddingInner:o}=r.scale,u=PR(n,"tick"===a?o:"bar"===a?e:i);if(gq(u))return{signal:`(1 - (${u.signal})) * ${t}`};if(bt(u))return{signal:`${1-u} * ${t}`}}return{value:TY(r.view,t)-2}}function xJ(t,n,e,r,i,o,a){if(OL(t))return 0;const u="x"===t||"y2"===t,s=u?-n/2:n/2;if(gq(e)||gq(i)||gq(r)||o){const t=Fq(e),n=Fq(i),c=Fq(r),f=Fq(o),l=o?`(${a} < ${f} ? ${u?"":"-"}0.5 * (${f} - (${a})) : ${s})`:s;return{signal:(c?`${c} + `:"")+(t?`(${t} ? -1 : 1) * `:"")+(n?`(${n} + ${l})`:l)}}return i=i||0,r+(e?-i-s:+i+s)}function $J({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return vH({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:bX,endSuffix:wX}:{}})}const kJ=new Set(["aria","width","height"]);function MJ(t,n){const{fill:e,stroke:r}="include"===n.color?uJ(t):{};return{...DJ(t.markDef,n),...AJ("fill",e),...AJ("stroke",r),...aJ("opacity",t),...aJ("fillOpacity",t),...aJ("strokeOpacity",t),...aJ("strokeWidth",t),...aJ("strokeDash",t),...sJ(t),...tJ(t),...QX(t,"href"),...rJ(t)}}function AJ(t,n){return n?{[t]:n}:{}}function DJ(t,n){return bq.reduce(((e,r)=>(!kJ.has(r)&&YR(t,r)&&"ignore"!==n[r]&&(e[r]=Aq(t[r])),e)),{})}function SJ(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef(((i,o)=>{let a;if(!GI(o)||!(a=t.getScaleType(o)))return;const u=rq(i.aggregate);if("break-paths-filter-domains"===(s=lH({scaleChannel:o,markDef:e,config:n,scaleType:a,isCountAggregate:u}))||"break-paths-show-domains"===s){const n=t.vgField(o,{expr:"datum",binSuffix:t.stack?.impute?"mid":void 0});n&&r.add(n)}var s})),r.size>0){const t=[...r].map((t=>JU(t,!0))).join(" && ");return{defined:{signal:t}}}}function FJ(t,n){if(void 0!==n)return{[t]:Aq(n)}}const EJ="voronoi",NJ={defined:t=>"point"===t.type&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(EJ)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,o=t.mark;if(JW(o))return yU(`The "nearest" transform is not supported for ${o} marks.`),e;const a={name:t.getName(EJ),type:"path",interactive:!0,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...tJ(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let u=0,s=!1;return e.forEach(((n,e)=>{const r=n.name??"";r===t.component.mark[0].name?u=e:r.includes(EJ)&&(s=!0)})),s||e.splice(u+1,0,a),e}},CJ={defined:t=>"point"===t.type&&"global"===t.resolve&&t.bind&&"scales"!==t.bind&&!MY(t.bind),parse:(t,n,e)=>KJ(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,o=n.bind,a=n.init&&n.init[0],u=NJ.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach(((t,i)=>{const s=AR(`${r}_${t.field}`);e.filter((t=>t.name===s)).length||e.unshift({name:s,...a?{init:jX(a[i])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Et(t.field)}] : null`}]:[],bind:o[t.field]??o[t.channel]??o})})),e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+HJ)),a=r+MX,u=i.items.map((t=>AR(`${r}_${t.field}`))),s=u.map((t=>`${t} !== null`)).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,e}},OJ="_toggle",_J={defined:t=>"point"===t.type&&!QJ(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+OJ,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+HJ,r=n.name+OJ;return`${r} ? null : ${e}, `+("global"===n.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${XJ(t)}}, `)+`${r} ? ${e} : null`}},zJ={defined:t=>void 0!==t.clear&&!1!==t.clear&&!QJ(t),parse:(t,n)=>{n.clear&&(n.clear=xt(n.clear)?iB(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(CJ.defined(n))for(const t of n.project.items){const r=e.findIndex((e=>e.name===AR(`${n.name}_${t.field}`)));-1!==r&&e[r].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(t,r){-1!==t&&e[t].on&&e[t].on.push({events:n.clear,update:r})}if("interval"===n.type)for(const t of n.project.items){const n=e.findIndex((n=>n.name===t.signals.visual));r(n,"[0, 0]"),-1===n&&r(e.findIndex((n=>n.name===t.signals.data)),"null")}else{let t=e.findIndex((t=>t.name===n.name+HJ));r(t,"null"),_J.defined(n)&&(t=e.findIndex((t=>t.name===n.name+OJ)),r(t,"false"))}return e}},BJ={defined:t=>{const n="global"===t.resolve&&t.bind&&MY(t.bind),e=1===t.project.items.length&&t.project.items[0].field!==$Y;return n&&!e&&yU("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=iR(e);if(r.select=xt(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},KJ(n,r),S(e.select)&&(e.select.on||e.select.clear)){const t='event.item && indexof(event.item.mark.role, "legend") < 0';for(const e of n.events)e.filter=K(e.filter??[]),e.filter.includes(t)||e.filter.push(t)}const i=AY(n.bind)?n.bind.legend:"click",o=xt(i)?iB(i,"view"):K(i);n.bind={legend:{merge:o}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=AY(n.bind)&&n.bind.legend,o=t=>n=>{const e=iR(n);return e.markname=t,e};for(const t of n.project.items){if(!t.hasLegend)continue;const a=`${AR(t.field)}_legend`,u=`${r}_${a}`;if(0===e.filter((t=>t.name===u)).length){const t=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:t,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+HJ)),a=r+MX,u=i.items.filter((t=>t.hasLegend)).map((t=>AR(`${r}_${AR(t.field)}_legend`))),s=`${u.map((t=>`${t} !== null`)).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;n.events&&u.length>0?o.on.push({events:u.map((t=>({signal:t}))),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const c=e.find((t=>t.name===r+OJ)),f=AY(n.bind)&&n.bind.legend;return c&&(n.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),e}},TJ="_translate_anchor",PJ="_translate_delta",jJ={defined:t=>"interval"===t.type&&t.translate,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+TJ,{x:a,y:u}=n.project.hasChannel;let s=iB(n.translate,"scope");return i||(s=s.map((t=>(t.between[0].markname=r+GX,t)))),e.push({name:o,value:{},on:[{events:s.map((t=>t.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${i?WX(t,KR):`slice(${a.signals.visual})`}`:"")+(void 0!==u?`, extent_y: ${i?WX(t,QR):`slice(${u.signals.visual})`}`:"")+"}"}]},{name:r+PJ,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&RJ(t,n,a,"width",e),void 0!==u&&RJ(t,n,u,"height",e),e}};function RJ(t,n,e,r,i){const o=n.name,a=o+TJ,u=o+PJ,s=e.channel,c=UX.defined(n),f=i.find((t=>t.name===e.signals[c?"data":"visual"])),l=t.getSizeSignalRef(r).signal,h=t.getScaleComponent(s),d=h&&h.get("type"),m=h&&h.get("reverse"),p=`${a}.extent_${s}`,g=`${c&&h?"log"===d?"panLog":"symlog"===d?"panSymlog":"pow"===d?"panPow":"panLinear":"panLinear"}(${p}, ${c?s===KR?m?"":"-":m?"-":"":""}${u}.${s} / ${c?`${l}`:`span(${p})`}${c?"pow"===d?`, ${h.get("exponent")??1}`:"symlog"===d?`, ${h.get("constant")??1}`:"":""})`;f.on.push({events:{signal:u},update:c?g:`clampRange(${g}, 0, ${l})`})}const LJ="_zoom_anchor",IJ="_zoom_delta",qJ={defined:t=>"interval"===t.type&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+IJ,{x:a,y:u}=n.project.hasChannel,s=Et(t.scaleName(KR)),c=Et(t.scaleName(QR));let f=iB(n.zoom,"scope");return i||(f=f.map((t=>(t.markname=r+GX,t)))),e.push({name:r+LJ,on:[{events:f,update:i?"{"+[s?`x: invert(${s}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((t=>t)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&UJ(t,n,a,"width",e),void 0!==u&&UJ(t,n,u,"height",e),e}};function UJ(t,n,e,r,i){const o=n.name,a=e.channel,u=UX.defined(n),s=i.find((t=>t.name===e.signals[u?"data":"visual"])),c=t.getSizeSignalRef(r).signal,f=t.getScaleComponent(a),l=f&&f.get("type"),h=u?WX(t,a):s.name,d=o+IJ,m=`${u&&f?"log"===l?"zoomLog":"symlog"===l?"zoomSymlog":"pow"===l?"zoomPow":"zoomLinear":"zoomLinear"}(${h}, ${o}${LJ}.${a}, ${d}${u?"pow"===l?`, ${f.get("exponent")??1}`:"symlog"===l?`, ${f.get("constant")??1}`:"":""})`;s.on.push({events:{signal:d},update:u?m:`clampRange(${m}, 0, ${c})`})}const WJ="_store",HJ="_tuple",GJ="_modify",YJ="vlSelectionResolve",VJ=[TX,JX,DX,_J,CJ,UX,BJ,zJ,jJ,qJ,NJ];function XJ(t,{escape:n}={escape:!0}){let e=n?Et(t.name):t.name;const r=function(t){let n=t.parent;for(;n&&!FZ(n);)n=n.parent;return n}(t);if(r){const{facet:t}=r;for(const n of LL)t[n]&&(e+=` + '__facet_${n}_' + (facet[${Et(r.vgField(n))}])`)}return e}function JJ(t){return $R(t.component.selection??{}).reduce(((t,n)=>t||n.project.hasSelectionId),!1)}function KJ(t,n){!xt(n.select)&&n.select.on||delete t.events,!xt(n.select)&&n.select.clear||delete t.clear,!xt(n.select)&&n.select.toggle||delete t.toggle}function QJ(t){return t.events?.find((t=>"type"in t&&"timer"===t.type))}function ZJ(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...ZJ(t.object)),n.push(...ZJ(t.property))),n)}function tK(t){return"MemberExpression"===t.object.type?tK(t.object):"datum"===t.object.name}function nK(t){const n=YO(t),e=new Set;return n.visit((t=>{"MemberExpression"===t.type&&tK(t)&&e.add(ZJ(t).slice(1).join("."))})),e}class eK extends mX{clone(){return new eK(null,this.model,iR(this.filter))}constructor(t,n,e){super(t),this.model=n,this.filter=e,this.expr=oK(this.model,this.filter,this),this._dependentFields=nK(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function rK(t,n,e,r="datum"){const i=xt(n)?n:n.param,o=AR(i),a=Et(o+WJ);let u;try{u=t.getSelectionComponent(o,i)}catch(t){return`!!${o}`}if(u.project.timeUnit){const n=e??t.component.data.raw,r=u.project.timeUnit.clone();n.parent?r.insertAsParentOf(n):n.parent=r}const s=`${u.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${r}${"global"===u.resolve?")":`, ${Et(u.resolve)})`}`,c=`length(data(${a}))`;return!1===n.empty?`${c} && ${s}`:`!${c} || ${s}`}function iK(t,n,e){const r=AR(n),i=e.encoding;let o,a=e.field;try{o=t.getSelectionComponent(r,n)}catch(t){return r}if(i||a){if(i&&!a){const t=o.project.items.filter((t=>t.channel===i));!t.length||t.length>1?(a=o.project.items[0].field,yU(function(t,n,e,r){return(t.length?"Multiple ":"No ")+`matching ${Et(n)} encoding found for selection ${Et(e.param)}. `+`Using "field": ${Et(r)}.`}(t,i,e,a))):a=t[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&yU(function(t){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Et(t)}.`}(a));return`${o.name}[${Et(_R(a))}]`}function oK(t,n,e){return DR(n,(n=>xt(n)?n:function(t){return YR(t,"param")}(n)?rK(t,n,e):XU(n)))}function aK(t,n,e,r){var i,o;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(o=t.encode[n]).update??(o.update={}),t.encode[n].update[e]=r}function uK(t,n,e,r={header:!1}){const{disable:i,orient:o,scale:a,labelExpr:u,title:s,zindex:c,...f}=t.combine();if(!i){for(const t in f){const e=t,r=CG[e],i=f[e];if(r&&r!==n&&"both"!==r)delete f[e];else if(EG(i)){const{condition:t,...n}=i,r=K(t),o=FG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((t=>{const{test:n,...e}=t;return{test:oK(null,n),...e}})),n];aK(f,i,t,a),delete f[e]}else if(null===o){const t={signal:r.map((t=>{const{test:n,...e}=t;return`${oK(null,n)} ? ${Sq(e)} : `})).join("")+Sq(n)};f[e]=t}}else if(gq(i)){const t=FG[e];if(t){const{vgProp:n,part:r}=t;aK(f,r,n,i),delete f[e]}}fR(["labelAlign","labelBaseline"],e)&&null===f[e]&&delete f[e]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:t}=f.encode;f.encode={...t?{grid:t}:{}},wR(f.encode)&&delete f.encode}return{scale:a,orient:o,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:PR(c,0)}}{if(!r.header&&t.mainExtracted)return;if(void 0!==u){let t=u;f.encode?.labels?.update&&gq(f.encode.labels.update.text)&&(t=zR(u,"datum.label",f.encode.labels.update.text.signal)),aK(f,"labels","text",{signal:t})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const n of NG)t.hasAxisPart(n)||delete f.encode[n];wR(f.encode)&&delete f.encode}const n=function(t,n){if(t)return D(t)&&!pq(t)?t.map((t=>pG(t,n))).join(", "):t}(s,e);return{scale:a,orient:o,grid:!1,...n?{title:n}:{},...f,...!1===e.aria?{aria:!1}:{},zindex:PR(c,0)}}}}function sK(t){const{axes:n}=t.component,e=[];for(const r of AI)if(n[r])for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const n="x"===r?"height":"width",i=t.getSizeSignalRef(n).signal;n!==i&&e.push({name:n,update:i})}return e}function cK(t,n,e,r){return Object.assign.apply(null,[{},...t.map((t=>{if("axisOrient"===t){const t="x"===e?"bottom":"left",i=n["x"===e?"axisBottom":"axisLeft"]||{},o=n["x"===e?"axisTop":"axisRight"]||{},a=new Set([...xR(i),...xR(o)]),u={};for(const n of a.values())u[n]={signal:`${r.signal} === "${t}" ? ${Fq(i[n])} : ${Fq(o[n])}`};return u}return n[t]}))])}function fK(t,n){const e=[{}];for(const r of t){let t=n[r]?.style;if(t){t=K(t);for(const r of t)e.push(n.style[r])}}return Object.assign.apply(null,e)}function lK(t,n,e,r={}){const i=zq(t,e,n);if(void 0!==i)return{configFrom:"style",configValue:i};for(const n of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==r[n]?.[t])return{configFrom:n,configValue:r[n][t]};return{}}const hK={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(t,n){return!wW(t)&&VH(n)&&!uq(n?.bin)&&!sq(n?.bin)}(e,t),gridScale:({model:t,channel:n})=>function(t,n){const e="x"===n?"y":"x";if(t.getScaleComponent(e))return t.scaleName(e)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||pK(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||mK(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(t,n){if("x"===n&&fR(["quantitative","temporal"],t))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(t,n,e,r){if(e&&!S(r)||"nominal"!==t&&"ordinal"!==t)return"log"!==n&&"symlog"!==n||"greedy"}(n.type,e,VH(n)&&!!n.timeUnit,VH(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const o="x"===t?"width":"y"===t?"height":void 0,a=o?n.getSizeSignalRef(o):void 0;return e.tickCount??function({fieldOrDatumDef:t,scaleType:n,size:e,values:r}){if(!r&&!wW(n)&&"log"!==n){if(VH(t)){if(uq(t.bin))return{signal:`ceil(${e.signal}/10)`};if(t.timeUnit&&fR(["month","hours","day","quarter"],TU(t.timeUnit)?.unit))return}return{signal:`ceil(${e.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:a,values:e.values})},tickMinStep:function({format:t,fieldOrDatumDef:n}){if("d"===t)return 1;if(VH(n)){const{timeUnit:t}=n;if(t){const n=PU(t);if(n)return{signal:n}}}},title:({axis:t,model:n,channel:e})=>{if(void 0!==t.title)return t.title;const r=gK(n,e);if(void 0!==r)return r;const i=n.typedFieldDef(e),o=n.fieldDef("x"===e?"x2":"y2");return Tq(i?[RH(i)]:[],VH(o)?[RH(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(t,n){const e=t.values;return D(e)?DG(n,e):gq(e)?e:void 0}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(t,n){return"rect"===t&&cG(n)?1:0}(e,n)};function dK(t){return`(((${t.signal} % 360) + 360) % 360)`}function mK(t,n,e,r){if(void 0!==t){if("x"===e){if(gq(t)){const e=dK(t);return{signal:`(45 < ${e} && ${e} < 135) || (225 < ${e} && ${e} < 315) ? "middle" :(${e} <= 45 || 315 <= ${e}) === ${gq(n)?`(${n.signal} === "top")`:"top"===n} ? "bottom" : "top"`}}return 45<t&&t<135||225<t&&t<315?"middle":gq(n)?{signal:`${n.signal} ${t<=45||315<=t?"===":"!=="} "top" ? "bottom" : "top"`}:(t<=45||315<=t)==("top"===n)?"bottom":"top"}if(gq(t)){const e=dK(t);return{signal:`${e} <= 45 || 315 <= ${e} || (135 <= ${e} && ${e} <= 225) ? ${r?'"middle"':"null"} : (45 <= ${e} && ${e} <= 135) === ${gq(n)?`(${n.signal} === "left")`:"left"===n} ? "top" : "bottom"`}}return t<=45||315<=t||135<=t&&t<=225?r?"middle":null:gq(n)?{signal:`${n.signal} ${45<=t&&t<=135?"===":"!=="} "left" ? "top" : "bottom"`}:(45<=t&&t<=135)==("left"===n)?"top":"bottom"}}function pK(t,n,e){if(void 0===t)return;const r="x"===e,i=r?0:90,o=r?"bottom":"left";if(gq(t)){const e=dK(t);return{signal:`(${i?`(${e} + 90)`:e} % 180 === 0) ? ${r?null:'"center"'} :(${i} < ${e} && ${e} < ${180+i}) === ${gq(n)?`(${n.signal} === "${o}")`:n===o} ? "left" : "right"`}}return(t+i)%180==0?r?null:"center":gq(n)?{signal:`${n.signal} ${i<t&&t<180+i?"===":"!=="} "${o}" ? "left" : "right"`}:(i<t&&t<180+i)==(n===o)?"left":"right"}function gK(t,n){const e="x"===n?"x2":"y2",r=t.fieldDef(n),i=t.fieldDef(e),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?Pq(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class vK extends mX{clone(){return new vK(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this._dependentFields=nK(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef(((n,e)=>{if(rG(n)&&BH(n.sort)){const{field:r,timeUnit:i}=n,o=n.sort,a=o.map(((t,n)=>`${XU({field:r,timeUnit:i,equal:t})} ? ${n} : `)).join("")+o.length;t=new vK(t,{calculate:a,as:yK(n,e,{forAs:!0})})}})),t}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 ${sR(this.transform)}`}}function yK(t,n,e){return sG(t,{prefix:n,suffix:"sort_index",...e})}function bK(t,n){return fR(["top","bottom"],n)?"column":fR(["left","right"],n)||"row"===t?"row":"column"}function wK(t,n,e,r){return PR((n||{})[t],("row"===r?e.headerRow:"column"===r?e.headerColumn:e.headerFacet)[t],e.header[t])}function xK(t,n,e,r){const i={};for(const o of t){const t=wK(o,n||{},e,r);void 0!==t&&(i[o]=t)}return i}const $K=["row","column"],kK=["header","footer"];function MK(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=xK(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),s=bK(n,u),c=qR(a);return{name:`${n}-title`,type:"group",role:`${s}-title`,title:{text:e,..."row"===n?{orient:"left"}:{},style:"guide-title",...DK(c,s),...AK(s,c,o),..._K(r,i,n,yY,gY)}}}function AK(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=pK(n,"row"===t?"left":"top","row"===t?"y":"x");return r?{align:r}:{}}function DK(t,n){const e=mK(t,"row"===n?"left":"top","row"===n?"y":"x",!0);return e?{baseline:e}:{}}function SK(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of kK)if(e[i])for(const o of e[i]){const a=NK(t,n,i,e,o);null!=a&&r.push(a)}return r}function FK(t,n){const{sort:e}=t;return zH(e)?{field:sG(e,{expr:"datum"}),order:e.order??"ascending"}:D(e)?{field:yK(t,n,{expr:"datum"}),order:"ascending"}:{field:sG(t,{expr:"datum"}),order:e??"ascending"}}function EK(t,n,e){const{format:r,formatType:i,labelAngle:o,labelAnchor:a,labelOrient:u,labelExpr:s}=xK(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),c=$H({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,f=bK(n,u);return{text:{signal:s?zR(zR(s,"datum.label",c),"datum.value",sG(t,{expr:"parent"})):c},..."row"===n?{orient:"left"}:{},style:"guide-label",frame:"group",...DK(o,f),...AK(f,o,a),..._K(e,t,n,bY,vY)}}function NK(t,n,e,r,i){if(i){let o=null;const{facetFieldDef:a}=r,u=t.config?t.config:void 0;if(a&&i.labels){const{labelOrient:t}=xK(["labelOrient"],a.header,u,n);("row"===n&&!fR(["top","bottom"],t)||"column"===n&&!fR(["left","right"],t))&&(o=EK(a,n,u))}const s=FZ(t)&&!TH(t.facet),c=i.axes,f=c?.length>0;if(o||f){const u="row"===n?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:FK(a,n)}:{},...f&&s?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...o?{title:o}:{},...i.sizeSignal?{encode:{update:{[u]:i.sizeSignal}}}:{},...f?{axes:c}:{}}}}return null}const CK={column:{start:0,end:1},row:{start:1,end:0}};function OK(t,n){return CK[n][t]}function _K(t,n,e,r,i){const o={};for(const a of r){if(!i[a])continue;const r=wK(a,n?.header,t,e);void 0!==r&&(o[i[a]]=r)}return o}function zK(t){return[...BK(t,"width"),...BK(t,"height"),...BK(t,"childWidth"),...BK(t,"childHeight")]}function BK(t,n){const e="width"===n?"x":"y",r=t.component.layoutSize.get(n);if(!r||"merged"===r)return[];const i=t.getSizeSignalRef(n).signal;if("step"===r){const n=t.getScaleComponent(e);if(n){const r=n.get("type"),o=n.get("range");if(wW(r)&&vq(o)){const r=t.scaleName(e);return FZ(t.parent)&&"independent"===t.parent.component.resolve.scale[e]?[TK(r,o)]:[TK(r,o),{name:i,update:PK(r,n,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const n=i.endsWith("width"),e=n?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${e}) ? ${e} : ${BY(t.config.view,n?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function TK(t,n){const e=`${t}_step`;return gq(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function PK(t,n,e){const r=n.get("type"),i=n.get("padding"),o=PR(n.get("paddingOuter"),i);let a=n.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${e}, ${Fq(a)}, ${Fq(o)}) * ${t}_step`}function jK(t){return"childWidth"===t?"width":"childHeight"===t?"height":t}function RK(t,n){return xR(t).reduce(((e,r)=>({...e,...KX({model:n,channelDef:t[r],vgChannel:r,mainRefFn:t=>Aq(t.value),invalidValueRef:void 0})})),{})}function LK(t,n){if(FZ(n))return"theta"===t?"independent":"shared";if(NZ(n))return"shared";if(EZ(n))return DI(t)||"theta"===t||"radius"===t?"independent":"shared";throw new Error("invalid model type for resolve")}function IK(t,n){const e=t.scale[n],r=DI(n)?"axis":"legend";return"independent"===e?("shared"===t[r][n]&&yU(function(t){return`Setting the scale to be independent for "${t}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const qK=xR({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 UK extends QV{}const WK={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:u,config:s,mark:c}=e,f=a.filled&&"trail"!==c;let l={...Eq({},e,tH),...uJ(e,{filled:f})};const h=i.get("symbolOpacity")??s.legend.symbolOpacity,d=i.get("symbolFillColor")??s.legend.symbolFillColor,m=i.get("symbolStrokeColor")??s.legend.symbolStrokeColor,p=void 0===h?HK(u.opacity)??a.opacity:void 0;if(l.fill)if("fill"===r||f&&r===hL)delete l.fill;else if(YR(l.fill,"field"))d?delete l.fill:(l.fill=Aq(s.legend.symbolBaseFillColor??"black"),l.fillOpacity=Aq(p??1));else if(D(l.fill)){const t=GK(u.fill??u.color)??a.fill??(f&&a.color);t&&(l.fill=Aq(t))}if(l.stroke)if("stroke"===r||!f&&r===hL)delete l.stroke;else if(YR(l.stroke,"field")||m)delete l.stroke;else if(D(l.stroke)){const t=PR(GK(u.stroke||u.color),a.stroke,f?a.color:void 0);t&&(l.stroke={value:t})}if(r!==yL){const t=VH(n)&&VK(0,i,n);t?l.opacity=[{test:t,...Aq(p??1)},Aq(s.legend.unselectedOpacity)]:p&&(l.opacity=Aq(p))}return l={...l,...t},wR(l)?void 0:l},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if("gradient"!==e)return;const{config:i,markDef:o,encoding:a}=n;let u={};const s=void 0===(r.get("gradientOpacity")??i.legend.gradientOpacity)?HK(a.opacity)||o.opacity:void 0;return s&&(u.opacity=Aq(s)),u={...u,...t},wR(u)?void 0:u},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const o=e.legend(r)||{},a=e.config,u=VH(n)?VK(0,i,n):void 0,s=u?[{test:u,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:c,formatType:f}=o;let l;wH(f)?l=MH({fieldOrDatumDef:n,field:"datum.value",format:c,formatType:f,config:a}):void 0===c&&void 0===f&&a.customFormatTypes&&("quantitative"===n.type&&a.numberFormatType?l=MH({fieldOrDatumDef:n,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===n.type&&a.timeFormatType&&VH(n)&&void 0===n.timeUnit&&(l=MH({fieldOrDatumDef:n,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const h={...s?{opacity:s}:{},...l?{text:l}:{},...t};return wR(h)?void 0:h},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e?.length?{...t,fill:{value:"transparent"}}:t}};function HK(t){return YK(t,((t,n)=>Math.max(t,n.value)))}function GK(t){return YK(t,((t,n)=>PR(t,n.value)))}function YK(t,n){return function(t){const n=t?.condition;return!!n&&(D(n)||eG(n))}(t)?K(t.condition).reduce(n,t.value):eG(t)?t.value:void 0}function VK(t,n,e){const r=n.get("selections");if(!r?.length)return;const i=Et(e.field);return r.map((t=>`(!length(data(${Et(AR(t)+WJ)})) || (${t}[${i}] && indexof(${t}[${i}], datum.value) >= 0))`)).join(" || ")}const XK={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return AH(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return DH(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:t,model:n,direction:e,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if($W(i))return"horizontal"===e?"top"===r||"bottom"===r?KK(n,"width",a,o):a:KK(n,"height",s,u)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(t){if(fR(["quantile","threshold","log","symlog"],t))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(t,n,e,r){if("shape"!==n){const t=GK(e)??r;if(t)return t}switch(t){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"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>dG(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(jL(e)&&$W(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(t,n){const e=t.values;return D(e)?DG(n,e):gq(e)?e:void 0}(n,t)};function JK({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(t,n){switch(t){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===n?"horizontal":void 0}}(e,n)}function KK(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function QK(t){const n=SZ(t)?function(t){const{encoding:n}=t,e={};for(const r of[hL,...xY]){const i=yG(n[r]);i&&t.getScaleComponent(r)&&(r===pL&&VH(i)&&i.type===iW||(e[r]=tQ(t,r)))}return e}(t):function(t){const{legends:n,resolve:e}=t.component;for(const r of t.children){QK(r);for(const i of xR(r.component.legends))e.legend[i]=IK(t.component.resolve,i),"shared"===e.legend[i]&&(n[i]=nQ(n[i],r.component.legends[i]),n[i]||(e.legend[i]="independent",delete n[i]))}for(const r of xR(n))for(const n of t.children)n.component.legends[r]&&"shared"===e.legend[r]&&delete n.component.legends[r];return n}(t);return t.component.legends=n,n}function ZK(t,n,e,r){switch(n){case"disable":return void 0!==e;case"values":return!!e?.values;case"title":if("title"===n&&t===r?.title)return!0}return t===(e||{})[n]}function tQ(t,n){let e=t.legend(n);const{markDef:r,encoding:i,config:o}=t,a=o.legend,u=new UK({},function(t,n){const e=t.scaleName(n);if("trail"===t.mark){if("color"===n)return{stroke:e};if("size"===n)return{strokeWidth:e}}return"color"===n?t.markDef.filled?{fill:e}:{stroke:e}:{[n]:e}}(t,n));!function(t,n,e){const r=t.fieldDef(n)?.field;for(const i of $R(t.component.selection??{})){const t=i.project.hasField[r]??i.project.hasChannel[n];if(t&&BJ.defined(i)){const n=e.get("selections")??[];n.push(i.name),e.set("selections",n,!1),t.hasLegend=!0}}}(t,n,u);const s=void 0!==e?!e:a.disable;if(u.set("disable",s,void 0!==e),s)return u;e=e||{};const c=t.getScaleComponent(n).get("type"),f=yG(i[n]),l=VH(f)?TU(f.timeUnit)?.unit:void 0,h=e.orient||o.legend.orient||"right",d=function(t){const{legend:n}=t;return PR(n.type,function({channel:t,timeUnit:n,scaleType:e}){if(jL(t)){if(fR(["quarter","month","day"],n))return"symbol";if($W(e))return"gradient"}return"symbol"}(t))}({legend:e,channel:n,timeUnit:l,scaleType:c}),m={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:f,legendConfig:a,config:o,scaleType:c,orient:h,legendType:d,direction:JK({legend:e,legendType:d,orient:h,legendConfig:a})};for(const r of qK){if("gradient"===d&&r.startsWith("symbol")||"symbol"===d&&r.startsWith("gradient"))continue;const i=r in XK?XK[r](m):e[r];if(void 0!==i){const a=ZK(i,r,e,t.fieldDef(n));(a||void 0===o.legend[r])&&u.set(r,i,a)}}const p=e?.encoding??{},g=u.get("selections"),v={},y={fieldOrDatumDef:f,model:t,channel:n,legendCmpt:u,legendType:d};for(const n of["labels","legend","title","symbols","gradient","entries"]){const e=RK(p[n]??{},t),r=n in WK?WK[n](e,y):e;void 0===r||wR(r)||(v[n]={...g?.length&&VH(f)?{name:`${AR(f.field)}_legend_${n}`}:{},...g?.length?{interactive:!!g}:{},update:r})}return wR(v)||u.set("encode",v,!!e?.encoding),u}function nQ(t,n){if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const e of qK){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"legend",((t,n)=>{switch(e){case"symbolType":return r=t,"circle"===(o=n).value?o:r;case"title":return jq(t,n);case"type":return i=!0,tX("symbol")}var r,o;return eX(t,n,e,"legend")}));t.setWithExplicit(e,r)}return i&&(t.implicit?.encode?.gradient&&SR(t.implicit,["encode","gradient"]),t.explicit?.encode?.gradient&&SR(t.explicit,["encode","gradient"])),t}function eQ(t){const n=t.component.legends,e={};for(const r of xR(n)){const i=GR(t.getScaleComponent(r).get("domains"));if(e[i])for(const t of e[i])nQ(t,n[r])||e[i].push(n[r]);else e[i]=[n[r].clone()]}const r=$R(e).flat().map((n=>function(t,n){const{disable:e,labelExpr:r,selections:i,...o}=t.combine();if(!e){if(!1===n.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const t=o.encode.symbols.update;!t.fill||"transparent"===t.fill.value||t.stroke||o.stroke||(t.stroke={value:"transparent"});for(const n of xY)o[n]&&delete t[n]}if(o.title||delete o.title,void 0!==r){let t=r;o.encode?.labels?.update&&gq(o.encode.labels.update.text)&&(t=zR(r,"datum.label",o.encode.labels.update.text.signal)),function(t,n,e,r){var i,o;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(o=t.encode[n]).update??(o.update={}),t.encode[n].update.text=r}(o,"labels",0,{signal:t})}return o}}(n,t.config))).filter((t=>void 0!==t));return r}function rQ(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map((t=>t.signal)).join(", ")}]`},o=n.data.reduce(((n,e)=>{const r=gq(e)?e.signal:`data('${t.lookupDataSource(e)}')`;return fR(n,r)||n.push(r),n}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const iQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class oQ extends QV{constructor(t,n,e,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=e,this.data=r,this.merged=!1}get isFit(){return!!this.data}}function aQ(t){t.component.projection=SZ(t)?function(t){if(t.hasProjection){const n=dq(t.specifiedProjection),e=!(n&&(null!=n.scale||null!=n.translate)),r=e?[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]:void 0,i=e?function(t){const n=[],{encoding:e}=t;for(const r of[[sL,uL],[fL,cL]])(yG(e[r[0]])||yG(e[r[1]]))&&n.push({signal:t.getName(`geojson_${n.length}`)});return t.channelHasField(pL)&&t.typedFieldDef(pL).type===iW&&n.push({signal:t.getName(`geojson_${n.length}`)}),0===n.length&&n.push(t.requestDataName(hX.Main)),n}(t):void 0,o=new oQ(t.projectionName(!0),{...dq(t.config.projection),...n},r,i);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(t){if(0===t.children.length)return;let n;for(const n of t.children)aQ(n);const e=hR(t.children,(t=>{const e=t.component.projection;if(e){if(n){const t=function(t,n){const e=hR(iQ,(e=>!ft(t.explicit,e)&&!ft(n.explicit,e)||!!(ft(t.explicit,e)&&ft(n.explicit,e)&&HR(t.get(e),n.get(e)))));if(HR(t.size,n.size)){if(e)return t;if(HR(t.explicit,{}))return n;if(HR(n.explicit,{}))return t}return null}(n,e);return t&&(n=t),!!t}return n=e,!0}return!0}));if(n&&e){const e=t.projectionName(!0),r=new oQ(e,n.specifiedProjection,n.size,iR(n.data));for(const n of t.children){const t=n.component.projection;t&&(t.isFit&&r.data.push(...n.component.projection.data),n.renameProjection(t.get("name"),e),t.merged=!0)}return r}}(t)}function uQ(t,n,e,r){if(SG(n,e)){const i=SZ(t)?t.axis(e)??t.legend(e)??{}:{},o=sG(n,{expr:"datum"}),a=sG(n,{expr:"datum",binSuffix:"end"});return{formulaAs:sG(n,{binSuffix:"range",forAs:!0}),formula:NH(o,a,i.format,i.formatType,r)}}return{}}function sQ(t,n){return`${aq(t)}_${n}`}function cQ(t,n,e){const r=sQ($G(e,void 0)??{},n);return t.getName(`${r}_bins`)}function fQ(t,n,e){let r,i;r=function(t){return"as"in t}(t)?xt(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[sG(t,{forAs:!0}),sG(t,{binSuffix:"end",forAs:!0})];const o={...$G(n,void 0)},a=sQ(o,t.field),{signal:u,extentSignal:s}=function(t,n){return{signal:t.getName(`${n}_bins`),extentSignal:t.getName(`${n}_extent`)}}(e,a);if(fq(o.extent)){const t=o.extent;i=iK(e,t.param,t),delete o.extent}return{key:a,binComponent:{bin:o,field:t.field,as:[r],...u?{signal:u}:{},...s?{extentSignal:s}:{},...i?{span:i}:{}}}}class lQ extends mX{clone(){return new lQ(null,iR(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{if(nG(e)&&uq(e.bin)){const{key:i,binComponent:o}=fQ(e,e.bin,n);t[i]={...o,...t[i],...uQ(n,e,r,n.config)}}return t}),{});return wR(e)?null:new lQ(t,e)}static makeFromTransform(t,n,e){const{key:r,binComponent:i}=fQ(n,n.bin,e);return new lQ(t,{[r]:i})}merge(t,n){for(const e of xR(t.bins))e in this.bins?(n(t.bins[e].signal,this.bins[e].signal),this.bins[e].as=pR([...this.bins[e].as,...t.bins[e].as],sR)):this.bins[e]=t.bins[e];for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}producedFields(){return new Set($R(this.bins).map((t=>t.as)).flat(2))}dependentFields(){return new Set($R(this.bins).map((t=>t.field)))}hash(){return`Bin ${sR(this.bins)}`}assemble(){return $R(this.bins).flatMap((t=>{const n=[],[e,...r]=t.as,{extent:i,...o}=t.bin,a={type:"bin",field:_R(t.field),as:e,signal:t.signal,...fq(i)?{extent:null}:{extent:i},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!i&&t.extentSignal&&(n.push({type:"extent",field:_R(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const t of r)for(let r=0;r<2;r++)n.push({type:"formula",expr:sG({field:e[r]},{expr:"datum"}),as:t[r]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n}))}}class hQ extends mX{clone(){return new hQ(null,new Set(this.dimensions),iR(this.measures))}constructor(t,n,e){super(t),this.dimensions=n,this.measures=e}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let e=!1;n.forEachFieldDef((t=>{t.aggregate&&(e=!0)}));const r={},i=new Set;return e?(n.forEachFieldDef(((t,e)=>{const{aggregate:o,field:a}=t;if(o)if("count"===o)r["*"]??(r["*"]={}),r["*"].count=new Set([sG(t,{forAs:!0})]);else{if(ZI(o)||tq(o)){const t=ZI(o)?"argmin":"argmax",n=o[t];r[n]??(r[n]={}),r[n][t]=new Set([sG({op:t,field:n},{forAs:!0})])}else r[a]??(r[a]={}),r[a][o]=new Set([sG(t,{forAs:!0})]);GI(e)&&"unaggregated"===n.scaleDomain(e)&&(r[a]??(r[a]={}),r[a].min=new Set([sG({field:a,aggregate:"min"},{forAs:!0})]),r[a].max=new Set([sG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(t,n,e,r){const i=SZ(r)?r.encoding[eI(n)]:void 0;if(nG(e)&&SZ(r)&&UH(e,i,r.markDef,r.config)){t.add(sG(e,{})),t.add(sG(e,{suffix:"end"}));const{mark:i,markDef:o,config:a}=r,u=IH({fieldDef:e,markDef:o,config:a});KW(i)&&.5!==u&&DI(n)&&(t.add(sG(e,{suffix:bX})),t.add(sG(e,{suffix:wX}))),e.bin&&SG(e,n)&&t.add(sG(e,{binSuffix:"range"}))}else if(BL(n)){const e=zL(n);t.add(r.getName(e))}else t.add(sG(e));rG(e)&&function(t){return S(t)&&"field"in t}(e.scale?.range)&&t.add(e.scale.range.field)}(i,e,t,n)})),i.size+xR(r).length===0?null:new hQ(t,i,r)):null}static makeFromTransform(t,n){var e;const r=new Set,i={};for(const t of n.aggregate){const{op:n,field:r,as:o}=t;n&&("count"===n?(i["*"]??(i["*"]={}),i["*"].count=new Set([o||sG(t,{forAs:!0})])):(i[r]??(i[r]={}),(e=i[r])[n]??(e[n]=new Set),i[r][n].add(o||sG(t,{forAs:!0}))))}for(const t of n.groupby??[])r.add(t);return r.size+xR(i).length===0?null:new hQ(t,r,i)}merge(t){return gR(this.dimensions,t.dimensions)?(function(t,n){for(const e of xR(n)){const r=n[e];for(const n of xR(r))e in t?t[e][n]=new Set([...t[e][n]??[],...r[n]]):t[e]={[n]:r[n]}}}(this.measures,t.measures),!0):(gU.debug("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...xR(this.measures)])}producedFields(){const t=new Set;for(const n of xR(this.measures))for(const e of xR(this.measures[n])){const r=this.measures[n][e];0===r.size?t.add(`${e}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${sR({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],e=[];for(const r of xR(this.measures))for(const i of xR(this.measures[r]))for(const o of this.measures[r][i])e.push(o),t.push(i),n.push("*"===r?null:_R(r));return{type:"aggregate",groupby:[...this.dimensions].map(_R),ops:t,fields:n,as:e}}}class dQ extends mX{constructor(t,n,e,r){super(t),this.model=n,this.name=e,this.data=r;for(const t of LL){const e=n.facet[t];if(e){const{bin:r,sort:i}=e;this[t]={name:n.getName(`${t}_domain`),fields:[sG(e),...uq(r)?[sG(e,{binSuffix:"end"})]:[]],...zH(i)?{sortField:i}:D(i)?{sortIndexField:yK(e,t)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of LL)this[n]&&(t+=` ${n.charAt(0)}:${sR(this[n])}`);return t}get fields(){const t=[];for(const n of LL)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of LL)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of AI){const e=this.childModel.component.scales[n];if(e&&!e.merged){const r=e.get("type"),i=e.get("range");if(wW(r)&&vq(i)){const e=iZ(oZ(this.childModel,n));e?t[n]=e:yU(Uq(n))}}}return t}assembleRowColumnHeaderData(t,n,e){const r={row:"y",column:"x",facet:void 0}[t],i=[],o=[],a=[];r&&e&&e[r]&&(n?(i.push(`distinct_${e[r]}`),o.push("max")):(i.push(e[r]),o.push("distinct")),a.push(`distinct_${e[r]}`));const{sortField:u,sortIndexField:s}=this[t];if(u){const{op:t=CH,field:n}=u;i.push(n),o.push(t),a.push(sG(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...i.length?{fields:i,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:e}=this.model.component,r=[],i={};for(const t of $K){for(const n of kK){const r=(e[t]&&e[t][n])??[];for(const n of r)if(n.axes?.length>0){i[t]=!0;break}}if(i[t]){const e=`length(data("${this.facet.name}"))`;r.push({name:`${this.facet.name}_${t}`,transform:[{type:"sequence",start:0,stop:"row"===t?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e}}]})}}const{row:o,column:a}=i;return(o||a)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const e=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:o}=this;if(r&&i&&(e.x||e.y)){n=`cross_${this.column.name}_${this.row.name}`;const r=[].concat(e.x??[],e.y??[]),i=r.map((()=>"distinct"));t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:r,ops:i}]})}for(const r of[XR,VR])this[r]&&t.push(this.assembleRowColumnHeaderData(r,n,e));if(o){const n=this.assembleFacetHeaderData(e);n&&t.push(...n)}return t}}function mQ(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function pQ(t){const n={};return eR(t.filter,(t=>{if(YU(t)){let e=null;LU(t)?e=kq(t.equal):qU(t)?e=kq(t.lte):IU(t)?e=kq(t.lt):UU(t)?e=kq(t.gt):WU(t)?e=kq(t.gte):HU(t)?e=t.range[0]:GU(t)&&(e=(t.oneOf??t.in)[0]),e&&(bU(e)?n[t.field]="date":bt(e)?n[t.field]="number":xt(e)&&(n[t.field]="string")),t.timeUnit&&(n[t.field]="date")}})),n}class gQ extends mX{clone(){return new gQ(null,iR(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${sR(this._parse)}`}static makeExplicit(t,n,e){let r={};const i=n.data;return!sX(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(t,r,{},e)}static makeWithAncestors(t,n,e,r){for(const t of xR(e)){const n=r.getWithExplicit(t);void 0!==n.value&&(n.explicit||n.value===e[t]||"derived"===n.value||"flatten"===e[t]?delete e[t]:yU(Xq(t,e[t],n.value)))}for(const t of xR(n)){const e=r.get(t);void 0!==e&&(e===n[t]?delete n[t]:yU(Xq(t,n[t],e)))}const i=new QV(n,e);r.copyAll(i);const o={};for(const t of xR(i.combine())){const n=i.get(t);null!==n&&(o[t]=n)}return 0===xR(o).length||r.parseNothing?null:new gQ(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of xR(this._parse)){const e=this._parse[n];1===TR(n)&&(t[n]=e)}return t}producedFields(){return new Set(xR(this._parse))}dependentFields(){return new Set(xR(this._parse))}assembleTransforms(t=!1){return xR(this._parse).filter((n=>!t||TR(n)>1)).map((t=>{const n=function(t,n){const e=ER(t);return"number"===n?`toNumber(${e})`:"boolean"===n?`toBoolean(${e})`:"string"===n?`toString(${e})`:"date"===n?`toDate(${e})`:"flatten"===n?e:n.startsWith("date:")?`timeParse(${e},'${mQ(n.slice(5,n.length))}')`:n.startsWith("utc:")?`utcParse(${e},'${mQ(n.slice(4,n.length))}')`:(yU(`Unrecognized parse "${n}".`),null)}(t,this._parse[t]);return n?{type:"formula",expr:n,as:BR(t)}:null})).filter((t=>null!==t))}}class vQ extends mX{clone(){return new vQ(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([$Y])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:$Y}}}class yQ extends mX{clone(){return new yQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${sR(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class bQ extends mX{clone(){return new bQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${sR(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class wQ extends mX{constructor(t){let n;if(super(null),t??(t={name:"source"}),sX(t)||(n=t.format?{...uR(t.format,["parse"])}:{}),aX(t))this._data={values:t.values};else if(oX(t)){if(this._data={url:t.url},!n.type){let e=/(?:\.([^.]+))?$/.exec(t.url)[1];fR(["json","csv","tsv","dsv","topojson"],e)||(e="json"),n.type=e}}else fX(t)?this._data={values:[{type:"Sphere"}]}:(uX(t)||sX(t))&&(this._data={});this._generator=sX(t),t.name&&(this._name=t.name),n&&!wR(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(t){this._name=t}set parent(t){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:[]}}}var xQ,$Q=function(t,n,e,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?t!==n||!i:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,e):i?i.value=e:n.set(t,e),e};function kQ(t){return t instanceof wQ||t instanceof yQ||t instanceof bQ}class MQ{constructor(){xQ.set(this,void 0),$Q(this,xQ,!1,"f")}setModified(){$Q(this,xQ,!0,"f")}get modifiedFlag(){return function(t,n,e,r){if("a"===e&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?t!==n||!r:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?r:"a"===e?r.call(t):r?r.value:n.get(t)}(this,xQ,"f")}}xQ=new WeakMap;class AQ extends MQ{getNodeDepths(t,n,e){e.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,e);return e}optimize(t){const n=[...this.getNodeDepths(t,0,new Map).entries()].sort(((t,n)=>n[1]-t[1]));for(const t of n)this.run(t[0]);return this.modifiedFlag}}class DQ extends MQ{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class SQ extends DQ{mergeNodes(t,n){const e=n.shift();for(const r of n)t.removeChild(r),r.parent=e,r.remove()}run(t){const n=t.children.map((t=>t.hash())),e={};for(let r=0;r<n.length;r++)void 0===e[n[r]]?e[n[r]]=[t.children[r]]:e[n[r]].push(t.children[r]);for(const n of xR(e))e[n].length>1&&(this.setModified(),this.mergeNodes(t,e[n]))}}class FQ extends DQ{constructor(t){super(),this.requiresSelectionId=t&&JJ(t)}run(t){t instanceof vQ&&(this.requiresSelectionId&&(kQ(t.parent)||t.parent instanceof hQ||t.parent instanceof gQ)||(this.setModified(),t.remove()))}}class EQ extends MQ{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let e=new Set;t instanceof yX&&(e=t.producedFields(),vR(e,n)&&(this.setModified(),t.removeFormulas(n),0===t.producedFields.length&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...e]))}}class NQ extends DQ{constructor(){super()}run(t){t instanceof pX&&!t.isRequired()&&(this.setModified(),t.remove())}}class CQ extends AQ{run(t){if(!(kQ(t)||t.numChildren()>1))for(const n of t.children)if(n instanceof gQ)if(t instanceof gQ)this.setModified(),t.merge(n);else{if(bR(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}class OQ extends AQ{run(t){const n=[...t.children],e=t.children.filter((t=>t instanceof gQ));if(t.numChildren()>1&&e.length>=1){const r={},i=new Set;for(const t of e){const n=t.parse;for(const t of xR(n))t in r?r[t]!==n[t]&&i.add(t):r[t]=n[t]}for(const t of i)delete r[t];if(!wR(r)){this.setModified();const e=new gQ(t,r);for(const i of n){if(i instanceof gQ)for(const t of xR(r))delete i.parse[t];t.removeChild(i),i.parent=e,i instanceof gQ&&0===xR(i.parse).length&&i.remove()}}}}}class _Q extends AQ{run(t){t instanceof pX||t.numChildren()>0||t instanceof dQ||t instanceof wQ||(this.setModified(),t.remove())}}class zQ extends AQ{run(t){const n=t.children.filter((t=>t instanceof yX)),e=n.pop();for(const t of n)this.setModified(),e.merge(t)}}class BQ extends AQ{run(t){const n=t.children.filter((t=>t instanceof hQ)),e={};for(const t of n){const n=sR(t.groupBy);n in e||(e[n]=[]),e[n].push(t)}for(const n of xR(e)){const r=e[n];if(r.length>1){const n=r.pop();for(const e of r)n.merge(e)&&(t.removeChild(e),e.parent=n,e.remove(),this.setModified())}}}}class TQ extends AQ{constructor(t){super(),this.model=t}run(t){const n=!(kQ(t)||t instanceof eK||t instanceof gQ||t instanceof vQ),e=[],r=[];for(const i of t.children)i instanceof lQ&&(n&&!bR(t.producedFields(),i.dependentFields())?e.push(i):r.push(i));if(e.length>0){const n=e.pop();for(const t of e)n.merge(t,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof lQ?t.merge(n,this.model.renameSignal.bind(this.model)):n.swapWithParent()}if(r.length>1){const t=r.pop();for(const n of r)t.merge(n,this.model.renameSignal.bind(this.model));this.setModified()}}}class PQ extends AQ{run(t){const n=[...t.children];if(!lR(n,(t=>t instanceof pX))||t.numChildren()<=1)return;const e=[];let r;for(const i of n)if(i instanceof pX){let n=i;for(;1===n.numChildren();){const[t]=n.children;if(!(t instanceof pX))break;n=t}e.push(...n.children),r?(t.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setModified()):r=n}else e.push(i);if(e.length){this.setModified();for(const t of e)t.parent.removeChild(t),t.parent=r}}}class jQ extends mX{clone(){return new jQ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??sG(t)}hash(){return`JoinAggregateTransform ${sR(this.transform)}`}assemble(){const t=[],n=[],e=[];for(const r of this.transform.joinaggregate)n.push(r.op),e.push(this.getDefaultName(r)),t.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==r?{groupby:r}:{}}}}class RQ extends mX{clone(){return new RQ(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,e){const{config:r,markDef:i}=n,{marks:o,scales:a}=e;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const u=n.reduceFieldDef(((t,e,o)=>{const a=GI(o)&&n.getScaleComponent(o);if(a){const n=a.get("type"),{aggregate:u}=e,s=lH({scaleChannel:o,markDef:i,config:r,scaleType:n,isCountAggregate:rq(u)});"show"!==s&&"always-valid"!==s&&(t[e.field]=e)}return t}),{});return xR(u).length?new RQ(t,u):null}dependentFields(){return new Set(xR(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${sR(this.filter)}`}assemble(){const t=xR(this.filter).reduce(((t,n)=>{const e=this.filter[n],r=sG(e,{expr:"datum"});return null!==e&&("temporal"===e.type?t.push(`(isDate(${r}) || (${LQ(r)}))`):"quantitative"===e.type&&t.push(LQ(r))),t}),[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function LQ(t){return`isValid(${t}) && isFinite(+${t})`}class IQ extends mX{clone(){return new IQ(null,iR(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:e,groupby:r,as:i,offset:o="zero"}=n,a=[],u=[];if(void 0!==n.sort)for(const t of n.sort)a.push(t.field),u.push(PR(t.order,"ascending"));const s={field:a,order:u};let c;return c=function(t){return D(t)&&t.every((t=>xt(t)))&&t.length>1}(i)?i:xt(i)?[i,`${i}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new IQ(t,{dimensionFieldDefs:[],stackField:e,groupby:r,offset:o,sort:s,facetby:[],as:c})}static makeFromEncoding(t,n){const e=n.stack,{encoding:r}=n;if(!e)return null;const{groupbyChannels:i,fieldChannel:o,offset:a,impute:u}=e,s=i.map((t=>vG(r[t]))).filter((t=>!!t)),c=function(t){return t.stack.stackBy.reduce(((t,n)=>{const e=sG(n.fieldDef);return e&&t.push(e),t}),[])}(n),f=n.encoding.order;let l;if(D(f)||VH(f))l=Bq(f);else{const t=WH(f)?f.sort:"y"===o?"descending":"ascending";l=c.reduce(((n,e)=>(n.field.includes(e)||(n.field.push(e),n.order.push(t)),n)),{field:[],order:[]})}return new IQ(t,{dimensionFieldDefs:s,stackField:n.vgField(o),facetby:[],stackby:c,sort:l,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${sR(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:e}=this._stack;return t.length>0?t.map((t=>t.bin?n?[sG(t,{binSuffix:"mid"})]:[sG(t,{}),sG(t,{binSuffix:"end"})]:[sG(t)])).flat():e??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:e,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u)for(const o of e){const{bandPosition:e=.5,bin:a}=o;if(a){const n=sG(o,{expr:"datum"}),r=sG(o,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${LQ(n)} ? ${e}*${n}+${1-e}*${r} : ${n}`,as:sG(o,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...i,...n],key:sG(o,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:o,as:s,offset:a}),t}}class qQ extends mX{clone(){return new qQ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach((n=>t.add(n.field))),this.transform.window.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??sG(t)}hash(){return`WindowTransform ${sR(this.transform)}`}assemble(){const t=[],n=[],e=[],r=[];for(const i of this.transform.window)n.push(i.op),e.push(this.getDefaultName(i)),r.push(void 0===i.param?null:i.param),t.push(void 0===i.field?null:i.field);const i=this.transform.frame,o=this.transform.groupby;if(i&&null===i[0]&&null===i[1]&&n.every((t=>nq(t))))return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==o?{groupby:o}:{}};const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(t.order??"ascending");const s=this.transform.ignorePeers;return{type:"window",params:r,as:e,ops:n,fields:t,sort:{field:a,order:u},...void 0!==s?{ignorePeers:s}:{},...void 0!==o?{groupby:o}:{},...void 0!==i?{frame:i}:{}}}}function UQ(t){if(t instanceof dQ)if(1!==t.numChildren()||t.children[0]instanceof pX){const e=t.model.component.data.main;WQ(e);const r=(n=t,function t(e){if(!(e instanceof dQ)){const r=e.clone();if(r instanceof pX){const t=HQ+r.getSource();r.setSource(t),n.model.component.data.outputNodes[t]=r}else(r instanceof hQ||r instanceof IQ||r instanceof qQ||r instanceof jQ)&&r.addDimensions(n.fields);for(const n of e.children.flatMap(t))n.parent=r;return[r]}return e.children.flatMap(t)}),i=t.children.map(r).flat();for(const t of i)t.parent=e}else{const n=t.children[0];(n instanceof hQ||n instanceof IQ||n instanceof qQ||n instanceof jQ)&&n.addDimensions(t.fields),n.swapWithParent(),UQ(t)}else t.children.map(UQ);var n}function WQ(t){if(t instanceof pX&&t.type===hX.Main&&1===t.numChildren()){const n=t.children[0];n instanceof dQ||(n.swapWithParent(),WQ(t))}}const HQ="scale_";function GQ(t){for(const n of t){for(const t of n.children)if(t.parent!==n)return!1;if(!GQ(n.children))return!1}return!0}function YQ(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function VQ(t,n,e){let r=t.sources,i=!1;return i=YQ(new NQ,r)||i,i=YQ(new FQ(n),r)||i,r=r.filter((t=>t.numChildren()>0)),i=YQ(new _Q,r)||i,r=r.filter((t=>t.numChildren()>0)),e||(i=YQ(new CQ,r)||i,i=YQ(new TQ(n),r)||i,i=YQ(new EQ,r)||i,i=YQ(new OQ,r)||i,i=YQ(new BQ,r)||i,i=YQ(new zQ,r)||i,i=YQ(new SQ,r)||i,i=YQ(new PQ,r)||i),t.sources=r,i}class XQ{constructor(t){Object.defineProperty(this,"signal",{enumerable:!0,get:t})}static fromName(t,n){return new XQ((()=>t(n)))}}function JQ(t){SZ(t)?function(t){const n=t.component.scales;for(const e of xR(n)){const r=KQ(t,e);if(n[e].setWithExplicit("domains",r),nZ(t,e),t.component.data.isFaceted){let n=t;for(;!FZ(n)&&n.parent;)n=n.parent;if("shared"===n.component.resolve.scale[e])for(const t of r.value)yq(t)&&(t.data=HQ+t.data.replace(HQ,""))}}}(t):function(t){for(const n of t.children)JQ(n);const n=t.component.scales;for(const e of xR(n)){let r,i=null;for(const n of t.children){const t=n.component.scales[e];if(t){r=void 0===r?t.getWithExplicit("domains"):rX(r,t.getWithExplicit("domains"),"domains","scale",rZ);const n=t.get("selectionExtent");i&&n&&i.param!==n.param&&yU("The same selection must be used to override scale domains in a layered view."),i=n}}n[e].setWithExplicit("domains",r),i&&n[e].set("selectionExtent",i,!0)}}(t)}function KQ(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(t,n,e,r){if("unaggregated"===t){const{valid:t,reason:r}=eZ(n,e);if(!t)return void yU(r)}else if(void 0===t&&r.useUnaggregatedDomain){const{valid:t}=eZ(n,e);if(t)return"unaggregated"}return t}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),"x"===n&&yG(r.x2)?yG(r.x)?rX(ZQ(e,i,t,"x"),ZQ(e,i,t,"x2"),"domain","scale",rZ):ZQ(e,i,t,"x2"):"y"===n&&yG(r.y2)?yG(r.y)?rX(ZQ(e,i,t,"y"),ZQ(e,i,t,"y2"),"domain","scale",rZ):ZQ(e,i,t,"y2"):ZQ(e,i,t,n)}function QQ(t,n,e){const r=TU(e)?.unit;return"temporal"===n||r?function(t,n,e){return t.map((t=>({signal:`{data: ${AG(t,{timeUnit:e,type:n})}}`})))}(t,n,r):[t]}function ZQ(t,n,e,r){const{encoding:i,markDef:o,mark:a,config:u,stack:s}=e,c=yG(i[r]),{type:f}=c,l=c.timeUnit,h=function(t){const{marks:n,scales:e}=dX(t);return n===e?hX.Main:"include-invalid-values"===e?hX.PreFilterInvalid:hX.PostFilterInvalid}({invalid:Oq("invalid",o,u),isPath:JW(a)});if(function(t){return YR(t,"unionWith")}(n)){const i=ZQ(t,void 0,e,r);return ZV([...QQ(n.unionWith,f,l),...i.value])}if(gq(n))return ZV([n]);if(n&&"unaggregated"!==n&&!MW(n))return ZV(QQ(n,f,l));if(s&&r===s.fieldChannel){if("normalize"===s.offset)return tX([[0,1]]);const t=e.requestDataName(h);return tX([{data:t,field:e.vgField(r,{suffix:"start"})},{data:t,field:e.vgField(r,{suffix:"end"})}])}const d=GI(r)&&VH(c)?function(t,n,e){if(!wW(e))return;const r=t.fieldDef(n),i=r.sort;if(BH(i))return{op:"min",field:yK(r,n),order:"ascending"};const{stack:o}=t,a=o?new Set([...o.groupbyFields,...o.stackBy.map((t=>t.fieldDef.field))]):void 0;if(zH(i))return tZ(i,o&&!a.has(i.field));if(function(t){return YR(t,"encoding")}(i)){const{encoding:n,order:e}=i,r=t.fieldDef(n),{aggregate:u,field:s}=r,c=o&&!a.has(s);if(ZI(u)||tq(u))return tZ({field:sG(r),order:e},c);if(nq(u)||!u)return tZ({op:u,field:s,order:e},c)}else{if("descending"===i)return{op:"min",field:t.vgField(n),order:"descending"};if(fR(["ascending",void 0],i))return!0}}(e,r,t):void 0;if(JH(c))return tX(QQ([c.datum],f,l));const m=c;if("unaggregated"===n){const{field:t}=c;return tX([{data:e.requestDataName(h),field:sG({field:t,aggregate:"min"})},{data:e.requestDataName(h),field:sG({field:t,aggregate:"max"})}])}if(uq(m.bin)){if(wW(t))return tX("bin-ordinal"===t?[]:[{data:MR(d)?e.requestDataName(h):e.requestDataName(hX.Raw),field:e.vgField(r,SG(m,r)?{binSuffix:"range"}:{}),sort:!0!==d&&S(d)?d:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:t}=m;if(uq(t)){const n=cQ(e,m.field,t);return tX([new XQ((()=>{const t=e.getSignalName(n);return`[${t}.start, ${t}.stop]`}))])}return tX([{data:e.requestDataName(h),field:e.vgField(r,{})}])}}if(m.timeUnit&&fR(["time","utc"],t)){const t=i[eI(r)];if(UH(m,t,o,u)){const n=e.requestDataName(h),i=IH({fieldDef:m,fieldDef2:t,markDef:o,config:u}),s=KW(a)&&.5!==i&&DI(r);return tX([{data:n,field:e.vgField(r,s?{suffix:bX}:{})},{data:n,field:e.vgField(r,{suffix:s?wX:"end"})}])}}return tX(d?[{data:MR(d)?e.requestDataName(h):e.requestDataName(hX.Raw),field:e.vgField(r),sort:d}]:[{data:e.requestDataName(h),field:e.vgField(r)}])}function tZ(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":CH),...r?{field:_R(r)}:{},...i?{order:i}:{}}}function nZ(t,n){const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=t.fieldDef(n)?.bin,o=MW(r)?r:void 0,a=cq(i)&&fq(i.extent)?i.extent:void 0;(o||a)&&e.set("selectionExtent",o??a,!0)}function eZ(t,n){const{aggregate:e,type:r}=t;return e?xt(e)&&!oq.has(e)?{valid:!1,reason:uU(e)}:"quantitative"===r&&"log"===n?{valid:!1,reason:sU(t)}:{valid:!0}:{valid:!1,reason:aU(t)}}function rZ(t,n,e,r){return t.explicit&&n.explicit&&yU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${GR(e)} and ${GR(r)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function iZ(t){if(yq(t)&&xt(t.field))return t.field;if(function(t){return!D(t)&&YR(t,"fields")&&!YR(t,"data")}(t)){let n;for(const e of t.fields)if(yq(e)&&xt(e.field))if(n){if(n!==e.field)return yU("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=e.field;return yU("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(t){return!D(t)&&YR(t,"fields")&&YR(t,"data")}(t)){yU("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=t.fields[0];return xt(n)?n:void 0}}function oZ(t,n){const e=t.component.scales[n].get("domains").map((n=>(yq(n)&&(n.data=t.lookupDataSource(n.data)),n)));return function(t){const n=pR(t.map((t=>{if(yq(t)){const{sort:n,...e}=t;return e}return t})),sR),e=pR(t.map((t=>{if(yq(t)){const n=t.sort;return void 0===n||MR(n)||("op"in n&&"count"===n.op&&delete n.field,"ascending"===n.order&&delete n.order),n}})).filter((t=>void 0!==t)),sR);if(0===n.length)return;if(1===n.length){const n=t[0];if(yq(n)&&e.length>0){let t=e[0];if(e.length>1){yU(lU);const n=e.filter((t=>S(t)&&"op"in t&&"min"!==t.op));t=!e.every((t=>S(t)&&"op"in t))||1!==n.length||n[0]}else S(t)&&"field"in t&&n.field===t.field&&(t=!t.order||{order:t.order});return{...n,sort:t}}return n}const r=pR(e.map((t=>MR(t)||!("op"in t)||xt(t.op)&&ft(QI,t.op)?t:(yU(function(t){return`Dropping sort property ${GR(t)} as unioned domains only support boolean or op "count", "min", and "max".`}(t)),!0))),sR);let i;1===r.length?i=r[0]:r.length>1&&(yU(lU),i=!0);const o=pR(t.map((t=>yq(t)?t.data:null)),(t=>t));return 1===o.length&&null!==o[0]?{data:o[0],fields:n.map((t=>t.field)),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}(e)}function aZ(t){return NZ(t)||EZ(t)?t.children.reduce(((t,n)=>t.concat(aZ(n))),uZ(t)):uZ(t)}function uZ(t){return xR(t.component.scales).reduce(((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:c,reverse:f,...l}=i,h=function(t,n,e,r){if(DI(e)){if(vq(t))return{step:{signal:`${n}_step`}}}else if(S(t)&&yq(t))return{...t,data:r.lookupDataSource(t.data)};return t}(i.range,o,e,t),d=oZ(t,e),m=u?function(t,n,e,r){const i=iK(t,n.param,n);return{signal:xW(e.get("type"))&&D(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}(t,u,r,d):null;return n.push({name:o,type:a,...d?{domain:d}:{},...m?{domainRaw:m}:{},range:h,...void 0!==f?{reverse:f}:{},...l}),n}),[])}class sZ extends QV{constructor(t,n){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(fR(["log",aW,uW],t))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&fR([oW,"sqrt","pow"],t))return"definitely";const e=this.get("domains");if(e.length>0){let t=!1,n=!1,r=!1;for(const i of e){if(D(i)){const e=i[0],r=i[i.length-1];if(bt(e)&&bt(r)){if(e<=0&&r>=0){t=!0;continue}n=!0;continue}}r=!0}if(t)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const cZ=["range","scheme"];function fZ(t,n){const e=t.fieldDef(n);if(e?.bin){const{bin:r,field:i}=e,o=rI(n),a=t.getName(o);if(S(r)&&r.binned&&void 0!==r.step)return new XQ((()=>{const e=t.scaleName(n),i=`(domain("${e}")[1] - domain("${e}")[0]) / ${r.step}`;return`${t.getSignalName(a)} / (${i})`}));if(uq(r)){const n=cQ(t,i,r);return new XQ((()=>{const e=t.getSignalName(n),r=`(${e}.stop - ${e}.start) / ${e}.step`;return`${t.getSignalName(a)} / (${r})`}))}}}function lZ(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const r of cZ)if(void 0!==e[r]){const o=_W(i,r),a=zW(t,r);if(o)if(a)yU(a);else switch(r){case"range":{const r=e.range;if(D(r)){if(DI(t))return ZV(r.map((t=>{if("width"===t||"height"===t){const e=n.getName(t),r=n.getSignalName.bind(n);return XQ.fromName(r,e)}return t})))}else if(S(r))return ZV({data:n.requestDataName(hX.Main),field:r.field,sort:{op:"min",field:n.vgField(t)}});return ZV(r)}case"scheme":return ZV(hZ(e[r]))}else yU(cU(i,r,t))}const o=t===KR||"xOffset"===t?"width":"height",a=r[o];if(OY(a))if(DI(t))if(wW(i)){const e=mZ(a,n,t);if(e)return ZV({step:e})}else yU(fU(o));else if(CI(t)&&"band"===n.getScaleComponent(t===nL?"x":"y").get("type")){const t=pZ(a,i);if(t)return ZV(t)}const{rangeMin:u,rangeMax:s}=e,c=function(t,n){const{size:e,config:r,mark:i,encoding:o}=n,{type:a}=yG(o[t]),u=n.getScaleComponent(t).get("type"),{domain:s,domainMid:c}=n.specifiedScales[t];switch(t){case KR:case QR:if(fR(["point","band"],u)){const i=gZ(t,e,r.view);if(OY(i))return{step:mZ(i,n,t)}}return dZ(t,n,u);case nL:case eL:return function(t,n,e){const r=t===nL?"x":"y",i=n.getScaleComponent(r);if(!i)return dZ(r,n,e,{center:!0});const o=i.get("type"),a=n.scaleName(r),{markDef:u,config:s}=n;if("band"===o){const t=gZ(r,n.size,n.config.view);if(OY(t)){const n=pZ(t,e);if(n)return n}return[0,{signal:`bandwidth('${a}')`}]}{const e=n.encoding[r];if(VH(e)&&e.timeUnit){const t=PU(e.timeUnit,(t=>`scale('${a}', ${t})`)),r=n.config.scale.bandWithNestedOffsetPaddingInner,i=IH({fieldDef:e,markDef:u,config:s})-.5,o=0!==i?` + ${i}`:"";return r?[{signal:`${gq(r)?`${r.signal}/2`+o:`${r/2+i}`} * (${t})`},{signal:`${gq(r)?`(1 - ${r.signal}/2)`+o:`${1-r/2+i}`} * (${t})`}]:[0,{signal:t}]}return oR(`Cannot use ${t} scale if ${r} scale is not discrete.`)}}(t,n,u);case gL:{const o=function(t,n){switch(t){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(eU("size",t))}(i,r),a=function(t,n,e,r){const i={x:fZ(e,"x"),y:fZ(e,"y")};switch(t){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const t=yZ(n,i,r.view);return bt(t)?t-1:new XQ((()=>`${t.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 t=yZ(n,i,r.view);return bt(t)?Math.pow(vZ*t,2):new XQ((()=>`pow(${vZ} * ${t.signal}, 2)`))}}throw new Error(eU("size",t))}(i,e,n,r);return kW(u)?function(t,n,e){const r=()=>{const r=Fq(n),i=Fq(t),o=`(${r} - ${i}) / (${e} - 1)`;return`sequence(${i}, ${r} + ${o}, ${o})`};return gq(n)?new XQ(r):{signal:r()}}(o,a,function(t,n,e,r){switch(t){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==e&&D(e)?e.length+1:(yU(function(t){return`Domain for ${t} is required for threshold scale.`}(r)),3)}}(u,r,s,t)):[o,a]}case oL:return[0,2*Math.PI];case vL:return[0,360];case rL:return[0,new XQ((()=>`min(${n.getSignalName(FZ(n.parent)?"child_width":"width")},${n.getSignalName(FZ(n.parent)?"child_height":"height")})/2`))];case lL:return{step:1e3/r.scale.framesPerSecond};case xL:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case $L:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case pL:return"symbol";case hL:case dL:case mL:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===i||"geoshape"===i?"heatmap":"ramp";case yL:case bL:case wL:return[r.scale.minOpacity,r.scale.maxOpacity]}}(t,n);return(void 0!==u||void 0!==s)&&_W(i,"rangeMin")&&D(c)&&2===c.length?ZV([u??c[0],s??c[1]]):tX(c)}function hZ(t){return function(t){return!xt(t)&&YR(t,"name")}(t)?{scheme:t.name,...uR(t,["name"])}:{scheme:t}}function dZ(t,n,e,{center:r}={}){const i=rI(t),o=n.getName(i),a=n.getSignalName.bind(n);return t===QR&&xW(e)?r?[XQ.fromName((t=>`${a(t)}/2`),o),XQ.fromName((t=>`-${a(t)}/2`),o)]:[XQ.fromName(a,o),0]:r?[XQ.fromName((t=>`-${a(t)}/2`),o),XQ.fromName((t=>`${a(t)}/2`),o)]:[0,XQ.fromName(a,o)]}function mZ(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),o=oI(e),a=r[o];if("offset"===CY({step:t,offsetIsDiscrete:tG(a)&&ZU(a.type)})&&RG(r,o)){const e=n.getScaleComponent(o);let r=`domain('${n.scaleName(o)}').length`;"band"===e.get("type")&&(r=`bandspace(${r}, ${e.get("paddingInner")??e.get("padding")??0}, ${e.get("paddingOuter")??e.get("padding")??0})`);const a=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${r} / (1-${Dq(a)})`}}return t.step}function pZ(t,n){if("offset"===CY({step:t,offsetIsDiscrete:wW(n)}))return{step:t.step}}function gZ(t,n,e){const r=t===KR?"width":"height";return n[r]||PY(e,r)}const vZ=.95;function yZ(t,n,e){const r=OY(t.width)?t.width.step:TY(e,"width"),i=OY(t.height)?t.height.step:TY(e,"height");return n.x||n.y?new XQ((()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`)):Math.min(r,i)}function bZ(t,n){SZ(t)?function(t,n){const e=t.component.scales,{config:r,encoding:i,markDef:o,specifiedScales:a}=t;for(const u of xR(e)){const s=a[u],c=e[u],f=t.getScaleComponent(u),l=yG(i[u]),h=s[n],d=f.get("type"),m=f.get("padding"),p=f.get("paddingInner"),g=_W(d,n),v=zW(u,n);if(void 0!==h&&(g?v&&yU(v):yU(cU(d,n,u))),g&&void 0===v)if(void 0!==h){const t=l.timeUnit,e=l.type;switch(n){case"domainMax":case"domainMin":bU(s[n])||"temporal"===e||t?c.set(n,{signal:AG(s[n],{type:e,timeUnit:t})},!0):c.set(n,s[n],!0);break;default:c.copyKeyFromObject(n,s)}}else{const e=YR(wZ,n)?wZ[n]({model:t,channel:u,fieldOrDatumDef:l,scaleType:d,scalePadding:m,scalePaddingInner:p,domain:s.domain,domainMin:s.domainMin,domainMax:s.domainMax,markDef:o,config:r,hasNestedOffsetScale:LG(i,u),hasSecondaryRangeChannel:!!i[eI(u)]}):r.scale[n];void 0!==e&&c.set(n,e,!1)}}}(t,n):$Z(t,n)}const wZ={bins:({model:t,fieldOrDatumDef:n})=>VH(n)?function(t,n){const e=n.bin;if(uq(e)){const r=cQ(t,n.field,e);return new XQ((()=>t.getSignalName(r)))}if(sq(e)&&cq(e)&&void 0!==e.step)return{step:e.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(t,n){if(fR([hL,dL,mL],t)&&"nominal"!==n)return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:o})=>function(t,n,e,r,i,o){if(!(vG(o)?.bin||D(e)||null!=i||null!=r||fR([aW,uW],t)))return!!DI(n)||void 0}(t,n,e,r,i,o),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(t,n,e,r,i,o){if(DI(t)){if($W(n)){if(void 0!==e.continuousPadding)return e.continuousPadding;const{type:n,orient:a}=i;if("bar"===n&&(!VH(r)||!r.bin&&!r.timeUnit)&&("vertical"===a&&"x"===t||"horizontal"===a&&"y"===t))return o.continuousBandSize}if(n===sW)return e.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t){if(DI(n)){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:u}=i;return o?u:PR(t,"bar"===e?n:"tick"===e?a:r)}return CI(n)&&r===cW?i.offsetBandPaddingInner:void 0}}(t,n,e.type,r,i.scale,o),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t)if(DI(n)){const{bandPaddingOuter:t,bandWithNestedOffsetPaddingOuter:n}=i;if(o)return n;if(e===cW)return PR(t,gq(r)?{signal:`${r.signal}/2`}:r/2)}else if(CI(n)){if(e===sW)return.5;if(e===cW)return i.offsetBandPaddingOuter}}(t,n,e,r,i.scale,o),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(t,n,e,r){return"x"===e&&void 0!==r.xReverse?xW(t)&&"descending"===n?gq(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse:!(!xW(t)||"descending"!==n)||void 0}(n,VH(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:o,hasSecondaryRangeChannel:a})=>function(t,n,e,r,i,o,a){if(e&&"unaggregated"!==e&&xW(i)){if(D(e)){const t=e[0],n=e[e.length-1];if(bt(t)&&t<=0&&bt(n)&&n>=0)return!0}return!1}if("size"===t&&"quantitative"===n.type&&!kW(i))return!0;if((!VH(n)||!n.bin)&&fR([...AI,...FI],t)){const{orient:n,type:e}=r;return(!fR(["bar","area","line","trail"],e)||!("horizontal"===n&&"y"===t||"vertical"===n&&"x"===t))&&(!(!fR(["bar","area"],e)||a)||o?.zero)}return!1}(t,n,e,r,i,o.scale,a)};function xZ(t){SZ(t)?function(t){const n=t.component.scales;for(const e of HI){const r=n[e];if(!r)continue;const i=lZ(e,t);r.setWithExplicit("range",i)}}(t):$Z(t,"range")}function $Z(t,n){const e=t.component.scales;for(const e of t.children)"range"===n?xZ(e):bZ(e,n);for(const r of xR(e)){let i;for(const e of t.children){const t=e.component.scales[r];t&&(i=rX(i,t.getWithExplicit(n),n,"scale",nX(((t,e)=>"range"===n&&t.step&&e.step?t.step-e.step:0))))}e[r].setWithExplicit(n,i)}}function kZ(t,n,e,r,i=!1){const o=function(t,n,e,r){switch(n.type){case"nominal":case"ordinal":if(jL(t)||"discrete"===JI(t))return"shape"===t&&"ordinal"===n.type&&yU(oU(t,"ordinal")),"ordinal";if(_I(t))return"band";if(DI(t)||CI(t)){if(fR(["rect","bar","image","rule","tick"],e.type))return"band";if(r)return"band"}else if("arc"===e.type&&t in SI)return"band";return oH(e[rI(t)])||iG(n)&&n.axis?.tickBand?"band":"point";case"temporal":return jL(t)?"time":"discrete"===JI(t)?(yU(oU(t,"temporal")),"ordinal"):VH(n)&&n.timeUnit&&TU(n.timeUnit).utc?"utc":_I(t)?"band":"time";case"quantitative":return jL(t)?VH(n)&&uq(n.bin)?"bin-ordinal":"linear":"discrete"===JI(t)?(yU(oU(t,"quantitative")),"ordinal"):_I(t)?"band":"linear";case"geojson":return}throw new Error(Zq(n.type))}(n,e,r,i),{type:a}=t;return GI(n)?void 0!==a?function(t,n,e=!1){if(!GI(t))return!1;switch(t){case KR:case QR:case nL:case eL:case oL:case rL:return!!$W(n)||"band"===n||"point"===n&&!e;case lL:return fR(["linear","band"],n);case gL:case xL:case yL:case bL:case wL:case vL:return $W(n)||kW(n)||fR(["band","point","ordinal"],n);case hL:case dL:case mL:return"band"!==n;case $L:case pL:return"ordinal"===n||kW(n)}}(n,a)?VH(e)&&(u=a,!(fR([nW,rW],s=e.type)?void 0===u||wW(u):s===eW?fR([aW,uW,void 0],u):s!==tW||gW(u)||kW(u)||void 0===u))?(yU(function(t,n){return`FieldDef does not work with "${t}" scale. We are using "${n}" scale instead.`}(a,o)),o):a:(yU(function(t,n,e){return`Channel "${t}" does not work with "${n}" scale. We are using "${e}" scale instead.`}(n,a,o)),o):o:null;var u,s}function MZ(t){t.component.scales=SZ(t)?function(t){const{encoding:n,mark:e,markDef:r}=t,i={};for(const o of HI){const a=yG(n[o]);if(a&&e===XW&&o===pL&&a.type===iW)continue;let u=a&&a.scale;if(a&&null!==u&&!1!==u){u??(u={});const e=kZ(u,o,a,r,LG(n,o));i[o]=new sZ(t.scaleName(`${o}`,!0),{value:e,explicit:u.type===e})}}return i}(t):function(t){var n;const e=t.component.scales={},r={},i=t.component.resolve;for(const e of t.children){MZ(e);for(const o of xR(e.component.scales))if((n=i.scale)[o]??(n[o]=LK(o,t)),"shared"===i.scale[o]){const t=r[o],n=e.component.scales[o].getWithExplicit("type");t?lW(t.value,n.value)?r[o]=rX(t,n,"type","scale",AZ):(i.scale[o]="independent",delete r[o]):r[o]=n}}for(const n of xR(r)){const i=t.scaleName(n,!0);e[n]=new sZ(i,r[n]);for(const e of t.children){const t=e.component.scales[n];t&&(e.renameScale(t.get("name"),i),t.merged=!0)}}return e}(t)}const AZ=nX(((t,n)=>dW(t)-dW(n)));class DZ{constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return void 0!==this.nameMap[t]}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function SZ(t){return"unit"===t?.type}function FZ(t){return"facet"===t?.type}function EZ(t){return"concat"===t?.type}function NZ(t){return"layer"===t?.type}class CZ{constructor(t,n,e,r,i,o,a){this.type=n,this.parent=e,this.config=i,this.parent=e,this.config=i,this.view=dq(a),this.name=t.name??r,this.title=pq(t.title)?{text:t.title}:t.title?dq(t.title):void 0,this.scaleNameMap=e?e.scaleNameMap:new DZ,this.projectionNameMap=e?e.projectionNameMap:new DZ,this.signalNameMap=e?e.signalNameMap:new DZ,this.data=t.data,this.description=t.description,this.transforms=function(t){return t.map((t=>wV(t)?{filter:rR(t.filter,KU)}:t))}(t.transform??[]),this.layout="layer"===n||"unit"===n?{}:function(t,n,e){const r=e[n],i={},{spacing:o,columns:a}=r;void 0!==o&&(i.spacing=o),void 0!==a&&(jH(t)&&!TH(t.facet)||FY(t))&&(i.columns=a),EY(t)&&(i.columns=1);for(const n of zY)if(void 0!==t[n])if("spacing"===n){const e=t[n];i[n]=bt(e)?e:{row:e.row??o,column:e.column??o}}else i[n]=t[n];return i}(t,n,i),this.component={data:{sources:e?e.component.data.sources:[],outputNodes:e?e.component.data.outputNodes:{},outputNodeRefCounts:e?e.component.data.outputNodeRefCounts:{},isFaceted:jH(t)||e?.component.data.isFaceted&&void 0===t.data},layoutSize:new QV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?iR(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(t,{ignoreRange:n}={}){MZ(t),JQ(t);for(const n of OW)bZ(t,n);n||xZ(t)}(this)}parseProjection(){aQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){QK(this)}assembleEncodeFromView(t){const{style:n,...e}=t,r={};for(const t of xR(e)){const n=e[t];void 0!==n&&(r[t]=Aq(n))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),t||(this.description&&(n.description=Aq(this.description)),"unit"!==this.type&&"layer"!==this.type)?wR(n)?void 0:n:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:e,config:r}=this,i=function(t,n){const e={};for(const r of LL){const i=t[r];if(i?.facetFieldDef){const{titleAnchor:t,titleOrient:o}=xK(["titleAnchor","titleOrient"],i.facetFieldDef.header,n,r),a=bK(r,o),u=OK(t,a);void 0!==u&&(e[a]=u)}}return wR(e)?void 0:e}(e.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const e of LL)t[e].title&&n.push(MK(this,e));for(const t of $K)n=n.concat(SK(this,t));return n}assembleAxes(){return function(t,n){const{x:e=[],y:r=[]}=t;return[...e.map((t=>uK(t,"grid",n))),...r.map((t=>uK(t,"grid",n))),...e.map((t=>uK(t,"main",n))),...r.map((t=>uK(t,"main",n)))].filter((t=>t))}(this.component.axes,this.config)}assembleLegends(){return eQ(this)}assembleProjections(){return NZ(t=this)||EZ(t)?function(t){return t.children.reduce(((t,n)=>t.concat(n.assembleProjections())),rQ(t))}(t):rQ(t);var t}assembleTitle(){const{encoding:t,...n}=this.title??{},e={...mq(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(e.text)return fR(["unit","layer"],this.type)?fR(["middle",void 0],e.anchor)&&(e.frame??(e.frame="group")):e.anchor??(e.anchor="start"),wR(e)?void 0:e}assembleGroup(t=[]){const n={};(t=t.concat(this.assembleSignals())).length>0&&(n.signals=t);const e=this.assembleLayout();e&&(n.layout=e),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||FZ(this.parent)?aZ(this):[];r.length>0&&(n.scales=r);const i=this.assembleAxes();i.length>0&&(n.axes=i);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return AR((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(hX[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),e=this.component.data.outputNodeRefCounts;return e[n]=(e[n]||0)+1,n}getSizeSignalRef(t){if(FZ(this.parent)){const n=EI(jK(t)),e=this.component.scales[n];if(e&&!e.merged){const t=e.get("type"),r=e.get("range");if(wW(t)&&vq(r)){const t=e.get("name"),r=iZ(oZ(this,n));return r?{signal:PK(t,e,sG({aggregate:"distinct",field:r},{expr:"datum"}))}:(yU(Uq(n)),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){return n?this.getName(t):KL(t)&&GI(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?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(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let e=this.component.selection[t];if(!e&&this.parent&&(e=this.parent.getSelectionComponent(t,n)),!e)throw new Error(`Cannot find a selection named "${n}".`);return e}hasAxisOrientSignalRef(){return this.component.axes.x?.some((t=>t.hasOrientSignalRef()))||this.component.axes.y?.some((t=>t.hasOrientSignalRef()))}}class OZ extends CZ{vgField(t,n={}){const e=this.fieldDef(t);if(e)return sG(e,n)}reduceFieldDef(t,n){return function(t,n,e,r){return t?xR(t).reduce(((e,i)=>{const o=t[i];return D(o)?o.reduce(((t,e)=>n.call(r,t,e,i)),e):n.call(r,e,o,i)}),e):e}(this.getMapping(),((n,e,r)=>{const i=vG(e);return i?t(n,i,r):n}),n)}forEachFieldDef(t,n){HG(this.getMapping(),((n,e)=>{const r=vG(n);r&&t(r,e)}),n)}}class _Z extends mX{clone(){return new _Z(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"value",e[1]??"density"],this.transform.resolve=this.transform.resolve??"shared"}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${sR(this.transform)}`}assemble(){const{density:t,...n}=this.transform,e={type:"kde",field:t,...n};return e.resolve=this.transform.resolve,e}}class zZ extends mX{clone(){return new zZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${sR(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class BZ extends mX{clone(){return new BZ(this.parent,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const{flatten:e,as:r=[]}=this.transform;this.transform.as=e.map(((t,n)=>r[n]??t))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${sR(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class TZ extends mX{clone(){return new TZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"key",e[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${sR(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class PZ extends mX{clone(){return new PZ(null,iR(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let e=0;for(const r of[[sL,uL],[fL,cL]]){const i=r.map((t=>{const e=yG(n.encoding[t]);return VH(e)?e.field:JH(e)?{expr:`${e.datum}`}:eG(e)?{expr:`${e.value}`}:void 0}));(i[0]||i[1])&&(t=new PZ(t,i,null,n.getName("geojson_"+e++)))}if(n.channelHasField(pL)){const r=n.typedFieldDef(pL);r.type===iW&&(t=new PZ(t,null,r.field,n.getName("geojson_"+e++)))}return t}constructor(t,n,e,r){super(t),this.fields=n,this.geojson=e,this.signal=r}dependentFields(){const t=(this.fields??[]).filter(xt);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${sR(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class jZ extends mX{clone(){return new jZ(null,this.projection,iR(this.fields),iR(this.as))}constructor(t,n,e,r){super(t),this.projection=n,this.fields=e,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const e of[[sL,uL],[fL,cL]]){const r=e.map((t=>{const e=yG(n.encoding[t]);return VH(e)?e.field:JH(e)?{expr:`${e.datum}`}:eG(e)?{expr:`${e.value}`}:void 0})),i=e[0]===fL?"2":"";(r[0]||r[1])&&(t=new jZ(t,n.projectionName(),r,[n.getName(`x${i}`),n.getName(`y${i}`)]))}return t}dependentFields(){return new Set(this.fields.filter(xt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${sR(this.fields)} ${sR(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class RZ extends mX{clone(){return new RZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:e,step:r}=t;return{signal:`sequence(${[n,e,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new RZ(t,n)}static makeFromEncoding(t,n){const e=n.encoding,r=e.x,i=e.y;if(VH(r)&&VH(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:c,keyvals:f}=o.impute,l=GG(n.mark,e);return new RZ(t,{impute:o.field,key:a.field,...u?{method:u}:{},...void 0!==s?{value:s}:{},...c?{frame:c}:{},...void 0!==f?{keyvals:f}:{},...l.length?{groupby:l}:{}})}return null}hash(){return`Impute ${sR(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:e,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...e?{keyvals:(s=e,YR(s,"stop")?this.processSequence(e):e)}:{},method:"value",...i?{groupby:i}:{},value:r&&"value"!==r?null:o};var s;return r&&"value"!==r?[u,{type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1,...i?{groupby:i}:{}},{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[u]}}class LZ extends mX{clone(){return new LZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${sR(this.transform)}`}assemble(){const{loess:t,on:n,...e}=this.transform;return{type:"loess",x:n,y:t,...e}}}class IZ extends mX{clone(){return new IZ(null,iR(this.transform),this.secondary)}constructor(t,n,e){super(t),this.transform=n,this.secondary=e}static make(t,n,e,r){const i=n.component.data.sources,{from:o}=e;let a=null;if(function(t){return YR(t,"data")}(o)){let t=n0(o.data,i);t||(t=new wQ(o.data),i.push(t));const e=n.getName(`lookup_${r}`);a=new pX(t,e,hX.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[e]=a}else if(function(t){return YR(t,"param")}(o)){const t=o.param;let r;e={as:t,...e};try{r=n.getSelectionComponent(AR(t),t)}catch(n){throw new Error(`Lookups can only be performed on selection parameters. "${t}" is a variable parameter.`)}if(a=r.materialized,!a)throw new Error(`Cannot define and lookup the "${t}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new IZ(t,e,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?K(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${sR({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:K(this.transform.as)}:{}};else{let n=this.transform.as;xt(n)||(yU('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"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class qZ extends mX{clone(){return new qZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"prob",e[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${sR(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class UZ extends mX{clone(){return new UZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${sR(this.transform)}`}assemble(){const{regression:t,on:n,...e}=this.transform;return{type:"regression",x:n,y:t,...e}}}class WZ extends mX{clone(){return new WZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR((this.transform.groupby??[]).concat(t),(t=>t))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${sR(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:e,limit:r,op:i}=this.transform;return{type:"pivot",field:t,value:n,...void 0!==r?{limit:r}:{},...void 0!==i?{op:i}:{},...void 0!==e?{groupby:e}:{}}}}class HZ extends mX{clone(){return new HZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${sR(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function GZ(t){let n=0;return function e(r,i){if(r instanceof wQ&&!r.isGenerator&&!oX(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof gQ&&(r.parent instanceof wQ&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof dQ)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof yQ||r instanceof bQ||r instanceof RQ||r instanceof eK||r instanceof vK||r instanceof jZ||r instanceof hQ||r instanceof IZ||r instanceof qQ||r instanceof jQ||r instanceof TZ||r instanceof BZ||r instanceof _Z||r instanceof LZ||r instanceof qZ||r instanceof UZ||r instanceof vQ||r instanceof HZ||r instanceof WZ||r instanceof zZ)&&i.transform.push(r.assemble()),(r instanceof lQ||r instanceof yX||r instanceof RZ||r instanceof IQ||r instanceof PZ)&&i.transform.push(...r.assemble()),r instanceof pX&&(i.source&&0===i.transform.length?r.setSource(i.source):r.parent instanceof pX?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),1===r.numChildren()&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof pX&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let o=i.name;!i.source||i.transform.length>0?t.push(i):o=i.source;for(const t of r.children)e(t,{name:null,source:o,transform:[]});break}}}}function YZ(t,n){const{facet:e,config:r,child:i,component:o}=t;if(t.channelHasField(n)){const a=e[n],u=wK("title",null,r,n);let s=dG(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});i.component.layoutHeaders[n].title&&(s=D(s)?s.join(", "):s,s+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=wK("labelOrient",a.header,r,n),f=null!==a.header&&PR(a.header?.labels,r.header.labels,!0),l=fR(["bottom","right"],c)?"footer":"header";o.layoutHeaders[n]={title:null!==a.header?s:null,facetFieldDef:a,[l]:"facet"===n?[]:[VZ(t,n,f)]}}}function VZ(t,n,e){const r="row"===n?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function XZ(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:i,resolve:o}=t.component;if(o.axis[n]=IK(o,n),"shared"===o.axis[n]){const o="x"===n?"column":"row",a=i[o];for(const i of e.component.axes[n]){const n="top"===(r=i.get("orient"))||"left"===r||gq(r)?"header":"footer";a[n]??(a[n]=[VZ(t,o,!1)]);const e=uK(i,"main",t.config,{header:!0});e&&a[n][0].axes.push(e),i.mainExtracted=!0}}}var r}function JZ(t){for(const n of t.children)n.parseLayoutSize()}function KZ(t,n){const e=jK(n),r=EI(e),i=t.component.resolve,o=t.component.layoutSize;let a;for(const n of t.children){const o=n.component.layoutSize.getWithExplicit(e),u=i.scale[r]??LK(r,t);if("independent"===u&&"step"===o.value){a=void 0;break}if(a){if("independent"===u&&a.value!==o.value){a=void 0;break}a=rX(a,o,e,"")}else a=o}if(a){for(const r of t.children)t.renameSignal(r.getName(e),t.getName(n)),r.component.layoutSize.set(e,"merged",!1);o.setWithExplicit(n,a)}else o.setWithExplicit(n,{explicit:!1,value:void 0})}function QZ(t,n){const e=t.config,r=t.getScaleComponent("width"===n?"x":"y");if(r){const t=r.get("type"),i=r.get("range");if(wW(t)){const t=PY(e.view,n);return vq(i)||OY(t)?"step":t}return BY(e.view,n)}if(t.hasProjection||"arc"===t.mark)return BY(e.view,n);{const t=PY(e.view,n);return OY(t)?t.step:t}}function ZZ(t,n,e){return sG(n,{suffix:`by_${sG(t)}`,...e})}class t0 extends OZ{constructor(t,n,e,r){super(t,"facet",n,e,r,t.resolve),this.child=M0(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!TH(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=xR(t),e={};for(const r of n){if(![VR,XR].includes(r)){yU(eU(r,"facet"));break}const n=t[r];if(void 0===n.field){yU(nU(n,r));break}e[r]=this.initFacetFieldDef(n,r)}return e}initFacetFieldDef(t,n){const e=xG(t,n);return e.header?e.header=dq(e.header):null===e.header&&(e.header=null),e}channelHasField(t){return YR(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=e0(this),this.child.parseData()}parseLayoutSize(){JZ(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(t){for(const n of LL)YZ(t,n);XZ(t,"x"),XZ(t,"y")}(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of LL)for(const e of kK){const r=this.component.layoutHeaders[n],i=r[e],{facetFieldDef:o}=r;if(o){const e=wK("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(e)){const r=bK(n,e);t.titleAnchor??(t.titleAnchor={}),t.titleAnchor[r]="end"}}if(i?.[0]){const i="header"===e?"headerBand":"footerBand";"facet"===n||this.child.component.layoutSize.get("row"===n?"height":"width")||(t[i]??(t[i]={}),t[i][n]=.5),r.title&&(t.offset??(t.offset={}),t.offset["row"===n?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,e=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(n||"independent"!==this.component.resolve.scale.x)&&(t||"independent"!==this.component.resolve.scale.y)||(r="none"),{...this.getHeaderLayoutMixins(),...e?{columns:e}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof t0))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof t0?{...this.channelHasField("column")?{encode:{update:{columns:{field:sG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],e=[];if(this.child instanceof t0){if(this.child.channelHasField("column")){const r=sG(this.child.facet.column);t.push(r),n.push("distinct"),e.push(`distinct_${r}`)}}else for(const r of AI){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(wW(o)&&vq(a)){const i=iZ(oZ(this.child,r));i?(t.push(i),n.push("distinct"),e.push(`distinct_${i}`)):yU(Uq(r))}}}return{fields:t,ops:n,as:e}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:e,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const t of LL){const n=this.facet[t];if(n){u.push(sG(n));const{bin:s,sort:c}=n;if(uq(s)&&u.push(sG(n,{binSuffix:"end"})),zH(c)){const{field:t,op:u=CH}=c,s=ZZ(n,c);e&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(t),o.push(u),a.push(s))}else if(D(c)){const e=yK(n,t);i.push(e),o.push("max"),a.push(e)}}}const s=!!e&&!!r;return{name:t,data:n,groupby:u,...s||i.length>0?{aggregate:{...s?{cross:s}:{},...i.length?{fields:i,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,e=n[t];return e?zH(e.sort)?[ZZ(e,e.sort,{expr:"datum"})]:D(e.sort)?[yK(e,t,{expr:"datum"})]:[sG(e,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,e=n[t];if(e){const{sort:t}=e;return[(zH(t)?t.order:!D(t)&&t)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return EK(t.facet,"facet",n);const e={row:["top","bottom"],column:["left","right"]};for(const r of $K)if(t[r]){const i=wK("labelOrient",t[r]?.header,n,r);if(e[r].includes(i))return EK(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=function(t){const n=[],e=GZ(n);for(const n of t.children)e(n,{source:t.name,name:null,transform:[]});return n}(this.component.data.facetRoot),e=t.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||t.assembleTitle(),i=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...r?{title:r}:{},...i?{style:i}:{},from:{facet:this.assembleFacet()},sort:{field:LL.map((t=>this.facetSortFields(t))).flat(),order:LL.map((t=>this.facetSortOrder(t))).flat()},...n.length>0?{data:n}:{},...e?{encode:{update:e}}:{},...t.assembleGroup(LX(this,[]))}]}getMapping(){return this.facet}}function n0(t,n){for(const e of n){const n=e.data;if(t.name&&e.hasName()&&t.name!==e.dataName)continue;const r=t.format?.mesh,i=n.format?.feature;if(r&&i)continue;const o=t.format?.feature;if((o||i)&&o!==i)continue;const a=n.format?.mesh;if(!r&&!a||r===a)if(aX(t)&&aX(n)){if(HR(t.values,n.values))return e}else if(oX(t)&&oX(n)){if(t.url===n.url)return e}else if(uX(t)&&t.name===e.dataName)return e}return null}function e0(t){let n=function(t,n){if(t.data||!t.parent){if(null===t.data){const t=new wQ({values:[]});return n.push(t),t}const e=n0(t.data,n);if(e)return sX(t.data)||(e.data.format=dR({},t.data.format,e.data.format)),!e.hasName()&&t.data.name&&(e.dataName=t.data.name),e;{const e=new wQ(t.data);return n.push(e),e}}return t.parent.component.data.facetRoot?t.parent.component.data.facetRoot:t.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,o=i&&(sX(i)||oX(i)||aX(i))||!t.parent?new iX:t.parent.component.data.ancestorParse.clone();sX(i)?(cX(i)?n=new bQ(n,i.sequence):lX(i)&&(n=new yQ(n,i.graticule)),o.parseNothing=!0):null===i?.format?.parse&&(o.parseNothing=!0),n=gQ.makeExplicit(n,t,o)??n,n=new vQ(n);const a=t.parent&&NZ(t.parent);(SZ(t)||FZ(t))&&a&&(n=lQ.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(t,n,e){let r=0;for(const i of n.transforms){let o,a;if(CV(i))a=t=new vK(t,i),o="derived";else if(wV(i)){const r=pQ(i);a=t=gQ.makeWithAncestors(t,{},r,e)??t,t=new eK(t,n,i.filter)}else if(OV(i))a=t=lQ.makeFromTransform(t,i,n),o="number";else if(zV(i))o="date",void 0===e.getWithExplicit(i.field).value&&(t=new gQ(t,{[i.field]:o}),e.set(i.field,o,!1)),a=t=yX.makeFromTransform(t,i);else if(BV(i))a=t=hQ.makeFromTransform(t,i),o="number",JJ(n)&&(t=new vQ(t));else if(xV(i))a=t=IZ.make(t,n,i,r++),o="derived";else if(FV(i))a=t=new qQ(t,i),o="number";else if(EV(i))a=t=new jQ(t,i),o="number";else if(TV(i))a=t=IQ.makeFromTransform(t,i),o="derived";else if(PV(i))a=t=new TZ(t,i),o="derived";else if(jV(i))a=t=new zZ(t,i),o="derived";else if(NV(i))a=t=new BZ(t,i),o="derived";else if($V(i))a=t=new WZ(t,i),o="derived";else if(SV(i))t=new HZ(t,i);else if(_V(i))a=t=RZ.makeFromTransform(t,i),o="derived";else if(kV(i))a=t=new _Z(t,i),o="derived";else if(MV(i))a=t=new qZ(t,i),o="derived";else if(AV(i))a=t=new UZ(t,i),o="derived";else{if(!DV(i)){yU(Jq(i));continue}a=t=new LZ(t,i),o="derived"}if(a&&void 0!==o)for(const t of a.producedFields()??[])e.set(t,o,!1)}return t}(n,t,o));const u=function(t){const n={};if(SZ(t)&&t.component.selection)for(const e of xR(t.component.selection)){const r=t.component.selection[e];for(const t of r.project.items)!t.channel&&TR(t.field)>1&&(n[t.field]="flatten")}return n}(t),s=function(t){const n={};function e(t){var e;MG(t)?n[t.field]="date":"quantitative"===t.type&&xt(e=t.aggregate)&&fR(["min","max"],e)?n[t.field]="number":TR(t.field)>1?t.field in n||(n[t.field]="flatten"):rG(t)&&zH(t.sort)&&TR(t.sort.field)>1&&(t.sort.field in n||(n[t.sort.field]="flatten"))}if((SZ(t)||FZ(t))&&t.forEachFieldDef(((n,r)=>{if(nG(n))e(n);else{const i=tI(r),o=t.fieldDef(i);e({...n,type:o.type})}})),SZ(t)){const{mark:e,markDef:r,encoding:i}=t;if(JW(e)&&!t.encoding.order){const t=i["horizontal"===r.orient?"y":"x"];VH(t)&&"quantitative"===t.type&&!(t.field in n)&&(n[t.field]="number")}}return n}(t);n=gQ.makeWithAncestors(n,{},{...u,...s},o)??n,SZ(t)&&(n=PZ.parseAll(n,t),n=jZ.parseAll(n,t)),(SZ(t)||FZ(t))&&(a||(n=lQ.makeFromEncoding(n,t)??n),n=yX.makeFromEncoding(n,t)??n,n=vK.parseAllForSortIndex(n,t));const c=n=r0(hX.Raw,t,n);if(SZ(t)){const e=hQ.makeFromEncoding(n,t);e&&(n=e,JJ(t)&&(n=new vQ(n))),n=RZ.makeFromEncoding(n,t)??n,n=IQ.makeFromEncoding(n,t)??n}let f,l;if(SZ(t)){const{markDef:e,mark:r,config:i}=t,o=Cq("invalid",e,i),{marks:a,scales:u}=l=dX({invalid:o,isPath:JW(r)});a!==u&&"include-invalid-values"===u&&(f=n=r0(hX.PreFilterInvalid,t,n)),"exclude-invalid-values"===a&&(n=RQ.make(n,t,l)??n)}const h=n=r0(hX.Main,t,n);let d;if(SZ(t)&&l){const{marks:e,scales:r}=l;"include-invalid-values"===e&&"exclude-invalid-values"===r&&(n=RQ.make(n,t,l)??n,d=n=r0(hX.PostFilterInvalid,t,n))}SZ(t)&&function(t,n){for(const[e,r]of kR(t.component.selection??{})){const i=t.getName(`lookup_${e}`);t.component.data.outputNodes[i]=r.materialized=new pX(new eK(n,t,{param:e}),i,hX.Lookup,t.component.data.outputNodeRefCounts)}}(t,h);let m=null;if(FZ(t)){const r=t.getName("facet");n=function(t,n){const{row:e,column:r}=n;if(e&&r){let n=null;for(const i of[e,r])if(zH(i.sort)){const{field:e,op:r=CH}=i.sort;t=n=new jQ(t,{joinaggregate:[{op:r,field:e,as:ZZ(i,i.sort,{forAs:!0})}],groupby:[sG(i)]})}return n}return null}(n,t.facet)??n,m=new dQ(n,t,r,h.getSource()),e[r]=m}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:o,preFilterInvalid:f,postFilterInvalid:d}}function r0(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,o=n.getDataName(t),a=new pX(e,o,t,i);return r[o]=a,a}class i0 extends CZ{constructor(t,n,e,r){super(t,"concat",n,e,r,t.resolve),"shared"!==t.resolve?.axis?.x&&"shared"!==t.resolve?.axis?.y||yU("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(t).map(((t,n)=>M0(t,this,this.getName(`concat_${n}`),void 0,r)))}parseData(){this.component.data=e0(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of xR(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return EY(t)?t.vconcat:NY(t)?t.hconcat:t.concat}parseLayoutSize(){!function(t){JZ(t);const n=void 0===t.layout.columns?"height":"childHeight";KZ(t,1===t.layout.columns?"width":"childWidth"),KZ(t,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.forEach((t=>t.assembleSignals())),[]}assembleLayoutSignals(){const t=zK(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleMarks(){return this.children.map((t=>{const n=t.assembleTitle(),e=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...e?{style:e}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...null!=t?{columns:t}:{},bounds:"full",align:"each"}}}const o0={disable:1,gridScale:1,scale:1,...OG,labelExpr:1,encode:1},a0=xR(o0);class u0 extends QV{constructor(t={},n={},e=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=e}clone(){return new u0(iR(this.explicit),iR(this.implicit),this.mainExtracted)}hasAxisPart(t){return!("axis"!==t&&("grid"===t||"title"===t?!this.get(t):!1===(n=this.get(t))||null===n));var n}hasOrientSignalRef(){return gq(this.explicit.orient)}}const s0={bottom:"top",top:"bottom",left:"right",right:"left"};function c0(t,n){if(!t)return n.map((t=>t.clone()));{if(t.length!==n.length)return;const e=t.length;for(let r=0;r<e;r++){const e=t[r],i=n[r];if(!!e!=!!i)return;if(e&&i){const n=e.getWithExplicit("orient"),o=i.getWithExplicit("orient");if(n.explicit&&o.explicit&&n.value!==o.value)return;t[r]=f0(e,i)}}}return t}function f0(t,n){for(const e of a0){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"axis",((t,n)=>{switch(e){case"title":return jq(t,n);case"gridScale":return{explicit:t.explicit,value:PR(t.value,n.value)}}return eX(t,n,e,"axis")}));t.setWithExplicit(e,r)}return t}function l0(t,n,e,r,i){if("disable"===n)return void 0!==e;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(gq(e.labelAngle)?e.labelAngle:qR(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===gK(r,i))return!0}return t===e[n]}const h0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function d0(t,n){let e=n.axis(t);const r=new u0,i=yG(n.encoding[t]),{mark:o,config:a}=n,u=e?.orient||a["x"===t?"axisX":"axisY"]?.orient||a.axis?.orient||function(t){return"x"===t?"bottom":"left"}(t),s=n.getScaleComponent(t).get("type"),c=function(t,n,e,r){const i="band"===n?["axisDiscrete","axisBand"]:"point"===n?["axisDiscrete","axisPoint"]:gW(n)?["axisQuantitative"]:"time"===n||"utc"===n?["axisTemporal"]:[],o="x"===t?"axisX":"axisY",a=gq(e)?"axisOrient":`axis${FR(e)}`,u=[...i,...i.map((t=>o+t.substr(4)))],s=["axis",a,o];return{vlOnlyAxisConfig:cK(u,r,t,e),vgAxisConfig:cK(s,r,t,e),axisConfigStyle:fK([...s,...u],r)}}(t,s,u,n.config),f=void 0!==e?!e:lK("disable",a.style,e?.style,c).configValue;if(r.set("disable",f,void 0!==e),f)return r;e=e||{};const l=function(t,n,e,r,i){const o=n?.labelAngle;if(void 0!==o)return gq(o)?o:qR(o);{const{configValue:o}=lK("labelAngle",r,n?.style,i);return void 0!==o?qR(o):e!==KR||!fR([rW,nW],t.type)||VH(t)&&t.timeUnit?void 0:270}}(i,e,t,a.style,c),h=DH(e.formatType,i,s),d=AH(i,i.type,e.format,e.formatType,a,!0),m={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:s,orient:u,labelAngle:l,format:d,formatType:h,mark:o,config:a};for(const i of a0){const o=i in hK?hK[i](m):zG(i)?e[i]:void 0,u=void 0!==o,s=l0(o,i,e,n,t);if(u&&s)r.set(i,o,s);else{const{configValue:t,configFrom:n}=zG(i)&&"values"!==i?lK(i,a.style,e.style,c):{},f=void 0!==t;u&&!f?r.set(i,o,s):("vgAxisConfig"!==n||h0.has(i)&&f||EG(t)||gq(t))&&r.set(i,t,!1)}}const p=e.encoding??{},g=NG.reduce(((e,i)=>{if(!r.hasAxisPart(i))return e;const o=RK(p[i]??{},n),a="labels"===i?function(t,n,e){const{encoding:r,config:i}=t,o=yG(r[n])??yG(r[eI(n)]),a=t.axis(n)||{},{format:u,formatType:s}=a;if(wH(s))return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:u,formatType:s,config:i}),...e};if(void 0===u&&void 0===s&&i.customFormatTypes){if("quantitative"===XH(o)){if(iG(o)&&"normalize"===o.stack&&i.normalizedNumberFormatType)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...e};if(i.numberFormatType)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...e}}if("temporal"===XH(o)&&i.timeFormatType&&VH(o)&&!o.timeUnit)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...e}}return e}(n,t,o):o;return void 0===a||wR(a)||(e[i]={update:a}),e}),{});return wR(g)||r.set("encode",g,!!e.encoding||void 0!==e.labelAngle),r}function m0(t,n){const{config:e}=t;return{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t),...aJ("angle",t),...p0(t,0,n)}}function p0(t,n,e){return e?{shape:{value:e}}:aJ("shape",t)}function g0(t,n,e){if(void 0===Cq("align",t,e))return"center"}function v0(t,n,e){if(void 0===Cq("baseline",t,e))return"middle"}const y0={arc:{vgMark:"arc",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...bJ(t,"radius"),...bJ(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...gJ("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===t.markDef.orient}),...gJ("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===t.markDef.orient}),...SJ(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>m0(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&VH(e)&&e.type===iW?{field:sG(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y"),...QX(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t,{vgChannel:"strokeWidth"}),...SJ(t)})},point:{vgMark:"symbol",encodeEntry:t=>m0(t)},rect:{vgMark:"rect",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y")})},rule:{vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...gJ("x",t,{defaultPos:"horizontal"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==e}),...gJ("y",t,{defaultPos:"vertical"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==e}),...aJ("size",t,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:t=>m0(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...MJ(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...QX(t),...aJ("size",t,{vgChannel:"fontSize"}),...aJ("angle",t),...FJ("align",g0(t.markDef,0,n)),...FJ("baseline",v0(t.markDef,0,n)),...fJ("radius",t,{defaultPos:null}),...fJ("theta",t,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i="horizontal"===r?"x":"y",o="horizontal"===r?"y":"x",a="horizontal"===r?"height":"width";return{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,i),...fJ(o,t,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:Aq(Cq("thickness",e,n))}}},trail:{vgMark:"trail",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t),...SJ(t)})}};const b0="faceted_path_",w0="stack_group_";function x0(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:o}=t,a=PR(r.clip,function(t){const n=t.getScaleComponent("x"),e=t.getScaleComponent("y");return!(!n?.get("selectionExtent")&&!e?.get("selectionExtent"))||void 0}(t),function(t){const n=t.component.projection;return!(!n||n.isFit)||void 0}(t)),u=Nq(r),s=i.key,c=function(t){const{encoding:n,stack:e,mark:r,markDef:i,config:o}=t,a=n.order;if(!(!D(a)&&eG(a)&&cR(a.value)||!a&&cR(Cq("order",i,o)))){if((D(a)||VH(a))&&!e)return Bq(a,{expr:"datum"});if(JW(r)){const t="horizontal"===i.orient?"y":"x";if(VH(n[t]))return{field:t}}}}(t),f=function(t){if(!t.component.selection)return null;const n=xR(t.component.selection).length;let e=n,r=t.parent;for(;r&&0===e;)e=xR(r.component.selection).length,r=r.parent;return e?{interactive:n>0||"geoshape"===t.mark||!!t.encoding.tooltip||!!t.markDef.tooltip}:null}(t),l=Cq("aria",r,o),h=y0[e].postEncodingTransform?y0[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:y0[e].vgMark,...a?{clip:a}:{},...u?{style:u}:{},...s?{key:s.field}:{},...c?{sort:c}:{},...f||{},...!1===l?{aria:l}:{},from:{data:n.fromPrefix+t.requestDataName(hX.Main)},encode:{update:y0[e].encodeEntry(t)},...h?{transform:h}:{}}]}class $0 extends OZ{constructor(t,n,e,r={},i){super(t,"unit",n,e,i,void 0,_Y(t)?t.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=t=>(t.from?.data&&(t.from.data=this.lookupDataSource(t.from.data),"time"in this.encoding&&(t.from.data=t.from.data+SX)),t.from?.facet?.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t);const o=ZW(t.mark)?{...t.mark}:{type:t.mark},a=o.type;void 0===o.filled&&(o.filled=function(t,n,{graticule:e}){if(e)return!1;const r=Oq("filled",t,n),i=t.type;return PR(r,i!==IW&&i!==LW&&i!==UW)}(o,i,{graticule:t.data&&lX(t.data)}));const u=this.encoding=function(t,n,e,r){const i={};for(const n of xR(t))KL(n)||yU(`${o=n}-encoding is dropped as ${o} is not a valid encoding channel.`);var o;for(let o of uI){if(!t[o])continue;const a=t[o];if(CI(o)){const t=aI(o),n=i[t];if(VH(n)&&QU(n.type)&&VH(a)&&!n.timeUnit){yU(Qq(t));continue}}if("angle"!==o||"arc"!==n||t.theta||(yU("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=oL),UG(t,o,n)){if(o===gL&&"line"===n){const n=vG(t[o]);if(n?.aggregate){yU("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===hL&&(e?"fill"in t:"stroke"in t))yU(tU("encoding",{fill:"fill"in t,stroke:"stroke"in t}));else if(o===AL||o===ML&&!D(a)&&!eG(a)||o===SL&&D(a)){if(a){if(o===ML){const n=t[o];if(WH(n)){i[o]=n;continue}}i[o]=K(a).reduce(((t,n)=>(VH(n)?t.push(xG(n,o)):yU(nU(n,o)),t)),[])}}else{if(o===SL&&null===a)i[o]=null;else if(!(VH(a)||JH(a)||eG(a)||HH(a)||gq(a))){yU(nU(a,o));continue}i[o]=bG(a,o,r)}}else yU(eU(o,n))}return i}(t.encoding||{},a,o.filled,i);this.markDef=iV(o,u,i),this.size=function({encoding:t,size:n}){for(const e of AI){const r=rI(e);OY(n[r])&&KH(t[e])&&(delete n[r],yU(fU(r)))}return n}({encoding:u,size:_Y(t)?{...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}}:r}),this.stack=rV(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter((t=>DY(t)))}get hasProjection(){const{encoding:t}=this,n=this.mark===XW,e=t&&TL.some((n=>tG(t[n])));return n||e}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return HI.reduce(((t,e)=>{const r=yG(n[e]);return r&&(t[e]=this.initScale(r.scale??{})),t}),{})}initScale(t){const{domain:n,range:e}=t,r=dq(t);return D(n)&&(r.domain=n.map(kq)),D(e)&&(r.range=e.map(kq)),r}initAxes(t){return AI.reduce(((n,e)=>{const r=t[e];if(tG(r)||e===KR&&tG(t.x2)||e===QR&&tG(t.y2)){const t=tG(r)?r.axis:void 0;n[e]=t?this.initAxis({...t}):t}return n}),{})}initAxis(t){const n=xR(t),e={};for(const r of n){const n=t[r];e[r]=EG(n)?$q(n):kq(n)}return e}initLegends(t){return UI.reduce(((n,e)=>{const r=yG(t[e]);if(r&&function(t){switch(t){case hL:case dL:case mL:case gL:case pL:case yL:case xL:case $L:return!0;case bL:case wL:case vL:case lL:return!1}}(e)){const t=r.legend;n[e]=t?dq(t):t}return n}),{})}parseData(){this.component.data=e0(this)}parseLayoutSize(){!function(t){const{size:n,component:e}=t;for(const r of AI){const i=rI(r);if(n[i]){const t=n[i];e.layoutSize.set(i,OY(t)?"step":t,!0)}else{const n=QZ(t,i);e.layoutSize.set(i,n,!1)}}}(this)}parseSelections(){this.component.selection=function(t,n){const e={},r=t.config.selection;if(!n||!n.length)return e;let i=0;for(const o of n){const n=AR(o.name),a=o.select,u=xt(a)?a:a.type,s=S(a)?iR(a):{type:u},c=r[u];for(const t in c)"fields"!==t&&"encodings"!==t&&("mark"===t&&(s.mark={...c.mark,...s.mark}),void 0!==s[t]&&!0!==s[t]||(s[t]=iR(c[t]??s[t])));const f=e[n]={...s,name:n,type:u,init:o.value,bind:o.bind,events:xt(s.on)?iB(s.on,"scope"):K(iR(s.on))};if(QJ(f)&&(i++,i>1)){delete e[n];continue}const l=iR(o);for(const n of VJ)n.defined(f)&&n.parse&&n.parse(t,f,l)}return i>1&&yU("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),e}(this,this.selection)}parseMarkGroup(){this.component.mark=function(t){if(fR([LW,PW,GW],t.mark)){const n=GG(t.mark,t.encoding);if(n.length>0)return function(t,n){return[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:b0+t.requestDataName(hX.Main),data:t.requestDataName(hX.Main),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:x0(t,{fromPrefix:b0})}]}(t,n)}else if(t.mark===jW){const n=xq.some((n=>Cq(n,t.markDef,t.config)));if(t.stack&&!t.fieldDef("size")&&n)return function(t){const[n]=x0(t,{fromPrefix:w0}),e=t.scaleName(t.stack.fieldChannel),r=(n={})=>t.vgField(t.stack.fieldChannel,n),i=(t,n)=>`${t}(${[r({prefix:"min",suffix:"start",expr:n}),r({prefix:"max",suffix:"start",expr:n}),r({prefix:"min",suffix:"end",expr:n}),r({prefix:"max",suffix:"end",expr:n})].map((t=>`scale('${e}',${t})`)).join(",")})`;let o,a;"x"===t.stack.fieldChannel?(o={...aR(n.encode.update,["y","yc","y2","height",...xq]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...uR(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...aR(n.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...uR(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const e of xq){const r=Oq(e,t.markDef,t.config);n.encode.update[e]?(o[e]=n.encode.update[e],delete n.encode.update[e]):r&&(o[e]=Aq(r)),r&&(n.encode.update[e]={value:0})}const u=[];if(t.stack.groupbyChannels?.length>0)for(const n of t.stack.groupbyChannels){const e=t.fieldDef(n),r=sG(e);r&&u.push(r),(e?.bin||e?.timeUnit)&&u.push(sG(e,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((e,r)=>{if(n.encode.update[r])return{...e,[r]:n.encode.update[r]};{const n=Oq(r,t.markDef,t.config);return void 0!==n?{...e,[r]:Aq(n)}:e}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:t.requestDataName(hX.Main),name:w0+t.requestDataName(hX.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}(t)}return x0(t)}(this)}parseAxesAndHeaders(){var t;this.component.axes=(t=this,AI.reduce(((n,e)=>(t.component.scales[e]&&(n[e]=[d0(e,t)]),n)),{}))}assembleSelectionTopLevelSignals(t){return function(t,n){let e=!1;for(const r of $R(t.component.selection??{})){const i=r.name,o=Et(i+WJ);if(0===n.filter((t=>t.name===i)).length){const t="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${YJ}(${o}, ${Et("global"===r.resolve?"union":r.resolve)}${t}`})}e=!0;for(const e of VJ)e.defined(r)&&e.topLevelSignals&&(n=e.topLevelSignals(t,r,n))}return e&&0===n.filter((t=>"unit"===t.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),qX(n)}(this,t)}assembleSignals(){return[...sK(this),...RX(this,[])]}assembleSelectionData(t){return function(t,n){const e=[],r=[],i=XJ(t,{escape:!1});for(const o of $R(t.component.selection??{})){const a={name:o.name+WJ};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:$Y}}]),o.init){const t=o.project.items.map(PX);a.values=o.init.map(o.project.hasSelectionId?t=>({unit:i,[$Y]:jX(t,!1)[0]}):n=>({unit:i,fields:t,values:jX(n,!1)}))}if([...e,...n].filter((t=>t.name===o.name+WJ)).length||e.push(a),QJ(o)&&n.length){const e=t.lookupDataSource(t.getDataName(hX.Main)),i=n.find((t=>t.name===e)),o=i.transform.find((t=>"filter"===t.type&&t.expr.includes("vlSelectionTest")));o&&(i.transform=i.transform.filter((t=>t!==o)),r.push({name:i.name+SX,source:i.name,transform:[o]}))}}return e.concat(n,r)}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return zK(this)}assembleMarks(){let t=this.component.mark??[];return this.parent&&NZ(this.parent)||(t=IX(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return void 0!==t?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return jG(this.encoding,t)}fieldDef(t){return vG(this.encoding[t])}typedFieldDef(t){const n=this.fieldDef(t);return nG(n)?n:null}}class k0 extends CZ{constructor(t,n,e,r,i){super(t,"layer",n,e,i,t.resolve,t.view);const o={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map(((t,n)=>{if(JY(t))return new k0(t,this,this.getName(`layer_${n}`),o,i);if(TG(t))return new $0(t,this,this.getName(`layer_${n}`),o,i);throw new Error(Rq(t))}))}parseData(){this.component.data=e0(this);for(const t of this.children)t.parseData()}parseLayoutSize(){JZ(this),KZ(this,"width"),KZ(this,"height")}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of xR(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){!function(t){const{axes:n,resolve:e}=t.component,r={top:0,bottom:0,right:0,left:0};for(const r of t.children){r.parseAxesAndHeaders();for(const i of xR(r.component.axes))e.axis[i]=IK(t.component.resolve,i),"shared"===e.axis[i]&&(n[i]=c0(n[i],r.component.axes[i]),n[i]||(e.axis[i]="independent",delete n[i]))}for(const i of AI){for(const o of t.children)if(o.component.axes[i]){if("independent"===e.axis[i]){n[i]=(n[i]??[]).concat(o.component.axes[i]);for(const t of o.component.axes[i]){const{value:n,explicit:e}=t.getWithExplicit("orient");if(!gq(n)){if(r[n]>0&&!e){const e=s0[n];r[n]>r[e]&&t.set("orient",e,!1)}r[n]++}}}delete o.component.axes[i]}if("independent"===e.axis[i]&&n[i]&&n[i].length>1)for(const[t,e]of(n[i]||[]).entries())t>0&&e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleSignals())),sK(this))}assembleLayoutSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleLayoutSignals())),zK(this))}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleGroupStyle(){const t=new Set;for(const n of this.children)for(const e of K(n.assembleGroupStyle()))t.add(e);const n=Array.from(t);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return function(t,n){for(const e of t.children)SZ(e)&&(n=IX(e,n));return n}(this,this.children.flatMap((t=>t.assembleMarks())))}assembleLegends(){return this.children.reduce(((t,n)=>t.concat(n.assembleLegends())),eQ(this))}}function M0(t,n,e,r,i){if(jH(t))return new t0(t,n,e,i);if(JY(t))return new k0(t,n,e,r,i);if(TG(t))return new $0(t,n,e,r,i);if(function(t){return EY(t)||NY(t)||FY(t)}(t))return new i0(t,n,e,i);throw new Error(Rq(t))}var A0=Object.freeze({__proto__:null,accessPathDepth:TR,accessPathWithDatum:ER,accessWithDatumToUnescapedPath:CR,compile:function(t,n={}){n.logger&&(gU=n.logger),n.fieldTitle&&hG(n.fieldTitle);try{const e=HY(E(n.config,t.config)),r=HV(t,e),i=M0(r,null,"",void 0,e);i.parse(),function(t,n){GQ(t.sources);let e=0,r=0;for(let r=0;r<5&&VQ(t,n,!0);r++)e++;t.sources.map(UQ);for(let e=0;e<5&&VQ(t,n,!1);e++)r++;GQ(t.sources),5===Math.max(e,r)&&yU("Maximum optimization runs(5) reached.")}(i.component.data,i);const o=function(t,n,e={},r){const i=t.config?function(t){t=iR(t);for(const n of YY)delete t[n];if(t.axis)for(const n in t.axis)EG(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of pY)delete t.legend[n];if(t.mark){for(const n of nH)delete t.mark[n];t.mark.tooltip&&S(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(SY(t.params)),delete t.params);for(const n of GY){for(const e of nH)delete t[n][e];const e=VY[n];if(e)for(const r of e)delete t[n][r];XY(t,n)}for(const n of xR(dY))delete t[n];!function(t){const{titleMarkConfig:n,subtitleMarkConfig:e,subtitle:r}=mq(t.title);wR(n)||(t.style["group-title"]={...t.style["group-title"],...n}),wR(e)||(t.style["group-subtitle"]={...t.style["group-subtitle"],...e}),wR(r)?delete t.title:t.title=r}(t);for(const n in t)S(t[n])&&wR(t[n])&&delete t[n];return wR(t)?void 0:t}(t.config):void 0,o=function(t,n){const e=[],r=GZ(e);let i=0;for(const n of t.sources){n.hasName()||(n.dataName="source_"+i++);const t=n.assemble();r(n,t)}for(const t of e)0===t.transform.length&&delete t.transform;let o=0;for(const[t,n]of e.entries())0!==(n.transform??[]).length||n.source||e.splice(o++,0,e.splice(t,1)[0]);for(const n of e)for(const e of n.transform??[])"lookup"===e.type&&(e.from=t.outputNodes[e.from].getSource());for(const t of e)t.name in n&&(t.values=n[t.name]);return e}(t.component.data,e),a=t.assembleSelectionData(o),u=t.assembleProjections(),s=t.assembleTitle(),c=t.assembleGroupStyle(),f=t.assembleGroupEncodeEntry(!0);let l=t.assembleLayoutSignals();l=l.filter((t=>"width"!==t.name&&"height"!==t.name||void 0===t.value||(n[t.name]=+t.value,!1)));const{params:h,...d}=n;return{$schema:"https://vega.github.io/schema/vega/v5.json",...t.description?{description:t.description}:{},...d,...s?{title:s}:{},...c?{style:c}:{},...f?{encode:{update:f}}:{},data:a,...u.length>0?{projections:u}:{},...t.assembleGroup([...l,...t.assembleSelectionTopLevelSignals([]),...SY(h)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}(i,function(t,n,e,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");if(void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):xt(n)&&(n={type:n}),i&&o&&["fit","fit-x","fit-y"].includes(n.type))if("step"===i&&"step"===o)yU(qq()),n.type="pad";else if("step"===i||"step"===o){const t="step"===i?"width":"height";yU(qq(EI(t))),n.type=function(t){return t?`fit-${EI(t)}`:"fit"}("width"===t?"height":"width")}return{...1===xR(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...KV(e,!1),...KV(t,!0)}}(t,r.autosize,e,i),t.datasets,t.usermeta);return{spec:o,normalized:r}}finally{n.logger&&(gU=pU),n.fieldTitle&&hG(fG)}},contains:fR,deepEqual:HR,deleteNestedProperty:SR,duplicate:iR,entries:kR,every:hR,fieldIntersection:bR,flatAccessWithDatum:NR,getFirstDefined:PR,hasIntersection:vR,hasProperty:YR,hash:sR,internalField:LR,isBoolean:MR,isEmpty:wR,isEqual:function(t,n){const e=xR(t),r=xR(n);if(e.length!==r.length)return!1;for(const r of e)if(t[r]!==n[r])return!1;return!0},isInternalField:IR,isNullOrFalse:cR,isNumeric:UR,keys:xR,logicalExpr:DR,mergeDeep:dR,never:oR,normalize:HV,normalizeAngle:qR,omit:uR,pick:aR,prefixGenerator:yR,removePathFromField:BR,replaceAll:zR,replacePathInField:_R,resetIdCounter:function(){jR=42},setEqual:gR,some:lR,stringify:GR,titleCase:FR,unique:pR,uniqueId:RR,vals:$R,varName:AR,version:"5.23.0"});function D0(t){const[n,e]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:n,version:e}}const S0="#fff",F0="#888",E0={background:"#333",view:{stroke:F0},title:{color:S0,subtitleColor:S0},style:{"guide-label":{fill:S0},"guide-title":{fill:S0}},axis:{domainColor:S0,gridColor:F0,tickColor:S0}},N0="#4572a7",C0={background:"#fff",arc:{fill:N0},area:{fill:N0},line:{stroke:N0,strokeWidth:2},path:{stroke:N0},rect:{fill:N0},shape:{stroke:N0},symbol:{fill:N0,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},O0="#30a2da",_0="#cbcbcb",z0="#f0f0f0",B0="#333",T0={arc:{fill:O0},area:{fill:O0},axis:{domainColor:_0,grid:!0,gridColor:_0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:_0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:z0,group:{fill:z0},legend:{labelColor:B0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:B0,titleFontSize:14,titlePadding:10},line:{stroke:O0,strokeWidth:2},path:{stroke:O0,strokeWidth:.5},rect:{fill:O0},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:O0},bar:{binSpacing:2,fill:O0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},P0="#000",j0={group:{fill:"#e5e5e5"},arc:{fill:P0},area:{fill:P0},line:{stroke:P0},path:{stroke:P0},rect:{fill:P0},shape:{stroke:P0},symbol:{fill:P0,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},R0="Benton Gothic, sans-serif",L0="#82c6df",I0="Benton Gothic Bold, sans-serif",q0="normal",U0={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},W0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:I0,fontSize:22,fontWeight:"normal"},arc:{fill:L0},area:{fill:L0},line:{stroke:L0,strokeWidth:2},path:{stroke:L0},rect:{fill:L0},shape:{stroke:L0},symbol:{fill:L0,size:30},axis:{labelFont:R0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:I0,titleFontSize:13,titleFontWeight:q0},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:R0,labelFontSize:11.5,symbolType:"square",titleFont:I0,titleFontSize:13,titleFontWeight:q0},range:{category:U0["category-6"],diverging:U0["fireandice-6"],heatmap:U0["fire-7"],ordinal:U0["fire-7"],ramp:U0["fire-7"]}},H0="#ab5787",G0="#979797",Y0={background:"#f9f9f9",arc:{fill:H0},area:{fill:H0},line:{stroke:H0},path:{stroke:H0},rect:{fill:H0},shape:{stroke:H0},symbol:{fill:H0,size:30},axis:{domainColor:G0,domainWidth:.5,gridWidth:.2,labelColor:G0,tickColor:G0,tickWidth:.2,titleColor:G0},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},V0="#3e5c69",X0={background:"#fff",arc:{fill:V0},area:{fill:V0},line:{stroke:V0},path:{stroke:V0},rect:{fill:V0},shape:{stroke:V0},symbol:{fill:V0},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},J0="#1696d2",K0="#000000",Q0="Lato",Z0="Lato",t1={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},n1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:Q0},axisX:{domain:!0,domainColor:K0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Z0,labelAngle:0,tickColor:K0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Q0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Z0,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Q0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Z0,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Q0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:t1["six-groups-cat-1"],diverging:t1["diverging-colors"],heatmap:t1["diverging-colors"],ordinal:t1["six-groups-seq"],ramp:t1["shades-blue"]},area:{fill:J0},rect:{fill:J0},line:{color:J0,stroke:J0,strokeWidth:5},trail:{color:J0,stroke:J0,strokeWidth:0,size:1},path:{stroke:J0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:J0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:J0,stroke:null}},arc:{fill:J0},shape:{stroke:J0},symbol:{fill:J0,size:30}},e1="#3366CC",r1="#ccc",i1="Arial, sans-serif",o1={arc:{fill:e1},area:{fill:e1},path:{stroke:e1},rect:{fill:e1},shape:{stroke:e1},symbol:{stroke:e1},circle:{fill:e1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:i1,fontSize:12},"guide-title":{font:i1,fontSize:12},"group-title":{font:i1,fontSize:12}},title:{font:i1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:r1,tickColor:r1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},a1=t=>t*(1/3+1),u1=a1(9),s1=a1(10),c1=a1(12),f1="Segoe UI",l1="wf_standard-font, helvetica, arial, sans-serif",h1="#252423",d1="#605E5C",m1="transparent",p1="#118DFF",g1="#DEEFFF",v1=[g1,p1],y1={view:{stroke:m1},background:m1,font:f1,header:{titleFont:l1,titleFontSize:c1,titleColor:h1,labelFont:f1,labelFontSize:s1,labelColor:d1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:d1,labelFontSize:u1,titleFont:l1,titleColor:h1,titleFontSize:c1,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:p1},line:{stroke:p1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:f1,fontSize:u1,fill:d1},arc:{fill:p1},area:{fill:p1,line:!0,opacity:.6},path:{stroke:p1},rect:{fill:p1},point:{fill:p1,filled:!0,size:75},shape:{stroke:p1},symbol:{fill:p1,strokeWidth:1.5,size:50},legend:{titleFont:f1,titleFontWeight:"bold",titleColor:d1,labelFont:f1,labelFontSize:s1,labelColor:d1,symbolType:"circle",symbolSize:75},range:{category:[p1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:v1,heatmap:v1,ordinal:[g1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",p1]}},b1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',w1={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},x1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],$1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function k1({theme:t,background:n}){const e=["white","g10"].includes(t)?"light":"dark",r=w1.gridBg[t],i=w1.textPrimary[t],o=w1.textSecondary[t],a="dark"===e?"#d4bbff":"#6929c4";return{background:n,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:b1,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:w1.layerAccent01[t],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:b1,fill:o,fontWeight:400},"guide-title":{font:b1,fill:o,fontWeight:400}},range:{category:"dark"===e?x1:$1,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const M1=k1({theme:"white",background:"#ffffff"}),A1=k1({theme:"g10",background:"#f4f4f4"}),D1=k1({theme:"g90",background:"#262626"}),S1=k1({theme:"g100",background:"#161616"});var F1=Object.freeze({__proto__:null,carbong10:A1,carbong100:S1,carbong90:D1,carbonwhite:M1,dark:E0,excel:C0,fivethirtyeight:T0,ggplot2:j0,googlecharts:o1,latimes:W0,powerbi:y1,quartz:Y0,urbaninstitute:n1,version:"2.15.0",vox:X0});function E1(t,n){return JSON.stringify(t,function(t){const n=[];return function(e,r){if("object"!=typeof r||null===r)return r;const i=n.indexOf(this)+1;return n.length=i,n.length>t?"[Object]":n.indexOf(r)>=0?"[Circular]":(n.push(r),r)}}(n))}const N1="vg-tooltip-element",C1={offsetX:10,offsetY:10,id:N1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(t,n,e,r){if(D(t))return`[${t.map((t=>n(xt(t)?t:E1(t,e)))).join(", ")}]`;if(S(t)){let i="";const{title:o,image:a,...u}=t;o&&(i+=`<h2>${n(o)}</h2>`),a&&(i+=`<img src="${new URL(n(a),r||location.href).href}">`);const s=Object.keys(u);if(s.length>0){i+="<table>";for(const t of s){let r=u[t];void 0!==r&&(S(r)&&(r=E1(r,e)),i+=`<tr><td class="key">${n(t)}</td><td class="value">${n(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return n(t)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function O1(t,n,{offsetX:e,offsetY:r}){const i=_1({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},n,e,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const t of o)if(z1(i[t],n))return i[t];return i["top-left"]}function _1(t,n,e,r){const i=t.x1-n.width-e,o=(t.x1+t.x2)/2-n.width/2,a=t.x2+e,u=t.y1-n.height-r,s=(t.y1+t.y2)/2-n.height/2,c=t.y2+r;return{top:{x:o,y:u},bottom:{x:o,y:c},left:{x:i,y:s},right:{x:a,y:s},"top-left":{x:i,y:u},"top-right":{x:a,y:u},"bottom-left":{x:i,y:c},"bottom-right":{x:a,y:c}}}function z1(t,n){return t.x>=0&&t.y>=0&&t.x+n.width<=window.innerWidth&&t.y+n.height<=window.innerHeight}function B1(t,n,e){return t.clientX>=n.x&&t.clientX<=n.x+e.width&&t.clientY>=n.y&&t.clientY<=n.y+e.height}class T1{constructor(t){this.options={...C1,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=function(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n".toString().replace(N1,t)}(n);const e=document.head;e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}}tooltipHandler(t,n,e,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}="mark"===this.options.anchor?function(t,n,e,r,i){const{position:o,offsetX:a,offsetY:u}=i,s=function(t,n,e){const r=e.isVoronoi?e.datum.bounds:e.bounds;let i=t.left+n[0]+r.x1,o=t.top+n[1]+r.y1,a=e;for(;a.mark.group;)a=a.mark.group,i+=a.x??0,o+=a.y??0;return{x1:i,x2:i+(r.x2-r.x1),y1:o,y2:o+(r.y2-r.y1)}}(t._el.getBoundingClientRect(),t._origin,e),c=_1(s,r,a,u),f=Array.isArray(o)?o:[o];for(const t of f)if(z1(c[t],r)&&!B1(n,c[t],r))return c[t];return O1(n,r,i)}(t,n,e,this.el.getBoundingClientRect(),this.options):O1(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}
1
+ import{r as t,c as n,h as e,g as r}from"./p-DohbbG4E.js";import{a as i,D as o,t as a}from"./p-u1goCfXU.js";const u=/("(?:[^\\"]|\\.)*")|[:,]/g;function s(t,n={}){const e=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===e?1/0:void 0===n.maxLength?80:n.maxLength;let{replacer:i}=n;return function t(n,o,a){n&&"function"==typeof n.toJSON&&(n=n.toJSON());const s=JSON.stringify(n,i);if(void 0===s)return s;const c=r-o.length-a;if(s.length<=c){const t=s.replace(u,((t,n)=>n||`${t} `));if(t.length<=c)return t}if(null!=i&&(n=JSON.parse(s),i=void 0),"object"==typeof n&&null!==n){const r=o+e,i=[];let a,u,s=0;if(Array.isArray(n)){a="[",u="]";const{length:e}=n;for(;s<e;s++)i.push(t(n[s],r,s===e-1?0:1)||"null")}else{a="{",u="}";const e=Object.keys(n),{length:o}=e;for(;s<o;s++){const a=e[s],u=`${JSON.stringify(a)}: `,c=t(n[a],r,u.length+(s===o-1?0:1));void 0!==c&&i.push(u+c)}}if(i.length>0)return[a,e+i.join(`,\n${r}`),u].join(`\n${o}`)}return s}(t,"",0)}function c(t,n,e){return t.fields=n||[],t.fname=e,t}function f(t){return null==t?null:t.fname}function l(t){return null==t?null:t.fields}function h(t){return 1===t.length?d(t[0]):m(t)}const d=t=>function(n){return n[t]},m=t=>{const n=t.length;return function(e){for(let r=0;r<n;++r)e=e[t[r]];return e}};function p(t){throw Error(t)}function g(t){const n=[],e=t.length;let r,i,o,a=null,u=0,s="";function c(){n.push(s+t.substring(r,i)),s="",r=i+1}for(t+="",r=i=0;i<e;++i)if(o=t[i],"\\"===o)s+=t.substring(r,i++),r=i;else if(o===a)c(),a=null,u=-1;else{if(a)continue;r===u&&'"'===o||r===u&&"'"===o?(r=i+1,a=o):"."!==o||u?"["===o?(i>r&&c(),u=r=i+1):"]"===o&&(u||p("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&p("Access path missing closing bracket: "+t),a&&p("Access path missing closing quote: "+t),i>r&&(i++,c()),n}function v(t,n,e){const r=g(t);return t=1===r.length?r[0]:t,c((e&&e.get||h)(r),[t],n||t)}const y=v("id"),b=c((t=>t),[],"identity"),w=c((()=>0),[],"zero"),x=c((()=>1),[],"one"),$=c((()=>!0),[],"true"),k=c((()=>!1),[],"false");function M(t,n,e){const r=[n].concat([].slice.call(e));console[t].apply(console,r)}function A(t,n){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M,r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=1&&e(n||"error","ERROR",arguments),this},warn(){return r>=2&&e(n||"warn","WARN",arguments),this},info(){return r>=3&&e(n||"log","INFO",arguments),this},debug(){return r>=4&&e(n||"log","DEBUG",arguments),this}}}var D=Array.isArray;function S(t){return t===Object(t)}const F=t=>"__proto__"!==t;function E(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.reduce(((t,n)=>{for(const e in n)"signals"===e?t.signals=C(t.signals,n.signals):N(t,e,n[e],"legend"===e?{layout:1}:"style"===e||null);return t}),{})}function N(t,n,e,r){if(!F(n))return;let i,o;if(S(e)&&!D(e))for(i in o=S(t[n])?t[n]:t[n]={},e)r&&(!0===r||r[i])?N(o,i,e[i]):F(i)&&(o[i]=e[i]);else t[n]=e}function C(t,n){if(null==t)return n;const e={},r=[];function i(t){e[t.name]||(e[t.name]=1,r.push(t))}return n.forEach(i),t.forEach(i),r}function O(t){return t[t.length-1]}function _(t){return null==t||""===t?null:+t}const z=t=>n=>t*Math.exp(n),B=t=>n=>Math.log(t*n),T=t=>n=>Math.sign(n)*Math.log1p(Math.abs(n/t)),P=t=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*t,j=t=>n=>n<0?-Math.pow(-n,t):Math.pow(n,t);function R(t,n,e,r){const i=e(t[0]),o=e(O(t)),a=(o-i)*n;return[r(i-a),r(o-a)]}function L(t,n){return R(t,n,_,b)}function I(t,n){var e=Math.sign(t[0]);return R(t,n,B(e),z(e))}function q(t,n,e){return R(t,n,j(e),j(1/e))}function U(t,n,e){return R(t,n,T(e),P(e))}function W(t,n,e,r,i){const o=r(t[0]),a=r(O(t)),u=null!=n?r(n):(o+a)/2;return[i(u+(o-u)*e),i(u+(a-u)*e)]}function H(t,n,e){return W(t,n,e,_,b)}function G(t,n,e){const r=Math.sign(t[0]);return W(t,n,e,B(r),z(r))}function Y(t,n,e,r){return W(t,n,e,j(r),j(1/r))}function V(t,n,e,r){return W(t,n,e,T(r),P(r))}function X(t){return 1+~~(new Date(t).getMonth()/3)}function J(t){return 1+~~(new Date(t).getUTCMonth()/3)}function K(t){return null!=t?D(t)?t:[t]:[]}function Q(t,n,e){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function Z(t){return"function"==typeof t}function tt(t,n,e){e=e||{},n=K(n)||[];const r=[],i=[],o={},a=e.comparator||et;return K(t).forEach(((t,a)=>{null!=t&&(r.push("descending"===n[a]?-1:1),i.push(t=Z(t)?t:v(t,null,e)),(l(t)||[]).forEach((t=>o[t]=1)))})),0===i.length?null:c(a(i,r),Object.keys(o))}const nt=(t,n)=>(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0),et=(t,n)=>1===t.length?rt(t[0],n[0]):it(t,n,t.length),rt=(t,n)=>function(e,r){return nt(t(e),t(r))*n},it=(t,n,e)=>(n.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++u<e;)o=t[u],a=nt(o(r),o(i));return a*n[u]});function ot(t){return Z(t)?t:()=>t}function at(t,n){let e;return r=>{e&&clearTimeout(e),e=setTimeout((()=>(n(r),e=null)),t)}}function ut(t){for(let n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r],n)t[e]=n[e];return t}function st(t,n){let e,r,i,o,a=0;if(t&&(e=t.length))if(null==n){for(r=t[a];a<e&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<e;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=n(t[a]);a<e&&(null==r||r!=r);r=n(t[++a]));for(i=o=r;a<e;++a)r=n(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function ct(t,n){const e=t.length;let r,i,o,a,u,s=-1;if(null==n){for(;++s<e;)if(i=t[s],null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=t[s],null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}else{for(;++s<e;)if(i=n(t[s],s,t),null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=n(t[s],s,t),null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}return[a,u]}function ft(t,n){return Object.hasOwn(t,n)}const lt={};function ht(t){let n,e={};function r(t){return ft(e,t)&&e[t]!==lt}const i={size:0,empty:0,object:e,has:r,get:t=>r(t)?e[t]:void 0,set(t,n){return r(t)||(++i.size,e[t]===lt&&--i.empty),e[t]=n,this},delete(t){return r(t)&&(--i.size,++i.empty,e[t]=lt),this},clear(){i.size=i.empty=0,i.object=e={}},test(t){return arguments.length?(n=t,i):n},clean(){const t={};let r=0;for(const i in e){const o=e[i];o===lt||n&&n(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=e=t}};return t&&Object.keys(t).forEach((n=>{i.set(n,t[n])})),i}function dt(t,n,e,r,i,o){if(!e&&0!==e)return o;const a=+e;let u,s=t[0],c=O(t);c<s&&(u=s,s=c,c=u),u=Math.abs(n-s);const f=Math.abs(c-n);return u<f&&u<=a?r:f<=a?i:o}function mt(t,n,e){const r=t.prototype=Object.create(n.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),ut(r,e)}function pt(t,n,e,r){let i,o=n[0],a=n[n.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((e=void 0===e||e)?o<=t:o<t)&&(r?t<=a:t<a)}function gt(t){return"boolean"==typeof t}function vt(t){return"[object Date]"===Object.prototype.toString.call(t)}function yt(t){return t&&Z(t[Symbol.iterator])}function bt(t){return"number"==typeof t}function wt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function xt(t){return"string"==typeof t}function $t(t,n,e){t&&(t=n?K(t).map((t=>t.replace(/\\(.)/g,"$1"))):K(t));const r=t&&t.length,i=e&&e.get||h,o=t=>i(n?[t]:g(t));let a;if(r)if(1===r){const n=o(t[0]);a=function(t){return""+n(t)}}else{const n=t.map(o);a=function(t){let e=""+n[0](t),i=0;for(;++i<r;)e+="|"+n[i](t);return e}}else a=function(){return""};return c(a,t,"key")}function kt(t,n){const e=t[0],r=O(t),i=+n;return i?1===i?r:e+i*(r-e):e}function Mt(t){let n,e,r;t=+t||1e4;const i=()=>{n={},e={},r=0},o=(i,o)=>(++r>t&&(e=n,n={},r=1),n[i]=o);return i(),{clear:i,has:t=>ft(n,t)||ft(e,t),get:t=>ft(n,t)?n[t]:ft(e,t)?o(t,e[t]):void 0,set:(t,e)=>ft(n,t)?n[t]=e:o(t,e)}}function At(t,n,e,r){const i=n.length,o=e.length;if(!o)return n;if(!i)return e;const a=r||new n.constructor(i+o);let u=0,s=0,c=0;for(;u<i&&s<o;++c)a[c]=t(n[u],e[s])>0?e[s++]:n[u++];for(;u<i;++u,++c)a[c]=n[u];for(;s<o;++s,++c)a[c]=e[s];return a}function Dt(t,n){let e="";for(;--n>=0;)e+=t;return e}function St(t,n,e,r){const i=e||" ",o=t+"",a=n-o.length;return a<=0?o:"left"===r?Dt(i,a)+o:"center"===r?Dt(i,~~(a/2))+o+Dt(i,Math.ceil(a/2)):o+Dt(i,a)}function Ft(t){return t&&O(t)-t[0]||0}function Et(t){return D(t)?"["+t.map(Et)+"]":S(t)||xt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function Nt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t||!t)}const Ct=t=>bt(t)||vt(t)?t:Date.parse(t);function Ot(t,n){return n=n||Ct,null==t||""===t?null:n(t)}function _t(t){return null==t||""===t?null:t+""}function zt(t){const n={},e=t.length;for(let r=0;r<e;++r)n[t[r]]=!0;return n}function Bt(t,n,e,r){const i=null!=r?r:"…",o=t+"",a=o.length,u=Math.max(0,n-i.length);return a<=n?o:"left"===e?i+o.slice(a-u):"center"===e?o.slice(0,Math.ceil(u/2))+i+o.slice(a-~~(u/2)):o.slice(0,u)+i}function Tt(t,n,e){if(t)if(n){const r=t.length;for(let i=0;i<r;++i){const r=n(t[i]);r&&e(r,i,t)}}else t.forEach(e)}var Pt={},jt={};function Rt(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function Lt(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function It(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function qt(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,s=o<=0,c=!1;function f(){if(s)return jt;if(c)return c=!1,Pt;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(n=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(n=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=f())!==jt;){for(var l=[];r!==Pt&&r!==jt;)l.push(r),r=f();n&&null==(l=n(l,u++))||i.push(l)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return a(n[t])})).join(t)}))}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?function(t){var n=t.getUTCHours(),e=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+It(-t,6):t>9999?"+"+It(t,6):It(t,4)}(t.getUTCFullYear())+"-"+It(t.getUTCMonth()+1,2)+"-"+It(t.getUTCDate(),2)+(i?"T"+It(n,2)+":"+It(e,2)+":"+It(r,2)+"."+It(i,3)+"Z":r?"T"+It(n,2)+":"+It(e,2)+":"+It(r,2)+"Z":e||n?"T"+It(n,2)+":"+It(e,2)+"Z":"")}(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=Rt(t);return function(r,i){return n(e(r),i,t)}}(t,n):Rt(t)}));return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=Lt(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=Lt(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function Ut(t){return t}function Wt(t,n){return"string"==typeof n&&(n=t.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(n){return Ht(t,n)}))}:Ht(t,n)}function Ht(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,o=Gt(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:e,properties:i,geometry:o}:{type:"Feature",id:e,bbox:r,properties:i,geometry:o}}function Gt(t,n){var e=function(t){if(null==t)return Ut;var n,e,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,u){u||(n=e=0);var s=2,c=t.length,f=new Array(c);for(f[0]=(n+=t[0])*r+o,f[1]=(e+=t[1])*i+a;s<c;)f[s]=t[s],++s;return f}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)n.push(e(i[o],o));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,a)}function o(t){return e(t)}function a(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function u(t){for(var n=a(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(u)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=o(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(o);break;case"LineString":e=a(n.arcs);break;case"MultiLineString":e=n.arcs.map(a);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function Yt(t,n){var e={},r={},i={},o=[],a=-1;function u(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach((function(t){e[t<0?~t:t]=1})),o.push(i)}}return n.forEach((function(e,r){var i,o=t.arcs[e<0?~e:e];o.length<3&&!o[1][0]&&!o[1][1]&&(i=n[++a],n[a]=e,n[r]=i)})),n.forEach((function(n){var e,o,a=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];return t.transform?(e=[0,0],r.forEach((function(t){e[0]+=t[0],e[1]+=t[1]}))):e=r[r.length-1],n<0?[e,i]:[i,e]}(n),u=a[0],s=a[1];if(e=i[u])if(delete i[e.end],e.push(n),e.end=s,o=r[s]){delete r[o.start];var c=o===e?e:e.concat(o);r[c.start=e.start]=i[c.end=o.end]=c}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=u,o=i[u]){delete i[o.end];var f=o===e?e:o.concat(e);r[f.start=o.start]=i[f.end=e.end]=f}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=u]=i[e.end=s]=e})),u(i,r),u(r,i),n.forEach((function(t){e[t<0?~t:t]||o.push([t])})),o}function Vt(t){return Gt(t,Xt.apply(this,arguments))}function Xt(t,n,e){var r,i,o;if(arguments.length>1)r=function(t,n,e){var r,i=[],o=[];function a(t){var n=t<0?~t:t;(o[n]||(o[n]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":u(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(n.arcs)}}(n),o.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:Yt(t,r)}}function Jt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Kt(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Qt(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length?(n=Jt,e=(n,e)=>Jt(t(n),e),r=(n,e)=>t(n)-e):(n=t===Jt||t===Kt?t:Zt,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<=0?i=n+1:o=n}while(i<o)}return i}}}function Zt(){return 0}function tn(t){return null===t?NaN:+t}const nn=Qt(Jt),en=nn.right,rn=nn.left;Qt(tn);class on{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class an extends Map{constructor(t,n=ln){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(sn(this,t))}has(t){return super.has(sn(this,t))}set(t,n){return super.set(cn(this,t),n)}delete(t){return super.delete(fn(this,t))}}class un extends Set{constructor(t,n=ln){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(sn(this,t))}add(t){return super.add(cn(this,t))}delete(t){return super.delete(fn(this,t))}}function sn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function cn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function fn({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function ln(t){return null!==t&&"object"==typeof t?t.valueOf():t}function hn(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}const dn=Math.sqrt(50),mn=Math.sqrt(10),pn=Math.sqrt(2);function gn(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=dn?10:o>=mn?5:o>=pn?2:1;let u,s,c;return i<0?(c=Math.pow(10,-i)/a,u=Math.round(t*c),s=Math.round(n*c),u/c<t&&++u,s/c>n&&--s,c=-c):(c=Math.pow(10,i)*a,u=Math.round(t/c),s=Math.round(n/c),u*c<t&&++u,s*c>n&&--s),s<u&&.5<=e&&e<2?gn(t,n,2*e):[u,s,c]}function vn(t,n,e){if(!((e=+e)>0))return[];if((t=+t)==(n=+n))return[t];const r=n<t,[i,o,a]=r?gn(n,t,e):gn(t,n,e);if(!(o>=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)s[t]=(o-t)/-a;else for(let t=0;t<u;++t)s[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)s[t]=(i+t)/-a;else for(let t=0;t<u;++t)s[t]=(i+t)*a;return s}function yn(t,n,e){return gn(t=+t,n=+n,e=+e)[2]}function bn(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?yn(n,t,e):yn(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function wn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function xn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function $n(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?hn:function(t=Jt){if(t===Jt)return hn;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),s=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);$n(t,n,Math.max(e,Math.floor(n-a*s/o+c)),Math.min(r,Math.floor(n+(o-a)*s/o+c)),i)}const o=t[n];let a=e,u=r;for(kn(t,e,n),i(t[r],o)>0&&kn(t,e,r);a<u;){for(kn(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?kn(t,e,u):(++u,kn(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function kn(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function Mn(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return xn(t);if(n>=1)return wn(t);var r,i=(r-1)*n,o=Math.floor(i),a=wn($n(t,o).subarray(0,o+1));return a+(xn(t.subarray(o+1))-a)*(i-o)}}function An(t,n,e=tn){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function Dn(t,n){return Mn(t,.5,n)}function Sn(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function Fn(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function En(t){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}function Nn(t){return t instanceof un?t:new un(t)}function Cn(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function On(t){return(t=Cn(Math.abs(t)))?t[1]:NaN}var _n,zn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Bn(t){if(!(n=zn.exec(t)))throw new Error("invalid format: "+t);var n;return new Tn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Tn(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Pn(t,n){var e=Cn(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Bn.prototype=Tn.prototype,Tn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var jn={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>Pn(100*t,n),r:Pn,s:function(t,n){var e=Cn(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(_n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cn(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Rn(t){return t}var Ln,In,qn,Un=Array.prototype.map,Wn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Hn(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Rn:(n=Un.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Rn:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Un.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Bn(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):jn[y]||(void 0===g&&(g=12),v=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?s:"",x=jn[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,h=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==l&&(M=!1),h=(M?"("===l?l:c:"-"===l||"("===l?"":l)+h,k=("s"===y?Wn[8+_n/3]:"")+k+(M&&"("===l?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!d&&(t=r(t,1/0));var A=h.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&d&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=h+t+k+D;break;case"=":t=h+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+h+t+k+D.slice(A);break;default:t=D+h+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:l,formatPrefix:function(t,n){var e=l(((t=Bn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(On(n)/3))),i=Math.pow(10,-r),o=Wn[8+r/3];return function(t){return e(i*t)+o}}}}Ln=Hn({thousands:",",grouping:[3],currency:["$",""]}),In=Ln.format,qn=Ln.formatPrefix;const Gn=new Date,Yn=new Date;function Vn(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>Vn((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Gn.setTime(+n),Yn.setTime(+r),t(Gn),t(Yn),Math.floor(e(Gn,Yn))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Xn=Vn((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Xn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vn((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Xn:null);const Jn=1e3,Kn=6e4,Qn=36e5,Zn=864e5,te=6048e5,ne=Vn((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*Jn)}),((t,n)=>(n-t)/Jn),(t=>t.getUTCSeconds())),ee=Vn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jn)}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getMinutes())),re=Vn((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getUTCMinutes())),ie=Vn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jn-t.getMinutes()*Kn)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getHours())),oe=Vn((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getUTCHours())),ae=Vn((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kn)/Zn),(t=>t.getDate()-1)),ue=Vn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/Zn),(t=>t.getUTCDate()-1));function se(t){return Vn((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Kn)/te))}Vn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/Zn),(t=>Math.floor(t/Zn)));const ce=se(0);function fe(t){return Vn((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/te))}se(1),se(2),se(3),se(4),se(5),se(6);const le=fe(0);fe(1),fe(2),fe(3),fe(4),fe(5),fe(6);const he=Vn((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),de=Vn((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),me=Vn((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));me.every=t=>isFinite(t=Math.floor(t))&&t>0?Vn((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const pe=Vn((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));pe.every=t=>isFinite(t=Math.floor(t))&&t>0?Vn((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const ge="year",ve="quarter",ye="month",be="week",we="date",xe="day",$e="dayofyear",ke="hours",Me="minutes",Ae="seconds",De="milliseconds",Se=[ge,ve,ye,be,we,xe,$e,ke,Me,Ae,De],Fe=Se.reduce(((t,n,e)=>(t[n]=1+e,t)),{});function Ee(t){const n=K(t).slice(),e={};return n.length||p("Missing time unit."),n.forEach((t=>{ft(Fe,t)?e[t]=1:p(`Invalid time unit: ${t}.`)})),(e[be]||e[xe]?1:0)+(e[ve]||e[ye]||e[we]?1:0)+(e[$e]?1:0)>1&&p(`Incompatible time units: ${t}`),n.sort(((t,n)=>Fe[t]-Fe[n])),n}const Ne={[ge]:"%Y ",[ve]:"Q%q ",[ye]:"%b ",[we]:"%d ",[be]:"W%U ",[xe]:"%a ",[$e]:"%j ",[ke]:"%H:00",[Me]:"00:%M",[Ae]:":%S",[De]:".%L",[`${ge}-${ye}`]:"%Y-%m ",[`${ge}-${ye}-${we}`]:"%Y-%m-%d ",[`${ke}-${Me}`]:"%H:%M"};function Ce(t,n){const e=ut({},Ne,n),r=Ee(t),i=r.length;let o,a,u="",s=0;for(s=0;s<i;)for(o=r.length;o>s;--o)if(a=r.slice(s,o).join("-"),null!=e[a]){u+=e[a],s=o;break}return u.trim()}const Oe=new Date;function _e(t){return Oe.setFullYear(t),Oe.setMonth(0),Oe.setDate(1),Oe.setHours(0,0,0,0),Oe}function ze(t){return Te(new Date(t))}function Be(t){return Pe(new Date(t))}function Te(t){return ae.count(_e(t.getFullYear())-1,t)}function Pe(t){return ce.count(_e(t.getFullYear())-1,t)}function je(t){return _e(t).getDay()}function Re(t,n,e,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,n,e,r,i,o,a);return u.setFullYear(t),u}return new Date(t,n,e,r,i,o,a)}function Le(t){return qe(new Date(t))}function Ie(t){return Ue(new Date(t))}function qe(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return ue.count(n-1,t)}function Ue(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return le.count(n-1,t)}function We(t){return Oe.setTime(Date.UTC(t,0,1)),Oe.getUTCDay()}function He(t,n,e,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,n,e,r,i,o,a));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(t,n,e,r,i,o,a))}function Ge(t,n,e,r,i){const o=n||1,a=O(t),u=(t,n,i)=>function(t,n,e,r){const i=e<=1?t:r?(n,i)=>r+e*Math.floor((t(n,i)-r)/e):(n,r)=>e*Math.floor(t(n,r)/e);return n?(t,e)=>n(i(t,e),e):i}(e[i=i||t],r[i],t===a&&o,n),s=new Date,c=zt(t),f=c[ge]?u(ge):ot(2012),l=c[ye]?u(ye):c[ve]?u(ve):w,h=c[be]&&c[xe]?u(xe,1,be+xe):c[be]?u(be,1):c[xe]?u(xe,1):c[we]?u(we,1):c[$e]?u($e,1):x,d=c[ke]?u(ke):w,m=c[Me]?u(Me):w,p=c[Ae]?u(Ae):w,g=c[De]?u(De):w;return function(t){s.setTime(+t);const n=f(s);return i(n,l(s),h(s,n),d(s),m(s),p(s),g(s))}}function Ye(t,n,e){return n+7*t-(e+6)%7}const Ve={[ge]:t=>t.getFullYear(),[ve]:t=>Math.floor(t.getMonth()/3),[ye]:t=>t.getMonth(),[we]:t=>t.getDate(),[ke]:t=>t.getHours(),[Me]:t=>t.getMinutes(),[Ae]:t=>t.getSeconds(),[De]:t=>t.getMilliseconds(),[$e]:t=>Te(t),[be]:t=>Pe(t),[be+xe]:(t,n)=>Ye(Pe(t),t.getDay(),je(n)),[xe]:(t,n)=>Ye(1,t.getDay(),je(n))},Xe={[ve]:t=>3*t,[be]:(t,n)=>Ye(t,0,je(n))};function Je(t,n){return Ge(t,n||1,Ve,Xe,Re)}const Ke={[ge]:t=>t.getUTCFullYear(),[ve]:t=>Math.floor(t.getUTCMonth()/3),[ye]:t=>t.getUTCMonth(),[we]:t=>t.getUTCDate(),[ke]:t=>t.getUTCHours(),[Me]:t=>t.getUTCMinutes(),[Ae]:t=>t.getUTCSeconds(),[De]:t=>t.getUTCMilliseconds(),[$e]:t=>qe(t),[be]:t=>Ue(t),[xe]:(t,n)=>Ye(1,t.getUTCDay(),We(n)),[be+xe]:(t,n)=>Ye(Ue(t),t.getUTCDay(),We(n))},Qe={[ve]:t=>3*t,[be]:(t,n)=>Ye(t,0,We(n))};function Ze(t,n){return Ge(t,n||1,Ke,Qe,He)}const tr={[ge]:me,[ve]:he.every(3),[ye]:he,[be]:ce,[we]:ae,[xe]:ae,[$e]:ae,[ke]:ie,[Me]:ee,[Ae]:ne,[De]:Xn},nr={[ge]:pe,[ve]:de.every(3),[ye]:de,[be]:le,[we]:ue,[xe]:ue,[$e]:ue,[ke]:oe,[Me]:re,[Ae]:ne,[De]:Xn};function er(t){return tr[t]}function rr(t){return nr[t]}function ir(t,n,e){return t?t.offset(n,e):void 0}function or(t,n,e){return ir(er(t),n,e)}function ar(t,n,e){return ir(rr(t),n,e)}function ur(t,n,e,r){return t?t.range(n,e,r):void 0}function sr(t,n,e,r){return ur(er(t),n,e,r)}function cr(t,n,e,r){return ur(rr(t),n,e,r)}const fr=31536e6,lr=[ge,ye,we,ke,Me,Ae,De],hr=lr.slice(0,-1),dr=hr.slice(0,-1),mr=dr.slice(0,-1),pr=mr.slice(0,-1),gr=[ge,ye],vr=[ge],yr=[[hr,1,1e3],[hr,5,5e3],[hr,15,15e3],[hr,30,3e4],[dr,1,6e4],[dr,5,3e5],[dr,15,9e5],[dr,30,18e5],[mr,1,36e5],[mr,3,108e5],[mr,6,216e5],[mr,12,432e5],[pr,1,864e5],[[ge,be],1,6048e5],[gr,1,2592e6],[gr,3,7776e6],[vr,1,fr]];function br(t){const n=t.extent,e=t.maxbins||40,r=Math.abs(Ft(n))/e;let i,o,a=Qt((t=>t[2])).right(yr,r);return a===yr.length?(i=vr,o=bn(n[0]/fr,n[1]/fr,e)):a?(a=yr[r/yr[a-1][2]<yr[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=lr,o=Math.max(bn(n[0],n[1],e),1)),{units:i,step:o}}var wr=new Date,xr=new Date;function $r(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return $r((function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return wr.setTime(+n),xr.setTime(+r),t(wr),t(xr),Math.floor(e(wr,xr))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var kr=864e5,Mr=6048e5,Ar=$r((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/kr}),(function(t){return t.getDate()-1}));function Dr(t){return $r((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Mr}))}var Sr=Dr(0),Fr=Dr(1);Dr(2),Dr(3);var Er=Dr(4);Dr(5),Dr(6);var Nr=$r((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Nr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$r((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Cr=$r((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/kr}),(function(t){return t.getUTCDate()-1}));function Or(t){return $r((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/Mr}))}var _r=Or(0),zr=Or(1);Or(2),Or(3);var Br=Or(4);Or(5),Or(6);var Tr=$r((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function Pr(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function jr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Rr(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function Lr(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Qr(i),f=Zr(i),l=Qr(o),h=Zr(o),d=Qr(a),m=Zr(a),p=Qr(u),g=Zr(u),v=Qr(s),y=Zr(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:wi,e:wi,f:Ai,g:Ti,G:ji,H:xi,I:$i,j:ki,L:Mi,m:Di,M:Si,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:uo,s:so,S:Fi,u:Ei,U:Ni,V:Oi,w:_i,W:zi,x:null,X:null,y:Bi,Y:Pi,Z:Ri,"%":ao},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Li,e:Li,f:Hi,g:eo,G:io,H:Ii,I:qi,j:Ui,L:Wi,m:Gi,M:Yi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:uo,s:so,S:Vi,u:Xi,U:Ji,V:Qi,w:Zi,W:to,x:null,X:null,y:no,Y:ro,Z:oo,"%":ao},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=m.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:fi,e:fi,f:gi,g:ai,G:oi,H:hi,I:hi,j:li,L:pi,m:ci,M:di,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=f.get(r[0].toLowerCase()),e+r[0].length):-1},q:si,Q:yi,s:bi,S:mi,u:ni,U:ei,V:ri,w:ti,W:ii,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:ai,Y:oi,Z:ui,"%":vi};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Gr[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Rr(1900,void 0,1);if(M(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(n&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=jr(Rr(o.y,0,1))).getUTCDay(),r=i>4||0===i?zr.ceil(r):zr(r),r=Cr.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Pr(Rr(o.y,0,1))).getDay(),r=i>4||0===i?Fr.ceil(r):Fr(r),r=Ar.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?jr(Rr(o.y,0,1)).getUTCDay():Pr(Rr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,jr(o)):Pr(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Gr?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}Tr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?$r((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var Ir,qr,Ur,Wr,Hr,Gr={"-":"",_:" ",0:"0"},Yr=/^\s*\d+/,Vr=/^%/,Xr=/[\\^$*+?|[\]().{}]/g;function Jr(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Kr(t){return t.replace(Xr,"\\$&")}function Qr(t){return new RegExp("^(?:"+t.map(Kr).join("|")+")","i")}function Zr(t){return new Map(t.map(((t,n)=>[t.toLowerCase(),n])))}function ti(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function ni(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function ei(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function ri(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function ii(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function oi(t,n,e){var r=Yr.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function ai(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function ui(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function si(t,n,e){var r=Yr.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function ci(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function fi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function li(t,n,e){var r=Yr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function hi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function di(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function mi(t,n,e){var r=Yr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function pi(t,n,e){var r=Yr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function gi(t,n,e){var r=Yr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function vi(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function yi(t,n,e){var r=Yr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function bi(t,n,e){var r=Yr.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function wi(t,n){return Jr(t.getDate(),n,2)}function xi(t,n){return Jr(t.getHours(),n,2)}function $i(t,n){return Jr(t.getHours()%12||12,n,2)}function ki(t,n){return Jr(1+Ar.count(Nr(t),t),n,3)}function Mi(t,n){return Jr(t.getMilliseconds(),n,3)}function Ai(t,n){return Mi(t,n)+"000"}function Di(t,n){return Jr(t.getMonth()+1,n,2)}function Si(t,n){return Jr(t.getMinutes(),n,2)}function Fi(t,n){return Jr(t.getSeconds(),n,2)}function Ei(t){var n=t.getDay();return 0===n?7:n}function Ni(t,n){return Jr(Sr.count(Nr(t)-1,t),n,2)}function Ci(t){var n=t.getDay();return n>=4||0===n?Er(t):Er.ceil(t)}function Oi(t,n){return t=Ci(t),Jr(Er.count(Nr(t),t)+(4===Nr(t).getDay()),n,2)}function _i(t){return t.getDay()}function zi(t,n){return Jr(Fr.count(Nr(t)-1,t),n,2)}function Bi(t,n){return Jr(t.getFullYear()%100,n,2)}function Ti(t,n){return Jr((t=Ci(t)).getFullYear()%100,n,2)}function Pi(t,n){return Jr(t.getFullYear()%1e4,n,4)}function ji(t,n){var e=t.getDay();return Jr((t=e>=4||0===e?Er(t):Er.ceil(t)).getFullYear()%1e4,n,4)}function Ri(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Jr(n/60|0,"0",2)+Jr(n%60,"0",2)}function Li(t,n){return Jr(t.getUTCDate(),n,2)}function Ii(t,n){return Jr(t.getUTCHours(),n,2)}function qi(t,n){return Jr(t.getUTCHours()%12||12,n,2)}function Ui(t,n){return Jr(1+Cr.count(Tr(t),t),n,3)}function Wi(t,n){return Jr(t.getUTCMilliseconds(),n,3)}function Hi(t,n){return Wi(t,n)+"000"}function Gi(t,n){return Jr(t.getUTCMonth()+1,n,2)}function Yi(t,n){return Jr(t.getUTCMinutes(),n,2)}function Vi(t,n){return Jr(t.getUTCSeconds(),n,2)}function Xi(t){var n=t.getUTCDay();return 0===n?7:n}function Ji(t,n){return Jr(_r.count(Tr(t)-1,t),n,2)}function Ki(t){var n=t.getUTCDay();return n>=4||0===n?Br(t):Br.ceil(t)}function Qi(t,n){return t=Ki(t),Jr(Br.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function Zi(t){return t.getUTCDay()}function to(t,n){return Jr(zr.count(Tr(t)-1,t),n,2)}function no(t,n){return Jr(t.getUTCFullYear()%100,n,2)}function eo(t,n){return Jr((t=Ki(t)).getUTCFullYear()%100,n,2)}function ro(t,n){return Jr(t.getUTCFullYear()%1e4,n,4)}function io(t,n){var e=t.getUTCDay();return Jr((t=e>=4||0===e?Br(t):Br.ceil(t)).getUTCFullYear()%1e4,n,4)}function oo(){return"+0000"}function ao(){return"%"}function uo(t){return+t}function so(t){return Math.floor(+t/1e3)}function co(t){const n={};return e=>n[e]||(n[e]=t(e))}function fo(t){const n=co(t.format),e=t.formatPrefix;return{format:n,formatPrefix:e,formatFloat(t){const e=Bn(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,n){return e=>{const r=t(e),i=r.indexOf(n);if(i<0)return r;let o=function(t,n){let e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if(e=t.charCodeAt(r),e>=48&&e<=57)return r+1}(r,i);const a=o<r.length?r.slice(o):"";for(;--o>i;)if("0"!==r[o]){++o;break}return r.slice(0,o)+a}}(n(e),n(".1f")(1)[1])}return n(e)},formatSpan(t,r,i,o){o=Bn(null==o?",f":o);const a=bn(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(On(n)/3)))-On(Math.abs(t)))}(a,u))||(o.precision=s),e(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,On(n)-On(t))+1}(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=function(t){return Math.max(0,-On(Math.abs(t)))}(a))||(o.precision=s-2*("%"===o.type))}return n(o)}}}let lo,ho;function mo(){return lo=fo({format:In,formatPrefix:qn})}function po(t){return fo(Hn(t))}function go(t){return arguments.length?lo=po(t):lo}function vo(t,n,e){S(e=e||{})||p(`Invalid time multi-format specifier: ${e}`);const r=n(Ae),i=n(Me),o=n(ke),a=n(we),u=n(be),s=n(ye),c=n(ve),f=n(ge),l=t(e[De]||".%L"),h=t(e[Ae]||":%S"),d=t(e[Me]||"%I:%M"),m=t(e[ke]||"%I %p"),g=t(e[we]||e[xe]||"%a %d"),v=t(e[be]||"%b %d"),y=t(e[ye]||"%B"),b=t(e[ve]||"%B"),w=t(e[ge]||"%Y");return t=>(r(t)<t?l:i(t)<t?h:o(t)<t?d:a(t)<t?m:s(t)<t?u(t)<t?g:v:f(t)<t?c(t)<t?y:b:w)(t)}function yo(t){const n=co(t.format),e=co(t.utcFormat);return{timeFormat:t=>xt(t)?n(t):vo(n,er,t),utcFormat:t=>xt(t)?e(t):vo(e,rr,t),timeParse:co(t.parse),utcParse:co(t.utcParse)}}function bo(){return ho=yo({format:qr,parse:Ur,utcFormat:Wr,utcParse:Hr})}function wo(t){return yo(Lr(t))}function xo(t){return arguments.length?ho=wo(t):ho}Ir=Lr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),qr=Ir.format,Ur=Ir.parse,Wr=Ir.utcFormat,Hr=Ir.utcParse,mo(),bo();const $o=(t,n)=>ut({},t,n);function ko(t,n){const e=t?po(t):go(),r=n?wo(n):xo();return $o(e,r)}function Mo(t,n){const e=arguments.length;return e&&2!==e&&p("defaultLocale expects either zero or two arguments."),e?$o(go(t),xo(n)):$o(go(),xo())}const Ao=/^(data:|([A-Za-z]+:)?\/\/)/,Do=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,So=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Fo(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n)}async function Eo(t,n){n=ut({},this.options,n);const e=this.fileAccess,r={href:null};let i,o,a;const u=Do.test(t.replace(So,""));null!=t&&"string"==typeof t&&u||p("Sanitize failure, invalid URI: "+Et(t));const s=Ao.test(t);return(a=n.baseURL)&&!s&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!s&&e,i?t=t.slice(7):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),o=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(r.crossOrigin=n.crossOrigin+""),r}function No(t){return t?n=>new Promise(((e,r)=>{t.readFile(n,((t,n)=>{t?r(t):e(n)}))})):Co}async function Co(){p("No file system access.")}function Oo(t){return t?async function(n,e){const r=ut({},this.options.http,e),i=e&&e.response,o=await t(n,r);return o.ok?Z(o[i])?o[i]():o.text():p(o.status+""+o.statusText)}:_o}async function _o(){p("No HTTP fetch method available.")}const zo=t=>!(Number.isNaN(+t)||t instanceof Date),Bo={boolean:Nt,integer:_,number:_,date:Ot,string:_t,unknown:b},To=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>zo(t)&&Number.isInteger(+t),zo,t=>!Number.isNaN(Date.parse(t))],Po=["boolean","integer","number","date"];function jo(t,n){if(!t||!t.length)return"unknown";const e=t.length,r=To.length,i=To.map(((t,n)=>n+1));for(let a,u,s=0,c=0;s<e;++s)for(u=n?t[s][n]:t[s],a=0;a<r;++a)if(i[a]&&null!=(o=u)&&o==o&&!To[a](u)&&(i[a]=0,++c,c===To.length))return"string";var o;return Po[i.reduce(((t,n)=>0===t?n:t),0)-1]}function Ro(t,n){return n.reduce(((n,e)=>(n[e]=jo(t,e),n)),{})}function Lo(t){const n=function(n,e){const r={delimiter:t};return Io(n,e?ut(e,r):r)};return n.responseType="text",n}function Io(t,n){return n.header&&(t=n.header.map(Et).join(n.delimiter)+"\n"+t),qt(n.delimiter).parse(t+"")}function qo(t,n){const e=n&&n.property?v(n.property):b;return!S(t)||(r=t,"function"==typeof Buffer&&Z(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return!D(t)&&yt(t)&&(t=[...t]),n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t),n);var r}Io.responseType="text",qo.responseType="json";const Uo={interior:(t,n)=>t!==n,exterior:(t,n)=>t===n};function Wo(t,n){let e,r,i,o;return t=qo(t,n),n&&n.feature?(e=Wt,i=n.feature):n&&n.mesh?(e=Vt,i=n.mesh,o=Uo[n.filter]):p("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?e(t,r,o):p("Invalid TopoJSON object: "+i),r&&r.features||[r]}Wo.responseType="json";const Ho={dsv:Io,csv:Lo(","),tsv:Lo("\t"),json:qo,topojson:Wo};function Go(t,n){return arguments.length>1?(Ho[t]=n,this):ft(Ho,t)?Ho[t]:null}function Yo(t){const n=Go(t);return n&&n.responseType||"text"}function Vo(t,n,e,r){const i=Go((n=n||{}).type||"json");return i||p("Unknown data format type: "+n.type),t=i(t,n),n.parse&&function(t,n,e,r){if(!t.length)return;const i=xo();e=e||i.timeParse,r=r||i.utcParse;let o,a,u,s,c,f,l=t.columns||Object.keys(t[0]);"auto"===n&&(n=Ro(t,l)),l=Object.keys(n);const h=l.map((t=>{const i=n[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:")))return o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?r:e)(a);if(!Bo[i])throw Error("Illegal format pattern: "+t+":"+i);return Bo[i]}));for(u=0,c=t.length,f=l.length;u<c;++u)for(o=t[u],s=0;s<f;++s)a=l[s],o[a]=h[s](o[a])}(t,n.parse,e,r),ft(t,"columns")&&delete t.columns,t}const Xo=function(t){return n=>({options:n||{},sanitize:Eo,load:Fo,fileAccess:!1,file:No(null),http:Oo(t)})}("undefined"!=typeof fetch&&fetch);function Jo(t){const n=t||b,e=[],r={};return e.add=t=>{const i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=t=>{const i=n(t);if(r[i]){r[i]=0;const n=e.indexOf(t);n>=0&&e.splice(n,1)}return e},e}async function Ko(t,n){try{await n(t)}catch(n){t.error(n)}}const Qo=Symbol("vega_id");let Zo=1;function ta(t){return!(!t||!na(t))}function na(t){return t[Qo]}function ea(t,n){return t[Qo]=n,t}function ra(t){const n=t===Object(t)?t:{data:t};return na(n)?n:ea(n,Zo++)}function ia(t){return oa(t,ra({}))}function oa(t,n){for(const e in t)n[e]=t[e];return n}function aa(t,n){return ea(n,na(t))}function ua(t,n){return t?n?(e,r)=>t(e,r)||na(n(e))-na(n(r)):(n,e)=>t(n,e)||na(n)-na(e):null}function sa(t){return t&&t.constructor===ca}function ca(){const t=[],n=[],e=[],r=[],i=[];let o=null,a=!1;return{constructor:ca,insert(n){const e=K(n),r=e.length;for(let n=0;n<r;++n)t.push(e[n]);return this},remove(t){const e=Z(t)?r:n,i=K(t),o=i.length;for(let t=0;t<o;++t)e.push(i[t]);return this},modify(t,n,r){const o={field:n,value:ot(r)};return Z(t)?(o.filter=t,i.push(o)):(o.tuple=t,e.push(o)),this},encode(t,n){return Z(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(u,s){const c={},f={};let l,h,d,m,p,g;for(l=0,h=s.length;l<h;++l)c[na(s[l])]=1;for(l=0,h=n.length;l<h;++l)p=n[l],c[na(p)]=-1;for(l=0,h=r.length;l<h;++l)m=r[l],s.forEach((t=>{m(t)&&(c[na(t)]=-1)}));for(l=0,h=t.length;l<h;++l)p=t[l],g=na(p),c[g]?c[g]=1:u.add.push(ra(t[l]));for(l=0,h=s.length;l<h;++l)p=s[l],c[na(p)]<0&&u.rem.push(p);function v(t,n,e){e?t[n]=e(t):u.encode=n,a||(f[na(t)]=t)}for(l=0,h=e.length;l<h;++l)d=e[l],p=d.tuple,m=d.field,g=c[na(p)],g>0&&(v(p,m,d.value),u.modifies(m));for(l=0,h=i.length;l<h;++l)d=i[l],m=d.filter,s.forEach((t=>{m(t)&&c[na(t)]>0&&v(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=n.length||r.length?s.filter((t=>c[na(t)]>0)):s.slice();else for(g in f)u.mod.push(f[g]);return(o||null==o&&(n.length||r.length))&&u.clean(!0),u}}}const fa="_:mod:_";function la(){Object.defineProperty(this,fa,{writable:!0,value:{}})}la.prototype={set(t,n,e,r){const i=this,o=i[t],a=i[fa];return null!=n&&n>=0?(o[n]!==e||r)&&(o[n]=e,a[n+":"+t]=-1,a[t]=-1):(o!==e||r)&&(i[t]=e,a[t]=D(e)?1+e.length:-1),i},modified(t,n){const e=this[fa];if(!arguments.length){for(const t in e)if(e[t])return!0;return!1}if(D(t)){for(let n=0;n<t.length;++n)if(e[t[n]])return!0;return!1}return null!=n&&n>=0?n+1<e[t]||!!e[n+":"+t]:!!e[t]},clear(){return this[fa]={},this}};let ha=0;const da=new la;function ma(t,n,e,r){this.id=++ha,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}function pa(t){return function(n){const e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}ma.prototype={targets(){return this._targets||(this._targets=Jo(y))},set(t){return this.value!==t?(this.value=t,1):0},skip:pa(1),modified:pa(2),parameters(t,n,e){n=!1!==n;const r=this._argval=this._argval||new la,i=this._argops=this._argops||[],o=[];let a,u,s,c;const f=(t,e,a)=>{a instanceof ma?(a!==this&&(n&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:e})):r.set(t,e,a)};for(a in t)if(u=t[a],"pulse"===a)K(u).forEach((t=>{t instanceof ma?t!==this&&(t.targets().add(this),o.push(t)):p("Pulse parameters must be operator instances.")})),this.source=u;else if(D(u))for(r.set(a,-1,Array(s=u.length)),c=0;c<s;++c)f(a,c,u[c]);else f(a,-1,u);return this.marshall().clear(),e&&(i.initonly=!0),o},marshall(t){const n=this._argval||da,e=this._argops;let r,i,o,a;if(e){const u=e.length;for(i=0;i<u;++i)r=e[i],o=r.op,a=o.modified()&&o.stamp===t,n.set(r.name,r.index,o.value,a);if(e.initonly){for(i=0;i<u;++i)r=e[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return n},detach(){const t=this._argops;let n,e,r,i;if(t)for(n=0,e=t.length;n<e;++n)r=t[n],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const n=this._update;if(n){const e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.pulse=n||t}};let ga=0;function va(t,n,e){this.id=++ga,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function ya(t,n,e){return new va(t,n,e)}va.prototype={_filter:$,_apply:b,targets(){return this._targets||(this._targets=Jo(y))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const n=this.value=this._apply(t),e=this._targets,r=e?e.length:0;for(let t=0;t<r;++t)e[t].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const n=ya(t);return this.targets().add(n),n},apply(t){const n=ya(null,t);return this.targets().add(n),n},merge(){const t=ya();this.targets().add(t);for(let n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},throttle(t){let n=-1;return this.filter((()=>{const e=Date.now();return e-n>t?(n=e,1):0}))},debounce(t){const n=ya();return this.targets().add(ya(null,null,at(t,(t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},between(t,n){let e=!1;return t.targets().add(ya(null,null,(()=>e=!0))),n.targets().add(ya(null,null,(()=>e=!1))),this.filter((()=>e))},detach(){this._filter=$,this._targets=null}};const ba={skip:!0};function wa(t,n,e,r,i,o){const a=ut({},o,ba);let u,s;Z(e)||(e=ot(e)),void 0===r?u=n=>t.touch(e(n)):Z(r)?(s=new ma(null,r,i,!1),u=n=>{s.evaluate(n);const r=e(n),i=s.value;sa(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=n=>t.update(e(n),r,a),n.apply(u)}function xa(t,n,e,r,i,o){if(void 0===r)n.targets().add(e);else{const a=o||{},u=new ma(null,function(t,n){return n=Z(n)?n:ot(n),t?function(e,r){const i=n(e,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:n}(e,r),i,!1);u.modified(a.force),u.rank=n.rank,n.targets().add(u),e&&(u.skip(!0),u.value=e.value,u.targets().add(e),t.connect(e,[u]))}}const $a={};function ka(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function Ma(t,n){const e=[];return Tt(t,n,(t=>e.push(t))),e}function Aa(t,n){const e={};return t.visit(n,(t=>{e[na(t)]=1})),t=>e[na(t)]?null:t}function Da(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function Sa(t,n,e,r){const i=this;let o=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const t of e)if(t.stamp===n){if(t.fields){const n=i.fields||(i.fields={});for(const e in t.fields)n[e]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function Fa(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}ka.prototype={StopPropagation:$a,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new ka(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new ka(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,Aa(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return D(t)?t.forEach((t=>n[t]=!0)):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?D(t)?t.some((t=>e[t])):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=Da(e.addF,n)),2&t&&(e.remF=Da(e.remF,n)),4&t&&(e.modF=Da(e.modF,n)),16&t&&(e.srcF=Da(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=Ma(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=Ma(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=Ma(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return Tt(e.source,e.srcF,r),e;1&t&&Tt(e.add,e.addF,r),2&t&&Tt(e.rem,e.remF,r),4&t&&Tt(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const t=e.add.length+e.mod.length;t===i.length||Tt(i,t?Aa(e,5):e.srcF,r)}return e}},mt(Sa,ka,{fork(t){const n=new ka(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(t=>n.add.push(t))),t&n.REM&&this.visit(n.REM,(t=>n.rem.push(t))),t&n.MOD&&this.visit(n.MOD,(t=>n.mod.push(t)))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?D(t)?t.some((t=>e[t])):e[t]:0},filter(){p("MultiPulse does not support filtering.")},materialize(){p("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let o=0;if(t&e.SOURCE)for(;o<i;++o)r[o].visit(t,n);else for(;o<i;++o)r[o].stamp===e.stamp&&r[o].visit(t,n);return e}});const Ea={skip:!1,force:!1};function Na(t,n,e,r){let i,o;const a=t[e];for(;e>n&&(o=e-1>>1,i=t[o],r(a,i)<0);)t[e]=i,e=o;return t[e]=a}function Ca(){this.logger(A()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Mo();try{this._loader=Xo()}catch(t){}this._touched=Jo(y),this._input={},this._pulse=null,this._heap=function(t){let n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),Na(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(t,n,e){const r=n,i=t.length,o=t[n];let a,u=1+(n<<1);for(;u<i;)a=u+1,a<i&&e(t[u],t[a])>=0&&(u=a),t[n]=t[u],u=1+((n=u)<<1);t[n]=o,Na(t,r,n,e)}(n,0,t)):r=e,r}}}(((t,n)=>t.qrank-n.qrank)),this._postrun=[]}function Oa(t){return function(){return this._log[t].apply(this,arguments)}}function _a(t,n){ma.call(this,t,null,n)}Ca.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Oa("error"),warn:Oa("warn"),info:Oa("info"),debug:Oa("debug"),logLevel:Oa("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,o=1;return t instanceof ma?i=t:t&&t.prototype instanceof ma?i=new t:Z(t)?i=new ma(null,t):(o=0,i=new ma(t,n)),this.rank(i),o&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i<r;++i)if(e<n[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let e,r,i;for(;n.length;)if(this.rank(e=n.pop()),r=e._targets)for(i=r.length;--i>=0;)n.push(e=r[i]),e===t&&p("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||Ea);const r=new ka(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||Ea;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||Ea;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:ca,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return Vo(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(t){let n;const e=new Promise((t=>n=t));return e.requests=0,e.done=()=>{0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const o=await r.request(n,e);return r.pulse(t,r.changeset().remove($).insert(o.data||[])),i.done(),o},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Yo(n&&n.type)});try{r=e.parse(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,o=ya(e,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):K(t);const s=u.length;for(let t=0;t<s;++t)u[t].addEventListener(n,a);return o},on:function(t,n,e,r,i){return(t instanceof ma?xa:wa)(this,t,n,e,r,i),this},evaluate:async function(t,n,e){const r=this,i=[];if(r._pulse)return Fa(r);if(r._pending&&await r._pending,n&&await Ko(r,n),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new ka(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=Jo(y);let a,u,s,c=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=$a),u!==$a&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++c):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${c} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,n)=>n.priority-t.priority));r._postrun=[];for(let n=0;n<t.length;++n)await Ko(r,t[n].callback)}return e&&await Ko(r,e),i.length&&Promise.all(i).then((t=>r.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,n,e){return this._pulse?Fa(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,n){const e=t.stamp<this._clock;e&&(t.stamp=this._clock),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const e=t.source,r=this._clock;return e&&D(e)?new Sa(this,r,e.map((t=>t.pulse)),n):this._input[t.id]||function(t,n){return n&&n.stamp===t.stamp?n:(t=t.fork(),n&&n!==$a&&(t.source=n.source),t)}(this._pulse,e&&e.pulse)}},mt(_a,ma,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?this.skip(!1):n=this.evaluate(t),n=n||t,n.then?n=n.then((t=>this.pulse=t)):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const za={};function Ba(t){const n=Ta(t);return n&&n.Definition||null}function Ta(t){return t=t&&t.toLowerCase(),ft(za,t)?za[t]:null}function*Pa(t,n){if(null==n)for(let n of t)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)r=n(r,++e,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function ja(t,n,e){const r=Float64Array.from(Pa(t,e));return r.sort(Jt),n.map((t=>An(r,t)))}function Ra(t,n){return ja(t,[.25,.5,.75],n)}function La(t,n){const e=t.length,r=function(t,n){const e=function(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}(t,n);return e?Math.sqrt(e):e}(t,n),i=Ra(t,n);return 1.06*(Math.min(r,(i[2]-i[0])/1.34)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function Ia(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let o,a,u,s,c,f,l=t.extent[0],h=t.extent[1];const d=t.span||h-l||Math.abs(l)||1;if(t.step)o=t.step;else if(t.steps){for(s=d/n,c=0,f=t.steps.length;c<f&&t.steps[c]<s;++c);o=t.steps[Math.max(0,c-1)]}else{for(a=Math.ceil(Math.log(n)/r),u=t.minstep||0,o=Math.max(u,Math.pow(e,Math.round(Math.log(d)/r)-a));Math.ceil(d/o)>n;)o*=e;for(c=0,f=i.length;c<f;++c)s=o/i[c],s>=u&&d/s<=n&&(o=s)}s=Math.log(o);const m=Math.pow(e,-(s>=0?0:1+~~(-s/r))-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(l/o+m)*o,l=l<s?s-o:s,h=Math.ceil(h/o)*o),{start:l,stop:h===l?l+o:h,step:o}}var qa=Math.random;function Ua(t,n,e,r){if(!t.length)return[void 0,void 0];const i=Float64Array.from(Pa(t,r)),o=i.length,a=n;let u,s,c,f;for(c=0,f=Array(a);c<a;++c){for(u=0,s=0;s<o;++s)u+=i[~~(qa()*o)];f[c]=u/o}return f.sort(Jt),[Mn(f,e/2),Mn(f,1-e/2)]}function Wa(t,n,e,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,c=r(t[0]),f=c,l=c+n;for(;s<i;++s){if(a=r(t[s]),a>=l){for(f=(c+f)/2;u<s;++u)o[u]=f;l=a+n,c=a}f=a}for(f=(c+f)/2;u<s;++u)o[u]=f;return e?function(t,n){const e=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<e;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<n){for(i=a+(o+r-a-a>>1);i<a;)t[i++]=t[a];for(;i>a;)t[i--]=t[o]}o=a,a=r}return t}(o,n+n/4):o}const Ha=Math.sqrt(2*Math.PI),Ga=Math.SQRT2;let Ya=NaN;function Va(t,n){t=t||0,n=null==n?1:n;let e,r,i=0,o=0;if(Ya==Ya)i=Ya,Ya=NaN;else{do{i=2*qa()-1,o=2*qa()-1,e=i*i+o*o}while(0===e||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Ya=o*r}return t+i*n}function Xa(t,n,e){const r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*Ha)}function Ja(t,n,e){const r=(t-(n=n||0))/(e=null==e?1:e),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let n;i<7.07106781186547?(n=.0352624965998911*i+.700383064443688,n=n*i+6.37396220353165,n=n*i+33.912866078383,n=n*i+112.079291497871,n=n*i+221.213596169931,n=n*i+220.206867912376,o=t*n,n=.0883883476483184*i+1.75566716318264,n=n*i+16.064177579207,n=n*i+86.7807322029461,n=n*i+296.564248779674,n=n*i+637.333633378831,n=n*i+793.826512519948,n=n*i+440.413735824752,o/=n):(n=i+.65,n=i+4/n,n=i+3/n,n=i+2/n,n=i+1/n,o=t/n/2.506628274631)}return r>0?1-o:o}function Ka(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Ga*function(t){let n,e=-Math.log((1-t)*(1+t));return e<6.25?(e-=3.125,n=-364441206401782e-35,n=n*e-16850591381820166e-35,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=n*e-1333171662854621e-31,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=n*e-4054566272975207e-29,n=n*e-8151934197605472e-29,n=26335093153082323e-28+n*e,n=n*e-12975133253453532e-27,n=n*e-5415412054294628e-26,n=1.0512122733215323e-9+n*e,n=n*e-4.112633980346984e-9,n=n*e-2.9070369957882005e-8,n=4.2347877827932404e-7+n*e,n=n*e-13654692000834679e-22,n=n*e-13882523362786469e-21,n=.00018673420803405714+n*e,n=n*e-.000740702534166267,n=n*e-.006033670871430149,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*e,n=n*e-2.7517406297064545e-7,n=1.8239629214389228e-8+n*e,n=15027403968909828e-22+n*e,n=n*e-4013867526981546e-21,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=n*e-47318229009055734e-21,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=n*e-.0003550375203628475,n=.0009532893797373805+n*e,n=n*e-.0016882755560235047,n=.002491442096107851+n*e,n=n*e-.003751208507569241,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=n*e-2.555641816996525e-10,n=1.5076572693500548e-9+n*e,n=n*e-3.789465440126737e-9,n=7.61570120807834e-9+n*e,n=n*e-1.496002662714924e-8,n=2.914795345090108e-8+n*e,n=n*e-6.771199775845234e-8,n=2.2900482228026655e-7+n*e,n=n*e-9.9298272942317e-7,n=4526062597223154e-21+n*e,n=n*e-1968177810553167e-20,n=7599527703001776e-20+n*e,n=n*e-.00021503011930044477,n=n*e-.00013871931833623122,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}(2*t-1)}function Qa(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Va(e,r),pdf:t=>Xa(t,e,r),cdf:t=>Ja(t,e,r),icdf:t=>Ka(t,e,r)};return i.mean(t).stdev(n)}function Za(t,n){const e=Qa();let r=0;const i={data(e){return arguments.length?(t=e,r=e?e.length:0,i.bandwidth(n)):t},bandwidth(e){return arguments.length?(!(n=e)&&t&&(n=La(t)),i):n},sample:()=>t[~~(qa()*r)]+n*e.sample(),pdf(i){let o=0,a=0;for(;a<r;++a)o+=e.pdf((i-t[a])/n);return o/n/r},cdf(i){let o=0,a=0;for(;a<r;++a)o+=e.cdf((i-t[a])/n);return o/r},icdf(){throw Error("KDE icdf not supported.")}};return i.data(t)}function tu(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+Va()*n)}function nu(t,n,e){if(t<=0)return 0;n=n||0,e=null==e?1:e;const r=(Math.log(t)-n)/e;return Math.exp(-.5*r*r)/(e*Ha*t)}function eu(t,n,e){return Ja(Math.log(t),n,e)}function ru(t,n,e){return Math.exp(Ka(t,n,e))}function iu(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>tu(e,r),pdf:t=>nu(t,e,r),cdf:t=>eu(t,e,r),icdf:t=>ru(t,e,r)};return i.mean(t).stdev(n)}function ou(t,n){let e,r=0;const i={weights(t){return arguments.length?(e=function(t){const n=[];let e,i=0;for(e=0;e<r;++e)i+=n[e]=null==t[e]?1:+t[e];for(e=0;e<r;++e)n[e]/=i;return n}(n=t||[]),i):n},distributions(e){return arguments.length?(e?(r=e.length,t=e):(r=0,t=[]),i.weights(n)):t},sample(){const n=qa();let i=t[r-1],o=e[0],a=0;for(;a<r-1;o+=e[++a])if(n<o){i=t[a];break}return i.sample()},pdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].pdf(n);return i},cdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].cdf(n);return i},icdf(){throw Error("Mixture icdf not supported.")}};return i.distributions(t).weights(n)}function au(t,n){return null==n&&(n=null==t?1:t,t=0),t+(n-t)*qa()}function uu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=n&&t<=e?1/(e-n):0}function su(t,n,e){return null==e&&(e=null==n?1:n,n=0),t<n?0:t>e?1:(t-n)/(e-n)}function cu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function fu(t,n){let e,r;const i={min(t){return arguments.length?(e=t||0,i):e},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>au(e,r),pdf:t=>uu(t,e,r),cdf:t=>su(t,e,r),icdf:t=>cu(t,e,r)};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function lu(t,n,e){let r=0,i=0;for(const o of t){const t=e(o);null==n(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function hu(t,n,e,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-o*t,o]}function du(t,n,e,r){t=t.filter((t=>{let r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,e)=>n(t)-n(e)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,c,f=0,l=0,h=0;for(c of t)o[f]=u=+n(c),a[f]=s=+e(c),++f,l+=(u-l)/f,h+=(s-h)/f;for(f=0;f<i;++f)o[f]-=l,a[f]-=h;return[o,a,l,h]}function mu(t,n,e,r){let i,o,a=-1;for(const u of t)i=n(u),o=e(u),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function pu(t,n,e,r,i){let o=0,a=0;return mu(t,n,e,((t,n)=>{const e=n-i(t),u=n-r;o+=e*e,a+=u*u})),1-o/a}function gu(t,n,e){let r=0,i=0,o=0,a=0,u=0;mu(t,n,e,((t,n)=>{++u,r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),c=t=>s[0]+s[1]*t;return{coef:s,predict:c,rSquared:pu(t,n,e,i,c)}}function vu(t,n,e){let r=0,i=0,o=0,a=0,u=0;mu(t,n,e,((t,n)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),c=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:c,rSquared:pu(t,n,e,i,c)}}function yu(t,n,e){const[r,i,o,a]=du(t,n,e);let u,s,c,f=0,l=0,h=0,d=0,m=0;mu(t,n,e,((t,n)=>{u=r[m++],s=Math.log(n),c=u*n,f+=(n*s-f)/m,l+=(c-l)/m,h+=(c*s-h)/m,d+=(u*c-d)/m}));const[p,g]=hu(l/a,f/a,h/a,d/a),v=t=>Math.exp(p+g*(t-o));return{coef:[Math.exp(p-g*o),g],predict:v,rSquared:pu(t,n,e,a,v)}}function bu(t,n,e){let r=0,i=0,o=0,a=0,u=0,s=0;mu(t,n,e,((t,n)=>{const e=Math.log(t),c=Math.log(n);++s,r+=(e-r)/s,i+=(c-i)/s,o+=(e*c-o)/s,a+=(e*e-a)/s,u+=(n-u)/s}));const c=hu(r,i,o,a),f=t=>c[0]*Math.pow(t,c[1]);return c[0]=Math.exp(c[0]),{coef:c,predict:f,rSquared:pu(t,n,e,u,f)}}function wu(t,n,e){const[r,i,o,a]=du(t,n,e),u=r.length;let s,c,f,l,h=0,d=0,m=0,p=0,g=0;for(s=0;s<u;)c=r[s],f=i[s++],l=c*c,h+=(l-h)/s,d+=(l*c-d)/s,m+=(l*l-m)/s,p+=(c*f-p)/s,g+=(l*f-g)/s;const v=m-h*h,y=h*v-d*d,b=(g*h-p*d)/y,w=(p*v-g*d)/y,x=-b*h,$=t=>b*(t-=o)*t+w*t+x+a;return{coef:[x-w*o+b*o*o+a,w-2*b*o,b],predict:$,rSquared:pu(t,n,e,a,$)}}function xu(t,n,e,r){if(0===r)return lu(t,n,e);if(1===r)return gu(t,n,e);if(2===r)return wu(t,n,e);const[i,o,a,u]=du(t,n,e),s=i.length,c=[],f=[],l=r+1;let h,d,m,p,g;for(h=0;h<l;++h){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],h)*o[m];for(c.push(p),g=new Float64Array(l),d=0;d<l;++d){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],h+d);g[d]=p}f.push(g)}f.push(c);const v=function(t){const n=t.length-1,e=[];let r,i,o,a,u;for(r=0;r<n;++r){for(a=r,i=r+1;i<n;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<n+1;++o)u=t[o][r],t[o][r]=t[o][a],t[o][a]=u;for(i=r+1;i<n;++i)for(o=n;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=n-1;i>=0;--i){for(u=0,o=i+1;o<n;++o)u+=t[o][i]*e[o];e[i]=(t[n][i]-u)/t[i][i]}return e}(f),y=t=>{let n=u+v[0]+v[1]*(t-=a)+v[2]*t*t;for(h=3;h<l;++h)n+=v[h]*Math.pow(t,h);return n};return{coef:$u(l,v,-a,u),predict:y,rSquared:pu(t,n,e,u,y)}}function $u(t,n,e,r){const i=Array(t);let o,a,u,s;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(u=n[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(e,a)*s;return i[0]+=r,i}function ku(t,n,e,r){const[i,o,a,u]=du(t,n,e,!0),s=i.length,c=Math.max(2,~~(r*s)),f=new Float64Array(s),l=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const n=[0,c-1];for(let t=0;t<s;++t){const e=i[t],r=n[0],a=n[1];let u=0,s=0,c=0,d=0,m=0;const p=1/Math.abs(i[e-i[r]>i[a]-e?r:a]-e||1);for(let t=r;t<=a;++t){const n=i[t],r=o[t],a=Mu(Math.abs(e-n)*p)*h[t],f=n*a;u+=a,s+=f,c+=r*a,d+=r*f,m+=n*f}const[g,v]=hu(s/u,c/u,d/u,m/u);f[t]=g+v*e,l[t]=Math.abs(o[t]-f[t]),Au(i,t+1,n)}if(2===t)break;const e=Dn(l);if(Math.abs(e)<1e-12)break;for(let t,n,r=0;r<s;++r)t=l[r]/(6*e),h[r]=t>=1?1e-12:(n=1-t*t)*n}return function(t,n,e,r){const i=t.length,o=[];let a,u=0,s=0,c=[];for(;u<i;++u)a=t[u]+e,c[0]===a?c[1]+=(n[u]-c[1])/++s:(s=0,c[1]+=r,c=[a,n[u]],o.push(c));return c[1]+=r,o}(i,f,a,u)}function Mu(t){return(t=1-t*t*t)*t*t}function Au(t,n,e){const r=t[n];let i=e[0],o=e[1]+1;if(!(o>=t.length))for(;n>i&&t[o]-r<=r-t[i];)e[0]=++i,e[1]=o,++o}const Du=.5*Math.PI/180;function Su(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=n=>[n,t(n)],o=n[0],a=n[1],u=a-o,s=u/r,c=[i(o)],f=[];if(e===r){for(let t=1;t<r;++t)c.push(i(o+t/e*u));return c.push(i(a)),c}f.push(i(a));for(let t=e;--t>0;)f.push(i(o+t/e*u));let l=c[0],h=f[f.length-1];const d=1/u,m=function(t,n){let e=t,r=t;const i=n.length;for(let t=0;t<i;++t){const i=n[t][1];i<e&&(e=i),i>r&&(r=i)}return 1/(r-e)}(l[1],f);for(;h;){const t=i((l[0]+h[0])/2);t[0]-l[0]>=s&&Fu(l,t,h,d,m)>Du?f.push(t):(l=h,c.push(h),f.pop()),h=f[f.length-1]}return c}function Fu(t,n,e,r,i){const o=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),a=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(o-a)}function Eu(t){return t&&t.length?1===t.length?t[0]:(n=t,t=>{const e=n.length;let r=1,i=String(n[0](t));for(;r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function Nu(t,n,e){return e||t+(n?"_"+n:"")}const Cu=()=>{},Ou={init:Cu,add:Cu,rem:Cu,idx:0},_u={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n<t.min||void 0===t.min)&&(t.min=n)},rem:(t,n)=>{n<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,n)=>{(n>t.max||void 0===t.max)&&(t.max=n)},rem:(t,n)=>{n>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,n,e)=>{n<t.min&&(t.argmin=e)},rem:(t,n)=>{n<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},zu=Object.keys(_u).filter((t=>"__count__"!==t));function Bu(t,n,e){return _u[t](e,n)}function Tu(t,n){return t.idx-n.idx}function Pu(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function ju(t,n){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((e=>e.add(this,t,n)))):++this.missing}function Ru(t,n){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((e=>e.rem(this,t,n)))):--this.missing}function Lu(t){return this._out.forEach((n=>t[n.out]=n.value(this))),t}function Iu(t,n){const e=n||b,r=function(t){const n={};t.forEach((t=>n[t.name]=t));const e=t=>{t.req&&t.req.forEach((t=>{n[t]||e(n[t]=_u[t]())}))};return t.forEach(e),Object.values(n).sort(Tu)}(t),i=t.slice().sort(Tu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=Pu,o.prototype.add=ju,o.prototype.rem=Ru,o.prototype.set=Lu,o.prototype.get=e,o.fields=t.map((t=>t.out)),o}function qu(t){this._key=t?v(t):na,this.reset()}[...zu,"__count__"].forEach((t=>{_u[t]=function(t,n){return(e,r)=>ut({name:t,aggregate_param:r,out:e||t},Ou,n)}(t,_u[t])}));const Uu=qu.prototype;function Wu(t){_a.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function Hu(t){_a.call(this,null,t)}function Gu(t,n,e){const r=t;let i=n||[],o=e||[],a={},u=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,n)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),n&&t&&i.sort(t),o.length&&(i=t?At(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Yu(t){_a.call(this,[],t)}function Vu(t){ma.call(this,null,Xu,t)}function Xu(t){return this.value&&!t.modified()?this.value:tt(t.fields,t.orders)}function Ju(t){_a.call(this,null,t)}function Ku(t){_a.call(this,null,t)}Uu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Uu.add=function(t){this._add.push(t)},Uu.rem=function(t){this._rem.push(t)},Uu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,o=Array(r-i),a={};let u,s,c;for(u=0;u<i;++u)a[e(n[u])]=1;for(u=0,s=0;u<r;++u)a[e(c=t[u])]?a[e(c)]=0:o[s++]=c;return this._rem=[],this._add=o},Uu.distinct=function(t){const n=this.values(),e={};let r,i=n.length,o=0;for(;--i>=0;)r=t(n[i])+"",ft(e,r)||(e[r]=1,++o);return o},Uu.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=ct(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},Uu.argmin=function(t){return this.extent(t)[0]||{}},Uu.argmax=function(t){return this.extent(t)[1]||{}},Uu.min=function(t){const n=this.extent(t)[0];return null!=n?t(n):void 0},Uu.max=function(t){const n=this.extent(t)[1];return null!=n?t(n):void 0},Uu.quartile=function(t){return this._get===t&&this._q||(this._q=Ra(this.values(),t),this._get=t),this._q},Uu.q1=function(t){return this.quartile(t)[0]},Uu.q2=function(t){return this.quartile(t)[1]},Uu.q3=function(t){return this.quartile(t)[2]},Uu.ci=function(t){return this._get===t&&this._ci||(this._ci=Ua(this.values(),1e3,.05,t),this._get=t),this._ci},Uu.ci0=function(t){return this.ci(t)[0]},Uu.ci1=function(t){return this.ci(t)[1]},Wu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:zu},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},mt(Wu,_a,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,(t=>e.add(t)))):(e.value=e.value||e.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),r.modifies(e._outputs),e._drop=!1!==t.drop,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter((()=>this.clean())),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map((()=>({}))),i=e.length;function o(t){let n,o,a,u;for(n in t)for(a=t[n].tuple,o=0;o<i;++o)r[o][u=a[e[o]]]=u}o(t._prev),o(n),function o(a,u,s){const c=e[s],f=r[s++];for(const e in f){const r=a?a+"|"+e:e;u[c]=f[e],s<i?o(r,u,s):n[r]||t.cell(r,u)}}("",{},0)},init(t){const n=this._inputs=[],e=this._outputs=[],r={};function i(t){const e=K(l(t)),i=e.length;let o,a=0;for(;a<i;++a)r[o=e[a]]||(r[o]=1,n.push(o))}this._dims=K(t.groupby),this._dnames=this._dims.map((t=>{const n=f(t);return i(t),e.push(n),n})),this.cellkey=t.key?t.key:Eu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=t.fields||[null],a=t.ops||["count"],u=t.aggregate_params||[null],s=t.as||[],c=o.length,h={};let d,m,g,v,y,b,w;for(c!==a.length&&p("Unmatched number of fields and aggregate ops."),w=0;w<c;++w)d=o[w],m=a[w],g=u[w]||null,null==d&&"count"!==m&&p("Null aggregate field specified."),y=f(d),b=Nu(m,y,s[w]),e.push(b),"count"!==m?(v=h[y],v||(i(d),v=h[y]=[],v.field=d,this._measures.push(v)),"count"!==m&&(this._countOnly=!1),v.push(Bu(m,g,b))):this._counts.push(b);return this._measures=this._measures.map((t=>Iu(t,t.field))),Object.create(null)},cellkey:Eu(),cell(t,n){let e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},newcell(t,n){const e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,n=t.length;e.agg=Array(n);for(let r=0;r<n;++r)e.agg[r]=new t[r](e)}return e.store&&(e.data=new qu),e},newtuple(t,n){const e=this._dnames,r=this._dims,i=r.length,o={};for(let n=0;n<i;++n)o[e[n]]=r[n](t);return n?aa(n.tuple,o):ra(o)},clean(){const t=this.value;for(const n in t)0===t[n].num&&delete t[n]},add(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num+=1,this._countOnly)return;e.store&&e.data.add(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].add(r[n].get(t),t)},rem(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num-=1,this._countOnly)return;e.store&&e.data.rem(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].rem(r[n].get(t),t)},celltuple(t){const n=t.tuple,e=this._counts;t.store&&t.data.values();for(let r=0,i=e.length;r<i;++r)n[e[r]]=t.num;if(!this._countOnly){const e=t.agg;for(let t=0,r=e.length;t<r;++t)e[t].set(n)}return n},changes(t){const n=this._adds,e=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,u=t.mod;let s,c,f,l;if(r)for(c in r)s=r[c],i&&!s.num||a.push(s.tuple);for(f=0,l=this._alen;f<l;++f)o.push(this.celltuple(n[f])),n[f]=null;for(f=0,l=this._mlen;f<l;++f)s=e[f],(0===s.num&&i?a:u).push(this.celltuple(s)),e[f]=null;return this._alen=this._mlen=0,this._prev=null,t}}),Hu.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},mt(Hu,_a,{transform(t,n){const e=!1!==t.interval,r=this._bins(t),i=r.start,o=r.step,a=t.as||["bin0","bin1"],u=a[0],s=a[1];let c;return c=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(l(t.field))?n.ADD_MOD:n.ADD,n.visit(c,e?t=>{const n=r(t);t[u]=n,t[s]=null==n?null:i+o*(1+(n-i)/o)}:t=>t[u]=r(t)),n.modifies(e?a:u)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=Ia(t),r=e.step;let i,o,a=e.start,u=a+Math.ceil((e.stop-a)/r)*r;null!=(i=t.anchor)&&(o=i-(a+r*Math.floor((i-a)/r)),a+=o,u+=o);const s=function(t){let e=_(n(t));return null==e?null:e<a?-1/0:e>u?1/0:(e=Math.max(a,Math.min(e,u-r)),a+r*Math.floor(1e-14+(e-a)/r))};return s.start=a,s.stop=e.stop,s.step=r,this.value=c(s,l(n),t.name||"bin_"+f(n))}}),Yu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},mt(Yu,_a,{transform(t,n){const e=n.fork(n.ALL),r=Gu(na,this.value,e.materialize(e.ADD).add),i=t.sort,o=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(o),this.value=e.source=r.data(ua(i),o),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),mt(Vu,ma),Ju.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},mt(Ju,_a,{transform(t,n){const e=n=>e=>{for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(u(e),t.case,o)||[],s=0,c=i.length;s<c;++s)a.test(r=i[s])||n(r)},r=this._parameterCheck(t,n),i=this._counts,o=this._match,a=this._stop,u=t.field,s=t.as||["text","count"],c=e((t=>i[t]=1+(i[t]||0))),f=e((t=>i[t]-=1));return r?n.visit(n.SOURCE,c):(n.visit(n.ADD,c),n.visit(n.REM,f)),this._finish(n,s)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],o=n[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,c;for(u in e)s=r[u],c=e[u]||0,!s&&c?(r[u]=s=ra({}),s[i]=u,s[o]=c,a.add.push(s)):0===c?(s&&a.rem.push(s),e[u]=null,r[u]=null):s[o]!==c&&(s[o]=c,a.mod.push(s));return a.modifies(n)}}),Ku.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},mt(Ku,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(e.rem=u),u=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,o,a=[],u={},s=t.length,c=0;c<s;++c)for(u[n]=o=t[c],i=0;i<s;++i)u[e]=t[i],r(u)&&(a.push(ra(u)),(u={})[n]=o);return a}(u,i,o,t.filter||$)):e.mod=u,e.source=this.value,e.modifies(r)}});const Qu={kde:Za,mixture:ou,normal:Qa,lognormal:iu,uniform:fu},Zu="function";function ts(t,n){const e=t[Zu];ft(Qu,e)||p("Unknown distribution function: "+e);const r=Qu[e]();for(const e in t)"field"===e?r.data((t.from||n()).map(t[e])):"distributions"===e?r[e](t[e].map((t=>ts(t,n)))):typeof r[e]===Zu&&r[e](t[e]);return r}function ns(t){_a.call(this,null,t)}const es=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}];function rs(t,n){return t?t.map(((t,e)=>n[e]||f(t))):null}function is(t,n,e){const r=[],i=t=>t(s);let o,a,u,s,c,f;if(null==n)r.push(t.map(e));else for(o={},a=0,u=t.length;a<u;++a)s=t[a],c=n.map(i),f=o[c],f||(o[c]=f=[],f.dims=c,r.push(f)),f.push(e(s));return r}function os(t){_a.call(this,null,t)}function as(t){ma.call(this,null,us,t),this.modified(!0)}function us(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:c((e=>n(e,t)),l(n),f(n))}function ss(t){_a.call(this,[void 0,void 0],t)}function cs(t,n){ma.call(this,t),this.parent=n,this.count=0}function fs(t){_a.call(this,{},t),this._keys=ht();const n=this._targets=[];n.active=0,n.forEach=t=>{for(let e=0,r=n.active;e<r;++e)t(n[e],e,n)}}function ls(t){ma.call(this,null,hs,t)}function hs(t){return this.value&&!t.modified()?this.value:D(t.name)?K(t.name).map((t=>v(t))):v(t.name,t.as)}function ds(t){_a.call(this,ht(),t)}function ms(t){_a.call(this,[],t)}function ps(t){_a.call(this,[],t)}function gs(t){_a.call(this,null,t)}function vs(t){_a.call(this,[],t)}ns.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:es.concat({key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:es},{name:"weights",type:"number",array:!0}]})},{name:"as",type:"string",array:!0,default:["value","density"]}]},mt(ns,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=ts(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(n)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&p("Invalid density method: "+a),t.extent||r.data||p("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],s=Su(a,t.extent||st(r.data()),i,o).map((t=>{const n={};return n[u[0]]=t[0],n[u[1]]=t[1],ra(n)}));this.value&&(e.rem=this.value),this.value=e.add=e.source=s}return e}}),os.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]},mt(os,_a,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=is(n.source,t.groupby,b),i=t.smooth||!1,o=t.field,a=t.step||((t,n)=>Ft(st(t,n))/30)(e,o),u=ua(((t,n)=>o(t)-o(n))),s=t.as||"bin",c=r.length;let f,l=1/0,h=-1/0,d=0;for(;d<c;++d){const t=r[d].sort(u);f=-1;for(const n of Wa(t,a,i,o))n<l&&(l=n),n>h&&(h=n),t[++f][s]=n}return this.value={start:l,stop:h,step:a},n.reflow(!0).modifies(s)}}),mt(as,ma),ss.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},mt(ss,_a,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let o=e[0],a=e[1];if((i||null==o)&&(o=1/0,a=-1/0),n.visit(i?n.SOURCE:n.ADD,(t=>{const n=_(r(t));null!=n&&(n<o&&(o=n),n>a&&(a=n))})),!Number.isFinite(o)||!Number.isFinite(a)){let t=f(r);t&&(t=` for field "${t}"`),n.dataflow.warn(`Infinite extent${t}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),mt(cs,ma,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),mt(fs,_a,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let o,a,u=ft(i,t)&&i[t];return u?u.value.stamp<e.stamp&&(u.init(e),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,o=e.dataflow,u=new cs(e.fork(e.NO_SOURCE),this),o.add(u).connect(n(o,t,a)),i[t]=u,this.activate(u)),u},clean(){const t=this.value;let n=0;for(const e in t)if(0===t[e].count){const r=t[e].detachSubflow;r&&r(),delete t[e],++n}if(n){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;i<r;++i)n[i]=t[i];for(;i<e&&null!=n[i];++i)n[i]=null;n.active=r},transform(t,n){const e=n.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),u=t=>this.subflow(t,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,(t=>{const n=na(t),e=o.get(n);void 0!==e&&(o.delete(n),u(e).rem(t))})),n.visit(n.ADD,(t=>{const n=r(t);o.set(na(t),n),u(n).add(t)})),a||n.modified(r.fields)?n.visit(n.MOD,(t=>{const n=na(t),e=o.get(n),i=r(t);e===i?u(i).mod(t):(o.set(n,i),u(e).rem(t),u(i).add(t))})):n.changed(n.MOD)&&n.visit(n.MOD,(t=>{u(o.get(na(t))).mod(t)})),a&&n.visit(n.REFLOW,(t=>{const n=na(t),e=o.get(n),i=r(t);e!==i&&(o.set(n,i),u(e).rem(t),u(i).add(t))})),n.clean()?e.runAfter((()=>{this.clean(),o.clean()})):o.empty>e.cleanThreshold&&e.runAfter(o.clean),n}}),mt(ls,ma),ds.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},mt(ds,_a,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let c=!0;function f(n){const e=na(n),i=s(n,t),f=r.get(e);i&&f?(r.delete(e),o.push(n)):i||f?c&&i&&!f&&u.push(n):(r.set(e,1),a.push(n))}return n.visit(n.REM,(t=>{const n=na(t);r.has(n)?r.delete(n):a.push(t)})),n.visit(n.ADD,(n=>{s(n,t)?o.push(n):r.set(na(n),1)})),n.visit(n.MOD,f),t.modified()&&(c=!1,n.visit(n.REFLOW,f)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),ms.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},mt(ms,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=rs(r,t.as||[]),o=t.index||null,a=i.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{const n=r.map((n=>n(t))),u=n.reduce(((t,n)=>Math.max(t,n.length)),0);let s,c,f,l=0;for(;l<u;++l){for(c=ia(t),s=0;s<a;++s)c[i[s]]=null==(f=n[s][l])?null:f;o&&(c[o]=l),e.add.push(c)}})),this.value=e.source=e.add,o&&e.modifies(o),e.modifies(i)}}),ps.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},mt(ps,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=r.map(f),o=t.as||["key","value"],a=o[0],u=o[1],s=r.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{for(let n,o=0;o<s;++o)n=ia(t),n[a]=i[o],n[u]=r[o](t),e.add.push(n)})),this.value=e.source=e.add,e.modifies(o)}}),gs.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},mt(gs,_a,{transform(t,n){const e=t.expr,r=t.as,i=t.modified(),o=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)||n.modified(r)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(o,(n=>n[r]=e(n,t)))}}),mt(vs,_a,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ra(r(t))),u.push(a);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else o=u.slice(0,-s),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(o):o,u=u.slice(-s);return e.source=this.value=u,e}});const ys={value:"value",median:Dn,mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(o=+o)>=o&&(++e,r+=o)}if(e)return r/e},min:xn,max:wn},bs=[];function ws(t){_a.call(this,[],t)}function xs(t){Wu.call(this,t)}function $s(t){_a.call(this,null,t)}function ks(t){ma.call(this,null,Ms,t)}function Ms(t){return this.value&&!t.modified()?this.value:$t(t.fields,t.flat)}function As(t){_a.call(this,[],t),this._pending=null}function Ds(t,n,e){e.forEach(ra);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function Ss(t){_a.call(this,{},t)}function Fs(t){ma.call(this,null,Es,t)}function Es(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,o=1/0,a=-1/0;for(r=0;r<e;++r)i=n[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function Ns(t){ma.call(this,null,Cs,t)}function Cs(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,n)=>t.concat(n)),[])}function Os(t){_a.call(this,null,t)}function _s(t){Wu.call(this,t)}function zs(t){fs.call(this,t)}function Bs(t){_a.call(this,null,t)}function Ts(t){_a.call(this,null,t)}function Ps(t){_a.call(this,null,t)}function js(t){_a.call(this,null,t)}function Rs(t){_a.call(this,[],t),this.count=0}function Ls(t){_a.call(this,null,t)}function Is(t){_a.call(this,null,t),this.modified(!0)}function qs(t){_a.call(this,null,t)}ws.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},mt(ws,_a,{transform(t,n){var e,r,i,o,a,u,s,c,l,h,d=n.fork(n.ALL),m=function(t){var n,e=t.method||ys.value;if(null!=ys[e])return e===ys.value?(n=void 0!==t.value?t.value:0,()=>n):ys[e];p("Unrecognized imputation method: "+e)}(t),g=function(t){const n=t.field;return t=>t?n(t):NaN}(t),v=f(t.field),y=f(t.key),b=(t.groupby||[]).map(f),w=function(t,n,e,r){var i,o,a,u,s,c,f,l,h=t=>t(l),d=[],m=r?r.slice():[],p={},g={};for(m.forEach(((t,n)=>p[t]=n+1)),u=0,f=t.length;u<f;++u)c=e(l=t[u]),s=p[c]||(p[c]=m.push(c)),(a=g[o=(i=n?n.map(h):bs)+""])||(a=g[o]=[],d.push(a),a.values=i),a[s-1]=l;return d.domain=m,d}(n.source,t.groupby,t.key,t.keyvals),x=[],$=this.value,k=w.domain.length;for(a=0,c=w.length;a<c;++a)for(i=(e=w[a]).values,r=NaN,s=0;s<k;++s)if(null==e[s]){for(o=w.domain[s],h={_impute:!0},u=0,l=i.length;u<l;++u)h[b[u]]=i[u];h[y]=o,h[v]=Number.isNaN(r)?r=m(e,g):r,x.push(ra(h))}return x.length&&(d.add=d.materialize(d.ADD).add.concat(x)),$.length&&(d.rem=d.materialize(d.REM).rem.concat($)),this.value=x,d}}),xs.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:zu},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},mt(xs,Wu,{transform(t,n){const e=this,r=t.modified();let i;return e.value&&(r||n.modified(e._inputs,!0))?(i=e.value=r?e.init(t):{},n.visit(n.SOURCE,(t=>e.add(t)))):(i=e.value=e.value||this.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),e.changes(),n.visit(n.SOURCE,(t=>{ut(t,i[e.cellkey(t)].tuple)})),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e<r;++e)this.celltuple(t[e]),t[e]=null;for(e=0,r=this._mlen;e<r;++e)this.celltuple(n[e]),n[e]=null;this._alen=this._mlen=0}}),$s.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},mt($s,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=n.materialize(n.SOURCE).source,i=is(r,t.groupby,t.field),o=(t.groupby||[]).map(f),a=t.bandwidth,u=t.cumulative?"cdf":"pdf",s=t.as||["value","density"],c=[];let l=t.extent,h=t.steps||t.minsteps||25,d=t.steps||t.maxsteps||200;"pdf"!==u&&"cdf"!==u&&p("Invalid density method: "+u),"shared"===t.resolve&&(l||(l=st(r,t.field)),h=d=t.steps||d),i.forEach((n=>{const e=Za(n,a)[u],r=t.counts?n.length:1;Su(e,l||st(n),h,d).forEach((t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[s[0]]=t[0],e[s[1]]=t[1]*r,c.push(ra(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}}),mt(ks,ma),mt(As,_a,{transform(t,n){const e=n.dataflow;if(this._pending)return Ds(this,n,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return n.StopPropagation;if(t.values)return Ds(this,n,e.parse(t.values,t.format));if(t.async){const n=e.request(t.url,t.format).then((t=>(this._pending=K(t.data),t=>t.touch(this))));return{async:n}}return e.request(t.url,t.format).then((t=>Ds(this,n,K(t.data))))}}),Ss.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},mt(Ss,_a,{transform(t,n){const e=t.fields,r=t.index,i=t.values,o=null==t.default?null:t.default,a=t.modified(),u=e.length;let s,c,l,h=a?n.SOURCE:n.ADD,d=n,m=t.as;return i?(c=i.length,u>1&&!m&&p('Multi-field lookup requires explicit "as" parameter.'),m&&m.length!==u*c&&p('The "as" parameter has too few output field names.'),m=m||i.map(f),s=function(t){for(var n,a,s=0,f=0;s<u;++s)if(null==(a=r.get(e[s](t))))for(n=0;n<c;++n,++f)t[m[f]]=o;else for(n=0;n<c;++n,++f)t[m[f]]=i[n](a)}):(m||p("Missing output field names."),s=function(t){for(var n,i=0;i<u;++i)n=r.get(e[i](t)),t[m[i]]=null==n?o:n}),a?d=n.reflow(!0):(l=e.some((t=>n.modified(t.fields))),h|=l?n.MOD:0),n.visit(h,s),d.modifies(m)}}),mt(Fs,ma),mt(Ns,ma),mt(Os,_a,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),_s.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:zu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},mt(_s,Wu,{_transform:Wu.prototype.transform,transform(t,n){return this._transform(function(t,n){const e=t.field,r=t.value,i=("count"===t.op?"__count__":t.op)||"sum",o=l(e).concat(l(r)),a=function(t,n,e){const r={},i=[];return e.visit(e.SOURCE,(n=>{const e=t(n);r[e]||(r[e]=1,i.push(e))})),i.sort(nt),n?i.slice(0,n):i}(e,t.limit||0,n);return n.changed()&&t.set("__pivot__",null,null,!0),{key:t.key,groupby:t.groupby,ops:a.map((()=>i)),fields:a.map((t=>function(t,n,e,r){return c((r=>n(r)===t?e(r):NaN),r,t+"")}(t,e,r,o))),as:a.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),mt(zs,fs,{transform(t,n){const e=t.subflow,r=t.field,i=t=>this.subflow(na(t),e,n,t);return(t.modified("field")||r&&n.modified(l(r)))&&p("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,(t=>{const n=i(t);r(t).forEach((t=>n.mod(t)))})),n.visit(n.ADD,(t=>{const n=i(t);r(t).forEach((t=>n.add(ra(t))))})),n.visit(n.REM,(t=>{const n=i(t);r(t).forEach((t=>n.rem(t)))}))):(n.visit(n.MOD,(t=>i(t).mod(t))),n.visit(n.ADD,(t=>i(t).add(t))),n.visit(n.REM,(t=>i(t).rem(t)))),n.clean()&&n.runAfter((()=>this.clean())),n}}),Bs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},mt(Bs,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=rs(t.fields,t.as||[]),o=r?(t,n)=>function(t,n,e,r){for(let i=0,o=e.length;i<o;++i)n[r[i]]=e[i](t);return n}(t,n,r,i):oa;let a;return this.value?a=this.value:(n=n.addAll(),a=this.value={}),n.visit(n.REM,(t=>{const n=na(t);e.rem.push(a[n]),a[n]=null})),n.visit(n.ADD,(t=>{const n=o(t,ra({}));a[na(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{e.mod.push(o(t,a[na(t)]))})),e}}),mt(Ts,_a,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),Ps.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]},mt(Ps,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=is(n.materialize(n.SOURCE).source,t.groupby,t.field),o=(t.groupby||[]).map(f),a=[],u=t.step||.01,s=t.probs||Fn(u/2,1-1e-14,u),c=s.length;return i.forEach((t=>{const n=ja(t,s);for(let e=0;e<c;++e){const i={};for(let n=0;n<o.length;++n)i[o[n]]=t.dims[n];i[r[0]]=s[e],i[r[1]]=n[e],a.push(ra(i))}})),this.value&&(e.rem=this.value),this.value=e.add=e.source=a,e}}),mt(js,_a,{transform(t,n){let e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,(t=>{const n=na(t);e.rem.push(r[n]),r[n]=null})),n.visit(n.ADD,(t=>{const n=ia(t);r[na(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{const n=r[na(t)];for(const r in t)n[r]=t[r],e.modifies(r);e.mod.push(n)}))),e}}),Rs.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},mt(Rs,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,o=this.value.reduce(((t,n)=>(t[na(n)]=1,t)),{});let a=this.value,u=this.count,s=0;function c(t){let n,r;a.length<i?a.push(t):(r=~~((u+1)*qa()),r<a.length&&r>=s&&(n=a[r],o[na(n)]&&e.rem.push(n),a[r]=t)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const n=na(t);o[n]&&(o[n]=-1,e.rem.push(t)),--u})),a=a.filter((t=>-1!==o[na(t)]))),(n.rem.length||r)&&a.length<i&&n.source&&(s=u=a.length,n.visit(n.SOURCE,(t=>{o[na(t)]||c(t)})),s=-1),r&&a.length>i){const t=a.length-i;for(let n=0;n<t;++n)o[na(a[n])]=-1,e.rem.push(a[n]);a=a.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{o[na(t)]&&e.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||s<0)&&(e.add=a.filter((t=>!o[na(t)]))),this.count=u,this.value=e.source=a,e}}),Ls.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},mt(Ls,_a,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=Fn(t.start,t.stop,t.step||1).map((t=>{const n={};return n[r]=t,ra(n)})),e.add=n.add.concat(this.value),e}}),mt(Is,_a,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const Us=["unit0","unit1"];function Ws(t){_a.call(this,ht(),t)}function Hs(t){_a.call(this,null,t)}qs.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Se,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Us}]},mt(qs,_a,{transform(t,n){const e=t.field,r=!1!==t.interval,i="utc"===t.timezone,o=this._floor(t,n),a=(i?rr:er)(o.unit).offset,u=t.as||Us,s=u[0],c=u[1],f=o.step;let h=o.start||1/0,d=o.stop||-1/0,m=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(l(e)))&&(m=(n=n.reflow(!0)).SOURCE,h=1/0,d=-1/0),n.visit(m,(t=>{const n=e(t);let i,u;null==n?(t[s]=null,r&&(t[c]=null)):(t[s]=i=u=o(n),r&&(t[c]=u=a(i,f)),i<h&&(h=i),u>d&&(d=u))})),o.start=h,o.stop=d,n.modifies(r?u:s)},_floor(t,n){const e="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:br({extent:t.extent||st(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),o=Ee(r),a=this.value||{},u=(e?Ze:Je)(o,i);return u.unit=O(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),mt(Ws,_a,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,o)):n.changed()?(n.visit(n.REM,(t=>i.delete(r(t)))),n.visit(n.ADD,o)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),mt(Hs,_a,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(ua(t.sort)):n.source).map(t.field))}});const Gs={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=Gs.rank(),n=t.next;return{init:t.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t<i){for(;i+1<e.length&&!r(e[i],e[i+1]);)++i;t=i}return(1+t)/e.length}}},ntile:function(t,n){(n=+n)>0||p("ntile num must be greater than zero.");const e=Gs.cume_dist(),r=e.next;return{init:e.init,next:t=>Math.ceil(n*r(t))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:n=>t(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||p("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}},prev_value:function(t){let n;return{init:()=>n=null,next:e=>{const r=t(e.data[e.index]);return null!=r?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(t,n,e){for(let r=n.length;e<r;++e)if(null!=t(n[e]))return e;return-1}(t,i,r.index))<0?(e=i.length,n=null):n=t(i[e])}}}},Ys=Object.keys(Gs);function Vs(t){const n=K(t.ops),e=K(t.fields),r=K(t.params),i=K(t.aggregate_params),o=K(t.as),a=this.outputs=[],u=this.windows=[],s={},c={},h=[],d=[];let m=!0;function g(t){K(l(t)).forEach((t=>s[t]=1))}g(t.sort),n.forEach(((t,n)=>{const s=e[n],l=r[n],v=i[n]||null,y=f(s),b=Nu(t,y,o[n]);if(g(s),a.push(b),ft(Gs,t))u.push(function(t,n,e,r){const i=Gs[t](n,e);return{init:i.init||w,update:function(t,n){n[r]=i.next(t)}}}(t,s,l,b));else{if(null==s&&"count"!==t&&p("Null aggregate field specified."),"count"===t)return void h.push(b);m=!1;let n=c[y];n||(n=c[y]=[],n.field=s,d.push(n)),n.push(Bu(t,v,b))}})),(h.length||d.length)&&(this.cell=function(t,n,e){t=t.map((t=>Iu(t,t.field)));const r={num:0,agg:null,store:!1,count:n};if(!e)for(var i=t.length,o=r.agg=Array(i),a=0;a<i;++a)o[a]=new t[a](r);if(r.store)var u=r.data=new qu;return r.add=function(t){if(r.num+=1,!e){u&&u.add(t);for(let n=0;n<i;++n)o[n].add(o[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){u&&u.rem(t);for(let n=0;n<i;++n)o[n].rem(o[n].get(t),t)}},r.set=function(t){let i,a;for(u&&u.values(),i=0,a=n.length;i<a;++i)t[n[i]]=r.num;if(!e)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,u&&u.reset();for(let t=0;t<i;++t)o[t].init()},r}(d,h,m)),this.inputs=Object.keys(s)}const Xs=Vs.prototype;function Js(t){_a.call(this,{},t),this._mlen=0,this._mods=[]}function Ks(t,n,e,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],u=t.data(e),s=u.length,c=o?Qt(i):null,f={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:i||ot(-1)};n.init();for(let t=0;t<s;++t)Qs(f,a,t,s),o&&Zs(f,c),n.update(f,u[t])}function Qs(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function Zs(t,n){const e=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;e>0&&!i(o[e],o[e-1])&&(t.i0=n.left(o,o[e])),r<a&&!i(o[r],o[r+1])&&(t.i1=n.right(o,o[r]))}Xs.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},Xs.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(e){for(a=t.p0;a<t.i0;++a)e.rem(i[a]);for(a=t.p1;a<t.i1;++a)e.add(i[a]);e.set(n)}for(a=0;a<o;++a)r[a].update(t,n)},Js.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ys.concat(zu)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},mt(Js,_a,{transform(t,n){this.stamp=n.stamp;const e=t.modified(),r=ua(t.sort),i=Eu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!e||(a=this.state=new Vs(t)),e||n.modified(a.inputs)?(this.value={},n.visit(n.SOURCE,(t=>o(t).add(t)))):(n.visit(n.REM,(t=>o(t).remove(t))),n.visit(n.ADD,(t=>o(t).add(t))));for(let n=0,e=this._mlen;n<e;++n)Ks(this._mods[n],a,r,t);return this._mlen=0,this._mods=[],n.reflow(e).modifies(a.outputs)},group(t){let n=this.value[t];return n||(n=this.value[t]=Gu(na),n.stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n}});var tc=Object.freeze({__proto__:null,aggregate:Wu,bin:Hu,collect:Yu,compare:Vu,countpattern:Ju,cross:Ku,density:ns,dotbin:os,expression:as,extent:ss,facet:fs,field:ls,filter:ds,flatten:ms,fold:ps,formula:gs,generate:vs,impute:ws,joinaggregate:xs,kde:$s,key:ks,load:As,lookup:Ss,multiextent:Fs,multivalues:Ns,params:Os,pivot:_s,prefacet:zs,project:Bs,proxy:Ts,quantile:Ps,relay:js,sample:Rs,sequence:Ls,sieve:Is,subflow:cs,timeunit:qs,tupleindex:Ws,values:Hs,window:Js});function nc(t){return function(){return t}}const ec=Math.abs,rc=Math.atan2,ic=Math.cos,oc=Math.max,ac=Math.min,uc=Math.sin,sc=Math.sqrt,cc=1e-12,fc=Math.PI,lc=fc/2,hc=2*fc;function dc(t){return t>=1?lc:t<=-1?-lc:Math.asin(t)}const mc=Math.PI,pc=2*mc,gc=1e-6,vc=pc-gc;function yc(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}let bc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?yc:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return yc;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,s=r-n,c=o-t,f=a-n,l=c*c+f*f;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(l>gc)if(Math.abs(f*u-s*c)>gc&&i){let h=e-o,d=r-a,m=u*u+s*s,p=h*h+d*d,g=Math.sqrt(m),v=Math.sqrt(l),y=i*Math.tan((mc-Math.acos((m+l-p)/(2*g*v)))/2),b=y/v,w=y/g;Math.abs(b-1)>gc&&this._append`L${t+b*c},${n+b*f}`,this._append`A${i},${i},0,0,${+(f*h>c*d)},${this._x1=t+w*u},${this._y1=n+w*s}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,c=n+u,f=1^o,l=o?r-i:i-r;null===this._x1?this._append`M${s},${c}`:(Math.abs(this._x1-s)>gc||Math.abs(this._y1-c)>gc)&&this._append`L${s},${c}`,e&&(l<0&&(l=l%pc+pc),l>vc?this._append`A${e},${e},0,1,${f},${t-a},${n-u}A${e},${e},0,1,${f},${this._x1=s},${this._y1=c}`:l>gc&&this._append`A${e},${e},0,${+(l>=mc)},${f},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function wc(){return new bc}function xc(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new bc(n)}function $c(t){return t.innerRadius}function kc(t){return t.outerRadius}function Mc(t){return t.startAngle}function Ac(t){return t.endAngle}function Dc(t){return t&&t.padAngle}function Sc(t,n,e,r,i,o,a){var u=t-e,s=n-r,c=(a?o:-o)/sc(u*u+s*s),f=c*s,l=-c*u,h=t+f,d=n+l,m=e+f,p=r+l,g=(h+m)/2,v=(d+p)/2,y=m-h,b=p-d,w=y*y+b*b,x=i-o,$=h*p-m*d,k=(b<0?-1:1)*sc(oc(0,x*x*w-$*$)),M=($*b-y*k)/w,A=(-$*y-b*k)/w,D=($*b+y*k)/w,S=(-$*y+b*k)/w,F=M-g,E=A-v,N=D-g,C=S-v;return F*F+E*E>N*N+C*C&&(M=D,A=S),{cx:M,cy:A,x01:-f,y01:-l,x11:M*(i/x-1),y11:A*(i/x-1)}}function Fc(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ec(t){this._context=t}function Nc(t){return new Ec(t)}function Cc(t){return t[0]}function Oc(t){return t[1]}function _c(t,n){var e=nc(!0),r=null,i=Nc,o=null,a=xc(u);function u(u){var s,c,f,l=(u=Fc(u)).length,h=!1;for(null==r&&(o=i(f=a())),s=0;s<=l;++s)!(s<l&&e(c=u[s],s,u))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(c,s,u),+n(c,s,u));if(f)return o=null,f+""||null}return t="function"==typeof t?t:void 0===t?Cc:nc(t),n="function"==typeof n?n:void 0===n?Oc:nc(n),u.x=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:nc(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),u):r},u}function zc(t,n,e){var r=null,i=nc(!0),o=null,a=Nc,u=null,s=xc(c);function c(c){var f,l,h,d,m,p=(c=Fc(c)).length,g=!1,v=new Array(p),y=new Array(p);for(null==o&&(u=a(m=s())),f=0;f<=p;++f){if(!(f<p&&i(d=c[f],f,c))===g)if(g=!g)l=f,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),h=f-1;h>=l;--h)u.point(v[h],y[h]);u.lineEnd(),u.areaEnd()}g&&(v[f]=+t(d,f,c),y[f]=+n(d,f,c),u.point(r?+r(d,f,c):v[f],e?+e(d,f,c):y[f]))}if(m)return u=null,m+""||null}function f(){return _c().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Cc:nc(+t),n="function"==typeof n?n:nc(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?Oc:nc(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),r=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:nc(+t),c):r},c.y=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:nc(+t),c):e},c.lineX0=c.lineY0=function(){return f().x(t).y(n)},c.lineY1=function(){return f().x(t).y(e)},c.lineX1=function(){return f().x(r).y(n)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:nc(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}wc.prototype=bc.prototype,Ec.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var Bc={draw(t,n){const e=sc(n/fc);t.moveTo(e,0),t.arc(0,0,e,0,hc)}};function Tc(){}function Pc(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function jc(t){this._context=t}function Rc(t){this._context=t}function Lc(t){this._context=t}function Ic(t,n){this._basis=new jc(t),this._beta=n}jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Rc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Pc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ic.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,s=-1;++s<=e;)this._basis.point(this._beta*t[s]+(1-this._beta)*(i+(r=s/e)*a),this._beta*n[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var qc=function t(n){function e(t){return 1===n?new jc(t):new Ic(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Uc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Wc(t,n){this._context=t,this._k=(1-n)/6}Wc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Uc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Hc=function t(n){function e(t){return new Wc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gc(t,n){this._context=t,this._k=(1-n)/6}Gc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Yc=function t(n){function e(t){return new Gc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vc(t,n){this._context=t,this._k=(1-n)/6}Vc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Uc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Xc=function t(n){function e(t){return new Vc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Jc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>cc){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>cc){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/f,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Kc(t,n){this._context=t,this._alpha=n}Kc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Qc=function t(n){function e(t){return n?new Kc(t,n):new Wc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Zc(t,n){this._context=t,this._alpha=n}Zc.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var tf=function t(n){function e(t){return n?new Zc(t,n):new Gc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function nf(t,n){this._context=t,this._alpha=n}nf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Jc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var ef=function t(n){function e(t){return n?new nf(t,n):new Vc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function rf(t){this._context=t}function of(t){return t<0?-1:1}function af(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(of(o)+of(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function uf(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function sf(t,n,e){var r=t._x0,i=t._x1,o=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,t._y0+a*n,i-a,o-a*e,i,o)}function cf(t){this._context=t}function ff(t){this._context=new lf(t)}function lf(t){this._context=t}function hf(t){this._context=t}function df(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)o[n]-=e=i[n]/o[n-1],a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function mf(t,n){this._context=t,this._t=n}function pf(t,n){if("undefined"!=typeof document&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}rf.prototype={areaStart:Tc,areaEnd:Tc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},cf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sf(this,this._t0,uf(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,sf(this,uf(this,e=af(this,t,n)),e);break;default:sf(this,this._t0,e=af(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(ff.prototype=Object.create(cf.prototype)).point=function(t,n){cf.prototype.point.call(this,n,t)},lf.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},hf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=df(t),i=df(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},mf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};const gf=()=>"undefined"!=typeof Image?Image:null;function vf(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function yf(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const bf=Symbol("implicit");function wf(){var t=new an,n=[],e=[],r=bf;function i(i){let o=t.get(i);if(void 0===o){if(r!==bf)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new an;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return wf(n,e).unknown(r)},vf.apply(i,arguments),i}function xf(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function $f(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function kf(){}var Mf=.7,Af=1/Mf,Df="\\s*([+-]?\\d+)\\s*",Sf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ff="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ef=/^#([0-9a-f]{3,8})$/,Nf=new RegExp(`^rgb\\(${Df},${Df},${Df}\\)$`),Cf=new RegExp(`^rgb\\(${Ff},${Ff},${Ff}\\)$`),Of=new RegExp(`^rgba\\(${Df},${Df},${Df},${Sf}\\)$`),_f=new RegExp(`^rgba\\(${Ff},${Ff},${Ff},${Sf}\\)$`),zf=new RegExp(`^hsl\\(${Sf},${Ff},${Ff}\\)$`),Bf=new RegExp(`^hsla\\(${Sf},${Ff},${Ff},${Sf}\\)$`),Tf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Pf(){return this.rgb().formatHex()}function jf(){return this.rgb().formatRgb()}function Rf(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Ef.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Lf(n):3===e?new Wf(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?If(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?If(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Nf.exec(t))?new Wf(n[1],n[2],n[3],1):(n=Cf.exec(t))?new Wf(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Of.exec(t))?If(n[1],n[2],n[3],n[4]):(n=_f.exec(t))?If(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=zf.exec(t))?Jf(n[1],n[2]/100,n[3]/100,1):(n=Bf.exec(t))?Jf(n[1],n[2]/100,n[3]/100,n[4]):Tf.hasOwnProperty(t)?Lf(Tf[t]):"transparent"===t?new Wf(NaN,NaN,NaN,0):null}function Lf(t){return new Wf(t>>16&255,t>>8&255,255&t,1)}function If(t,n,e,r){return r<=0&&(t=n=e=NaN),new Wf(t,n,e,r)}function qf(t){return t instanceof kf||(t=Rf(t)),t?new Wf((t=t.rgb()).r,t.g,t.b,t.opacity):new Wf}function Uf(t,n,e,r){return 1===arguments.length?qf(t):new Wf(t,n,e,null==r?1:r)}function Wf(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hf(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}`}function Gf(){const t=Yf(this.opacity);return`${1===t?"rgb(":"rgba("}${Vf(this.r)}, ${Vf(this.g)}, ${Vf(this.b)}${1===t?")":`, ${t})`}`}function Yf(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xf(t){return((t=Vf(t))<16?"0":"")+t.toString(16)}function Jf(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Zf(t,n,e,r)}function Kf(t){if(t instanceof Zf)return new Zf(t.h,t.s,t.l,t.opacity);if(t instanceof kf||(t=Rf(t)),!t)return new Zf;if(t instanceof Zf)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Zf(a,u,s,t.opacity)}function Qf(t,n,e,r){return 1===arguments.length?Kf(t):new Zf(t,n,e,null==r?1:r)}function Zf(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function tl(t){return(t=(t||0)%360)<0?t+360:t}function nl(t){return Math.max(0,Math.min(1,t||0))}function el(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}xf(kf,Rf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pf,formatHex:Pf,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Kf(this).formatHsl()},formatRgb:jf,toString:jf}),xf(Wf,Uf,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Wf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Wf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Wf(Vf(this.r),Vf(this.g),Vf(this.b),Yf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Hf,formatHex:Hf,formatHex8:function(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}${Xf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Gf,toString:Gf})),xf(Zf,Qf,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Zf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Zf(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Wf(el(t>=240?t-240:t+120,i,r),el(t,i,r),el(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Zf(tl(this.h),nl(this.s),nl(this.l),Yf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Yf(this.opacity);return`${1===t?"hsl(":"hsla("}${tl(this.h)}, ${100*nl(this.s)}%, ${100*nl(this.l)}%${1===t?")":`, ${t})`}`}}));const rl=Math.PI/180,il=180/Math.PI,ol=.96422,al=.82521,ul=4/29,sl=6/29,cl=3*sl*sl,fl=sl*sl*sl;function ll(t){if(t instanceof dl)return new dl(t.l,t.a,t.b,t.opacity);if(t instanceof bl)return wl(t);t instanceof Wf||(t=qf(t));var n,e,r=vl(t.r),i=vl(t.g),o=vl(t.b),a=ml((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=ml((.4360747*r+.3850649*i+.1430804*o)/ol),e=ml((.0139322*r+.0971045*i+.7141733*o)/al)),new dl(116*a-16,500*(n-a),200*(a-e),t.opacity)}function hl(t,n,e,r){return 1===arguments.length?ll(t):new dl(t,n,e,null==r?1:r)}function dl(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ml(t){return t>fl?Math.pow(t,1/3):t/cl+ul}function pl(t){return t>sl?t*t*t:cl*(t-ul)}function gl(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function vl(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yl(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof bl)return new bl(t.h,t.c,t.l,t.opacity);if(t instanceof dl||(t=ll(t)),0===t.a&&0===t.b)return new bl(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*il;return new bl(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new bl(t,n,e,null==r?1:r)}function bl(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function wl(t){if(isNaN(t.h))return new dl(t.l,0,0,t.opacity);var n=t.h*rl;return new dl(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}xf(dl,hl,$f(kf,{brighter(t){return new dl(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new dl(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Wf(gl(3.1338561*(n=ol*pl(n))-1.6168667*(t=1*pl(t))-.4906146*(e=al*pl(e))),gl(-.9787684*n+1.9161415*t+.033454*e),gl(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),xf(bl,yl,$f(kf,{brighter(t){return new bl(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new bl(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return wl(this).rgb()}}));var xl=-.14861,$l=1.78277,kl=-.29227,Ml=-.90649,Al=1.97294,Dl=Al*Ml,Sl=Al*$l,Fl=$l*kl-Ml*xl;function El(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Nl)return new Nl(t.h,t.s,t.l,t.opacity);t instanceof Wf||(t=qf(t));var n=t.g/255,e=t.b/255,r=(Fl*e+Dl*(t.r/255)-Sl*n)/(Fl+Dl-Sl),i=e-r,o=(Al*(n-r)-kl*i)/Ml,a=Math.sqrt(o*o+i*i)/(Al*r*(1-r)),u=a?Math.atan2(o,i)*il-120:NaN;return new Nl(u<0?u+360:u,a,r,t.opacity)}(t):new Nl(t,n,e,null==r?1:r)}function Nl(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Cl(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Ol(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1];return Cl((e-r/n)*n,r>0?t[r-1]:2*i-o,i,o,r<n-1?t[r+2]:2*o-i)}}function _l(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n);return Cl((e-r/n)*n,t[(r+n-1)%n],t[r%n],t[(r+1)%n],t[(r+2)%n])}}xf(Nl,El,$f(kf,{brighter(t){return t=null==t?Af:Math.pow(Af,t),new Nl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Mf:Math.pow(Mf,t),new Nl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*rl,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Wf(255*(n+e*(xl*r+$l*i)),255*(n+e*(kl*r+Ml*i)),255*(n+e*(Al*r)),this.opacity)}}));var zl=t=>()=>t;function Bl(t,n){return function(e){return t+e*n}}function Tl(t,n){var e=n-t;return e?Bl(t,e>180||e<-180?e-360*Math.round(e/360):e):zl(isNaN(t)?n:t)}function Pl(t,n){var e=n-t;return e?Bl(t,e):zl(isNaN(t)?n:t)}var jl=function t(n){var e=function(t){return 1==(t=+t)?Pl:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):zl(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Uf(t)).r,(n=Uf(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Pl(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Rl(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Uf(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Ll=Rl(Ol),Il=Rl(_l);function ql(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Ul(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Wl(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Kl(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Hl(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Gl(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Yl(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Kl(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Vl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xl=new RegExp(Vl.source,"g");function Jl(t,n){var e,r,i,o=Vl.lastIndex=Xl.lastIndex=0,a=-1,u=[],s=[];for(t+="",n+="";(e=Vl.exec(t))&&(r=Xl.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Gl(e,r)})),o=Xl.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}function Kl(t,n){var e,r=typeof n;return null==n||"boolean"===r?zl(n):("number"===r?Gl:"string"===r?(e=Rf(n))?(n=e,jl):Jl:n instanceof Rf?jl:n instanceof Date?Hl:Ul(n)?ql:Array.isArray(n)?Wl:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Yl:Gl)(t,n)}function Ql(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Zl,th=180/Math.PI,nh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function eh(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*th,skewX:Math.atan(s)*th,scaleX:a,scaleY:u}}function rh(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Gl(t,i)},{i:s-2,x:Gl(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Gl(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Gl(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Gl(t,e)},{i:u-2,x:Gl(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e<r;)u[(n=s[e]).i]=n.x(t);return u.join("")}}}var ih=rh((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?nh:eh(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),oh=rh((function(t){return null==t?nh:(Zl||(Zl=document.createElementNS("http://www.w3.org/2000/svg","g")),Zl.setAttribute("transform",t),(t=Zl.transform.baseVal.consolidate())?eh((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):nh)}),", ",")",")");function ah(t){return((t=Math.exp(t))+1/t)/2}var uh=function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],f=i[2],l=i[0]-u,h=i[1]-s,d=l*l+h*h;if(d<1e-12)a=Math.log(f/c)/n,o=function(t){return[u+t*l,s+t*h,c*Math.exp(n*t*a)]};else{var m=Math.sqrt(d),p=(f*f-c*c+r*d)/(2*c*e*m),g=(f*f-c*c-r*d)/(2*f*e*m),v=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(g*g+1)-g);a=(y-v)/n,o=function(t){var r=t*a,i=ah(v),o=c/(e*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[u+o*l,s+o*h,c*i/ah(n*r+v)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function sh(t){return function(n,e){var r=t((n=Qf(n)).h,(e=Qf(e)).h),i=Pl(n.s,e.s),o=Pl(n.l,e.l),a=Pl(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var ch=sh(Tl),fh=sh(Pl);function lh(t){return function(n,e){var r=t((n=yl(n)).h,(e=yl(e)).h),i=Pl(n.c,e.c),o=Pl(n.l,e.l),a=Pl(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var hh=lh(Tl),dh=lh(Pl);function mh(t){return function n(e){function r(n,r){var i=t((n=El(n)).h,(r=El(r)).h),o=Pl(n.s,r.s),a=Pl(n.l,r.l),u=Pl(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var ph=mh(Tl),gh=mh(Pl);function vh(t,n){void 0===n&&(n=t,t=Kl);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var yh=Object.freeze({__proto__:null,interpolate:Kl,interpolateArray:function(t,n){return(Ul(n)?ql:Wl)(t,n)},interpolateBasis:Ol,interpolateBasisClosed:_l,interpolateCubehelix:ph,interpolateCubehelixLong:gh,interpolateDate:Hl,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHcl:hh,interpolateHclLong:dh,interpolateHsl:ch,interpolateHslLong:fh,interpolateHue:function(t,n){var e=Tl(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateLab:function(t,n){var e=Pl((t=hl(t)).l,(n=hl(n)).l),r=Pl(t.a,n.a),i=Pl(t.b,n.b),o=Pl(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},interpolateNumber:Gl,interpolateNumberArray:ql,interpolateObject:Yl,interpolateRgb:jl,interpolateRgbBasis:Ll,interpolateRgbBasisClosed:Il,interpolateRound:Ql,interpolateString:Jl,interpolateTransformCss:ih,interpolateTransformSvg:oh,interpolateZoom:uh,piecewise:vh,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function bh(t){return+t}var wh=[0,1];function xh(t){return t}function $h(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function kh(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=$h(i,r),o=e(a,o)):(r=$h(r,i),o=e(o,a)),function(t){return o(r(t))}}function Mh(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=$h(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=en(t,n,1,r)-1;return o[e](i[e](n))}}function Ah(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Dh(){var t,n,e,r,i,o,a=wh,u=wh,s=Kl,c=xh;function f(){var t=Math.min(a.length,u.length);return c!==xh&&(c=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?Mh:kh,i=o=null,l}function l(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return l.invert=function(e){return c(n((o||(o=r(u,a.map(t),Gl)))(e)))},l.domain=function(t){return arguments.length?(a=Array.from(t,bh),f()):a.slice()},l.range=function(t){return arguments.length?(u=Array.from(t),f()):u.slice()},l.rangeRound=function(t){return u=Array.from(t),s=Ql,f()},l.clamp=function(t){return arguments.length?(c=!!t||xh,f()):c!==xh},l.interpolate=function(t){return arguments.length?(s=t,f()):s},l.unknown=function(t){return arguments.length?(e=t,l):e},function(e,r){return t=e,n=r,f()}}function Sh(){return Dh()(xh,xh)}function Fh(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Eh(t){return(t=Fh(Math.abs(t)))?t[1]:NaN}var Nh,Ch=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oh(t){if(!(n=Ch.exec(t)))throw new Error("invalid format: "+t);var n;return new _h({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function _h(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function zh(t,n){var e=Fh(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Oh.prototype=_h.prototype,_h.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Bh={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return zh(100*t,n)},r:zh,s:function(t,n){var e=Fh(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Nh=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Fh(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Th(t){return t}var Ph,jh,Rh,Lh=Array.prototype.map,Ih=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function qh(t,n,e,r){var i,o=bn(t,n,e);switch((r=Oh(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Eh(n)/3)))-Eh(Math.abs(t)))}(o,a))||(r.precision=i),Rh(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Eh(n)-Eh(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Eh(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return jh(r)}function Uh(t){var n=t.domain;return t.ticks=function(t){var e=n();return vn(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return qh(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,s=o[a],c=o[u],f=10;for(c<s&&(i=s,s=c,c=i,i=a,a=u,u=i);f-- >0;){if((i=yn(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Wh(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Hh(t){return Math.log(t)}function Gh(t){return Math.exp(t)}function Yh(t){return-Math.log(-t)}function Vh(t){return-Math.exp(-t)}function Xh(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Jh(t){return(n,e)=>-t(-n,e)}function Kh(t){const n=t(Hh,Gh),e=n.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?Xh:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=Jh(r),i=Jh(i),t(Yh,Vh)):t(Hh,Gh),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],u=n[n.length-1];const s=u<a;s&&([a,u]=[u,a]);let c,f,l=r(a),h=r(u);const d=null==t?10:+t;let m=[];if(!(o%1)&&h-l<d){if(l=Math.floor(l),h=Math.ceil(h),a>0){for(;l<=h;++l)for(c=1;c<o;++c)if(f=l<0?c/i(-l):c*i(l),!(f<a)){if(f>u)break;m.push(f)}}else for(;l<=h;++l)for(c=o-1;c>=1;--c)if(f=l>0?c/i(-l):c*i(l),!(f<a)){if(f>u)break;m.push(f)}2*m.length<d&&(m=vn(a,u,d))}else m=vn(l,h,Math.min(h-l,d)).map(i);return s?m.reverse():m},n.tickFormat=(t,e)=>{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=Oh(e)).precision||(e.trim=!0),e=jh(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*o<o-.5&&(n*=o),n<=a?e(t):""}},n.nice=()=>e(Wh(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function Qh(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Zh(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function td(t){var n=1,e=t(Qh(n),Zh(n));return e.constant=function(e){return arguments.length?t(Qh(n=+e),Zh(n)):n},Uh(e)}function nd(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function ed(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function rd(t){return t<0?-t*t:t*t}function id(t){var n=t(xh,xh),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(xh,xh):.5===e?t(ed,rd):t(nd(e),nd(1/e)):e},Uh(n)}function od(){var t=id(Dh());return t.copy=function(){return Ah(t,od()).exponent(t.exponent())},vf.apply(t,arguments),t}Ph=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Th:(n=Lh.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=t.decimal+"",u=void 0===t.numerals?Th:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Lh.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function l(t){var n=(t=Oh(t)).fill,e=t.align,l=t.sign,h=t.symbol,d=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):Bh[y]||(void 0===g&&(g=12),v=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var b="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?s:"",x=Bh[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,h=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==l&&(M=!1),h=(M?"("===l?l:c:"-"===l||"("===l?"":l)+h,k=("s"===y?Ih[8+Nh/3]:"")+k+(M&&"("===l?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!d&&(t=r(t,1/0));var A=h.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&d&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=h+t+k+D;break;case"=":t=h+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+h+t+k+D.slice(A);break;default:t=D+h+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:l,formatPrefix:function(t,n){var e=l(((t=Oh(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Eh(n)/3))),i=Math.pow(10,-r),o=Ih[8+r/3];return function(t){return e(i*t)+o}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),jh=Ph.format,Rh=Ph.formatPrefix;const ad=new Date,ud=new Date;function sd(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>sd((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(ad.setTime(+n),ud.setTime(+r),t(ad),t(ud),Math.floor(e(ad,ud))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const cd=sd((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));cd.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?sd((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):cd:null);const fd=1e3,ld=6e4,hd=36e5,dd=864e5,md=6048e5,pd=31536e6,gd=sd((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*fd)}),((t,n)=>(n-t)/fd),(t=>t.getUTCSeconds())),vd=sd((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fd)}),((t,n)=>{t.setTime(+t+n*ld)}),((t,n)=>(n-t)/ld),(t=>t.getMinutes())),yd=sd((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*ld)}),((t,n)=>(n-t)/ld),(t=>t.getUTCMinutes())),bd=sd((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fd-t.getMinutes()*ld)}),((t,n)=>{t.setTime(+t+n*hd)}),((t,n)=>(n-t)/hd),(t=>t.getHours())),wd=sd((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*hd)}),((t,n)=>(n-t)/hd),(t=>t.getUTCHours())),xd=sd((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ld)/dd),(t=>t.getDate()-1)),$d=sd((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dd),(t=>t.getUTCDate()-1)),kd=sd((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dd),(t=>Math.floor(t/dd)));function Md(t){return sd((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ld)/md))}const Ad=Md(0);function Dd(t){return sd((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/md))}Md(1),Md(2),Md(3),Md(4),Md(5),Md(6);const Sd=Dd(0);Dd(1),Dd(2),Dd(3),Dd(4),Dd(5),Dd(6);const Fd=sd((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),Ed=sd((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),Nd=sd((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Nd.every=t=>isFinite(t=Math.floor(t))&&t>0?sd((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const Cd=sd((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Od(t,n,e,r,i,o){const a=[[gd,1,fd],[gd,5,5e3],[gd,15,15e3],[gd,30,3e4],[o,1,ld],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,hd],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,dd],[r,2,1728e5],[e,1,md],[n,1,2592e6],[n,3,7776e6],[t,1,pd]];function u(n,e,r){const i=Math.abs(e-n)/r,o=Qt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(bn(n/pd,e/pd,r));if(0===o)return cd.every(Math.max(bn(n,e,r),1));const[u,s]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return u.every(s)}return[function(t,n,e){const r=n<t;r&&([t,n]=[n,t]);const i=e&&"function"==typeof e.range?e:u(t,n,e),o=i?i.range(t,+n+1):[];return r?o.reverse():o},u]}Cd.every=t=>isFinite(t=Math.floor(t))&&t>0?sd((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const[_d,zd]=Od(Cd,Ed,Sd,kd,wd,yd),[Bd,Td]=Od(Nd,Fd,Ad,xd,bd,vd);function Pd(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function jd(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Rd(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var Ld,Id,qd,Ud={"-":"",_:" ",0:"0"},Wd=/^\s*\d+/,Hd=/^%/,Gd=/[\\^$*+?|[\]().{}]/g;function Yd(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Vd(t){return t.replace(Gd,"\\$&")}function Xd(t){return new RegExp("^(?:"+t.map(Vd).join("|")+")","i")}function Jd(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Kd(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Qd(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Zd(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function tm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function nm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function em(t,n,e){var r=Wd.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function rm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function im(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function om(t,n,e){var r=Wd.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function am(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function um(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function sm(t,n,e){var r=Wd.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function cm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function fm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function lm(t,n,e){var r=Wd.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function hm(t,n,e){var r=Wd.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function dm(t,n,e){var r=Wd.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function mm(t,n,e){var r=Hd.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function pm(t,n,e){var r=Wd.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function gm(t,n,e){var r=Wd.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function vm(t,n){return Yd(t.getDate(),n,2)}function ym(t,n){return Yd(t.getHours(),n,2)}function bm(t,n){return Yd(t.getHours()%12||12,n,2)}function wm(t,n){return Yd(1+Ar.count(Nr(t),t),n,3)}function xm(t,n){return Yd(t.getMilliseconds(),n,3)}function $m(t,n){return xm(t,n)+"000"}function km(t,n){return Yd(t.getMonth()+1,n,2)}function Mm(t,n){return Yd(t.getMinutes(),n,2)}function Am(t,n){return Yd(t.getSeconds(),n,2)}function Dm(t){var n=t.getDay();return 0===n?7:n}function Sm(t,n){return Yd(Sr.count(Nr(t)-1,t),n,2)}function Fm(t){var n=t.getDay();return n>=4||0===n?Er(t):Er.ceil(t)}function Em(t,n){return t=Fm(t),Yd(Er.count(Nr(t),t)+(4===Nr(t).getDay()),n,2)}function Nm(t){return t.getDay()}function Cm(t,n){return Yd(Fr.count(Nr(t)-1,t),n,2)}function Om(t,n){return Yd(t.getFullYear()%100,n,2)}function _m(t,n){return Yd((t=Fm(t)).getFullYear()%100,n,2)}function zm(t,n){return Yd(t.getFullYear()%1e4,n,4)}function Bm(t,n){var e=t.getDay();return Yd((t=e>=4||0===e?Er(t):Er.ceil(t)).getFullYear()%1e4,n,4)}function Tm(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Yd(n/60|0,"0",2)+Yd(n%60,"0",2)}function Pm(t,n){return Yd(t.getUTCDate(),n,2)}function jm(t,n){return Yd(t.getUTCHours(),n,2)}function Rm(t,n){return Yd(t.getUTCHours()%12||12,n,2)}function Lm(t,n){return Yd(1+Cr.count(Tr(t),t),n,3)}function Im(t,n){return Yd(t.getUTCMilliseconds(),n,3)}function qm(t,n){return Im(t,n)+"000"}function Um(t,n){return Yd(t.getUTCMonth()+1,n,2)}function Wm(t,n){return Yd(t.getUTCMinutes(),n,2)}function Hm(t,n){return Yd(t.getUTCSeconds(),n,2)}function Gm(t){var n=t.getUTCDay();return 0===n?7:n}function Ym(t,n){return Yd(_r.count(Tr(t)-1,t),n,2)}function Vm(t){var n=t.getUTCDay();return n>=4||0===n?Br(t):Br.ceil(t)}function Xm(t,n){return t=Vm(t),Yd(Br.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function Jm(t){return t.getUTCDay()}function Km(t,n){return Yd(zr.count(Tr(t)-1,t),n,2)}function Qm(t,n){return Yd(t.getUTCFullYear()%100,n,2)}function Zm(t,n){return Yd((t=Vm(t)).getUTCFullYear()%100,n,2)}function tp(t,n){return Yd(t.getUTCFullYear()%1e4,n,4)}function np(t,n){var e=t.getUTCDay();return Yd((t=e>=4||0===e?Br(t):Br.ceil(t)).getUTCFullYear()%1e4,n,4)}function ep(){return"+0000"}function rp(){return"%"}function ip(t){return+t}function op(t){return Math.floor(+t/1e3)}function ap(t){return new Date(t)}function up(t){return t instanceof Date?+t:+new Date(+t)}function sp(t,n,e,r,i,o,a,u,s,c){var f=Sh(),l=f.invert,h=f.domain,d=c(".%L"),m=c(":%S"),p=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function x(t){return(s(t)<t?d:u(t)<t?m:a(t)<t?p:o(t)<t?g:r(t)<t?i(t)<t?v:y:e(t)<t?b:w)(t)}return f.invert=function(t){return new Date(l(t))},f.domain=function(t){return arguments.length?h(Array.from(t,up)):h().map(ap)},f.ticks=function(n){var e=h();return t(e[0],e[e.length-1],null==n?10:n)},f.tickFormat=function(t,n){return null==n?x:c(n)},f.nice=function(t){var e=h();return t&&"function"==typeof t.range||(t=n(e[0],e[e.length-1],null==t?10:t)),t?h(Wh(e,t)):f},f.copy=function(){return Ah(f,sp(t,n,e,r,i,o,a,u,s,c))},f}function cp(){var t,n,e,r,i,o=0,a=1,u=xh,s=!1;function c(n){return null==n||isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}function f(t){return function(n){var e,r;return arguments.length?([e,r]=n,u=t(e,r),c):[u(0),u(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),n=r(a=+a),e=t===n?0:1/(n-t),c):[o,a]},c.clamp=function(t){return arguments.length?(s=!!t,c):s},c.interpolator=function(t){return arguments.length?(u=t,c):u},c.range=f(Kl),c.rangeRound=f(Ql),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),c}}function fp(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function lp(){var t=Uh(cp()(xh));return t.copy=function(){return fp(t,lp())},yf.apply(t,arguments)}function hp(){var t=id(cp());return t.copy=function(){return fp(t,hp()).exponent(t.exponent())},yf.apply(t,arguments)}function dp(){var t,n,e,r,i,o,a,u=0,s=.5,c=1,f=1,l=xh,h=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(f*t<f*n?r:i),l(h?Math.max(0,Math.min(1,t)):t))}function m(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,l=vh(t,[e,r,i]),d):[l(0),l(.5),l(1)]}}return d.domain=function(a){return arguments.length?([u,s,c]=a,t=o(u=+u),n=o(s=+s),e=o(c=+c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),f=n<t?-1:1,d):[u,s,c]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(l=t,d):l},d.range=m(Kl),d.rangeRound=m(Ql),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(u),n=a(s),e=a(c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),f=n<t?-1:1,d}}function mp(){var t=id(dp());return t.copy=function(){return fp(t,mp()).exponent(t.exponent())},yf.apply(t,arguments)}function pp(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}Ld=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Xd(i),f=Jd(i),l=Xd(o),h=Jd(o),d=Xd(a),m=Jd(a),p=Xd(u),g=Jd(u),v=Xd(s),y=Jd(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:vm,e:vm,f:$m,g:_m,G:Bm,H:ym,I:bm,j:wm,L:xm,m:km,M:Mm,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ip,s:op,S:Am,u:Dm,U:Sm,V:Em,w:Nm,W:Cm,x:null,X:null,y:Om,Y:zm,Z:Tm,"%":rp},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Pm,e:Pm,f:qm,g:Zm,G:np,H:jm,I:Rm,j:Lm,L:Im,m:Um,M:Wm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ip,s:op,S:Hm,u:Gm,U:Ym,V:Xm,w:Jm,W:Km,x:null,X:null,y:Qm,Y:tp,Z:ep,"%":rp},x={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=m[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:um,e:um,f:dm,g:rm,G:em,H:cm,I:cm,j:sm,L:hm,m:am,M:fm,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=f[r[0].toLowerCase()],e+r[0].length):-1},q:om,Q:pm,s:gm,S:lm,u:Qd,U:Zd,V:tm,w:Kd,W:nm,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:rm,Y:em,Z:im,"%":mm};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Ud[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Rd(1900,void 0,1);if(M(o,t,e+="",0)!=e.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(n&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=jd(Rd(o.y,0,1))).getUTCDay(),r=i>4||0===i?zr.ceil(r):zr(r),r=Cr.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Pd(Rd(o.y,0,1))).getDay(),r=i>4||0===i?Fr.ceil(r):Fr(r),r=Ar.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?jd(Rd(o.y,0,1)).getUTCDay():Pd(Rd(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,jd(o)):Pd(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Ud?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Id=Ld.format,qd=Ld.utcFormat;var gp=pp("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),vp=pp("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),yp=pp("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),bp=pp("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),wp=pp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),xp=pp("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),$p=pp("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),kp=pp("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Mp=pp("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Ap=pp("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Dp(t,n,e){const r=t-n+2*e;return t?r>0?r:1:0}const Sp="linear",Fp="log",Ep="pow",Np="sqrt",Cp="symlog",Op="time",_p="utc",zp="sequential",Bp="diverging",Tp="quantile",Pp="quantize",jp="threshold",Rp="ordinal",Lp="point",Ip="band",qp="bin-ordinal",Up="continuous",Wp="discrete",Hp="discretizing",Gp="interpolating",Yp="temporal";function Vp(){const t=wf().unknown(void 0),n=t.domain,e=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,c=.5;function f(){const t=n().length,f=o[1]<o[0],l=o[1-f],h=Dp(t,u,s);let d=o[f-0];r=(l-d)/(h||1),a&&(r=Math.floor(r)),d+=(l-d-r*(t-u))*c,i=r*(1-u),a&&(d=Math.round(d),i=Math.round(i));const m=Fn(t).map((t=>d+r*t));return e(f?m.reverse():m)}return delete t.unknown,t.domain=function(t){return arguments.length?(n(t),f()):n()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],f()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,f()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,f()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,f()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),f()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),f()):s},t.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),f()):c},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?e().reverse():e(),u=a.length-1;let s,c,f,l=+t[0],h=+t[1];return l!=l||h!=h||(h<l&&(f=l,l=h,h=f),h<a[0]||l>o[1-r])?void 0:(s=Math.max(0,en(a,l)-1),c=l===h?s:en(a,h)-1,l-a[s]>i+1e-10&&++s,r&&(f=s,s=u-c,c=u-f),s>c?void 0:n().slice(s,c+1))},t.invert=function(n){const e=t.invertRange([n,n]);return e?e[0]:e},t.copy=function(){return Vp().domain(n()).range(o).round(a).paddingInner(u).paddingOuter(s).align(c)},f()}function Xp(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Xp(n())},t}var Jp=Array.prototype.map;const Kp=Array.prototype.slice,Qp=new Map,Zp=Symbol("vega_scale");function tg(t){return t[Zp]=!0,t}function ng(t,n,e){return arguments.length>1?(Qp.set(t,function(t,n,e){const r=function(){const e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){let e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){const e=t.range();let r,i,o,a,u=n[0],s=n[1],c=-1;for(s<u&&(i=u,u=s,s=i),o=0,a=e.length;o<a;++o)e[o]>=u&&e[o]<=s&&(c<0&&(c=o),r=o);if(!(c<0))return u=t.invertExtent(e[c]),s=t.invertExtent(e[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,tg(e)};return r.metadata=zt(K(e)),r}(t,n,e)),this):eg(t)?Qp.get(t):void 0}function eg(t){return Qp.has(t)}function rg(t,n){const e=Qp.get(t);return e&&e.metadata[n]}function ig(t){return rg(t,Up)}function og(t){return rg(t,Wp)}function ag(t){return rg(t,Hp)}function ug(t){return rg(t,Fp)}function sg(t){return rg(t,Gp)}function cg(t){return rg(t,Tp)}ng("identity",(function t(n){var e;function r(t){return null==t||isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,bh),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,bh):[0,1],Uh(r)})),ng(Sp,(function t(){var n=Sh();return n.copy=function(){return Ah(n,t())},vf.apply(n,arguments),Uh(n)}),Up),ng(Fp,(function t(){const n=Kh(Dh()).domain([1,10]);return n.copy=()=>Ah(n,t()).base(n.base()),vf.apply(n,arguments),n}),[Up,Fp]),ng(Ep,od,Up),ng(Np,(function(){return od.apply(null,arguments).exponent(.5)}),Up),ng(Cp,(function t(){var n=td(Dh());return n.copy=function(){return Ah(n,t()).constant(n.constant())},vf.apply(n,arguments)}),Up),ng(Op,(function(){return vf.apply(sp(Bd,Td,Nd,Fd,Ad,xd,bd,vd,gd,Id).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Up,Yp]),ng(_p,(function(){return vf.apply(sp(_d,zd,Cd,Ed,Sd,$d,wd,yd,gd,qd).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Up,Yp]),ng(zp,lp,[Up,Gp]),ng(`${zp}-${Sp}`,lp,[Up,Gp]),ng(`${zp}-${Fp}`,(function t(){var n=Kh(cp()).domain([1,10]);return n.copy=function(){return fp(n,t()).base(n.base())},yf.apply(n,arguments)}),[Up,Gp,Fp]),ng(`${zp}-${Ep}`,hp,[Up,Gp]),ng(`${zp}-${Np}`,(function(){return hp.apply(null,arguments).exponent(.5)}),[Up,Gp]),ng(`${zp}-${Cp}`,(function t(){var n=td(cp());return n.copy=function(){return fp(n,t()).constant(n.constant())},yf.apply(n,arguments)}),[Up,Gp]),ng(`${Bp}-${Sp}`,(function t(){var n=Uh(dp()(xh));return n.copy=function(){return fp(n,t())},yf.apply(n,arguments)}),[Up,Gp]),ng(`${Bp}-${Fp}`,(function t(){var n=Kh(dp()).domain([.1,1,10]);return n.copy=function(){return fp(n,t()).base(n.base())},yf.apply(n,arguments)}),[Up,Gp,Fp]),ng(`${Bp}-${Ep}`,mp,[Up,Gp]),ng(`${Bp}-${Np}`,(function(){return mp.apply(null,arguments).exponent(.5)}),[Up,Gp]),ng(`${Bp}-${Cp}`,(function t(){var n=td(dp());return n.copy=function(){return fp(n,t()).constant(n.constant())},yf.apply(n,arguments)}),[Up,Gp]),ng(Tp,(function t(){var n,e=[],r=[],i=[];function o(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=An(e,t/n);return a}function a(t){return null==t||isNaN(t=+t)?n:r[en(i,t)]}return a.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Jt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(n=t,a):n},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(e).range(r).unknown(n)},vf.apply(a,arguments)}),[Hp,Tp]),ng(Pp,(function t(){var n,e=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[en(o,t,0,i)]:n}function s(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,s()):[e,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,s()):a.slice()},u.invertExtent=function(t){var n=a.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},u.unknown=function(t){return arguments.length?(n=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([e,r]).range(a).unknown(n)},vf.apply(Uh(u),arguments)}),Hp),ng(jp,(function t(){var n,e=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[en(e,t,0,i)]:n}return o.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),o):e.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t().domain(e).range(r).unknown(n)},vf.apply(o,arguments)}),Hp),ng(qp,(function t(){let n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(en(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=function(t){return Jp.call(t,_)}(t),r):n.slice()},r.range=function(t){return arguments.length?(e=Kp.call(t),r):e.slice()},r.tickFormat=function(t,e){return qh(n[0],O(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Wp,Hp]),ng(Rp,wf,Wp),ng(Ip,Vp,Wp),ng(Lp,(function(){return Xp(Vp().paddingInner(1))}),Wp);const fg=["clamp","base","constant","exponent"];function lg(t,n){const e=n[0],r=O(n)-e;return function(n){return t(e+n*r)}}function hg(t,n,e){return vh(pg(n||"rgb",e),t)}function dg(t,n){const e=new Array(n),r=n+1;for(let i=0;i<n;)e[i]=t(++i/r);return e}function mg(t,n,e){const r=e-n;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=ng(o)().domain([n,e]).range([0,1]),fg.forEach((n=>t[n]?a[n](t[n]()):0)),a):ot(.5)}function pg(t,n){const e=yh[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function gg(t){if(D(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function vg(t,n){for(const e in t)bg(e,n(t[e]))}const yg={};function bg(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(yg[t]=n,this):yg[t]}vg({accent:vp,category10:gp,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:yp,observable10:bp,paired:wp,pastel1:xp,pastel2:$p,set1:kp,set2:Mp,set3:Ap,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},gg),vg({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>hg(gg(t))));const wg="symbol",xg=t=>D(t)?t.map((t=>String(t))):String(t),$g=(t,n)=>t[1]-n[1],kg=(t,n)=>n[1]-t[1];function Mg(t,n,e){let r;return bt(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,Math.floor(Ft(t.domain())/e||1)+1))),S(n)&&(r=n.step,n=n.interval),xt(n)&&(n=t.type===Op?er(n):t.type==_p?rr(n):p("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Ag(t,n,e){let r=t.range(),i=r[0],o=O(r),a=$g;if(i>o&&(r=o,o=i,i=r,a=kg),i=Math.floor(i),o=Math.ceil(o),n=n.map((n=>[n,t(n)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),e>0&&n.length>1){const t=[n[0],O(n)];for(;n.length>e&&n.length>=3;)n=n.filter(((t,n)=>!(n%2)));n.length<3&&(n=t)}return n}function Dg(t,n){return t.bins?Ag(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function Sg(t,n,e,r,i,o){const a=n.type;let u=xg;if(a===Op||i===Op)u=t.timeFormat(r);else if(a===_p||i===_p)u=t.utcFormat(r);else if(ug(a)){const i=t.formatFloat(r);if(o||n.bins)u=i;else{const t=Fg(n,e,!1);u=n=>t(n)?i(n):""}}else if(n.tickFormat){const i=n.domain();u=t.formatSpan(i[0],i[i.length-1],e,r)}else r&&(u=t.format(r));return u}function Fg(t,n,e){const r=Dg(t,n),i=t.base(),o=Math.log(i),a=Math.max(1,i*n/r.length),u=t=>{let n=t/Math.pow(i,Math.round(Math.log(t)/o));return n*i<i-.5&&(n*=i),n<=a};return e?r.filter(u):u}const Eg={[Tp]:"quantiles",[Pp]:"thresholds",[jp]:"domain"},Ng={[Tp]:"quantiles",[Pp]:"domain"};function Cg(t,n){return t.bins?function(t){const n=t.slice(0,-1);return n.max=O(t),n}(t.bins):t.type===Fp?Fg(t,n,!0):Eg[t.type]?function(t){const n=[-1/0].concat(t);return n.max=1/0,n}(t[Eg[t.type]]()):Dg(t,n)}function Og(t,n,e,r,i,o,a){const u=Ng[n.type]&&o!==Op&&o!==_p?function(t,n,e){const r=n[Ng[n.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o<i;++o)a=Math.min(a,r[o]-r[o-1]);return t.formatSpan(0,a,30,e)}(t,n,i):Sg(t,n,e,i,o,a);return r===wg&&(t=>Eg[t.type]||t.bins)(n)?_g(u):"discrete"===r?Bg(u):Tg(u)}const _g=t=>(n,e,r)=>{const i=zg(r[e+1],zg(r.max,1/0)),o=Pg(n,t),a=Pg(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},zg=(t,n)=>null!=t?t:n,Bg=t=>(n,e)=>e?t(n):null,Tg=t=>n=>t(n),Pg=(t,n)=>Number.isFinite(t)?n(t):null;function jg(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=function(t,n,e,r){const i=r||n.type;return xt(e)&&function(t){return rg(t,Yp)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==Op?e||i!==_p?Og(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}(t,n,e.format,e.formatType);if(ag(n.type)){const t=Cg(n).slice(1).map(i),e=t.length;return`${e} boundar${1===e?"y":"ies"}: ${t.join(", ")}`}if(og(n.type)){const t=n.domain(),e=t.length;return`${e} value${1===e?"":"s"}: ${e>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=n.domain();return`values from ${i(t[0])} to ${i(O(t))}`}}let Rg=0;const Lg="p_";function Ig(t){return t&&t.gradient}function qg(t,n,e){const r=t.gradient;let i=t.id,o="radial"===r?Lg:"";return i||(i=t.id="gradient_"+Rg++,"radial"===r?(t.x1=Ug(t.x1,.5),t.y1=Ug(t.y1,.5),t.r1=Ug(t.r1,0),t.x2=Ug(t.x2,.5),t.y2=Ug(t.y2,.5),t.r2=Ug(t.r2,.5),o=Lg):(t.x1=Ug(t.x1,0),t.y1=Ug(t.y1,0),t.x2=Ug(t.x2,1),t.y2=Ug(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+o+i+")"}function Ug(t,n){return null!=t?t:n}function Wg(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}const Hg={basis:{curve:function(t){return new jc(t)}},"basis-closed":{curve:function(t){return new Rc(t)}},"basis-open":{curve:function(t){return new Lc(t)}},bundle:{curve:qc,tension:"beta",value:.85},cardinal:{curve:Hc,tension:"tension",value:0},"cardinal-open":{curve:Xc,tension:"tension",value:0},"cardinal-closed":{curve:Yc,tension:"tension",value:0},"catmull-rom":{curve:Qc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:tf,tension:"alpha",value:.5},"catmull-rom-open":{curve:ef,tension:"alpha",value:.5},linear:{curve:Nc},"linear-closed":{curve:function(t){return new rf(t)}},monotone:{horizontal:function(t){return new ff(t)},vertical:function(t){return new cf(t)}},natural:{curve:function(t){return new hf(t)}},step:{curve:function(t){return new mf(t,.5)}},"step-after":{curve:function(t){return new mf(t,1)}},"step-before":{curve:function(t){return new mf(t,0)}}};function Gg(t,n,e){var r=ft(Hg,t)&&Hg[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}const Yg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Vg=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Xg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Jg=/^((\s+,?\s*)|(,\s*))/,Kg=/^[01]/;function Qg(t){const n=[];return(t.match(Vg)||[]).forEach((t=>{let e=t[0];const r=e.toLowerCase(),i=Yg[r],o=function(t,n,e){const r=[];for(let i=0;n&&i<e.length;)for(let o=0;o<n;++o){const n="a"!==t||3!==o&&4!==o?Xg:Kg,a=e.slice(i).match(n);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");i+=a[0].length,r.push(+a[0]);const u=e.slice(i).match(Jg);null!==u&&(i+=u[0].length)}return r}(r,i,t.slice(1).trim()),a=o.length;if(a<i||a&&a%i!=0)throw Error("Invalid SVG path, incorrect parameter count");if(n.push([e,...o.slice(0,i)]),a!==i){"m"===r&&(e="M"===e?"L":"l");for(let t=i;t<a;t+=i)n.push([e,...o.slice(t,t+i)])}})),n}const Zg=Math.PI/180,tv=Math.PI/2,nv=2*Math.PI,ev=Math.sqrt(3)/2;var rv={},iv={},ov=[].join;function av(t){const n=ov.call(t);if(iv[n])return iv[n];var e=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],c=t[7];const f=c*a,l=-s*u,h=s*a,d=c*u,m=Math.cos(i),p=Math.sin(i),g=Math.cos(o),v=Math.sin(o),y=.5*(o-i),b=Math.sin(.5*y),w=8/3*b*b/Math.sin(y),x=e+m-w*p,$=r+p+w*m,k=e+g,M=r+v,A=k+w*v,D=M-w*g;return iv[n]=[f*x+l*$,h*x+d*$,f*A+l*D,h*A+d*D,f*k+l*M,h*k+d*M]}const uv=["l",0,0,0,0,0,0,0];function sv(t,n,e){const r=uv[0]=t[0];if("a"===r||"A"===r)uv[1]=n*t[1],uv[2]=e*t[2],uv[3]=t[3],uv[4]=t[4],uv[5]=t[5],uv[6]=n*t[6],uv[7]=e*t[7];else if("h"===r||"H"===r)uv[1]=n*t[1];else if("v"===r||"V"===r)uv[1]=e*t[1];else for(var i=1,o=t.length;i<o;++i)uv[i]=(i%2==1?n:e)*t[i];return uv}function cv(t,n,e,r,i,o){var a,u,s,c,f,l=null,h=0,d=0,m=0,p=0,g=0,v=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var y=0,b=n.length;y<b;++y){switch(a=n[y],1===i&&1===o||(a=sv(a,i,o)),a[0]){case"l":t.lineTo((h+=a[1])+e,(d+=a[2])+r);break;case"L":t.lineTo((h=a[1])+e,(d=a[2])+r);break;case"h":t.lineTo((h+=a[1])+e,d+r);break;case"H":t.lineTo((h=a[1])+e,d+r);break;case"v":t.lineTo(h+e,(d+=a[1])+r);break;case"V":t.lineTo(h+e,(d=a[1])+r);break;case"m":g=h+=a[1],v=d+=a[2],t.moveTo(h+e,d+r);break;case"M":g=h=a[1],v=d=a[2],t.moveTo(h+e,d+r);break;case"c":t.bezierCurveTo(h+a[1]+e,d+a[2]+r,(m=h+a[3])+e,(p=d+a[4])+r,(u=h+a[5])+e,(s=d+a[6])+r),h=u,d=s;break;case"C":t.bezierCurveTo(a[1]+e,a[2]+r,(m=a[3])+e,(p=a[4])+r,(h=a[5])+e,(d=a[6])+r);break;case"s":t.bezierCurveTo((m=2*h-m)+e,(p=2*d-p)+r,h+a[1]+e,d+a[2]+r,(u=h+a[3])+e,(s=d+a[4])+r),m=h+a[1],p=d+a[2],h=u,d=s;break;case"S":t.bezierCurveTo((m=2*h-m)+e,(p=2*d-p)+r,a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),h=u,d=s,m=a[1],p=a[2];break;case"q":t.quadraticCurveTo((m=h+a[1])+e,(p=d+a[2])+r,(u=h+a[3])+e,(s=d+a[4])+r),h=u,d=s;break;case"Q":t.quadraticCurveTo(a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),h=u,d=s,m=a[1],p=a[2];break;case"t":u=h+a[1],s=d+a[2],null===l[0].match(/[QqTt]/)?(m=h,p=d):"t"===l[0]?(m=2*h-c,p=2*d-f):"q"===l[0]&&(m=2*h-m,p=2*d-p),c=m,f=p,t.quadraticCurveTo(m+e,p+r,u+e,s+r),m=(h=u)+a[1],p=(d=s)+a[2];break;case"T":t.quadraticCurveTo((m=2*h-m)+e,(p=2*d-p)+r,(u=a[1])+e,(s=a[2])+r),h=u,d=s;break;case"a":fv(t,h+e,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+h+e,a[7]+d+r]),h+=a[6],d+=a[7];break;case"A":fv(t,h+e,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+r]),h=a[6],d=a[7];break;case"z":case"Z":h=g,d=v,t.closePath()}l=a}}function fv(t,n,e,r){const i=function(t,n,e,r,i,o,a,u,s){const c=ov.call(arguments);if(rv[c])return rv[c];const f=a*Zg,l=Math.sin(f),h=Math.cos(f),d=h*(u-t)*.5+l*(s-n)*.5,m=h*(s-n)*.5-l*(u-t)*.5;let p=d*d/((e=Math.abs(e))*e)+m*m/((r=Math.abs(r))*r);p>1&&(p=Math.sqrt(p),e*=p,r*=p);const g=h/e,v=l/e,y=-l/r,b=h/r,w=g*u+v*s,x=y*u+b*s,$=g*t+v*n,k=y*t+b*n;let M=1/(($-w)*($-w)+(k-x)*(k-x))-.25;M<0&&(M=0);let A=Math.sqrt(M);o==i&&(A=-A);const D=.5*(w+$)-A*(k-x),S=.5*(x+k)+A*($-w),F=Math.atan2(x-S,w-D);let E=Math.atan2(k-S,$-D)-F;E<0&&1===o?E+=nv:E>0&&0===o&&(E-=nv);const N=Math.ceil(Math.abs(E/(tv+.001))),C=[];for(let t=0;t<N;++t)C[t]=[D,S,F+t*E/N,F+(t+1)*E/N,e,r,l,h];return rv[c]=C}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e);for(let n=0;n<i.length;++n){const e=av(i[n]);t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])}}const lv=.5773502691896257,hv={circle:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,nv)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,o=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-e),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*lv,o=e/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*lv;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function dv(t){return ft(hv,t)?hv[t]:function(t){if(!ft(mv,t)){const n=Qg(t);mv[t]={draw:function(t,e){cv(t,n,0,0,Math.sqrt(e)/2)}}}return mv[t]}(t)}var mv={};const pv=.448084975506;function gv(t){return t.x}function vv(t){return t.y}function yv(t){return t.width}function bv(t){return t.height}function wv(t){return"function"==typeof t?t:()=>+t}function xv(t,n,e){return Math.max(n,Math.min(t,e))}function $v(){var t=gv,n=vv,e=yv,r=bv,i=wv(0),o=i,a=i,u=i,s=null;function c(c,f,l){var h,d=null!=f?f:+t.call(this,c),m=null!=l?l:+n.call(this,c),p=+e.call(this,c),g=+r.call(this,c),v=Math.min(p,g)/2,y=xv(+i.call(this,c),0,v),b=xv(+o.call(this,c),0,v),w=xv(+a.call(this,c),0,v),x=xv(+u.call(this,c),0,v);if(s||(s=h=wc()),y<=0&&b<=0&&w<=0&&x<=0)s.rect(d,m,p,g);else{var $=d+p,k=m+g;s.moveTo(d+y,m),s.lineTo($-b,m),s.bezierCurveTo($-pv*b,m,$,m+pv*b,$,m+b),s.lineTo($,k-x),s.bezierCurveTo($,k-pv*x,$-pv*x,k,$-x,k),s.lineTo(d+w,k),s.bezierCurveTo(d+pv*w,k,d,k-pv*w,d,k-w),s.lineTo(d,m+y),s.bezierCurveTo(d,m+pv*y,d+pv*y,m,d+y,m),s.closePath()}if(h)return s=null,h+""||null}return c.x=function(n){return arguments.length?(t=wv(n),c):t},c.y=function(t){return arguments.length?(n=wv(t),c):n},c.width=function(t){return arguments.length?(e=wv(t),c):e},c.height=function(t){return arguments.length?(r=wv(t),c):r},c.cornerRadius=function(t,n,e,r){return arguments.length?(i=wv(t),o=null!=n?wv(n):i,u=null!=e?wv(e):i,a=null!=r?wv(r):o,c):i},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function kv(){var t,n,e,r,i,o,a,u,s=null;function c(t,n,e){const r=e/2;if(i){var c=a-n,f=t-o;if(c||f){var l=Math.hypot(c,f),h=(c/=l)*u,d=(f/=l)*u,m=Math.atan2(f,c);s.moveTo(o-h,a-d),s.lineTo(t-c*r,n-f*r),s.arc(t,n,r,m-Math.PI,m),s.lineTo(o+h,a+d),s.arc(o,a,u,m,m+Math.PI)}else s.arc(t,n,r,0,nv);s.closePath()}else i=1;o=t,a=n,u=r}function f(o){var a,u,f,l=o.length,h=!1;for(null==s&&(s=f=wc()),a=0;a<=l;++a)!(a<l&&r(u=o[a],a,o))===h&&(h=!h)&&(i=0),h&&c(+t(u,a,o),+n(u,a,o),+e(u,a,o));if(f)return s=null,f+""||null}return f.x=function(n){return arguments.length?(t=n,f):t},f.y=function(t){return arguments.length?(n=t,f):n},f.size=function(t){return arguments.length?(e=t,f):e},f.defined=function(t){return arguments.length?(r=t,f):r},f.context=function(t){return arguments.length?(s=null==t?null:t,f):s},f}function Mv(t,n){return null!=t?t:n}const Av=t=>t.x||0,Dv=t=>t.y||0,Sv=t=>!(!1===t.defined),Fv=function(){var t=$c,n=kc,e=nc(0),r=null,i=Mc,o=Ac,a=Dc,u=null,s=xc(c);function c(){var c,f,l=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-lc,m=o.apply(this,arguments)-lc,p=ec(m-d),g=m>d;if(u||(u=c=s()),h<l&&(f=h,h=l,l=f),h>cc)if(p>hc-cc)u.moveTo(h*ic(d),h*uc(d)),u.arc(0,0,h,d,m,!g),l>cc&&(u.moveTo(l*ic(m),l*uc(m)),u.arc(0,0,l,m,d,g));else{var v,y,b=d,w=m,x=d,$=m,k=p,M=p,A=a.apply(this,arguments)/2,D=A>cc&&(r?+r.apply(this,arguments):sc(l*l+h*h)),S=ac(ec(h-l)/2,+e.apply(this,arguments)),F=S,E=S;if(D>cc){var N=dc(D/l*uc(A)),C=dc(D/h*uc(A));(k-=2*N)>cc?(x+=N*=g?1:-1,$-=N):(k=0,x=$=(d+m)/2),(M-=2*C)>cc?(b+=C*=g?1:-1,w-=C):(M=0,b=w=(d+m)/2)}var O=h*ic(b),_=h*uc(b),z=l*ic($),B=l*uc($);if(S>cc){var T,P=h*ic(w),j=h*uc(w),R=l*ic(x),L=l*uc(x);if(p<fc)if(T=function(t,n,e,r,i,o,a,u){var s=e-t,c=r-n,f=a-i,l=u-o,h=l*s-f*c;if(!(h*h<cc))return[t+(h=(f*(n-o)-l*(t-i))/h)*s,n+h*c]}(O,_,R,L,P,j,z,B)){var I=O-T[0],q=_-T[1],U=P-T[0],W=j-T[1],H=1/uc(function(t){return t>1?0:t<-1?fc:Math.acos(t)}((I*U+q*W)/(sc(I*I+q*q)*sc(U*U+W*W)))/2),G=sc(T[0]*T[0]+T[1]*T[1]);F=ac(S,(l-G)/(H-1)),E=ac(S,(h-G)/(H+1))}else F=E=0}M>cc?E>cc?(v=Sc(R,L,O,_,h,E,g),y=Sc(P,j,z,B,h,E,g),u.moveTo(v.cx+v.x01,v.cy+v.y01),E<S?u.arc(v.cx,v.cy,E,rc(v.y01,v.x01),rc(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,E,rc(v.y01,v.x01),rc(v.y11,v.x11),!g),u.arc(0,0,h,rc(v.cy+v.y11,v.cx+v.x11),rc(y.cy+y.y11,y.cx+y.x11),!g),u.arc(y.cx,y.cy,E,rc(y.y11,y.x11),rc(y.y01,y.x01),!g))):(u.moveTo(O,_),u.arc(0,0,h,b,w,!g)):u.moveTo(O,_),l>cc&&k>cc?F>cc?(v=Sc(z,B,P,j,l,-F,g),y=Sc(O,_,R,L,l,-F,g),u.lineTo(v.cx+v.x01,v.cy+v.y01),F<S?u.arc(v.cx,v.cy,F,rc(v.y01,v.x01),rc(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,F,rc(v.y01,v.x01),rc(v.y11,v.x11),!g),u.arc(0,0,l,rc(v.cy+v.y11,v.cx+v.x11),rc(y.cy+y.y11,y.cx+y.x11),g),u.arc(y.cx,y.cy,F,rc(y.y11,y.x11),rc(y.y01,y.x01),!g))):u.arc(0,0,l,$,x,g):u.lineTo(z,B)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-fc/2;return[ic(r)*e,uc(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:nc(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nc(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:nc(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:nc(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:nc(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:nc(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}().startAngle((t=>t.startAngle||0)).endAngle((t=>t.endAngle||0)).padAngle((t=>t.padAngle||0)).innerRadius((t=>t.innerRadius||0)).outerRadius((t=>t.outerRadius||0)).cornerRadius((t=>t.cornerRadius||0)),Ev=zc().x(Av).y1(Dv).y0((t=>(t.y||0)+(t.height||0))).defined(Sv),Nv=zc().y(Dv).x1(Av).x0((t=>(t.x||0)+(t.width||0))).defined(Sv),Cv=_c().x(Av).y(Dv).defined(Sv),Ov=$v().x(Av).y(Dv).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Mv(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),_v=function(t,n){let e=null,r=xc(i);function i(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return t="function"==typeof t?t:nc(t||Bc),n="function"==typeof n?n:nc(void 0===n?64:+n),i.type=function(n){return arguments.length?(t="function"==typeof n?n:nc(n),i):t},i.size=function(t){return arguments.length?(n="function"==typeof t?t:nc(+t),i):n},i.context=function(t){return arguments.length?(e=null==t?null:t,i):e},i}().type((t=>dv(t.shape||"circle"))).size((t=>Mv(t.size,64))),zv=kv().x(Av).y(Dv).defined(Sv).size((t=>t.size||1));function Bv(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Tv(t,n,e,r){return Ov.context(t)(n,e,r)}var Pv=1;function jv(){Pv=1}function Rv(t,n,e){var r=n.clip,i=t._defs,o=n.clip_id||(n.clip_id="clip"+Pv++),a=i.clipping[o]||(i.clipping[o]={id:o});return Z(r)?a.path=r(null):Bv(e)?a.path=Tv(null,e,0,0):(a.width=e.width||0,a.height=e.height||0),"url(#"+o+")"}function Lv(t){this.clear(),t&&this.union(t)}function Iv(t){this.mark=t,this.bounds=this.bounds||new Lv}function qv(t){Iv.call(this,t),this.items=this.items||[]}Lv.prototype={clone(){return new Lv(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},add(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),c=n-n*u+e*s,f=e-n*s-e*u;return[u*r-s*i+c,s*r+u*i+f,u*r-s*a+c,s*r+u*a+f,u*o-s*i+c,s*o+u*i+f,u*o-s*a+c,s*o+u*a+f]},union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},contains(t,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},mt(qv,Iv);class Uv{constructor(t){this._pending=0,this._loader=t||Xo()}pending(){return this._pending}sanitizeURL(t){const n=this;return Wv(n),n._loader.sanitize(t,{context:"href"}).then((t=>(Hv(n),t))).catch((()=>(Hv(n),null)))}loadImage(t){const n=this,e=gf();return Wv(n),n._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!e)throw{url:r};const i=new e,o=ft(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Hv(n),i.onerror=()=>Hv(n),i.src=r,i})).catch((t=>(Hv(n),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((n=>{!function e(r){t.pending()?setTimeout((()=>{e(!0)}),10):n(r)}(!1)}))}}function Wv(t){t._pending+=1}function Hv(t){t._pending-=1}function Gv(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){const r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}const Yv=nv-1e-8;let Vv,Xv,Jv,Kv,Qv,Zv,ty,ny;const ey=(t,n)=>Vv.add(t,n),ry=(t,n)=>ey(Xv=t,Jv=n),iy=t=>ey(t,Vv.y1),oy=t=>ey(Vv.x1,t),ay=(t,n)=>Qv*t+ty*n,uy=(t,n)=>Zv*t+ny*n,sy=(t,n)=>ey(ay(t,n),uy(t,n)),cy=(t,n)=>ry(ay(t,n),uy(t,n));function fy(t,n){return Vv=t,n?(Kv=n*Zg,Qv=ny=Math.cos(Kv),Zv=Math.sin(Kv),ty=-Zv):(Qv=ny=1,Kv=Zv=ty=0),ly}const ly={beginPath(){},closePath(){},moveTo:cy,lineTo:cy,rect(t,n,e,r){Kv?(sy(t+e,n),sy(t+e,n+r),sy(t,n+r),cy(t,n)):(ey(t+e,n+r),ry(t,n))},quadraticCurveTo(t,n,e,r){const i=ay(t,n),o=uy(t,n),a=ay(e,r),u=uy(e,r);hy(Xv,i,a,iy),hy(Jv,o,u,oy),ry(a,u)},bezierCurveTo(t,n,e,r,i,o){const a=ay(t,n),u=uy(t,n),s=ay(e,r),c=uy(e,r),f=ay(i,o),l=uy(i,o);dy(Xv,a,s,f,iy),dy(Jv,u,c,l,oy),ry(f,l)},arc(t,n,e,r,i,o){if(r+=Kv,i+=Kv,Xv=e*Math.cos(i)+t,Jv=e*Math.sin(i)+n,Math.abs(i-r)>Yv)ey(t-e,n-e),ey(t+e,n+e);else{const a=r=>ey(e*Math.cos(r)+t,e*Math.sin(r)+n);let u,s;if(a(r),a(i),i!==r)if((r%=nv)<0&&(r+=nv),(i%=nv)<0&&(i+=nv),i<r&&(o=!o,u=r,r=i,i=u),o)for(i-=nv,u=r-r%tv,s=0;s<4&&u>i;++s,u-=tv)a(u);else for(u=r-r%tv+tv,s=0;s<4&&u<i;++s,u+=tv)a(u)}}};function hy(t,n,e,r){const i=(t-n)/(t+e-2*n);0<i&&i<1&&r(t+(n-t)*i)}function dy(t,n,e,r,i){const o=r-t+3*n-3*e,a=t+e-2*n,u=t-n;let s,c=0,f=0;Math.abs(o)>1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),c=(-a+s)/o,f=(-a-s)/o)):c=.5*u/a,0<c&&c<1&&i(my(c,t,n,e,r)),0<f&&f<1&&i(my(f,t,n,e,r))}function my(t,n,e,r,i){const o=1-t,a=o*o,u=t*t;return a*o*n+3*a*t*e+3*o*u*r+u*t*i}var py=(py=pf(1,1))?py.getContext("2d"):null;const gy=new Lv;function vy(t){return function(n,e){if(!py)return!0;t(py,n),gy.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:o,y2:a}=gy;for(let t=i;t<=a;++t)for(let n=r;n<=o;++n)if(py.isPointInPath(n,t))return!0;return!1}}function yy(t,n){return n.contains(t.x||0,t.y||0)}function by(t,n){const e=t.x||0,r=t.y||0;return n.intersects(gy.set(e,r,e+(t.width||0),r+(t.height||0)))}function wy(t,n){const e=t.x||0,r=t.y||0;return xy(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function xy(t,n,e,r,i){const{x1:o,y1:a,x2:u,y2:s}=t,c=r-n,f=i-e;let l,h,d,m,p=0,g=1;for(m=0;m<4;++m){if(0===m&&(l=-c,h=-(o-n)),1===m&&(l=c,h=u-n),2===m&&(l=-f,h=-(a-e)),3===m&&(l=f,h=s-e),Math.abs(l)<1e-10&&h<0)return!1;if(d=h/l,l<0){if(d>g)return!1;d>p&&(p=d)}else if(l>0){if(d<p)return!1;d<g&&(g=d)}}return!0}function $y(t,n){t.globalCompositeOperation=n.blend||"source-over"}function ky(t,n){return null==t?n:t}function My(t,n){const e=n.length;for(let r=0;r<e;++r)t.addColorStop(n[r].offset,n[r].color);return t}function Ay(t,n,e){return Ig(e)?function(t,n,e){const r=e.width(),i=e.height();let o;if("radial"===n.gradient)o=t.createRadialGradient(e.x1+ky(n.x1,.5)*r,e.y1+ky(n.y1,.5)*i,Math.max(r,i)*ky(n.r1,0),e.x1+ky(n.x2,.5)*r,e.y1+ky(n.y2,.5)*i,Math.max(r,i)*ky(n.r2,.5));else{const a=ky(n.x1,0),u=ky(n.y1,0),s=ky(n.x2,1),c=ky(n.y2,0);if(a!==s&&u!==c&&r!==i){const e=pf(Math.ceil(r),Math.ceil(i)),o=e.getContext("2d");return o.scale(r,i),o.fillStyle=My(o.createLinearGradient(a,u,s,c),n.stops),o.fillRect(0,0,r,i),t.createPattern(e,"no-repeat")}o=t.createLinearGradient(e.x1+a*r,e.y1+u*i,e.x1+s*r,e.y1+c*i)}return My(o,n.stops)}(t,e,n.bounds):e}function Dy(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=Ay(t,n,n.fill),!0)}var Sy=[];function Fy(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&(e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=Ay(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Sy),t.lineDashOffset=n.strokeDashOffset||0),!0)}function Ey(t,n){return t.zindex-n.zindex||t.index-n.index}function Ny(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,o=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&o.push(n);return t.zdirty=!1,t.zitems=o.sort(Ey)}function Cy(t,n){var e,r,i=t.items;if(!i||!i.length)return;const o=Ny(t);if(o&&o.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=o}for(e=0,r=i.length;e<r;++e)n(i[e])}function Oy(t,n){var e,r,i=t.items;if(!i||!i.length)return null;const o=Ny(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function _y(t){return function(n,e,r){Cy(e,(e=>{r&&!r.intersects(e.bounds)||By(t,n,e,e)}))}}function zy(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||By(t,n,e.items[0],e.items)}}function By(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||($y(n,e),e.fill&&Dy(n,e,i)&&n.fill(),e.stroke&&Fy(n,e,i)&&n.stroke()))}function Ty(t){return t=t||$,function(n,e,r,i,o,a){return r*=n.pixelRatio,i*=n.pixelRatio,Oy(e,(e=>{const u=e.bounds;if((!u||u.contains(o,a))&&u)return t(n,e,r,i,o,a)?e:void 0}))}}function Py(t,n){return function(e,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,c=null==n?s.fill:n,f=s.stroke&&e.isPointInStroke;return f&&(u=s.strokeCap,e.lineWidth=null!=(a=s.strokeWidth)?a:1,e.lineCap=null!=u?u:"butt"),!t(e,r)&&(c&&e.isPointInPath(i,o)||f&&e.isPointInStroke(i,o))}}function jy(t){return Ty(Py(t))}function Ry(t,n){return"translate("+t+","+n+")"}function Ly(t){return"rotate("+t+")"}function Iy(t){return Ry(t.x||0,t.y||0)}function qy(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,o=e.angle||0;t.translate(r,i),o&&t.rotate(o*=Zg),t.beginPath(),n(t,e),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",function(t){return Ry(t.x||0,t.y||0)+(t.angle?" "+Ly(t.angle):"")}(e)),t("d",n(null,e))},bound:function(t,e){return n(fy(t,e.angle),e),Gv(t,e).translate(e.x||0,e.y||0)},draw:_y(r),pick:jy(r),isect:e||vy(r)}}var Uy=qy("arc",(function(t,n){return Fv.context(t)(n)}));function Wy(t,n,e){function r(t,e){t.beginPath(),n(t,e)}const i=Py(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(fy(t),r),Gv(t,r[0]))},draw:zy(r),pick:function(t,n,e,r,o,a){var u=n.items,s=n.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:i(t,u,e*=t.pixelRatio,r*=t.pixelRatio)?u[0]:null},isect:yy,tip:e}}var Hy=Wy("area",(function(t,n){const e=n[0];return("horizontal"===e.orient?Nv:Ev).curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<u&&(u=r,e=t[a]);return e}));function Gy(t,n){t.beginPath(),Bv(n)?Tv(t,n,0,0):t.rect(0,0,n.width||0,n.height||0),t.clip()}function Yy(t){const n=ky(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&n>.5&&n<1.5?.5-Math.abs(n-1):0}function Vy(t,n){const e=Yy(n);t("d",Tv(null,n,e,e))}function Xy(t,n,e,r){const i=Yy(n);t.beginPath(),Tv(t,n,(e||0)+i,(r||0)+i)}const Jy=Py(Xy),Ky=Py(Xy,!1),Qy=Py(Xy,!0);var Zy={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",Iy(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let n=0;n<r;++n)t.union(e[n].bounds)}return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),Gv(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e,r){Cy(n,(n=>{const i=n.x||0,o=n.y||0,a=n.strokeForeground,u=null==n.opacity?1:n.opacity;(n.stroke||n.fill)&&u&&(Xy(t,n,i,o),$y(t,n),n.fill&&Dy(t,n,u)&&t.fill(),n.stroke&&!a&&Fy(t,n,u)&&t.stroke()),t.save(),t.translate(i,o),n.clip&&Gy(t,n),e&&e.translate(-i,-o),Cy(n,(n=>{("group"===n.marktype||null==r||r.includes(n.marktype))&&this.draw(t,n,e,r)})),e&&e.translate(i,o),t.restore(),a&&n.stroke&&u&&(Xy(t,n,i,o),$y(t,n),Fy(t,n,u)&&t.stroke())}))},pick:function(t,n,e,r,i,o){if(n.bounds&&!n.bounds.contains(i,o)||!n.items)return null;const a=e*t.pixelRatio,u=r*t.pixelRatio;return Oy(n,(s=>{let c,f,l;const h=s.bounds;if(h&&!h.contains(i,o))return;f=s.x||0,l=s.y||0;const d=s.clip;if(d&&(i<f||i>f+(s.width||0)||o<l||o>l+(s.height||0)))return;if(t.save(),t.translate(f,l),f=i-f,l=o-l,d&&Bv(s)&&!Qy(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,p=!1!==n.interactive;return p&&m&&s.stroke&&Ky(t,s,a,u)?(t.restore(),s):(c=Oy(s,(t=>function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,f,l)?this.pick(t,e,r,f,l):null)),!c&&p&&(s.fill||!m&&s.stroke)&&Jy(t,s,a,u)&&(c=s),t.restore(),c||null)}))},isect:by,content:function(t,n,e){t("clip-path",n.clip?Rv(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),Vy(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?Vy(t,n):t("d","")}},tb={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function nb(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then((n=>{t.image=n,t.image.url=t.url}))),e}function eb(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function rb(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function ib(t,n){return"center"===t?n/2:"right"===t?n:0}function ob(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var ab={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=nb(n,e),i=eb(n,r),o=rb(n,r),a=(n.x||0)-ib(n.align,i),u=(n.y||0)-ob(n.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",tb["xmlns:xlink"],"xlink:href"),t("transform",Ry(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===n.aspect?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=eb(n,e),i=rb(n,e),o=(n.x||0)-ib(n.align,r),a=(n.y||0)-ob(n.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,n,e){Cy(n,(n=>{if(e&&!e.intersects(n.bounds))return;const r=nb(n,this);let i=eb(n,r),o=rb(n,r);if(0===i||0===o)return;let a,u,s,c,f=(n.x||0)-ib(n.align,i),l=(n.y||0)-ob(n.baseline,o);!1!==n.aspect&&(u=r.width/r.height,s=n.width/n.height,u==u&&s==s&&u!==s&&(s<u?(c=i/u,l+=(o-c)/2,o=c):(c=o*u,f+=(i-c)/2,i=c))),(r.complete||r.toDataURL)&&($y(t,n),t.globalAlpha=null!=(a=n.opacity)?a:1,t.imageSmoothingEnabled=!1!==n.smooth,t.drawImage(r,f,l,i,o))}))},pick:Ty(),isect:$,get:nb,xOffset:ib,yOffset:ob},ub=Wy("line",(function(t,n){const e=n[0];return Cv.curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(e=t[o].x-n[0])*e+(r=t[o].y-n[1])*r<i)return t[o];return null}));function sb(t,n){var e=n.path;if(null==e)return!0;var r=n.x||0,i=n.y||0,o=n.scaleX||1,a=n.scaleY||1,u=(n.angle||0)*Zg,s=n.pathCache;s&&s.path===e||((n.pathCache=s=Qg(e)).path=e),u&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(u),cv(t,s,0,0,o,a),t.rotate(-u),t.translate(-r,-i)):cv(t,s,r,i,o,a)}var cb={type:"path",tag:"path",nested:!1,attr:function(t,n){1===(n.scaleX||1)&&1===(n.scaleY||1)||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return Ry(t.x||0,t.y||0)+(t.angle?" "+Ly(t.angle):"")+(t.scaleX||t.scaleY?" "+("scale("+(t.scaleX||1)+","+(t.scaleY||1)+")"):"")}(n)),t("d",n.path)},bound:function(t,n){return sb(fy(t,n.angle),n)?t.set(0,0,0,0):Gv(t,n,!0)},draw:_y(sb),pick:jy(sb),isect:vy(sb)};function fb(t,n){t.beginPath(),Tv(t,n)}var lb={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Tv(null,n))},bound:function(t,n){var e,r;return Gv(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:_y(fb),pick:jy(fb),isect:by};function hb(t,n,e){var r,i,o,a;return!(!n.stroke||!Fy(t,n,e)||(r=n.x||0,i=n.y||0,o=null!=n.x2?n.x2:r,a=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),0))}var db={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",Iy(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return Gv(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){Cy(n,(n=>{if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&hb(t,n,r)&&($y(t,n),t.stroke())}}))},pick:Ty((function(t,n,e,r){return!!t.isPointInStroke&&hb(t,n,1)&&t.isPointInStroke(e,r)})),isect:wy},mb=qy("shape",(function(t,n){return(n.mark.shape||n.shape).context(t)(n)})),pb=qy("symbol",(function(t,n){return _v.context(t)(n)}),yy);const gb=Mt();var vb={height:kb,measureWidth:xb,estimateWidth:bb,width:bb,canvas:yb};function yb(t){vb.width=t&&py?xb:bb}function bb(t,n){return wb(Sb(t,n),kb(t))}function wb(t,n){return~~(.8*t.length*n)}function xb(t,n){return kb(t)<=0||!(n=Sb(t,n))?0:$b(n,Eb(t))}function $b(t,n){const e=`(${n}) ${t}`;let r=gb.get(e);return void 0===r&&(py.font=n,r=py.measureText(t).width,gb.set(e,r)),r}function kb(t){return null!=t.fontSize?+t.fontSize||0:11}function Mb(t){return null!=t.lineHeight?t.lineHeight:kb(t)+2}function Ab(t){return n=t.lineBreak&&t.text&&!D(t.text)?t.text.split(t.lineBreak):t.text,D(n)?n.length>1?n:n[0]:n;var n}function Db(t){const n=Ab(t);return(D(n)?n.length-1:0)*Mb(t)}function Sb(t,n){const e=null==n?"":(n+"").trim();return t.limit>0&&e.length?function(t,n){var e=+t.limit,r=function(t){if(vb.width===xb){const n=Eb(t);return t=>$b(t,n)}if(vb.width===bb){const n=kb(t);return t=>wb(t,n)}return n=>vb.width(t,n)}(t);if(r(n)<e)return n;var i,o=t.ellipsis||"…",a="rtl"===t.dir,u=0,s=n.length;if(e-=r(o),a){for(;u<s;)r(n.slice(i=u+s>>>1))>e?u=i+1:s=i;return o+n.slice(u)}for(;u<s;)r(n.slice(0,i=1+(u+s>>>1)))<e?u=i:s=i-1;return n.slice(0,u)+o}(t,e):e}function Fb(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function Eb(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+kb(t)+"px "+Fb(t,n)}function Nb(t){var n=t.baseline,e=kb(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:"line-top"===n?.29*e+.5*Mb(t):"line-bottom"===n?.29*e-.5*Mb(t):0)}yb(!0);const Cb={left:"start",center:"middle",right:"end"},Ob=new Lv;function _b(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-tv,e+=i*Math.cos(n),r+=i*Math.sin(n)),Ob.x1=e,Ob.y1=r,Ob}function zb(t,n,e){var r,i=vb.height(n),o=n.align,a=_b(n),u=a.x1,s=a.y1,c=n.dx||0,f=(n.dy||0)+Nb(n)-Math.round(.8*i),l=Ab(n);if(D(l)?(i+=Mb(n)*(l.length-1),r=l.reduce(((t,e)=>Math.max(t,vb.width(n,e))),0)):r=vb.width(n,l),"center"===o?c-=r/2:"right"===o&&(c-=r),t.set(c+=u,f+=s,c+r,f+i),n.angle&&!e)t.rotate(n.angle*Zg,u,s);else if(2===e)return t.rotatedPoints(n.angle*Zg,u,s);return t}var Bb={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+Nb(n),o=_b(n),a=o.x1,u=o.y1,s=n.angle||0;t("text-anchor",Cb[n.align]||"start"),s?(e=Ry(a,u)+" "+Ly(s),(r||i)&&(e+=" "+Ry(r,i))):e=Ry(a+r,u+i),t("transform",e)},bound:zb,draw:function(t,n,e){Cy(n,(n=>{var r,i,o,a,u,s,c,f=null==n.opacity?1:n.opacity;if(!(e&&!e.intersects(n.bounds)||0===f||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Eb(n),t.textAlign=n.align||"left",i=(r=_b(n)).x1,o=r.y1,n.angle&&(t.save(),t.translate(i,o),t.rotate(n.angle*Zg),i=o=0),i+=n.dx||0,o+=(n.dy||0)+Nb(n),s=Ab(n),$y(t,n),D(s))for(u=Mb(n),a=0;a<s.length;++a)c=Sb(n,s[a]),n.fill&&Dy(t,n,f)&&t.fillText(c,i,o),n.stroke&&Fy(t,n,f)&&t.strokeText(c,i,o),o+=u;else c=Sb(n,s),n.fill&&Dy(t,n,f)&&t.fillText(c,i,o),n.stroke&&Fy(t,n,f)&&t.strokeText(c,i,o);n.angle&&t.restore()}}))},pick:Ty((function(t,n,e,r,i,o){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var a=_b(n),u=a.x1,s=a.y1,c=zb(Ob,n,1),f=-n.angle*Zg,l=Math.cos(f),h=Math.sin(f);return c.contains(l*i-h*o+(u-l*u+h*s),h*i+l*o+(s-h*u-l*s))})),isect:function(t,n){const e=zb(Ob,t,2);return xy(n,e[0],e[1],e[2],e[3])||xy(n,e[0],e[1],e[4],e[5])||xy(n,e[4],e[5],e[6],e[7])||xy(n,e[2],e[3],e[6],e[7])}},Tb=Wy("trail",(function(t,n){return zv.context(t)(n)}),(function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null})),Pb={arc:Uy,area:Hy,group:Zy,image:ab,line:ub,path:cb,rect:lb,rule:db,shape:mb,symbol:pb,text:Bb,trail:Tb};function jb(t,n,e){var r=Pb[t.mark.marktype];return r.nested&&(t=t.mark),(n||r.bound)(t.bounds||(t.bounds=new Lv),t,e)}var Rb={mark:null};function Lb(t,n,e){var r,i,o,a,u=Pb[t.marktype],s=u.bound,c=t.items,f=c&&c.length;if(u.nested)return f?o=c[0]:(Rb.mark=t,o=Rb),a=jb(o,s,e),n&&n.union(a)||a;if(n=n||t.bounds&&t.bounds.clear()||new Lv,f)for(r=0,i=c.length;r<i;++r)n.union(jb(c[r],s,e));return t.bounds=n}const Ib=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function qb(t,n){return JSON.stringify(t,Ib,n)}function Ub(t){return Wb("string"==typeof t?JSON.parse(t):t)}function Wb(t){var n,e,r,i=t.marktype,o=t.items;if(o)for(e=0,r=o.length;e<r;++e)o[e][n=i?"mark":"group"]=t,o[e].zindex&&(o[e][n].zdirty=!0),"group"===(i||n)&&Wb(o[e]);return i&&Lb(t),t}class Hb{constructor(t){arguments.length?this.root=Ub(t):(this.root=Gb({marktype:"group",name:"root",role:"frame"}),this.root.items=[new qv(this.root)])}toJSON(t){return qb(this.root,t||0)}mark(t,n,e){const r=Gb(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r}}function Gb(t,n){const e={bounds:new Lv,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(e.aria=t.aria),t.description&&(e.description=t.description),e}function Yb(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function Vb(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Xb(t,n,e,r){var i,o=t.childNodes[n];return o&&o.tagName.toLowerCase()===e.toLowerCase()||(i=o||null,o=Yb(t.ownerDocument,e,r),t.insertBefore(o,i)),o}function Jb(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function Kb(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Qb(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}let Zb=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Xo(),this._tooltip=n||tw}initialize(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,e){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1}handlers(t){const n=this._handlers,e=[];if(t)e.push(...n[this.eventName(t)]);else for(const t in n)e.push(...n[t]);return e}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,e){this._loader.sanitize(e,{context:"href"}).then((n=>{const e=new MouseEvent(t.type,t),r=Yb(null,"a");for(const t in n)r.setAttribute(t,n[t]);r.dispatchEvent(e)})).catch((()=>{}))}handleTooltip(t,n,e){n&&null!=n.tooltip&&(n=function(t,n,e,r){var i,o,a=t&&t.mark;if(a&&(i=Pb[a.marktype]).tip){for((o=Qb(n,e))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(n,t,this.canvas(),this._origin),this._tooltip.call(this._obj,this,t,n,e&&n&&n.tooltip||null))}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+e.left,s=i.y1+r[1]+e.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}};function tw(t,n,e,r){t.element().setAttribute("title",r||"")}class nw{constructor(t){this._el=null,this._bgcolor=null,this._loader=new Uv(t)}initialize(t,n,e,r,i){return this._el=t,this.resize(n,e,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const e=this;return e._call=function(){e._render(t,n)},e._call(),e._call=null,e}_render(){}renderAsync(t,n){const e=this.render(t,n);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)}_load(t,n){var e=this,r=e._loader[t](n);if(!e._ready){const t=e._call;e._ready=e._loader.ready().then((n=>{n&&t(),e._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const ew="dragenter",rw="dragleave",iw="dragover",ow="pointerdown",aw="pointermove",uw="pointerout",sw="pointerover",cw="mousedown",fw="mousemove",lw="mouseout",hw="mouseover",dw="click",mw="mousewheel",pw="touchstart",gw="touchmove",vw="touchend",yw=["keydown","keypress","keyup",ew,rw,iw,ow,"pointerup",aw,uw,sw,cw,"mouseup",fw,lw,hw,dw,"dblclick","wheel",mw,pw,gw,vw],bw=aw,ww=lw,xw=dw;class $w extends Zb{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=yw,this.pointermove=Dw([aw,fw],[sw,hw],[uw,lw]),this.dragover=Dw([iw],[ew],[rw]),this.pointerout=Sw([uw,lw]),this.dragleave=Sw([rw])}initialize(t,n,e){return this._canvas=t&&Vb(t,"canvas"),[dw,cw,ow,aw,uw,rw].forEach((t=>Mw(this,t))),super.initialize(t,n,e)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(mw,t)}pointerdown(t){this._down=this._active,this.fire(ow,t)}mousedown(t){this._down=this._active,this.fire(cw,t)}click(t){this._down===this._active&&(this.fire(dw,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(pw,t,!0)}touchmove(t){this.fire(gw,t,!0)}touchend(t){this.fire(vw,t,!0),this._touch=null}fire(t,n,e){const r=e?this._touch:this._active,i=this._handlers[t];if(n.vegaType=t,t===xw&&r&&r.href?this.handleHref(n,r,r.href):t!==bw&&t!==ww||this.handleTooltip(n,r,t!==ww),i)for(let t=0,e=i.length;t<e;++t)i[t].handler.call(this._obj,n,r)}on(t,n){const e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(Mw(this,t),(r[e]||(r[e]=[])).push({type:t,handler:n})),this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this}pickEvent(t){const n=Qb(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])}pick(t,n,e,r,i){const o=this.context();return Pb[t.marktype].pick.call(this,o,t,n,e,r,i)}}const kw=t=>t===pw||t===gw||t===vw?[pw,gw,vw]:[t];function Mw(t,n){kw(n).forEach((n=>function(t,n){const e=t.canvas();e&&!t._events[n]&&(t._events[n]=1,e.addEventListener(n,t[n]?e=>t[n](e):e=>t.fire(n,e)))}(t,n)))}function Aw(t,n,e){n.forEach((n=>t.fire(n,e)))}function Dw(t,n,e){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Aw(this,e,r),this._active=o,Aw(this,n,r)),Aw(this,t,r)}}function Sw(t){return function(n){Aw(this,t,n),this._active=null}}class Fw extends nw{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Lv,this._tempb=new Lv}initialize(t,n,e,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:pf(1,1),t&&this._canvas&&(Jb(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,e,r,i)}resize(t,n,e,r){if(super.resize(t,n,e,r),this._canvas)!function(t,n,e,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=n*s,t.height=e*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=n+"px",t.style.height=e+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||p("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let e=t.mark.group;for(;e;)n.translate(e.x||0,e.y||0),e=e.mark.group;this._dirty.union(n)}_render(t,n){const e=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,u=Ew(r,i,o);e.save();const s=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(t,n,e){return n.expand(1).round(),t.pixelRatio%1&&n.scale(t.pixelRatio).round().scale(1/t.pixelRatio),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(e,u.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(e,t,s,n),e.restore(),a.clear(),this}draw(t,n,e,r){if("group"!==n.marktype&&null!=r&&!r.includes(n.marktype))return;const i=Pb[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),Z(e)?(t.beginPath(),e(t),t.clip()):Gy(t,n.group)}(t,n),i.draw.call(this,t,n,e,r),n.clip&&t.restore()}clear(t,n,e,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,n,e,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,e,r))}}const Ew=(t,n,e)=>(new Lv).set(0,0,n,e).translate(-t[0],-t[1]);class Nw extends Zb{constructor(t,n){super(t,n);const e=this;e._hrefHandler=Cw(e,((t,n)=>{n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=Cw(e,((t,n)=>{e.handleTooltip(t,n,t.type!==ww)}))}initialize(t,n,e){let r=this._svg;return r&&(r.removeEventListener(xw,this._hrefHandler),r.removeEventListener(bw,this._tooltipHandler),r.removeEventListener(ww,this._tooltipHandler)),this._svg=r=t&&Vb(t,"svg"),r&&(r.addEventListener(xw,this._hrefHandler),r.addEventListener(bw,this._tooltipHandler),r.addEventListener(ww,this._tooltipHandler)),super.initialize(t,n,e)}canvas(){return this._svg}on(t,n){const e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){const i={type:t,handler:n,listener:Cw(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this}}const Cw=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},Ow="aria-hidden",_w="aria-label",zw="role",Bw="aria-roledescription",Tw="graphics-object",Pw="graphics-symbol",jw=(t,n,e)=>({[zw]:t,[Bw]:n,[_w]:e||void 0}),Rw=zt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Lw={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?Hw(t):null,i=t.context,o=i.scales[n.scale].value,a=i.dataflow.locale(),u=o.type;return`${"left"===e||"right"===e?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${og(u)?"discrete":u} scale`+` with ${jg(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?Hw(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return((c=r).length?c[0].toUpperCase()+c.slice(1):c)+(e?` titled '${e}'`:"")+` for ${function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+O(t)}(o)}`+` with ${jg(s,u,t)}`;var c}},"title-text":{desc:"title",caption:t=>`Title text '${Ww(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Ww(t)}'`}},Iw={ariaRole:zw,ariaRoleDescription:Bw,description:_w};function qw(t,n){const e=!1===n.aria;if(t(Ow,e||void 0),e||null==n.description)for(const n in Iw)t(Iw[n],void 0);else{const e=n.mark.marktype;t(_w,n.description),t(zw,n.ariaRole||("group"===e?Tw:Pw)),t(Bw,n.ariaRoleDescription||`${e} mark`)}}function Uw(t){return!1===t.aria?{[Ow]:!0}:Rw[t.role]?null:Lw[t.role]?function(t,n){try{const e=t.items[0];return jw(n.role||Pw,n.desc,e.description||(n.caption||(()=>""))(e))}catch(t){return null}}(t,Lw[t.role]):function(t){const n=t.marktype,e="group"===n||"text"===n||t.items.some((t=>null!=t.description&&!1!==t.aria));return jw(e?Tw:Pw,`${n} mark container`,t.description)}(t)}function Ww(t){return K(t.text).join(" ")}function Hw(t){try{return K(O(t.items).items[0].text).join(" ")}catch(t){return null}}const Gw=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Yw(){let t="",n="",e="";const r=[],i=()=>n=e="",o=(t,e)=>{var r;return null!=e&&(n+=` ${t}="${r=e,Gw(r).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(u){(o=>{n&&(t+=`${n}>${e}`,i()),r.push(o)})(u),n="<"+u;for(var s=arguments.length,c=new Array(s>1?s-1:0),f=1;f<s;f++)c[f-1]=arguments[f];for(const t of c)for(const n in t)o(n,t[n]);return a},close(){const o=r.pop();return t+=n?n+(e?`>${e}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(e+=Gw(t),a),toString:()=>t};return a}const Vw=t=>Xw(Yw(),t)+"";function Xw(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let n=0;n<r;++n)t.attr(e[n].name,e[n].value)}if(n.hasChildNodes()){const e=n.childNodes;for(const n of e)3===n.nodeType?t.text(n.nodeValue):Xw(t,n)}return t.close()}const Jw={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Kw={blend:"mix-blend-mode"},Qw={fill:"none","stroke-miterlimit":10},Zw="http://www.w3.org/2000/xmlns/",tx=tb.xmlns;class nx extends nw{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,e,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=Xb(t,0,"svg",tx),this._svg.setAttributeNS(Zw,"xmlns",tx),this._svg.setAttributeNS(Zw,"xmlns:xlink",tb["xmlns:xlink"]),this._svg.setAttribute("version",tb.version),this._svg.setAttribute("class","marks"),Jb(t,1),this._root=Xb(this._svg,0,"g",tx),lx(this._root,Qw),Jb(this._svg,1)),this.background(this._bgcolor),super.initialize(t,n,e,r,i)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svg&&(lx(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const t=this._svg,n=this._bgcolor;if(!t)return null;let e;n&&(t.removeAttribute("style"),e=Xb(t,0,"rect",tx),lx(e,{width:this._width,height:this._height,fill:n}));const r=Vw(t);return n&&(t.removeChild(e),this._svg.style.setProperty("background-color",n)),r}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),Jb(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))}isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const n=++this._dirtyID;let e,r,i,o,a,u,s;for(a=0,u=t.length;a<u;++a)e=t[a],r=e.mark,r.marktype!==i&&(i=r.marktype,o=Pb[i]),r.zdirty&&r.dirty!==n&&(this._dirtyAll=!1,ex(e,n),r.items.forEach((t=>{t.dirty=n}))),r.zdirty||(e.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):e._svg&&(s=e._svg.parentNode,s&&s.removeChild(e._svg)),e._svg=null):(e=o.nested?r.items[0]:e,e._update!==n&&(e._svg&&e._svg.ownerSVGElement?this._update(o,e._svg,e):(this._dirtyAll=!1,ex(e,n)),e._update=n)));return!this._dirtyAll}mark(t,n,e,r){if(!this.isDirty(n))return n._svg;const i=this._svg,o=n.marktype,a=Pb[o],u=!1===n.interactive?"none":null,s="g"===a.tag,c=ox(n,t,e,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return Jb(c,0),n._svg;c.setAttribute("class",Kb(n));const f=Uw(n);for(const t in f)hx(c,t,f[t]);s||hx(c,"pointer-events",u),hx(c,"clip-path",n.clip?Rv(this,n,n.group):null);let l=null,h=0;const d=t=>{const n=this.isDirty(t),e=ox(t,c,l,a.tag,i);n&&(this._update(a,e,t),s&&function(t,n,e,r){n=n.lastChild.previousSibling;let i,o=0;Cy(e,(e=>{i=t.mark(n,e,i,r),++o})),Jb(n,1+o)}(this,e,t,r)),l=e,++h};return a.nested?n.items.length&&d(n.items[0]):Cy(n,d),Jb(c,h),c}_update(t,n,e){ax=n,ux=n.__values__,qw(cx,e),t.attr(cx,e,this);const r=sx[t.type];r&&r.call(this,t,n,e),ax&&this.style(ax,e)}style(t,n){if(null!=n){for(const e in Jw){let r="font"===e?Fb(n):n[e];if(r===ux[e])continue;const i=Jw[e];null==r?t.removeAttribute(i):(Ig(r)&&(r=qg(r,this._defs.gradient,dx())),t.setAttribute(i,r+"")),ux[e]=r}for(const e in Kw)fx(t,Kw[e],n[e])}}defs(){const t=this._svg,n=this._defs;let e=n.el,r=0;for(const i in n.gradient)e||(n.el=e=Xb(t,1,"defs",tx)),r=rx(e,n.gradient[i],r);for(const i in n.clipping)e||(n.el=e=Xb(t,1,"defs",tx)),r=ix(e,n.clipping[i],r);e&&(0===r?(t.removeChild(e),n.el=null):Jb(e,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function ex(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function rx(t,n,e){let r,i,o;if("radial"===n.gradient){let r=Xb(t,e++,"pattern",tx);lx(r,{id:Lg+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=Xb(r,0,"rect",tx),lx(r,{width:1,height:1,fill:`url(${dx()}#${n.id})`}),lx(t=Xb(t,e++,"radialGradient",tx),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else lx(t=Xb(t,e++,"linearGradient",tx),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r<i;++r)o=Xb(t,r,"stop",tx),o.setAttribute("offset",n.stops[r].offset),o.setAttribute("stop-color",n.stops[r].color);return Jb(t,r),e}function ix(t,n,e){let r;return(t=Xb(t,e,"clipPath",tx)).setAttribute("id",n.id),n.path?(r=Xb(t,0,"path",tx),r.setAttribute("d",n.path)):(r=Xb(t,0,"rect",tx),lx(r,{x:0,y:0,width:n.width,height:n.height})),Jb(t,1),e+1}function ox(t,n,e,r,i){let o,a=t._svg;if(!a&&(o=n.ownerDocument,a=Yb(o,r,tx),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const n=Yb(o,"path",tx);a.appendChild(n),n.__data__=t;const e=Yb(o,"g",tx);a.appendChild(e),e.__data__=t;const r=Yb(o,"path",tx);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,n){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=n}(a,e))&&n.insertBefore(a,e?e.nextSibling:n.firstChild),a}let ax=null,ux=null;const sx={group(t,n,e){const r=ax=n.childNodes[2];ux=r.__values__,t.foreground(cx,e,this),ux=n.__values__,ax=n.childNodes[1],t.content(cx,e,this);const i=ax=n.childNodes[0];t.background(cx,e,this);const o=!1===e.mark.interactive?"none":null;if(o!==ux.events&&(hx(r,"pointer-events",o),hx(i,"pointer-events",o),ux.events=o),e.strokeForeground&&e.stroke){const t=e.fill;hx(r,"display",null),this.style(i,e),hx(i,"stroke",null),t&&(e.fill=null),ux=r.__values__,this.style(r,e),t&&(e.fill=t),ax=null}else hx(r,"display","none")},image(t,n,e){!1===e.smooth?(fx(n,"image-rendering","optimizeSpeed"),fx(n,"image-rendering","pixelated")):fx(n,"image-rendering",null)},text(t,n,e){const r=Ab(e);let i,o,a,u;D(r)?(o=r.map((t=>Sb(e,t))),i=o.join("\n"),i!==ux.text&&(Jb(n,0),a=n.ownerDocument,u=Mb(e),o.forEach(((t,r)=>{const i=Yb(a,"tspan",tx);i.__data__=e,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),n.appendChild(i)})),ux.text=i)):(o=Sb(e,r),o!==ux.text&&(n.textContent=o,ux.text=o)),hx(n,"font-family",Fb(e)),hx(n,"font-size",kb(e)+"px"),hx(n,"font-style",e.fontStyle),hx(n,"font-variant",e.fontVariant),hx(n,"font-weight",e.fontWeight)}};function cx(t,n,e){n!==ux[t]&&(e?function(t,n,e,r){null!=e?t.setAttributeNS(r,n,e):t.removeAttributeNS(r,n)}(ax,t,n,e):hx(ax,t,n),ux[t]=n)}function fx(t,n,e){e!==ux[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),ux[n]=e)}function lx(t,n){for(const e in n)hx(t,e,n[e])}function hx(t,n,e){null!=e?t.setAttribute(n,e):t.removeAttribute(n)}function dx(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class mx extends nw{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=Yw();n.open("svg",ut({},tb,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const e=this._bgcolor;return e&&"transparent"!==e&&"none"!==e&&n.open("rect",{width:this._width,height:this._height,fill:e}).close(),n.open("g",Qw,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const e=Pb[n.marktype],r=e.tag,i=[qw,e.attr];t.open("g",{class:Kb(n),"clip-path":n.clip?Rv(this,n,n.group):null},Uw(n),{"pointer-events":"g"!==r&&!1===n.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(n,o,i,"g"!==r?r:null)),"text"===r){const n=Ab(o);if(D(n)){const e={x:0,dy:Mb(o)};for(let r=0;r<n.length;++r)t.open("tspan",r?e:null).text(Sb(o,n[r])).close()}else t.text(Sb(o,n))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(n,o,e.background,"bgrect")).close(),t.open("g",this.attr(n,o,e.content)),Cy(o,(n=>this.mark(t,n))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(n,o,e.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(n,o,e.foreground,"bgfore")).close()}t.close(),a&&t.close()};return e.nested?n.items&&n.items.length&&o(n.items[0]):Cy(n,o),t.close()}href(t){const n=t.href;let e;if(n){if(e=this._hrefs&&this._hrefs[n])return e;this.sanitizeURL(n).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[n]=t}))}return null}attr(t,n,e,r){const i={},o=(t,n,e,r)=>{i[r||t]=n};return Array.isArray(e)?e.forEach((t=>t(o,n,this))):e(o,n,this),r&&function(t,n,e,r,i){let o;if(null==n)return t;if("bgrect"===r&&!1===e.interactive&&(t["pointer-events"]="none"),"bgfore"===r&&(!1===e.interactive&&(t["pointer-events"]="none"),t.display="none",null!==n.fill))return t;"image"===r&&!1===n.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===r&&(t["font-family"]=Fb(n),t["font-size"]=kb(n)+"px",t["font-style"]=n.fontStyle,t["font-variant"]=n.fontVariant,t["font-weight"]=n.fontWeight);for(const e in Jw){let r=n[e];const o=Jw[e];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Ig(r)&&(r=qg(r,i.gradient,"")),t[o]=r)}for(const t in Kw){const e=n[t];null!=e&&(o=o||[],o.push(`${Kw[t]}: ${e};`))}o&&(t.style=o.join(" "))}(i,n,t,r,this._defs),i}defs(t){const n=this._defs.gradient,e=this._defs.clipping;if(0!==Object.keys(n).length+Object.keys(e).length){t.open("defs");for(const e in n){const r=n[e],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Lg+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+e+")"}).close(),t.close(),t.open("radialGradient",{id:e,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:e,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let n=0;n<i.length;++n)t.open("stop",{offset:i[n].offset,"stop-color":i[n].color}).close();t.close()}for(const n in e){const r=e[n];t.open("clipPath",{id:n}),r.path?t.open("path",{d:r.path}).close():t.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),t.close()}t.close()}}}const px={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class gx extends nw{constructor(t){super(t),this._svgRenderer=new nx(t),this._canvasRenderer=new Fw(t)}initialize(t,n,e,r,i){this._root_el=Xb(t,0,"div");const o=Xb(this._root_el,0,"div"),a=Xb(this._root_el,1,"div");return this._root_el.style.position="relative",px.debug||(o.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=px.svgOnTop?a:o,this._canvasEl=px.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,e,r,i),this._svgRenderer.initialize(this._svgEl,n,e,r,i),super.initialize(t,n,e,r,i)}dirty(t){return px.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const e=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((t=>!px.svgMarkTypes.includes(t)));this._svgRenderer.render(t,px.svgMarkTypes),this._canvasRenderer.render(t,e)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svgRenderer.resize(t,n,e,r),this._canvasRenderer.resize(t,n,e,r),this}background(t){return px.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class vx extends $w{constructor(t,n){super(t,n)}initialize(t,n,e){const r=Xb(Xb(t,0,"div"),px.svgOnTop?0:1,"div");return super.initialize(r,n,e)}}const yx="canvas",bx="hybrid",wx="none",xx={Canvas:yx,PNG:"png",SVG:"svg",Hybrid:bx,None:wx},$x={};function kx(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?($x[t]=n,this):$x[t]}function Mx(t,n,e){const r=[],i=(new Lv).union(n),o=t.marktype;return o?Ax(t,i,e,r):"group"===o?Dx(t,i,e,r):p("Intersect scene must be mark node or group item.")}function Ax(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u<a;++u)Dx(i[u],n,e,r);else for(const t=Pb[o].isect;u<a;++u){const e=i[u];Sx(e,n,t)&&r.push(e)}}return r}function Dx(t,n,e,r){e&&e(t.mark)&&Sx(t,n,Pb.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,u=t.y||0;n.translate(-a,-u);for(let t=0;t<o;++t)Ax(i[t],n,e,r);n.translate(a,u)}return r}function Sx(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}$x[yx]=$x.png={renderer:Fw,headless:Fw,handler:$w},$x.svg={renderer:nx,headless:mx,handler:Nw},$x[bx]={renderer:gx,headless:gx,handler:vx},$x[wx]={};const Fx=new Lv;function Ex(t){const n=t.clip;if(Z(n))n(fy(Fx.clear()));else{if(!n)return;Fx.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Fx)}function Nx(t,n,e){return t===n||("path"===e?Cx(t,n):t instanceof Date&&n instanceof Date?+t==+n:bt(t)&&bt(n)?Math.abs(t-n)<=1e-9:t&&n&&(S(t)||S(n))?function(t,n){var e,r,i=Object.keys(t),o=Object.keys(n);if(i.length!==o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!Nx(t[e=i[r]],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function Cx(t,n){return Nx(Qg(t),Qg(n))}const Ox="top",_x="left",zx="right",Bx="bottom",Tx="start",Px="middle",jx="end",Rx="group",Lx="axis",Ix="title",qx="legend",Ux="row-header",Wx="row-footer",Hx="row-title",Gx="column-header",Yx="column-footer",Vx="column-title",Xx="fit-x",Jx="fit-y",Kx="none",Qx="all",Zx="each",t$="flush",n$="column",e$="row";function r$(t){_a.call(this,null,t)}function i$(t,n,e){return n(t.bounds.clear(),t,e)}mt(r$,_a,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,o=Pb[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&e.dirty(r.items[0]),s=i$(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===Rx||t.modified())switch(n.visit(n.MOD,(t=>e.dirty(t))),s.clear(),r.items.forEach((t=>s.union(i$(t,a)))),r.role){case Lx:case qx:case Ix:n.reflow()}else u=n.changed(n.REM),n.visit(n.ADD,(t=>{s.union(i$(t,a))})),n.visit(n.MOD,(t=>{u=u||s.alignsWith(t.bounds),e.dirty(t),s.union(i$(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Ex(r),n.modifies("bounds")}});const o$=":vega_identifier:";function a$(t){_a.call(this,0,t)}function u$(t){_a.call(this,null,t)}function s$(t){_a.call(this,null,t)}a$.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},mt(a$,_a,{transform(t,n){const e=(i=n.dataflow)._signals[o$]||(i._signals[o$]=i.add(0)),r=t.as;var i;let o=e.value;return n.visit(n.ADD,(t=>t[r]=t[r]||++o)),e.set(this.value=o),n}}),mt(u$,_a,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(t){const n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===Rx?qv:Iv;return n.visit(n.ADD,(t=>r.call(t,e))),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const c$={parity:t=>t.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(t,n)=>{let e;return t.filter(((t,r)=>r&&f$(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)))}},f$=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),l$=(t,n)=>{for(var e,r=1,i=t.length,o=t[0].bounds;r<i;o=e,++r)if(f$(o,e=t[r].bounds,n))return!0},h$=t=>{const n=t.bounds;return n.width()>1&&n.height()>1},d$=t=>(t.forEach((t=>t.opacity=1)),t),m$=(t,n)=>t.reflow(n.modified()).modifies("opacity");function p$(t){_a.call(this,null,t)}mt(s$,_a,{transform(t,n){const e=c$[t.method]||c$.parity,r=t.separation||0;let i,o,a=n.materialize(n.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(d$(a),n=m$(n,t)),n;if(a=a.filter(h$),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=d$(a),n=m$(n,t),i.length>=3&&l$(i,r)){do{i=e(i,r)}while(i.length>=3&&l$(i,r));i.length<3&&!O(a).opacity&&(i.length>1&&(O(i).opacity=0),O(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,n,e)=>{var r=t.range(),i=new Lv;return n===Ox||n===Bx?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),n}}),mt(p$,_a,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,(t=>e.dirty(t))),n.fields&&n.fields.zindex){const t=n.source&&n.source[0];t&&(t.mark.zdirty=!0)}}});const g$=new Lv;function v$(t,n,e){return t[n]===e?0:(t[n]=e,1)}function y$(t){var n=t.items[0].orient;return n===_x||n===zx}function b$(t,n,e,r){var i,o,a=n.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,c=a.orient,f=function(t){let n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(u),l=a.range,h=a.offset,d=a.position,m=a.minExtent,p=a.maxExtent,g=u.title&&a.items[f[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&Db(g),w=0,x=0;switch(g$.clear().union(y),y.clear(),(i=f[0])>-1&&y.union(a.items[i].bounds),(i=f[1])>-1&&y.union(a.items[i].bounds),c){case Ox:w=d||0,x=-h,o=Math.max(m,Math.min(p,-y.y1)),y.add(0,-o).add(l,0),g&&w$(t,g,o,v,b,0,-1,y);break;case _x:w=-h,x=d||0,o=Math.max(m,Math.min(p,-y.x1)),y.add(-o,0).add(0,l),g&&w$(t,g,o,v,b,1,-1,y);break;case zx:w=e+h,x=d||0,o=Math.max(m,Math.min(p,y.x2)),y.add(0,0).add(o,l),g&&w$(t,g,o,v,b,1,1,y);break;case Bx:w=d||0,x=r+h,o=Math.max(m,Math.min(p,y.y2)),y.add(0,0).add(l,o),g&&w$(t,g,o,v,0,0,1,y);break;default:w=a.x,x=a.y}return Gv(y.translate(w,x),a),v$(a,"x",w+s)|v$(a,"y",x+s)&&(a.bounds=g$,t.dirty(a),a.bounds=y,t.dirty(a)),a.mark.bounds.clear().union(y)}function w$(t,n,e,r,i,o,a,u){const s=n.bounds;if(n.auto){const u=a*(e+i+r);let c=0,f=0;t.dirty(n),o?c=(n.x||0)-(n.x=u):f=(n.y||0)-(n.y=u),n.mark.bounds.clear().union(s.translate(-c,-f)),t.dirty(n)}u.union(s)}const x$=(t,n)=>Math.floor(Math.min(t,n)),$$=(t,n)=>Math.ceil(Math.max(t,n));function k$(t){return(new Lv).set(0,0,t.width||0,t.height||0)}function M$(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function A$(t,n,e){const r=S(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function D$(t){return t<0?Math.ceil(-t):0}function S$(t,n,e){var r,i,o,a,u,s,c,f,l,h,d,m=!e.nodirty,p=e.bounds===t$?k$:M$,g=g$.set(0,0,0,0),v=A$(e.align,n$),y=A$(e.align,e$),b=A$(e.padding,n$),w=A$(e.padding,e$),x=e.columns||n.length,$=x<=0?1:Math.ceil(n.length/x),k=n.length,M=Array(k),A=Array(x),D=0,S=Array(k),F=Array($),E=0,N=Array(k),C=Array(k),O=Array(k);for(i=0;i<x;++i)A[i]=0;for(i=0;i<$;++i)F[i]=0;for(i=0;i<k;++i)u=O[i]=p(s=n[i]),s.x=s.x||0,N[i]=0,s.y=s.y||0,C[i]=0,o=i%x,a=~~(i/x),D=Math.max(D,c=Math.ceil(u.x2)),E=Math.max(E,f=Math.ceil(u.y2)),A[o]=Math.max(A[o],c),F[a]=Math.max(F[a],f),M[i]=b+D$(u.x1),S[i]=w+D$(u.y1),m&&t.dirty(n[i]);for(i=0;i<k;++i)i%x==0&&(M[i]=0),i<x&&(S[i]=0);if(v===Zx)for(o=1;o<x;++o){for(d=0,i=o;i<k;i+=x)d<M[i]&&(d=M[i]);for(i=o;i<k;i+=x)M[i]=d+A[o-1]}else if(v===Qx){for(d=0,i=0;i<k;++i)i%x&&d<M[i]&&(d=M[i]);for(i=0;i<k;++i)i%x&&(M[i]=d+D)}else for(v=!1,o=1;o<x;++o)for(i=o;i<k;i+=x)M[i]+=A[o-1];if(y===Zx)for(a=1;a<$;++a){for(d=0,r=(i=a*x)+x;i<r;++i)d<S[i]&&(d=S[i]);for(i=a*x;i<r;++i)S[i]=d+F[a-1]}else if(y===Qx){for(d=0,i=x;i<k;++i)d<S[i]&&(d=S[i]);for(i=x;i<k;++i)S[i]=d+E}else for(y=!1,a=1;a<$;++a)for(r=(i=a*x)+x;i<r;++i)S[i]+=F[a-1];for(l=0,i=0;i<k;++i)N[i]+=(l=M[i]+(i%x?l:0))-n[i].x;for(o=0;o<x;++o)for(h=0,i=o;i<k;i+=x)C[i]+=(h+=S[i])-n[i].y;if(v&&A$(e.center,n$)&&$>1)for(i=0;i<k;++i)(l=(u=v===Qx?D:A[i%x])-O[i].x2-n[i].x-N[i])>0&&(N[i]+=l/2);if(y&&A$(e.center,e$)&&1!==x)for(i=0;i<k;++i)(h=(u=y===Qx?E:F[~~(i/x)])-O[i].y2-n[i].y-C[i])>0&&(C[i]+=h/2);for(i=0;i<k;++i)g.union(O[i].translate(N[i],C[i]));switch(l=A$(e.anchor,"x"),h=A$(e.anchor,"y"),A$(e.anchor,n$)){case jx:l-=g.width();break;case Px:l-=g.width()/2}switch(A$(e.anchor,e$)){case jx:h-=g.height();break;case Px:h-=g.height()/2}for(l=Math.round(l),h=Math.round(h),g.clear(),i=0;i<k;++i)n[i].mark.bounds.clear();for(i=0;i<k;++i)(s=n[i]).x+=N[i]+=l,s.y+=C[i]+=h,g.union(s.mark.bounds.union(s.bounds.translate(N[i],C[i]))),m&&t.dirty(s);return g}function F$(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function E$(t,n){return t.bounds[n]}function N$(t,n,e,r,i,o,a,u,s,c,f,l,h,d){var m,p,g,v,y,b,w,x,$,k=e.length,M=0,A=0;if(!k)return M;for(m=f;m<k;m+=l)e[m]&&(M=a(M,s(e[m],c)));if(!n.length)return M;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),M+=o,p=0,v=n.length;p<v;++p)t.dirty(n[p]),n[p].mark.bounds.clear();for(m=f,p=0,v=n.length;p<v;++p,m+=l){for(y=(b=n[p]).mark.bounds,g=m;g>=0&&null==(w=e[g]);g-=h);u?(x=null==d?w.x:Math.round(w.bounds.x1+d*w.bounds.width()),$=M):(x=M,$=null==d?w.y:Math.round(w.bounds.y1+d*w.bounds.height())),y.union(b.bounds.translate(x-(b.x||0),$-(b.y||0))),b.x=x,b.y=$,t.dirty(b),A=a(A,y[c])}return A}function C$(t,n,e,r,i,o){if(n){t.dirty(n);var a=e,u=e;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),n.bounds.translate(a-(n.x||0),u-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=a,n.y=u,t.dirty(n)}}function O$(t,n,e,r,i,o,a){const u=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),s=function(t,n){let e=-1/0;return t.forEach((t=>{null!=t.offset&&(e=Math.max(e,t.offset))})),e>-1/0?e:n}(t,u("offset",0)),c=u("anchor",Tx),f=c===jx?1:c===Px?.5:0,l={align:Zx,bounds:u("bounds",t$),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(n){case _x:l.anchor={x:Math.floor(r.x1)-s,column:jx,y:f*(a||r.height()+2*r.y1),row:c};break;case zx:l.anchor={x:Math.ceil(r.x2)+s,y:f*(a||r.height()+2*r.y1),row:c};break;case Ox:l.anchor={y:Math.floor(i.y1)-s,row:jx,x:f*(o||i.width()+2*i.x1),column:c};break;case Bx:l.anchor={y:Math.ceil(i.y2)+s,x:f*(o||i.width()+2*i.x1),column:c};break;case"top-left":l.anchor={x:s,y:s};break;case"top-right":l.anchor={x:o-s,y:s,column:jx};break;case"bottom-left":l.anchor={x:s,y:a-s,row:jx};break;case"bottom-right":l.anchor={x:o-s,y:a-s,column:jx,row:jx}}return l}function _$(t,n){var e,r,i=n.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,c=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,n,e){var r=n.padding,i=r-e.x,o=r-e.y;if(n.datum.title){var a=n.items[1].items[0],u=a.anchor,s=n.titlePadding||0,c=r-a.x,f=r-a.y;switch(a.orient){case _x:i+=Math.ceil(a.bounds.width())+s;break;case zx:case Bx:break;default:o+=a.bounds.height()+s}switch((i||o)&&B$(t,e,i,o),a.orient){case _x:f+=z$(n,e,a,u,1,1);break;case zx:c+=z$(n,e,a,jx,0,0)+s,f+=z$(n,e,a,u,1,1);break;case Bx:c+=z$(n,e,a,u,0,0),f+=z$(n,e,a,jx,-1,0,1)+s;break;default:c+=z$(n,e,a,u,0,0)}(c||f)&&B$(t,a,c,f),(c=Math.round(a.bounds.x1-r))<0&&(B$(t,e,-c,0),B$(t,a,-c,0))}else(i||o)&&B$(t,e,i,o)}(t,i,i.items[0].items[0]),u=function(t,n){return t.items.forEach((t=>n.union(t.bounds))),n.x1=t.padding,n.y1=t.padding,n}(i,u),e=2*i.padding,r=2*i.padding,u.empty()||(e=Math.ceil(u.width()+e),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const n=t.reduce(((t,n)=>(t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t)),{});t.forEach((t=>{t.width=n[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==Kx&&(i.x=s=0,i.y=c=0),i.width=e,i.height=r,Gv(u.set(s,c,s+e,c+r),i),i.mark.bounds.clear().union(u),i}function z$(t,n,e,r,i,o,a){const u=e.datum.vgrad,s=("symbol"===t.datum.type||!o&&u||a?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?s:0,f=u&&o?0:s,l=i<=0?0:Db(e);return Math.round(r===Tx?c:r===jx?f-l:.5*(s-l))}function B$(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function T$(t){_a.call(this,null,t)}mt(T$,_a,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach((n=>{t.layout&&function(t,n,e){var r,i,o,a,u,s,c,f=function(t){var n,e,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(e=(n=r[o]).items,n.marktype===Rx)switch(n.role){case Lx:case qx:case Ix:break;case Ux:a.rowheaders.push(...e);break;case Wx:a.rowfooters.push(...e);break;case Gx:a.colheaders.push(...e);break;case Yx:a.colfooters.push(...e);break;case Hx:a.rowtitle=e[0];break;case Vx:a.coltitle=e[0];break;default:a.marks.push(...e)}return a}(n),l=f.marks,h=e.bounds===t$?F$:E$,d=e.offset,m=e.columns||l.length,p=m<=0?1:Math.ceil(l.length/m),g=p*m;const v=S$(t,l,e);v.empty()&&v.set(0,0,0,0),f.rowheaders&&(s=A$(e.headerBand,e$,null),r=N$(t,f.rowheaders,l,0,p,-A$(d,"rowHeader"),x$,0,h,"x1",0,m,1,s)),f.colheaders&&(s=A$(e.headerBand,n$,null),i=N$(t,f.colheaders,l,0,m,-A$(d,"columnHeader"),x$,1,h,"y1",0,1,m,s)),f.rowfooters&&(s=A$(e.footerBand,e$,null),o=N$(t,f.rowfooters,l,0,p,A$(d,"rowFooter"),$$,0,h,"x2",m-1,m,1,s)),f.colfooters&&(s=A$(e.footerBand,n$,null),a=N$(t,f.colfooters,l,0,m,A$(d,"columnFooter"),$$,1,h,"y2",g-m,1,m,s)),f.rowtitle&&(u=A$(e.titleAnchor,e$),c=A$(d,"rowTitle"),c=u===jx?o+c:r-c,s=A$(e.titleBand,e$,.5),C$(t,f.rowtitle,c,0,v,s)),f.coltitle&&(u=A$(e.titleAnchor,n$),c=A$(d,"columnTitle"),c=u===jx?a+c:i-c,s=A$(e.titleBand,n$,.5),C$(t,f.coltitle,c,1,v,s))}(e,n,t.layout),function(t,n,e){var r,i,o,a,u,s=n.items,c=Math.max(0,n.width||0),f=Math.max(0,n.height||0),l=(new Lv).set(0,0,c,f),h=l.clone(),d=l.clone(),m=[];for(a=0,u=s.length;a<u;++a)switch((i=s[a]).role){case Lx:(y$(i)?h:d).union(b$(t,i,c,f));break;case Ix:r=i;break;case qx:m.push(_$(t,i));break;case"frame":case"scope":case Ux:case Wx:case Hx:case Gx:case Yx:case Vx:h.union(i.bounds),d.union(i.bounds);break;default:l.union(i.bounds)}if(m.length){const n={};m.forEach((t=>{(o=t.orient||zx)!==Kx&&(n[o]||(n[o]=[])).push(t)}));for(const r in n){const i=n[r];S$(t,i,O$(i,r,e.legends,h,d,c,f))}m.forEach((n=>{const r=n.bounds;if(r.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=r,t.dirty(n)),!e.autosize||"fit"!==e.autosize.type&&e.autosize.type!==Xx&&e.autosize.type!==Jx)l.union(r);else switch(n.orient){case _x:case zx:l.add(r.x1,0).add(r.x2,0);break;case Ox:case Bx:l.add(0,r.y1).add(0,r.y2)}}))}l.union(h).union(d),r&&l.union(function(t,n,e,r,i){var o,a=n.items[0],u=a.orient,s=a.anchor,c=a.offset,f=a.padding,l=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],d=u===_x||u===zx?r:e,m=0,p=0,g=0,v=0,y=0;if(a.frame!==Rx?u===_x?(m=i.y2,d=i.y1):u===zx?(m=i.y1,d=i.y2):(m=i.x1,d=i.x2):u===_x&&(m=r,d=0),o=s===Tx?m:s===jx?d:(m+d)/2,h&&h.text){switch(u){case Ox:case Bx:y=l.bounds.height()+f;break;case _x:v=l.bounds.width()+f;break;case zx:v=-l.bounds.width()-f}g$.clear().union(h.bounds),g$.translate(v-(h.x||0),y-(h.y||0)),v$(h,"x",v)|v$(h,"y",y)&&(t.dirty(h),h.bounds.clear().union(g$),h.mark.bounds.clear().union(g$),t.dirty(h)),g$.clear().union(h.bounds)}else g$.clear();switch(g$.union(l.bounds),u){case Ox:p=o,g=i.y1-g$.height()-c;break;case _x:p=i.x1-g$.width()-c,g=o;break;case zx:p=i.x2+g$.width()+c,g=o;break;case Bx:p=o,g=i.y2+c;break;default:p=a.x,g=a.y}return v$(a,"x",p)|v$(a,"y",g)&&(g$.translate(p,g),t.dirty(a),a.bounds.clear().union(g$),n.bounds.clear().union(g$),t.dirty(a)),a.bounds}(t,r,c,f,l)),n.clip&&l.set(0,0,n.width||0,n.height||0),function(t,n,e,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),f=Math.max(0,n.height||0),l=Math.max(0,Math.ceil(-e.y1));const h=Math.max(0,Math.ceil(e.x2-s)),d=Math.max(0,Math.ceil(e.y2-f));if("padding"===i.contains){const n=t.padding();a-=n.left+n.right,u-=n.top+n.bottom}o===Kx?(c=0,l=0,s=a,f=u):"fit"===o?(s=Math.max(0,a-c-h),f=Math.max(0,u-l-d)):o===Xx?(s=Math.max(0,a-c-h),u=f+l+d):o===Jx?(a=s+c+h,f=Math.max(0,u-l-d)):"pad"===o&&(a=s+c+h,u=f+l+d),t._resizeView(a,u,s,f,[c,l],i.resize)}(t,n,l,e)}(e,n,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?n.reflow():n}});var P$=Object.freeze({__proto__:null,bound:r$,identifier:a$,mark:u$,overlap:s$,render:p$,viewlayout:T$});function j$(t){_a.call(this,null,t)}function R$(t){_a.call(this,null,t)}function L$(){return ra({})}function I$(t){_a.call(this,null,t)}function q$(t){_a.call(this,[],t)}mt(j$,_a,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,o=t.scale,a=Mg(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Sg(e,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Ag(o,t.values,a):Dg(o,a);return i&&(r.rem=i),i=s.map(((t,n)=>ra({index:n/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ra({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),mt(R$,_a,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||L$,o=t.key||na,a=this.value;return D(r.encode)&&(r.encode=null),a&&(t.modified("key")||n.modified(o))&&p("DataJoin does not support modified key function or fields."),a||(n=n.addAll(),this.value=a=function(t){const n=ht().test((t=>t.exit));return n.lookup=e=>n.get(t(e)),n}(o)),n.visit(n.ADD,(t=>{const n=o(t);let e=a.get(n);e?e.exit?(a.empty--,r.add.push(e)):r.mod.push(e):(e=i(t),a.set(n,e),r.add.push(e)),e.datum=t,e.exit=!1})),n.visit(n.MOD,(t=>{const n=o(t),e=a.get(n);e&&(e.datum=t,r.mod.push(e))})),n.visit(n.REM,(t=>{const n=o(t),e=a.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++a.empty)})),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&a.empty>e.cleanThreshold)&&e.runAfter(a.clean),r}}),mt(I$,_a,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,o=n.encode;if(D(o)){if(!e.changed()&&!o.every((t=>i[t])))return n.StopPropagation;o=o[0],e.encode=null}var a="enter"===o,u=i.update||k,s=i.enter||k,c=i.exit||k,f=(o&&!a?i[o]:u)||k;if(n.changed(n.ADD)&&(n.visit(n.ADD,(n=>{s(n,t),u(n,t)})),e.modifies(s.output),e.modifies(u.output),f!==k&&f!==u&&(n.visit(n.ADD,(n=>{f(n,t)})),e.modifies(f.output))),n.changed(n.REM)&&c!==k&&(n.visit(n.REM,(n=>{c(n,t)})),e.modifies(c.output)),a||f!==k){const i=n.MOD|(t.modified()?n.REFLOW:0);a?(n.visit(i,(n=>{const i=s(n,t)||r;(f(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(s.output)):n.visit(i,(n=>{(f(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(f.output)}return e.changed()?e:n.StopPropagation}}),mt(q$,_a,{transform(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,o,a,u=n.dataflow.locale(),s=n.fork(n.NO_SOURCE|n.NO_FIELDS),c=this.value,f=t.type||wg,l=t.scale,h=+t.limit,d=Mg(l,null==t.count?5:t.count,t.minstep),m=t.format||Og(u,l,d,f,t.formatSpecifier,t.formatType,!!t.values||f===wg),p=t.values||Cg(l,d);return c&&(s.rem=c),f===wg?(h&&p.length>h?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=p.slice(0,h-1),a=!0):c=p,Z(i=t.size)?(t.values||0!==l(c[0])||(c=c.slice(1)),o=c.reduce(((n,e)=>Math.max(n,i(e,t))),0)):i=ot(o=i||8),c=c.map(((n,e)=>ra({index:e,label:m(n,e,c),value:n,offset:o,size:i(n,t)}))),a&&c.push(ra({index:c.length,label:`…${p.length-c.length} entries`,value:a=p[c.length],offset:o,size:i(a,t)}))):"gradient"===f?(e=l.domain(),r=mg(l,e[0],O(e)),p.length<3&&!t.values&&e[0]!==O(e)&&(p=[e[0],O(e)]),c=p.map(((t,n)=>ra({index:n,label:m(t,n,p),value:t,perc:r(t)})))):(i=p.length-1,r=function(t){const n=t.domain(),e=n.length-1;let r=+n[0],i=+O(n),o=i-r;if(t.type===jp){const t=e?o/e:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(l),c=p.map(((t,n)=>ra({index:n,label:m(t,n,p),value:t,perc:n?r(t):0,perc2:n===i?1:r(p[n+1])})))),s.source=c,s.add=c,this.value=c,s}});const U$=t=>t.source.x,W$=t=>t.source.y,H$=t=>t.target.x,G$=t=>t.target.y;function Y$(t){_a.call(this,{},t)}Y$.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},mt(Y$,_a,{transform(t,n){var e=t.sourceX||U$,r=t.sourceY||W$,i=t.targetX||H$,o=t.targetY||G$,a=t.as||"path",u=t.shape||"line",s=K$.get(u+"-"+(t.orient||"vertical"))||K$.get(u);return s||p("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(t=>{t[a]=s(e(t),r(t),i(t),o(t))})),n.reflow(t.modified()).modifies(a)}});const V$=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,X$=(t,n,e,r)=>{var i=e-t,o=r-n,a=Math.hypot(i,o)/2;return"M"+t+","+n+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+e+","+r},J$=(t,n,e,r)=>{const i=e-t,o=r-n,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+n+"C"+(t+a)+","+(n+u)+" "+(e+u)+","+(r-a)+" "+e+","+r},K$=ht({line:V$,"line-radial":(t,n,e,r)=>V$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:X$,"arc-radial":(t,n,e,r)=>X$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:J$,"curve-radial":(t,n,e,r)=>J$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e);return"M"+n*i+","+n*o+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*a+","+n*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function Q$(t){_a.call(this,null,t)}function Z$(t){return ig(t)&&t!==zp}Q$.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},mt(Q$,_a,{transform(t,n){var e,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=n.source,l=f.map(t.field||x),h=l.length,d=s,m=(c-s)/En(l),p=Fn(h);for(t.sort&&p.sort(((t,n)=>l[t]-l[n])),e=0;e<h;++e)i=l[p[e]],(r=f[p[e]])[a]=d,r[u]=d+=i*m;return this.value=l,n.reflow(t.modified()).modifies(o)}});const tk=zt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function nk(t){_a.call(this,null,t),this.modified(!0)}function ek(t,n,e){return ug(t)&&Math.abs(n.reduce(((t,n)=>t+(n<0?-1:n>0?1:0)),0))!==n.length&&e.warn("Log scale domain includes zero: "+Et(n)),n}function rk(t,n,e){return Z(t)&&(n||e)?lg(t,ik(n||[0,1],e)):t}function ik(t,n){return n?t.slice().reverse():t}function ok(t){_a.call(this,null,t)}mt(nk,_a,{transform(t,n){var e=n.dataflow,r=this.value,i=function(t){var n,e=t.type,r="";return e===zp?zp+"-"+Sp:(function(t){const n=t.type;return ig(n)&&n!==Op&&n!==_p&&(t.scheme||t.range&&t.range.length&&t.range.every(xt))}(t)&&(r=2===(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?zp+"-":3===n?Bp+"-":""),(r+e||Sp).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=ng(i)()),t)if(!tk[i]){if("padding"===i&&Z$(r.type))continue;Z(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(t,n,e){var r=t.type,i=n.round||!1,o=n.range;if(null!=n.rangeStep)o=function(t,n,e){return t!==Ip&&t!==Lp&&p("Only band and point scales support rangeStep."),[0,n.rangeStep*Dp(e,t===Lp?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0,(null!=n.paddingOuter?n.paddingOuter:n.padding)||0)]}(r,n,e);else if(n.scheme&&(o=function(t,n,e){var r,i=n.schemeExtent;return D(n.scheme)?r=hg(n.scheme,n.interpolate,n.interpolateGamma):(r=bg(n.scheme.toLowerCase()))||p(`Unrecognized scheme name: ${n.scheme}`),e=t===jp?e+1:t===qp?e-1:t===Tp||t===Pp?+n.schemeCount||5:e,sg(t)?rk(r,i,n.reverse):Z(r)?dg(rk(r,i),e):t===Rp?r:r.slice(0,e)}(r,n,e),Z(o))){if(t.interpolator)return t.interpolator(o);p(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&sg(r))return t.interpolator(hg(ik(o,n.reverse),n.interpolate,n.interpolateGamma));o&&n.interpolate&&t.interpolate?t.interpolate(pg(n.interpolate,n.interpolateGamma)):Z(t.round)?t.round(i):Z(t.rangeRound)&&t.interpolate(i?Ql:Kl),o&&t.range(ik(o,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!D(r)){const n=t.domain(),e=n[0],i=O(n),o=r.step;let a=null==r.start?e:r.start,u=null==r.stop?i:r.stop;o||p("Scale bins parameter missing step property."),a<e&&(a=o*Math.ceil(e/o)),u>i&&(u=o*Math.floor(i/o)),r=Fn(a,u+o/2,o)}return r?t.bins=r:t.bins&&delete t.bins,t.type===qp&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain()),e}(r,t,function(t,n,e){const r=function(t,n,e){return n?(t.domain(ek(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,o,a=n.domain,u=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Sp||n===Ep||n===Np)}(t);if(!a)return 0;if((s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=n.domainMin&&(a[0]=n.domainMin),null!=n.domainMax&&(a[i]=n.domainMax),null!=n.domainMid)){const t=(o=n.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&e.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}return Z$(u)&&n.padding&&a[0]!==O(a)&&(a=function(t,n,e,r,i,o){var a=Math.abs(O(e)-e[0]),u=a/(a-2*r),s=t===Fp?G(n,null,u):t===Np?Y(n,null,u,.5):t===Ep?Y(n,null,u,i||1):t===Cp?V(n,null,u,o||1):H(n,null,u);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(u,a,n.range,n.padding,n.exponent,n.constant)),t.domain(ek(u,a,e)),u===Rp&&t.unknown(n.domainImplicit?bf:void 0),n.nice&&t.nice&&t.nice(!0!==n.nice&&Mg(t,n.nice)||null),a.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),mt(ok,_a,{transform(t,n){const e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(ua(t.sort)),this.modified(e),n}});const ak="zero",uk="center",sk="normalize",ck=["y0","y1"];function fk(t){_a.call(this,null,t)}function lk(t,n,e,r,i){for(var o,a=(n-t.sum)/2,u=t.length,s=0;s<u;++s)(o=t[s])[r]=a,o[i]=a+=Math.abs(e(o))}function hk(t,n,e,r,i){for(var o,a=1/t.sum,u=0,s=t.length,c=0,f=0;c<s;++c)(o=t[c])[r]=u,o[i]=u=a*(f+=Math.abs(e(o)))}function dk(t,n,e,r,i){for(var o,a,u=0,s=0,c=t.length,f=0;f<c;++f)(o=+e(a=t[f]))<0?(a[r]=s,a[i]=s+=o):(a[r]=u,a[i]=u+=o)}fk.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:ak,values:[ak,uk,sk]},{name:"as",type:"string",array:!0,length:2,default:ck}]},mt(fk,_a,{transform(t,n){var e,r,i,o,a=t.as||ck,u=a[0],s=a[1],c=ua(t.sort),f=t.field||x,l=t.offset===uk?lk:t.offset===sk?hk:dk;for(e=function(t,n,e,r){var i,o,a,u,s,c,f,l,h,d=[],m=t=>t(s);if(null==n)d.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)s=t[o],(f=i[c=n.map(m)])||(i[c]=f=[],d.push(f)),f.push(s);for(c=0,h=0,u=d.length;c<u;++c){for(o=0,l=0,a=(f=d[c]).length;o<a;++o)l+=Math.abs(r(f[o]));f.sum=l,l>h&&(h=l),e&&f.sort(e)}return d.max=h,d}(n.source,t.groupby,c,f),r=0,i=e.length,o=e.max;r<i;++r)l(e[r],o,f,u,s);return n.reflow(t.modified()).modifies(a)}});var mk=Object.freeze({__proto__:null,axisticks:j$,datajoin:R$,encode:I$,legendentries:q$,linkpath:Y$,pie:Q$,scale:nk,sortitems:ok,stack:fk}),pk=1e-6,gk=1e-12,vk=Math.PI,yk=vk/2,bk=vk/4,wk=2*vk,xk=180/vk,$k=vk/180,kk=Math.abs,Mk=Math.atan,Ak=Math.atan2,Dk=Math.cos,Sk=Math.ceil,Fk=Math.exp,Ek=Math.hypot,Nk=Math.log,Ck=Math.pow,Ok=Math.sin,_k=Math.sign||function(t){return t>0?1:t<0?-1:0},zk=Math.sqrt,Bk=Math.tan;function Tk(t){return t>1?0:t<-1?vk:Math.acos(t)}function Pk(t){return t>1?yk:t<-1?-yk:Math.asin(t)}function jk(){}function Rk(t,n){t&&Ik.hasOwnProperty(t.type)&&Ik[t.type](t,n)}var Lk={Feature:function(t,n){Rk(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Rk(e[r].geometry,n)}},Ik={Sphere:function(t,n){n.sphere()},Point:function(t,n){n.point((t=t.coordinates)[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)n.point((t=e[r])[0],t[1],t[2])},LineString:function(t,n){qk(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)qk(e[r],n,0)},Polygon:function(t,n){Uk(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Uk(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Rk(e[r],n)}};function qk(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)n.point((r=t[i])[0],r[1],r[2]);n.lineEnd()}function Uk(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)qk(t[e],n,1);n.polygonEnd()}function Wk(t,n){t&&Lk.hasOwnProperty(t.type)?Lk[t.type](t,n):Rk(t,n)}var Hk,Gk,Yk,Vk,Xk,Jk,Kk,Qk,Zk,tM,nM,eM,rM,iM,oM,aM,uM=new on,sM=new on,cM={point:jk,lineStart:jk,lineEnd:jk,polygonStart:function(){uM=new on,cM.lineStart=fM,cM.lineEnd=lM},polygonEnd:function(){var t=+uM;sM.add(t<0?wk+t:t),this.lineStart=this.lineEnd=this.point=jk},sphere:function(){sM.add(wk)}};function fM(){cM.point=hM}function lM(){dM(Hk,Gk)}function hM(t,n){cM.point=dM,Hk=t,Gk=n,Yk=t*=$k,Vk=Dk(n=(n*=$k)/2+bk),Xk=Ok(n)}function dM(t,n){var e=(t*=$k)-Yk,r=e>=0?1:-1,i=r*e,o=Dk(n=(n*=$k)/2+bk),a=Ok(n),u=Xk*a,s=Vk*o+u*Dk(i),c=u*r*Ok(i);uM.add(Ak(c,s)),Yk=t,Vk=o,Xk=a}function mM(t){return[Ak(t[1],t[0]),Pk(t[2])]}function pM(t){var n=t[0],e=t[1],r=Dk(e);return[r*Dk(n),r*Ok(n),Ok(e)]}function gM(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function vM(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function yM(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function bM(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function wM(t){var n=zk(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var xM,$M,kM,MM,AM,DM,SM,FM,EM,NM,CM,OM,_M,zM,BM,TM,PM={point:jM,lineStart:LM,lineEnd:IM,polygonStart:function(){PM.point=qM,PM.lineStart=UM,PM.lineEnd=WM,iM=new on,cM.polygonStart()},polygonEnd:function(){cM.polygonEnd(),PM.point=jM,PM.lineStart=LM,PM.lineEnd=IM,uM<0?(Jk=-(Qk=180),Kk=-(Zk=90)):iM>pk?Zk=90:iM<-1e-6&&(Kk=-90),aM[0]=Jk,aM[1]=Qk},sphere:function(){Jk=-(Qk=180),Kk=-(Zk=90)}};function jM(t,n){oM.push(aM=[Jk=t,Qk=t]),n<Kk&&(Kk=n),n>Zk&&(Zk=n)}function RM(t,n){var e=pM([t*$k,n*$k]);if(rM){var r=vM(rM,e),i=vM([r[1],-r[0],0],r);wM(i),i=mM(i);var o,a=t-tM,u=a>0?1:-1,s=i[0]*xk*u,c=kk(a)>180;c^(u*tM<s&&s<u*t)?(o=i[1]*xk)>Zk&&(Zk=o):c^(u*tM<(s=(s+360)%360-180)&&s<u*t)?(o=-i[1]*xk)<Kk&&(Kk=o):(n<Kk&&(Kk=n),n>Zk&&(Zk=n)),c?t<tM?HM(Jk,t)>HM(Jk,Qk)&&(Qk=t):HM(t,Qk)>HM(Jk,Qk)&&(Jk=t):Qk>=Jk?(t<Jk&&(Jk=t),t>Qk&&(Qk=t)):t>tM?HM(Jk,t)>HM(Jk,Qk)&&(Qk=t):HM(t,Qk)>HM(Jk,Qk)&&(Jk=t)}else oM.push(aM=[Jk=t,Qk=t]);n<Kk&&(Kk=n),n>Zk&&(Zk=n),rM=e,tM=t}function LM(){PM.point=RM}function IM(){aM[0]=Jk,aM[1]=Qk,PM.point=jM,rM=null}function qM(t,n){if(rM){var e=t-tM;iM.add(kk(e)>180?e+(e>0?360:-360):e)}else nM=t,eM=n;cM.point(t,n),RM(t,n)}function UM(){cM.lineStart()}function WM(){qM(nM,eM),cM.lineEnd(),kk(iM)>pk&&(Jk=-(Qk=180)),aM[0]=Jk,aM[1]=Qk,rM=null}function HM(t,n){return(n-=t)<0?n+360:n}function GM(t,n){return t[0]-n[0]}function YM(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var VM={sphere:jk,point:XM,lineStart:KM,lineEnd:tA,polygonStart:function(){VM.lineStart=nA,VM.lineEnd=eA},polygonEnd:function(){VM.lineStart=KM,VM.lineEnd=tA}};function XM(t,n){t*=$k;var e=Dk(n*=$k);JM(e*Dk(t),e*Ok(t),Ok(n))}function JM(t,n,e){++xM,kM+=(t-kM)/xM,MM+=(n-MM)/xM,AM+=(e-AM)/xM}function KM(){VM.point=QM}function QM(t,n){t*=$k;var e=Dk(n*=$k);zM=e*Dk(t),BM=e*Ok(t),TM=Ok(n),VM.point=ZM,JM(zM,BM,TM)}function ZM(t,n){t*=$k;var e=Dk(n*=$k),r=e*Dk(t),i=e*Ok(t),o=Ok(n),a=Ak(zk((a=BM*o-TM*i)*a+(a=TM*r-zM*o)*a+(a=zM*i-BM*r)*a),zM*r+BM*i+TM*o);$M+=a,DM+=a*(zM+(zM=r)),SM+=a*(BM+(BM=i)),FM+=a*(TM+(TM=o)),JM(zM,BM,TM)}function tA(){VM.point=XM}function nA(){VM.point=rA}function eA(){iA(OM,_M),VM.point=XM}function rA(t,n){OM=t,_M=n,t*=$k,n*=$k,VM.point=iA;var e=Dk(n);zM=e*Dk(t),BM=e*Ok(t),TM=Ok(n),JM(zM,BM,TM)}function iA(t,n){t*=$k;var e=Dk(n*=$k),r=e*Dk(t),i=e*Ok(t),o=Ok(n),a=BM*o-TM*i,u=TM*r-zM*o,s=zM*i-BM*r,c=Ek(a,u,s),f=Pk(c),l=c&&-f/c;EM.add(l*a),NM.add(l*u),CM.add(l*s),$M+=f,DM+=f*(zM+(zM=r)),SM+=f*(BM+(BM=i)),FM+=f*(TM+(TM=o)),JM(zM,BM,TM)}function oA(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function aA(t,n){return kk(t)>vk&&(t-=Math.round(t/wk)*wk),[t,n]}function uA(t,n,e){return(t%=wk)?n||e?oA(cA(t),fA(n,e)):cA(t):n||e?fA(n,e):aA}function sA(t){return function(n,e){return kk(n+=t)>vk&&(n-=Math.round(n/wk)*wk),[n,e]}}function cA(t){var n=sA(t);return n.invert=sA(-t),n}function fA(t,n){var e=Dk(t),r=Ok(t),i=Dk(n),o=Ok(n);function a(t,n){var a=Dk(n),u=Dk(t)*a,s=Ok(t)*a,c=Ok(n),f=c*e+u*r;return[Ak(s*i-f*o,u*e-c*r),Pk(f*i+s*o)]}return a.invert=function(t,n){var a=Dk(n),u=Dk(t)*a,s=Ok(t)*a,c=Ok(n),f=c*i-s*o;return[Ak(s*i+c*o,u*e+f*r),Pk(f*e-u*r)]},a}function lA(t,n){(n=pM(n))[0]-=t,wM(n);var e=Tk(-n[1]);return((-n[2]<0?-e:e)+wk-pk)%wk}function hA(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:jk,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function dA(t,n){return kk(t[0]-n[0])<pk&&kk(t[1]-n[1])<pk}function mA(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function pA(t,n,e,r,i){var o,a,u=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(dA(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}u.push(e=new mA(r,t,null,!0)),s.push(e.o=new mA(r,null,e,!1)),u.push(e=new mA(a,t,null,!1)),s.push(e.o=new mA(a,null,e,!0))}})),u.length){for(s.sort(n),gA(u),gA(s),o=0,a=s.length;o<a;++o)s[o].e=e=!e;for(var c,f,l=u[0];;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;c=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((f=c[o])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(o=(c=h.p.z).length-1;o>=0;--o)i.point((f=c[o])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}c=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function gA(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function vA(t){return kk(t[0])<=vk?t[0]:_k(t[0])*((kk(t[0])+vk)%wk-vk)}function yA(t,n,e,r){return function(i){var o,a,u,s=n(i),c=hA(),f=n(c),l=!1,h={point:d,lineStart:p,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=b,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=p,h.lineEnd=g,a=Sn(a);var t=function(t,n){var e=vA(n),r=n[1],i=Ok(r),o=[Ok(e),-Dk(e),0],a=0,u=0,s=new on;1===i?r=yk+pk:-1===i&&(r=-yk-pk);for(var c=0,f=t.length;c<f;++c)if(h=(l=t[c]).length)for(var l,h,d=l[h-1],m=vA(d),p=d[1]/2+bk,g=Ok(p),v=Dk(p),y=0;y<h;++y,m=w,g=$,v=k,d=b){var b=l[y],w=vA(b),x=b[1]/2+bk,$=Ok(x),k=Dk(x),M=w-m,A=M>=0?1:-1,D=A*M,S=D>vk,F=g*$;if(s.add(Ak(F*A*Ok(D),v*k+F*Dk(D))),a+=S?M+A*wk:M,S^m>=e^w>=e){var E=vM(pM(d),pM(b));wM(E);var N=vM(o,E);wM(N);var C=(S^M>=0?-1:1)*Pk(N[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=S^M>=0?1:-1)}}return(a<-1e-6||a<pk&&s<-1e-12)^1&u}(o,r);a.length?(l||(i.polygonStart(),l=!0),pA(a,wA,t,e,i)):t&&(l||(i.polygonStart(),l=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),l&&(i.polygonEnd(),l=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function m(t,n){s.point(t,n)}function p(){h.point=m,s.lineStart()}function g(){h.point=d,s.lineEnd()}function v(t,n){u.push([t,n]),f.point(t,n)}function y(){f.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),f.lineEnd();var t,n,e,r,s=f.clean(),h=c.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&s){if((n=(e=h[0]).length-1)>0){for(l||(i.polygonStart(),l=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter(bA))}return h}}function bA(t){return t.length>1}function wA(t,n){return((t=t.x)[0]<0?t[1]-yk-pk:yk-t[1])-((n=n.x)[0]<0?n[1]-yk-pk:yk-n[1])}aA.invert=aA;var xA=yA((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?vk:-vk,s=kk(o-e);kk(s-vk)<pk?(t.point(e,r=(r+a)/2>0?yk:-yk),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&s>=vk&&(kk(e-i)<pk&&(e-=i*pk),kk(o-u)<pk&&(o-=u*pk),r=function(t,n,e,r){var i,o,a=Ok(t-e);return kk(a)>pk?Mk((Ok(n)*(o=Dk(r))*Ok(e)-Ok(r)*(i=Dk(n))*Ok(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)r.point(-vk,i=e*yk),r.point(0,i),r.point(vk,i),r.point(vk,0),r.point(vk,-i),r.point(0,-i),r.point(-vk,-i),r.point(-vk,0),r.point(-vk,i);else if(kk(t[0]-n[0])>pk){var o=t[0]<n[0]?vk:-vk;r.point(-o,i=e*o/2),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}),[-vk,-yk]);var $A=1e9,kA=-1e9;function MA(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var f=0,l=0;if(null==i||(f=a(i,u))!==(l=a(o,u))||s(i,o)<0^u>0)do{c.point(0===f||3===f?t:e,f>1?r:n)}while((f=(f+u+4)%4)!==l);else c.point(o[0],o[1])}function a(r,i){return kk(r[0]-t)<pk?i>0?0:3:kk(r[0]-e)<pk?i>0?2:1:kk(r[1]-n)<pk?i>0?1:0:i>0?3:2}function u(t,n){return s(t.x,n.x)}function s(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var s,c,f,l,h,d,m,p,g,v,y,b=a,w=hA(),x={point:$,lineStart:function(){x.point=k,c&&c.push(f=[]),v=!0,g=!1,m=p=NaN},lineEnd:function(){s&&(k(l,h),d&&g&&w.rejoin(),s.push(w.result())),x.point=$,g&&b.lineEnd()},polygonStart:function(){b=w,s=[],c=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],s=1,f=u.length,l=u[0],h=l[0],d=l[1];s<f;++s)o=h,a=d,h=(l=u[s])[0],d=l[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++n:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--n;return n}(),e=y&&n,i=(s=Sn(s)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&pA(s,u,n,o,a),a.polygonEnd()),b=a,s=c=f=null}};function $(t,n){i(t,n)&&b.point(t,n)}function k(o,a){var u=i(o,a);if(c&&f.push([o,a]),v)l=o,h=a,d=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[m=Math.max(kA,Math.min($A,m)),p=Math.max(kA,Math.min($A,p))],w=[o=Math.max(kA,Math.min($A,o)),a=Math.max(kA,Math.min($A,a))];!function(t,n,e,r,i,o){var a,u=t[0],s=t[1],c=0,f=1,l=n[0]-u,h=n[1]-s;if(a=e-u,l||!(a>0)){if(a/=l,l<0){if(a<c)return;a<f&&(f=a)}else if(l>0){if(a>f)return;a>c&&(c=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>f)return;a>c&&(c=a)}else if(l>0){if(a<c)return;a<f&&(f=a)}if(a=r-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}return c>0&&(t[0]=u+c*l,t[1]=s+c*h),f<1&&(n[0]=u+f*l,n[1]=s+f*h),!0}}}}}(s,w,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(w[0],w[1]),u||b.lineEnd(),y=!1)}m=o,p=a,g=u}return x}}function AA(t,n,e){var r=Fn(t,n-pk,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function DA(t,n,e){var r=Fn(t,n-pk,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}var SA,FA,EA,NA,CA=t=>t,OA=new on,_A=new on,zA={point:jk,lineStart:jk,lineEnd:jk,polygonStart:function(){zA.lineStart=BA,zA.lineEnd=jA},polygonEnd:function(){zA.lineStart=zA.lineEnd=zA.point=jk,OA.add(kk(_A)),_A=new on},result:function(){var t=OA/2;return OA=new on,t}};function BA(){zA.point=TA}function TA(t,n){zA.point=PA,SA=EA=t,FA=NA=n}function PA(t,n){_A.add(NA*t-EA*n),EA=t,NA=n}function jA(){PA(SA,FA)}var RA,LA,IA,qA,UA=1/0,WA=UA,HA=-UA,GA=HA,YA={point:function(t,n){t<UA&&(UA=t),t>HA&&(HA=t),n<WA&&(WA=n),n>GA&&(GA=n)},lineStart:jk,lineEnd:jk,polygonStart:jk,polygonEnd:jk,result:function(){var t=[[UA,WA],[HA,GA]];return HA=GA=-(WA=UA=1/0),t}},VA=0,XA=0,JA=0,KA=0,QA=0,ZA=0,tD=0,nD=0,eD=0,rD={point:iD,lineStart:oD,lineEnd:sD,polygonStart:function(){rD.lineStart=cD,rD.lineEnd=fD},polygonEnd:function(){rD.point=iD,rD.lineStart=oD,rD.lineEnd=sD},result:function(){var t=eD?[tD/eD,nD/eD]:ZA?[KA/ZA,QA/ZA]:JA?[VA/JA,XA/JA]:[NaN,NaN];return VA=XA=JA=KA=QA=ZA=tD=nD=eD=0,t}};function iD(t,n){VA+=t,XA+=n,++JA}function oD(){rD.point=aD}function aD(t,n){rD.point=uD,iD(IA=t,qA=n)}function uD(t,n){var e=t-IA,r=n-qA,i=zk(e*e+r*r);KA+=i*(IA+t)/2,QA+=i*(qA+n)/2,ZA+=i,iD(IA=t,qA=n)}function sD(){rD.point=iD}function cD(){rD.point=lD}function fD(){hD(RA,LA)}function lD(t,n){rD.point=hD,iD(RA=IA=t,LA=qA=n)}function hD(t,n){var e=t-IA,r=n-qA,i=zk(e*e+r*r);KA+=i*(IA+t)/2,QA+=i*(qA+n)/2,ZA+=i,tD+=(i=qA*t-IA*n)*(IA+t),nD+=i*(qA+n),eD+=3*i,iD(IA=t,qA=n)}function dD(t){this._context=t}dD.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,wk)}},result:jk};var mD,pD,gD,vD,yD,bD=new on,wD={point:jk,lineStart:function(){wD.point=xD},lineEnd:function(){mD&&$D(pD,gD),wD.point=jk},polygonStart:function(){mD=!0},polygonEnd:function(){mD=null},result:function(){var t=+bD;return bD=new on,t}};function xD(t,n){wD.point=$D,pD=vD=t,gD=yD=n}function $D(t,n){bD.add(zk((vD-=t)*vD+(yD-=n)*yD)),vD=t,yD=n}let kD,MD,AD,DD;class SD{constructor(t){this._append=null==t?FD:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return FD;if(n!==kD){const t=10**n;kD=n,MD=function(n){let e=1;this._+=n[0];for(const r=n.length;e<r;++e)this._+=Math.round(arguments[e]*t)/t+n[e]}}return MD}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==AD||this._append!==MD){const t=this._radius,n=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,AD=t,MD=this._append,DD=this._,this._=n}this._+=DD}}result(){const t=this._;return this._="",t.length?t:null}}function FD(t){let n=1;this._+=t[0];for(const e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function ED(t,n){let e,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Wk(t,e(r))),r.result()}return a.area=function(t){return Wk(t,e(zA)),zA.result()},a.measure=function(t){return Wk(t,e(wD)),wD.result()},a.bounds=function(t){return Wk(t,e(YA)),YA.result()},a.centroid=function(t){return Wk(t,e(rD)),rD.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,CA):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new SD(i)):new dD(n=t),"function"!=typeof o&&r.pointRadius(o),a):n},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return null===n&&(r=new SD(i)),a},a.projection(t).digits(i).context(n)}function ND(t){return function(n){var e=new CD;for(var r in t)e[r]=t[r];return e.stream=n,e}}function CD(){}function OD(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Wk(e,t.stream(YA)),n(YA.result()),null!=r&&t.clipExtent(r),t}function _D(t,n,e){return OD(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])}),e)}function zD(t,n,e){return _D(t,[[0,0],n],e)}function BD(t,n,e){return OD(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])}),e)}function TD(t,n,e){return OD(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])}),e)}CD.prototype={constructor:CD,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var PD=Dk(30*$k);function jD(t,n){return+n?function(t,n){function e(r,i,o,a,u,s,c,f,l,h,d,m,p,g){var v=c-r,y=f-i,b=v*v+y*y;if(b>4*n&&p--){var w=a+h,x=u+d,$=s+m,k=zk(w*w+x*x+$*$),M=Pk($/=k),A=kk(kk($)-1)<pk||kk(o-l)<pk?(o+l)/2:Ak(x,w),D=t(A,M),S=D[0],F=D[1],E=S-r,N=F-i,C=y*E-v*N;(C*C/b>n||kk((v*E+y*N)/b-.5)>.3||a*h+u*d+s*m<PD)&&(e(r,i,o,a,u,s,S,F,A,w/=k,x/=k,$,p,g),g.point(S,F),e(S,F,A,w,x,$,c,f,l,h,d,m,p,g))}}return function(n){var r,i,o,a,u,s,c,f,l,h,d,m,p={point:g,lineStart:v,lineEnd:b,polygonStart:function(){n.polygonStart(),p.lineStart=w},polygonEnd:function(){n.polygonEnd(),p.lineStart=v}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){f=NaN,p.point=y,n.lineStart()}function y(r,i){var o=pM([r,i]),a=t(r,i);e(f,l,c,h,d,m,f=a[0],l=a[1],c=r,h=o[0],d=o[1],m=o[2],16,n),n.point(f,l)}function b(){p.point=g,n.lineEnd()}function w(){v(),p.point=x,p.lineEnd=$}function x(t,n){y(r=t,n),i=f,o=l,a=h,u=d,s=m,p.point=y}function $(){e(f,l,c,h,d,m,i,o,r,a,u,s,16,n),p.lineEnd=b,b()}return p}}(t,n):function(t){return ND({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var RD=ND({point:function(t,n){this.stream.point(t*$k,n*$k)}});function LD(t,n,e,r,i,o){if(!o)return function(t,n,e,r,i){function o(o,a){return[n+t*(o*=r),e-t*(a*=i)]}return o.invert=function(o,a){return[(o-n)/t*r,(e-a)/t*i]},o}(t,n,e,r,i);var a=Dk(o),u=Ok(o),s=a*t,c=u*t,f=a/t,l=u/t,h=(u*e-a*n)/t,d=(u*n+a*e)/t;function m(t,o){return[s*(t*=r)-c*(o*=i)+n,e-c*t-s*o]}return m.invert=function(t,n){return[r*(f*t-l*n+h),i*(d-l*t-f*n)]},m}function ID(t){return qD((function(){return t}))()}function qD(t){var n,e,r,i,o,a,u,s,c,f,l=150,h=480,d=250,m=0,p=0,g=0,v=0,y=0,b=0,w=1,x=1,$=null,k=xA,M=null,A=CA,D=.5;function S(t){return s(t[0]*$k,t[1]*$k)}function F(t){return(t=s.invert(t[0],t[1]))&&[t[0]*xk,t[1]*xk]}function E(){var t=LD(l,0,0,w,x,b).apply(null,n(m,p)),r=LD(l,h-t[0],d-t[1],w,x,b);return e=uA(g,v,y),u=oA(n,r),s=oA(e,u),a=jD(u,D),N()}function N(){return c=f=null,S}return S.stream=function(t){return c&&f===t?c:c=RD(function(t){return ND({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(k(a(A(f=t)))))},S.preclip=function(t){return arguments.length?(k=t,$=void 0,N()):k},S.postclip=function(t){return arguments.length?(A=t,M=r=i=o=null,N()):A},S.clipAngle=function(t){return arguments.length?(k=+t?function(t){var n=Dk(t),e=2*$k,r=n>0,i=kk(n)>pk;function o(t,e){return Dk(t)*Dk(e)>n}function a(t,e,r){var i=[1,0,0],o=vM(pM(t),pM(e)),a=gM(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var c=n*a/s,f=-n*u/s,l=vM(i,o),h=bM(i,c);yM(h,bM(o,f));var d=l,m=gM(h,d),p=gM(d,d),g=m*m-p*(gM(h,h)-1);if(!(g<0)){var v=zk(g),y=bM(d,(-m-v)/p);if(yM(y,h),y=mM(y),!r)return y;var b,w=t[0],x=e[0],$=t[1],k=e[1];x<w&&(b=w,w=x,x=b);var M=x-w,A=kk(M-vk)<pk;if(!A&&k<$&&(b=$,$=k,k=b),A||M<pk?A?$+k>0^y[1]<(kk(y[0]-w)<pk?$:k):$<=y[1]&&y[1]<=k:M>vk^(w<=y[0]&&y[0]<=x)){var D=bM(d,(-m+v)/p);return yM(D,h),[y,mM(D)]}}}function u(n,e){var i=r?t:vk-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return yA(o,(function(t){var n,e,s,c,f;return{lineStart:function(){c=s=!1,f=1},point:function(l,h){var d,m=[l,h],p=o(l,h),g=r?p?0:u(l,h):p?u(l+(l<0?vk:-vk),h):0;if(!n&&(c=s=p)&&t.lineStart(),p!==s&&(!(d=a(n,m))||dA(n,d)||dA(m,d))&&(m[2]=1),p!==s)f=0,p?(t.lineStart(),d=a(m,n),t.point(d[0],d[1])):(d=a(n,m),t.point(d[0],d[1],2),t.lineEnd()),n=d;else if(i&&n&&r^p){var v;g&e||!(v=a(m,n,!0))||(f=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!p||n&&dA(n,m)||t.point(m[0],m[1]),n=m,s=p,e=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return f|(c&&s)<<1}}}),(function(n,r,i,o){!function(t,n,e,r,i,o){if(e){var a=Dk(n),u=Ok(n),s=r*e;null==i?(i=n+r*wk,o=n-s/2):(i=lA(a,i),o=lA(a,o),(r>0?i<o:i>o)&&(i+=r*wk));for(var c,f=i;r>0?f>o:f<o;f-=s)c=mM([a,-u*Dk(f),-u*Ok(f)]),t.point(c[0],c[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-vk,t-vk])}($=t*$k):($=null,xA),N()):$*xk},S.clipExtent=function(t){return arguments.length?(A=null==t?(M=r=i=o=null,CA):MA(M=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),N()):null==M?null:[[M,r],[i,o]]},S.scale=function(t){return arguments.length?(l=+t,E()):l},S.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],E()):[h,d]},S.center=function(t){return arguments.length?(m=t[0]%360*$k,p=t[1]%360*$k,E()):[m*xk,p*xk]},S.rotate=function(t){return arguments.length?(g=t[0]%360*$k,v=t[1]%360*$k,y=t.length>2?t[2]%360*$k:0,E()):[g*xk,v*xk,y*xk]},S.angle=function(t){return arguments.length?(b=t%360*$k,E()):b*xk},S.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},S.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},S.precision=function(t){return arguments.length?(a=jD(u,D=t*t),N()):zk(D)},S.fitExtent=function(t,n){return _D(S,t,n)},S.fitSize=function(t,n){return zD(S,t,n)},S.fitWidth=function(t,n){return BD(S,t,n)},S.fitHeight=function(t,n){return TD(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&F,E()}}function UD(t){var n=0,e=vk/3,r=qD(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*$k,e=t[1]*$k):[n*xk,e*xk]},i}function WD(t,n){var e=Ok(t),r=(e+Ok(n))/2;if(kk(r)<pk)return function(t){var n=Dk(t);function e(t,e){return[t*n,Ok(e)/n]}return e.invert=function(t,e){return[t/n,Pk(e*n)]},e}(t);var i=1+e*(2*r-e),o=zk(i)/r;function a(t,n){var e=zk(i-2*r*Ok(n))/r;return[e*Ok(t*=r),o-e*Dk(t)]}return a.invert=function(t,n){var e=o-n,a=Ak(t,kk(e))*_k(e);return e*r<0&&(a-=vk*_k(t)*_k(e)),[a/r,Pk((i-(t*t+e*e)*r*r)/(2*r))]},a}function HD(){return UD(WD).scale(155.424).center([0,33.6442])}function GD(){return HD().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function YD(t){return function(n,e){var r=Dk(n),i=Dk(e),o=t(r*i);return o===1/0?[2,0]:[o*i*Ok(n),o*Ok(e)]}}function VD(t){return function(n,e){var r=zk(n*n+e*e),i=t(r),o=Ok(i),a=Dk(i);return[Ak(n*o,r*a),Pk(r&&e*o/r)]}}var XD=YD((function(t){return zk(2/(1+t))}));XD.invert=VD((function(t){return 2*Pk(t/2)}));var JD=YD((function(t){return(t=Tk(t))&&t/Ok(t)}));function KD(t,n){return[t,Nk(Bk((yk+n)/2))]}function QD(t){var n,e,r,i=ID(t),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,c=null;function f(){var o=vk*a(),u=i(function(t){function n(n){return(n=t(n[0]*$k,n[1]*$k))[0]*=xk,n[1]*=xk,n}return t=uA(t[0]*$k,t[1]*$k,t.length>2?t[2]*$k:0),n.invert=function(n){return(n=t.invert(n[0]*$k,n[1]*$k))[0]*=xk,n[1]*=xk,n},n}(i.rotate()).invert([0,0]));return s(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===KD?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),f()):a()},i.translate=function(t){return arguments.length?(u(t),f()):u()},i.center=function(t){return arguments.length?(o(t),f()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),f()):null==c?null:[[c,n],[e,r]]},f()}function ZD(t){return Bk((yk+t)/2)}function tS(t,n){var e=Dk(t),r=t===n?Ok(t):Nk(e/Dk(n))/Nk(ZD(n)/ZD(t)),i=e*Ck(ZD(t),r)/r;if(!r)return KD;function o(t,n){i>0?n<-yk+pk&&(n=-yk+pk):n>yk-pk&&(n=yk-pk);var e=i/Ck(ZD(n),r);return[e*Ok(r*t),i-e*Dk(r*t)]}return o.invert=function(t,n){var e=i-n,o=_k(r)*zk(t*t+e*e),a=Ak(t,kk(e))*_k(e);return e*r<0&&(a-=vk*_k(t)*_k(e)),[a/r,2*Mk(Ck(i/o,1/r))-yk]},o}function nS(t,n){return[t,n]}function eS(t,n){var e=Dk(t),r=t===n?Ok(t):(e-Dk(n))/(n-t),i=e/r+t;if(kk(r)<pk)return nS;function o(t,n){var e=i-n,o=r*t;return[e*Ok(o),i-e*Dk(o)]}return o.invert=function(t,n){var e=i-n,o=Ak(t,kk(e))*_k(e);return e*r<0&&(o-=vk*_k(t)*_k(e)),[o/r,i-_k(r)*zk(t*t+e*e)]},o}JD.invert=VD((function(t){return t})),KD.invert=function(t,n){return[t,2*Mk(Fk(n))-yk]},nS.invert=nS;var rS=1.340264,iS=-.081106,oS=893e-6,aS=.003796,uS=zk(3)/2;function sS(t,n){var e=Pk(uS*Ok(n)),r=e*e,i=r*r*r;return[t*Dk(e)/(uS*(rS+3*iS*r+i*(7*oS+9*aS*r))),e*(rS+iS*r+i*(oS+aS*r))]}function cS(t,n){var e=Dk(n),r=Dk(t)*e;return[e*Ok(t)/r,Ok(n)/r]}function fS(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function lS(t,n){return[Dk(n)*Ok(t),Ok(n)]}function hS(t,n){var e=Dk(n),r=1+Dk(t)*e;return[e*Ok(t)/r,Ok(n)/r]}function dS(t,n){return[Nk(Bk((yk+n)/2)),-t]}sS.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(rS+iS*i+o*(oS+aS*i))-n)/(rS+3*iS*i+o*(7*oS+9*aS*i)))*r)*i*i,!(kk(e)<gk));++a);return[uS*t*(rS+3*iS*i+o*(7*oS+9*aS*i))/Dk(r),Pk(Ok(r)/uS)]},cS.invert=VD(Mk),fS.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(kk(e)>pk&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},lS.invert=VD(Pk),hS.invert=VD((function(t){return 2*Mk(t)})),dS.invert=function(t,n){return[-n,2*Mk(Fk(t))-yk]};var mS=Math.abs,pS=Math.cos,gS=Math.sin,vS=Math.PI,yS=vS/2,bS=Math.sqrt(2);function wS(t){return t>1?yS:t<-1?-yS:Math.asin(t)}function xS(t,n){var e,r=t*gS(n),i=30;do{n-=e=(n+gS(n)-r)/(1+pS(n))}while(mS(e)>1e-6&&--i>0);return n/2}var $S=function(t,n,e){function r(r,i){return[t*r*pS(i=xS(e,i)),n*gS(i)]}return r.invert=function(r,i){return i=wS(i/n),[r/(t*pS(i)),wS((2*i+gS(2*i))/e)]},r}(bS/yS,bS,vS);const kS=ED(),MS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function AS(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(SS[t]=function(t,n){return function e(){const r=n();return r.type=t,r.path=ED().projection(r),r.copy=r.copy||function(){const t=e();return MS.forEach((n=>{r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},tg(r)}}(t,n),this):SS[t]||null}function DS(t){return t&&t.path||kS}const SS={albers:GD,albersusa:function(){var t,n,e,r,i,o,a=GD(),u=HD().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=HD().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function f(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function l(){return t=n=null,f}return f.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},f.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},f.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),s.precision(t),l()):a.precision()},f.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),s.scale(t),f.translate(a.translate())):a.scale()},f.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],f=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,f-.238*n],[o+.455*n,f+.238*n]]).stream(c),r=u.translate([o-.307*n,f+.201*n]).clipExtent([[o-.425*n+pk,f+.12*n+pk],[o-.214*n-pk,f+.234*n-pk]]).stream(c),i=s.translate([o-.205*n,f+.212*n]).clipExtent([[o-.214*n+pk,f+.166*n+pk],[o-.115*n-pk,f+.234*n-pk]]).stream(c),l()},f.fitExtent=function(t,n){return _D(f,t,n)},f.fitSize=function(t,n){return zD(f,t,n)},f.fitWidth=function(t,n){return BD(f,t,n)},f.fitHeight=function(t,n){return TD(f,t,n)},f.scale(1070)},azimuthalequalarea:function(){return ID(XD).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return ID(JD).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return UD(tS).scale(109.5).parallels([30,30])},conicequalarea:HD,conicequidistant:function(){return UD(eS).scale(131.154).center([0,13.9389])},equalEarth:function(){return ID(sS).scale(177.158)},equirectangular:function(){return ID(nS).scale(152.63)},gnomonic:function(){return ID(cS).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,o,a,u=1,s=0,c=0,f=1,l=1,h=0,d=null,m=1,p=1,g=ND({point:function(t,n){var e=b([t,n]);this.stream.point(e[0],e[1])}}),v=CA;function y(){return m=u*f,p=u*l,o=a=null,b}function b(e){var r=e[0]*m,i=e[1]*p;if(h){var o=i*t-r*n;r=r*t+i*n,i=o}return[r+s,i+c]}return b.invert=function(e){var r=e[0]-s,i=e[1]-c;if(h){var o=i*t+r*n;r=r*t-i*n,i=o}return[r/m,i/p]},b.stream=function(t){return o&&a===t?o:o=g(v(a=t))},b.postclip=function(t){return arguments.length?(v=t,d=e=r=i=null,y()):v},b.clipExtent=function(t){return arguments.length?(v=null==t?(d=e=r=i=null,CA):MA(d=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),y()):null==d?null:[[d,e],[r,i]]},b.scale=function(t){return arguments.length?(u=+t,y()):u},b.translate=function(t){return arguments.length?(s=+t[0],c=+t[1],y()):[s,c]},b.angle=function(e){return arguments.length?(n=Ok(h=e%360*$k),t=Dk(h),y()):h*xk},b.reflectX=function(t){return arguments.length?(f=t?-1:1,y()):f<0},b.reflectY=function(t){return arguments.length?(l=t?-1:1,y()):l<0},b.fitExtent=function(t,n){return _D(b,t,n)},b.fitSize=function(t,n){return zD(b,t,n)},b.fitWidth=function(t,n){return BD(b,t,n)},b.fitHeight=function(t,n){return TD(b,t,n)},b},mercator:function(){return QD(KD).scale(961/wk)},mollweide:function(){return ID($S).scale(169.529)},naturalEarth1:function(){return ID(fS).scale(175.295)},orthographic:function(){return ID(lS).scale(249.5).clipAngle(90.000001)},stereographic:function(){return ID(hS).scale(250).clipAngle(142)},transversemercator:function(){var t=QD(dS),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in SS)AS(t,SS[t]);function FS(){}const ES=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function NS(){var t=1,n=1,e=a;function r(t,n){return n.map((n=>i(t,n)))}function i(r,i){var a=[],u=[];return function(e,r,i){var a,u,s,c,f,l=[],h=[];for(a=u=-1,ES[(s=e[0]>=r)<<1].forEach(d);++a<t-1;)ES[s|(s=e[a+1]>=r)<<1].forEach(d);for(ES[0|s].forEach(d);++u<n-1;){for(a=-1,ES[(s=e[u*t+t]>=r)<<1|(c=e[u*t]>=r)<<2].forEach(d);++a<t-1;)f=c,ES[s|(s=e[u*t+t+a+1]>=r)<<1|(c=e[u*t+a+1]>=r)<<2|f<<3].forEach(d);ES[s|c<<3].forEach(d)}for(a=-1,ES[(c=e[u*t]>=r)<<2].forEach(d);++a<t-1;)f=c,ES[(c=e[u*t+a+1]>=r)<<2|f<<3].forEach(d);function d(t){var n,e,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],c=o(r),f=o(s);(n=h[c])?(e=l[f])?(delete h[n.end],delete l[e.start],n===e?(n.ring.push(s),i(n.ring)):l[n.start]=h[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[n.end],n.ring.push(s),h[n.end=f]=n):(n=l[f])?(e=h[c])?(delete l[n.start],delete h[e.end],n===e?(n.ring.push(s),i(n.ring)):l[e.start]=h[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete l[n.start],n.ring.unshift(r),l[n.start=c]=n):l[c]=h[f]={start:c,end:f,ring:[r,s]}}ES[c<<3].forEach(d)}(r,i,(t=>{e(t,r,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var n,e=0,r=a.length;e<r;++e)if(-1!==CS((n=a[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(n){return 2*n[0]+n[1]*(t+1)*4}function a(e,r,i){e.forEach((e=>{var o,a=e[0],u=e[1],s=0|a,c=0|u,f=r[c*t+s];a>0&&a<t&&s===a&&(e[0]=a+(i-(o=r[c*t+s-1]))/(f-o)-.5),u>0&&u<n&&c===u&&(e[1]=u+(i-(o=r[(c-1)*t+s]))/(f-o)-.5)}))}return r.contour=i,r.size=function(e){if(!arguments.length)return[t,n];var i=Math.floor(e[0]),o=Math.floor(e[1]);return i>=0&&o>=0||p("invalid size"),t=i,n=o,r},r.smooth=function(t){return arguments.length?(e=t?a:FS,r):e===a},r}function CS(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=OS(t,n[r]))return e;return 0}function OS(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var s=t[o],c=s[0],f=s[1],l=t[u],h=l[0],d=l[1];if(_S(s,l,n))return 0;f>r!=d>r&&e<(h-c)*(r-f)/(d-f)+c&&(i=-i)}return i}function _S(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=n[r],i<=(o=e[r])&&o<=a||a<=o&&o<=i)}function zS(t,n,e){return function(r){var i=st(r),o=e?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=n?bn(o,a,t):u/(t+1);return Fn(o+s,a,s)}}function BS(t){_a.call(this,null,t)}function TS(t,n,e,r,i){const o=t.x1||0,a=t.y1||0,u=n*e<0;function s(t){t.forEach(c)}function c(t){u&&t.reverse(),t.forEach(f)}function f(t){t[0]=(t[0]-o)*n+r,t[1]=(t[1]-a)*e+i}return function(t){return t.coordinates.forEach(s),t}}function PS(t,n,e){const r=t>=0?t:La(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function jS(t){return Z(t)?t:ot(+t)}function RS(){var t=t=>t[0],n=t=>t[1],e=x,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const c=PS(r[0],u,t)>>a,f=PS(r[1],u,n)>>a,l=c?c+2:0,h=f?f+2:0,d=2*l+(i>>a),m=2*h+(o>>a),p=new Float32Array(d*m),g=new Float32Array(d*m);let v=p;u.forEach((r=>{const i=l+(+t(r)>>a),o=h+(+n(r)>>a);i>=0&&i<d&&o>=0&&o<m&&(p[i+o*d]+=+e(r))})),c>0&&f>0?(LS(d,m,p,g,c),IS(d,m,g,p,f),LS(d,m,p,g,c),IS(d,m,g,p,f),LS(d,m,p,g,c),IS(d,m,g,p,f)):c>0?(LS(d,m,p,g,c),LS(d,m,g,p,c),LS(d,m,p,g,c),v=g):f>0&&(IS(d,m,p,g,f),IS(d,m,g,p,f),IS(d,m,p,g,f),v=g);const y=s?Math.pow(2,-2*a):1/En(v);for(let t=0,n=d*m;t<n;++t)v[t]*=y;return{values:v,scale:1<<a,width:d,height:m,x1:l,y1:h,x2:l+(i>>a),y2:h+(o>>a)}}return u.x=function(n){return arguments.length?(t=jS(n),u):t},u.y=function(t){return arguments.length?(n=jS(t),u):n},u.weight=function(t){return arguments.length?(e=jS(t),u):e},u.size=function(t){if(!arguments.length)return[i,o];var n=+t[0],e=+t[1];return n>=0&&e>=0||p("invalid size"),i=n,o=e,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||p("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=K(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&p("invalid bandwidth"),r=t,u):r},u}function LS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<n;++a)for(let n=0,u=0;n<t+i;++n)n<t&&(u+=e[n+a*t]),n>=i&&(n>=o&&(u-=e[n-o+a*t]),r[n-i+a*t]=u/Math.min(n+1,t-1+o-n,o))}function IS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let u=0,s=0;u<n+i;++u)u<n&&(s+=e[a+u*t]),u>=i&&(u>=o&&(s-=e[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,n-1+o-u,o))}function qS(t){_a.call(this,null,t)}BS.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},mt(BS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||b,o=NS().smooth(!1!==t.smooth),a=t.thresholds||function(t,n,e){const r=zS(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map((t=>wn(n(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((n=>{const e=i(n),r=o.size([e.width,e.height])(e.values,D(a)?a:a(e.values));!function(t,n,e,r){let i=r.scale||n.scale,o=r.translate||n.translate;if(Z(i)&&(i=i(e,r)),Z(o)&&(o=o(e,r)),(1===i||null==i)&&!o)return;const a=(bt(i)?i:i[0])||1,u=(bt(i)?i:i[1])||1;t.forEach(TS(n,a,u,o&&o[0]||0,o&&o[1]||0))}(r,e,n,t),r.forEach((t=>{s.push(oa(n,ra(null!=u?{[u]:t}:t)))}))})),this.value&&(e.rem=this.value),this.value=e.source=e.add=s,e}}),qS.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const US=["x","y","weight","size","cellSize","bandwidth"];function WS(t,n){return US.forEach((e=>null!=n[e]?t[e](n[e]):0)),t}function HS(t){_a.call(this,null,t)}mt(qS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(t,n){var e,r,i,o,a,u,s=[],c=t=>t(o);if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}(n.materialize(n.SOURCE).source,t.groupby),o=(t.groupby||[]).map(f),a=WS(RS(),t),u=t.as||"grid";return e=i.map((n=>ra(function(t,n){for(let e=0;e<o.length;++e)t[o[e]]=n[e];return t}({[u]:a(n,t.counts)},n.dims)))),this.value&&(r.rem=this.value),this.value=r.source=r.add=e,r}}),HS.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},mt(HS,_a,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=NS().smooth(!1!==t.smooth),a=t.values,u=t.thresholds||zS(t.count||10,t.nice,!!a),s=t.size;return a||(a=n.materialize(n.SOURCE).source,r=TS(e=WS(RS(),t)(a,!0),e.scale||1,e.scale||1,0,0),s=[e.width,e.height],a=e.values),u=D(u)?u:u(a),a=o.size(s)(a,u),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(ra),i}});const GS="Feature",YS="FeatureCollection";function VS(t){_a.call(this,null,t)}function XS(t){_a.call(this,null,t)}function JS(t){_a.call(this,null,t)}function KS(t){_a.call(this,null,t)}function QS(t){_a.call(this,[],t),this.generator=function(){var t,n,e,r,i,o,a,u,s,c,f,l,h=10,d=h,m=90,p=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return Fn(Sk(r/m)*m,e,m).map(f).concat(Fn(Sk(u/p)*p,a,p).map(l)).concat(Fn(Sk(n/h)*h,t,h).filter((function(t){return kk(t%m)>pk})).map(s)).concat(Fn(Sk(o/d)*d,i,d).filter((function(t){return kk(t%p)>pk})).map(c))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[f(r).concat(l(a).slice(1),f(e).reverse().slice(1),l(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(u=+t[0][1],a=+t[1][1],(r=+t[0][0])>(e=+t[1][0])&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(g)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(o=+e[0][1],i=+e[1][1],(n=+e[0][0])>(t=+e[1][0])&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(g)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(m=+t[0],p=+t[1],v):[m,p]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(g=+h,s=AA(o,i,90),c=DA(n,t,g),f=AA(u,a,90),l=DA(r,e,g),v):g},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function ZS(t){_a.call(this,null,t)}function tF(t){if(!Z(t))return!1;const n=zt(l(t));return n.$x||n.$y||n.$value||n.$max}function nF(t){_a.call(this,null,t),this.modified(!0)}function eF(t,n,e){Z(t[n])&&t[n](e)}VS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},mt(VS,_a,{transform(t,n){var e,r=this._features,i=this._points,o=t.fields,a=o&&o[0],u=o&&o[1],s=t.geojson||!o&&b,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(l(s))||a&&n.modified(l(a))||u&&n.modified(l(u)),this.value&&!e||(c=n.SOURCE,this._features=r=[],this._points=i=[]),s&&n.visit(c,(t=>r.push(s(t)))),a&&u&&(n.visit(c,(t=>{var n=a(t),e=u(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&i.push([n,e])})),r=r.concat({type:GS,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:YS,features:r}}}),XS.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},mt(XS,_a,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||b,o=t.as||"path",a=e.SOURCE;!r||t.modified()?(this.value=r=DS(t.projection),e.materialize().reflow()):a=i===b||n.modified(i.fields)?e.ADD_MOD:e.ADD;const u=function(t,n){const e=t.pointRadius();return t.context(null),null!=n&&t.pointRadius(n),e}(r,t.pointRadius);return e.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),e.modifies(o)}}),JS.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},mt(JS,_a,{transform(t,n){var e,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function c(t){const n=r([i(t),o(t)]);n?(t[u]=n[0],t[s]=n[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,c):(e=n.modified(i.fields)||n.modified(o.fields),n.visit(e?n.ADD_MOD:n.ADD,c)),n.modifies(a)}}),KS.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},mt(KS,_a,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",o=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){const r=null==e?e=>t(n(e)):r=>{var i=t.pointRadius(),o=t.pointRadius(e)(n(r));return t.pointRadius(i),o};return r.context=n=>(t.context(n),r),r}(DS(t.projection),t.field||v("datum"),t.pointRadius),e.materialize().reflow(),o=e.SOURCE),e.visit(o,(t=>t[i]=r)),e.modifies(i)}}),QS.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},mt(QS,_a,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const n in t)Z(i[n])&&i[n](t[n]);return e=i(),r.length?n.mod.push(aa(r[0],e)):n.add.push(ra(e)),r[0]=e,n}}),ZS.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},mt(ZS,_a,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||b,o=function(t,n){let e;return Z(t)?(e=e=>t(e,n),e.dep=tF(t)):t?e=ot(t):(e=t=>t.$value/t.$max||0,e.dep=!0),e}(t.opacity,t),a=function(t,n){let e;return Z(t)?(e=e=>Uf(t(e,n)),e.dep=tF(t)):e=ot(Uf(t||"#888")),e}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?wn(e.map((t=>wn(i(t).values)))):0};return e.forEach((t=>{const n=i(t),e=ut({},t,s);r||(e.$max=wn(n.values||[])),t[u]=function(t,n,e,r){const i=t.width,o=t.x1||0,a=t.y1||0,u=t.x2||i,s=t.y2||t.height,c=t.values,f=c?t=>c[t]:w,l=pf(u-o,s-a),h=l.getContext("2d"),d=h.getImageData(0,0,u-o,s-a),m=d.data;for(let t=a,c=0;t<s;++t){n.$y=t-a;for(let a=o,s=t*i;a<u;++a,c+=4){n.$x=a-o,n.$value=f(a+s);const t=e(n);m[c+0]=t.r,m[c+1]=t.g,m[c+2]=t.b,m[c+3]=~~(255*r(n))}}return h.putImageData(d,0,0),l}(n,e,a.dep?a:ot(a(e)),o.dep?o:ot(o(e)))})),n.reflow(!0).modifies(u)}}),mt(nF,_a,{transform(t,n){let e=this.value;return!e||t.modified("type")?(this.value=e=function(t){const n=AS((t||"mercator").toLowerCase());return n||p("Unrecognized projection type: "+t),n()}(t.type),MS.forEach((n=>{null!=t[n]&&eF(e,n,t[n])}))):MS.forEach((n=>{t.modified(n)&&eF(e,n,t[n])})),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){const e=function(t){return 1===(t=K(t)).length?t[0]:{type:YS,features:t.reduce(((t,n)=>t.concat(function(t){return t.type===YS?t.features:K(t).filter((t=>null!=t)).map((t=>t.type===GS?t:{type:GS,geometry:t}))}(n))),[])}}(n.fit);n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});var rF=Object.freeze({__proto__:null,contour:HS,geojson:VS,geopath:XS,geopoint:JS,geoshape:KS,graticule:QS,heatmap:ZS,isocontour:BS,kde2d:qS,projection:nF});function iF(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,s,c,f,l,h,d=t._root,m={data:r},p=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=m,t;for(;d.length;)if((c=n>=(o=(p+v)/2))?p=o:v=o,(f=e>=(a=(g+y)/2))?g=a:y=a,i=d,!(d=d[l=f<<1|c]))return i[l]=m,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===u&&e===s)return m.next=d,i?i[l]=m:t._root=m,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+v)/2))?p=o:v=o,(f=e>=(a=(g+y)/2))?g=a:y=a}while((l=f<<1|c)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[l]=m,t}function oF(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function aF(t){return t[0]}function uF(t){return t[1]}function sF(t,n,e){var r=new cF(null==n?aF:n,null==e?uF:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function cF(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function fF(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var lF=sF.prototype=cF.prototype;function hF(t){return function(){return t}}function dF(t){return 1e-6*(t()-.5)}function mF(t){return t.x+t.vx}function pF(t){return t.y+t.vy}function gF(t){return t.index}function vF(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}lF.copy=function(){var t,n,e=new cF(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=fF(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=fF(n));return e},lF.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return iF(this.cover(n,e),n,e,t)},lF.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,f=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<s&&(s=r),r>f&&(f=r),i<c&&(c=i),i>l&&(l=i));if(s>f||c>l)return this;for(this.cover(s,c).cover(f,l),e=0;e<o;++e)iF(this,a[e],u[e],t[e]);return this},lF.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,s=i-e||1,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=e+s,o=r+s;break;case 1:e=i-s,o=r+s;break;case 2:i=e+s,r=o-s;break;case 3:e=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},lF.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},lF.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},lF.find=function(t,n,e){var r,i,o,a,u,s,c,f=this._x0,l=this._y0,h=this._x1,d=this._y1,m=[],p=this._root;for(p&&m.push(new oF(p,f,l,h,d)),null==e?e=1/0:(f=t-e,l=n-e,h=t+e,d=n+e,e*=e);s=m.pop();)if(!(!(p=s.node)||(i=s.x0)>h||(o=s.y0)>d||(a=s.x1)<f||(u=s.y1)<l))if(p.length){var g=(i+a)/2,v=(o+u)/2;m.push(new oF(p[3],g,v,a,u),new oF(p[2],i,v,g,u),new oF(p[1],g,o,a,v),new oF(p[0],i,o,g,v)),(c=(n>=v)<<1|t>=g)&&(s=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=s)}else{var y=t-+this._x.call(null,p.data),b=n-+this._y.call(null,p.data),w=y*y+b*b;if(w<e){var x=Math.sqrt(e=w);f=t-x,l=n-x,h=t+x,d=n+x,r=p.data}}return r},lF.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,s,c,f,l,h,d=this._root,m=this._x0,p=this._y0,g=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(u=(m+g)/2))?m=u:g=u,(f=a>=(s=(p+v)/2))?p=s:v=s,n=d,!(d=d[l=f<<1|c]))return this;if(!d.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},lF.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},lF.root=function(){return this._root},lF.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},lF.visit=function(t){var n,e,r,i,o,a,u=[],s=this._root;for(s&&u.push(new oF(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&s.length){var c=(r+o)/2,f=(i+a)/2;(e=s[3])&&u.push(new oF(e,c,f,o,a)),(e=s[2])&&u.push(new oF(e,r,f,c,a)),(e=s[1])&&u.push(new oF(e,c,i,o,f)),(e=s[0])&&u.push(new oF(e,r,i,c,f))}return this},lF.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new oF(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,s=n.x1,c=n.y1,f=(a+s)/2,l=(u+c)/2;(o=i[0])&&e.push(new oF(o,a,u,f,l)),(o=i[1])&&e.push(new oF(o,f,u,s,l)),(o=i[2])&&e.push(new oF(o,a,l,f,c)),(o=i[3])&&e.push(new oF(o,f,l,s,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},lF.x=function(t){return arguments.length?(this._x=t,this):this._x},lF.y=function(t){return arguments.length?(this._y=t,this):this._y};var yF={value:()=>{}};function bF(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new wF(r)}function wF(t){this._=t}function xF(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function $F(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=yF,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}wF.prototype=bF.prototype={constructor:wF,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=$F(i[e],t.name,n);else if(null==n)for(e in i)i[e]=$F(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=xF(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new wF(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var kF,MF,AF=0,DF=0,SF=0,FF=0,EF=0,NF=0,CF="object"==typeof performance&&performance.now?performance:Date,OF="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _F(){return EF||(OF(zF),EF=CF.now()+NF)}function zF(){EF=0}function BF(){this._call=this._time=this._next=null}function TF(t,n,e){var r=new BF;return r.restart(t,n,e),r}function PF(){EF=(FF=CF.now())+NF,AF=DF=0;try{!function(){_F(),++AF;for(var t,n=kF;n;)(t=EF-n._time)>=0&&n._call.call(void 0,t),n=n._next;--AF}()}finally{AF=0,function(){for(var t,n,e=kF,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:kF=n);MF=t,RF(r)}(),EF=0}}function jF(){var t=CF.now(),n=t-FF;n>1e3&&(NF-=n,FF=t)}function RF(t){AF||(DF&&(DF=clearTimeout(DF)),t-EF>24?(t<1/0&&(DF=setTimeout(PF,t-CF.now()-NF)),SF&&(SF=clearInterval(SF))):(SF||(FF=CF.now(),SF=setInterval(jF,1e3)),AF=1,OF(PF)))}BF.prototype=TF.prototype={constructor:BF,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?_F():+e)+(null==n?0:+n),this._next||MF===this||(MF?MF._next=this:kF=this,MF=this),this._call=t,this._time=e,RF()},stop:function(){this._call&&(this._call=null,this._time=1/0,RF())}};const LF=4294967296;function IF(t){return t.x}function qF(t){return t.y}var UF=Math.PI*(3-Math.sqrt(5));const WF={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=e[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=s}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,s,c,f,l,h,d=n.length,m=0;m<o;++m)for(a=sF(n,mF,pF).visitAfter(u),t=0;t<d;++t)h=(l=e[(s=n[t]).index])*l,c=s.x+s.vx,f=s.y+s.vy,a.visit(p);function p(t,n,e,o,a){var u=t.data,d=t.r,m=l+d;if(!u)return n>c+m||o<c-m||e>f+m||a<f-m;if(u.index>s.index){var p=c-u.x-u.vx,g=f-u.y-u.vy,v=p*p+g*g;v<m*m&&(0===p&&(v+=(p=dF(r))*p),0===g&&(v+=(g=dF(r))*g),v=(m-(v=Math.sqrt(v)))/v*i,s.vx+=(p*=v)*(m=(d*=d)/(h+d)),s.vy+=(g*=v)*m,u.vx-=p*(m=1-m),u.vy-=g*m)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function s(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)e[(i=n[r]).index]=+t(i,r,n)}}return"function"!=typeof t&&(t=hF(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,s()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),s(),a):t},a},nbody:function(){var t,n,e,r,i,o=hF(-30),a=1,u=1/0,s=.81;function c(e){var i,o=t.length,a=sF(t,IF,qF).visitAfter(l);for(r=e,i=0;i<o;++i)n=t[i],a.visit(h)}function f(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)i[(e=t[n]).index]=+o(e,n,t)}}function l(t){var n,e,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,s+=e,r+=e*n.x,o+=e*n.y);t.x=r/s,t.y=o/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function h(t,o,c,f){if(!t.value)return!0;var l=t.x-n.x,h=t.y-n.y,d=f-o,m=l*l+h*h;if(d*d/s<m)return m<u&&(0===l&&(m+=(l=dF(e))*l),0===h&&(m+=(h=dF(e))*h),m<a&&(m=Math.sqrt(a*m)),n.vx+=l*t.value*r/m,n.vy+=h*t.value*r/m),!0;if(!(t.length||m>=u)){(t.data!==n||t.next)&&(0===l&&(m+=(l=dF(e))*l),0===h&&(m+=(h=dF(e))*h),m<a&&(m=Math.sqrt(a*m)));do{t.data!==n&&(n.vx+=l*(d=i[t.data.index]*r/m),n.vy+=h*d)}while(t=t.next)}}return c.initialize=function(n,r){t=n,e=r,f()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:hF(+t),f(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c},link:function(t){var n,e,r,i,o,a,u=gF,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=hF(30),f=1;function l(r){for(var i=0,u=t.length;i<f;++i)for(var s,c,l,h,d,m,p,g=0;g<u;++g)h=(l=(s=t[g]).target).x+l.vx-(c=s.source).x-c.vx||dF(a),d=l.y+l.vy-c.y-c.vy||dF(a),d*=m=((m=Math.sqrt(h*h+d*d))-e[g])/m*r*n[g],l.vx-=(h*=m)*(p=o[g]),l.vy-=d*p,c.vx+=h*(p=1-p),c.vy+=d*p}function h(){if(r){var a,s,c=r.length,f=t.length,l=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(c);a<f;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=vF(l,s.source)),"object"!=typeof s.target&&(s.target=vF(l,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(f);a<f;++a)o[a]=i[(s=t[a]).source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(f),d(),e=new Array(f),m()}}function d(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+s(t[e],e,t)}function m(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),l.initialize=function(t,n){r=t,a=n,h()},l.links=function(n){return arguments.length?(t=n,h(),l):t},l.id=function(t){return arguments.length?(u=t,l):u},l.iterations=function(t){return arguments.length?(f=+t,l):f},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:hF(+t),d(),l):s},l.distance=function(t){return arguments.length?(c="function"==typeof t?t:hF(+t),m(),l):c},l},x:function(t){var n,e,r,i=hF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=hF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:hF(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),a(),o):t},o},y:function(t){var n,e,r,i=hF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=hF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:hF(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:hF(+n),a(),o):t},o}},HF="forces",GF=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],YF=["static","iterations"],VF=["x","y","vx","vy"];function XF(t){_a.call(this,null,t)}function JF(t,n,e,r){var i,o,a,u,s=K(n.forces);for(i=0,o=GF.length;i<o;++i)(a=GF[i])!==HF&&n.modified(a)&&t[a](n[a]);for(i=0,o=s.length;i<o;++i)u=HF+i,(a=e||n.modified(HF,i)?QF(s[i]):r&&KF(s[i],r)?t.force(u):null)&&t.force(u,a);for(o=t.numForces||0;i<o;++i)t.force(HF+i,null);return t.numForces=s.length,t}function KF(t,n){var e,r;for(e in t)if(Z(r=t[e])&&n.modified(l(r)))return 1;return 0}function QF(t){var n,e;for(e in ft(WF,t.force)||p("Unrecognized force: "+t.force),n=WF[t.force](),t)Z(n[e])&&ZF(n[e],t[e],t);return n}function ZF(t,n,e){t(Z(n)?t=>n(t,e):n)}XF.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:VF}]},mt(XF,_a,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(GF),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&JF(i,t,0,n)):(this.value=i=function(t,n){const e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=TF(l),c=bF("tick","end"),f=function(){let t=1;return()=>(t=(1664525*t+1013904223)%LF)/LF}();function l(){h(),c.call("tick",n),e<r&&(s.stop(),c.call("end",n))}function h(r){var s,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),s=0;s<f;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return n}function d(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(.5+e),o=e*UF;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function m(n){return n.initialize&&n.initialize(t,f),n}return null==t&&(t=[]),d(),n={tick:h,restart:function(){return s.restart(l),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,d(),u.forEach(m),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(f=t,u.forEach(m),n):f},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,m(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,s,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),JF(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(YF)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,s=n.length;u<s;++u)if(t=n[u],t.name===HF&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(VF)}});var tE=Object.freeze({__proto__:null,force:XF});function nE(t,n){return t.parent===n.parent?1:2}function eE(t,n){return t+n.x}function rE(t,n){return Math.max(t,n.y)}function iE(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function oE(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=uE)):void 0===n&&(n=aE);for(var e,r,i,o,a,u=new fE(t),s=[u];e=s.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new fE(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(cE)}function aE(t){return t.children}function uE(t){return Array.isArray(t)?t[1]:null}function sE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function cE(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function fE(t){this.data=t,this.depth=this.height=0,this.parent=null}function lE(t){return null==t?null:hE(t)}function hE(t){if("function"!=typeof t)throw new Error;return t}function dE(){return 0}function mE(t){return function(){return t}}fE.prototype=oE.prototype={constructor:fE,count:function(){return this.eachAfter(iE)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++s,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)r.push(n=n.parent);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return oE(this).eachBefore(sE)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const pE=4294967296;function gE(t,n){var e,r;if(bE(n,t))return[n];for(e=0;e<t.length;++e)if(vE(n,t[e])&&bE(xE(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(vE(xE(t[e],t[r]),n)&&vE(xE(t[e],n),t[r])&&vE(xE(t[r],n),t[e])&&bE($E(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function vE(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function yE(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function bE(t,n){for(var e=0;e<n.length;++e)if(!yE(t,n[e]))return!1;return!0}function wE(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return xE(t[0],t[1]);case 3:return $E(t[0],t[1],t[2])}var n}function xE(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,s=o-e,c=a-r,f=u-i,l=Math.sqrt(s*s+c*c);return{x:(e+o+s/l*f)/2,y:(r+a+c/l*f)/2,r:(l+i+u)/2}}function $E(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,s=n.r,c=e.x,f=e.y,l=e.r,h=r-a,d=r-c,m=i-u,p=i-f,g=s-o,v=l-o,y=r*r+i*i-o*o,b=y-a*a-u*u+s*s,w=y-c*c-f*f+l*l,x=d*m-h*p,$=(m*w-p*b)/(2*x)-r,k=(p*g-m*v)/x,M=(d*b-h*w)/(2*x)-i,A=(h*v-d*g)/x,D=k*k+A*A-1,S=2*(o+$*k+M*A),F=$*$+M*M-o*o,E=-(Math.abs(D)>1e-6?(S+Math.sqrt(S*S-4*D*F))/(2*D):F/S);return{x:r+$+k*E,y:i+M+A*E,r:E}}function kE(t,n,e){var r,i,o,a,u=t.x-n.x,s=t.y-n.y,c=u*u+s*s;c?(i=n.r+e.r,a=t.r+e.r,(i*=i)>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*s,e.y=t.y-r*s+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*s,e.y=n.y+r*s+o*u)):(e.x=n.x+e.r,e.y=n.y)}function ME(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function AE(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function DE(t){this._=t,this.next=null,this.previous=null}function SE(t){return Math.sqrt(t.value)}function FE(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function EE(t,n,e){return function(r){if(i=r.children){var i,o,a,u=i.length,s=t(r)*n||0;if(s)for(o=0;o<u;++o)i[o].r+=s;if(a=function(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,s,c,f,l,h;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(e.x=-(r=t[1]).r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;kE(r,e,i=t[2]),e=new DE(e),r=new DE(r),i=new DE(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(s=3;s<o;++s){kE(e._,r._,i=t[s]),i=new DE(i),c=r.next,f=e.previous,l=r._.r,h=e._.r;do{if(l<=h){if(ME(c._,i._)){e.next=r=c,r.previous=e,--s;continue t}l+=c._.r,c=c.next}else{if(ME(f._,i._)){(e=f).next=r,r.previous=e,--s;continue t}h+=f._.r,f=f.previous}}while(c!==f.next);for(i.previous=e,i.next=r,e.next=r.previous=r=i,a=AE(e);(i=i.next)!==r;)(u=AE(i))<a&&(e=i,a=u);r=e.next}for(e=[r._],i=r;(i=i.next)!==r;)e.push(i._);for(i=function(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i<o;)e=t[i],r&&yE(r,e)?++i:(r=wE(a=gE(a,e)),i=0);return r}(e,n),s=0;s<o;++s)(e=t[s]).x-=i.x,e.y-=i.y;return i.r}(i,e),s)for(o=0;o<u;++o)i[o].r-=s;r.r=a+s}}}function NE(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function CE(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function OE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(r-n)/t.value;++u<s;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var _E={depth:-1},zE={},BE={};function TE(t){return t.id}function PE(t){return t.parentId}function jE(){var t,n=TE,e=PE;function r(r){var i,o,a,u,s,c,f,l,h=Array.from(r),d=n,m=e,p=new Map;if(null!=t){const n=h.map(((n,e)=>function(t){let n=(t=`${t}`).length;return LE(t,n-1)&&!LE(t,n-2)&&(t=t.slice(0,-1)),"/"===t[0]?t:`/${t}`}(t(n,e,r)))),e=n.map(RE),i=new Set(n).add("");for(const t of e)i.has(t)||(i.add(t),n.push(t),e.push(RE(t)),h.push(BE));d=(t,e)=>n[e],m=(t,n)=>e[n]}for(a=0,i=h.length;a<i;++a)c=h[a]=new fE(o=h[a]),null!=(f=d(o,a,r))&&(f+="")&&(l=c.id=f,p.set(l,p.has(l)?zE:c)),null!=(f=m(o,a,r))&&(f+="")&&(c.parent=f);for(a=0;a<i;++a)if(f=(c=h[a]).parent){if(!(s=p.get(f)))throw new Error("missing: "+f);if(s===zE)throw new Error("ambiguous: "+f);s.children?s.children.push(c):s.children=[c],c.parent=s}else{if(u)throw new Error("multiple roots");u=c}if(!u)throw new Error("no root");if(null!=t){for(;u.data===BE&&1===u.children.length;)u=u.children[0],--i;for(let t=h.length-1;t>=0&&(c=h[t]).data===BE;--t)c.data=null}if(u.parent=_E,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(cE),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(n=lE(t),r):n},r.parentId=function(t){return arguments.length?(e=lE(t),r):e},r.path=function(n){return arguments.length?(t=lE(n),r):t},r}function RE(t){let n=t.length;if(n<2)return"";for(;--n>1&&!LE(t,n););return t.slice(0,n)}function LE(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(!(1&e))return!0}return!1}function IE(t,n){return t.parent===n.parent?1:2}function qE(t){var n=t.children;return n?n[0]:t.t}function UE(t){var n=t.children;return n?n[n.length-1]:t.t}function WE(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function HE(t,n,e){return t.a.parent===n.parent?t.a:e}function GE(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function YE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(i-e)/t.value;++u<s;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}GE.prototype=Object.create(fE.prototype);var VE=(1+Math.sqrt(5))/2;function XE(t,n,e,r,i,o){for(var a,u,s,c,f,l,h,d,m,p,g,v=[],y=n.children,b=0,w=0,x=y.length,$=n.value;b<x;){s=i-e,c=o-r;do{f=y[w++].value}while(!f&&w<x);for(l=h=f,g=f*f*(p=Math.max(c/s,s/c)/($*t)),m=Math.max(h/g,g/l);w<x;++w){if(f+=u=y[w].value,u<l&&(l=u),u>h&&(h=u),g=f*f*p,(d=Math.max(h/g,g/l))>m){f-=u;break}m=d}v.push(a={value:f,dice:s<c,children:y.slice(b,w)}),a.dice?OE(a,e,r,i,$?r+=c*f/$:o):YE(a,e,r,$?e+=s*f/$:i,o),$-=f,b=w}return v}var JE=function t(n){function e(t,e,r,i,o){XE(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(VE),KE=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,s,c,f,l=-1,h=a.length,d=t.value;++l<h;){for(s=(u=a[l]).children,c=u.value=0,f=s.length;c<f;++c)u.value+=s[c].value;u.dice?OE(u,e,r,i,d?r+=(o-r)*u.value/d:o):YE(u,e,r,d?e+=(i-e)*u.value/d:i,o),d-=u.value}else t._squarify=a=XE(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(VE);function QE(t,n,e){const r={};return t.each((t=>{const i=t.data;e(i)&&(r[n(i)]=t)})),t.lookup=r,t}function ZE(t){_a.call(this,null,t)}ZE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const tN=t=>t.values;function nN(){const t=[],n={entries:t=>r(e(t,0),0),key:e=>(t.push(e),n)};function e(n,r){if(r>=t.length)return n;const i=n.length,o=t[r++],a={},u={};let s,c,f,l=-1;for(;++l<i;)s=o(c=n[l])+"",(f=a[s])?f.push(c):a[s]=[c];for(s in a)u[s]=e(a[s],r);return u}function r(n,e){if(++e>t.length)return n;const i=[];for(const t in n)i.push({key:t,values:r(n[t],e)});return i}return n}function eN(t){_a.call(this,null,t)}mt(ZE,_a,{transform(t,n){n.source||p("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),o=this.value;return(!o||r||n.changed())&&(o&&o.each((t=>{t.children&&ta(t.data)&&i.rem.push(t.data)})),this.value=o=oE({values:K(t.keys).reduce(((t,n)=>(t.key(n),t)),nN()).entries(i.source)},tN),e&&o.each((t=>{t.children&&(t=ra(t.data),i.add.push(t),i.source.push(t))})),QE(o,na,na)),i.source.root=o,i}});const rN=(t,n)=>t.parent===n.parent?1:2;mt(eN,_a,{transform(t,n){n.source&&n.source.root||p(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(ua(t.sort,(t=>t.data))),function(t,n,e){for(let r,i=0,o=n.length;i<o;++i)r=n[i],r in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?rN:x);try{this.value=e(i)}catch(t){p(t)}return i.each((t=>function(t,n,e){const r=t.data,i=n.length-1;for(let o=0;o<i;++o)r[e[o]]=t[n[o]];r[e[i]]=t.children?t.children.length:0}(t,r,o))),n.reflow(t.modified()).modifies(o).modifies("leaf")}});const iN=["x","y","r","depth","children"];function oN(t){eN.call(this,t)}oN.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:iN.length,default:iN}]},mt(oN,eN,{layout:function(){var t=null,n=1,e=1,r=dE;function i(i){const o=function(){let t=1;return()=>(t=(1664525*t+1013904223)%pE)/pE}();return i.x=n/2,i.y=e/2,t?i.eachBefore(FE(t)).eachAfter(EE(r,.5,o)).eachBefore(NE(1)):i.eachBefore(FE(SE)).eachAfter(EE(dE,1,o)).eachAfter(EE(r,i.r/Math.min(n,e),o)).eachBefore(NE(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=lE(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:mE(+t),i):r},i},params:["radius","size","padding"],fields:iN});const aN=["x0","y0","x1","y1","depth","children"];function uN(t){eN.call(this,t)}function sN(t){_a.call(this,null,t)}uN.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:aN.length,default:aN}]},mt(uN,eN,{layout:function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&OE(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(CE),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},params:["size","round","padding"],fields:aN}),sN.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},mt(sN,_a,{transform(t,n){n.source||p("Stratify transform requires an upstream data source.");let e=this.value;const r=t.modified(),i=n.fork(n.ALL).materialize(n.SOURCE),o=!e||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(e=i.source.length?QE(jE().id(t.key).parentId(t.parentKey)(i.source),t.key,$):QE(jE()([{}]),t.key,t.key)),i.source.root=this.value=e,i}});const cN={tidy:function(){var t=IE,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,o,a=new GE(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new GE(r[i],i)),e.parent=n;return(a.parent=new GE(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var c=i,f=i,l=i;i.eachBefore((function(t){t.x<c.x&&(c=t),t.x>f.x&&(f=t),t.depth>l.depth&&(l=t)}));var h=c===f?1:t(c,f)/2,d=h-c.x,m=n/(f.x+h+d),p=e/(l.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*m,t.y=t.depth*p}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,s=o.parent.children[0],c=o.m,f=a.m,l=u.m,h=s.m;u=UE(u),o=qE(o),u&&o;)s=qE(s),(a=UE(a)).a=n,(i=u.z+l-o.z-c+t(u._,o._))>0&&(WE(HE(u,n,r),n,i),c+=i,f+=i),l+=u.m,c+=o.m,h+=s.m,f+=a.m;u&&!UE(a)&&(a.t=u,a.m+=l-f),o&&!qE(s)&&(s.t=o,s.m+=c-h,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=nE,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(eE,0)/t.length}(e),n.y=function(t){return 1+t.reduce(rE,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,s)/2,f=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(f-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},fN=["x","y","depth","children"];function lN(t){eN.call(this,t)}function hN(t){_a.call(this,[],t)}lN.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:fN.length,default:fN}]},mt(lN,eN,{layout(t){const n=t||"tidy";if(ft(cN,n))return cN[n]();p("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:fN}),hN.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},mt(hN,_a,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),o={};return r||p("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,(t=>o[na(t)]=1)),r.each((t=>{const n=t.data,e=t.parent&&t.parent.data;e&&o[na(n)]&&o[na(e)]&&i.add.push(ra({source:e,target:n}))})),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,(t=>o[na(t)]=1)),e.forEach((t=>{(o[na(t.source)]||o[na(t.target)])&&i.mod.push(t)}))),i}});const dN={binary:function(t,n,e,r,i){var o,a,u=t.children,s=u.length,c=new Array(s+1);for(c[0]=a=o=0;o<s;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,s){if(n>=e-1){var f=u[n];return f.x0=i,f.y0=o,f.x1=a,void(f.y1=s)}for(var l=c[n],h=r/2+l,d=n+1,m=e-1;d<m;){var p=d+m>>>1;c[p]<h?d=p+1:m=p}h-c[d-1]<c[d]-h&&n+1<d&&--d;var g=c[d]-l,v=r-g;if(a-i>s-o){var y=r?(i*v+a*g)/r:a;t(n,d,g,i,o,y,s),t(d,e,v,y,o,a,s)}else{var b=r?(o*v+s*g)/r:s;t(n,d,g,i,o,a,b),t(d,e,v,i,b,a,s)}}(0,s,t.value,n,e,r,i)},dice:OE,slice:YE,slicedice:function(t,n,e,r,i){(1&t.depth?YE:OE)(t,n,e,r,i)},squarify:JE,resquarify:KE},mN=["x0","y0","x1","y1","depth","children"];function pN(t){eN.call(this,t)}pN.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:mN.length,default:mN}]},mt(pN,eN,{layout(){const t=function(){var t=JE,n=!1,e=1,r=1,i=[0],o=dE,a=dE,u=dE,s=dE,c=dE;function f(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(l),i=[0],n&&t.eachBefore(CE),t}function l(n){var e=i[n.depth],r=n.x0+e,f=n.y0+e,l=n.x1-e,h=n.y1-e;l<r&&(r=l=(r+l)/2),h<f&&(f=h=(f+h)/2),n.x0=r,n.y0=f,n.x1=l,n.y1=h,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,f+=a(n)-e,(l-=u(n)-e)<r&&(r=l=(r+l)/2),(h-=s(n)-e)<f&&(f=h=(f+h)/2),t(n,r,f,l,h))}return f.round=function(t){return arguments.length?(n=!!t,f):n},f.size=function(t){return arguments.length?(e=+t[0],r=+t[1],f):[e,r]},f.tile=function(n){return arguments.length?(t=hE(n),f):t},f.padding=function(t){return arguments.length?f.paddingInner(t).paddingOuter(t):f.paddingInner()},f.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:mE(+t),f):o},f.paddingOuter=function(t){return arguments.length?f.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):f.paddingTop()},f.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:mE(+t),f):a},f.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:mE(+t),f):u},f.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:mE(+t),f):s},f.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:mE(+t),f):c},f}();return t.ratio=n=>{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{ft(dN,n)?t.tile(dN[n]):p("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:mN});var gN=Object.freeze({__proto__:null,nest:ZE,pack:oN,partition:uN,stratify:sN,tree:lN,treelinks:hN,treemap:pN});const vN=4278190080;function yN(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function bN(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;"group"===r?n.forEach((n=>{n.items.forEach((n=>bN(t,n.items,e)))})):Pb[r].draw(t,{items:e?n.map(wN):n})}function wN(t){const n=oa(t,{});return n.stroke&&0!==n.strokeOpacity||n.fill&&0!==n.fillOpacity?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const xN=31,$N=new Uint32Array(33),kN=new Uint32Array(33);kN[0]=0,$N[0]=~kN[0];for(let t=1;t<=32;++t)kN[t]=kN[t-1]<<1|1,$N[t]=~kN[t];function MN(t,n,e,r,i,o){let a=e/2;return t-a<0||t+a>i||n-(a=r/2)<0||n+a>o}function AN(t,n,e,r,i,o,a,u){const s=i*o/(2*r),c=t(n-s),f=t(n+s),l=t(e-(o/=2)),h=t(e+o);return a.outOfBounds(c,l,f,h)||a.getRange(c,l,f,h)||u&&u.getRange(c,l,f,h)}const DN=[-1,-1,1,1],SN=[-1,1,-1,1],FN=["right","center","left"],EN=["bottom","middle","top"];function NN(t,n,e,r,i,o,a,u,s,c,f,l){return!(i.outOfBounds(t,e,n,r)||(l&&o||i).getRange(t,e,n,r))}const CN={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},ON={naive:function(t,n,e,r){const i=t.width,o=t.height;return function(t){const n=t.datum.datum.items[r].items,e=n.length,a=t.datum.fontSize,u=vb.width(t.datum,t.datum.text);let s,c,f,l,h,d,m,p=0;for(let r=0;r<e;++r)s=n[r].x,f=n[r].y,c=void 0===n[r].x2?s:n[r].x2,l=void 0===n[r].y2?f:n[r].y2,h=(s+c)/2,d=(f+l)/2,m=Math.abs(c-s+l-f),m>=p&&(p=m,t.x=h,t.y=d);return h=u/2,d=a/2,s=t.x-h,c=t.x+h,f=t.y-d,l=t.y+d,t.align="center",s<0&&c<=i?t.align="left":0<=s&&i<c&&(t.align="right"),t.baseline="middle",f<0&&l<=o?t.baseline="top":0<=f&&o<l&&(t.baseline="bottom"),!0}},"reduced-search":function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1];function s(n,e,r,s,c){const f=t.invert(n),l=t.invert(e);let h,d=r,m=o;if(!MN(f,l,s,c,i,o)&&!AN(t,f,l,c,s,d,a,u)&&!AN(t,f,l,c,s,c,a,null)){for(;m-d>=1;)h=(d+m)/2,AN(t,f,l,c,s,h,a,u)?m=h:d=h;if(d>r)return[f,l,d,!0]}}return function(n){const u=n.datum.datum.items[r].items,c=u.length,f=n.datum.fontSize,l=vb.width(n.datum,n.datum.text);let h,d,m,p,g,v,y,b,w,x,$,k,M,A,D,S,F,E=e?f:0,N=!1,C=!1,O=0;for(let r=0;r<c;++r){for(h=u[r].x,m=u[r].y,d=void 0===u[r].x2?h:u[r].x2,p=void 0===u[r].y2?m:u[r].y2,h>d&&(F=h,h=d,d=F),m>p&&(F=m,m=p,p=F),w=t(h),$=t(d),x=~~((w+$)/2),k=t(m),A=t(p),M=~~((k+A)/2),y=x;y>=w;--y)for(b=M;b>=k;--b)S=s(y,b,E,l,f),S&&([n.x,n.y,E,N]=S);for(y=x;y<=$;++y)for(b=M;b<=A;++b)S=s(y,b,E,l,f),S&&([n.x,n.y,E,N]=S);N||e||(D=Math.abs(d-h+p-m),g=(h+d)/2,v=(m+p)/2,D>=O&&!MN(g,v,l,f,i,o)&&!AN(t,g,v,f,l,f,a,null)&&(O=D,n.x=g,n.y=v,C=!0))}return!(!N&&!C||(g=l/2,v=f/2,a.setRange(t(n.x-g),t(n.y-v),t(n.x+g),t(n.y+v)),n.align="center",n.baseline="middle",0))}},floodfill:function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=t.bitmap();return function(n){const c=n.datum.datum.items[r].items,f=c.length,l=n.datum.fontSize,h=vb.width(n.datum,n.datum.text),d=[];let m,p,g,v,y,b,w,x,$,k,M,A,D=e?l:0,S=!1,F=!1,E=0;for(let r=0;r<f;++r){for(m=c[r].x,g=c[r].y,p=void 0===c[r].x2?m:c[r].x2,v=void 0===c[r].y2?g:c[r].y2,d.push([t((m+p)/2),t((g+v)/2)]);d.length;)if([w,x]=d.pop(),!(a.get(w,x)||u.get(w,x)||s.get(w,x))){s.set(w,x);for(let t=0;t<4;++t)y=w+DN[t],b=x+SN[t],s.outOfBounds(y,b,y,b)||d.push([y,b]);if(y=t.invert(w),b=t.invert(x),$=D,k=o,!MN(y,b,h,l,i,o)&&!AN(t,y,b,l,h,$,a,u)&&!AN(t,y,b,l,h,l,a,null)){for(;k-$>=1;)M=($+k)/2,AN(t,y,b,l,h,M,a,u)?k=M:$=M;$>D&&(n.x=y,n.y=b,D=$,S=!0)}}S||e||(A=Math.abs(p-m+v-g),y=(m+p)/2,b=(g+v)/2,A>=E&&!MN(y,b,h,l,i,o)&&!AN(t,y,b,l,h,l,a,null)&&(E=A,n.x=y,n.y=b,F=!0))}return!(!S&&!F||(y=h/2,b=l/2,a.setRange(t(n.x-y),t(n.y-b),t(n.x+y),t(n.y+b)),n.align="center",n.baseline="middle",0))}}};function _N(t,n,e,r,i,o,a,u,s,c,f){if(!t.length)return t;const l=Math.max(r.length,i.length),h=function(t,n){const e=new Float64Array(n),r=t.length;for(let n=0;n<r;++n)e[n]=t[n]||0;for(let t=r;t<n;++t)e[t]=e[r-1];return e}(r,l),d=function(t,n){const e=new Int8Array(n),r=t.length;for(let n=0;n<r;++n)e[n]|=CN[t[n]];for(let t=r;t<n;++t)e[t]=e[r-1];return e}(i,l),m=(w=t[0].datum)&&w.mark&&w.mark.marktype,p="group"===m&&t[0].datum.items[s].marktype,g="area"===p,v=function(t,n,e,r){const i=t=>[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===n?t=>{const n=t.datum.items[r].items;return i(n.length?n["start"===e?0:n.length-1]:{x:NaN,y:NaN})}:t=>{const n=t.datum.bounds;return[n.x1,(n.x1+n.x2)/2,n.x2,n.y1,(n.y1+n.y2)/2,n.y2]}:i}(m,p,u,s),y=null===c||c===1/0,b=g&&"naive"===f;var w;let x=-1,$=-1;const k=t.map((t=>{const n=y?vb.width(t,t.text):void 0;return x=Math.max(x,n),$=Math.max($,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v(t),textWidth:n}}));c=null===c||c===1/0?Math.max(x,$)+Math.max(...r):c;const M=function(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),o=~~((n+2*e+r)/r),a=t=>~~((t+e)/r);return a.invert=t=>t*r-e,a.bitmap=()=>function(t,n){const e=new Uint32Array(~~((t*n+32)/32));function r(t,n){e[t]|=n}function i(t,n){e[t]&=n}return{array:e,get:(n,r)=>{const i=r*t+n;return e[i>>>5]&1<<(i&xN)},set:(n,e)=>{const i=e*t+n;r(i>>>5,1<<(i&xN))},clear:(n,e)=>{const r=e*t+n;i(r>>>5,~(1<<(r&xN)))},getRange:(n,r,i,o)=>{let a,u,s,c,f=o;for(;f>=r;--f)if(a=f*t+n,u=f*t+i,s=a>>>5,c=u>>>5,s===c){if(e[s]&$N[a&xN]&kN[1+(u&xN)])return!0}else{if(e[s]&$N[a&xN])return!0;if(e[c]&kN[1+(u&xN)])return!0;for(let t=s+1;t<c;++t)if(e[t])return!0}return!1},setRange:(n,e,i,o)=>{let a,u,s,c,f;for(;e<=o;++e)if(a=e*t+n,u=e*t+i,s=a>>>5,c=u>>>5,s===c)r(s,$N[a&xN]&kN[1+(u&xN)]);else for(r(s,$N[a&xN]),r(c,kN[1+(u&xN)]),f=s+1;f<c;++f)r(f,4294967295)},clearRange:(n,e,r,o)=>{let a,u,s,c,f;for(;e<=o;++e)if(a=e*t+n,u=e*t+r,s=a>>>5,c=u>>>5,s===c)i(s,kN[a&xN]|$N[1+(u&xN)]);else for(i(s,kN[a&xN]),i(c,$N[1+(u&xN)]),f=s+1;f<c;++f)i(f,0)},outOfBounds:(e,r,i,o)=>e<0||r<0||o>=n||i>=t}}(i,o),a.ratio=r,a.padding=e,a.width=t,a.height=n,a}(n[0],n[1],c);let A;if(!b){e&&k.sort(((t,n)=>e(t.datum,n.datum)));let n=!1;for(let t=0;t<d.length&&!n;++t)n=5===d[t]||h[t]<0;const r=(m&&a||g)&&t.map((t=>t.datum));A=o.length||r?function(t,n,e,r,i){const o=t.width,a=t.height,u=r||i,s=pf(o,a).getContext("2d"),c=pf(o,a).getContext("2d"),f=u&&pf(o,a).getContext("2d");e.forEach((t=>bN(s,t,!1))),bN(c,n,!1),u&&bN(f,n,!0);const l=yN(s,o,a),h=yN(c,o,a),d=u&&yN(f,o,a),m=t.bitmap(),p=u&&t.bitmap();let g,v,y,b,w,x,$,k;for(v=0;v<a;++v)for(g=0;g<o;++g)w=v*o+g,x=l[w]&vN,k=h[w]&vN,$=u&&d[w]&vN,(x||$||k)&&(y=t(g),b=t(v),i||!x&&!k||m.set(y,b),u&&(x||$)&&p.set(y,b));return[m,p]}(M,r||[],o,n,g):function(t,n){const e=t.bitmap();return(n||[]).forEach((n=>e.set(t(n.boundary[0]),t(n.boundary[3])))),[e,void 0]}(M,a&&k)}const D=g?ON[f](M,A,a,s):function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=r.length;return function(n){const c=n.boundary,f=n.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>o)return!1;let l,h,d,m,p,g,v,y,b,w,x,$,k,M,A,D=n.textWidth??0;for(let i=0;i<s;++i){if(l=(3&e[i])-1,h=(e[i]>>>2&3)-1,d=0===l&&0===h||r[i]<0,m=l&&h?Math.SQRT1_2:1,p=r[i]<0?-1:1,g=c[1+l]+r[i]*l*m,x=c[4+h]+p*f*h/2+r[i]*h*m,y=x-f/2,b=x+f/2,$=t(g),M=t(y),A=t(b),!D){if(!NN($,$,M,A,a,u,0,0,0,0,0,d))continue;D=vb.width(n.datum,n.datum.text)}if(w=g+p*D*l/2,g=w-D/2,v=w+D/2,$=t(g),k=t(v),NN($,k,M,A,a,u,0,0,0,0,0,d))return n.x=l?l*p<0?v:g:w,n.y=h?h*p<0?b:y:x,n.align=FN[l*p+1],n.baseline=EN[h*p+1],a.setRange($,M,k,A),!0}return!1}}(M,A,d,h);return k.forEach((t=>t.opacity=+D(t))),k}const zN=["x","y","opacity","align","baseline"],BN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function TN(t){_a.call(this,null,t)}TN.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:BN},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:zN.length,default:zN}]},mt(TN,_a,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(){const e=t.sort;return Z(e)&&n.modified(e.fields)}()))return;t.size&&2===t.size.length||p("Size parameter should be specified as a [width, height] array.");const r=t.as||zN;return _N(n.materialize(n.SOURCE).source||[],t.size,t.sort,K(null==t.offset?1:t.offset),K(t.anchor||BN),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const n=t.datum;n[r[0]]=t.x,n[r[1]]=t.y,n[r[2]]=t.opacity,n[r[3]]=t.align,n[r[4]]=t.baseline})),n.reflow(e).modifies(r)}});var PN=Object.freeze({__proto__:null,label:TN});function jN(t,n){var e,r,i,o,a,u,s=[],c=function(t){return t(o)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}function RN(t){_a.call(this,null,t)}RN.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},mt(RN,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=jN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(f),o=i.length,a=t.as||[f(t.x),f(t.y)],u=[];r.forEach((n=>{ku(n,t.x,t.y,t.bandwidth||.3).forEach((t=>{const e={};for(let t=0;t<o;++t)e[i[t]]=n.dims[t];e[a[0]]=t[0],e[a[1]]=t[1],u.push(ra(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});const LN={constant:lu,linear:gu,log:vu,exp:yu,pow:bu,quad:wu,poly:xu};function IN(t){_a.call(this,null,t)}IN.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(LN)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},mt(IN,_a,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=jN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(f),o=t.method||"linear",a=null==t.order?3:t.order,u=((t,n)=>"poly"===t?n:"quad"===t?2:1)(o,a),s=t.as||[f(t.x),f(t.y)],c=LN[o],l=[];let h=t.extent;ft(LN,o)||p("Invalid regression method: "+o),null!=h&&"log"===o&&h[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),h=null),r.forEach((e=>{if(e.length<=u)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(e,t.x,t.y,a);if(t.params)return void l.push(ra({keys:e.dims,coef:r.coef,rSquared:r.rSquared}));const f=h||st(e,t.x),d=t=>{const n={};for(let t=0;t<i.length;++t)n[i[t]]=e.dims[t];n[s[0]]=t[0],n[s[1]]=t[1],l.push(ra(n))};"linear"===o||"constant"===o?f.forEach((t=>d([t,r.predict(t)]))):Su(r.predict,f,25,200).forEach(d)})),this.value&&(e.rem=this.value),this.value=e.add=e.source=l}return e}});var qN=Object.freeze({__proto__:null,loess:RN,regression:IN});const UN=134217729;function WN(t,n,e,r,i){let o,a,u,s,c=n[0],f=r[0],l=0,h=0;f>c==f>-c?(o=c,c=n[++l]):(o=f,f=r[++h]);let d=0;if(l<t&&h<e)for(f>c==f>-c?(a=c+o,u=o-(a-c),c=n[++l]):(a=f+o,u=o-(a-f),f=r[++h]),o=a,0!==u&&(i[d++]=u);l<t&&h<e;)f>c==f>-c?(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++l]):(a=o+f,s=a-o,u=o-(a-s)+(f-s),f=r[++h]),o=a,0!==u&&(i[d++]=u);for(;l<t;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++l],o=a,0!==u&&(i[d++]=u);for(;h<e;)a=o+f,s=a-o,u=o-(a-s)+(f-s),f=r[++h],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function HN(t){return new Float64Array(t)}const GN=HN(4),YN=HN(8),VN=HN(12),XN=HN(16),JN=HN(4);function KN(t,n,e,r,i,o){const a=(n-o)*(e-i),u=(t-i)*(r-o),s=a-u,c=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*c?s:-function(t,n,e,r,i,o,a){let u,s,c,f,l,h,d,m,p,g,v,y,b,w,x,$,k,M;const A=t-i,D=e-i,S=n-o,F=r-o;w=A*F,h=UN*A,d=h-(h-A),m=A-d,h=UN*F,p=h-(h-F),g=F-p,x=m*g-(w-d*p-m*p-d*g),$=S*D,h=UN*S,d=h-(h-S),m=S-d,h=UN*D,p=h-(h-D),g=D-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,GN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,GN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,GN[2]=y-(M-l)+(v-l),GN[3]=M;let E=function(t,n){let e=n[0];for(let t=1;t<4;t++)e+=n[t];return e}(0,GN),N=22204460492503146e-32*a;if(E>=N||-E>=N)return E;if(l=t-A,u=t-(A+l)+(l-i),l=e-D,c=e-(D+l)+(l-i),l=n-S,s=n-(S+l)+(l-o),l=r-F,f=r-(F+l)+(l-o),0===u&&0===s&&0===c&&0===f)return E;if(N=11093356479670487e-47*a+33306690738754706e-32*Math.abs(E),E+=A*f+F*u-(S*c+D*s),E>=N||-E>=N)return E;w=u*F,h=UN*u,d=h-(h-u),m=u-d,h=UN*F,p=h-(h-F),g=F-p,x=m*g-(w-d*p-m*p-d*g),$=s*D,h=UN*s,d=h-(h-s),m=s-d,h=UN*D,p=h-(h-D),g=D-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const C=WN(4,GN,4,JN,YN);w=A*f,h=UN*A,d=h-(h-A),m=A-d,h=UN*f,p=h-(h-f),g=f-p,x=m*g-(w-d*p-m*p-d*g),$=S*c,h=UN*S,d=h-(h-S),m=S-d,h=UN*c,p=h-(h-c),g=c-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const O=WN(C,YN,4,JN,VN);w=u*f,h=UN*u,d=h-(h-u),m=u-d,h=UN*f,p=h-(h-f),g=f-p,x=m*g-(w-d*p-m*p-d*g),$=s*c,h=UN*s,d=h-(h-s),m=s-d,h=UN*c,p=h-(h-c),g=c-p,k=m*g-($-d*p-m*p-d*g),v=x-k,l=x-v,JN[0]=x-(v+l)+(l-k),y=w+v,l=y-w,b=w-(y-l)+(v-l),v=b-$,l=b-v,JN[1]=b-(v+l)+(l-$),M=y+v,l=M-y,JN[2]=y-(M-l)+(v-l),JN[3]=M;const _=WN(O,VN,4,JN,XN);return XN[_-1]}(t,n,e,r,i,o,c)}const QN=Math.pow(2,-52),ZN=new Uint32Array(512);class tC{static from(t,n=aC,e=uC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=n(r),i[2*o+1]=e(r)}return new tC(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,c=-1/0;for(let n=0;n<o;n++){const e=t[2*n],r=t[2*n+1];e<a&&(a=e),r<u&&(u=r),e>s&&(s=e),r>c&&(c=r),this._ids[n]=n}const f=(a+s)/2,l=(u+c)/2;let h,d,m;for(let n=0,e=1/0;n<o;n++){const r=nC(f,l,t[2*n],t[2*n+1]);r<e&&(h=n,e=r)}const p=t[2*h],g=t[2*h+1];for(let n=0,e=1/0;n<o;n++){if(n===h)continue;const r=nC(p,g,t[2*n],t[2*n+1]);r<e&&r>0&&(d=n,e=r)}let v=t[2*d],y=t[2*d+1],b=1/0;for(let n=0;n<o;n++){if(n===h||n===d)continue;const e=rC(p,g,v,y,t[2*n],t[2*n+1]);e<b&&(m=n,b=e)}let w=t[2*m],x=t[2*m+1];if(b===1/0){for(let n=0;n<o;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];iC(this._ids,this._dists,0,o-1);const n=new Uint32Array(o);let e=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(n[e++]=i,r=o)}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(KN(p,g,v,y,w,x)<0){const t=d,n=v,e=y;d=m,v=w,y=x,m=t,w=n,x=e}const $=function(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,f=a*a+u*u,l=s*s+c*c,h=.5/(a*c-u*s);return{x:t+(c*f-u*l)*h,y:n+(a*l-s*f)*h}}(p,g,v,y,w,x);this._cx=$.x,this._cy=$.y;for(let n=0;n<o;n++)this._dists[n]=nC(t[2*n],t[2*n+1],$.x,$.y);iC(this._ids,this._dists,0,o-1),this._hullStart=h;let k=3;e[h]=n[m]=d,e[d]=n[h]=m,e[m]=n[d]=h,r[h]=0,r[d]=1,r[m]=2,i.fill(-1),i[this._hashKey(p,g)]=h,i[this._hashKey(v,y)]=d,i[this._hashKey(w,x)]=m,this.trianglesLen=0,this._addTriangle(h,d,m,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const s=this._ids[u],c=t[2*s],f=t[2*s+1];if(u>0&&Math.abs(c-o)<=QN&&Math.abs(f-a)<=QN)continue;if(o=c,a=f,s===h||s===d||s===m)continue;let l=0;for(let t=0,n=this._hashKey(c,f);t<this._hashSize&&(l=i[(n+t)%this._hashSize],-1===l||l===e[l]);t++);l=n[l];let p,g=l;for(;p=e[g],KN(c,f,t[2*g],t[2*g+1],t[2*p],t[2*p+1])>=0;)if(g=p,g===l){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,s,e[g],-1,-1,r[g]);r[s]=this._legalize(v+2),r[g]=v,k++;let y=e[g];for(;p=e[y],KN(c,f,t[2*y],t[2*y+1],t[2*p],t[2*p+1])<0;)v=this._addTriangle(y,s,p,r[s],-1,r[y]),r[s]=this._legalize(v+2),e[y]=y,k--,y=p;if(g===l)for(;p=n[g],KN(c,f,t[2*p],t[2*p+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(p,s,g,-1,r[g],r[p]),this._legalize(v+2),r[p]=v,e[g]=g,k--,g=p;this._hullStart=n[s]=g,e[g]=n[y]=s,e[s]=y,i[this._hashKey(c,f)]=s,i[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(k);for(let t=0,n=this._hullStart;t<k;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=ZN[--i];continue}const s=a-a%3,c=s+(a+2)%3,f=n[o],l=n[t],h=n[u+(t+1)%3],d=n[c];if(eC(r[2*f],r[2*f+1],r[2*l],r[2*l+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1])){n[t]=d,n[a]=f;const r=e[c];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===c){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,c),i<ZN.length&&(ZN[i++]=s+(a+1)%3)}else{if(0===i)break;t=ZN[--i]}}return o}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=e,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function nC(t,n,e,r){const i=t-e,o=n-r;return i*i+o*o}function eC(t,n,e,r,i,o,a,u){const s=t-a,c=n-u,f=e-a,l=r-u,h=i-a,d=o-u,m=f*f+l*l,p=h*h+d*d;return s*(l*p-m*d)-c*(f*p-m*h)+(s*s+c*c)*(f*d-l*h)<0}function rC(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,f=a*a+u*u,l=s*s+c*c,h=.5/(a*c-u*s),d=(c*f-u*l)*h,m=(a*l-s*f)*h;return d*d+m*m}function iC(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],o=n[r];let a=i-1;for(;a>=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;oC(t,e+r>>1,i),n[t[e]]>n[t[r]]&&oC(t,e,r),n[t[i]]>n[t[r]]&&oC(t,i,r),n[t[e]]>n[t[i]]&&oC(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]<u);do{o--}while(n[t[o]]>u);if(o<i)break;oC(t,i,o)}t[e+1]=t[o],t[o]=a,r-i+1>=o-e?(iC(t,n,i,r),iC(t,n,e,o-1)):(iC(t,n,e,o-1),iC(t,n,i,r))}}function oC(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function aC(t){return t[0]}function uC(t){return t[1]}const sC=1e-6;class cC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>sC||Math.abs(this._y1-i)>sC)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class fC{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let lC=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let r,u,s=0,c=0,f=e.length;s<f;s+=3,c+=2){const f=2*e[s],l=2*e[s+1],h=2*e[s+2],d=t[f],m=t[f+1],p=t[h],g=t[h+1],v=t[l]-d,y=t[l+1]-m,b=p-d,w=g-m,x=2*(v*w-y*b);if(Math.abs(x)<1e-9){if(void 0===i){i=o=0;for(const e of n)i+=t[2*e],o+=t[2*e+1];i/=n.length,o/=n.length}const e=1e9*Math.sign((i-d)*w-(o-m)*b);r=(d+p)/2-e*w,u=(m+g)/2+e*b}else{const t=1/x,n=v*v+y*y,e=b*b+w*w;r=d+(w*n-y*e)*t,u=m+(v*e-b*n)*t}a[c]=r,a[c+1]=u}let u,s,c,f=n[n.length-1],l=4*f,h=t[2*f],d=t[2*f+1];r.fill(0);for(let e=0;e<n.length;++e)f=n[e],u=l,s=h,c=d,l=4*f,h=t[2*f],d=t[2*f+1],r[u+2]=r[l]=c-d,r[u+3]=r[l+1]=h-s}render(t){const n=null==t?t=new cC:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),a=2*Math.floor(r/3);this._renderSegment(o[i],o[i+1],o[a],o[a+1],t)}let u,s=i[i.length-1];for(let n=0;n<i.length;++n){u=s,s=i[n];const e=2*Math.floor(r[s]/3),c=o[e],f=o[e+1],l=4*u,h=this._project(c,f,a[l+2],a[l+3]);h&&this._renderSegment(c,f,h[0],h[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new cC:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new cC:void 0,r=this._clip(t);if(null===r||!r.length)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(t.index=n,yield t)}}cellPolygon(t){const n=new fC;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let o;const a=this._regioncode(t,n),u=this._regioncode(e,r);0===a&&0===u?(i.moveTo(t,n),i.lineTo(e,r)):(o=this._clipSegment(t,n,e,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}*neighbors(t){const n=this._clip(t);if(n)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let r=0,i=n.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(n[r]===t[o]&&n[r+1]===t[o+1]&&n[(r+2)%i]===t[(o+a-2)%a]&&n[(r+3)%i]===t[(o+a-1)%a]){yield e;break t}}}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,o=e[t];if(-1===o)return null;const a=[];let u=o;do{const e=Math.floor(u/3);if(a.push(n[2*e],n[2*e+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return this._simplify(e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const e=n.length;let r,i,o,a,u=null,s=n[e-2],c=n[e-1],f=this._regioncode(s,c),l=0;for(let h=0;h<e;h+=2)if(r=s,i=c,s=n[h],c=n[h+1],o=f,f=this._regioncode(s,c),0===o&&0===f)a=l,l=0,u?u.push(s,c):u=[s,c];else{let n,e,h,d,m;if(0===o){if(null===(n=this._clipSegment(r,i,s,c,o,f)))continue;[e,h,d,m]=n}else{if(null===(n=this._clipSegment(s,c,r,i,f,o)))continue;[d,m,e,h]=n,a=l,l=this._edgecode(e,h),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(e,h):u=[e,h]}a=l,l=this._edgecode(d,m),a&&l&&this._edge(t,a,l,u,u.length),u?u.push(d,m):u=[d,m]}if(u)a=l,l=this._edgecode(u[0],u[1]),a&&l&&this._edge(t,a,l,u,u.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return u}_clipSegment(t,n,e,r,i,o){const a=i<o;for(a&&([t,n,e,r,i,o]=[e,r,t,n,o,i]);;){if(0===i&&0===o)return a?[e,r,t,n]:[t,n,e,r];if(i&o)return null;let u,s,c=i||o;8&c?(u=t+(e-t)*(this.ymax-n)/(r-n),s=this.ymax):4&c?(u=t+(e-t)*(this.ymin-n)/(r-n),s=this.ymin):2&c?(s=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(s=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?i=this._regioncode(t=u,n=s):o=this._regioncode(e=u,r=s)}}_clipInfinite(t,n,e,r,i,o){let a,u=Array.from(n);if((a=this._project(u[0],u[1],e,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let n,e=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);e<r;e+=2)n=i,i=this._edgecode(u[e],u[e+1]),n&&i&&(e=this._edge(t,n,i,u,e),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,n,e,r,i){for(;n!==e;){let e,o;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,o=this.ymin}r[i]===e&&r[i+1]===o||!this.contains(t,e,o)||(r.splice(i,0,e,o),i+=2)}return i}_project(t,n,e,r){let i,o,a,u=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<u&&(a=this.ymin,o=t+(u=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<u&&(a=this.ymax,o=t+(u=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<u&&(o=this.xmax,a=n+(u=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<u&&(o=this.xmin,a=n+(u=i)*r)}return[o,a]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const e=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[e]&&t[e]===t[r]||t[n+1]===t[e+1]&&t[e+1]===t[r+1])&&(t.splice(e,2),n-=2)}t.length||(t=null)}return t}};const hC=2*Math.PI,dC=Math.pow;function mC(t){return t[0]}function pC(t){return t[1]}function gC(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class vC{static from(t,n=mC,e=pC,r){return new vC("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=n.call(r,i,a,t),o[2*a+1]=e.call(r,i,a,t)}return o}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const o of t)yield n.call(r,o,i,t),yield e.call(r,o,i,t),++i}(t,n,e,r)))}constructor(t){this._delaunator=new tC(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],o=2*n[t+2];if((e[o]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[o+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t<e;++t){const e=gC(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new tC(n)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==o[n]||(o[n]=t)}for(let t=0,n=r.length;t<n;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new lC(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n<a.length-1&&(yield a[n+1]))}const u=n[t];if(-1===u)return;let s=u,c=-1;do{if(yield c=o[s],s=s%3==2?s-2:s+1,o[s]!==t)return;if(s=i[s],-1===s){const n=e[(r[t]+1)%e.length];return void(n!==c&&(yield n))}}while(s!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let c=t,f=dC(n-s[2*t],2)+dC(e-s[2*t+1],2);const l=r[t];let h=l;do{let r=u[h];const l=dC(n-s[2*r],2)+dC(e-s[2*r+1],2);if(l<f&&(f=l,c=r),h=h%3==2?h-2:h+1,u[h]!==t)break;if(h=a[h],-1===h){if(h=i[(o[t]+1)%i.length],h!==r&&dC(n-s[2*h],2)+dC(e-s[2*h+1],2)<f)return h;break}}while(h!==l);return c}render(t){const n=null==t?t=new cC:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,o=r.length;n<o;++n){const o=r[n];if(o<n)continue;const a=2*i[n],u=2*i[o];t.moveTo(e[a],e[a+1]),t.lineTo(e[u],e[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){void 0!==n||t&&"function"==typeof t.moveTo||(n=t,t=null),n=null==n?2:+n;const e=null==t?t=new cC:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],o=r[e+1];t.moveTo(i+n,o),t.arc(i,o,n,0,hC)}return e&&e.value()}renderHull(t){const n=null==t?t=new cC:void 0,{hull:e,points:r}=this,i=2*e[0],o=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<o;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new fC;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new cC:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new fC;return this.renderTriangle(t,n),n.value()}}function yC(t){_a.call(this,null,t)}yC.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const bC=[-1e5,-1e5,1e5,1e5];function wC(t){const n=t[0][0],e=t[0][1];let r=t.length-1;for(;t[r][0]===n&&t[r][1]===e;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}mt(yC,_a,{transform(t,n){const e=t.as||"path",r=n.source;if(!r||!r.length)return n;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:bC;const o=this.value=vC.from(r,t.x,t.y).voronoi(i);for(let t=0,n=r.length;t<n;++t){const n=o.cellPolygon(t);r[t][e]=!n||2===(a=n).length&&a[0][0]===a[1][0]&&a[0][1]===a[1][1]?null:wC(n)}var a;return n.reflow(t.modified()).modifies(e)}});var xC=Object.freeze({__proto__:null,voronoi:yC}),$C=Math.PI/180,kC=2048;function MC(t,n,e,r){if(!n.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,kC/o);var a,u,s,c,f,l=0,h=0,d=0,m=e.length;for(--r;++r<m;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/o)+"px "+n.font,a=i.measureText(n.text+"m").width*o,s=n.size<<1,n.rotate){var p=Math.sin(n.rotate*$C),g=Math.cos(n.rotate*$C),v=a*g,y=a*p,b=s*g,w=s*p;a=Math.max(Math.abs(v+w),Math.abs(v-w))+31>>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>d&&(d=s),l+a>=2048&&(l=0,h+=d,d=0),h+s>=kC)break;i.translate((l+(a>>1))/o,(h+(s>>1))/o),n.rotate&&i.rotate(n.rotate*$C),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=a,n.height=s,n.xoff=l,n.yoff=h,n.x1=a>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,l+=a}for(var x=i.getImageData(0,0,2048/o,kC/o).data,$=[];--r>=0;)if((n=e[r]).hasText){for(u=(a=n.width)>>5,s=n.y1-n.y0,c=0;c<s*u;c++)$[c]=0;if(null==(l=n.xoff))return;h=n.yoff;var k=0,M=-1;for(f=0;f<s;f++){for(c=0;c<a;c++){var A=x[2048*(h+f)+(l+c)<<2]?1<<31-c%32:0;$[u*f+(c>>5)]|=A,k|=A}k?M=f:(n.y0++,s--,f--,h++)}n.y1=n.y0+M,n.sprite=$.slice(0,(n.y1-n.y0)*u)}}}function AC(t,n,e){for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,c=t.y1-t.y0,f=(t.y+t.y0)*(e>>=5)+(a>>5),l=0;l<c;l++){r=0;for(var h=0;h<=o;h++)if((r<<s|(h<o?(r=i[l*o+h])>>>u:0))&n[f+h])return!0;f+=e}return!1}function DC(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function SC(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0<n[1].x&&t.y+t.y1>n[0].y&&t.y+t.y0<n[1].y}function FC(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function EC(t){return"function"==typeof t?t:function(){return t}}var NC={archimedean:FC,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}};const CC=["x","y","font","fontSize","fontStyle","fontWeight","angle"],OC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function _C(t){_a.call(this,function(){var t,n,e,r,i,o,a,u=[256,256],s=FC,c=[],f=Math.random,l={};function h(t,n,e){for(var r,i,o,a=n.x,c=n.y,l=Math.hypot(u[0],u[1]),h=s(u),d=f()<.5?1:-1,m=-d;(r=h(m+=d))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=l));)if(n.x=a+i,n.y=c+o,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>u[0]||n.y+n.y1>u[1])&&(!e||!AC(n,t,u[0]))&&(!e||SC(n,e))){for(var p,g=n.sprite,v=n.width>>5,y=u[0]>>5,b=n.x-(v<<4),w=127&b,x=32-w,$=n.y1-n.y0,k=(n.y+n.y0)*y+(b>>5),M=0;M<$;M++){p=0;for(var A=0;A<=v;A++)t[k+A]|=p<<x|(A<v?(p=g[M*v+A])>>>w:0);k+=y}return n.sprite=null,!0}return!1}return l.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/n,t.height=kC/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(pf()),l=function(t){for(var n=[],e=-1;++e<t;)n[e]=0;return n}((u[0]>>5)*u[1]),d=null,m=c.length,p=-1,g=[],v=c.map((u=>({text:t(u),font:n(u),style:r(u),weight:i(u),rotate:o(u),size:~~(e(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,n)=>n.size-t.size));++p<m;){var y=v[p];y.x=u[0]*(f()+.5)>>1,y.y=u[1]*(f()+.5)>>1,MC(s,y,v,p),y.hasText&&h(l,y,d)&&(g.push(y),d?DC(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},l.words=function(t){return arguments.length?(c=t,l):c},l.size=function(t){return arguments.length?(u=[+t[0],+t[1]],l):u},l.font=function(t){return arguments.length?(n=EC(t),l):n},l.fontStyle=function(t){return arguments.length?(r=EC(t),l):r},l.fontWeight=function(t){return arguments.length?(i=EC(t),l):i},l.rotate=function(t){return arguments.length?(o=EC(t),l):o},l.text=function(n){return arguments.length?(t=EC(n),l):t},l.spiral=function(t){return arguments.length?(s=NC[t]||t,l):s},l.fontSize=function(t){return arguments.length?(e=EC(t),l):e},l.padding=function(t){return arguments.length?(a=EC(t),l):a},l.random=function(t){return arguments.length?(f=t,l):f},l}(),t)}_C.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:CC}]},mt(_C,_a,{transform(t,n){!t.size||t.size[0]&&t.size[1]||p("Wordcloud size dimensions must be non-zero.");const e=t.modified();if(!(e||n.changed(n.ADD_REM)||OC.some((function(e){const r=t[e];return Z(r)&&n.modified(r.fields)}))))return;const r=n.materialize(n.SOURCE).source,i=this.value,o=t.as||CC;let a,u=t.fontSize||14;if(Z(u)?a=t.fontSizeRange:u=ot(u),a){const t=u,n=ng("sqrt")().domain(st(r,t)).range(a);u=e=>n(t(e))}r.forEach((t=>{t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0}));const s=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(u).random(qa).layout(),c=i.size(),f=c[0]>>1,l=c[1]>>1,h=s.length;for(let t,n,e=0;e<h;++e)t=s[e],n=t.datum,n[o[0]]=t.x+f,n[o[1]]=t.y+l,n[o[2]]=t.font,n[o[3]]=t.size,n[o[4]]=t.style,n[o[5]]=t.weight,n[o[6]]=t.rotate;return n.reflow(e).modifies(o)}});var zC=Object.freeze({__proto__:null,wordcloud:_C});const BC=t=>new Uint8Array(t),TC=t=>new Uint16Array(t),PC=t=>new Uint32Array(t);function jC(t,n,e){const r=(n<257?BC:n<65537?TC:PC)(t);return e&&r.set(e),r}function RC(t,n,e){const r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,n){const e=this,i=e.bisect(e.range,t.value),o=t.index,a=i[0],u=i[1],s=o.length;let c;for(c=0;c<a;++c)n[o[c]]|=r;for(c=u;c<s;++c)n[o[c]]|=r;return e}}}function LC(){let t=PC(0),n=[],e=0;return{insert:function(r,i,o){if(!i.length)return[];const a=e,u=i.length,s=PC(u);let c,f,l,h=Array(u);for(l=0;l<u;++l)h[l]=r(i[l]),s[l]=l;if(h=function(t,n){return t.sort.call(n,((n,e)=>{const r=t[n],i=t[e];return r<i?-1:r>i?1:0})),function(t,n){return Array.from(n,(n=>t[n]))}(t,n)}(h,s),a)c=n,f=t,n=Array(a+u),t=PC(a+u),function(t,n,e,r,i,o,a,u,s){let c,f=0,l=0;for(c=0;f<r&&l<a;++c)n[f]<i[l]?(u[c]=n[f],s[c]=e[f++]):(u[c]=i[l],s[c]=o[l++]+t);for(;f<r;++f,++c)u[c]=n[f],s[c]=e[f];for(;l<a;++l,++c)u[c]=i[l],s[c]=o[l]+t}(o,c,f,a,h,s,u,n,t);else{if(o>0)for(l=0;l<u;++l)s[l]+=o;n=h,t=s}return e=a+u,{index:s,value:h}},remove:function(r,i){const o=e;let a,u,s;for(u=0;!i[t[u]]&&u<o;++u);for(s=u;u<o;++u)i[a=t[u]]||(t[s]=a,n[s]=n[u],++s);e=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=n,i=e),[rn(r,t[0],0,i),en(r,t[1],0,i)]},reindex:function(n){for(let r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:()=>t,size:()=>e}}function IC(t){_a.call(this,function(){let t=8,n=[],e=PC(0),r=jC(0,t),i=jC(0,t);return{data:()=>n,seen:()=>e=function(t,n,e){return t.length>=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length),add(t){for(let e,r=0,i=n.length,o=t.length;r<o;++r)e=t[r],e._index=i++,n.push(e)},remove(t,e){const o=n.length,a=Array(o-t),u=n;let s,c,f;for(c=0;!e[c]&&c<o;++c)a[c]=n[c],u[c]=c;for(f=c;c<o;++c)s=n[c],e[c]?u[c]=-1:(u[c]=f,r[f]=r[c],i[f]=i[c],a[f]=s,s._index=f++),r[c]=0;return n=a,u},size:()=>n.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,n){r[t]|=n},clear(t,n){r[t]&=~n},resize(n,e){(n>r.length||e>t)&&(t=Math.max(e,t),r=jC(n,t,r),i=jC(n,t))}}}(),t),this._indices=null,this._dims=null}function qC(t){_a.call(this,null,t)}IC.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},mt(IC,_a,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some((t=>n.modified(t.fields)))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,c=0;for(;c<a;++c)u=e[c].fname,s=i[u]||(i[u]=LC()),o.push(RC(s,c,r[c]));return this.eval(t,n)},reinit(t,n){const e=n.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,u=this.value,s=u.curr(),c=u.prev(),f=u.all(),l=e.rem=e.add,h=e.mod,d=i.length,m={};let p,g,v,y,b,w,x,$,k;if(c.set(s),n.rem.length&&(b=this.remove(t,n,e)),n.add.length&&u.add(n.add),n.mod.length)for(w={},y=n.mod,x=0,$=y.length;x<$;++x)w[y[x]._index]=1;for(x=0;x<d;++x)k=r[x],(!a[x]||t.modified("fields",x)||n.modified(k.fields))&&(v=k.fname,(p=m[v])||(o[v]=g=LC(),m[v]=p=g.insert(k,n.source,0)),a[x]=RC(g,x,i[x]).onAdd(p,s));for(x=0,$=u.data().length;x<$;++x)b[x]||(c[x]!==s[x]?l.push(x):w[x]&&s[x]!==f&&h.push(x));return u.mask=(1<<d)-1,e},eval(t,n){const e=n.materialize().fork(),r=this._dims.length;let i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},insert(t,n,e){const r=n.add,i=this.value,o=this._dims,a=this._indices,u=t.fields,s={},c=e.add,f=i.size()+r.length,l=o.length;let h,d,m,p=i.size();i.resize(f,l),i.add(r);const g=i.curr(),v=i.prev(),y=i.all();for(h=0;h<l;++h)d=u[h].fname,m=s[d]||(s[d]=a[d].insert(u[h],r,p)),o[h].onAdd(m,g);for(;p<f;++p)v[p]=y,g[p]!==y&&c.push(p)},modify(t,n){const e=n.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let u,s,c;for(u=0,s=a.length;u<s;++u)c=a[u]._index,i[c]!==o&&e.push(c)},remove(t,n,e){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),u=i.all(),s={},c=e.rem,f=n.rem;let l,h,d,m;for(l=0,h=f.length;l<h;++l)d=f[l]._index,s[d]=1,a[d]=m=o[d],o[d]=u,m!==u&&c.push(d);for(d in r)r[d].remove(h,s);return this.reindex(n,h,s),s},reindex(t,n,e){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(n,e);for(const n in r)r[n].reindex(t)}))},update(t,n,e){const r=this._dims,i=t.query,o=n.stamp,a=r.length;let u,s,c=0;for(e.filters=0,s=0;s<a;++s)t.modified("query",s)&&(u=s,++c);if(1===c)c=r[u].one,this.incrementOne(r[u],i[u],e.add,e.rem);else for(s=0,c=0;s<a;++s)t.modified("query",s)&&(c|=r[s].one,this.incrementAll(r[s],i[s],o,e.add),e.rem=e.add);return c},incrementAll(t,n,e,r){const i=this.value,o=i.seen(),a=i.curr(),u=i.prev(),s=t.index(),c=t.bisect(t.range),f=t.bisect(n),l=f[0],h=f[1],d=c[0],m=c[1],p=t.one;let g,v,y;if(l<d)for(g=l,v=Math.min(d,h);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(l>d)for(g=d,v=Math.min(l,m);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;if(h>m)for(g=Math.max(l,m),v=h;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(h<m)for(g=Math.max(d,h),v=m;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;t.range=n.slice()},incrementOne(t,n,e,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),u=t.bisect(n),s=u[0],c=u[1],f=a[0],l=a[1],h=t.one;let d,m,p;if(s<f)for(d=s,m=Math.min(f,c);d<m;++d)p=o[d],i[p]^=h,e.push(p);else if(s>f)for(d=f,m=Math.min(s,l);d<m;++d)p=o[d],i[p]^=h,r.push(p);if(c>l)for(d=Math.max(s,l),m=c;d<m;++d)p=o[d],i[p]^=h,e.push(p);else if(c<l)for(d=Math.max(f,c),m=l;d<m;++d)p=o[d],i[p]^=h,r.push(p);t.range=n.slice()}}),qC.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},mt(qC,_a,{transform(t,n){const e=~(t.ignore||0),r=t.filter,i=r.mask;if(!(i&e))return n.StopPropagation;const o=n.fork(n.ALL),a=r.data(),u=r.curr(),s=r.prev(),c=t=>u[t]&e?null:a[t];return o.filter(o.MOD,c),i&i-1?(o.filter(o.ADD,(t=>{const n=u[t]&e;return!n&&n^s[t]&e?a[t]:null})),o.filter(o.REM,(t=>!(u[t]&e)||s[t]&e?null:a[t]))):(o.filter(o.ADD,c),o.filter(o.REM,(t=>(u[t]&e)===i?a[t]:null))),o.filter(o.SOURCE,(t=>c(t._index)))}});var UC=Object.freeze({__proto__:null,crossfilter:IC,resolvefilter:qC});const WC="Literal",HC="CallExpression";function GC(t){this.type=t}var YC,VC,XC,JC,KC;GC.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case HC:return[t.callee].concat(t.arguments);case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];default:return[]}}(this),e=0,r=n.length;e<r;++e)if(n[e].visit(t))return 1},(YC={})[1]="Boolean",YC[2]="<end>",YC[3]="Identifier",YC[4]="Keyword",YC[5]="Null",YC[6]="Numeric",YC[7]="Punctuator",YC[8]="String",YC[9]="RegularExpression";var QC="Identifier",ZC="Unexpected token %0",tO="Invalid regular expression",nO="Invalid regular expression: missing /",eO="Octal literals are not allowed in strict mode.",rO="ILLEGAL",iO="Disabled.",oO=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]"),aO=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 uO(t,n){if(!t)throw new Error("ASSERT: "+n)}function sO(t){return t>=48&&t<=57}function cO(t){return"0123456789abcdefABCDEF".includes(t)}function fO(t){return"01234567".includes(t)}function lO(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function hO(t){return 10===t||13===t||8232===t||8233===t}function dO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&oO.test(String.fromCharCode(t))}function mO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&aO.test(String.fromCharCode(t))}const pO={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 gO(){for(;XC<JC;){const t=VC.charCodeAt(XC);if(!lO(t)&&!hO(t))break;++XC}}function vO(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)XC<JC&&cO(VC[XC])?(r=VC[XC++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):CO({},ZC,rO);return String.fromCharCode(i)}function yO(){var t,n;for(n=0,"}"===(t=VC[XC])&&CO({},ZC,rO);XC<JC&&cO(t=VC[XC++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&CO({},ZC,rO),n<=65535?String.fromCharCode(n):String.fromCharCode(55296+(n-65536>>10),56320+(n-65536&1023))}function bO(){var t,n;for(t=VC.charCodeAt(XC++),n=String.fromCharCode(t),92===t&&(117!==VC.charCodeAt(XC)&&CO({},ZC,rO),++XC,(t=vO("u"))&&"\\"!==t&&dO(t.charCodeAt(0))||CO({},ZC,rO),n=t);XC<JC&&mO(t=VC.charCodeAt(XC));)++XC,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==VC.charCodeAt(XC)&&CO({},ZC,rO),++XC,(t=vO("u"))&&"\\"!==t&&mO(t.charCodeAt(0))||CO({},ZC,rO),n+=t);return n}function wO(){var t,n,e,r,i=XC,o=VC.charCodeAt(XC),a=VC[XC];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++XC,{type:7,value:String.fromCharCode(o),start:i,end:XC};default:if(61===(t=VC.charCodeAt(XC+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return XC+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:XC};case 33:case 61:return 61===VC.charCodeAt(XC+=2)&&++XC,{type:7,value:VC.slice(i,XC),start:i,end:XC}}}return">>>="===(r=VC.substr(XC,4))?{type:7,value:r,start:i,end:XC+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:7,value:e,start:i,end:XC+=3}:a===(n=e.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===n?{type:7,value:n,start:i,end:XC+=2}:("//"===n&&CO({},ZC,rO),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:i,end:++XC}:void CO({},ZC,rO))}function xO(){var t,n,e;if(uO(sO((e=VC[XC]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=XC,t="","."!==e){if(t=VC[XC++],e=VC[XC],"0"===t){if("x"===e||"X"===e)return++XC,function(t){let n="";for(;XC<JC&&cO(VC[XC]);)n+=VC[XC++];return 0===n.length&&CO({},ZC,rO),dO(VC.charCodeAt(XC))&&CO({},ZC,rO),{type:6,value:parseInt("0x"+n,16),start:t,end:XC}}(n);if(fO(e))return function(t){let n="0"+VC[XC++];for(;XC<JC&&fO(VC[XC]);)n+=VC[XC++];return(dO(VC.charCodeAt(XC))||sO(VC.charCodeAt(XC)))&&CO({},ZC,rO),{type:6,value:parseInt(n,8),octal:!0,start:t,end:XC}}(n);e&&sO(e.charCodeAt(0))&&CO({},ZC,rO)}for(;sO(VC.charCodeAt(XC));)t+=VC[XC++];e=VC[XC]}if("."===e){for(t+=VC[XC++];sO(VC.charCodeAt(XC));)t+=VC[XC++];e=VC[XC]}if("e"===e||"E"===e)if(t+=VC[XC++],"+"!==(e=VC[XC])&&"-"!==e||(t+=VC[XC++]),sO(VC.charCodeAt(XC)))for(;sO(VC.charCodeAt(XC));)t+=VC[XC++];else CO({},ZC,rO);return dO(VC.charCodeAt(XC))&&CO({},ZC,rO),{type:6,value:parseFloat(t),start:n,end:XC}}function $O(){if(gO(),XC>=JC)return{type:2,start:XC,end:XC};const t=VC.charCodeAt(XC);return dO(t)?function(){var t,n;return t=XC,n=92===VC.charCodeAt(XC)?bO():function(){var t,n;for(t=XC++;XC<JC;){if(92===(n=VC.charCodeAt(XC)))return XC=t,bO();if(!mO(n))break;++XC}return VC.slice(t,XC)}(),{type:1===n.length?3:pO.hasOwnProperty(n)?4:"null"===n?5:"true"===n||"false"===n?1:3,value:n,start:t,end:XC}}():40===t||41===t||59===t?wO():39===t||34===t?function(){var t,n,e,r,i="",o=!1;for(uO("'"===(t=VC[XC])||'"'===t,"String literal must starts with a quote"),n=XC,++XC;XC<JC;){if((e=VC[XC++])===t){t="";break}if("\\"===e)if((e=VC[XC++])&&hO(e.charCodeAt(0)))"\r"===e&&"\n"===VC[XC]&&++XC;else switch(e){case"u":case"x":"{"===VC[XC]?(++XC,i+=yO()):i+=vO(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:fO(e)?(0!==(r="01234567".indexOf(e))&&(o=!0),XC<JC&&fO(VC[XC])&&(o=!0,r=8*r+"01234567".indexOf(VC[XC++]),"0123".includes(e)&&XC<JC&&fO(VC[XC])&&(r=8*r+"01234567".indexOf(VC[XC++]))),i+=String.fromCharCode(r)):i+=e}else{if(hO(e.charCodeAt(0)))break;i+=e}}return""!==t&&CO({},ZC,rO),{type:8,value:i,octal:o,start:n,end:XC}}():46===t?sO(VC.charCodeAt(XC+1))?xO():wO():sO(t)?xO():wO()}function kO(){const t=KC;return XC=t.end,KC=$O(),XC=t.end,t}function MO(){const t=XC;KC=$O(),XC=t}function AO(t,n,e){const r=new GC("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=n,r.right=e,r}function DO(t,n){const e=new GC("CallExpression");return e.callee=t,e.arguments=n,e}function SO(t){const n=new GC(QC);return n.name=t,n}function FO(t){const n=new GC("Literal");return n.value=t.value,n.raw=VC.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function EO(t,n,e){const r=new GC("MemberExpression");return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function NO(t,n,e){const r=new GC("Property");return r.key=n,r.value=e,r.kind=t,r}function CO(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,((t,n)=>(uO(n<r.length,"Message reference must be in range"),r[n])));throw(e=new Error(i)).index=XC,e.description=i,e}function OO(t){2===t.type&&CO(t,"Unexpected end of input"),6===t.type&&CO(t,"Unexpected number"),8===t.type&&CO(t,"Unexpected string"),3===t.type&&CO(t,"Unexpected identifier"),4===t.type&&CO(t,"Unexpected reserved word"),CO(t,ZC,t.value)}function _O(t){const n=kO();7===n.type&&n.value===t||OO(n)}function zO(t){return 7===KC.type&&KC.value===t}function BO(t){return 4===KC.type&&KC.value===t}function TO(){XC=KC.start;const t=kO();return 8===t.type||6===t.type?(t.octal&&CO(t,eO),FO(t)):SO(t.value)}function PO(){var t,n,e;return XC=KC.start,3===(t=KC).type?(e=TO(),_O(":"),NO("init",e,HO())):2!==t.type&&7!==t.type?(n=TO(),_O(":"),NO("init",n,HO())):void OO(t)}const jO={if:1};function RO(){var t,n,e;if(zO("("))return function(){_O("(");const t=GO();return _O(")"),t}();if(zO("["))return function(){const t=[];for(XC=KC.start,_O("[");!zO("]");)zO(",")?(kO(),t.push(null)):(t.push(HO()),zO("]")||_O(","));return kO(),function(t){const n=new GC("ArrayExpression");return n.elements=t,n}(t)}();if(zO("{"))return function(){var t,n,e=[],r={},i=String;for(XC=KC.start,_O("{");!zO("}");)n="$"+((t=PO()).key.type===QC?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?CO({},"Duplicate data property in object literal not allowed in strict mode"):r[n]=!0,e.push(t),zO("}")||_O(",");return _O("}"),function(t){const n=new GC("ObjectExpression");return n.properties=t,n}(e)}();if(XC=KC.start,3===(t=KC.type)||jO[KC.value])e=SO(kO().value);else if(8===t||6===t)KC.octal&&CO(KC,eO),e=FO(kO());else{if(4===t)throw new Error(iO);1===t?((n=kO()).value="true"===n.value,e=FO(n)):5===t?((n=kO()).value=null,e=FO(n)):zO("/")||zO("/=")?(e=FO(function(){var t,n,e,r;return KC=null,gO(),t=XC,n=function(){var t,n,e,r;for(uO("/"===(t=VC[XC]),"Regular expression literal must start with a slash"),n=VC[XC++],e=!1,r=!1;XC<JC;)if(n+=t=VC[XC++],"\\"===t)hO((t=VC[XC++]).charCodeAt(0))&&CO({},nO),n+=t;else if(hO(t.charCodeAt(0)))CO({},nO);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||CO({},nO),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";XC<JC&&mO((t=VC[XC]).charCodeAt(0));)++XC,"\\"===t&&XC<JC?CO({},ZC,rO):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&CO({},tO,e),{value:e,literal:n}}(),r=function(t,n){let e=t;n.includes("u")&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,n)=>{if(parseInt(n,16)<=1114111)return"x";CO({},tO)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:XC}}()),MO()):OO(kO())}return e}function LO(){const t=[];if(_O("("),!zO(")"))for(;XC<JC&&(t.push(HO()),!zO(")"));)_O(",");return _O(")"),t}function IO(){_O("[");const t=GO();return _O("]"),t}function qO(){const t=function(){var t;for(t=RO();;)if(zO("."))t=EO(".",t,(_O("."),function(){XC=KC.start;const t=kO();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||OO(t),SO(t.value)}()));else if(zO("("))t=DO(t,LO());else{if(!zO("["))break;t=EO("[",t,IO())}return t}();if(7===KC.type&&(zO("++")||zO("--")))throw new Error(iO);return t}function UO(){var t,n;if(7!==KC.type&&4!==KC.type)n=qO();else{if(zO("++")||zO("--"))throw new Error(iO);if(zO("+")||zO("-")||zO("~")||zO("!"))t=kO(),n=UO(),n=function(t,n){const e=new GC("UnaryExpression");return e.operator=t,e.argument=n,e.prefix=!0,e}(t.value,n);else{if(BO("delete")||BO("void")||BO("typeof"))throw new Error(iO);n=qO()}}return n}function WO(t){let n=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function HO(){var t,n;return t=function(){var t,n,e,r,i,o,a,u,s,c;if(t=KC,s=UO(),0===(i=WO(r=KC)))return s;for(r.prec=i,kO(),n=[t,KC],o=[s,r,a=UO()];(i=WO(KC))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),n.pop(),e=AO(u,s,a),o.push(e);(r=kO()).prec=i,o.push(r),n.push(KC),e=UO(),o.push(e)}for(e=o[c=o.length-1],n.pop();c>1;)n.pop(),e=AO(o[c-1].value,o[c-2],e),c-=2;return e}(),zO("?")&&(kO(),n=HO(),_O(":"),t=function(t,n,e){const r=new GC("ConditionalExpression");return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,HO())),t}function GO(){const t=HO();if(zO(","))throw new Error(iO);return t}function YO(t){XC=0,JC=(VC=t).length,KC=null,MO();const n=GO();if(2!==KC.type)throw new Error("Unexpect token after expression.");return n}var VO,XO={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function JO(t){function n(n,e,r){return i=>function(n,e,r,i){let o=t(e[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}const e="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(n){n.length<3&&p("Missing arguments to clamp function."),n.length>3&&p("Too many arguments to clamp function.");const e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),regexp:i,test:n("test",i),if:function(n){n.length<3&&p("Missing arguments to if function."),n.length>3&&p("Too many arguments to if function.");const e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}function KO(t){const n=(t=t||{}).allowed?zt(t.allowed):{},e=t.forbidden?zt(t.forbidden):{},r=t.constants||XO,i=(t.functions||JO)(l),o=t.globalvar,a=t.fieldvar,u=Z(o)?o:t=>`${o}["${t}"]`;let s={},c={},f=0;function l(t){if(xt(t))return t;const n=h[t.type];return null==n&&p("Unsupported type: "+t.type),n(t)}const h={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:ft(e,i)?p("Illegal identifier: "+i):ft(r,i)?r[i]:ft(n,i)?i:(s[i]=1,u(i))},MemberExpression:t=>{const n=!t.computed,e=l(t.object);n&&(f+=1);const r=l(t.property);return e===a&&(c[function(t){const n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(f-=1),e+(n?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&p("Illegal callee type: "+t.callee.type);const n=t.callee.name,e=t.arguments,r=ft(i,n)&&i[n];return r||p("Unrecognized function: "+n),Z(r)?r(e):r+"("+e.map(l).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(l).join(",")+"]",BinaryExpression:t=>"("+l(t.left)+" "+t.operator+" "+l(t.right)+")",UnaryExpression:t=>"("+t.operator+l(t.argument)+")",ConditionalExpression:t=>"("+l(t.test)+"?"+l(t.consequent)+":"+l(t.alternate)+")",LogicalExpression:t=>"("+l(t.left)+t.operator+l(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(l).join(",")+"}",Property:t=>{f+=1;const n=l(t.key);return f-=1,n+":"+l(t.value)}};function d(t){const n={code:l(t),globals:Object.keys(s),fields:Object.keys(c)};return s={},c={},n}return d.functions=i,d.constants=r,d}(VO={})[1]="Boolean",VO[2]="<end>",VO[3]="Identifier",VO[4]="Keyword",VO[5]="Null",VO[6]="Numeric",VO[7]="Punctuator",VO[8]="String",VO[9]="RegularExpression";const QO=Symbol("vega_selection_getter");function ZO(t){return t.getter&&t.getter[QO]||(t.getter=v(t.field),t.getter[QO]=!0),t.getter}const t_="intersect",n_="union",e_="or",r_="and",i_="_vgsid_",o_=v(i_),a_="index:unit";function u_(t,n){for(var e,r,i=n.fields,o=n.values,a=i.length,u=0;u<a;++u)if(vt(e=ZO(r=i[u])(t))&&(e=_(e)),vt(o[u])&&(o[u]=_(o[u])),D(o[u])&&vt(o[u][0])&&(o[u]=o[u].map(_)),"E"===r.type){if(D(o[u])?!o[u].includes(e):e!==o[u])return!1}else if("R"===r.type){if(!pt(e,o[u]))return!1}else if("R-RE"===r.type){if(!pt(e,o[u],!0,!1))return!1}else if("R-E"===r.type){if(!pt(e,o[u],!1,!1))return!1}else if("R-LE"===r.type){if(!pt(e,o[u],!1,!0))return!1}else if("E-LT"===r.type){if(e>=o[u])return!1}else if("E-LTE"===r.type){if(e>o[u])return!1}else if("E-GT"===r.type){if(e<=o[u])return!1}else if("E-GTE"===r.type){if(e<o[u])return!1}else if("E-VALID"===r.type){if(null===e||isNaN(e))return!1}else if("E-ONE"===r.type&&-1===o[u].indexOf(e))return!1;return!0}const s_=Qt(o_),c_=s_.left,f_=s_.right;var l_={[`${i_}_union`]:function(...t){const n=new un;for(const e of t)for(const t of e)n.add(t);return n},[`${i_}_intersect`]:function(t,...n){t=new un(t),n=n.map(Nn);t:for(const e of t)for(const r of n)if(!r.has(e)){t.delete(e);continue t}return t},E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.includes(n[e])||t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter((t=>n.includes(t))):n},R_union:function(t,n){var e=_(n[0]),r=_(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=_(n[0]),r=_(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};function h_(t,n,e,r){"Literal"!==n[0].type&&p("First argument to selection functions must be a string literal.");const i=n[0].value,o="unit",a="@"+o,u=":"+i;(n.length>=2&&O(n).value)!==t_||ft(r,a)||(r[a]=e.getData(i).indataRef(e,o)),ft(r,u)||(r[u]=e.getData(i).tuplesRef())}function d_(t){const n=this.context.data[t];return n?n.values.value:[]}const m_=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},p_=m_("format"),g_=m_("timeFormat"),v_=m_("utcFormat"),y_=m_("timeParse"),b_=m_("utcParse"),w_=new Date(2e3,0,1);function x_(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(w_.setYear(2e3),w_.setMonth(t),w_.setDate(n),g_.call(this,w_,e)):""}function $_(t,n,e,r){n[0].type!==WC&&p("First argument to data functions must be a string literal.");const i=n[0].value,o=":"+i;if(!ft(o,r))try{r[o]=e.getData(i).tuplesRef()}catch(t){}}function k_(t,n,e,r){if(n[0].type===WC)M_(e,r,n[0].value);else for(t in e.scales)M_(e,r,t)}function M_(t,n,e){const r="%"+e;if(!ft(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}function A_(t,n){if(xt(t)){const r=n.scales[t];return r&&((e=r.value)&&!0===e[Zp])?r.value:void 0}var e}function D_(t,n){return function(e,r,i){if(e){const n=A_(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const S_=D_("area",(function(t){return sM=new on,Wk(t,cM),2*sM})),F_=D_("bounds",(function(t){var n,e,r,i,o,a,u;if(Zk=Qk=-(Jk=Kk=1/0),oM=[],Wk(t,PM),e=oM.length){for(oM.sort(GM),n=1,o=[r=oM[0]];n<e;++n)YM(r,(i=oM[n])[0])||YM(r,i[1])?(HM(r[0],i[1])>HM(r[0],r[1])&&(r[1]=i[1]),HM(i[0],r[1])>HM(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)(u=HM(r[1],(i=o[n])[0]))>a&&(a=u,Jk=i[0],Qk=r[1])}return oM=aM=null,Jk===1/0||Kk===1/0?[[NaN,NaN],[NaN,NaN]]:[[Jk,Kk],[Qk,Zk]]})),E_=D_("centroid",(function(t){xM=$M=kM=MM=AM=DM=SM=FM=0,EM=new on,NM=new on,CM=new on,Wk(t,VM);var n=+EM,e=+NM,r=+CM,i=Ek(n,e,r);return i<gk&&(n=DM,e=SM,r=FM,$M<pk&&(n=kM,e=MM,r=AM),(i=Ek(n,e,r))<gk)?[NaN,NaN]:[Ak(e,n)*xk,Pk(r/i)*xk]}));function N_(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function C_(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function O_(t){const n=Uf(t);return.2126*C_(n.r)+.7152*C_(n.g)+.0722*C_(n.b)}function __(t,n){return t===n||t!=t&&n!=n||(D(t)?!(!D(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!__(t[e],n[e]))return!1;return!0}(t,n):!(!S(t)||!S(n))&&z_(t,n))}function z_(t,n){for(const e in t)if(!__(t[e],n[e]))return!1;return!0}function B_(t){return n=>z_(t,n)}const T_={};function P_(t){return D(t)||ArrayBuffer.isView(t)?t:null}function j_(t){return P_(t)||(xt(t)?t:null)}const R_=t=>t.data;function L_(t,n){const e=d_.call(n,t);return e.root&&e.root.lookup||{}}const I_=()=>"undefined"!=typeof window&&window||null;function q_(t,n,e){if(!t)return[];const[r,i]=t,o=(new Lv).set(r[0],r[1],i[0],i[1]);return Mx(e||this.context.dataflow.scenegraph().root,o,function(t){let n=null;if(t){const e=K(t.marktype),r=K(t.markname);n=t=>(!e.length||e.some((n=>t.marktype===n)))&&(!r.length||r.some((n=>t.name===n)))}return n}(n))}const U_={random:()=>qa(),cumulativeNormal:Ja,cumulativeLogNormal:eu,cumulativeUniform:su,densityNormal:Xa,densityLogNormal:nu,densityUniform:uu,quantileNormal:Ka,quantileLogNormal:ru,quantileUniform:cu,sampleNormal:Va,sampleLogNormal:tu,sampleUniform:au,isArray:D,isBoolean:gt,isDate:vt,isDefined:t=>void 0!==t,isNumber:bt,isObject:S,isRegExp:wt,isString:xt,isTuple:ta,isValid:t=>null!=t&&t==t,toBoolean:Nt,toDate:t=>Ot(t),toNumber:_,toString:_t,indexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).indexOf(...e)},join:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return P_(t).join(...e)},lastindexof:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).lastIndexOf(...e)},replace:function(t,n,e){return Z(e)&&p("Function argument passed to replace."),String(t).replace(n,e)},reverse:function(t){return P_(t).slice().reverse()},sort:function(t){return P_(t).slice().sort(nt)},slice:function(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return j_(t).slice(...e)},flush:dt,lerp:kt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),ut(...t)},pad:St,peek:O,pluck:function(t,n){const e=T_[n]||(T_[n]=v(n));return D(t)?t.map(e):e(t)},span:Ft,inrange:pt,truncate:Bt,rgb:Uf,lab:hl,hcl:yl,hsl:Qf,luminance:O_,contrast:function(t,n){const e=O_(t),r=O_(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:Fn,format:p_,utcFormat:v_,utcParse:b_,utcOffset:ar,utcSequence:cr,timeFormat:g_,timeParse:y_,timeOffset:or,timeSequence:sr,timeUnitSpecifier:Ce,monthFormat:function(t){return x_.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return x_.call(this,t,1,"%b")},dayFormat:function(t){return x_.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return x_.call(this,0,2+t,"%a")},quarter:X,utcquarter:J,week:Be,utcweek:Ie,dayofyear:ze,utcdayofyear:Le,warn:function(){return N_(this.context.dataflow,"warn",arguments)},info:function(){return N_(this.context.dataflow,"info",arguments)},debug:function(){return N_(this.context.dataflow,"debug",arguments)},extent:t=>st(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:q_,clampRange:Q,pinchDistance:function(t){const n=t.touches;return Math.hypot(n[0].clientX-n[1].clientX,n[0].clientY-n[1].clientY)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=I_();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=I_();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return Dp(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow;return e.pulse(this.context.data[t].input,e.changeset().remove($).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?cv(e,n=n||Qg(t)):t}},panLinear:L,panLog:I,panPow:q,panSymlog:U,zoomLinear:H,zoomLog:G,zoomPow:Y,zoomSymlog:V,encode:function(t,n,e){if(t){const e=this.context.dataflow;e.pulse(t.mark.source,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,c=a.stamp();let f,l,h=u.changes;if(!1===a._trigger||!(s.value.length||n||r))return 0;if((!h||h.stamp<c)&&(u.changes=h=a.changeset(),h.stamp=c,a.runAfter((()=>{u.modified=!0,a.pulse(s,h).run()}),!0,1)),e&&(f=!0===e?$:D(e)||ta(e)?e:B_(e),h.remove(f)),n&&h.insert(n),r&&(f=B_(r),s.value.some(f)?h.remove(f):h.insert(r)),i)for(l in o)h.modify(i,l,o[l]);return 1},lassoAppend:function(t,n,e){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const i=(t=K(t))[t.length-1];return void 0===i||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return K(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:o}=e,a=(new Lv).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<a.x1&&(a.x1=t),t>a.x2&&(a.x2=t),e<a.y1&&(a.y1=e),e>a.y2&&(a.y2=e);return a.translate(r,i),q_([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,u]=e[o],[s,c]=e[i];c>n!=u>n&&t<(a-s)*(n-c)/(u-c)+s&&r++}return 1&r}(t.x,t.y,n)))}},W_=["view","item","group","xy","x","y"],H_="this.",G_={},Y_={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Et("$"+t)}]`,functions:function(t){const n=JO(t);W_.forEach((t=>n[t]="event.vega."+t));for(const t in U_)n[t]=H_+t;return ut(n,function(t,n,e){n.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,e._bandwidth=k_,e._range=k_,e._scale=k_;const r=n=>"_["+(n.type===WC?Et("%"+n.value):Et("%")+"+"+t(n))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:n=>`${r(n[0])}(${t(n[1])})`}}(t,U_,G_)),n},constants:XO,visitors:G_},V_=KO(Y_);function X_(t,n,e){return 1===arguments.length?U_[t]:(U_[t]=n,e&&(G_[t]=e),V_&&(V_.functions[t]=H_+t),this)}function J_(t,n){const e={};let r;try{r=YO(t=xt(t)?t:Et(t)+"")}catch(n){p("Expression parse error: "+t)}r.visit((t=>{if(t.type!==HC)return;const r=t.callee.name,i=Y_.visitors[r];i&&i(r,t.arguments,n,e)}));const i=V_(r);return i.globals.forEach((t=>{const r="$"+t;!ft(e,r)&&n.getSignal(t)&&(e[r]=n.signalRef(t))})),{$expr:ut({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}X_("bandwidth",(function(t,n){const e=A_(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}),k_),X_("copy",(function(t,n){const e=A_(t,(n||this).context);return e?e.copy():void 0}),k_),X_("domain",(function(t,n){const e=A_(t,(n||this).context);return e?e.domain():[]}),k_),X_("range",(function(t,n){const e=A_(t,(n||this).context);return e&&e.range?e.range():[]}),k_),X_("invert",(function(t,n,e){const r=A_(t,(e||this).context);return r?D(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}),k_),X_("scale",(function(t,n,e){const r=A_(t,(e||this).context);return r?r(n):void 0}),k_),X_("gradient",(function(t,n,e,r,i){let o="string"==typeof t?A_(t,(i||this).context):t;const a=Wg(n,e);let u=o.domain(),s=u[0],c=O(u),f=b;return c-s?f=mg(o,s,c):o=(o.interpolator?ng("sequential")().interpolator(o.interpolator()):ng("linear")().interpolate(o.interpolate()).range(o.range())).domain([s=0,c=1]),o.ticks&&(u=o.ticks(+r||15),s!==u[0]&&u.unshift(s),c!==O(u)&&u.push(c)),u.forEach((t=>a.stop(f(t),o(t)))),a}),k_),X_("geoArea",S_,k_),X_("geoBounds",F_,k_),X_("geoCentroid",E_,k_),X_("geoShape",(function(t,n,e){const r=A_(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}),k_),X_("geoScale",(function(t,n){const e=A_(t,(n||this).context);return e&&e.scale()}),k_),X_("indata",(function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}),(function(t,n,e,r){n[0].type!==WC&&p("First argument to indata must be a string literal."),n[1].type!==WC&&p("Second argument to indata must be a string literal.");const i=n[0].value,o=n[1].value,a="@"+o;ft(a,r)||(r[a]=e.getData(i).indataRef(e,o))})),X_("data",d_,$_),X_("treePath",(function(t,n,e){const r=L_(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(R_):void 0}),$_),X_("treeAncestors",(function(t,n){const e=L_(t,this)[n];return e?e.ancestors().map(R_):void 0}),$_),X_("vlSelectionTest",(function(t,n,e){for(var r,i,o,a,u,s=this.context.data[t],c=s?s.values.value:[],f=s?s[a_]&&s[a_].value:void 0,l=e===t_,h=c.length,d=0;d<h;++d)if(r=c[d],f&&l){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(u=u_(n,r),i[a]=u?-1:++o,u&&1===f.size)return!0;if(!u&&o===f.get(a).count)return!1}else if(l^(u=u_(n,r)))return u;return h&&l}),h_),X_("vlSelectionIdTest",(function(t,n,e){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[a_]&&r[a_].value:void 0,a=e===t_,u=o_(n),s=c_(i,u);if(s===i.length)return!1;if(o_(i[s])!==u)return!1;if(o&&a){if(1===o.size)return!0;if(f_(i,u)-s<o.size)return!1}return!0}),h_),X_("vlSelectionResolve",(function(t,n,e,r){for(var i,o,a,u,s,c,f,l,h,d,m,p=this.context.data[t],g=p?p.values.value:[],v={},y={},b={},w=g.length,x=0;x<w;++x)if(u=(i=g[x]).unit,a=i.values,(o=i.fields)&&a){for(d=0,m=o.length;d<m;++d)l=(f=v[(s=o[d]).field]||(v[s.field]={}))[u]||(f[u]=[]),b[s.field]=h=s.type.charAt(0),f[u]=(0,l_[`${h}_union`])(l,K(a[d]));e&&(l=y[u]||(y[u]=[])).push(K(a).reduce(((t,n,e)=>(t[o[e].field]=n,t)),{}))}else s=i_,c=o_(i),(l=(f=v[s]||(v[s]={}))[u]||(f[u]=[])).push(c),e&&(l=y[u]||(y[u]=[])).push({[i_]:c});return n=n||n_,v[i_]?v[i_]=l_[`${i_}_${n}`](...Object.values(v[i_])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((n=>v[t][n])).reduce(((e,r)=>void 0===e?r:l_[`${b[t]}_${n}`](e,r)))})),g=Object.keys(y),e&&g.length&&(v[r?"vlPoint":"vlMulti"]=n===n_?{[e_]:g.reduce(((t,n)=>(t.push(...y[n]),t)),[])}:{[r_]:g.map((t=>({[e_]:y[t]})))}),v}),h_),X_("vlSelectionTuples",(function(t,n){return t.map((t=>ut(n.fields?{values:n.fields.map((n=>ZO(n)(t.datum)))}:{[i_]:o_(t.datum)},n)))}));const K_=zt(["rule"]),Q_=zt(["group","image","rect"]);function Z_(t){return(t+"").toLowerCase()}function tz(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var nz={operator:(t,n)=>tz(t,["_"],n.code),parameter:(t,n)=>tz(t,["datum","_"],n.code),event:(t,n)=>tz(t,["event"],n.code),handler:(t,n)=>tz(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const n="o["+Et(t)+"]";i+=`$=${r[t].code};if(${n}!==$)${n}=$,m=1;`}return i+=function(t,n){let e="";return K_[n]||(t.x2&&(t.x?(Q_[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(Q_[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;")),e}(r,e),i+="return m;",tz(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(Et).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=n[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((e=e||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,n,e,r){return`((u = ${t}) < (v = ${n}) || u == null) && v != null ? ${e}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${e}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return e?r.bind(e):r}}};function ez(t,n,e){if(!t||!S(t))return t;for(let r,i=0,o=rz.length;i<o;++i)if(r=rz[i],ft(t,r.key))return r.parse(t,n,e);return t}var rz=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||p("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){const e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=$t(t.$key,t.$flat,n.expr.codegen))}},{key:"$expr",parse:function(t,n,e){t.$params&&n.parseParameters(t.$params,e);const r="e:"+t.$expr.code;return n.fn[r]||(n.fn[r]=c(n.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;const e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=v(t.$field,t.$name,n.expr.codegen))}},{key:"$encode",parse:function(t,n){const e=t.$encode,r={};for(const t in e){const i=e[t];r[t]=c(n.encodeExpression(i.$expr),i.$fields),r[t].output=i.$output}return r}},{key:"$compare",parse:function(t,n){const e="c:"+t.$compare+"_"+t.$order,r=K(t.$compare).map((t=>t&&t.$tupleid?na:t));return n.fn[e]||(n.fn[e]=tt(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(t,r,i){const o=n.fork().parse(e),a=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>n.detach(o),a}}},{key:"$tupleid",parse:function(){return na}}];const iz={skip:!0};function oz(t,n,e,r){return new az(t,n,e,r)}function az(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||nz,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function uz(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function sz(t,n){t&&(null==n?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}az.prototype=uz.prototype={fork(){const t=new uz(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((n=>n!==t));const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(t){return"collect"===Z_(t)}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let i=e.get(t.parent.$ref);i?(r.connect(i,[n]),n.targets().add(i)):(e.unresolved=e.unresolved||[]).push((()=>{i=e.get(t.parent.$ref),r.connect(i,[n]),n.targets().add(i)}))}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const r in t.data){const i=e.data[r]||(e.data[r]={});t.data[r].forEach((t=>i[t]=n))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[Z_(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach((t=>n.parseOperator(t))),e.forEach((t=>n.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>n.parseStream(t))),(t.updates||[]).forEach((t=>n.parseUpdate(t))),n.resolve()},parseOperator:function(t){const n=this;!function(t){return"operator"===Z_(t)}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||p("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=D(i)?i.map((t=>ez(t,e,n))):ez(i,e,n)}return n},parseStream:function(t){var n,e=this,r=null!=t.filter?e.eventExpression(t.filter):void 0,i=null!=t.stream?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map((t=>e.get(t))))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map((t=>e.get(t))),i=i.between(n[0],n[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&p("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=S(r=t.source)?r.$ref:r,i=e.get(r),o=t.update,a=void 0;i||p("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),o&&o.$expr&&(o.$params&&(a=e.parseParameters(o.$params)),o=e.handlerExpression(o.$expr)),e.update(t,i,n,o,a)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach((e=>{const i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)}))}if(t.data){var i=e.data={};Object.keys(n.data).forEach((e=>{const r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)}))}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map((n=>n.getState(t)))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{e.update(n.signals[t],i[t],iz)})),Object.keys(r||{}).forEach((t=>{e.pulse(n.data[t].input,e.changeset().remove($).insert(r[t]))})),(t.subcontext||[]).forEach(((t,e)=>{const r=n.subcontext[e];r&&r.setState(t)}))}};const cz="default";function fz(t,n){const e=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(e)return null==n?e.style.removeProperty("cursor"):e.style.cursor=n}function lz(t,n){var e=t._runtime.data;return ft(e,n)||p("Unrecognized data set: "+n),e[n]}function hz(t,n){sa(n)||p("Second argument to changes must be a changeset.");const e=lz(this,t);return e.modified=!0,this.pulse(e.input,n)}function dz(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function mz(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function pz(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}const gz="view",vz={trap:!1};function yz(t,n,e,r){t._eventListeners.push({type:e,sources:K(n),handler:r})}function bz(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(!1===r||S(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function wz(t){return t.item}function xz(t){return t.item.mark.source}function $z(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function kz(t,n,e){const r=document.createElement(t);for(const t in n)r.setAttribute(t,n[t]);return null!=e&&(r.textContent=e),r}function Mz(t,n,e,r){const i=e.event||"input",o=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,o),yz(r,n,i,o),t.set=t=>{n.value=t,n.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function Az(t,n,e,r){const i=r.signal(e.signal),o=kz("div",{class:"vega-bind"}),a="radio"===e.input?o:o.appendChild(kz("label"));a.appendChild(kz("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(o);let u=Dz;switch(e.input){case"checkbox":u=Sz;break;case"select":u=Fz;break;case"radio":u=Ez;break;case"range":u=Nz}u(t,a,e,i)}function Dz(t,n,e,r){const i=kz("input");for(const t in e)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,e[t]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function Sz(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const o=kz("input",i);n.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function Fz(t,n,e,r){const i=kz("select",{name:e.signal}),o=e.labels||[];e.options.forEach(((t,n)=>{const e={value:t};Cz(t,r)&&(e.selected=!0),i.appendChild(kz("option",e,(o[n]||t)+""))})),n.appendChild(i),i.addEventListener("change",(()=>{t.update(e.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let n=0,r=e.options.length;n<r;++n)if(Cz(e.options[n],t))return void(i.selectedIndex=n)}}function Ez(t,n,e,r){const i=kz("span",{class:"vega-bind-radio"}),o=e.labels||[];n.appendChild(i),t.elements=e.options.map(((n,a)=>{const u={type:"radio",name:e.signal,value:n};Cz(n,r)&&(u.checked=!0);const s=kz("input",u);s.addEventListener("change",(()=>t.update(n)));const c=kz("label",{},(o[a]||n)+"");return c.prepend(s),i.appendChild(c),s})),t.set=n=>{const e=t.elements,r=e.length;for(let t=0;t<r;++t)Cz(e[t].value,n)&&(e[t].checked=!0)}}function Nz(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;const i=null!=e.max?e.max:Math.max(100,+r)||100,o=e.min||Math.min(0,i,+r)||0,a=e.step||bn(o,i,100),u=kz("input",{type:"range",name:e.signal,min:o,max:i,step:a});u.value=r;const s=kz("span",{},+r);n.appendChild(u),n.appendChild(s);const c=()=>{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",c),u.addEventListener("change",c),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function Cz(t,n){return t===n||t+""==n+""}function Oz(t,n,e,r,i,o){return(n=n||new r(t.loader())).initialize(e,dz(t),mz(t),pz(t),i,o).background(t.background())}function _z(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function zz(t,n,e){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(e){n=null,t.error(e)}return n}const Bz=t=>+t||0;function Tz(t){return S(t)?{top:Bz(t.top),bottom:Bz(t.bottom),left:Bz(t.left),right:Bz(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(Bz(t))}async function Pz(t,n,e,r){const i=kx(n),o=i&&i.headless;return o||p("Unrecognized renderer type: "+n),await t.runAsync(),Oz(t,null,null,o,e,r).renderAsync(t._scenegraph.root)}var jz="width",Rz="height",Lz="padding",Iz={skip:!0};function qz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===Lz?r.left+r.right:0)}function Uz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===Lz?r.top+r.bottom:0)}function Wz(t,n){return n.modified&&D(n.input.value)&&!t.startsWith("_:vega:_")}function Hz(t,n){return!("parent"===t||n instanceof za.proxy)}function Gz(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":D(t)?Yz(t):S(t)&&!vt(t)?(n=t,Object.keys(n).map((t=>{const e=n[t];return t+": "+(D(e)?Yz(e):Vz(e))})).join("\n")):t+"";var n}(r))}function Yz(t){return"["+t.map(Vz).join(", ")+"]"}function Vz(t){return D(t)?"[…]":S(t)&&!vt(t)?"{…}":t}function Xz(t,n){const e=this;if(n=n||{},Ca.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),null!=n.logLevel&&e.logLevel(n.logLevel),n.locale||t.locale){const r=ut({},t.locale,n.locale);e.locale(ko(r.number,r.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||xx.Canvas,e._scenegraph=new Hb;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Gz,e._redraw=!0,e._handler=(new $w).scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(t){const n=ut({defaults:{}},t),e=(t,n)=>{n.forEach((n=>{D(t[n])&&(t[n]=zt(t[n]))}))};return e(n.defaults,["prevent","allow"]),e(n,["view","window","selector"]),n}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(t,n,e){return oz(t,za,U_,e).parse(n)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map((t=>({state:null,param:ut({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=qz(e,e._width),e._viewHeight=Uz(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(t){var n=t._signals,e=n[jz],r=n[Rz],i=n[Lz];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(n=>{t._width=n.size,t._viewWidth=qz(t,n.size),o()}),{size:e}),t._resizeHeight=t.add(null,(n=>{t._height=n.size,t._viewHeight=Uz(t,n.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(e),function(t){t.add(null,(n=>(t._background=n.bg,t._resize=1,n.bg)),{bg:t._signals.background})}(e),function(t){const n=t._signals.cursor||(t._signals.cursor=t.add({user:cz,item:null}));t.on(t.events("view","pointermove"),n,((t,e)=>{const r=n.value,i=r?xt(r)?r:r.user:cz,o=e.item&&e.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(n){let e=n.cursor,r=this.value;return xt(e)||(r=e.item,e=e.user),fz(t,e&&e!==cz?e:r||e),r}),{cursor:n})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function Jz(t,n){return ft(t._signals,n)?t._signals[n]:p("Unrecognized signal name: "+Et(n))}function Kz(t,n){const e=(t._targets||[]).filter((t=>t._update&&t._update.handler===n));return e.length?e[0]:null}function Qz(t,n,e,r){let i=Kz(e,r);return i||(i=_z(t,(()=>r(n,e.value))),i.handler=r,t.on(e,null,i)),t}function Zz(t,n,e){const r=Kz(n,e);return r&&n._targets.remove(r),t}mt(Xz,Ca,{async evaluate(t,n,e){if(await Ca.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var n=pz(t),e=dz(t),r=mz(t);t._renderer.background(t.background()),t._renderer.resize(e,r,n),t._handler.origin(n),t._resizeListeners.forEach((n=>{try{n(e,r)}catch(n){t.error(n)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return e&&Ko(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=null!=t?t+"":null;return n!==this._desc&&sz(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=Jz(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",Tz(t)):Tz(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(kx(t)||p("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(Ca.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Jz(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==e&&(u=1,a.signal(jz,e,Iz),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(Rz,r,Iz),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==n&&(a._resize=1,a._viewHeight=n),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,n,e){let r=n;return e&&!1===e.trap||(r=_z(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(e=i[o].handler,t===(r=i[o].type)&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return Qz(this,t,Jz(this,t),n)},removeSignalListener(t,n){return Zz(this,Jz(this,t),n)},addDataListener(t,n){return Qz(this,t,lz(this,t).values,n)},removeDataListener(t,n){return Zz(this,lz(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=fz(this,null);this._globalCursor=!!t,n&&fz(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(t,n,e){var r=new BF,i=n;return null==n?(r.restart(t,n,e),r):(r._restart=r.restart,r.restart=function(t,n,e){n=+n,e=null==e?_F():+e,r._restart((function o(a){a+=i,r._restart(o,i+=n,e),t(a)}),n,e)},r.restart(t,n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},events:function(t,n,e){var r,i=this,o=new va(e),a=function(e,r){i.runAsync(null,(()=>{t===gz&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),o.receive(function(t,n,e){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=pz(t),(r=Qb(n.changedTouches?n.changedTouches[0]:n,a))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(t,n,e){const r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return e;xt(t)&&(t=i(t));const n=e.slice();for(;t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:ot(t),item:ot(n||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,e,r),n}(i,e,r))}))};if("timer"===t)bz(i,"timer",n)&&i.timer(a,n);else if(t===gz)bz(i,"view",n)&&i.addEventListener(n,a,vz);else if("window"===t?bz(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&bz(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var u=0,s=r.length;u<s;++u)r[u].addEventListener(n,a);yz(i,r,n,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,n,e,r=this._tooltip,i=this._timers,o=this._handler.handlers(),a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(r&&r.call(this,this._handler,null,null,null),t=o.length;--t>=0;)this._handler.off(o[t].type,o[t].handler);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",wz),xz,$z(t)),this.on(this.events("view","pointerout",wz),xz,$z(n)),this},data:function(t,n){return arguments.length<2?lz(this,t).values.value:hz.call(this,t,ca().remove($).insert(n))},change:hz,insert:function(t,n){return hz.call(this,t,ca().insert(n))},remove:function(t,n){return hz.call(this,t,ca().remove(n))},scale:function(t){var n=this._runtime.scales;return ft(n,t)||p("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,o=kx(r);t=e._el=t?zz(e,t,!0):null,function(t){const n=t.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),sz(n,t.description()))}(e),o||e.error("Unrecognized renderer type: "+r);const a=o.handler||$w,u=t?o.renderer:o.headless;return e._renderer=u?Oz(e,e._renderer,t,u):null,e._handler=function(t,n,e,r){const i=new r(t.loader(),_z(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,pz(t),t);return n&&n.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(e,e._handler,t,a),e._redraw=!0,t&&"none"!==i&&(n=n?e._elBind=zz(e,n,!0):t.appendChild(kz("form",{class:"vega-bindings"})),e._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=zz(e,t.param.element,!!t.param.input))})),e._bind.forEach((t=>{!function(t,n,e){if(!n)return;const r=e.param;let i=e.state;i||(i=e.state={elements:null,active:!1,set:null,update:n=>{n!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,n)}))}},r.debounce&&(i.update=at(r.debounce,i.update))),(null==r.input&&r.element?Mz:Az)(i,n,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(e,t.element||n,t)}))),e},toImageURL:async function(t,n){t!==xx.Canvas&&t!==xx.SVG&&t!==xx.PNG&&p("Unrecognized image type: "+t);const e=await Pz(this,t,n);return t===xx.SVG?function(t){const n=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(e.svg()):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await Pz(this,xx.Canvas,t,n)).canvas()},toSVG:async function(t){return(await Pz(this,xx.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:Wz,signals:Hz,recurse:!0})},setState:function(t){return this.runAsync(null,(n=>{n._trigger=!1,n._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const n=()=>{null!=t&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const tB=/[[\]{}]/,nB={"*":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 eB,rB;function iB(t,n,e){return eB=n||"view",rB=e||nB,aB(t.trim()).map(uB)}function oB(t,n,e,r,i){const o=t.length;let a,u=0;for(;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return n}function aB(t){const n=[],e=t.length;let r=0,i=0;for(;i<e;)i=oB(t,i,",","[{","]}"),n.push(t.substring(r,i).trim()),r=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function uB(t){return"["===t[0]?function(t){const n=t.length;let e,r=1;if(r=oB(t,r,"]","[","]"),r===n)throw"Empty between selector: "+t;if(e=aB(t.substring(1,r)),2!==e.length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;e=e.map(uB);const i=uB(t.slice(1).trim());return i.between?{between:e,stream:i}:(i.between=e,i)}(t):function(t){const n={source:eB},e=[];let r,i,o=[0,0],a=0,u=0,s=t.length,c=0;if("}"===t[s-1]){if(c=t.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+t;try{o=function(t){const n=t.split(",");if(!t.length||n.length>2)throw t;return n.map((n=>{const e=+n;if(e!=e)throw t;return e}))}(t.substring(c+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,c).trim()).length,c=0}if(!s)throw t;if("@"===t[0]&&(a=++c),r=oB(t,c,":"),r<s&&(e.push(t.substring(u,r).trim()),u=c=++r),c=oB(t,c,"["),c===s)e.push(t.substring(u,s).trim());else if(e.push(t.substring(u,c).trim()),i=[],u=++c,u===s)throw"Unmatched left bracket: "+t;for(;c<s;){if(c=oB(t,c,"]"),c===s)throw"Unmatched left bracket: "+t;if(i.push(t.substring(u,c).trim()),c<s-1&&"["!==t[++c])throw"Expected left bracket: "+t;u=++c}if(!(s=e.length)||tB.test(e[s-1]))throw"Invalid event selector: "+t;return s>1?(n.type=e[1],a?n.markname=e[0].slice(1):function(t){return rB[t]}(e[0])?n.marktype=e[0]:n.source=e[0]):n.type=e[0],"!"===n.type.slice(-1)&&(n.consume=!0,n.type=n.type.slice(0,-1)),null!=i&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}(t)}function sB(t){return S(t)?t:{type:t||"pad"}}const cB=t=>+t||0;function fB(t){return S(t)?t.signal?t:{top:cB(t.top),bottom:cB(t.bottom),left:cB(t.left),right:cB(t.right)}:{top:n=cB(t),bottom:n,left:n,right:n};var n}const lB=t=>S(t)&&!D(t)?ut({},t):{value:t};function hB(t,n,e,r){return null!=e?(S(e)&&!D(e)||D(e)&&e.length&&S(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function dB(t,n,e){for(const e in n)hB(t,e,n[e]);for(const n in e)hB(t,n,e[n],"update")}function mB(t,n,e){for(const r in n)e&&ft(e,r)||(t[r]=ut(t[r]||{},n[r]));return t}function pB(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const gB="mark",vB="frame",yB="scope",bB="legend-label";function wB(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const xB=t=>xt(t)?Et(t):t.signal?`(${t.signal})`:AB(t);function $B(t){if(null!=t.gradient)return function(t){const n=[t.start,t.stop,t.count].map((t=>null==t?null:Et(t)));for(;n.length&&null==O(n);)n.pop();return n.unshift(xB(t.gradient)),`gradient(${n.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(t){return t.c?kB("hcl",t.h,t.c,t.l):t.h||t.s?kB("hsl",t.h,t.s,t.l):t.l||t.a?kB("lab",t.l,t.a,t.b):t.r||t.g||t.b?kB("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?AB(t.field):void 0!==t.value?Et(t.value):void 0;return null!=t.scale&&(n=function(t,n){const e=xB(t.scale);return null!=t.range?n=`lerp(_range(${e}), ${+t.range})`:(void 0!==n&&(n=`_scale(${e}, ${n})`),t.band&&(n=(n?n+"+":"")+`_bandwidth(${e})`+(1==+t.band?"":"*"+MB(t.band)),t.extra&&(n=`(datum.extra ? _scale(${e}, datum.extra.value) : ${n})`)),null==n&&(n="0")),n}(t,n)),void 0===n&&(n=null),null!=t.exponent&&(n=`pow(${n},${MB(t.exponent)})`),null!=t.mult&&(n+=`*${MB(t.mult)}`),null!=t.offset&&(n+=`+${MB(t.offset)}`),t.round&&(n=`round(${n})`),n}const kB=(t,n,e,r)=>`(${t}(${[n,e,r].map($B).join(",")})+'')`;function MB(t){return S(t)?"("+$B(t)+")":t}function AB(t){return DB(S(t)?t:{datum:t})}function DB(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):p("Invalid field reference: "+Et(t));return t.signal||(r=xt(r)?g(r).map(Et).join("]["):DB(r)),n+"["+r+"]"}function SB(t,n,e,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,n,e,r,i){const o={},a={};let u,s,c,f;for(s in s="lineBreak","text"!==n||null==i[s]||pB(s,t)||wB(o,s,i[s]),("legend"==e||String(e).startsWith("axis"))&&(e=null),f=e===vB?i.group:e===gB?ut({},i.mark,i[n]):null,f)c=pB(s,t)||("fill"===s||"stroke"===s)&&(pB("fill",t)||pB("stroke",t)),c||wB(o,s,f[s]);for(s in K(r).forEach((n=>{const e=i.style&&i.style[n];for(const n in e)pB(n,t)||wB(o,n,e[n])})),t=ut({},t),o)f=o[s],f.signal?(u=u||{})[s]=f:a[s]=f;return t.enter=ut(a,t.enter),u&&(t.update=ut(u,t.update)),t}(t,n,e,r,i.config);for(const e in t)a[e]=FB(t[e],n,o,i);return o}function FB(t,n,e,r){const i={},o={};for(const n in t)null!=t[n]&&(i[n]=EB(D(a=t[n])?function(t){let n="";return t.forEach((t=>{const e=$B(t);n+=t.test?`(${t.test})?${e}:`:e})),":"===O(n)&&(n+="null"),n}(a):$B(a),r,e,o));var a;return{$expr:{marktype:n,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function EB(t,n,e,r){const i=J_(t,n);return i.$fields.forEach((t=>r[t]=1)),ut(e,i.$params),i.$expr}const NB=["value","update","init","react","bind"];function CB(t,n){p(t+' for "outer" push: '+Et(n))}function OB(t,n){const e=t.name;if("outer"===t.push)n.signals[e]||CB("No prior signal definition",e),NB.forEach((n=>{void 0!==t[n]&&CB("Invalid property ",n)}));else{const r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function _B(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function zB(t,n,e,r){return new _B(t,n,e,r)}function BB(t,n){return zB("operator",t,n)}function TB(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function PB(t,n){return n?{$field:t,$name:n}:{$field:t}}const jB=PB("key");function RB(t,n){return{$compare:t,$order:n}}function LB(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const IB="scope",qB="view";function UB(t){return t&&t.signal}function WB(t){if(UB(t))return!0;if(S(t))for(const n in t)if(WB(t[n]))return!0;return!1}function HB(t,n){return null!=t?t:n}function GB(t){return t&&t.signal||t}const YB="timer";function VB(t,n){return(t.merge?XB:t.stream?JB:t.type?KB:p("Invalid stream specification: "+Et(t)))(t,n)}function XB(t,n){const e=QB({merge:t.merge.map((t=>VB(t,n)))},t,n);return n.addStream(e).id}function JB(t,n){const e=QB({stream:VB(t.stream,n)},t,n);return n.addStream(e).id}function KB(t,n){let e;t.type===YB?(e=n.event(YB,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return t===IB?qB:t||qB}(t.source),t.type);const r=QB({stream:e},t,n);return 1===Object.keys(r).length?e:n.addStream(r).id}function QB(t,n,e){let r=n.between;return r&&(2!==r.length&&p('Stream "between" parameter must have 2 entries: '+Et(n)),t.between=[VB(r[0],e),VB(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===IB&&r.push("inScope(event.item)"),r.length&&(t.filter=J_("("+r.join(")&&(")+")",e).$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const ZB={code:"_.$value",ast:{type:"Identifier",value:"value"}};function tT(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const nT=t=>(n,e,r)=>zB(t,e,n||void 0,r),eT=nT("aggregate"),rT=nT("axisticks"),iT=nT("bound"),oT=nT("collect"),aT=nT("compare"),uT=nT("datajoin"),sT=nT("encode"),cT=nT("expression"),fT=nT("facet"),lT=nT("field"),hT=nT("key"),dT=nT("legendentries"),mT=nT("load"),pT=nT("mark"),gT=nT("multiextent"),vT=nT("multivalues"),yT=nT("overlap"),bT=nT("params"),wT=nT("prefacet"),xT=nT("projection"),$T=nT("proxy"),kT=nT("relay"),MT=nT("render"),AT=nT("scale"),DT=nT("sieve"),ST=nT("sortitems"),FT=nT("viewlayout"),ET=nT("values");let NT=0;const CT={min:"min",max:"max",count:"sum"};function OT(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=TT(t.domain,t,n),null!=t.range&&(e.range=WT(t,n,e)),null!=t.interpolate&&function(t,n){n.interpolate=_T(t.type||t),null!=t.gamma&&(n.interpolateGamma=_T(t.gamma))}(t.interpolate,e),null!=t.nice&&(e.nice=function(t,n){return t.signal?n.signalRef(t.signal):S(t)?{interval:_T(t.interval),step:_T(t.step)}:_T(t)}(t.nice,n)),null!=t.bins&&(e.bins=function(t,n){return t.signal||D(t)?zT(t,n):n.objectProperty(t)}(t.bins,n)),t)ft(e,r)||"name"===r||(e[r]=_T(t[r],n))}function _T(t,n){return S(t)?t.signal?n.signalRef(t.signal):p("Unsupported object: "+Et(t)):t}function zT(t,n){return t.signal?n.signalRef(t.signal):t.map((t=>_T(t,n)))}function BT(t){p("Can not find data set: "+Et(t))}function TT(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(D(t)?PT:t.fields?RT:jT)(t,n,e);null==n.domainMin&&null==n.domainMax||p("No scale domain defined for domainMin/domainMax to override.")}function PT(t,n,e){return t.map((t=>_T(t,e)))}function jT(t,n,e){const r=e.getData(t.data);return r||BT(t.data),og(n.type)?r.valuesRef(e,t.field,IT(t.sort,!1)):cg(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function RT(t,n,e){const r=t.data,i=t.fields.reduce(((t,n)=>(n=xt(n)?{data:r,field:n}:D(n)||n.signal?function(t,n){const e="_:vega:_"+NT++,r=oT({});if(D(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Et(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,DT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t)),[]);return(og(n.type)?LT:cg(n.type)?qT:UT)(t,e,i)}function LT(t,n,e){const r=IT(t.sort,!0);let i,o;const a=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.countsRef(n,t.field,r)})),u={groupby:jB,pulse:a};r&&(i=r.op||"count",o=r.field?LB(i,r.field):"count",u.ops=[CT[i]],u.fields=[n.fieldRef(o)],u.as=[o]),i=n.add(eT(u));const s=n.add(oT({pulse:TB(i)}));return o=n.add(ET({field:jB,sort:n.sortRef(r),pulse:TB(s)})),TB(o)}function IT(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!CT[t.op]&&p("Multiple domain scales can not be sorted using "+t.op):p("No field provided for sort aggregate op: "+t.op):S(t)?t.field="key":t={field:"key"}),t}function qT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.domainRef(n,t.field)}));return TB(n.add(vT({values:r})))}function UT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||BT(t.data),e.extentRef(n,t.field)}));return TB(n.add(gT({extents:r})))}function WT(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if(xt(i)){if(r&&ft(r,i))return WT(t=ut({},t,{range:r[i]}),n,e);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=og(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:p("Unrecognized scale range value: "+Et(i))}else{if(i.scheme)return e.scheme=D(i.scheme)?zT(i.scheme,n):_T(i.scheme,n),i.extent&&(e.schemeExtent=zT(i.extent,n)),void(i.count&&(e.schemeCount=_T(i.count,n)));if(i.step)return void(e.rangeStep=_T(i.step,n));if(og(t.type)&&!D(i))return TT(i,t,n);D(i)||p("Unsupported range type: "+Et(i))}return i.map((t=>(D(t)?zT:_T)(t,n)))}function HT(t,n,e){return D(t)?t.map((t=>HT(t,n,e))):S(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:p("Unsupported parameter object: "+Et(t)):t}const GT="top",YT="left",VT="right",XT="bottom",JT="center",KT="index",QT="label",ZT="perc",tP="value",nP="guide-label",eP="guide-title",rP="symbol",iP="gradient",oP="discrete",aP="size",uP=[aP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],sP={name:1,style:1,interactive:1},cP={value:0},fP={value:1},lP="group",hP="rect",dP="rule",mP="text";function pP(t){return t.type=lP,t.interactive=t.interactive||!1,t}function gP(t,n){const e=(e,r)=>HB(t[e],HB(n[e],r));return e.isVertical=e=>"vertical"===HB(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection)),e.gradientLength=()=>HB(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>HB(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>HB(t.columns,HB(n.columns,+e.isVertical(!0))),e}function vP(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function yP(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const bP=yP(Et(YT),Et(VT),Et(JT));function wP(t,n){return n?t?S(t)?Object.assign({},t,{offset:wP(t.offset,n)}):{value:t,offset:n}:n:t}function xP(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=mB(t.encode,n,sP)):t.interactive=!1,t}function $P(t,n,e,r){const i=gP(t,e),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,c,f,l,h;o?(c=[0,1],f=[0,0],l=a,h=u):(c=[0,0],f=[1,0],l=u,h=a);const d={enter:s={opacity:cP,x:cP,y:cP,width:lB(l),height:lB(h)},update:ut({},s,{opacity:fP,fill:{gradient:n,start:c,stop:f}}),exit:{opacity:cP}};return dB(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),xP({type:hP,role:"legend-gradient",encode:d},r)}function kP(t,n,e,r,i){const o=gP(t,e),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let c,f,l,h,d="";a?(c="y",l="y2",f="x",h="width",d="1-"):(c="x",l="x2",f="y",h="height");const m={opacity:cP,fill:{scale:n,field:tP}};m[c]={signal:d+"datum."+ZT,mult:s},m[f]=cP,m[l]={signal:d+"datum.perc2",mult:s},m[h]=lB(u);const p={enter:m,update:ut({},m,{opacity:fP}),exit:{opacity:cP}};return dB(p,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),xP({type:hP,role:"legend-band",key:tP,from:i,encode:p},r)}const MP=`datum.${ZT}<=0?"${YT}":datum.${ZT}>=1?"${VT}":"${JT}"`,AP=`datum.${ZT}<=0?"${XT}":datum.${ZT}>=1?"${GT}":"middle"`;function DP(t,n,e,r){const i=gP(t,n),o=i.isVertical(),a=lB(i.gradientThickness()),u=i.gradientLength();let s,c,f,l,h=i("labelOverlap"),d="";const m={enter:s={opacity:cP},update:c={opacity:fP,text:{field:QT}},exit:{opacity:cP}};return dB(m,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:HB(t.labelLimit,n.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=c.baseline={signal:AP},f="y",l="x",d="1-"):(s.align=c.align={signal:MP},s.baseline={value:"top"},f="x",l="y"),s[f]=c[f]={signal:d+"datum."+ZT,mult:u},s[l]=c[l]=a,a.offset=HB(t.labelOffset,n.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum."+KT}:void 0,xP({type:mP,role:bB,style:nP,key:tP,from:r,encode:m,overlap:h},e)}function SP(t,n,e,r,i){const o=gP(t,n),a=e.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,c=o("clipHeight"),f=o("symbolOffset"),l={data:"value"},h=`(${i}) ? datum.offset : datum.${aP}`,d=c?lB(c):{field:aP},m=`datum.${KT}`,p=`max(1, ${i})`;let g,v,y,b,w;d.mult=.5,g={enter:v={opacity:cP,x:{signal:h,mult:.5,offset:f},y:d},update:y={opacity:fP,x:v.x,y:v.y},exit:{opacity:cP}};let x=null,$=null;t.fill||(x=n.symbolBaseFillColor,$=n.symbolBaseStrokeColor),dB(g,{fill:o("symbolFillColor",x),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",$),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),uP.forEach((n=>{t[n]&&(y[n]=v[n]={scale:t[n],field:tP})}));const k=xP({type:"symbol",role:"legend-symbol",key:tP,from:l,clip:!!c||void 0,encode:g},e.symbols),M=lB(f);M.offset=o("labelOffset"),g={enter:v={opacity:cP,x:{signal:h,offset:M},y:d},update:y={opacity:fP,text:{field:QT},x:v.x,y:v.y},exit:{opacity:cP}},dB(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=xP({type:mP,role:bB,style:nP,key:tP,from:l,encode:g},e.labels);return g={enter:{noBound:{value:!c},width:cP,height:c?lB(c):cP,opacity:cP},exit:{opacity:cP},update:y={opacity:fP,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${p})`,y.row.signal=`${m}%${b}`,y.column.signal=`floor(${m} / ${b})`,w={field:["row",m]}):(y.row.signal=`floor(${m} / ${p})`,y.column.signal=`${m} % ${p}`,w={field:m}),y.column.signal=`(${i})?${y.column.signal}:${m}`,pP({role:yB,from:r={facet:{data:r,name:"value",groupby:KT}},encode:mB(g,a,sP),marks:[k,A],name:s,interactive:u,sort:w})}const FP='item.orient === "left"',EP='item.orient === "right"',NP=`(${FP} || ${EP})`,CP=`datum.vgrad && ${NP}`,OP=yP('"top"','"bottom"','"middle"'),_P=`datum.vgrad && ${EP} ? (${yP('"right"','"left"','"center"')}) : (${NP} && !(datum.vgrad && ${FP})) ? "left" : ${bP}`,zP=`item._anchor || (${NP} ? "middle" : "start")`,BP=`${CP} ? (${FP} ? -90 : 90) : 0`,TP=`${NP} ? (datum.vgrad ? (${EP} ? "bottom" : "top") : ${OP}) : "top"`;function PP(t,n){let e;return S(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+jP(t.path)+")":t.sphere&&(e="geoShape("+jP(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function jP(t){return S(t)&&t.signal?t.signal:Et(t)}function RP(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===lP?yB:n||gB}function LP(t){return{marktype:t.type,name:t.name||void 0,role:t.role||RP(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function IP(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function qP(t,n){const e=Ba(t.type);e||p("Unrecognized transform type: "+Et(t.type));const r=zB(e.type.toLowerCase(),null,UP(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function UP(t,n,e){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=WP(i,n,e)}return r}function WP(t,n,e){const r=t.type,i=n[t.name];return"index"===r?function(t,n,e){return xt(n.from)||p('Lookup "from" parameter must be a string literal.'),e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==i?"param"===r?function(t,n,e){const r=n[t.name];return t.array?(D(r)||p("Expected an array of sub-parameters. Instead: "+Et(r)),r.map((n=>GP(t,n,e)))):GP(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!UB(i)?i.map((n=>HP(t,n,e))):HP(t,i,e):void(t.required&&p("Missing required "+Et(n.type)+" parameter: "+Et(t.name)))}function HP(t,n,e){const r=t.type;if(UB(n))return JP(r)?p("Expression references can not be signals."):KP(r)?e.fieldRef(n):QP(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||KP(r);return i&&YP(n)?e.exprRef(n.expr,n.as):i&&VP(n)?PB(n.field,n.as):JP(r)?J_(n,e):XP(r)?TB(e.getData(n).values):KP(r)?PB(n):QP(r)?e.compareRef(n):n}}function GP(t,n,e){const r=t.params.length;let i;for(let e=0;e<r;++e){i=t.params[e];for(const t in i.key)if(i.key[t]!==n[t]){i=null;break}if(i)break}i||p("Unsupported parameter: "+Et(n));const o=ut(UP(i,n,e),i.key);return TB(e.add(bT(o)))}const YP=t=>t&&t.expr,VP=t=>t&&t.field,XP=t=>"data"===t,JP=t=>"expr"===t,KP=t=>"field"===t,QP=t=>"compare"===t;function ZP(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:TB(n.getData(t.data).output)}function tj(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function nj(t){return xt(t)?t:null}function ej(t,n,e){const r=LB(e.op,e.field);let i;if(n.ops){for(let t=0,e=n.as.length;t<e;++t)if(n.as[t]===r)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((i=e.op.signal)?t.signalRef(i):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(r))}function rj(t,n,e,r,i,o,a){const u=n[e]||(n[e]={}),s=function(t){return S(t)?("descending"===t.order?"-":"+")+LB(t.op,t.field):""}(o);let c,f,l=nj(i);if(null!=l&&(t=n.scope,l+=s?"|"+s:"",c=u[l]),!c){const e=o?{field:jB,pulse:n.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:TB(n.output)};s&&(e.sort=t.sortRef(o)),f=t.add(zB(r,void 0,e)),a&&(n.index[i]=f),c=TB(f),null!=l&&(u[l]=c)}return c}function ij(t,n,e){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,u=t.values,s=n.add(BB()),c=J_("if("+t.trigger+',modify("'+e+'",'+[i,r,o,a,u].map((t=>null==t?"null":t)).join(",")+"),0)",n);s.update=c.$expr,s.params=c.$params}function oj(t,n){const e=RP(t),r=t.type===lP,i=t.from&&t.from.facet,o=t.overlap;let a,u,s,c,f,l,h,d=t.layout||e===yB||e===vB;const m=e===gB||d||i,g=function(t,n,e){let r,i,o,a,u;return t?(r=t.facet)&&(n||p("Only group marks can be faceted."),null!=r.field?a=u=ZP(r,e):(t.data?u=TB(e.getData(t.data).aggregate):(o=qP(ut({type:"aggregate",groupby:K(r.groupby)},r.aggregate),e),o.params.key=e.keyRef(r.groupby),o.params.pulse=ZP(r,e),a=u=TB(e.add(o))),i=e.keyRef(r.groupby,!0))):a=TB(e.add(oT(null,[{}]))),a||(a=ZP(t,e)),{key:i,pulse:a,parent:u}}(t.from,r,n);u=n.add(uT({key:g.key||(t.key?PB(t.key):void 0),pulse:g.pulse,clean:!r}));const v=TB(u);u=s=n.add(oT({pulse:v})),u=n.add(pT({markdef:LP(t),interactive:IP(t.interactive,n),clip:PP(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:TB(u)}));const y=TB(u);u=c=n.add(sT(SB(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),u.params.parent=n.encode(),t.transform&&t.transform.forEach((t=>{const e=qP(t,n),r=e.metadata;(r.generates||r.changes)&&p("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),e.params.pulse=TB(u),n.add(u=e)})),t.sort&&(u=n.add(ST({sort:n.compareRef(t.sort),pulse:TB(u)})));const b=TB(u);(i||d)&&(d=n.add(FT({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:b})),l=TB(d));const w=n.add(iT({mark:y,pulse:l||b}));h=TB(w),r&&(m&&(a=n.operators,a.pop(),d&&a.pop()),n.pushState(b,l||h,v),i?function(t,n,e){const r=t.from.facet,i=r.name,o=ZP(r,n);let a;r.name||p("Facet must have a name: "+Et(r)),r.data||p("Facet must reference a data set: "+Et(r)),r.field?a=n.add(wT({field:n.fieldRef(r.field),pulse:o})):r.groupby?a=n.add(fT({key:n.keyRef(r.groupby),group:TB(n.proxy(e.parent)),pulse:o})):p("Facet must specify groupby or field: "+Et(r));const u=n.fork(),s=u.add(oT()),c=u.add(DT({pulse:TB(s)}));u.addData(i,new tj(u,s,s,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,n,g):m?function(t,n,e){const r=n.add(wT({pulse:e.pulse})),i=n.fork();i.add(DT()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,n,g):n.parse(t),n.popState(),m&&(d&&a.push(d),a.push(w))),o&&(h=function(t,n,e){const r=t.method,i=t.bound,o=t.separation,a={separation:UB(o)?e.signalRef(o.signal):o,method:UB(r)?e.signalRef(r.signal):r,pulse:n};if(t.order&&(a.sort=e.compareRef({field:t.order})),i){const t=i.tolerance;a.boundTolerance=UB(t)?e.signalRef(t.signal):+t,a.boundScale=e.scaleRef(i.scale),a.boundOrient=i.orient}return TB(e.add(yT(a)))}(o,h,n));const x=n.add(MT({pulse:h})),$=n.add(DT({pulse:TB(x)},void 0,n.parent()));null!=t.name&&(f=t.name,n.addData(f,new tj(n,s,x,$)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&p("Marks only support modify triggers."),ij(t,n,f)})))}function aj(t,n,e){const r={enter:{},update:{}};return dB(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function uj(t,n,e){return n[t]?`scale("${n[t]}",datum)`:vP(t,e[0].encode)}tj.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let o=n[0],a=null,u=1;for(o&&"load"===o.type&&(o=n[1]),t.add(n[0]);u<e;++u)n[u].params.pulse=TB(n[u-1]),t.add(n[u]),"aggregate"===n[u].type&&(a=n[u]);return new tj(t,o,i,r,a)},tj.prototype={countsRef(t,n,e){const r=this,i=r.counts||(r.counts={}),o=nj(n);let a,u,s;return null!=o&&(t=r.scope,a=i[o]),a?e&&e.field&&ej(t,a.agg.params,e):(s={groupby:t.fieldRef(n,"key"),pulse:TB(r.output)},e&&e.field&&ej(t,s,e),u=t.add(eT(s)),a=t.add(oT({pulse:TB(u)})),a={agg:u,ref:TB(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return TB(this.values)},extentRef(t,n){return rj(t,this,"extent","extent",n,!1)},domainRef(t,n){return rj(t,this,"domain","values",n,!1)},valuesRef(t,n,e){return rj(t,this,"vals","values",n,e||!0)},lookupRef(t,n){return rj(t,this,"lookup","tupleindex",n,!1)},indataRef(t,n){return rj(t,this,"indata","tupleindex",n,!0,!0)}};const sj=`item.orient==="${YT}"?-90:item.orient==="${VT}"?90:0`;function cj(t,n){const e={enter:{},update:{}};return dB(e,{orient:t("orient"),anchor:t("anchor"),align:{signal:bP},angle:{signal:sj},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),mB(e,n,sP)}function fj(t){const n=oT({},t);return n.metadata={source:!0},n}function lj(t,n){return mT({url:n.url?t.property(n.url):void 0,async:n.async?t.property(n.async):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}const hj=t=>t===XT||t===GT,dj=(t,n,e)=>UB(t)?bj(t.signal,n,e):t===YT||t===GT?n:e,mj=(t,n,e)=>UB(t)?vj(t.signal,n,e):hj(t)?n:e,pj=(t,n,e)=>UB(t)?yj(t.signal,n,e):hj(t)?e:n,gj=(t,n,e)=>UB(t)?wj(t.signal,n,e):t===GT?{value:n}:{value:e},vj=(t,n,e)=>xj(`${t} === '${GT}' || ${t} === '${XT}'`,n,e),yj=(t,n,e)=>xj(`${t} !== '${GT}' && ${t} !== '${XT}'`,n,e),bj=(t,n,e)=>kj(`${t} === '${YT}' || ${t} === '${GT}'`,n,e),wj=(t,n,e)=>kj(`${t} === '${GT}'`,n,e),xj=(t,n,e)=>(n=null!=n?lB(n):n,e=null!=e?lB(e):e,$j(n)&&$j(e)?{signal:`${t} ? (${n=n?n.signal||Et(n.value):null}) : (${e=e?e.signal||Et(e.value):null})`}:[ut({test:t},n)].concat(e||[])),$j=t=>null==t||1===Object.keys(t).length,kj=(t,n,e)=>({signal:`${t} ? (${Aj(n)}) : (${Aj(e)})`}),Mj=(t,n,e,r,i)=>({signal:(null!=r?`${t} === '${YT}' ? (${Aj(r)}) : `:"")+(null!=e?`${t} === '${XT}' ? (${Aj(e)}) : `:"")+(null!=i?`${t} === '${VT}' ? (${Aj(i)}) : `:"")+(null!=n?`${t} === '${GT}' ? (${Aj(n)}) : `:"")+"(null)"}),Aj=t=>UB(t)?t.signal:null==t?null:Et(t),Dj=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function Sj(t,n,e,r){let i;if(n&&ft(n,t))return n[t];if(ft(e,t))return e[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[eP][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[nP][i]}return null}function Fj(t){const n={};for(const e of t)if(e)for(const t in e)n[t]=1;return Object.keys(n)}function Ej(t,n){return{scale:t.scale,range:n}}function Nj(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function Cj(t,n,e,r,i,o){const a=gP(t,n),u=t.orient,s=t.scale,c=dj(u,-1,1),f=GB(a("labelFlush")),l=GB(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let m,p=0===f||!!f;const g=lB(i);g.mult=c,g.offset=lB(a("labelPadding")||0),g.offset.mult=c;const v={scale:s,field:tP,band:.5,offset:wP(o.offset,a("labelOffset"))},y=mj(u,p?Nj(s,f,'"left"','"right"','"center"'):{value:"center"},((t,n,e)=>UB(t)?((t,n,e)=>kj(`${t} === '${VT}'`,n,e))(t.signal,n,e):t===VT?{value:n}:{value:e})(u,"left","right")),b=mj(u,gj(u,"bottom","top"),p?Nj(s,f,'"top"','"bottom"','"middle"'):{value:"middle"}),w=Nj(s,f,`-(${l})`,l,0);p=p&&l;const x={opacity:cP,x:mj(u,v,g),y:pj(u,v,g)},$={enter:x,update:m={opacity:fP,text:{field:QT},x:x.x,y:x.y,align:y,baseline:b},exit:{opacity:cP,x:x.x,y:x.y}};dB($,{dx:!h&&p?mj(u,w):null,dy:!d&&p?pj(u,w):null}),dB($,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let M=a("labelOverlap");return M=M||k?{separation:a("labelSeparation"),method:M,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,m.align!==y&&(m.align=Dj(m.align,y)),m.baseline!==b&&(m.baseline=Dj(m.baseline,b)),xP({type:mP,role:"axis-label",style:nP,key:tP,from:r,encode:$,overlap:M},e)}function Oj(t,n){const e=function(t,n){var e,r,i,o=n.config,a=o.style,u=o.axis,s="band"===n.scaleType(t.scale)&&o.axisBand,c=t.orient;if(UB(c)){const t=Fj([o.axisX,o.axisY]),n=Fj([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(e={},t))e[i]=mj(c,Sj(i,o.axisX,u,a),Sj(i,o.axisY,u,a));for(i of(r={},n))r[i]=Mj(c.signal,Sj(i,o.axisTop,u,a),Sj(i,o.axisBottom,u,a),Sj(i,o.axisLeft,u,a),Sj(i,o.axisRight,u,a))}else e=c===GT||c===XT?o.axisX:o.axisY,r=o["axis"+c[0].toUpperCase()+c.slice(1)];return e||r||s?ut({},u,e,r,s):u}(t,n),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=gP(t,e),c=function(t){const n=t("tickBand");let e,r,i=t("tickOffset");return n?n.signal?(e={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${n.signal}) === 'extent'`},S(i)||(i={signal:`(${n.signal}) === 'extent' ? 0 : ${i}`})):"extent"===n?(e=1,r=!0,i=0):(e=.5,r=!1):(e=t("bandPosition"),r=t("tickExtra")),{extra:r,band:e,offset:i}}(s),f={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},l=TB(n.add(oT({},[f]))),h=TB(n.add(rT({scale:n.scaleRef(t.scale),extra:n.property(c.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),d=[];let m;return f.grid&&d.push(function(t,n,e,r,i){const o=gP(t,n),a=t.orient,u=t.gridScale,s=dj(a,1,-1),c=function(t,n){if(1===n);else if(S(t)){let e=t=ut({},t);for(;null!=e.mult;){if(!S(e.mult))return e.mult=UB(n)?{signal:`(${e.mult}) * (${n.signal})`}:e.mult*n,t;e=e.mult=ut({},e.mult)}e.mult=n}else t=UB(n)?{signal:`(${n.signal}) * (${t||0})`}:n*(t||0);return t}(t.offset,s);let f,l,h;const d={enter:f={opacity:cP},update:h={opacity:fP},exit:l={opacity:cP}};dB(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const m={scale:t.scale,field:tP,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},p=mj(a,{signal:"height"},{signal:"width"}),g=u?{scale:u,range:0,mult:s,offset:c}:{value:0,offset:c},v=u?{scale:u,range:1,mult:s,offset:c}:ut(p,{mult:s,offset:c});return f.x=h.x=mj(a,m,g),f.y=h.y=pj(a,m,g),f.x2=h.x2=pj(a,v),f.y2=h.y2=mj(a,v),l.x=mj(a,m),l.y=pj(a,m),xP({type:dP,role:"axis-grid",key:tP,from:r,encode:d},e)}(t,e,r.grid,h,c)),f.ticks&&(m=s("tickSize"),d.push(function(t,n,e,r,i,o){const a=gP(t,n),u=t.orient,s=dj(u,-1,1);let c,f,l;const h={enter:c={opacity:cP},update:l={opacity:fP},exit:f={opacity:cP}};dB(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=lB(i);d.mult=s;const m={scale:t.scale,field:tP,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return l.y=c.y=mj(u,cP,m),l.y2=c.y2=mj(u,d),f.x=mj(u,m),l.x=c.x=pj(u,cP,m),l.x2=c.x2=pj(u,d),f.y=pj(u,m),xP({type:dP,role:"axis-tick",key:tP,from:r,encode:h},e)}(t,e,r.ticks,h,m,c))),f.labels&&(m=f.ticks?m:0,d.push(Cj(t,e,r.labels,h,m,c))),f.domain&&d.push(function(t,n,e,r){const i=gP(t,n),o=t.orient;let a,u;const s={enter:a={opacity:cP},update:u={opacity:fP},exit:{opacity:cP}};dB(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const c=Ej(t,0),f=Ej(t,1);return a.x=u.x=mj(o,c,cP),a.x2=u.x2=mj(o,f),a.y=u.y=pj(o,c,cP),a.y2=u.y2=pj(o,f),xP({type:dP,role:"axis-domain",from:r,encode:s},e)}(t,e,r.domain,l)),f.title&&d.push(function(t,n,e,r){const i=gP(t,n),o=t.orient,a=dj(o,-1,1);let u,s;const c={enter:u={opacity:cP,anchor:lB(i("titleAnchor",null)),align:{signal:bP}},update:s=ut({},u,{opacity:fP,text:lB(t.title)}),exit:{opacity:cP}},f={signal:`lerp(range("${t.scale}"), ${yP(0,1,.5)})`};return s.x=mj(o,f),s.y=pj(o,f),u.angle=mj(o,cP,(t=>UB(t)?{signal:`(${t.signal}) * 90`}:{value:90*t})(a)),u.baseline=mj(o,gj(o,XT,GT),{value:XT}),s.angle=u.angle,s.baseline=u.baseline,dB(c,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,n,e,r){const i=(t,n)=>null!=t?(e.update[n]=Dj(lB(t),e.update[n]),!1):!pB(n,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");e.enter.auto=a===o?lB(a):mj(n,lB(a),lB(o))}(i,o,c,e),c.update.align=Dj(c.update.align,u.align),c.update.angle=Dj(c.update.angle,u.angle),c.update.baseline=Dj(c.update.baseline,u.baseline),xP({type:mP,role:"axis-title",style:eP,from:r,encode:c},e)}(t,e,r.title,l)),oj(pP({role:"axis",from:l,encode:mB(_j(s,t),i,sP),marks:d,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),n)}function _j(t,n){const e={enter:{},update:{}};return dB(e,{orient:t("orient"),offset:t("offset")||0,position:HB(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function zj(t,n,e){const r=K(t.signals),i=K(t.scales);return e||r.forEach((t=>OB(t,n))),K(t.projections).forEach((t=>function(t,n){const e=n.config.projection||{},r={};for(const e in t)"name"!==e&&(r[e]=HT(t[e],e,n));for(const t in e)null==r[t]&&(r[t]=HT(e[t],t,n));n.addProjection(t.name,r)}(t,n))),i.forEach((t=>function(t,n){const e=t.type||"linear";eg(e)||p("Unrecognized scale type: "+Et(e)),n.addScale(t.name,{type:e,domain:void 0})}(t,n))),K(t.data).forEach((t=>function(t,n){const e=[];t.transform&&t.transform.forEach((t=>{e.push(qP(t,n))})),t.on&&t.on.forEach((e=>{ij(e,n,t.name)})),n.addDataPipeline(t.name,function(t,n,e){const r=[];let i,o,a,u,s,c=null,f=!1,l=!1;for(t.values?UB(t.values)||WB(t.format)?(r.push(lj(n,t)),r.push(c=fj())):r.push(c=fj({$ingest:t.values,$format:t.format})):t.url?WB(t.url)||WB(t.format)?(r.push(lj(n,t)),r.push(c=fj())):r.push(c=fj({$request:t.url,$format:t.format})):t.source&&(c=i=K(t.source).map((t=>TB(n.getData(t).output))),r.push(null)),o=0,a=e.length;o<a;++o)u=e[o],s=u.metadata,c||s.source||r.push(c=fj()),r.push(u),s.generates&&(l=!0),s.modifies&&!l&&(f=!0),s.source?c=u:s.changes&&(c=null);return i&&(a=i.length-1,r[0]=kT({derive:f,pulse:a?i:i[0]}),(f||a)&&r.splice(1,0,fj())),c||r.push(fj()),r.push(DT({})),r}(t,n,e))}(t,n))),i.forEach((t=>OT(t,n))),(e||r).forEach((t=>function(t,n){const e=n.getSignal(t.name);let r=t.update;t.init&&(r?p("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=J_(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach((t=>function(t,n,e){const r=t.encode,i={target:e};let o=t.events,a=t.update,u=[];o||p("Signal update missing events specification."),xt(o)&&(o=iB(o,n.isSubscope()?IB:qB)),o=K(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[tT(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&p("Signal encode and update are mutually exclusive."),a="encode(item(),"+Et(r)+")"),i.update=xt(a)?J_(a,n):null!=a.expr?J_(a.expr,n):null!=a.value?a.value:null!=a.signal?{$expr:ZB,$params:{$value:n.signalRef(a.signal)}}:p("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>n.addUpdate(ut(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):VB(t,n)}}(t,n),i))))}(t,n,e.id)))}(t,n))),K(t.axes).forEach((t=>Oj(t,n))),K(t.marks).forEach((t=>oj(t,n))),K(t.legends).forEach((t=>function(t,n){const e=n.config.legend,r=t.encode||{},i=gP(t,e),o=r.legend||{},a=o.name||void 0,u=o.interactive,s=o.style,c={};let f,l,h,d=0;uP.forEach((n=>t[n]?(c[n]=t[n],d=d||t[n]):0)),d||p("Missing valid scale for legend.");const m=function(t,n){let e=t.type||rP;return t.type||1!==function(t){return uP.reduce(((n,e)=>n+(t[e]?1:0)),0)}(t)||!t.fill&&!t.stroke||(e=ig(n)?iP:ag(n)?oP:rP),e!==iP?e:ag(n)?oP:iP}(t,n.scaleType(d)),g={title:null!=t.title,scales:c,type:m,vgrad:"symbol"!==m&&i.isVertical()},v=TB(n.add(oT(null,[g]))),y=TB(n.add(dT(l={type:m,scale:n.scaleRef(d),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return m===iP?(h=[$P(t,d,e,r.gradient),DP(t,e,r.labels,y)],l.count=l.count||n.signalRef(`max(2,2*floor((${GB(i.gradientLength())})/100))`)):m===oP?h=[kP(t,d,e,r.gradient,y),DP(t,e,r.labels,y)]:(f=function(t,n){const e=gP(t,n);return{align:e("gridAlign"),columns:e.entryColumns(),center:{row:!0,column:!1},padding:{row:e("rowPadding"),column:e("columnPadding")}}}(t,e),h=[SP(t,e,r,y,GB(f.columns))],l.size=function(t,n,e){const r=GB(uj("size",t,e)),i=GB(uj("strokeWidth",t,e)),o=GB(function(t,n,e){return vP("fontSize",t)||function(t,n,e){const r=n.config.style[e];return r&&r.fontSize}(0,n,e)}(e[1].encode,n,nP));return J_(`max(ceil(sqrt(${r})+${i}),${o})`,n)}(t,n,h[0].marks)),h=[pP({role:"legend-entry",from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:f,interactive:u})],g.title&&h.push(function(t,n,e,r){const i=gP(t,n),o={enter:{opacity:cP},update:{opacity:fP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:cP}};return dB(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:zP},angle:{signal:BP},align:{signal:_P},baseline:{signal:TP},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),xP({type:mP,role:"legend-title",style:eP,from:r,encode:o},e)}(t,e,r.title,v)),oj(pP({role:"legend",from:v,encode:mB(aj(i,t,e),o,sP),marks:h,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:s}),n)}(t,n))),t.title&&function(t,n){const e=gP(t=xt(t)?{text:t}:t,n.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,u=i.style,s=[],c=TB(n.add(oT(null,[{}])));s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dB(o,{text:t.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),xP({type:mP,role:"title-text",style:"group-title",from:r,encode:o},e)}(t,e,function(t){const n=t.encode;return n&&n.title||ut({name:t.name,interactive:t.interactive,style:t.style},n)}(t),c)),t.subtitle&&s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dB(o,{text:t.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),xP({type:mP,role:"title-subtitle",style:"group-subtitle",from:r,encode:o},e)}(t,e,r.subtitle,c)),oj(pP({role:"title",from:c,encode:cj(e,i),marks:s,aria:e("aria"),description:e("description"),zindex:e("zindex"),name:o,interactive:a,style:u}),n)}(t.title,n),n.parseLambdas(),n}function Bj(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function Tj(t,n){this.config=t||{},this.options=n||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function Pj(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function jj(t){return(D(t)?Rj:Lj)(t)}function Rj(t){const n=t.length;let e="[";for(let r=0;r<n;++r){const n=t[r];e+=(r>0?",":"")+(S(n)?n.signal||jj(n):Et(n))}return e+"]"}function Lj(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+Et(n)+":"+(S(e)?e.signal||jj(e):Et(e));return r+"}"}Tj.prototype=Pj.prototype={parse(t){return zj(t,this)},fork(){return new Pj(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((n=>{n.$ref=t.id})),t.refs=null),t},proxy(t){const n=t instanceof _B?TB(t):t;return this.add($T({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){let r,i;t&&(r=t.data||(t.data={}),i=r[n]||(r[n]=[]),i.push(e))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(TB(this.add(DT({pulse:t})))),this._parent.push(n),this._lookup.push(e?TB(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return O(this._parent)},encode(){return O(this._encode)},lookup(){return O(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if(xt(t))return PB(t,n);t.signal||p("Unsupported field reference: "+Et(t));const e=t.signal;let r=this.field[e];if(!r){const t={name:this.signalRef(e)};n&&(t.as=n),this.field[e]=r=TB(this.add(lT(t)))}return r},compareRef(t){let n=!1;const e=t=>UB(t)?(n=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(n=!0,this.exprRef(t.expr)):t,r=K(t.field).map(e),i=K(t.order).map(e);return n?TB(this.add(aT({fields:r,orders:i}))):RB(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=K(t).map((t=>UB(t)?(e=!0,TB(r[t.signal])):t)),e?TB(this.add(hT({fields:t,flat:n}))):function(t,n){const e={$key:t};return n&&(e.$flat=!0),e}(t,n)},sortRef(t){if(!t)return t;const n=LB(t.op,t.field),e=t.order||"ascending";return e.signal?TB(this.add(aT({fields:n,orders:this.signalRef(e.signal)}))):RB(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return ft(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&p("Duplicate signal name: "+Et(t));const e=n instanceof _B?n:this.add(BB(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||p("Unrecognized signal name: "+Et(t)),this.signals[t]},signalRef(t){return this.signals[t]?TB(this.signals[t]):(ft(this.lambdas,t)||(this.lambdas[t]=this.add(BB(null))),TB(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;n<e;++n){const e=t[n],r=J_(e,this),i=this.lambdas[e];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&S(t)?this.signalRef(t.signal||jj(t)):t},exprRef(t,n){const e={expr:J_(t,this)};return n&&(e.expr.$name=n),TB(this.add(cT(e)))},addBinding(t,n){this.bindings||p("Nested signals do not support binding: "+Et(t)),this.bindings.push(ut({signal:t},n))},addScaleProj(t,n){ft(this.scales,t)&&p("Duplicate scale or projection name: "+Et(t)),this.scales[t]=this.add(n)},addScale(t,n){this.addScaleProj(t,AT(n))},addProjection(t,n){this.addScaleProj(t,xT(n))},getScale(t){return this.scales[t]||p("Unrecognized scale name: "+Et(t)),this.scales[t]},scaleRef(t){return TB(this.getScale(t))},scaleType(t){return this.getScale(t).params.type},projectionRef(t){return this.scaleRef(t)},projectionType(t){return this.scaleType(t)},addData(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Et(t)),this.data[t]=n},getData(t){return this.data[t]||p("Undefined data set name: "+Et(t)),this.data[t]},addDataPipeline(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Et(t)),this.addData(t,tj.fromEntries(this,n))}},ut(za,tc,P$,mk,rF,tE,PN,gN,qN,xC,zC,UC);var Ij=Object.freeze({__proto__:null,Bounds:Lv,CanvasHandler:$w,CanvasRenderer:Fw,DATE:we,DAY:xe,DAYOFYEAR:$e,Dataflow:Ca,Debug:4,Error:1,EventStream:va,Gradient:Wg,GroupItem:qv,HOURS:ke,Handler:Zb,HybridHandler:vx,HybridRenderer:gx,Info:3,Item:Iv,MILLISECONDS:De,MINUTES:Me,MONTH:ye,Marks:Pb,MultiPulse:Sa,None:0,Operator:ma,Parameters:la,Pulse:ka,QUARTER:ve,RenderType:xx,Renderer:nw,ResourceLoader:Uv,SECONDS:Ae,SVGHandler:Nw,SVGRenderer:nx,SVGStringRenderer:mx,Scenegraph:Hb,TIME_UNITS:Se,Transform:_a,View:Xz,WEEK:be,Warn:2,YEAR:ge,accessor:c,accessorFields:l,accessorName:f,array:K,ascending:nt,bandwidthNRD:La,bin:Ia,bootstrapCI:Ua,boundClip:Ex,boundContext:fy,boundItem:jb,boundMark:Lb,boundStroke:Gv,changeset:ca,clampRange:Q,codegenExpression:KO,compare:tt,constant:ot,cumulativeLogNormal:eu,cumulativeNormal:Ja,cumulativeUniform:su,dayofyear:ze,debounce:at,defaultLocale:Mo,definition:Ba,densityLogNormal:nu,densityNormal:Xa,densityUniform:uu,domChild:Xb,domClear:Jb,domCreate:Yb,domFind:Vb,dotbin:Wa,error:p,expressionFunction:X_,extend:ut,extent:st,extentIndex:ct,falsy:k,fastmap:ht,field:v,flush:dt,font:Eb,fontFamily:Fb,fontSize:kb,format:Ho,formatLocale:go,formats:Go,hasOwnProperty:ft,id:y,identity:b,inferType:jo,inferTypes:Ro,ingest:ra,inherits:mt,inrange:pt,interpolate:pg,interpolateColors:hg,interpolateRange:lg,intersect:Mx,intersectBoxLine:xy,intersectPath:vy,intersectPoint:yy,intersectRule:wy,isArray:D,isBoolean:gt,isDate:vt,isFunction:Z,isIterable:yt,isNumber:bt,isObject:S,isRegExp:wt,isString:xt,isTuple:ta,key:$t,lerp:kt,lineHeight:Mb,loader:Xo,locale:ko,logger:A,lruCache:Mt,markup:Yw,merge:At,mergeConfig:E,multiLineOffset:Db,one:x,pad:St,panLinear:L,panLog:I,panPow:q,panSymlog:U,parse:function(t,n,e){return S(t)||p("Input Vega specification must be an object."),n=E(function(){const t="sans-serif",n="#4c78a8",e="#000",r="#888",i="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:n},area:{fill:n},image:null,line:{stroke:n,strokeWidth:2},path:{stroke:n},rect:{fill:n},rule:{stroke:e},shape:{stroke:n},symbol:{fill:n,size:64},text:{fill:e,font:t,fontSize:11},trail:{fill:n,size:2},style:{"guide-label":{fill:e,font:t,fontSize:10},"guide-title":{fill:e,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:e,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:e,font:t,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:i},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:i,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:r,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),n,t.config),function(t,n){const e=n.config,r=TB(n.root=n.add(BB())),i=function(t,n){const e=e=>HB(t[e],n[e]),r=[Bj("background",e("background")),Bj("autosize",sB(e("autosize"))),Bj("padding",fB(e("padding"))),Bj("width",e("width")||0),Bj("height",e("height")||0)],i=r.reduce(((t,n)=>(t[n.name]=n,t)),{}),o={};return K(t.signals).forEach((t=>{ft(i,t.name)?t=ut(i[t.name],t):r.push(t),o[t.name]=t})),K(n.signals).forEach((t=>{ft(o,t.name)||ft(i,t.name)||r.push(t)})),r}(t,e);i.forEach((t=>OB(t,n))),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const o=n.add(oT()),a=n.add(sT(SB((t=>mB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),lP,vB,t.style,n,{pulse:TB(o)}))),u=n.add(FT({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:TB(a)}));n.operators.pop(),n.pushState(TB(a),TB(u),null),zj(t,n,i),n.operators.push(u);let s=n.add(iT({mark:r,pulse:TB(u)}));return s=n.add(MT({pulse:TB(s)})),s=n.add(DT({pulse:TB(s)})),n.addData("root",new tj(n,o,o,s)),n}(t,new Tj(n,e)).toRuntime()},parseExpression:YO,parseSelector:iB,path:wc,pathCurves:Gg,pathEqual:Cx,pathParse:Qg,pathRectangle:$v,pathRender:cv,pathSymbols:dv,pathTrail:kv,peek:O,point:Qb,projection:AS,quantileLogNormal:ru,quantileNormal:Ka,quantileUniform:cu,quantiles:ja,quantizeInterpolator:dg,quarter:X,quartiles:Ra,get random(){return qa},randomInteger:function(t,n){let e,r,i;null==n&&(n=t,t=0);const o={min(t){return arguments.length?(e=t||0,i=r-e,o):e},max(t){return arguments.length?(r=t||0,i=r-e,o):r},sample:()=>e+Math.floor(i*qa()),pdf:t=>t===Math.floor(t)&&t>=e&&t<r?1/i:0,cdf(t){const n=Math.floor(t);return n<e?0:n>=r?1:(n-e+1)/i},icdf:t=>t>=0&&t<=1?e-1+Math.floor(t*i):NaN};return o.min(t).max(n)},randomKDE:Za,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:iu,randomMixture:ou,randomNormal:Qa,randomUniform:fu,read:Vo,regressionConstant:lu,regressionExp:yu,regressionLinear:gu,regressionLoess:ku,regressionLog:vu,regressionPoly:xu,regressionPow:bu,regressionQuad:wu,renderModule:kx,repeat:Dt,resetDefaultLocale:function(){return mo(),bo(),Mo()},resetSVGClipId:jv,resetSVGDefIds:function(){jv(),Rg=0},responseType:Yo,runtimeContext:oz,sampleCurve:Su,sampleLogNormal:tu,sampleNormal:Va,sampleUniform:au,scale:ng,sceneEqual:Nx,sceneFromJSON:Ub,scenePickVisit:Oy,sceneToJSON:qb,sceneVisit:Cy,sceneZOrder:Ny,scheme:bg,serializeXML:Vw,setHybridRendererOptions:function(t){px.svgMarkTypes=t.svgMarkTypes??["text"],px.svgOnTop=t.svgOnTop??!0,px.debug=t.debug??!1},setRandom:function(t){qa=t},span:Ft,splitAccessPath:g,stringValue:Et,textMetrics:vb,timeBin:br,timeFloor:Je,timeFormatLocale:xo,timeInterval:er,timeOffset:or,timeSequence:sr,timeUnitSpecifier:Ce,timeUnits:Ee,toBoolean:Nt,toDate:Ot,toNumber:_,toSet:zt,toString:_t,transform:Ta,transforms:za,truncate:Bt,truthy:$,tupleid:na,typeParsers:Bo,utcFloor:Ze,utcInterval:rr,utcOffset:ar,utcSequence:cr,utcdayofyear:Le,utcquarter:J,utcweek:Ie,version:"5.31.0",visitArray:Tt,week:Be,writeConfig:N,zero:w,zoomLinear:H,zoomLog:G,zoomPow:Y,zoomSymlog:V}),qj={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Uj={"*":(t,n)=>t*n,"+":(t,n)=>t+n,"-":(t,n)=>t-n,"/":(t,n)=>t/n,"%":(t,n)=>t%n,">":(t,n)=>t>n,"<":(t,n)=>t<n,"<=":(t,n)=>t<=n,">=":(t,n)=>t>=n,"==":(t,n)=>t==n,"!=":(t,n)=>t!=n,"===":(t,n)=>t===n,"!==":(t,n)=>t!==n,"&":(t,n)=>t&n,"|":(t,n)=>t|n,"^":(t,n)=>t^n,"<<":(t,n)=>t<<n,">>":(t,n)=>t>>n,">>>":(t,n)=>t>>>n},Wj={"+":t=>+t,"-":t=>-t,"~":t=>~t,"!":t=>!t};const Hj=Array.prototype.slice,Gj=(t,n,e)=>{const r=e?e(n[0]):n[0];return r[t].apply(r,Hj.call(n,1))};var Yj={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(t,n,e)=>Math.max(n,Math.min(e,t)),now:Date.now,utc:Date.UTC,datetime:(t,n,e,r,i,o,a)=>new Date(t,n||0,null!=e?e:1,r||0,i||0,o||0,a||0),date:t=>new Date(t).getDate(),day:t=>new Date(t).getDay(),year:t=>new Date(t).getFullYear(),month:t=>new Date(t).getMonth(),hours:t=>new Date(t).getHours(),minutes:t=>new Date(t).getMinutes(),seconds:t=>new Date(t).getSeconds(),milliseconds:t=>new Date(t).getMilliseconds(),time:t=>new Date(t).getTime(),timezoneoffset:t=>new Date(t).getTimezoneOffset(),utcdate:t=>new Date(t).getUTCDate(),utcday:t=>new Date(t).getUTCDay(),utcyear:t=>new Date(t).getUTCFullYear(),utcmonth:t=>new Date(t).getUTCMonth(),utchours:t=>new Date(t).getUTCHours(),utcminutes:t=>new Date(t).getUTCMinutes(),utcseconds:t=>new Date(t).getUTCSeconds(),utcmilliseconds:t=>new Date(t).getUTCMilliseconds(),length:t=>t.length,join:function(){return Gj("join",arguments)},indexof:function(){return Gj("indexOf",arguments)},lastindexof:function(){return Gj("lastIndexOf",arguments)},slice:function(){return Gj("slice",arguments)},reverse:t=>t.slice().reverse(),sort:t=>t.slice().sort(nt),parseFloat,parseInt,upper:t=>String(t).toUpperCase(),lower:t=>String(t).toLowerCase(),substring:function(){return Gj("substring",arguments,String)},split:function(){return Gj("split",arguments,String)},replace:function(){return Gj("replace",arguments,String)},trim:t=>String(t).trim(),btoa:t=>btoa(t),atob:t=>atob(t),regexp:RegExp,test:(t,n)=>RegExp(t).test(n)};const Vj=["view","item","group","xy","x","y"],Xj=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Xj.add(setImmediate);const Jj={Literal:(t,n)=>n.value,Identifier:(t,n)=>{const e=n.name;return t.memberDepth>0?e:"datum"===e?t.datum:"event"===e?t.event:"item"===e?t.item:qj[e]||t.params["$"+e]},MemberExpression:(t,n)=>{const e=!n.computed,r=t(n.object);e&&(t.memberDepth+=1);const i=t(n.property);if(e&&(t.memberDepth-=1),!Xj.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(t,n)=>{const e=n.arguments;let r=n.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?t(e[0])?t(e[1]):t(e[2]):(t.fn[r]||Yj[r]).apply(t.fn,e.map(t))},ArrayExpression:(t,n)=>n.elements.map(t),BinaryExpression:(t,n)=>Uj[n.operator](t(n.left),t(n.right)),UnaryExpression:(t,n)=>Wj[n.operator](t(n.argument)),ConditionalExpression:(t,n)=>t(n.test)?t(n.consequent):t(n.alternate),LogicalExpression:(t,n)=>"&&"===n.operator?t(n.left)&&t(n.right):t(n.left)||t(n.right),ObjectExpression:(t,n)=>n.properties.reduce(((n,e)=>{t.memberDepth+=1;const r=t(e.key);return t.memberDepth-=1,Xj.has(t(e.value))?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):n[r]=t(e.value),n}),{})};function Kj(t,n,e,r,i,o){const a=t=>Jj[t.type](a,t);return a.memberDepth=0,a.fn=Object.create(n),a.params=e,a.datum=r,a.event=i,a.item=o,Vj.forEach((t=>a.fn[t]=function(){return i.vega[t](...arguments)})),a(t)}var Qj={operator(t,n){const e=n.ast,r=t.functions;return t=>Kj(e,r,t)},parameter(t,n){const e=n.ast,r=t.functions;return(t,n)=>Kj(e,r,n,t)},event(t,n){const e=n.ast,r=t.functions;return t=>Kj(e,r,void 0,void 0,t)},handler(t,n){const e=n.ast,r=t.functions;return(t,n)=>Kj(e,r,t,n.item&&n.item.datum,n)},encode(t,n){const{marktype:e,channels:r}=n,i=t.functions,o="group"===e||"image"===e||"rect"===e;return(t,n)=>{const a=t.datum;let u,s=0;for(const e in r)u=Kj(r[e].ast,i,n,a,void 0,t),t[e]!==u&&(t[e]=u,s=1);return"rule"!==e&&function(t,n,e){let r;n.x2&&(n.x?(e&&t.x>t.x2&&(r=t.x,t.x=t.x2,t.x2=r),t.width=t.x2-t.x):t.x=t.x2-(t.width||0)),n.xc&&(t.x=t.xc-(t.width||0)/2),n.y2&&(n.y?(e&&t.y>t.y2&&(r=t.y,t.y=t.y2,t.y2=r),t.height=t.y2-t.y):t.y=t.y2-(t.height||0)),n.yc&&(t.y=t.yc-(t.height||0)/2)}(t,r,o),s}}};function Zj(t){return YR(t,"or")}function tR(t){return YR(t,"and")}function nR(t){return YR(t,"not")}function eR(t,n){if(nR(t))eR(t.not,n);else if(tR(t))for(const e of t.and)eR(e,n);else if(Zj(t))for(const e of t.or)eR(e,n);else n(t)}function rR(t,n){return nR(t)?{not:rR(t.not,n)}:tR(t)?{and:t.and.map((t=>rR(t,n)))}:Zj(t)?{or:t.or.map((t=>rR(t,n)))}:n(t)}const iR=structuredClone;function oR(t){throw new Error(t)}function aR(t,n){const e={};for(const r of n)ft(t,r)&&(e[r]=t[r]);return e}function uR(t,n){const e={...t};for(const t of n)delete e[t];return e}function sR(t){if(bt(t))return t;const n=xt(t)?t:GR(t);if(n.length<250)return n;let e=0;for(let t=0;t<n.length;t++)e=(e<<5)-e+n.charCodeAt(t),e|=0;return e}function cR(t){return!1===t||null===t}function fR(t,n){return t.includes(n)}function lR(t,n){let e=0;for(const[r,i]of t.entries())if(n(i,r,e++))return!0;return!1}function hR(t,n){let e=0;for(const[r,i]of t.entries())if(!n(i,r,e++))return!1;return!0}function dR(t,...n){for(const e of n)mR(t,e??{});return t}function mR(t,n){for(const e of xR(n))N(t,e,n[e],!0)}function pR(t,n){const e=[],r={};let i;for(const o of t)i=n(o),i in r||(r[i]=1,e.push(o));return e}function gR(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}function vR(t,n){for(const e of t)if(n.has(e))return!0;return!1}function yR(t){const n=new Set;for(const e of t){const t=g(e).map(((t,n)=>0===n?t:`[${t}]`)),r=t.map(((n,e)=>t.slice(0,e+1).join("")));for(const t of r)n.add(t)}return n}function bR(t,n){return void 0===t||void 0===n||vR(yR(t),yR(n))}function wR(t){return 0===xR(t).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((t=>GR(t))).join(",")})`};const xR=Object.keys,$R=Object.values,kR=Object.entries;function MR(t){return!0===t||!1===t}function AR(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function DR(t,n){return nR(t)?`!(${DR(t.not,n)})`:tR(t)?`(${t.and.map((t=>DR(t,n))).join(") && (")})`:Zj(t)?`(${t.or.map((t=>DR(t,n))).join(") || (")})`:n(t)}function SR(t,n){if(0===n.length)return!0;const e=n.shift();return e in t&&SR(t[e],n)&&delete t[e],wR(t)}function FR(t){return t.charAt(0).toUpperCase()+t.substr(1)}function ER(t,n="datum"){const e=g(t),r=[];for(let t=1;t<=e.length;t++){const i=`[${e.slice(0,t).map(Et).join("][")}]`;r.push(`${n}${i}`)}return r.join(" && ")}function NR(t,n="datum"){return`${n}[${Et(g(t).join("."))}]`}function CR(t){return`datum['${t.replaceAll("'","\\'")}']`}function OR(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function _R(t){return`${g(t).map(OR).join("\\.")}`}function zR(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function BR(t){return`${g(t).join(".")}`}function TR(t){return t?g(t).length:0}function PR(...t){return t.find((t=>void 0!==t))}let jR=42;function RR(t){const n=++jR;return t?String(t)+n:n}function LR(t){return IR(t)?t:`__${t}`}function IR(t){return t.startsWith("__")}function qR(t){if(void 0!==t)return(t%360+360)%360}function UR(t){return!!bt(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const WR=Object.getPrototypeOf(structuredClone({}));function HR(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(!HR(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;for(const e of t.entries())if(!HR(e[1],n.get(e[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(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&&t.valueOf!==WR.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==WR.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;0!=r--;){const e=i[r];if(!HR(t[e],n[e]))return!1}return!0}return t!=t&&n!=n}function GR(t){const n=[];return function t(e){if(e&&e.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===e)return;if("number"==typeof e)return isFinite(e)?""+e:"null";if("object"!=typeof e)return JSON.stringify(e);let r,i;if(Array.isArray(e)){for(i="[",r=0;r<e.length;r++)r&&(i+=","),i+=t(e[r])||"null";return i+"]"}if(null===e)return"null";if(n.includes(e))throw new TypeError("Converting circular structure to JSON");const o=n.push(e)-1,a=Object.keys(e).sort();for(i="",r=0;r<a.length;r++){const n=a[r],o=t(e[n]);o&&(i&&(i+=","),i+=JSON.stringify(n)+":"+o)}return n.splice(o,1),`{${i}}`}(t)}function YR(t,n){return S(t)&&ft(t,n)&&void 0!==t[n]}const VR="row",XR="column",JR="facet",KR="x",QR="y",ZR="x2",tL="y2",nL="xOffset",eL="yOffset",rL="radius",iL="radius2",oL="theta",aL="theta2",uL="latitude",sL="longitude",cL="latitude2",fL="longitude2",lL="time",hL="color",dL="fill",mL="stroke",pL="shape",gL="size",vL="angle",yL="opacity",bL="fillOpacity",wL="strokeOpacity",xL="strokeWidth",$L="strokeDash",kL="text",ML="order",AL="detail",DL="key",SL="tooltip",FL="href",EL="url",NL="description",CL={theta:1,theta2:1,radius:1,radius2:1};function OL(t){return ft(CL,t)}const _L={longitude:1,longitude2:1,latitude:1,latitude2:1};function zL(t){switch(t){case uL:return"y";case cL:return"y2";case sL:return"x";case fL:return"x2"}}function BL(t){return ft(_L,t)}const TL=xR(_L),PL={x:1,y:1,x2:1,y2:1,...CL,..._L,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time: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 jL(t){return t===hL||t===dL||t===mL}const RL={row:1,column:1,facet:1},LL=xR(RL),IL={...PL,...RL},qL=xR(IL),{order:UL,detail:WL,tooltip:HL,...GL}=IL,{row:YL,column:VL,facet:XL,...JL}=GL;function KL(t){return ft(IL,t)}const QL=[ZR,tL,cL,fL,aL,iL];function ZL(t){return tI(t)!==t}function tI(t){switch(t){case ZR:return KR;case tL:return QR;case cL:return uL;case fL:return sL;case aL:return oL;case iL:return rL}return t}function nI(t){if(OL(t))switch(t){case oL:return"startAngle";case aL:return"endAngle";case rL:return"outerRadius";case iL:return"innerRadius"}return t}function eI(t){switch(t){case KR:return ZR;case QR:return tL;case uL:return cL;case sL:return fL;case oL:return aL;case rL:return iL}}function rI(t){switch(t){case KR:case ZR:return"width";case QR:case tL:return"height"}}function iI(t){switch(t){case KR:return"xOffset";case QR:return"yOffset";case ZR:return"x2Offset";case tL:return"y2Offset";case oL:return"thetaOffset";case rL:return"radiusOffset";case aL:return"theta2Offset";case iL:return"radius2Offset"}}function oI(t){switch(t){case KR:return"xOffset";case QR:return"yOffset"}}function aI(t){switch(t){case"xOffset":return"x";case"yOffset":return"y"}}const uI=xR(PL),{x:sI,y:cI,x2:fI,y2:lI,xOffset:hI,yOffset:dI,latitude:mI,longitude:pI,latitude2:gI,longitude2:vI,theta:yI,theta2:bI,radius:wI,radius2:xI,...$I}=PL,kI=xR($I),MI={x:1,y:1},AI=xR(MI);function DI(t){return ft(MI,t)}const SI={theta:1,radius:1},FI=xR(SI);function EI(t){return"width"===t?KR:QR}const NI={xOffset:1,yOffset:1};function CI(t){return ft(NI,t)}const OI={time:1};function _I(t){return t in OI}const{text:zI,tooltip:BI,href:TI,url:PI,description:jI,detail:RI,key:LI,order:II,...qI}=$I,UI=xR(qI),WI={...MI,...SI,...NI,...qI},HI=xR(WI);function GI(t){return ft(WI,t)}const YI={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:VI,...XI}=YI;function JI(t){switch(t){case KR:case QR:case oL:case rL:case nL:case eL:case gL:case vL:case xL:case yL:case bL:case wL:case lL:case ZR:case tL:case aL:case iL:return;case JR:case VR:case XR:case pL:case $L:case kL:case SL:case FL:case EL:case NL:return"discrete";case hL:case dL:case mL:return"flexible";case uL:case sL:case cL:case fL:case AL:case DL:case ML:return}}const KI={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb: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},QI={count:1,min:1,max:1};function ZI(t){return YR(t,"argmin")}function tq(t){return YR(t,"argmax")}function nq(t){return xt(t)&&ft(KI,t)}const eq=new Set(["count","valid","missing","distinct"]);function rq(t){return xt(t)&&eq.has(t)}const iq=new Set(["count","sum","distinct","valid","missing"]),oq=new Set(["mean","average","median","q1","q3","min","max"]);function aq(t){return gt(t)&&(t=$G(t,void 0)),"bin"+xR(t).map((n=>fq(t[n])?AR(`_${n}_${kR(t[n])}`):AR(`_${n}_${t[n]}`))).join("")}function uq(t){return!0===t||cq(t)&&!t.binned}function sq(t){return"binned"===t||cq(t)&&!0===t.binned}function cq(t){return S(t)}function fq(t){return YR(t,"param")}function lq(t){switch(t){case VR:case XR:case gL:case hL:case dL:case mL:case xL:case yL:case bL:case wL:case pL:return 6;case $L:return 4;default:return 10}}function hq(t){return YR(t,"expr")}function dq(t,{level:n}={level:0}){const e=xR(t||{}),r={};for(const i of e)r[i]=0===n?kq(t[i]):dq(t[i],{level:n-1});return r}function mq(t){const{anchor:n,frame:e,offset:r,orient:i,angle:o,limit:a,color:u,subtitleColor:s,subtitleFont:c,subtitleFontSize:f,subtitleFontStyle:l,subtitleFontWeight:h,subtitleLineHeight:d,subtitlePadding:m,...p}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...s?{subtitleColor:s}:{},...c?{subtitleFont:c}:{},...f?{subtitleFontSize:f}:{},...l?{subtitleFontStyle:l}:{},...h?{subtitleFontWeight:h}:{},...d?{subtitleLineHeight:d}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:{...p,...u?{fill:u}:{}},subtitleMarkConfig:aR(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:v}}function pq(t){return xt(t)||D(t)&&xt(t[0])}function gq(t){return YR(t,"signal")}function vq(t){return YR(t,"step")}function yq(t){return!D(t)&&YR(t,"field")&&YR(t,"data")}const bq=xR({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}),wq={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},xq=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function $q(t){const n=D(t.condition)?t.condition.map(Mq):Mq(t.condition);return{...kq(t),condition:n}}function kq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Mq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Aq(t){if(hq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return gq(t)?t:void 0!==t?{value:t}:void 0}function Dq(t){return gq(t)?t.signal:Et(t)}function Sq(t){return gq(t)?t.signal:Et(t.value)}function Fq(t){return gq(t)?t.signal:null==t?null:Et(t)}function Eq(t,n,e){for(const r of e){const e=Oq(r,n.markDef,n.config);void 0!==e&&(t[r]=Aq(e))}return t}function Nq(t){return[].concat(t.type,t.style??[])}function Cq(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:o}=r;return i&&YR(n,i)?n[i]:void 0!==n[t]?n[t]:!o||i&&i!==t?Oq(t,n,e,r):void 0}function Oq(t,n,e,{vgChannel:r}={}){const i=_q(t,n,e.style);return PR(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function _q(t,n,e){return zq(t,Nq(n),e)}function zq(t,n,e){let r;n=K(n);for(const i of n){const n=e[i];YR(n,t)&&(r=n[t])}return r}function Bq(t,n){return K(t).reduce(((t,e)=>(t.field.push(sG(e,n)),t.order.push(e.sort??"ascending"),t)),{field:[],order:[]})}function Tq(t,n){const e=[...t];return n.forEach((t=>{for(const n of e)if(HR(n,t))return;e.push(t)})),e}function Pq(t,n){return HR(t,n)||!n?t:t?[...K(t),...K(n)].join(", "):n}function jq(t,n){const e=t.value,r=n.value;if(null==e||null===r)return{explicit:t.explicit,value:null};if((pq(e)||gq(e))&&(pq(r)||gq(r)))return{explicit:t.explicit,value:Pq(e,r)};if(pq(e)||gq(e))return{explicit:t.explicit,value:e};if(pq(r)||gq(r))return{explicit:t.explicit,value:r};if(!(pq(e)||gq(e)||pq(r)||gq(r)))return{explicit:t.explicit,value:Tq(e,r)};throw new Error("It should never reach here")}function Rq(t){return`Invalid specification ${GR(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function Lq(t){return("width"==t?"Width":"Height")+' "container" only works for single views and layered views.'}function Iq(t){return`${"width"==t?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==t?"x":"y"}".`}function qq(t){return t?`Dropping "fit-${t}" because spec has discrete ${rI(t)}.`:'Dropping "fit" because spec has discrete size.'}function Uq(t){return`Unknown field for ${t}. Cannot calculate view size.`}function Wq(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function Hq(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function Gq(t){return`Selection not supported for ${t} yet.`}function Yq(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Vq="Animation involving facet, layer, or concat is currently unsupported.";function Xq(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function Jq(t){return`Ignoring an invalid transform: ${GR(t)}.`}function Kq(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function Qq(t){return`${t}Offset dropped because ${t} is continuous`}function Zq(t){return`Invalid field type "${t}".`}function tU(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function nU(t,n){return`Dropping ${GR(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function eU(t,n){return`${t} dropped as it is incompatible with "${n}".`}function rU(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function iU(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function oU(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${"ordinal"===n?"order":"magnitude"}.`}function aU(t){return`Using unaggregated domain with raw field has no effect (${GR(t)}).`}function uU(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function sU(t){return`Unaggregated domain is currently unsupported for log scale (${GR(t)}).`}function cU(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function fU(t){return`The step for "${t}" is dropped because the ${"width"===t?"x":"y"} is continuous.`}const lU="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function hU(t,n){return`Invalid ${t}: ${GR(n)}.`}function dU(t){return`1D error band does not support ${t}.`}function mU(t){return`Channel ${t} is required for "binned" bin.`}const pU=A(2);let gU=pU;function vU(...t){gU.error(...t)}function yU(...t){gU.warn(...t)}function bU(t){if(t&&S(t))for(const n of SU)if(YR(t,n))return!0;return!1}const wU=["january","february","march","april","may","june","july","august","september","october","november","december"],xU=wU.map((t=>t.substr(0,3))),$U=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],kU=$U.map((t=>t.substr(0,3)));function MU(t,n){const e=[];if(n&&void 0!==t.day&&xR(t).length>1&&(yU(function(t){return`Dropping day from datetime ${GR(t)} as day cannot be combined with other units.`}(t)),delete(t=iR(t)).day),e.push(void 0!==t.year?t.year:2012),void 0!==t.month){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t-1;{const n=t.toLowerCase(),e=wU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=xU.indexOf(r);if(-1!==i)return i;throw new Error(hU("month",t))}}(t.month):t.month;e.push(r)}else if(void 0!==t.quarter){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t>4&&yU(hU("quarter",t)),t-1;throw new Error(hU("quarter",t))}(t.quarter):t.quarter;e.push(bt(r)?3*r:`${r}*3`)}else e.push(0);if(void 0!==t.date)e.push(t.date);else if(void 0!==t.day){const r=n?function(t){if(UR(t)&&(t=+t),bt(t))return t%7;{const n=t.toLowerCase(),e=$U.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=kU.indexOf(r);if(-1!==i)return i;throw new Error(hU("day",t))}}(t.day):t.day;e.push(bt(r)?r+1:`${r}+1`)}else e.push(1);for(const n of["hours","minutes","seconds","milliseconds"]){const r=t[n];e.push(void 0===r?0:r)}return e}function AU(t){const n=MU(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const DU={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},SU=xR(DU);function FU(t){return S(t)?t.binned:EU(t)}function EU(t){return t&&t.startsWith("binned")}function NU(t){return t.startsWith("utc")}const CU={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function OU(t){return SU.filter((n=>zU(t,n)))}function _U(t){const n=OU(t);return n[n.length-1]}function zU(t,n){const e=t.indexOf(n);return!(e<0||e>0&&"seconds"===n&&"i"===t.charAt(e-1)||t.length>e+3&&"day"===n&&"o"===t.charAt(e+3)||e>0&&"year"===n&&"f"===t.charAt(e-1))}function BU(t){if(t)return`timeUnitSpecifier(${GR(OU(t))}, ${GR(CU)})`}function TU(t){if(!t)return;let n;return xt(t)?n=EU(t)?{unit:t.substring(6),binned:!0}:{unit:t}:S(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),NU(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function PU(t,n=t=>t){const e=TU(t),r=_U(e.unit);if(r&&"day"!==r){const t={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:o}=RU(r,e.step);return`${n(AU({...t,[o]:+t[o]+i}))} - ${n(AU(t))}`}}const jU={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function RU(t,n=1){if(function(t){return ft(jU,t)}(t))return{part:t,step:n};switch(t){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function LU(t){return!!t?.field&&void 0!==t.equal}function IU(t){return!!t?.field&&void 0!==t.lt}function qU(t){return!!t?.field&&void 0!==t.lte}function UU(t){return!!t?.field&&void 0!==t.gt}function WU(t){return!!t?.field&&void 0!==t.gte}function HU(t){if(t?.field){if(D(t.range)&&2===t.range.length)return!0;if(gq(t.range))return!0}return!1}function GU(t){return!!t?.field&&(D(t.oneOf)||D(t.in))}function YU(t){return GU(t)||LU(t)||HU(t)||IU(t)||UU(t)||qU(t)||WU(t)}function VU(t,n){return AG(t,{timeUnit:n,wrapTime:!0})}function XU(t,n=!0){const{field:e}=t,r=TU(t.timeUnit),{unit:i,binned:o}=r||{},a=sG(t,{expr:"datum"}),u=i?`time(${o?a:function(t,n,{end:e}={end:!1}){const r=ER(n),i=NU(t)?"utc":"";let o;const a={};for(const n of SU)zU(t,n)&&(a[n]="quarter"===(u=n)?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`,o=n);var u;return e&&(a[o]+="+1"),function(t){const n=MU(t,!1).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}(a)}(i,e)})`:a;if(LU(t))return`${u}===${VU(t.equal,i)}`;if(IU(t))return`${u}<${VU(t.lt,i)}`;if(UU(t))return`${u}>${VU(t.gt,i)}`;if(qU(t))return`${u}<=${VU(t.lte,i)}`;if(WU(t))return`${u}>=${VU(t.gte,i)}`;if(GU(t))return`indexof([${function(t,n){return t.map((t=>VU(t,n)))}(t.oneOf,i).join(",")}], ${u}) !== -1`;if(function(t){return!!t?.field&&void 0!==t.valid}(t))return JU(u,t.valid);if(HU(t)){const{range:e}=dq(t),r=gq(e)?{signal:`${e.signal}[0]`}:e[0],o=gq(e)?{signal:`${e.signal}[1]`}:e[1];if(null!==r&&null!==o&&n)return"inrange("+u+", ["+VU(r,i)+", "+VU(o,i)+"])";const a=[];return null!==r&&a.push(`${u} >= ${VU(r,i)}`),null!==o&&a.push(`${u} <= ${VU(o,i)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${GR(t)}`)}function JU(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function KU(t){return YU(t)&&t.timeUnit?{...t,timeUnit:TU(t.timeUnit)}:t}function QU(t){return"quantitative"===t||"temporal"===t}function ZU(t){return"ordinal"===t||"nominal"===t}const tW="quantitative",nW="ordinal",eW="temporal",rW="nominal",iW="geojson",oW="linear",aW="time",uW="utc",sW="point",cW="band",fW={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 lW(t,n){const e=fW[t],r=fW[n];return e===r||"ordinal-position"===e&&"time"===r||"ordinal-position"===r&&"time"===e}const hW={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 dW(t){return hW[t]}const mW=new Set(["linear","log","pow","sqrt","symlog"]),pW=new Set([...mW,"time","utc"]);function gW(t){return mW.has(t)}const vW=new Set(["quantile","quantize","threshold"]),yW=new Set([...pW,...vW,"sequential","identity"]),bW=new Set(["ordinal","bin-ordinal","point","band"]);function wW(t){return bW.has(t)}function xW(t){return yW.has(t)}function $W(t){return pW.has(t)}function kW(t){return vW.has(t)}function MW(t){return YR(t,"param")}const{type:AW,domain:DW,range:SW,rangeMax:FW,rangeMin:EW,scheme:NW,...CW}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw: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},OW=xR(CW);function _W(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return $W(t)||"band"===t||"point"===t;case"padding":case"rangeMin":case"rangeMax":return $W(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return"band"===t;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return $W(t);case"nice":return $W(t)||"quantize"===t||"threshold"===t;case"exponent":return"pow"===t;case"base":return"log"===t;case"constant":return"symlog"===t;case"zero":return xW(t)&&!fR(["log","time","utc","threshold","quantile"],t)}}function zW(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return jL(t)?void 0:`Cannot use the scale property "${n}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":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 BW={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"},TW=BW.arc,PW=BW.area,jW=BW.bar,RW=BW.image,LW=BW.line,IW=BW.point,qW=BW.rect,UW=BW.rule,WW=BW.text,HW=BW.tick,GW=BW.trail,YW=BW.circle,VW=BW.square,XW=BW.geoshape;function JW(t){return["line","area","trail"].includes(t)}function KW(t){return["rect","bar","image","arc","tick"].includes(t)}const QW=new Set(xR(BW));function ZW(t){return YR(t,"type")}const tH=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],nH=xR({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),eH=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rH={area:["line","point"],bar:eH,rect:eH,line:["point"],tick:["bandSize","thickness",...eH]},iH=xR({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 oH(t){return YR(t,"band")}const aH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},uH={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},sH={...uH,binSpacing:1},cH={...uH,thickness:1};function fH(t,{isPath:n}){return void 0===t||"break-paths-show-path-domains"===t?n?"break-paths-show-domains":"filter":null===t?"show":t}function lH({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){if(!r||!xW(r)||i)return"always-valid";const o=fH(Cq("invalid",t,n),{isPath:JW(t.type)}),a=n.scale?.invalid?.[e];return void 0!==a?"show":o}function hH({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,o=`peek(${r})`,a=n.domainHasZero();return"definitely"===a?{scale:t,value:0}:"maybe"===a?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${"zeroOrMin"===e?i:o})`}:{signal:`scale('${t}', ${"zeroOrMin"===e?i:o})`}}function dH({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:o}){const a=e?.get("type"),u=vG(n),s=lH({scaleChannel:t,markDef:i,config:o,scaleType:a,isCountAggregate:rq(u?.aggregate)});if(u&&"show"===s){const n=o.scale.invalid?.[t]??"zero-or-min";return{test:JU(sG(u,{expr:"datum"}),!1),...mH(n,e,r)}}}function mH(t,n,e){if(S(r=t)&&"value"in r){const{value:n}=t;return gq(n)?{signal:n.signal}:{value:n}}var r;return hH({scale:n,scaleName:e,mode:"zeroOrMin"})}function pH(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:o,config:a}=t,u=tI(n),s=yH(t),c=dH({scaleChannel:u,channelDef:e,scale:i,scaleName:o,markDef:r,config:a});return void 0!==c?[c,s]:s}function gH(t,n,e,r){const i={};if(n&&(i.scale=n),JH(t)){const{datum:n}=t;bU(n)?i.signal=AU(n):gq(n)?i.signal=n.signal:hq(n)?i.signal=n.expr:i.value=n}else i.field=sG(t,e);if(r){const{offset:t,band:n}=r;t&&(i.offset=t),n&&(i.band=n)}return i}function vH({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:o="end",bandPosition:a=.5}){const u=!gq(a)&&0<a&&a<1?"datum":void 0,s=sG(n,{expr:u,suffix:i}),c=void 0!==e?sG(e,{expr:u}):sG(n,{suffix:o,expr:u}),f={};if(0===a||1===a)f.scale=t,f.field=0===a?s:c;else{const n=gq(a)?`(1-${a.signal}) * ${s} + ${a.signal} * ${c}`:`${1-a} * ${s} + ${a} * ${c}`;f.signal=`scale("${t}", ${n})`}return r&&(f.offset=r),f}function yH({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c,bandPosition:f}){if(n){if(tG(n)){const c=a?.get("type");if(nG(n)){f??(f=IH({fieldDef:n,fieldDef2:e,markDef:r,config:i}));const{bin:a,timeUnit:l,type:h}=n;if(uq(a)||f&&l&&h===eW)return u?.impute?gH(n,o,{binSuffix:"mid"},{offset:s}):f&&!wW(c)?vH({scaleName:o,fieldOrDatumDef:n,bandPosition:f,offset:s}):gH(n,o,SG(n,t)?{binSuffix:"range"}:{},{offset:s});if(sq(a)){if(VH(e))return vH({scaleName:o,fieldOrDatumDef:n,fieldOrDatumDef2:e,bandPosition:f,offset:s});yU(mU(t===KR?ZR:tL))}}return gH(n,o,wW(c)?{binSuffix:"range"}:{},{offset:s,band:"band"===c?f??n.bandPosition??.5:void 0})}if(eG(n)){const e=s?{offset:s}:{};return{...bH(t,n.value),...e}}}return Z(c)&&(c=c()),c?{...c,...s?{offset:s}:{}}:c}function bH(t,n){return fR(["x","x2"],t)&&"width"===n?{field:{group:"width"}}:fR(["y","y2"],t)&&"height"===n?{field:{group:"height"}}:Aq(n)}function wH(t){return t&&"number"!==t&&"time"!==t}function xH(t,n,e){return`${t}(${n}${e?`, ${GR(e)}`:""})`}function $H({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o}){if(wH(e))return MH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,config:o});const a=kH(t,r,i),u=XH(t);if(void 0===n&&void 0===e&&o.customFormatTypes){if("quantitative"===u){if(i&&o.normalizedNumberFormatType)return MH({fieldOrDatumDef:t,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:r,config:o});if(o.numberFormatType)return MH({fieldOrDatumDef:t,format:o.numberFormat,formatType:o.numberFormatType,expr:r,config:o})}if("temporal"===u&&o.timeFormatType&&VH(t)&&void 0===t.timeUnit)return MH({fieldOrDatumDef:t,format:o.timeFormat,formatType:o.timeFormatType,expr:r,config:o})}if(MG(t)){const e=function({field:t,timeUnit:n,format:e,formatType:r,rawTimeFormat:i,isUTCScale:o}){return!n||e?!n&&r?`${r}(${t}, '${e}')`:`${o?"utc":"time"}Format(${t}, '${e=xt(e)?e:i}')`:function(t,n,e){if(!t)return;const r=BU(t);return`${e||NU(t)?"utc":"time"}Format(${n}, ${r})`}(n,t,o)}({field:a,timeUnit:VH(t)?TU(t.timeUnit)?.unit:void 0,format:n,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:rG(t)&&t.scale?.type===uW});return e?{signal:e}:void 0}return n=SH({type:u,specifiedFormat:n,config:o,normalizeStack:i}),VH(t)&&uq(t.bin)?{signal:NH(a,sG(t,{expr:r,binSuffix:"end"}),n,e,o)}:n||"quantitative"===XH(t)?{signal:`${FH(a,n)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function kH(t,n,e){return VH(t)?e?`${sG(t,{expr:n,suffix:"end"})}-${sG(t,{expr:n,suffix:"start"})}`:sG(t,{expr:n}):function(t){const{datum:n}=t;return bU(n)?AU(n):`${GR(n)}`}(t)}function MH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o,field:a}){return a??(a=kH(t,r,i)),"datum.value"!==a&&VH(t)&&uq(t.bin)?{signal:NH(a,sG(t,{expr:r,binSuffix:"end"}),n,e,o)}:{signal:xH(e,a,n)}}function AH(t,n,e,r,i,o){if(!xt(r)||!wH(r)){if(void 0===e&&void 0===r&&i.customFormatTypes&&"quantitative"===XH(t)){if(i.normalizedNumberFormatType&&iG(t)&&"normalize"===t.stack)return;if(i.numberFormatType)return}if(iG(t)&&"normalize"===t.stack&&i.normalizedNumberFormat)return SH({type:"quantitative",config:i,normalizeStack:!0});if(MG(t)){const n=VH(t)?TU(t.timeUnit)?.unit:void 0;if(void 0===n&&i.customFormatTypes&&i.timeFormatType)return;return function({specifiedFormat:t,timeUnit:n,config:e,omitTimeFormatConfig:r}){return t||(n?{signal:BU(n)}:r?void 0:e.timeFormat)}({specifiedFormat:e,timeUnit:n,config:i,omitTimeFormatConfig:o})}return SH({type:n,specifiedFormat:e,config:i})}}function DH(t,n,e){return t&&(gq(t)||"number"===t||"time"===t)?t:MG(n)&&"time"!==e&&"utc"!==e?VH(n)&&TU(n?.timeUnit)?.utc?"utc":"time":void 0}function SH({type:t,specifiedFormat:n,config:e,normalizeStack:r}){return xt(n)?n:t===tW?r?e.normalizedNumberFormat:e.numberFormat:void 0}function FH(t,n){return`format(${t}, "${n||""}")`}function EH(t,n,e,r){return wH(e)?xH(e,t,n):FH(t,(xt(n)?n:void 0)??r.numberFormat)}function NH(t,n,e,r,i){if(void 0===e&&void 0===r&&i.customFormatTypes&&i.numberFormatType)return NH(t,n,i.numberFormat,i.numberFormatType,i);const o=EH(t,e,r,i),a=EH(n,e,r,i);return`${JU(t,!1)} ? "null" : ${o} + " – " + ${a}`}const CH="min",OH={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function _H(t){return ft(OH,t)}function zH(t){return t&&("count"===t.op||YR(t,"field"))}function BH(t){return t&&D(t)}function TH(t){return YR(t,"row")||YR(t,"column")}function PH(t){return YR(t,"header")}function jH(t){return YR(t,"facet")}function RH(t){const{field:n,timeUnit:e,bin:r,aggregate:i}=t;return{...e?{timeUnit:e}:{},...r?{bin:r}:{},...i?{aggregate:i}:{},field:n}}function LH(t){return YR(t,"sort")}function IH({fieldDef:t,fieldDef2:n,markDef:e,config:r}){if(tG(t)&&void 0!==t.bandPosition)return t.bandPosition;if(VH(t)){const{timeUnit:i,bin:o}=t;if(i&&!n)return Oq("timeUnitBandPosition",e,r);if(uq(o))return.5}}function qH({channel:t,fieldDef:n,fieldDef2:e,markDef:r,config:i,scaleType:o,useVlSizeChannel:a}){const u=rI(t),s=Cq(a?"size":u,r,i,{vgChannel:u});if(void 0!==s)return s;if(VH(n)){const{timeUnit:t,bin:a}=n;if(t&&!e)return{band:Oq("timeUnitBandSize",r,i)};if(uq(a)&&!wW(o))return{band:1}}return KW(r.type)?o?wW(o)?i[r.type]?.discreteBandSize||{band:1}:i[r.type]?.continuousBandSize:i[r.type]?.discreteBandSize:void 0}function UH(t,n,e,r){return!!(uq(t.bin)||t.timeUnit&&nG(t)&&"temporal"===t.type)&&void 0!==IH({fieldDef:t,fieldDef2:n,markDef:e,config:r})}function WH(t){return YR(t,"sort")&&!YR(t,"field")}function HH(t){return YR(t,"condition")}function GH(t){const n=t?.condition;return!!n&&!D(n)&&VH(n)}function YH(t){const n=t?.condition;return!!n&&!D(n)&&tG(n)}function VH(t){return YR(t,"field")||"count"===t?.aggregate}function XH(t){return t?.type}function JH(t){return YR(t,"datum")}function KH(t){return nG(t)&&!cG(t)||ZH(t)}function QH(t){return nG(t)&&"quantitative"===t.type&&!t.bin||ZH(t)}function ZH(t){return JH(t)&&bt(t.datum)}function tG(t){return VH(t)||JH(t)}function nG(t){return t&&(YR(t,"field")||"count"===t.aggregate)&&YR(t,"type")}function eG(t){return YR(t,"value")}function rG(t){return YR(t,"scale")||YR(t,"sort")}function iG(t){return YR(t,"axis")||YR(t,"stack")||YR(t,"impute")}function oG(t){return YR(t,"legend")}function aG(t){return YR(t,"format")||YR(t,"formatType")}function uG(t){return uR(t,["legend","axis","header","scale"])}function sG(t,n={}){let e=t.field;const r=n.prefix;let i=n.suffix,o="";if(function(t){return"count"===t.aggregate}(t))e=LR("count");else{let r;if(!n.nofn)if(function(t){return YR(t,"op")}(t))r=t.op;else{const{bin:a,aggregate:u,timeUnit:s}=t;uq(a)?(r=aq(a),i=(n.binSuffix??"")+(n.suffix??"")):u?tq(u)?(o=`["${e}"]`,e=`argmax_${u.argmax}`):ZI(u)?(o=`["${e}"]`,e=`argmin_${u.argmin}`):r=String(u):s&&!FU(s)&&(r=function(t){const{utc:n,...e}=TU(t);return e.unit?(n?"utc":"")+xR(e).map((t=>AR(`${"unit"===t?"":`_${t}_`}${e[t]}`))).join(""):(n?"utc":"")+"timeunit"+xR(e).map((t=>AR(`_${t}_${e[t]}`))).join("")}(s),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}r&&(e=e?`${r}_${e}`:r)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?BR(e):n.expr?NR(e,n.expr)+o:_R(e)+o}function cG(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return VH(t)&&!!t.bin;case"temporal":return!1}throw new Error(Zq(t.type))}const fG=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(t){const{aggregate:n,bin:e,timeUnit:r,field:i}=t;if(tq(n))return`${i} for argmax(${n.argmax})`;if(ZI(n))return`${i} for argmin(${n.argmin})`;const o=r&&!FU(r)?TU(r):void 0,a=n||o?.unit||o?.maxbins&&"timeunit"||uq(e)&&"bin";return a?`${a.toUpperCase()}(${i})`:i}(t);default:return function(t,n){const{field:e,bin:r,timeUnit:i,aggregate:o}=t;if("count"===o)return n.countTitle;if(uq(r))return`${e} (binned)`;if(i&&!FU(i)){const t=TU(i)?.unit;if(t)return`${e} (${OU(t).join("-")})`}else if(o)return tq(o)?`${e} for max ${o.argmax}`:ZI(o)?`${e} for min ${o.argmin}`:`${FR(o)} of ${e}`;return e}(t,n)}};let lG=fG;function hG(t){lG=t}function dG(t,n,{allowDisabling:e,includeDefault:r=!0}){const i=mG(t)?.title;if(!VH(t))return i??t.title;const o=t,a=r?pG(o,n):void 0;return e?PR(i,o.title,a):i??o.title??a}function mG(t){return iG(t)&&t.axis?t.axis:oG(t)&&t.legend?t.legend:PH(t)&&t.header?t.header:void 0}function pG(t,n){return lG(t,n)}function gG(t){if(aG(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=mG(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function vG(t){return VH(t)?t:GH(t)?t.condition:void 0}function yG(t){return tG(t)?t:YH(t)?t.condition:void 0}function bG(t,n,e,r={}){return xt(t)||bt(t)||gt(t)?(yU(function(t,n,e){return`Channel ${t} is a ${n}. Converted to {value: ${GR(e)}}.`}(n,xt(t)?"string":bt(t)?"number":"boolean",t)),{value:t}):tG(t)?wG(t,n,e,r):YH(t)?{...t,condition:wG(t.condition,n,e,r)}:t}function wG(t,n,e,r){if(aG(t)){const{format:i,formatType:o,...a}=t;if(wH(o)&&!e.customFormatTypes)return yU(Kq(n)),wG(a,n,e,r)}else{const i=iG(t)?"axis":oG(t)?"legend":PH(t)?"header":null;if(i&&t[i]){const{format:o,formatType:a,...u}=t[i];if(wH(a)&&!e.customFormatTypes)return yU(Kq(n)),wG({...t,[i]:u},n,e,r)}}return VH(t)?xG(t,n,r):function(t){let n=t.type;if(n)return t;const{datum:e}=t;return n=bt(e)?"quantitative":xt(e)?"nominal":bU(e)?"temporal":void 0,{...t,type:n}}(t)}function xG(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:o,field:a}=t,u={...t};if(e||!r||nq(r)||tq(r)||ZI(r)||(yU(function(t){return`Invalid aggregation operator "${t}".`}(r)),delete u.aggregate),i&&(u.timeUnit=TU(i)),a&&(u.field=`${a}`),uq(o)&&(u.bin=$G(o,n)),sq(o)&&!DI(n)&&yU(function(t){return`Channel ${t} should not be used with "binned" bin.`}(n)),nG(u)){const{type:t}=u,n=function(t){if(t)switch(t=t.toLowerCase()){case"q":case tW:return"quantitative";case"t":case eW:return"temporal";case"o":case nW:return"ordinal";case"n":case rW:return"nominal";case iW:return"geojson"}}(t);t!==n&&(u.type=n),"quantitative"!==t&&rq(r)&&(yU(function(t,n){return`Invalid field type "${t}" for aggregate: "${n}", using "quantitative" instead.`}(t,r)),u.type="quantitative")}else if(!ZL(n)){const t=function(t,n){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(LH(t)&&D(t.sort))return"ordinal";const{aggregate:e,bin:r,timeUnit:i}=t;if(i)return"temporal";if(r||e&&!tq(e)&&!ZI(e))return"quantitative";if(rG(t)&&t.scale?.type)switch(fW[t.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,n);u.type=t}if(nG(u)){const{compatible:t,warning:e}=function(t,n){const e=t.type;if("geojson"===e&&"shape"!==n)return{compatible:!1,warning:`Channel ${n} should not be used with a geojson data.`};switch(n){case VR:case XR:case JR:return cG(t)?kG:{compatible:!1,warning:rU(n)};case KR:case QR:case nL:case eL:case hL:case dL:case mL:case kL:case AL:case DL:case SL:case FL:case EL:case vL:case oL:case rL:case NL:return kG;case sL:case fL:case uL:case cL:return e!==tW?{compatible:!1,warning:`Channel ${n} should be used with a quantitative field only, not ${t.type} field.`}:kG;case yL:case bL:case wL:case xL:case gL:case aL:case iL:case ZR:case tL:case lL:return"nominal"!==e||t.sort?kG:{compatible:!1,warning:`Channel ${n} should not be used with an unsorted discrete field.`};case pL:case $L:return cG(t)||function(t){return rG(t)&&kW(t.scale?.type)}(t)?kG:{compatible:!1,warning:iU(n)};case ML:return"nominal"!==t.type||"sort"in t?kG:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(u,n)||{};!1===t&&yU(e)}if(LH(u)&&xt(u.sort)){const{sort:t}=u;if(_H(t))return{...u,sort:{encoding:t}};const n=t.substring(1);if("-"===t.charAt(0)&&_H(n))return{...u,sort:{encoding:n,order:"descending"}}}if(PH(u)){const{header:t}=u;if(t){const{orient:n,...e}=t;if(n)return{...u,header:{...e,labelOrient:t.labelOrient||n,titleOrient:t.titleOrient||n}}}}return u}function $G(t,n){return gt(t)?{maxbins:lq(n)}:"binned"===t?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:lq(n)}}const kG={compatible:!0};function MG(t){const{formatType:n}=gG(t);return"time"===n||!n&&function(t){return t&&("temporal"===t.type||VH(t)&&!!t.timeUnit)}(t)}function AG(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){const o=n&&TU(n)?.unit;let a,u=o||"temporal"===e;return hq(t)?a=t.expr:gq(t)?a=t.signal:bU(t)?(u=!0,a=AU(t)):(xt(t)||bt(t))&&u&&(a=`datetime(${GR(t)})`,function(t){return ft(DU,t)}(o)&&(bt(t)&&t<1e4||xt(t)&&isNaN(Date.parse(t)))&&(a=AU({[o]:t}))),a?r&&u?`time(${a})`:a:i?void 0:GR(t)}function DG(t,n){const{type:e}=t;return n.map((n=>{const r=AG(n,{timeUnit:VH(t)&&!FU(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return void 0!==r?{signal:r}:n}))}function SG(t,n){return uq(t.bin)?GI(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const FG={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 EG(t){return t?.condition}const NG=["domain","grid","labels","ticks","title"],CG={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"},OG={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},_G={...OG,style:1,labelExpr:1,encoding:1};function zG(t){return ft(_G,t)}const BG=xR({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 TG(t){return YR(t,"mark")}class PG{constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return!!TG(t)&&function(t){return ZW(t)?t.type:t}(t.mark)===this.name}}function jG(t,n){const e=t&&t[n];return!!e&&(D(e)?lR(e,(t=>!!t.field)):VH(e)||GH(e))}function RG(t,n){const e=t&&t[n];return!!e&&(D(e)?lR(e,(t=>!!t.field)):VH(e)||JH(e)||YH(e))}function LG(t,n){if(DI(n)){const e=t[n];if((VH(e)||JH(e))&&(ZU(e.type)||VH(e)&&e.timeUnit))return RG(t,oI(n))}return!1}function IG(t){return lR(qL,(n=>{if(jG(t,n)){const e=t[n];if(D(e))return lR(e,(t=>!!t.aggregate));{const t=vG(e);return t&&!!t.aggregate}}return!1}))}function qG(t,n){const e=[],r=[],i=[],o=[],a={};return HG(t,((u,s)=>{if(VH(u)){const{field:c,aggregate:f,bin:l,timeUnit:h,...d}=u;if(f||h||l){const t=mG(u),m=t?.title;let p=sG(u,{forAs:!0});const g={...m?[]:{title:dG(u,n,{allowDisabling:!0})},...d,field:p};if(f){let t;if(tq(f)?(t="argmax",p=sG({op:"argmax",field:f.argmax},{forAs:!0}),g.field=`${p}.${c}`):ZI(f)?(t="argmin",p=sG({op:"argmin",field:f.argmin},{forAs:!0}),g.field=`${p}.${c}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(t=f),t){const n={op:t,as:p};c&&(n.field=c),o.push(n)}}else if(e.push(p),nG(u)&&uq(l))r.push({bin:l,field:c,as:p}),e.push(sG(u,{binSuffix:"end"})),SG(u,s)&&e.push(sG(u,{binSuffix:"range"})),DI(s)&&(a[`${s}2`]={field:`${p}_end`}),g.bin="binned",ZL(s)||(g.type=tW);else if(h&&!FU(h)){i.push({timeUnit:h,field:c,as:p});const t=nG(u)&&u.type!==eW&&"time";t&&(s===kL||s===SL?g.formatType=t:function(t){return ft($I,t)}(s)?g.legend={formatType:t,...g.legend}:DI(s)&&(g.axis={formatType:t,...g.axis}))}a[s]=g}else e.push(c),a[s]=t[s]}else a[s]=t[s]})),{bins:r,timeUnits:i,aggregate:o,groupby:e,encoding:a}}function UG(t,n,e){const r=function(t,n){return function(t){switch(t){case hL:case dL:case mL:case NL:case AL:case DL:case SL:case FL:case ML:case yL:case bL:case wL:case xL:case JR:case VR:case XR:return YI;case KR:case QR:case nL:case eL:case uL:case sL:case lL:return XI;case ZR:case tL:case cL:case fL:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case gL:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case $L:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case pL:return{point:"always",geoshape:"always"};case kL:return{text:"always"};case vL:return{point:"always",square:"always",text:"always"};case EL:return{image:"always"};case oL:case rL:return{text:"always",arc:"always"};case aL:case iL:return{arc:"always"}}}(t)[n]}(n,e);if(!r)return!1;if("binned"===r){const e=t[n===ZR?KR:QR];return!!(VH(e)&&VH(t[n])&&sq(e.bin))}return!0}function WG(t,n){const e={};for(const r of xR(t)){const i=bG(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function HG(t,n,e){if(t)for(const r of xR(t)){const i=t[r];if(D(i))for(const t of i)n.call(e,t,r);else n.call(e,i,r)}}function GG(t,n){return xR(n).reduce(((e,r)=>{switch(r){case KR:case QR:case FL:case NL:case EL:case ZR:case tL:case nL:case eL:case oL:case aL:case rL:case iL:case lL:case uL:case sL:case cL:case fL:case kL:case pL:case vL:case SL:return e;case ML:if("line"===t||"trail"===t)return e;case AL:case DL:{const t=n[r];if(D(t)||VH(t))for(const n of K(t))n.aggregate||e.push(sG(n,{}));return e}case gL:if("trail"===t)return e;case hL:case dL:case mL:case yL:case bL:case wL:case $L:case xL:{const t=vG(n[r]);return t&&!t.aggregate&&e.push(sG(t,{})),e}}}),[])}function YG(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map((({fieldPrefix:t,titlePrefix:e})=>{const i=r?` of ${VG(n)}`:"";return{field:t+n.field,type:n.type,title:gq(e)?{signal:`${e}"${escape(i)}"`}:e+i}})),o=function(t){const n=[];for(const e of xR(t))if(jG(t,e)){const r=K(t[e]);for(const t of r)VH(t)?n.push(t):GH(t)&&n.push(t.condition)}return n}(e).map(uG);return{tooltip:[...i,...pR(o,sR)]}}function VG(t){const{title:n,field:e}=t;return PR(n,e)}function XG(t,n,e,r,i){const{scale:o,axis:a}=e;return({partName:u,mark:s,positionPrefix:c,endPositionPrefix:f,extraEncoding:l={}})=>{const h=VG(e);return JG(t,u,i,{mark:s,encoding:{[n]:{field:`${c}_${e.field}`,type:e.type,...void 0!==h?{title:h}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...xt(f)?{[`${n}2`]:{field:`${f}_${e.field}`}}:{},...r,...l}})}}function JG(t,n,e,r){const{clip:i,color:o,opacity:a}=t,u=t.type;return t[n]||void 0===t[n]&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...o?{color:o}:{},...a?{opacity:a}:{},...ZW(r.mark)?r.mark:{type:r.mark},style:`${u}-${String(n)}`,...gt(t[n])?{}:t[n]}}]:[]}function KG(t,n,e){const{encoding:r}=t,i="vertical"===n?"y":"x",o=r[`${i}2`],a=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:QG(r[i],e),continuousAxisChannelDef2:QG(o,e),continuousAxisChannelDefError:QG(a,e),continuousAxisChannelDefError2:QG(u,e),continuousAxis:i}}function QG(t,n){if(t?.aggregate){const{aggregate:e,...r}=t;return e!==n&&yU(function(t,n){return`Continuous axis should not have customized aggregation function ${t}; ${n} already agregates the axis.`}(e,n)),r}return t}function ZG(t,n){const{mark:e,encoding:r}=t,{x:i,y:o}=r;if(ZW(e)&&e.orient)return e.orient;if(KH(i)){if(KH(o)){const t=VH(i)&&i.aggregate,e=VH(o)&&o.aggregate;if(t||e!==n){if(e||t!==n){if(t===n&&e===n)throw new Error("Both x and y cannot have aggregate");return MG(o)&&!MG(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(KH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const tY="boxplot",nY=new PG(tY,rY);function eY(t){return bt(t)?"tukey":t}function rY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:o,...a}=t,u=ZW(e)?e:{type:e};i&&yU(Gq("boxplot"));const s=u.extent??n.boxplot.extent,c=Cq("size",u,n),f=u.invalid,l=eY(s),{bins:h,timeUnits:d,transform:m,continuousAxisChannelDef:p,continuousAxis:g,groupby:v,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:$}=function(t,n,e){const r=ZG(t,tY),{continuousAxisChannelDef:i,continuousAxis:o}=KG(t,r,tY),a=i.field,u=BR(a),s=eY(n),c=[...iY(a),{op:"median",field:a,as:`mid_box_${u}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+u},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+u}],f="min-max"===s||"tukey"===s?[]:[{calculate:`${CR(`upper_box_${u}`)} - ${CR(`lower_box_${u}`)}`,as:`iqr_${u}`},{calculate:`min(${CR(`upper_box_${u}`)} + ${CR(`iqr_${u}`)} * ${n}, ${CR(`max_${u}`)})`,as:`upper_whisker_${u}`},{calculate:`max(${CR(`lower_box_${u}`)} - ${CR(`iqr_${u}`)} * ${n}, ${CR(`min_${u}`)})`,as:`lower_whisker_${u}`}],{[o]:l,...h}=t.encoding,{customTooltipWithoutAggregatedField:d,filteredEncoding:m}=function(t){const{tooltip:n,...e}=t;if(!n)return{filteredEncoding:e};let r,i;if(D(n)){for(const t of n)t.aggregate?(r||(r=[]),r.push(t)):(i||(i=[]),i.push(t));r&&(e.tooltip=r)}else n.aggregate?e.tooltip=n:i=n;return D(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:e}}(h),{bins:p,timeUnits:g,aggregate:v,groupby:y,encoding:b}=qG(m,e),w="vertical"===r?"horizontal":"vertical",x=r;return{bins:p,timeUnits:g,transform:[...p,...g,{aggregate:[...v,...c],groupby:y},...f],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:d}}(t,s,n),k=BR(p.field),{color:M,size:A,...F}=b,E=t=>XG(u,g,p,t,n.boxplot),N=E(F),C=E(b),O=(S(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",_=E({...F,...A?{size:A}:{},color:{condition:{test:`${CR(`lower_box_${p.field}`)} >= ${CR(`upper_box_${p.field}`)}`,...M||{value:O}}}}),z=YG([{fieldPrefix:"min-max"===l?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===l?"lower_whisker_":"min_",titlePrefix:"Min"}],p,b),B={type:"tick",color:"black",opacity:1,orient:w,invalid:f,aria:!1},T="min-max"===l?z:YG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,b),P=[...N({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),...N({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:T})],j=[..."tukey"!==l?P:[],...C({partName:"box",mark:{type:"bar",...c?{size:c}:{},orient:x,invalid:f,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),..._({partName:"median",mark:{type:"tick",invalid:f,...S(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...c?{size:c}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===l)return{...a,transform:(a.transform??[]).concat(m),layer:j};const R=CR(`lower_box_${p.field}`),L=CR(`upper_box_${p.field}`),I=`(${L} - ${R})`,q=`${R} - ${s} * ${I}`,U=`${L} + ${s} * ${I}`,W=CR(p.field),H={joinaggregate:iY(p.field),groupby:v},G={transform:[{filter:`(${q} <= ${W}) && (${W} <= ${U})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${k}`},{op:"max",field:p.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${k}`},...y],groupby:v}],layer:P},{tooltip:Y,...V}=F,{scale:X,axis:J}=p,K=VG(p),Q=uR(J,["title"]),Z=JG(u,"outliers",n.boxplot,{transform:[{filter:`(${W} < ${q}) || (${W} > ${U})`}],mark:"point",encoding:{[g]:{field:p.field,type:p.type,...void 0!==K?{title:K}:{},...void 0!==X?{scale:X}:{},...wR(Q)?{}:{axis:Q}},...V,...M?{color:M}:{},...$?{tooltip:$}:{}}})[0];let tt;const nt=[...h,...d,H];return Z?tt={transform:nt,layer:[Z,G]}:(tt=G,tt.transform.unshift(...nt)),{...a,layer:[tt,{transform:m,layer:j}]}}function iY(t){const n=BR(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const oY="errorbar",aY=new PG(oY,uY);function uY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:c}=sY(t,oY,n);delete o.size;const f=XG(u,i,r,o,n.errorbar),l=u.thickness,h=u.size,d={type:"tick",orient:a,aria:!1,...void 0!==l?{thickness:l}:{},...void 0!==h?{size:h}:{}},m=[...f({partName:"ticks",mark:d,positionPrefix:"lower",extraEncoding:c}),...f({partName:"ticks",mark:d,positionPrefix:"upper",extraEncoding:c}),...f({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==l?{size:l}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})];return{...s,transform:e,...m.length>1?{layer:m}:{...m[0]}}}function sY(t,n,e){const{mark:r,encoding:i,params:o,projection:a,...u}=t,s=ZW(r)?r:{type:r};o&&yU(Gq(n));const{orient:c,inputType:f}=function(t,n){const{encoding:e}=t;if(function(t){return(tG(t.x)||tG(t.y))&&!tG(t.x2)&&!tG(t.y2)&&!tG(t.xError)&&!tG(t.xError2)&&!tG(t.yError)&&!tG(t.yError2)}(e))return{orient:ZG(t,n),inputType:"raw"};const r=function(t){return tG(t.x2)||tG(t.y2)}(e),i=function(t){return tG(t.xError)||tG(t.xError2)||tG(t.yError)||tG(t.yError2)}(e),o=e.x,a=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const t=e.x2,r=e.y2;if(tG(t)&&tG(r))throw new Error(`${n} cannot have both x2 and y2`);if(tG(t)){if(KH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(tG(r)){if(KH(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const t=e.xError,r=e.yError,i=e.yError2;if(tG(e.xError2)&&!tG(t))throw new Error(`${n} cannot have xError2 without xError`);if(tG(i)&&!tG(r))throw new Error(`${n} cannot have yError2 without yError`);if(tG(t)&&tG(r))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(tG(t)){if(KH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tG(r)){if(KH(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")}}(t,n),{continuousAxisChannelDef:l,continuousAxisChannelDef2:h,continuousAxisChannelDefError:d,continuousAxisChannelDefError2:m,continuousAxis:p}=KG(t,c,n),{errorBarSpecificAggregate:g,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:b}=function(t,n,e,r,i,o,a,u){let s=[],c=[];const f=n.field;let l,h=!1;if("raw"===o){const n=t.center?t.center:t.extent?"iqr"===t.extent?"median":"mean":u.errorbar.center,e=t.extent?t.extent:"mean"===n?"stderr":"iqr";if("median"===n!=("iqr"===e)&&yU(function(t,n,e){return`${t} is not usually used with ${n} for ${e}.`}(n,e,a)),"stderr"===e||"stdev"===e)s=[{op:e,field:f,as:`extent_${f}`},{op:n,field:f,as:`center_${f}`}],c=[{calculate:`${CR(`center_${f}`)} + ${CR(`extent_${f}`)}`,as:`upper_${f}`},{calculate:`${CR(`center_${f}`)} - ${CR(`extent_${f}`)}`,as:`lower_${f}`}],l=[{fieldPrefix:"center_",titlePrefix:FR(n)},{fieldPrefix:"upper_",titlePrefix:cY(n,e,"+")},{fieldPrefix:"lower_",titlePrefix:cY(n,e,"-")}],h=!0;else{let t,n,r;"ci"===e?(t="mean",n="ci0",r="ci1"):(t="median",n="q1",r="q3"),s=[{op:n,field:f,as:`lower_${f}`},{op:r,field:f,as:`upper_${f}`},{op:t,field:f,as:`center_${f}`}],l=[{fieldPrefix:"upper_",titlePrefix:dG({field:f,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:dG({field:f,aggregate:n,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:dG({field:f,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(t.center||t.extent)&&yU(function(t,n){return`${n?"extent ":""}${n&&t?"and ":""}${t?"center ":""}${n&&t?"are ":"is "}not needed when data are aggregated.`}(t.center,t.extent)),"aggregated-upper-lower"===o?(l=[],c=[{calculate:CR(e.field),as:`upper_${f}`},{calculate:CR(f),as:`lower_${f}`}]):"aggregated-error"===o&&(l=[{fieldPrefix:"",titlePrefix:f}],c=[{calculate:`${CR(f)} + ${CR(r.field)}`,as:`upper_${f}`}],c.push(i?{calculate:`${CR(f)} + ${CR(i.field)}`,as:`lower_${f}`}:{calculate:`${CR(f)} - ${CR(r.field)}`,as:`lower_${f}`}));for(const t of c)l.push({fieldPrefix:t.as.substring(0,6),titlePrefix:zR(zR(t.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:s,tooltipSummary:l,tooltipTitleWithFieldName:h}}(s,l,h,d,m,f,n,e),{[p]:w,["x"===p?"x2":"y2"]:x,["x"===p?"xError":"yError"]:$,["x"===p?"xError2":"yError2"]:k,...M}=i,{bins:A,timeUnits:D,aggregate:S,groupby:F,encoding:E}=qG(M,e),N=[...S,...g],C="raw"!==f?[]:F,O=YG(y,l,E,b);return{transform:[...u.transform??[],...A,...D,...0===N.length?[]:[{aggregate:N,groupby:C}],...v],groupby:C,continuousAxisChannelDef:l,continuousAxis:p,encodingWithoutContinuousAxis:E,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:s,outerSpec:u,tooltipEncoding:O}}function cY(t,n,e){return`${FR(t)} ${e} ${n}`}const fY="errorband",lY=new PG(fY,hY);function hY(t,{config:n}){t={...t,encoding:WG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=sY(t,fY,n),c=a,f=XG(c,i,r,o,n.errorband),l=void 0!==t.encoding.x&&void 0!==t.encoding.y;let h={type:l?"area":"rect"},d={type:l?"line":"rule"};const m={...c.interpolate?{interpolate:c.interpolate}:{},...c.tension&&c.interpolate?{tension:c.tension}:{}};return l?(h={...h,...m,ariaRoleDescription:"errorband"},d={...d,...m,aria:!1}):c.interpolate?yU(dU("interpolate")):c.tension&&yU(dU("tension")),{...u,transform:e,layer:[...f({partName:"band",mark:h,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...f({partName:"borders",mark:d,positionPrefix:"lower",extraEncoding:s}),...f({partName:"borders",mark:d,positionPrefix:"upper",extraEncoding:s})]}}const dY={};function mY(t,n,e){const r=new PG(t,n);dY[t]={normalizer:r,parts:e}}mY(tY,rY,["box","median","outliers","rule","ticks"]),mY(oY,uY,["ticks","rule"]),mY(fY,hY,["band","borders"]);const pY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],gY={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"},vY={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"},yY=xR(gY),bY=xR(vY),wY=xR({header:1,headerRow:1,headerColumn:1,headerFacet:1}),xY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],$Y="_vgsid_",kY={point:{on:"click",fields:[$Y],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function MY(t){return"legend"===t||!!t?.legend}function AY(t){return MY(t)&&S(t)}function DY(t){return!!t?.select}function SY(t){const n=[];for(const e of t||[]){if(DY(e))continue;const{expr:t,bind:r,...i}=e;if(r&&t){const e={...i,bind:r,init:t};n.push(e)}else{const e={...i,...t?{update:t}:{},...r?{bind:r}:{}};n.push(e)}}return n}function FY(t){return YR(t,"concat")}function EY(t){return YR(t,"vconcat")}function NY(t){return YR(t,"hconcat")}function CY({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function OY(t){return YR(t,"step")}function _Y(t){return YR(t,"view")||YR(t,"width")||YR(t,"height")}const zY=xR({align:1,bounds:1,center:1,columns:1,spacing:1});function BY(t,n){return t[n]??t["width"===n?"continuousWidth":"continuousHeight"]}function TY(t,n){const e=PY(t,n);return OY(e)?e.step:jY}function PY(t,n){return PR(t[n]??t["width"===n?"discreteWidth":"discreteHeight"],{step:t.step})}const jY=20,RY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:jY},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:sH,circle:{},geoshape:{},image:{},line:{},point:{},rect:uH,rule:{color:"black"},square:{},text:{color:"black"},tick:cH,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,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:kY,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},LY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],IY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},qY={blue:LY[0],orange:LY[1],red:LY[2],teal:LY[3],green:LY[4],yellow:LY[5],purple:LY[6],pink:LY[7],brown:LY[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 UY(t){const n=xR(t||{}),e={};for(const r of n){const n=t[r];e[r]=EG(n)?$q(n):kq(n)}return e}const WY=[...iH,...BG,...wY,"background","padding","legend","lineBreak","scale","style","title","view"];function HY(t={}){const{color:n,font:e,fontSize:r,selection:i,...o}=t,a=E({},iR(RY),e?function(t){return{text:{font:t},style:{"guide-label":{font:t},"guide-title":{font:t},"group-title":{font:t},"group-subtitle":{font:t}}}}(e):{},n?function(t={}){return{signals:[{name:"color",value:S(t)?{...qY,...t}:qY}],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(t){return{signals:[{name:"fontSize",value:S(t)?{...IY,...t}:IY}],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||{});i&&N(a,"selection",i,!0);const u=uR(a,WY);for(const t of["background","lineBreak","padding"])a[t]&&(u[t]=kq(a[t]));for(const t of iH)a[t]&&(u[t]=dq(a[t]));for(const t of BG)a[t]&&(u[t]=UY(a[t]));for(const t of wY)a[t]&&(u[t]=dq(a[t]));if(a.legend&&(u.legend=dq(a.legend)),a.scale){const{invalid:t,...n}=a.scale,e=dq(t,{level:1});u.scale={...dq(n),...xR(e).length>0?{invalid:e}:{}}}return a.style&&(u.style=function(t){const n=xR(t),e={};for(const r of n)e[r]=UY(t[r]);return e}(a.style)),a.title&&(u.title=dq(a.title)),a.view&&(u.view=dq(a.view)),u}const GY=new Set(["view",...QW]),YY=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],VY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...rH};function XY(t,n,e){"view"===n&&(e="cell");const r={...t[n],...t.style[e??n]};wR(r)||(t.style[e??n]=r),delete t[n]}function JY(t){return YR(t,"layer")}class KY{map(t,n){return jH(t)?this.mapFacet(t,n):function(t){return YR(t,"repeat")}(t)?this.mapRepeat(t,n):NY(t)?this.mapHConcat(t,n):EY(t)?this.mapVConcat(t,n):FY(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(JY(t))return this.mapLayer(t,n);if(TG(t))return this.mapUnit(t,n);throw new Error(Rq(t))}mapLayer(t,n){return{...t,layer:t.layer.map((t=>this.mapLayerOrUnit(t,n)))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map((t=>this.map(t,n)))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map((t=>this.map(t,n)))}}mapConcat(t,n){const{concat:e,...r}=t;return{...r,concat:e.map((t=>this.map(t,n)))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const QY={zero:1,center:1,normalize:1},ZY=new Set([TW,jW,PW,UW,IW,YW,VW,LW,WW,HW]),tV=new Set([jW,PW,TW]);function nV(t){return VH(t)&&"quantitative"===XH(t)&&!t.bin}function eV(t,n,{orient:e,type:r}){const i="x"===n?"y":"radius",o="x"===n&&["bar","area"].includes(r),a=t[n],u=t[i];if(VH(a)&&VH(u))if(nV(a)&&nV(u)){if(a.stack)return n;if(u.stack)return i;const t=VH(a)&&!!a.aggregate;if(t!==(VH(u)&&!!u.aggregate))return t?n:i;if(o){if("vertical"===e)return i;if("horizontal"===e)return n}}else{if(nV(a))return n;if(nV(u))return i}else{if(nV(a)){if(o&&"vertical"===e)return;return n}if(nV(u)){if(o&&"horizontal"===e)return;return i}}}function rV(t,n){const e=ZW(t)?t:{type:t},r=e.type;if(!ZY.has(r))return null;const i=eV(n,"x",e)||eV(n,"theta",e);if(!i)return null;const o=n[i],a=VH(o)?sG(o,{}):void 0,u=function(t){switch(t){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),s=[],c=new Set;if(n[u]){const t=n[u],e=VH(t)?sG(t,{}):void 0;e&&e!==a&&(s.push(u),c.add(e))}const f="x"===u?"xOffset":"yOffset",l=n[f],h=VH(l)?sG(l,{}):void 0;h&&h!==a&&(s.push(f),c.add(h));const d=kI.reduce(((t,e)=>{if("tooltip"!==e&&jG(n,e)){const r=n[e];for(const n of K(r)){const r=vG(n);if(r.aggregate)continue;const i=sG(r,{});i&&c.has(i)||t.push({channel:e,fieldDef:r})}}return t}),[]);let m;return void 0!==o.stack?m=gt(o.stack)?o.stack?"zero":null:o.stack:tV.has(r)&&(m="zero"),m&&ft(QY,m)?IG(n)&&0===d.length?null:(o?.scale?.type&&o?.scale?.type!==oW&&o?.stack&&yU(function(t){return`Stack is applied to a non-linear scale (${t}).`}(o.scale.type)),tG(n[eI(i)])?(void 0!==o.stack&&yU(`Cannot stack "${p=i}" if there is already "${p}2".`),null):(VH(o)&&o.aggregate&&!iq.has(o.aggregate)&&yU(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:s,groupbyFields:c,fieldChannel:i,impute:null!==o.impute&&JW(r),stackBy:d,offset:m})):null;var p}function iV(t,n,e){const r=dq(t),i=Cq("orient",r,e);if(r.orient=function(t,n,e){switch(t){case IW:case YW:case VW:case WW:case qW:case RW:return}const{x:r,y:i,x2:o,y2:a}=n;switch(t){case jW:if(VH(r)&&(sq(r.bin)||VH(i)&&i.aggregate&&!r.aggregate))return"vertical";if(VH(i)&&(sq(i.bin)||VH(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(e)return e;if(!o)return(VH(r)&&r.type===tW&&!uq(r.bin)||ZH(r))&&VH(i)&&sq(i.bin)?"horizontal":"vertical";if(!a)return(VH(i)&&i.type===tW&&!uq(i.bin)||ZH(i))&&VH(r)&&sq(r.bin)?"vertical":"horizontal"}case UW:if(o&&(!VH(r)||!sq(r.bin))&&a&&(!VH(i)||!sq(i.bin)))return;case PW:if(a)return VH(i)&&sq(i.bin)?"horizontal":"vertical";if(o)return VH(r)&&sq(r.bin)?"vertical":"horizontal";if(t===UW){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case LW:case HW:{const n=QH(r),o=QH(i);if(e)return e;if(n&&!o)return"tick"!==t?"horizontal":"vertical";if(!n&&o)return"tick"!==t?"vertical":"horizontal";if(n&&o)return"vertical";{const t=nG(r)&&r.type===eW,n=nG(i)&&i.type===eW;if(t&&!n)return"vertical";if(!t&&n)return"horizontal"}return}}return"vertical"}(r.type,n,i),void 0!==i&&i!==r.orient&&yU(`Specified orient "${r.orient}" overridden with "${i}".`),"bar"===r.type&&r.orient){const t=Cq("cornerRadiusEnd",r,e);if(void 0!==t){const e="horizontal"===r.orient&&n.x2||"vertical"===r.orient&&n.y2?["cornerRadius"]:aH[r.orient];for(const n of e)r[n]=t;void 0!==r.cornerRadiusEnd&&delete r.cornerRadiusEnd}}const o=Cq("opacity",r,e),a=Cq("fillOpacity",r,e);return void 0===o&&void 0===a&&(r.opacity=function(t,n){if(fR([IW,HW,YW,VW],t)&&!IG(n))return.7}(r.type,n)),void 0===Cq("cursor",r,e)&&(r.cursor=function(t,n,e){return n.href||t.href||Cq("href",t,e)?"pointer":t.cursor}(r,n,e)),r}function oV(t){const{point:n,line:e,...r}=t;return xR(r).length>1?r:r.type}function aV(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:uR(t[n],["point","line"])});return t}function uV(t,n={},e){return"transparent"===t.point?{opacity:0}:t.point?S(t.point)?t.point:{}:void 0!==t.point?null:n.point||e.shape?S(n.point)?n.point:{}:void 0}function sV(t,n={}){return t.line?!0===t.line?{}:t.line:void 0!==t.line?null:n.line?!0===n.line?{}:n.line:void 0}class cV{constructor(){this.name="path-overlay"}hasMatchingType(t,n){if(TG(t)){const{mark:e,encoding:r}=t,i=ZW(e)?e:{type:e};switch(i.type){case"line":case"rule":case"trail":return!!uV(i,n[i.type],r);case"area":return!!uV(i,n[i.type],r)||!!sV(i,n[i.type])}}return!1}run(t,n,e){const{config:r}=n,{params:i,projection:o,mark:a,name:u,encoding:s,...c}=t,f=WG(s,r),l=ZW(a)?a:{type:a},h=uV(l,r[l.type],f),d="area"===l.type&&sV(l,r[l.type]),m=[{name:u,...i?{params:i}:{},mark:oV({..."area"===l.type&&void 0===l.opacity&&void 0===l.fillOpacity?{opacity:.7}:{},...l}),encoding:uR(f,["shape"])}],p=rV(iV(l,f,r),f);let g=f;if(p){const{fieldChannel:t,offset:n}=p;g={...f,[t]:{...f[t],...n?{stack:n}:{}}}}return g=uR(g,["y2","x2"]),d&&m.push({...o?{projection:o}:{},mark:{type:"line",...aR(l,["clip","interpolate","tension","tooltip"]),...d},encoding:g}),h&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...aR(l,["clip","tooltip"]),...h},encoding:g}),e({...c,layer:m},{...n,config:aV(r)})}}function fV(t,n){return n?TH(t)?gV(t,n):dV(t,n):t}function lV(t,n){return n?gV(t,n):t}function hV(t,n,e){const r=n[t];return function(t){return!xt(t)&&YR(t,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void yU(function(t){return`Unknown repeated value "${t}".`}(r.repeat)):n}function dV(t,n){if(void 0!==(t=hV("field",t,n))){if(null===t)return null;if(LH(t)&&zH(t.sort)){const e=hV("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function mV(t,n){if(VH(t))return dV(t,n);{const e=hV("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function pV(t,n){if(!tG(t)){if(YH(t)){const e=mV(t.condition,n);if(e)return{...t,condition:e};{const{condition:n,...e}=t;return e}}return t}{const e=mV(t,n);if(e)return e;if(HH(t))return{condition:t.condition}}}function gV(t,n){const e={};for(const r in t)if(YR(t,r)){const i=t[r];if(D(i))e[r]=i.map((t=>pV(t,n))).filter((t=>t));else{const t=pV(i,n);void 0!==t&&(e[r]=t)}}return e}class vV{constructor(){this.name="RuleForRangedLine"}hasMatchingType(t){if(TG(t)){const{encoding:n,mark:e}=t;if("line"===e||ZW(e)&&"line"===e.type)for(const t of QL){const e=n[tI(t)];if(n[t]&&(VH(e)&&!sq(e.bin)||JH(e)))return!0}}return!1}run(t,n,e){const{encoding:r,mark:i}=t;var o;return yU(`Line mark is for continuous lines and thus cannot be used with ${(o=!!r.x2)&&!!r.y2?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`),e({...t,mark:S(i)?{...i,type:"rule"}:"rule"},n)}}function yV({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...xR(t),...xR(n)]);for(const o of i){const i=n[o],a=t[o];if(tG(i)){const t={...a,...i};r[o]=t}else YH(i)?r[o]={...i,condition:{...a,...i.condition}}:i||null===i?r[o]=i:(e||eG(a)||gq(a)||tG(a)||D(a))&&(r[o]=a)}}else r=n;return!r||wR(r)?void 0:r}function bV(t){const{parentProjection:n,projection:e}=t;return n&&e&&yU(function(t){const{parentProjection:n,projection:e}=t;return`Layer's shared projection ${GR(n)} is overridden by a child projection ${GR(e)}.`}({parentProjection:n,projection:e})),e??n}function wV(t){return YR(t,"filter")}function xV(t){return YR(t,"lookup")}function $V(t){return YR(t,"pivot")}function kV(t){return YR(t,"density")}function MV(t){return YR(t,"quantile")}function AV(t){return YR(t,"regression")}function DV(t){return YR(t,"loess")}function SV(t){return YR(t,"sample")}function FV(t){return YR(t,"window")}function EV(t){return YR(t,"joinaggregate")}function NV(t){return YR(t,"flatten")}function CV(t){return YR(t,"calculate")}function OV(t){return YR(t,"bin")}function _V(t){return YR(t,"impute")}function zV(t){return YR(t,"timeUnit")}function BV(t){return YR(t,"aggregate")}function TV(t){return YR(t,"stack")}function PV(t){return YR(t,"fold")}function jV(t){return YR(t,"extent")&&!YR(t,"density")&&!YR(t,"regression")}function RV(t,n){const{transform:e,...r}=t;if(e){const t=e.map((t=>{if(wV(t))return{filter:qV(t,n)};if(OV(t)&&cq(t.bin))return{...t,bin:IV(t.bin)};if(xV(t)){const{selection:n,...e}=t.from;return n?{...t,from:{param:n,...e}}:t}return t}));return{...r,transform:t}}return t}function LV(t,n){const e=iR(t);if(VH(e)&&cq(e.bin)&&(e.bin=IV(e.bin)),rG(e)&&e.scale?.domain?.selection){const{selection:t,...n}=e.scale.domain;e.scale.domain={...n,...t?{param:t}:{}}}if(HH(e))if(D(e.condition))e.condition=e.condition.map((t=>{const{selection:e,param:r,test:i,...o}=t;return r?t:{...o,test:qV(t,n)}}));else{const{selection:t,param:r,test:i,...o}=LV(e.condition,n);e.condition=r?e.condition:{...o,test:qV(e.condition,n)}}return e}function IV(t){const n=t.extent;if(n?.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function qV(t,n){const e=t=>rR(t,(t=>{var e;const r={param:t,empty:n.emptySelections[t]??!0};return(e=n.selectionPredicates)[t]??(e[t]=[]),n.selectionPredicates[t].push(r),r}));return t.selection?e(t.selection):rR(t.test||t.filter,(t=>t.selection?e(t.selection):t))}class UV extends KY{map(t,n){const e=n.selections??[];if(t.params&&!TG(t)){const n=[];for(const r of t.params)DY(r)?e.push(r):n.push(r);t.params=n}return n.selections=e,super.map(t,n)}mapUnit(t,n){const e=n.selections;if(!e||!e.length)return t;const r=(n.path??[]).concat(t.name),i=[];for(const n of e)if(n.views&&n.views.length)for(const e of n.views)(xt(e)&&(e===t.name||r.includes(e))||D(e)&&e.map((t=>r.indexOf(t))).every(((t,n,e)=>-1!==t&&(0===n||t>e[n-1]))))&&i.push(n);else i.push(n);return i.length&&(t.params=i),t}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=UV.prototype[t];UV.prototype[t]=function(t,e){return n.call(this,t,WV(t,e))}}function WV(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function HV(t,n){void 0===n&&(n=HY(t.config));const e=function(t,n={}){const e={config:n};return VV.map(GV.map(YV.map(t,e),e),e)}(t,n),{width:r,height:i}=t,o=function(t,n,e){let{width:r,height:i}=n;const o=TG(t)||JY(t),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(yU(Lq("width")),r=void 0),"container"==i&&(yU(Lq("height")),i=void 0));const u={type:"pad",...a,...e?XV(e.autosize):{},...XV(t.autosize)};if("fit"!==u.type||o||(yU('Autosize "fit" only works for single views and layered views.'),u.type="pad"),"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&yU(Iq("width")),"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&yU(Iq("height")),!HR(u,{type:"pad"}))return u}(e,{width:r,height:i},n);return{...e,...o?{autosize:o}:{}}}const GV=new class extends KY{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[nY,aY,lY,new cV,new vV]}map(t,n){if(TG(t)){const e=jG(t.encoding,VR),r=jG(t.encoding,XR),i=jG(t.encoding,JR);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=lV(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const t of this.nonFacetUnitNormalizers)if(t.hasMatchingType(o,n.config))return t.run(o,n,a);return o}mapRepeat(t,n){return function(t){return!D(t.repeat)&&YR(t.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:o,column:a,layer:u}=e,{repeater:s={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:r}},n):{...i,layer:u.map((t=>{const e={...s,layer:t},i=`${(r.name?`${r.name}_`:"")+c}child__layer_${AR(t)}`,o=this.mapLayerOrUnit(r,{...n,repeater:e,repeaterPrefix:i});return o.name=i,o}))}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...o}=t;!D(e)&&t.columns&&(t=uR(t,["columns"]),yU(Yq("repeat")));const a=[],{repeater:u={},repeaterPrefix:s=""}=n,c=!D(e)&&e.row||[u?u.row:null],f=!D(e)&&e.column||[u?u.column:null],l=D(e)&&e||[u?u.repeat:null];for(const t of l)for(const i of c)for(const o of f){const c={repeat:t,row:i,column:o,layer:u.layer},f=(r.name?`${r.name}_`:"")+s+"child__"+(D(e)?`${AR(t)}`:(e.row?`row_${AR(i)}`:"")+(e.column?`column_${AR(o)}`:"")),l=this.map(r,{...n,repeater:c,repeaterPrefix:f});l.name=f,a.push(uR(l,["data"]))}const h=D(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...o,columns:h,concat:a}}mapFacet(t,n){const{facet:e}=t;return TH(e)&&t.columns&&(t=uR(t,["columns"]),yU(Yq("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:o,config:a}=n,u=bV({parentProjection:o,projection:r}),s=yV({parentEncoding:i,encoding:lV(e,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...s?{encoding:s}:{}},{config:a})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...o}=t.encoding,{mark:a,width:u,projection:s,height:c,view:f,params:l,encoding:h,...d}=t,{facetMapping:m,layout:p}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=lV(o,n.repeater);return this.mapFacet({...d,...p,facet:m,spec:{...u?{width:u}:{},...c?{height:c}:{},...f?{view:f}:{},...s?{projection:s}:{},mark:a,encoding:g,...l?{params:l}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&yU(`Facet encoding dropped as ${(o=[...e?[VR]:[],...r?[XR]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const n={},a={};for(const e of[VR,XR]){const r=t[e];if(r){const{align:t,center:i,spacing:o,columns:u,...s}=r;n[e]=s;for(const t of["align","center","spacing"])void 0!==r[t]&&(a[t]??(a[t]={}),a[t][e]=r[t])}}return{facetMapping:n,layout:a}}{const{align:t,center:e,spacing:r,columns:o,...a}=i;return{facetMapping:fV(a,n.repeater),layout:{...t?{align:t}:{},...e?{center:e}:{},...r?{spacing:r}:{},...o?{columns:o}:{}}}}var o}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:o,...a}=t,u={...r,parentEncoding:yV({parentEncoding:n,encoding:i,layer:!0}),parentProjection:bV({parentProjection:e,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{}},u)}},YV=new class extends KY{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=RV(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=RV(t,n)).encoding){const e={};for(const[r,i]of kR(t.encoding))e[r]=LV(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:kR(e).map((([t,e])=>{const{init:r,bind:i,empty:o,...a}=e;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),n.emptySelections[t]="none"!==o;for(const e of $R(n.selectionPredicates[t]??{}))e.empty="none"!==o;return{name:t,value:r,select:a,bind:i}}))}:t}},VV=new UV;function XV(t){return xt(t)?{type:t}:t??{}}const JV=["background","padding"];function KV(t,n){const e={};for(const n of JV)t&&void 0!==t[n]&&(e[n]=kq(t[n]));return n&&(e.params=t.params),e}class QV{constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new QV(iR(this.explicit),iR(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return PR(this.explicit[t],this.implicit[t])}getWithExplicit(t){return void 0!==this.explicit[t]?{explicit:!0,value:this.explicit[t]}:void 0!==this.implicit[t]?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:e}){void 0!==n&&this.set(t,n,e)}set(t,n,e){return delete this[e?"implicit":"explicit"][t],this[e?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:e}){void 0!==n[t]?this.set(t,n[t],!0):void 0!==e[t]&&this.set(t,e[t],!1)}copyKeyFromObject(t,n){void 0!==n[t]&&this.set(t,n[t],!0)}copyAll(t){for(const n of xR(t.combine())){const e=t.getWithExplicit(n);this.setWithExplicit(n,e)}}}function ZV(t){return{explicit:!0,value:t}}function tX(t){return{explicit:!1,value:t}}function nX(t){return(n,e,r,i)=>{const o=t(n.value,e.value);return o>0?n:o<0?e:eX(n,e,r,i)}}function eX(t,n,e,r){return t.explicit&&n.explicit&&yU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${GR(e)} and ${GR(r)}). Using ${GR(e)}.`}(e,r,t.value,n.value)),t}function rX(t,n,e,r,i=eX){return void 0===t||void 0===t.value?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:HR(t.value,n.value)?t:i(t,n,e,r)}class iX extends QV{constructor(t={},n={},e=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=e}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function oX(t){return YR(t,"url")}function aX(t){return YR(t,"values")}function uX(t){return YR(t,"name")&&!oX(t)&&!aX(t)&&!sX(t)}function sX(t){return t&&(cX(t)||fX(t)||lX(t))}function cX(t){return YR(t,"sequence")}function fX(t){return YR(t,"sphere")}function lX(t){return YR(t,"graticule")}var hX;function dX({invalid:t,isPath:n}){switch(fH(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}!function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"}(hX||(hX={}));class mX{constructor(t,n){this.debugName=n,this._children=[],this._parent=null,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){this._children.includes(t)?yU("Attempt to add the same child twice."):void 0!==n?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const n of this._children)n.parent=t;this._children=[],t.removeChild(this);const e=t.parent.removeChild(t);this._parent=n,n.addChild(this,e),t.parent=this}}class pX extends mX{clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,e,r){super(t,n),this.type=e,this.refCounts=r,this._source=this._name=n,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 ${RR()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function gX(t){return void 0!==t.as}function vX(t){return`${t}_end`}class yX extends mX{clone(){return new yX(null,iR(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{const{field:i,timeUnit:o}=e;if(o){let a;if(FU(o)){if(SZ(n)){const{mark:t,markDef:r,config:u}=n,s=IH({fieldDef:e,markDef:r,config:u});(KW(t)||s)&&(a={timeUnit:TU(o),field:i})}}else a={as:sG(e,{forAs:!0}),field:i,timeUnit:o};if(SZ(n)){const{mark:t,markDef:i,config:o}=n,u=IH({fieldDef:e,markDef:i,config:o});KW(t)&&DI(r)&&.5!==u&&(a.rectBandPosition=u)}a&&(t[sR(a)]=a)}return t}),{});return wR(e)?null:new yX(t,e)}static makeFromTransform(t,n){const{timeUnit:e,...r}={...n},i={...r,timeUnit:TU(e)};return new yX(t,{[sR(i)]:i})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[e,r]of kR(this.timeUnits)){const i=gX(r)?r.as:`${r.field}_end`;t.has(i)||(n[e]=r)}this.timeUnits=n}producedFields(){return new Set($R(this.timeUnits).map((t=>gX(t)?t.as:vX(t.field))))}dependentFields(){return new Set($R(this.timeUnits).map((t=>t.field)))}hash(){return`TimeUnit ${sR(this.timeUnits)}`}assemble(){const t=[];for(const n of $R(this.timeUnits)){const{rectBandPosition:e}=n,r=TU(n.timeUnit);if(gX(n)){const{field:i,as:o}=n,{unit:a,utc:u,...s}=r,c=[o,`${o}_end`];t.push({field:_R(i),type:"timeunit",...a?{units:OU(a)}:{},...u?{timezone:"utc"}:{},...s,as:c}),t.push(...$X(c,e,r))}else if(n){const{field:i}=n,o=i.replaceAll("\\.","."),a=xX({timeUnit:r,field:o}),u=vX(o);t.push({type:"formula",expr:a,as:u}),t.push(...$X([o,u],e,r))}}return t}}const bX="offsetted_rect_start",wX="offsetted_rect_end";function xX({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,o=_U(r),{part:a,step:u}=RU(o,t.step);return`${i?"utcOffset":"timeOffset"}('${a}', ${CR(n)}, ${e?-u:u})`}function $X([t,n],e,r){if(void 0!==e&&.5!==e){const i=CR(t),o=CR(n);return[{type:"formula",expr:kX([xX({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${bX}`},{type:"formula",expr:kX([i,o],e+.5),as:`${t}_${wX}`}]}return[]}function kX([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const MX="_tuple_fields";class AX{constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const DX={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??(n.project=new AX),o={},a={},u=new Set,s=(t,n)=>{const e="visual"===n?t.channel:t.field;let i=AR(`${r}_${e}`);for(let t=1;u.has(i);t++)i=AR(`${r}_${e}_${t}`);return u.add(i),{[n]:i}},c=n.type,f=t.config.selection[c],l=void 0!==e.value?K(e.value):null;let{fields:h,encodings:d}=S(e.select)?e.select:{};if(!h&&!d&&l)for(const t of l)if(S(t))for(const n of xR(t))ft(JL,n)?(d||(d=[])).push(n):"interval"===c?(yU('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),d=f.encodings):(h??(h=[])).push(n);h||d||(d=f.encodings,"fields"in f&&(h=f.fields));for(const n of d??[]){const e=t.fieldDef(n);if(e){let r=e.field;if(e.aggregate){yU(Hq(n,e.aggregate));continue}if(!r){yU(Wq(n));continue}if(e.timeUnit&&!FU(e.timeUnit)){r=t.vgField(n);const i={timeUnit:e.timeUnit,as:r,field:e.field};a[sR(i)]=i}if(!o[r]){const a={field:r,channel:n,type:"interval"===c&&GI(n)&&xW(t.getScaleComponent(n).get("type"))?"R":e.bin?"R-RE":"E",index:i.items.length};a.signals={...s(a,"data"),...s(a,"visual")},i.items.push(o[r]=a),i.hasField[r]=o[r],i.hasSelectionId=i.hasSelectionId||r===$Y,BL(n)?(a.geoChannel=n,a.channel=zL(n),i.hasChannel[a.channel]=o[r]):i.hasChannel[n]=o[r]}}else yU(Wq(n))}for(const t of h??[]){if(i.hasField[t])continue;const n={type:"E",field:t,index:i.items.length};n.signals={...s(n,"data")},i.items.push(n),i.hasField[t]=n,i.hasSelectionId=i.hasSelectionId||t===$Y}l&&(n.init=l.map((t=>i.items.map((n=>S(t)?void 0!==t[n.geoChannel||n.channel]?t[n.geoChannel||n.channel]:t[n.field]:t))))),wR(a)||(i.timeUnit=new yX(null,a))},signals:(t,n,e)=>{const r=n.name+MX;return e.filter((t=>t.name===r)).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(PX)})}},SX="_curr",FX="anim_value",EX="anim_clock",NX="eased_anim_clock",CX="min_extent",OX="max_range_extent",_X="last_tick_at",zX="is_playing",BX=1/60*1e3,TX={defined:t=>"point"===t.type,topLevelSignals:(t,n,e)=>(QJ(n)&&(e=e.concat([{name:EX,init:"0",on:[{events:{type:"timer",throttle:BX},update:`${zX} ? (${EX} + (now() - ${_X}) > ${OX} ? 0 : ${EX} + (now() - ${_X})) : ${EX}`}]},{name:_X,init:"now()",on:[{events:[{signal:EX},{signal:zX}],update:"now()"}]},{name:zX,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+MX,o=n.project,a="(item().isVoronoi ? datum.datum : datum)",u=$R(t.component.selection??{}).reduce(((t,n)=>"interval"===n.type?t.concat(n.name+GX):t),[]).map((t=>`indexof(item().mark.name, '${t}') < 0`)).join(" && "),s="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(u?` && ${u}`:"");let c=`unit: ${XJ(t)}, `;if(n.project.hasSelectionId?c+=`${$Y}: ${a}[${Et($Y)}]`:QJ(n)?c+=`fields: ${i}, values: [${FX} ? ${FX} : ${CX}]`:c+=`fields: ${i}, values: [${o.items.map((n=>{const e=t.fieldDef(n.channel);return e?.bin?`[${a}[${Et(t.vgField(n.channel,{}))}], ${a}[${Et(t.vgField(n.channel,{binSuffix:"end"}))}]]`:`${a}[${Et(n.field)}]`})).join(", ")}]`,QJ(n))return e.concat((f=n.name,l=t.scaleName(lL),[{name:NX,update:EX},{name:`${f}_domain`,init:`domain('${l}')`},{name:CX,init:`extent(${f}_domain)[0]`},{name:OX,init:`extent(range('${l}'))[1]`},{name:FX,update:`invert('${l}', ${NX})`}]),[{name:r+HJ,on:[{events:[{signal:NX},{signal:FX}],update:`{${c}}`,force:!0}]}]);{const t=n.events;return e.concat([{name:r+HJ,on:t?[{events:t,update:`${s} ? {${c}} : null`,force:!0}]:[]}])}var f,l}};function PX(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=_R(i.field),i}function jX(t,n=!0,e=b){if(D(t)){const r=t.map((t=>jX(t,n,e)));return n?`[${r.join(", ")}]`:r}return bU(t)?e(n?AU(t):function(t){const n=MU(t,!0);return t.utc?+new Date(Date.UTC(...n)):+new Date(...n)}(t)):n?e(GR(t)):t}function RX(t,n){for(const e of $R(t.component.selection??{})){const r=e.name;let i=`${r}${HJ}, ${"global"===e.resolve?"true":`{unit: ${XJ(t)}}`}`;for(const r of VJ)r.defined(e)&&(r.signals&&(n=r.signals(t,e,n)),r.modifyExpr&&(i=r.modifyExpr(t,e,i)));n.push({name:r+GJ,on:[{events:{signal:e.name+HJ},update:`modify(${Et(e.name+WJ)}, ${i})`}]})}return qX(n)}function LX(t,n){if(t.component.selection&&xR(t.component.selection).length){const e=Et(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:iB("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return qX(n)}function IX(t,n){for(const e of $R(t.component.selection??{}))for(const r of VJ)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function qX(t){return t.map((t=>(t.on&&!t.on.length&&delete t.on,t)))}const UX={defined:t=>"interval"===t.type&&"global"===t.resolve&&t.bind&&"scales"===t.bind,parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!GI(i))continue;const o=t.getScaleComponent(i),a=o?o.get("type"):void 0;"sequential"==a&&yU("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&xW(a)?(o.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):yU("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter((t=>0===e.filter((n=>n.name===t.signals.data)).length));if(!t.parent||HX(t)||0===r.length)return e;const i=e.find((t=>t.name===n.name));let o=i.update;if(o.includes(YJ))i.update=`{${r.map((t=>`${Et(_R(t.field))}: ${t.signals.data}`)).join(", ")}}`;else{for(const t of r){const n=`${Et(_R(t.field))}: ${t.signals.data}`;o.includes(n)||(o=`${o.substring(0,o.length-1)}, ${n}}`)}i.update=o}return e.concat(r.map((t=>({name:t.signals.data}))))},signals:(t,n,e)=>{if(t.parent&&!HX(t))for(const t of n.scales){const n=e.find((n=>n.name===t.signals.data));n.push="outer",delete n.value,delete n.update}return e}};function WX(t,n){return`domain(${Et(t.scaleName(n))})`}function HX(t){return t.parent&&NZ(t.parent)&&(!t.parent.parent||HX(t.parent.parent))}const GX="_brush",YX="_scale_trigger",VX="geo_interval_init_tick",XX="_init",JX={defined:t=>"interval"===t.type,parse:(t,n,e)=>{var r;if(t.hasProjection){const t={...S(e.select)?e.select:{}};t.fields=[$Y],t.encodings||(t.encodings=e.value?xR(e.value):[sL,uL]),e.select={type:"interval",...t}}if(n.translate&&!UX.defined(n)){const t=`!event.item || event.item.mark.name !== ${Et(n.name+GX)}`;for(const e of n.events){if(!e.between){yU(`${e} is not an ordered event stream for interval selections.`);continue}const n=K((r=e.between[0]).filter??(r.filter=[]));n.includes(t)||n.push(t)}}},signals:(t,n,e)=>{const r=n.name,i=r+HJ,o=$R(n.project.hasChannel).filter((t=>t.channel===KR||t.channel===QR)),a=n.init?n.init[0]:null;if(e.push(...o.reduce(((e,r)=>e.concat(function(t,n,e,r){const i=!t.hasProjection,o=e.channel,a=e.signals.visual,u=Et(i?t.scaleName(o):t.projectionName()),s=t=>`scale(${u}, ${t})`,c=t.getSizeSignalRef(o===KR?"width":"height").signal,f=`${o}(unit)`,l=n.events.reduce(((t,n)=>[...t,{events:n.between[0],update:`[${f}, ${f}]`},{events:n,update:`[${a}[0], clamp(${f}, 0, ${c})]`}]),[]);if(i){const i=e.signals.data,c=UX.defined(n),f=t.getScaleComponent(o),h=f?f.get("type"):void 0,d=r?{init:jX(r,!0,s)}:{value:[]};return l.push({events:{signal:n.name+YX},update:xW(h)?`[${s(`${i}[0]`)}, ${s(`${i}[1]`)}]`:"[0, 0]"}),c?[{name:i,on:[]}]:[{name:a,...d,on:l},{name:i,...r?{init:jX(r)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${u}, ${a})`}]}]}{const t=o===KR?0:1,e=n.name+XX;return[{name:a,...r?{init:`[${e}[0][${t}], ${e}[1][${t}]]`}:{value:[]},on:l}]}}(t,n,r,a&&a[r.index]))),[])),t.hasProjection){const u=Et(t.projectionName()),s=t.projectionName()+"_center",{x:c,y:f}=n.project.hasChannel,l=c&&c.signals.visual,h=f&&f.signals.visual,d=c?a&&a[c.index]:`${s}[0]`,m=f?a&&a[f.index]:`${s}[1]`,p=n=>t.getSizeSignalRef(n).signal,g=`[[${l?l+"[0]":"0"}, ${h?h+"[0]":"0"}],[${l?l+"[1]":p("width")}, ${h?h+"[1]":p("height")}]]`;!a||(e.unshift({name:r+XX,init:`[scale(${u}, [${c?d[0]:d}, ${f?m[0]:m}]), scale(${u}, [${c?d[1]:d}, ${f?m[1]:m}])]`}),c&&f)||e.find((t=>t.name===s))||e.unshift({name:s,update:`invert(${u}, [${p("width")}/2, ${p("height")}/2])`});const v=`vlSelectionTuples(intersect(${g}, {markname: ${Et(t.getName("marks"))}}, unit.mark), {unit: ${XJ(t)}})`,y=o.map((t=>t.signals.visual));return e.concat({name:i,on:[{events:[...y.length?[{signal:y.join(" || ")}]:[],...a?[{signal:VX}]:[]],update:v}]})}{if(!UX.defined(n)){const n=r+YX,i=o.map((n=>{const e=n.channel,{data:r,visual:i}=n.signals,o=Et(t.scaleName(e)),a=xW(t.getScaleComponent(e).get("type"))?"+":"";return`(!isArray(${r}) || (${a}invert(${o}, ${i})[0] === ${a}${r}[0] && ${a}invert(${o}, ${i})[1] === ${a}${r}[1]))`}));i.length&&e.push({name:n,value:{},on:[{events:o.map((n=>({scale:t.scaleName(n.channel)}))),update:i.join(" && ")+` ? ${n} : {}`}]})}const u=o.map((t=>t.signals.data)),s=`unit: ${XJ(t)}, fields: ${r+MX}, values`;return e.concat({name:i,...a?{init:`{${s}: ${jX(a)}}`}:{},...u.length?{on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${s}: [${u}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(SZ(t)&&t.hasProjection&&n.init&&(e.filter((t=>t.name===VX)).length||e.unshift({name:VX,value:null,on:[{events:"timer{1}",update:`${VX} === null ? {} : ${VX}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:o}=n.project.hasChannel,a=i?.signals.visual,u=o?.signals.visual,s=`data(${Et(n.name+WJ)})`;if(UX.defined(n)||!i&&!o)return e;const c={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const n of xR(c))c[n]=[{test:`${s}.length && ${s}[0].unit === ${XJ(t)}`,...c[n]},{value:0}];const{fill:f,fillOpacity:l,cursor:h,...d}=n.mark,m=xR(d).reduce(((t,n)=>(t[n]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter((t=>t)).join(" && "),value:d[n]},{value:null}],t)),{}),p=h??(n.translate?"move":null);return[{name:`${r+GX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:l}},update:c}},...e,{name:r+GX,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...c,...m}}}]}};function KX({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const o=HH(n)&&n.condition;let a=[];o&&(a=K(o).map((n=>{const e=i(n);if(function(t){return YR(t,"param")}(n)){const{param:r,empty:i}=n;return{test:rK(t,{param:r,empty:i}),...e}}return{test:oK(t,n.test),...e}}))),void 0!==r&&a.push(r);const u=i(n);return void 0!==u&&a.push(u),a.length>1||1===a.length&&Boolean(a[0].test)?{[e]:a}:1===a.length?{[e]:a[0]}:{}}function QX(t,n="text"){return KX({model:t,channelDef:t.encoding[n],vgChannel:n,mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0})}function ZX(t,n,e="datum"){if(t){if(eG(t))return Aq(t.value);if(tG(t)){const{format:r,formatType:i}=gG(t);return $H({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function tJ(t,n={}){const{encoding:e,markDef:r,config:i,stack:o}=t,a=e.tooltip;if(D(a))return{tooltip:eJ({tooltip:a},o,i,n)};{const u=n.reactiveGeom?"datum.datum":"datum";return KX({model:t,channelDef:a,vgChannel:"tooltip",mainRefFn:t=>{const a=ZX(t,i,u);if(a)return a;if(null===t)return;let s=Cq("tooltip",r,i);return!0===s&&(s={content:"encoding"}),xt(s)?{value:s}:S(s)?gq(s)?s:"encoding"===s.content?eJ(e,o,i,n):{signal:u}:void 0},invalidValueRef:void 0})}}function nJ(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},o=new Set,a=r?"datum.datum":"datum",u=[];function s(e,r){const s=tI(r),c=nG(e)?e:{...e,type:t[s].type},f=K(c.title||pG(c,i)).join(", ").replaceAll(/"/g,'\\"');let l;if(DI(r)){const n="x"===r?"x2":"y2",e=vG(t[n]);if(sq(c.bin)&&e){const t=sG(c,{expr:a}),r=sG(e,{expr:a}),{format:u,formatType:s}=gG(c);l=NH(t,r,u,s,i),o.add(n)}}if((DI(r)||r===oL||r===rL)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:t,formatType:n}=gG(c);l=$H({fieldOrDatumDef:c,format:t,formatType:n,expr:a,config:i,normalizeStack:!0}).signal}l??(l=ZX(c,i,a).signal),u.push({channel:r,key:f,value:l})}HG(t,((t,n)=>{VH(t)?s(t,n):GH(t)&&s(t.condition,n)}));const c={};for(const{channel:t,key:n,value:e}of u)o.has(t)||c[n]||(c[n]=e);return c}function eJ(t,n,e,{reactiveGeom:r}={}){const i=nJ(t,n,e,{reactiveGeom:r}),o=kR(i).map((([t,n])=>`"${t}": ${n}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function rJ(t){const{markDef:n,config:e}=t,r=Cq("aria",n,e);return!1===r?{}:{...r?{aria:r}:{},...iJ(t),...oJ(t)}}function iJ(t){const{mark:n,markDef:e,config:r}=t;if(!1===r.aria)return{};const i=Cq("ariaRoleDescription",e,r);return null!=i?{ariaRoleDescription:{value:i}}:ft(wq,n)?{}:{ariaRoleDescription:{value:n}}}function oJ(t){const{encoding:n,markDef:e,config:r,stack:i}=t,o=n.description;if(o)return KX({model:t,channelDef:o,vgChannel:"description",mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0});const a=Cq("description",e,r);if(null!=a)return{description:Aq(a)};if(!1===r.aria)return{};const u=nJ(n,i,r);return wR(u)?void 0:{description:{signal:kR(u).map((([t,n],e)=>`"${e>0?"; ":""}${t}: " + (${n})`)).join(" + ")}}}function aJ(t,n,e={}){const{markDef:r,encoding:i,config:o}=n,{vgChannel:a}=e;let{defaultRef:u,defaultValue:s}=e;const c=i[t];void 0===u&&(s??(s=Cq(t,r,o,{vgChannel:a,ignoreVgConfig:!HH(c)})),void 0!==s&&(u=Aq(s)));const f={markDef:r,config:o,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},l=dH({...f,scaleChannel:t,channelDef:c});return KX({model:n,channelDef:c,vgChannel:a??t,invalidValueRef:l,mainRefFn:n=>yH({...f,channel:t,channelDef:n,stack:null,defaultRef:u})})}function uJ(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:o}=e,a=n.filled??Cq("filled",e,i),u=fR(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=Cq(!0===a?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[!0===a&&"color"]??u,c=Cq(!1===a?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[!1===a&&"color"],f=a?"fill":"stroke",l={...s?{fill:Aq(s)}:{},...c?{stroke:Aq(c)}:{}};return e.color&&(a?e.fill:e.stroke)&&yU(tU("property",{fill:"fill"in e,stroke:"stroke"in e})),{...l,...aJ("color",t,{vgChannel:f,defaultValue:a?s:c}),...aJ("fill",t,{defaultValue:r.fill?s:void 0}),...aJ("stroke",t,{defaultValue:r.stroke?c:void 0})}}function sJ(t){const{encoding:n,mark:e}=t,r=n.order;return!JW(e)&&eG(r)?KX({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:t=>Aq(t.value),invalidValueRef:void 0}):{}}function cJ({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const o=`${t}Offset`,a=n[o],u=e[o];if(("xOffset"===o||"yOffset"===o)&&u)return{offsetType:"encoding",offset:yH({channel:o,channelDef:u,markDef:n,config:r?.config,scaleName:r.scaleName(o),scale:r.getScaleComponent(o),stack:null,defaultRef:Aq(a),bandPosition:i})};const s=n[o];return s?{offsetType:"visual",offset:s}:{}}function fJ(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:o,config:a,stack:u}=n,s=i[t],c=i[eI(t)],f=n.scaleName(t),l=n.getScaleComponent(t),{offset:h,offsetType:d}=cJ({channel:t,markDef:o,encoding:i,model:n,bandPosition:.5}),m=lJ({model:n,defaultPos:e,channel:t,scaleName:f,scale:l}),p=!s&&DI(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(t){const{channel:n,channelDef:e,scaleName:r,stack:i,offset:o,markDef:a}=t;if(tG(e)&&i&&n===i.fieldChannel){if(VH(e)){let t=e.bandPosition;if(void 0!==t||"text"!==a.type||"radius"!==n&&"theta"!==n||(t=.5),void 0!==t)return vH({scaleName:r,fieldOrDatumDef:e,startSuffix:"start",bandPosition:t,offset:o})}return gH(e,r,{suffix:"end"},{offset:o})}return pH(t)}({channel:t,channelDef:s,channel2Def:c,markDef:o,config:a,scaleName:f,scale:l,stack:u,offset:h,defaultRef:m,bandPosition:"encoding"===d?0:void 0});return p?{[r||t]:p}:void 0}function lJ({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:o,config:a}=t;return()=>{const u=tI(e),s=nI(e),c=Cq(e,o,a,{vgChannel:s});if(void 0!==c)return bH(e,c);switch(n){case"zeroOrMin":return hJ({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:u,config:a});case"zeroOrMax":return hJ({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:u,config:a});case"mid":return{...t[rI(e)],mult:.5}}}}function hJ({mainChannel:t,config:n,...e}){const r=hH(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if("zeroOrMin"===i)return{value:0};const{widthSignal:t,heightSignal:n}=i.zeroOrMax;return{signal:`min(${t},${n})/2`}}case"theta":return"zeroOrMin"===i?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===i?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===i?{field:{group:"height"}}:{value:0}}}const dJ={left:"x",center:"xc",right:"x2"},mJ={top:"y",middle:"yc",bottom:"y2"};function pJ(t,n,e,r="middle"){if("radius"===t||"theta"===t)return nI(t);const i="x"===t?"align":"baseline",o=Cq(i,n,e);let a;return gq(o)?(yU(function(t){return`The ${t} for range marks cannot be an expression`}(i)),a=void 0):a=o,"x"===t?dJ[a||("top"===r?"left":"center")]:mJ[a||r]}function gJ(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?vJ(t,n,{defaultPos:e,defaultPos2:r}):fJ(t,n,{defaultPos:e})}function vJ(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:o}=n,a=eI(t),u=rI(t),s=function(t,n,e){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=t,s=tI(e),c=rI(e),f=nI(e),l=r[s],h=t.scaleName(s),d=t.getScaleComponent(s),{offset:m}=cJ(e in r||e in o?{channel:e,markDef:o,encoding:r,model:t}:{channel:s,markDef:o,encoding:r,model:t});if(!l&&("x2"===e||"y2"===e)&&(r.latitude||r.longitude)){const n=rI(e),r=t.markDef[n];return null!=r?{[n]:{value:r}}:{[f]:{field:t.getName(e)}}}const p=function({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c}){return tG(n)&&u&&t.charAt(0)===u.fieldChannel.charAt(0)?gH(n,o,{suffix:"start"},{offset:s}):pH({channel:t,channelDef:e,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:c})}({channel:e,channelDef:l,channel2Def:r[e],markDef:o,config:u,scaleName:h,scale:d,stack:a,offset:m,defaultRef:void 0});return void 0!==p?{[f]:p}:yJ(e,o)||yJ(e,{[e]:_q(e,o,u.style),[c]:_q(c,o,u.style)})||yJ(e,u[i])||yJ(e,u.mark)||{[f]:lJ({model:t,defaultPos:n,channel:e,scaleName:h,scale:d})()}}(n,r,a);return{...fJ(t,n,{defaultPos:e,vgChannel:s[u]?pJ(t,i,o):nI(t)}),...s}}function yJ(t,n){const e=rI(t),r=nI(t);if(void 0!==n[r])return{[r]:bH(t,n[r])};if(void 0!==n[t])return{[r]:bH(t,n[t])};if(n[e]){const r=n[e];if(!oH(r))return{[e]:bH(t,r)};yU(function(t){return`Position range does not support relative band size for ${t}.`}(e))}}function bJ(t,n){const{config:e,encoding:r,markDef:i}=t,o=i.type,a=eI(n),u=rI(n),s=r[n],c=r[a],f=t.getScaleComponent(n),l=f?f.get("type"):void 0,h=i.orient,d=r[u]??r.size??Cq("size",i,e,{vgChannel:u}),m=iI(n),p="bar"===o&&("x"===n?"vertical"===h:"horizontal"===h)||"tick"===o&&("y"===n?"vertical"===h:"horizontal"===h);return!VH(s)||!(uq(s.bin)||sq(s.bin)||s.timeUnit&&!c)||d&&!oH(d)||r[m]||wW(l)?(tG(s)&&wW(l)||p)&&!c?function(t,n,e){const{markDef:r,encoding:i,config:o,stack:a}=e,u=r.orient,s=e.scaleName(n),c=e.getScaleComponent(n),f=rI(n),l=eI(n),h=iI(n),d=e.scaleName(h),m=e.getScaleComponent(oI(n)),p="tick"===r.type||"horizontal"===u&&"y"===n||"vertical"===u&&"x"===n;let g;(i.size||r.size)&&(p?g=aJ("size",e,{vgChannel:f,defaultRef:Aq(r.size)}):yU(function(t){return`Cannot apply size to non-oriented mark "${t}".`}(r.type)));const v=!!g,y=qH({channel:n,fieldDef:t,markDef:r,config:o,scaleType:(c||m)?.get("type"),useVlSizeChannel:p});g=g||{[f]:wJ(f,d||s,m||c,o,y,!!t,r.type)};const b=pJ(n,r,o,"band"===(c||m)?.get("type")&&oH(y)&&!v?"top":"middle"),w="xc"===b||"yc"===b,{offset:x,offsetType:$}=cJ({channel:n,markDef:r,encoding:i,model:e,bandPosition:w?.5:0}),k=pH({channel:n,channelDef:t,markDef:r,config:o,scaleName:s,scale:c,stack:a,offset:x,defaultRef:lJ({model:e,defaultPos:"mid",channel:n,scaleName:s,scale:c}),bandPosition:w?"encoding"===$?0:.5:gq(y)?{signal:`(1-${y})/2`}:oH(y)?(1-y.band)/2:0});if(f)return{[b]:k,...g};{const t=nI(l),n=g[f],e=x?{...n,offset:x}:n;return{[b]:k,[t]:D(k)?[k[0],{...k[1],offset:e}]:{...k,offset:e}}}}(s,n,t):vJ(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:t,fieldDef2:n,channel:e,model:r}){const{config:i,markDef:o,encoding:a}=r,u=r.getScaleComponent(e),s=r.scaleName(e),c=u?u.get("type"):void 0,f=u.get("reverse"),l=qH({channel:e,fieldDef:t,markDef:o,config:i,scaleType:c}),h=r.component.axes[e]?.[0],d=h?.get("translate")??.5,m=DI(e)?Cq("binSpacing",o,i)??0:0,p=eI(e),g=nI(e),v=nI(p),y=Oq("minBandSize",o,i),{offset:b}=cJ({channel:e,markDef:o,encoding:a,model:r,bandPosition:0}),{offset:w}=cJ({channel:p,markDef:o,encoding:a,model:r,bandPosition:0}),x=function({scaleName:t,fieldDef:n}){const e=sG(n,{expr:"datum"});return`abs(scale("${t}", ${sG(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${e}))`}({fieldDef:t,scaleName:s}),$=xJ(e,m,f,d,b,y,x),k=xJ(p,m,f,d,w??b,y,x),M=gq(l)?{signal:`(1-${l.signal})/2`}:oH(l)?(1-l.band)/2:.5,A=IH({fieldDef:t,fieldDef2:n,markDef:o,config:i});if(uq(t.bin)||t.timeUnit){const n=t.timeUnit&&.5!==A;return{[v]:$J({fieldDef:t,scaleName:s,bandPosition:M,offset:k,useRectOffsetField:n}),[g]:$J({fieldDef:t,scaleName:s,bandPosition:gq(M)?{signal:`1-${M.signal}`}:1-M,offset:$,useRectOffsetField:n})}}if(sq(t.bin)){const e=gH(t,s,{},{offset:k});if(VH(n))return{[v]:e,[g]:gH(n,s,{},{offset:$})};if(cq(t.bin)&&t.bin.step)return{[v]:e,[g]:{signal:`scale("${s}", ${sG(t,{expr:"datum"})} + ${t.bin.step})`,offset:$}}}yU(mU(p))}({fieldDef:s,fieldDef2:c,channel:n,model:t})}function wJ(t,n,e,r,i,o,a){if(oH(i)){if(!e)return{mult:i.band,field:{group:t}};{const t=e.get("type");if("band"===t){let t=`bandwidth('${n}')`;1!==i.band&&(t=`${i.band} * ${t}`);const e=Oq("minBandSize",{type:a},r);return{signal:e?`max(${Fq(e)}, ${t})`:t}}1!==i.band&&(yU(function(t){return`Cannot use the relative band size with ${t} scale.`}(t)),i=void 0)}}else{if(gq(i))return i;if(i)return{value:i}}if(e){const t=e.get("range");if(vq(t)&&bt(t.step))return{value:t.step-2}}if(!o){const{bandPaddingInner:n,barBandPaddingInner:e,rectBandPaddingInner:i,tickBandPaddingInner:o}=r.scale,u=PR(n,"tick"===a?o:"bar"===a?e:i);if(gq(u))return{signal:`(1 - (${u.signal})) * ${t}`};if(bt(u))return{signal:`${1-u} * ${t}`}}return{value:TY(r.view,t)-2}}function xJ(t,n,e,r,i,o,a){if(OL(t))return 0;const u="x"===t||"y2"===t,s=u?-n/2:n/2;if(gq(e)||gq(i)||gq(r)||o){const t=Fq(e),n=Fq(i),c=Fq(r),f=Fq(o),l=o?`(${a} < ${f} ? ${u?"":"-"}0.5 * (${f} - (${a})) : ${s})`:s;return{signal:(c?`${c} + `:"")+(t?`(${t} ? -1 : 1) * `:"")+(n?`(${n} + ${l})`:l)}}return i=i||0,r+(e?-i-s:+i+s)}function $J({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return vH({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:bX,endSuffix:wX}:{}})}const kJ=new Set(["aria","width","height"]);function MJ(t,n){const{fill:e,stroke:r}="include"===n.color?uJ(t):{};return{...DJ(t.markDef,n),...AJ("fill",e),...AJ("stroke",r),...aJ("opacity",t),...aJ("fillOpacity",t),...aJ("strokeOpacity",t),...aJ("strokeWidth",t),...aJ("strokeDash",t),...sJ(t),...tJ(t),...QX(t,"href"),...rJ(t)}}function AJ(t,n){return n?{[t]:n}:{}}function DJ(t,n){return bq.reduce(((e,r)=>(!kJ.has(r)&&YR(t,r)&&"ignore"!==n[r]&&(e[r]=Aq(t[r])),e)),{})}function SJ(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef(((i,o)=>{let a;if(!GI(o)||!(a=t.getScaleType(o)))return;const u=rq(i.aggregate);if("break-paths-filter-domains"===(s=lH({scaleChannel:o,markDef:e,config:n,scaleType:a,isCountAggregate:u}))||"break-paths-show-domains"===s){const n=t.vgField(o,{expr:"datum",binSuffix:t.stack?.impute?"mid":void 0});n&&r.add(n)}var s})),r.size>0){const t=[...r].map((t=>JU(t,!0))).join(" && ");return{defined:{signal:t}}}}function FJ(t,n){if(void 0!==n)return{[t]:Aq(n)}}const EJ="voronoi",NJ={defined:t=>"point"===t.type&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(EJ)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,o=t.mark;if(JW(o))return yU(`The "nearest" transform is not supported for ${o} marks.`),e;const a={name:t.getName(EJ),type:"path",interactive:!0,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...tJ(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let u=0,s=!1;return e.forEach(((n,e)=>{const r=n.name??"";r===t.component.mark[0].name?u=e:r.includes(EJ)&&(s=!0)})),s||e.splice(u+1,0,a),e}},CJ={defined:t=>"point"===t.type&&"global"===t.resolve&&t.bind&&"scales"!==t.bind&&!MY(t.bind),parse:(t,n,e)=>KJ(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,o=n.bind,a=n.init&&n.init[0],u=NJ.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach(((t,i)=>{const s=AR(`${r}_${t.field}`);e.filter((t=>t.name===s)).length||e.unshift({name:s,...a?{init:jX(a[i])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Et(t.field)}] : null`}]:[],bind:o[t.field]??o[t.channel]??o})})),e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+HJ)),a=r+MX,u=i.items.map((t=>AR(`${r}_${t.field}`))),s=u.map((t=>`${t} !== null`)).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,e}},OJ="_toggle",_J={defined:t=>"point"===t.type&&!QJ(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+OJ,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+HJ,r=n.name+OJ;return`${r} ? null : ${e}, `+("global"===n.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${XJ(t)}}, `)+`${r} ? ${e} : null`}},zJ={defined:t=>void 0!==t.clear&&!1!==t.clear&&!QJ(t),parse:(t,n)=>{n.clear&&(n.clear=xt(n.clear)?iB(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(CJ.defined(n))for(const t of n.project.items){const r=e.findIndex((e=>e.name===AR(`${n.name}_${t.field}`)));-1!==r&&e[r].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(t,r){-1!==t&&e[t].on&&e[t].on.push({events:n.clear,update:r})}if("interval"===n.type)for(const t of n.project.items){const n=e.findIndex((n=>n.name===t.signals.visual));r(n,"[0, 0]"),-1===n&&r(e.findIndex((n=>n.name===t.signals.data)),"null")}else{let t=e.findIndex((t=>t.name===n.name+HJ));r(t,"null"),_J.defined(n)&&(t=e.findIndex((t=>t.name===n.name+OJ)),r(t,"false"))}return e}},BJ={defined:t=>{const n="global"===t.resolve&&t.bind&&MY(t.bind),e=1===t.project.items.length&&t.project.items[0].field!==$Y;return n&&!e&&yU("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=iR(e);if(r.select=xt(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},KJ(n,r),S(e.select)&&(e.select.on||e.select.clear)){const t='event.item && indexof(event.item.mark.role, "legend") < 0';for(const e of n.events)e.filter=K(e.filter??[]),e.filter.includes(t)||e.filter.push(t)}const i=AY(n.bind)?n.bind.legend:"click",o=xt(i)?iB(i,"view"):K(i);n.bind={legend:{merge:o}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=AY(n.bind)&&n.bind.legend,o=t=>n=>{const e=iR(n);return e.markname=t,e};for(const t of n.project.items){if(!t.hasLegend)continue;const a=`${AR(t.field)}_legend`,u=`${r}_${a}`;if(0===e.filter((t=>t.name===u)).length){const t=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:t,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+HJ)),a=r+MX,u=i.items.filter((t=>t.hasLegend)).map((t=>AR(`${r}_${AR(t.field)}_legend`))),s=`${u.map((t=>`${t} !== null`)).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;n.events&&u.length>0?o.on.push({events:u.map((t=>({signal:t}))),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const c=e.find((t=>t.name===r+OJ)),f=AY(n.bind)&&n.bind.legend;return c&&(n.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),e}},TJ="_translate_anchor",PJ="_translate_delta",jJ={defined:t=>"interval"===t.type&&t.translate,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+TJ,{x:a,y:u}=n.project.hasChannel;let s=iB(n.translate,"scope");return i||(s=s.map((t=>(t.between[0].markname=r+GX,t)))),e.push({name:o,value:{},on:[{events:s.map((t=>t.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${i?WX(t,KR):`slice(${a.signals.visual})`}`:"")+(void 0!==u?`, extent_y: ${i?WX(t,QR):`slice(${u.signals.visual})`}`:"")+"}"}]},{name:r+PJ,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&RJ(t,n,a,"width",e),void 0!==u&&RJ(t,n,u,"height",e),e}};function RJ(t,n,e,r,i){const o=n.name,a=o+TJ,u=o+PJ,s=e.channel,c=UX.defined(n),f=i.find((t=>t.name===e.signals[c?"data":"visual"])),l=t.getSizeSignalRef(r).signal,h=t.getScaleComponent(s),d=h&&h.get("type"),m=h&&h.get("reverse"),p=`${a}.extent_${s}`,g=`${c&&h?"log"===d?"panLog":"symlog"===d?"panSymlog":"pow"===d?"panPow":"panLinear":"panLinear"}(${p}, ${c?s===KR?m?"":"-":m?"-":"":""}${u}.${s} / ${c?`${l}`:`span(${p})`}${c?"pow"===d?`, ${h.get("exponent")??1}`:"symlog"===d?`, ${h.get("constant")??1}`:"":""})`;f.on.push({events:{signal:u},update:c?g:`clampRange(${g}, 0, ${l})`})}const LJ="_zoom_anchor",IJ="_zoom_delta",qJ={defined:t=>"interval"===t.type&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+IJ,{x:a,y:u}=n.project.hasChannel,s=Et(t.scaleName(KR)),c=Et(t.scaleName(QR));let f=iB(n.zoom,"scope");return i||(f=f.map((t=>(t.markname=r+GX,t)))),e.push({name:r+LJ,on:[{events:f,update:i?"{"+[s?`x: invert(${s}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((t=>t)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&UJ(t,n,a,"width",e),void 0!==u&&UJ(t,n,u,"height",e),e}};function UJ(t,n,e,r,i){const o=n.name,a=e.channel,u=UX.defined(n),s=i.find((t=>t.name===e.signals[u?"data":"visual"])),c=t.getSizeSignalRef(r).signal,f=t.getScaleComponent(a),l=f&&f.get("type"),h=u?WX(t,a):s.name,d=o+IJ,m=`${u&&f?"log"===l?"zoomLog":"symlog"===l?"zoomSymlog":"pow"===l?"zoomPow":"zoomLinear":"zoomLinear"}(${h}, ${o}${LJ}.${a}, ${d}${u?"pow"===l?`, ${f.get("exponent")??1}`:"symlog"===l?`, ${f.get("constant")??1}`:"":""})`;s.on.push({events:{signal:d},update:u?m:`clampRange(${m}, 0, ${c})`})}const WJ="_store",HJ="_tuple",GJ="_modify",YJ="vlSelectionResolve",VJ=[TX,JX,DX,_J,CJ,UX,BJ,zJ,jJ,qJ,NJ];function XJ(t,{escape:n}={escape:!0}){let e=n?Et(t.name):t.name;const r=function(t){let n=t.parent;for(;n&&!FZ(n);)n=n.parent;return n}(t);if(r){const{facet:t}=r;for(const n of LL)t[n]&&(e+=` + '__facet_${n}_' + (facet[${Et(r.vgField(n))}])`)}return e}function JJ(t){return $R(t.component.selection??{}).reduce(((t,n)=>t||n.project.hasSelectionId),!1)}function KJ(t,n){!xt(n.select)&&n.select.on||delete t.events,!xt(n.select)&&n.select.clear||delete t.clear,!xt(n.select)&&n.select.toggle||delete t.toggle}function QJ(t){return t.events?.find((t=>"type"in t&&"timer"===t.type))}function ZJ(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...ZJ(t.object)),n.push(...ZJ(t.property))),n)}function tK(t){return"MemberExpression"===t.object.type?tK(t.object):"datum"===t.object.name}function nK(t){const n=YO(t),e=new Set;return n.visit((t=>{"MemberExpression"===t.type&&tK(t)&&e.add(ZJ(t).slice(1).join("."))})),e}class eK extends mX{clone(){return new eK(null,this.model,iR(this.filter))}constructor(t,n,e){super(t),this.model=n,this.filter=e,this.expr=oK(this.model,this.filter,this),this._dependentFields=nK(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function rK(t,n,e,r="datum"){const i=xt(n)?n:n.param,o=AR(i),a=Et(o+WJ);let u;try{u=t.getSelectionComponent(o,i)}catch(t){return`!!${o}`}if(u.project.timeUnit){const n=e??t.component.data.raw,r=u.project.timeUnit.clone();n.parent?r.insertAsParentOf(n):n.parent=r}const s=`${u.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${r}${"global"===u.resolve?")":`, ${Et(u.resolve)})`}`,c=`length(data(${a}))`;return!1===n.empty?`${c} && ${s}`:`!${c} || ${s}`}function iK(t,n,e){const r=AR(n),i=e.encoding;let o,a=e.field;try{o=t.getSelectionComponent(r,n)}catch(t){return r}if(i||a){if(i&&!a){const t=o.project.items.filter((t=>t.channel===i));!t.length||t.length>1?(a=o.project.items[0].field,yU(function(t,n,e,r){return(t.length?"Multiple ":"No ")+`matching ${Et(n)} encoding found for selection ${Et(e.param)}. `+`Using "field": ${Et(r)}.`}(t,i,e,a))):a=t[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&yU(function(t){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Et(t)}.`}(a));return`${o.name}[${Et(_R(a))}]`}function oK(t,n,e){return DR(n,(n=>xt(n)?n:function(t){return YR(t,"param")}(n)?rK(t,n,e):XU(n)))}function aK(t,n,e,r){var i,o;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(o=t.encode[n]).update??(o.update={}),t.encode[n].update[e]=r}function uK(t,n,e,r={header:!1}){const{disable:i,orient:o,scale:a,labelExpr:u,title:s,zindex:c,...f}=t.combine();if(!i){for(const t in f){const e=t,r=CG[e],i=f[e];if(r&&r!==n&&"both"!==r)delete f[e];else if(EG(i)){const{condition:t,...n}=i,r=K(t),o=FG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((t=>{const{test:n,...e}=t;return{test:oK(null,n),...e}})),n];aK(f,i,t,a),delete f[e]}else if(null===o){const t={signal:r.map((t=>{const{test:n,...e}=t;return`${oK(null,n)} ? ${Sq(e)} : `})).join("")+Sq(n)};f[e]=t}}else if(gq(i)){const t=FG[e];if(t){const{vgProp:n,part:r}=t;aK(f,r,n,i),delete f[e]}}fR(["labelAlign","labelBaseline"],e)&&null===f[e]&&delete f[e]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:t}=f.encode;f.encode={...t?{grid:t}:{}},wR(f.encode)&&delete f.encode}return{scale:a,orient:o,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:PR(c,0)}}{if(!r.header&&t.mainExtracted)return;if(void 0!==u){let t=u;f.encode?.labels?.update&&gq(f.encode.labels.update.text)&&(t=zR(u,"datum.label",f.encode.labels.update.text.signal)),aK(f,"labels","text",{signal:t})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const n of NG)t.hasAxisPart(n)||delete f.encode[n];wR(f.encode)&&delete f.encode}const n=function(t,n){if(t)return D(t)&&!pq(t)?t.map((t=>pG(t,n))).join(", "):t}(s,e);return{scale:a,orient:o,grid:!1,...n?{title:n}:{},...f,...!1===e.aria?{aria:!1}:{},zindex:PR(c,0)}}}}function sK(t){const{axes:n}=t.component,e=[];for(const r of AI)if(n[r])for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const n="x"===r?"height":"width",i=t.getSizeSignalRef(n).signal;n!==i&&e.push({name:n,update:i})}return e}function cK(t,n,e,r){return Object.assign.apply(null,[{},...t.map((t=>{if("axisOrient"===t){const t="x"===e?"bottom":"left",i=n["x"===e?"axisBottom":"axisLeft"]||{},o=n["x"===e?"axisTop":"axisRight"]||{},a=new Set([...xR(i),...xR(o)]),u={};for(const n of a.values())u[n]={signal:`${r.signal} === "${t}" ? ${Fq(i[n])} : ${Fq(o[n])}`};return u}return n[t]}))])}function fK(t,n){const e=[{}];for(const r of t){let t=n[r]?.style;if(t){t=K(t);for(const r of t)e.push(n.style[r])}}return Object.assign.apply(null,e)}function lK(t,n,e,r={}){const i=zq(t,e,n);if(void 0!==i)return{configFrom:"style",configValue:i};for(const n of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==r[n]?.[t])return{configFrom:n,configValue:r[n][t]};return{}}const hK={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(t,n){return!wW(t)&&VH(n)&&!uq(n?.bin)&&!sq(n?.bin)}(e,t),gridScale:({model:t,channel:n})=>function(t,n){const e="x"===n?"y":"x";if(t.getScaleComponent(e))return t.scaleName(e)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||pK(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||mK(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(t,n){if("x"===n&&fR(["quantitative","temporal"],t))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(t,n,e,r){if(e&&!S(r)||"nominal"!==t&&"ordinal"!==t)return"log"!==n&&"symlog"!==n||"greedy"}(n.type,e,VH(n)&&!!n.timeUnit,VH(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const o="x"===t?"width":"y"===t?"height":void 0,a=o?n.getSizeSignalRef(o):void 0;return e.tickCount??function({fieldOrDatumDef:t,scaleType:n,size:e,values:r}){if(!r&&!wW(n)&&"log"!==n){if(VH(t)){if(uq(t.bin))return{signal:`ceil(${e.signal}/10)`};if(t.timeUnit&&fR(["month","hours","day","quarter"],TU(t.timeUnit)?.unit))return}return{signal:`ceil(${e.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:a,values:e.values})},tickMinStep:function({format:t,fieldOrDatumDef:n}){if("d"===t)return 1;if(VH(n)){const{timeUnit:t}=n;if(t){const n=PU(t);if(n)return{signal:n}}}},title:({axis:t,model:n,channel:e})=>{if(void 0!==t.title)return t.title;const r=gK(n,e);if(void 0!==r)return r;const i=n.typedFieldDef(e),o=n.fieldDef("x"===e?"x2":"y2");return Tq(i?[RH(i)]:[],VH(o)?[RH(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(t,n){const e=t.values;return D(e)?DG(n,e):gq(e)?e:void 0}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(t,n){return"rect"===t&&cG(n)?1:0}(e,n)};function dK(t){return`(((${t.signal} % 360) + 360) % 360)`}function mK(t,n,e,r){if(void 0!==t){if("x"===e){if(gq(t)){const e=dK(t);return{signal:`(45 < ${e} && ${e} < 135) || (225 < ${e} && ${e} < 315) ? "middle" :(${e} <= 45 || 315 <= ${e}) === ${gq(n)?`(${n.signal} === "top")`:"top"===n} ? "bottom" : "top"`}}return 45<t&&t<135||225<t&&t<315?"middle":gq(n)?{signal:`${n.signal} ${t<=45||315<=t?"===":"!=="} "top" ? "bottom" : "top"`}:(t<=45||315<=t)==("top"===n)?"bottom":"top"}if(gq(t)){const e=dK(t);return{signal:`${e} <= 45 || 315 <= ${e} || (135 <= ${e} && ${e} <= 225) ? ${r?'"middle"':"null"} : (45 <= ${e} && ${e} <= 135) === ${gq(n)?`(${n.signal} === "left")`:"left"===n} ? "top" : "bottom"`}}return t<=45||315<=t||135<=t&&t<=225?r?"middle":null:gq(n)?{signal:`${n.signal} ${45<=t&&t<=135?"===":"!=="} "left" ? "top" : "bottom"`}:(45<=t&&t<=135)==("left"===n)?"top":"bottom"}}function pK(t,n,e){if(void 0===t)return;const r="x"===e,i=r?0:90,o=r?"bottom":"left";if(gq(t)){const e=dK(t);return{signal:`(${i?`(${e} + 90)`:e} % 180 === 0) ? ${r?null:'"center"'} :(${i} < ${e} && ${e} < ${180+i}) === ${gq(n)?`(${n.signal} === "${o}")`:n===o} ? "left" : "right"`}}return(t+i)%180==0?r?null:"center":gq(n)?{signal:`${n.signal} ${i<t&&t<180+i?"===":"!=="} "${o}" ? "left" : "right"`}:(i<t&&t<180+i)==(n===o)?"left":"right"}function gK(t,n){const e="x"===n?"x2":"y2",r=t.fieldDef(n),i=t.fieldDef(e),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?Pq(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class vK extends mX{clone(){return new vK(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this._dependentFields=nK(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef(((n,e)=>{if(rG(n)&&BH(n.sort)){const{field:r,timeUnit:i}=n,o=n.sort,a=o.map(((t,n)=>`${XU({field:r,timeUnit:i,equal:t})} ? ${n} : `)).join("")+o.length;t=new vK(t,{calculate:a,as:yK(n,e,{forAs:!0})})}})),t}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 ${sR(this.transform)}`}}function yK(t,n,e){return sG(t,{prefix:n,suffix:"sort_index",...e})}function bK(t,n){return fR(["top","bottom"],n)?"column":fR(["left","right"],n)||"row"===t?"row":"column"}function wK(t,n,e,r){return PR((n||{})[t],("row"===r?e.headerRow:"column"===r?e.headerColumn:e.headerFacet)[t],e.header[t])}function xK(t,n,e,r){const i={};for(const o of t){const t=wK(o,n||{},e,r);void 0!==t&&(i[o]=t)}return i}const $K=["row","column"],kK=["header","footer"];function MK(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=xK(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),s=bK(n,u),c=qR(a);return{name:`${n}-title`,type:"group",role:`${s}-title`,title:{text:e,..."row"===n?{orient:"left"}:{},style:"guide-title",...DK(c,s),...AK(s,c,o),..._K(r,i,n,yY,gY)}}}function AK(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=pK(n,"row"===t?"left":"top","row"===t?"y":"x");return r?{align:r}:{}}function DK(t,n){const e=mK(t,"row"===n?"left":"top","row"===n?"y":"x",!0);return e?{baseline:e}:{}}function SK(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of kK)if(e[i])for(const o of e[i]){const a=NK(t,n,i,e,o);null!=a&&r.push(a)}return r}function FK(t,n){const{sort:e}=t;return zH(e)?{field:sG(e,{expr:"datum"}),order:e.order??"ascending"}:D(e)?{field:yK(t,n,{expr:"datum"}),order:"ascending"}:{field:sG(t,{expr:"datum"}),order:e??"ascending"}}function EK(t,n,e){const{format:r,formatType:i,labelAngle:o,labelAnchor:a,labelOrient:u,labelExpr:s}=xK(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),c=$H({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,f=bK(n,u);return{text:{signal:s?zR(zR(s,"datum.label",c),"datum.value",sG(t,{expr:"parent"})):c},..."row"===n?{orient:"left"}:{},style:"guide-label",frame:"group",...DK(o,f),...AK(f,o,a),..._K(e,t,n,bY,vY)}}function NK(t,n,e,r,i){if(i){let o=null;const{facetFieldDef:a}=r,u=t.config?t.config:void 0;if(a&&i.labels){const{labelOrient:t}=xK(["labelOrient"],a.header,u,n);("row"===n&&!fR(["top","bottom"],t)||"column"===n&&!fR(["left","right"],t))&&(o=EK(a,n,u))}const s=FZ(t)&&!TH(t.facet),c=i.axes,f=c?.length>0;if(o||f){const u="row"===n?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:FK(a,n)}:{},...f&&s?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...o?{title:o}:{},...i.sizeSignal?{encode:{update:{[u]:i.sizeSignal}}}:{},...f?{axes:c}:{}}}}return null}const CK={column:{start:0,end:1},row:{start:1,end:0}};function OK(t,n){return CK[n][t]}function _K(t,n,e,r,i){const o={};for(const a of r){if(!i[a])continue;const r=wK(a,n?.header,t,e);void 0!==r&&(o[i[a]]=r)}return o}function zK(t){return[...BK(t,"width"),...BK(t,"height"),...BK(t,"childWidth"),...BK(t,"childHeight")]}function BK(t,n){const e="width"===n?"x":"y",r=t.component.layoutSize.get(n);if(!r||"merged"===r)return[];const i=t.getSizeSignalRef(n).signal;if("step"===r){const n=t.getScaleComponent(e);if(n){const r=n.get("type"),o=n.get("range");if(wW(r)&&vq(o)){const r=t.scaleName(e);return FZ(t.parent)&&"independent"===t.parent.component.resolve.scale[e]?[TK(r,o)]:[TK(r,o),{name:i,update:PK(r,n,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const n=i.endsWith("width"),e=n?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${e}) ? ${e} : ${BY(t.config.view,n?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function TK(t,n){const e=`${t}_step`;return gq(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function PK(t,n,e){const r=n.get("type"),i=n.get("padding"),o=PR(n.get("paddingOuter"),i);let a=n.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${e}, ${Fq(a)}, ${Fq(o)}) * ${t}_step`}function jK(t){return"childWidth"===t?"width":"childHeight"===t?"height":t}function RK(t,n){return xR(t).reduce(((e,r)=>({...e,...KX({model:n,channelDef:t[r],vgChannel:r,mainRefFn:t=>Aq(t.value),invalidValueRef:void 0})})),{})}function LK(t,n){if(FZ(n))return"theta"===t?"independent":"shared";if(NZ(n))return"shared";if(EZ(n))return DI(t)||"theta"===t||"radius"===t?"independent":"shared";throw new Error("invalid model type for resolve")}function IK(t,n){const e=t.scale[n],r=DI(n)?"axis":"legend";return"independent"===e?("shared"===t[r][n]&&yU(function(t){return`Setting the scale to be independent for "${t}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const qK=xR({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 UK extends QV{}const WK={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:u,config:s,mark:c}=e,f=a.filled&&"trail"!==c;let l={...Eq({},e,tH),...uJ(e,{filled:f})};const h=i.get("symbolOpacity")??s.legend.symbolOpacity,d=i.get("symbolFillColor")??s.legend.symbolFillColor,m=i.get("symbolStrokeColor")??s.legend.symbolStrokeColor,p=void 0===h?HK(u.opacity)??a.opacity:void 0;if(l.fill)if("fill"===r||f&&r===hL)delete l.fill;else if(YR(l.fill,"field"))d?delete l.fill:(l.fill=Aq(s.legend.symbolBaseFillColor??"black"),l.fillOpacity=Aq(p??1));else if(D(l.fill)){const t=GK(u.fill??u.color)??a.fill??(f&&a.color);t&&(l.fill=Aq(t))}if(l.stroke)if("stroke"===r||!f&&r===hL)delete l.stroke;else if(YR(l.stroke,"field")||m)delete l.stroke;else if(D(l.stroke)){const t=PR(GK(u.stroke||u.color),a.stroke,f?a.color:void 0);t&&(l.stroke={value:t})}if(r!==yL){const t=VH(n)&&VK(0,i,n);t?l.opacity=[{test:t,...Aq(p??1)},Aq(s.legend.unselectedOpacity)]:p&&(l.opacity=Aq(p))}return l={...l,...t},wR(l)?void 0:l},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if("gradient"!==e)return;const{config:i,markDef:o,encoding:a}=n;let u={};const s=void 0===(r.get("gradientOpacity")??i.legend.gradientOpacity)?HK(a.opacity)||o.opacity:void 0;return s&&(u.opacity=Aq(s)),u={...u,...t},wR(u)?void 0:u},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const o=e.legend(r)||{},a=e.config,u=VH(n)?VK(0,i,n):void 0,s=u?[{test:u,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:c,formatType:f}=o;let l;wH(f)?l=MH({fieldOrDatumDef:n,field:"datum.value",format:c,formatType:f,config:a}):void 0===c&&void 0===f&&a.customFormatTypes&&("quantitative"===n.type&&a.numberFormatType?l=MH({fieldOrDatumDef:n,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===n.type&&a.timeFormatType&&VH(n)&&void 0===n.timeUnit&&(l=MH({fieldOrDatumDef:n,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const h={...s?{opacity:s}:{},...l?{text:l}:{},...t};return wR(h)?void 0:h},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e?.length?{...t,fill:{value:"transparent"}}:t}};function HK(t){return YK(t,((t,n)=>Math.max(t,n.value)))}function GK(t){return YK(t,((t,n)=>PR(t,n.value)))}function YK(t,n){return function(t){const n=t?.condition;return!!n&&(D(n)||eG(n))}(t)?K(t.condition).reduce(n,t.value):eG(t)?t.value:void 0}function VK(t,n,e){const r=n.get("selections");if(!r?.length)return;const i=Et(e.field);return r.map((t=>`(!length(data(${Et(AR(t)+WJ)})) || (${t}[${i}] && indexof(${t}[${i}], datum.value) >= 0))`)).join(" || ")}const XK={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return AH(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return DH(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:t,model:n,direction:e,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if($W(i))return"horizontal"===e?"top"===r||"bottom"===r?KK(n,"width",a,o):a:KK(n,"height",s,u)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(t){if(fR(["quantile","threshold","log","symlog"],t))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(t,n,e,r){if("shape"!==n){const t=GK(e)??r;if(t)return t}switch(t){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"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>dG(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(jL(e)&&$W(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(t,n){const e=t.values;return D(e)?DG(n,e):gq(e)?e:void 0}(n,t)};function JK({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(t,n){switch(t){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===n?"horizontal":void 0}}(e,n)}function KK(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function QK(t){const n=SZ(t)?function(t){const{encoding:n}=t,e={};for(const r of[hL,...xY]){const i=yG(n[r]);i&&t.getScaleComponent(r)&&(r===pL&&VH(i)&&i.type===iW||(e[r]=tQ(t,r)))}return e}(t):function(t){const{legends:n,resolve:e}=t.component;for(const r of t.children){QK(r);for(const i of xR(r.component.legends))e.legend[i]=IK(t.component.resolve,i),"shared"===e.legend[i]&&(n[i]=nQ(n[i],r.component.legends[i]),n[i]||(e.legend[i]="independent",delete n[i]))}for(const r of xR(n))for(const n of t.children)n.component.legends[r]&&"shared"===e.legend[r]&&delete n.component.legends[r];return n}(t);return t.component.legends=n,n}function ZK(t,n,e,r){switch(n){case"disable":return void 0!==e;case"values":return!!e?.values;case"title":if("title"===n&&t===r?.title)return!0}return t===(e||{})[n]}function tQ(t,n){let e=t.legend(n);const{markDef:r,encoding:i,config:o}=t,a=o.legend,u=new UK({},function(t,n){const e=t.scaleName(n);if("trail"===t.mark){if("color"===n)return{stroke:e};if("size"===n)return{strokeWidth:e}}return"color"===n?t.markDef.filled?{fill:e}:{stroke:e}:{[n]:e}}(t,n));!function(t,n,e){const r=t.fieldDef(n)?.field;for(const i of $R(t.component.selection??{})){const t=i.project.hasField[r]??i.project.hasChannel[n];if(t&&BJ.defined(i)){const n=e.get("selections")??[];n.push(i.name),e.set("selections",n,!1),t.hasLegend=!0}}}(t,n,u);const s=void 0!==e?!e:a.disable;if(u.set("disable",s,void 0!==e),s)return u;e=e||{};const c=t.getScaleComponent(n).get("type"),f=yG(i[n]),l=VH(f)?TU(f.timeUnit)?.unit:void 0,h=e.orient||o.legend.orient||"right",d=function(t){const{legend:n}=t;return PR(n.type,function({channel:t,timeUnit:n,scaleType:e}){if(jL(t)){if(fR(["quarter","month","day"],n))return"symbol";if($W(e))return"gradient"}return"symbol"}(t))}({legend:e,channel:n,timeUnit:l,scaleType:c}),m={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:f,legendConfig:a,config:o,scaleType:c,orient:h,legendType:d,direction:JK({legend:e,legendType:d,orient:h,legendConfig:a})};for(const r of qK){if("gradient"===d&&r.startsWith("symbol")||"symbol"===d&&r.startsWith("gradient"))continue;const i=r in XK?XK[r](m):e[r];if(void 0!==i){const a=ZK(i,r,e,t.fieldDef(n));(a||void 0===o.legend[r])&&u.set(r,i,a)}}const p=e?.encoding??{},g=u.get("selections"),v={},y={fieldOrDatumDef:f,model:t,channel:n,legendCmpt:u,legendType:d};for(const n of["labels","legend","title","symbols","gradient","entries"]){const e=RK(p[n]??{},t),r=n in WK?WK[n](e,y):e;void 0===r||wR(r)||(v[n]={...g?.length&&VH(f)?{name:`${AR(f.field)}_legend_${n}`}:{},...g?.length?{interactive:!!g}:{},update:r})}return wR(v)||u.set("encode",v,!!e?.encoding),u}function nQ(t,n){if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const e of qK){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"legend",((t,n)=>{switch(e){case"symbolType":return r=t,"circle"===(o=n).value?o:r;case"title":return jq(t,n);case"type":return i=!0,tX("symbol")}var r,o;return eX(t,n,e,"legend")}));t.setWithExplicit(e,r)}return i&&(t.implicit?.encode?.gradient&&SR(t.implicit,["encode","gradient"]),t.explicit?.encode?.gradient&&SR(t.explicit,["encode","gradient"])),t}function eQ(t){const n=t.component.legends,e={};for(const r of xR(n)){const i=GR(t.getScaleComponent(r).get("domains"));if(e[i])for(const t of e[i])nQ(t,n[r])||e[i].push(n[r]);else e[i]=[n[r].clone()]}const r=$R(e).flat().map((n=>function(t,n){const{disable:e,labelExpr:r,selections:i,...o}=t.combine();if(!e){if(!1===n.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const t=o.encode.symbols.update;!t.fill||"transparent"===t.fill.value||t.stroke||o.stroke||(t.stroke={value:"transparent"});for(const n of xY)o[n]&&delete t[n]}if(o.title||delete o.title,void 0!==r){let t=r;o.encode?.labels?.update&&gq(o.encode.labels.update.text)&&(t=zR(r,"datum.label",o.encode.labels.update.text.signal)),function(t,n,e,r){var i,o;t.encode??(t.encode={}),(i=t.encode)[n]??(i[n]={}),(o=t.encode[n]).update??(o.update={}),t.encode[n].update.text=r}(o,"labels",0,{signal:t})}return o}}(n,t.config))).filter((t=>void 0!==t));return r}function rQ(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map((t=>t.signal)).join(", ")}]`},o=n.data.reduce(((n,e)=>{const r=gq(e)?e.signal:`data('${t.lookupDataSource(e)}')`;return fR(n,r)||n.push(r),n}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const iQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class oQ extends QV{constructor(t,n,e,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=e,this.data=r,this.merged=!1}get isFit(){return!!this.data}}function aQ(t){t.component.projection=SZ(t)?function(t){if(t.hasProjection){const n=dq(t.specifiedProjection),e=!(n&&(null!=n.scale||null!=n.translate)),r=e?[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]:void 0,i=e?function(t){const n=[],{encoding:e}=t;for(const r of[[sL,uL],[fL,cL]])(yG(e[r[0]])||yG(e[r[1]]))&&n.push({signal:t.getName(`geojson_${n.length}`)});return t.channelHasField(pL)&&t.typedFieldDef(pL).type===iW&&n.push({signal:t.getName(`geojson_${n.length}`)}),0===n.length&&n.push(t.requestDataName(hX.Main)),n}(t):void 0,o=new oQ(t.projectionName(!0),{...dq(t.config.projection),...n},r,i);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(t){if(0===t.children.length)return;let n;for(const n of t.children)aQ(n);const e=hR(t.children,(t=>{const e=t.component.projection;if(e){if(n){const t=function(t,n){const e=hR(iQ,(e=>!ft(t.explicit,e)&&!ft(n.explicit,e)||!!(ft(t.explicit,e)&&ft(n.explicit,e)&&HR(t.get(e),n.get(e)))));if(HR(t.size,n.size)){if(e)return t;if(HR(t.explicit,{}))return n;if(HR(n.explicit,{}))return t}return null}(n,e);return t&&(n=t),!!t}return n=e,!0}return!0}));if(n&&e){const e=t.projectionName(!0),r=new oQ(e,n.specifiedProjection,n.size,iR(n.data));for(const n of t.children){const t=n.component.projection;t&&(t.isFit&&r.data.push(...n.component.projection.data),n.renameProjection(t.get("name"),e),t.merged=!0)}return r}}(t)}function uQ(t,n,e,r){if(SG(n,e)){const i=SZ(t)?t.axis(e)??t.legend(e)??{}:{},o=sG(n,{expr:"datum"}),a=sG(n,{expr:"datum",binSuffix:"end"});return{formulaAs:sG(n,{binSuffix:"range",forAs:!0}),formula:NH(o,a,i.format,i.formatType,r)}}return{}}function sQ(t,n){return`${aq(t)}_${n}`}function cQ(t,n,e){const r=sQ($G(e,void 0)??{},n);return t.getName(`${r}_bins`)}function fQ(t,n,e){let r,i;r=function(t){return"as"in t}(t)?xt(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[sG(t,{forAs:!0}),sG(t,{binSuffix:"end",forAs:!0})];const o={...$G(n,void 0)},a=sQ(o,t.field),{signal:u,extentSignal:s}=function(t,n){return{signal:t.getName(`${n}_bins`),extentSignal:t.getName(`${n}_extent`)}}(e,a);if(fq(o.extent)){const t=o.extent;i=iK(e,t.param,t),delete o.extent}return{key:a,binComponent:{bin:o,field:t.field,as:[r],...u?{signal:u}:{},...s?{extentSignal:s}:{},...i?{span:i}:{}}}}class lQ extends mX{clone(){return new lQ(null,iR(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{if(nG(e)&&uq(e.bin)){const{key:i,binComponent:o}=fQ(e,e.bin,n);t[i]={...o,...t[i],...uQ(n,e,r,n.config)}}return t}),{});return wR(e)?null:new lQ(t,e)}static makeFromTransform(t,n,e){const{key:r,binComponent:i}=fQ(n,n.bin,e);return new lQ(t,{[r]:i})}merge(t,n){for(const e of xR(t.bins))e in this.bins?(n(t.bins[e].signal,this.bins[e].signal),this.bins[e].as=pR([...this.bins[e].as,...t.bins[e].as],sR)):this.bins[e]=t.bins[e];for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}producedFields(){return new Set($R(this.bins).map((t=>t.as)).flat(2))}dependentFields(){return new Set($R(this.bins).map((t=>t.field)))}hash(){return`Bin ${sR(this.bins)}`}assemble(){return $R(this.bins).flatMap((t=>{const n=[],[e,...r]=t.as,{extent:i,...o}=t.bin,a={type:"bin",field:_R(t.field),as:e,signal:t.signal,...fq(i)?{extent:null}:{extent:i},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!i&&t.extentSignal&&(n.push({type:"extent",field:_R(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const t of r)for(let r=0;r<2;r++)n.push({type:"formula",expr:sG({field:e[r]},{expr:"datum"}),as:t[r]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n}))}}class hQ extends mX{clone(){return new hQ(null,new Set(this.dimensions),iR(this.measures))}constructor(t,n,e){super(t),this.dimensions=n,this.measures=e}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let e=!1;n.forEachFieldDef((t=>{t.aggregate&&(e=!0)}));const r={},i=new Set;return e?(n.forEachFieldDef(((t,e)=>{const{aggregate:o,field:a}=t;if(o)if("count"===o)r["*"]??(r["*"]={}),r["*"].count=new Set([sG(t,{forAs:!0})]);else{if(ZI(o)||tq(o)){const t=ZI(o)?"argmin":"argmax",n=o[t];r[n]??(r[n]={}),r[n][t]=new Set([sG({op:t,field:n},{forAs:!0})])}else r[a]??(r[a]={}),r[a][o]=new Set([sG(t,{forAs:!0})]);GI(e)&&"unaggregated"===n.scaleDomain(e)&&(r[a]??(r[a]={}),r[a].min=new Set([sG({field:a,aggregate:"min"},{forAs:!0})]),r[a].max=new Set([sG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(t,n,e,r){const i=SZ(r)?r.encoding[eI(n)]:void 0;if(nG(e)&&SZ(r)&&UH(e,i,r.markDef,r.config)){t.add(sG(e,{})),t.add(sG(e,{suffix:"end"}));const{mark:i,markDef:o,config:a}=r,u=IH({fieldDef:e,markDef:o,config:a});KW(i)&&.5!==u&&DI(n)&&(t.add(sG(e,{suffix:bX})),t.add(sG(e,{suffix:wX}))),e.bin&&SG(e,n)&&t.add(sG(e,{binSuffix:"range"}))}else if(BL(n)){const e=zL(n);t.add(r.getName(e))}else t.add(sG(e));rG(e)&&function(t){return S(t)&&"field"in t}(e.scale?.range)&&t.add(e.scale.range.field)}(i,e,t,n)})),i.size+xR(r).length===0?null:new hQ(t,i,r)):null}static makeFromTransform(t,n){var e;const r=new Set,i={};for(const t of n.aggregate){const{op:n,field:r,as:o}=t;n&&("count"===n?(i["*"]??(i["*"]={}),i["*"].count=new Set([o||sG(t,{forAs:!0})])):(i[r]??(i[r]={}),(e=i[r])[n]??(e[n]=new Set),i[r][n].add(o||sG(t,{forAs:!0}))))}for(const t of n.groupby??[])r.add(t);return r.size+xR(i).length===0?null:new hQ(t,r,i)}merge(t){return gR(this.dimensions,t.dimensions)?(function(t,n){for(const e of xR(n)){const r=n[e];for(const n of xR(r))e in t?t[e][n]=new Set([...t[e][n]??[],...r[n]]):t[e]={[n]:r[n]}}}(this.measures,t.measures),!0):(gU.debug("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...xR(this.measures)])}producedFields(){const t=new Set;for(const n of xR(this.measures))for(const e of xR(this.measures[n])){const r=this.measures[n][e];0===r.size?t.add(`${e}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${sR({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],e=[];for(const r of xR(this.measures))for(const i of xR(this.measures[r]))for(const o of this.measures[r][i])e.push(o),t.push(i),n.push("*"===r?null:_R(r));return{type:"aggregate",groupby:[...this.dimensions].map(_R),ops:t,fields:n,as:e}}}class dQ extends mX{constructor(t,n,e,r){super(t),this.model=n,this.name=e,this.data=r;for(const t of LL){const e=n.facet[t];if(e){const{bin:r,sort:i}=e;this[t]={name:n.getName(`${t}_domain`),fields:[sG(e),...uq(r)?[sG(e,{binSuffix:"end"})]:[]],...zH(i)?{sortField:i}:D(i)?{sortIndexField:yK(e,t)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of LL)this[n]&&(t+=` ${n.charAt(0)}:${sR(this[n])}`);return t}get fields(){const t=[];for(const n of LL)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of LL)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of AI){const e=this.childModel.component.scales[n];if(e&&!e.merged){const r=e.get("type"),i=e.get("range");if(wW(r)&&vq(i)){const e=iZ(oZ(this.childModel,n));e?t[n]=e:yU(Uq(n))}}}return t}assembleRowColumnHeaderData(t,n,e){const r={row:"y",column:"x",facet:void 0}[t],i=[],o=[],a=[];r&&e&&e[r]&&(n?(i.push(`distinct_${e[r]}`),o.push("max")):(i.push(e[r]),o.push("distinct")),a.push(`distinct_${e[r]}`));const{sortField:u,sortIndexField:s}=this[t];if(u){const{op:t=CH,field:n}=u;i.push(n),o.push(t),a.push(sG(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...i.length?{fields:i,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:e}=this.model.component,r=[],i={};for(const t of $K){for(const n of kK){const r=(e[t]&&e[t][n])??[];for(const n of r)if(n.axes?.length>0){i[t]=!0;break}}if(i[t]){const e=`length(data("${this.facet.name}"))`;r.push({name:`${this.facet.name}_${t}`,transform:[{type:"sequence",start:0,stop:"row"===t?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e}}]})}}const{row:o,column:a}=i;return(o||a)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const e=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:o}=this;if(r&&i&&(e.x||e.y)){n=`cross_${this.column.name}_${this.row.name}`;const r=[].concat(e.x??[],e.y??[]),i=r.map((()=>"distinct"));t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:r,ops:i}]})}for(const r of[XR,VR])this[r]&&t.push(this.assembleRowColumnHeaderData(r,n,e));if(o){const n=this.assembleFacetHeaderData(e);n&&t.push(...n)}return t}}function mQ(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function pQ(t){const n={};return eR(t.filter,(t=>{if(YU(t)){let e=null;LU(t)?e=kq(t.equal):qU(t)?e=kq(t.lte):IU(t)?e=kq(t.lt):UU(t)?e=kq(t.gt):WU(t)?e=kq(t.gte):HU(t)?e=t.range[0]:GU(t)&&(e=(t.oneOf??t.in)[0]),e&&(bU(e)?n[t.field]="date":bt(e)?n[t.field]="number":xt(e)&&(n[t.field]="string")),t.timeUnit&&(n[t.field]="date")}})),n}class gQ extends mX{clone(){return new gQ(null,iR(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${sR(this._parse)}`}static makeExplicit(t,n,e){let r={};const i=n.data;return!sX(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(t,r,{},e)}static makeWithAncestors(t,n,e,r){for(const t of xR(e)){const n=r.getWithExplicit(t);void 0!==n.value&&(n.explicit||n.value===e[t]||"derived"===n.value||"flatten"===e[t]?delete e[t]:yU(Xq(t,e[t],n.value)))}for(const t of xR(n)){const e=r.get(t);void 0!==e&&(e===n[t]?delete n[t]:yU(Xq(t,n[t],e)))}const i=new QV(n,e);r.copyAll(i);const o={};for(const t of xR(i.combine())){const n=i.get(t);null!==n&&(o[t]=n)}return 0===xR(o).length||r.parseNothing?null:new gQ(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of xR(this._parse)){const e=this._parse[n];1===TR(n)&&(t[n]=e)}return t}producedFields(){return new Set(xR(this._parse))}dependentFields(){return new Set(xR(this._parse))}assembleTransforms(t=!1){return xR(this._parse).filter((n=>!t||TR(n)>1)).map((t=>{const n=function(t,n){const e=ER(t);return"number"===n?`toNumber(${e})`:"boolean"===n?`toBoolean(${e})`:"string"===n?`toString(${e})`:"date"===n?`toDate(${e})`:"flatten"===n?e:n.startsWith("date:")?`timeParse(${e},'${mQ(n.slice(5,n.length))}')`:n.startsWith("utc:")?`utcParse(${e},'${mQ(n.slice(4,n.length))}')`:(yU(`Unrecognized parse "${n}".`),null)}(t,this._parse[t]);return n?{type:"formula",expr:n,as:BR(t)}:null})).filter((t=>null!==t))}}class vQ extends mX{clone(){return new vQ(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([$Y])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:$Y}}}class yQ extends mX{clone(){return new yQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${sR(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class bQ extends mX{clone(){return new bQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${sR(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class wQ extends mX{constructor(t){let n;if(super(null),t??(t={name:"source"}),sX(t)||(n=t.format?{...uR(t.format,["parse"])}:{}),aX(t))this._data={values:t.values};else if(oX(t)){if(this._data={url:t.url},!n.type){let e=/(?:\.([^.]+))?$/.exec(t.url)[1];fR(["json","csv","tsv","dsv","topojson"],e)||(e="json"),n.type=e}}else fX(t)?this._data={values:[{type:"Sphere"}]}:(uX(t)||sX(t))&&(this._data={});this._generator=sX(t),t.name&&(this._name=t.name),n&&!wR(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(t){this._name=t}set parent(t){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:[]}}}var xQ,$Q=function(t,n,e,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?t!==n||!i:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,e):i?i.value=e:n.set(t,e),e};function kQ(t){return t instanceof wQ||t instanceof yQ||t instanceof bQ}class MQ{constructor(){xQ.set(this,void 0),$Q(this,xQ,!1,"f")}setModified(){$Q(this,xQ,!0,"f")}get modifiedFlag(){return function(t,n,e,r){if("a"===e&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?t!==n||!r:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?r:"a"===e?r.call(t):r?r.value:n.get(t)}(this,xQ,"f")}}xQ=new WeakMap;class AQ extends MQ{getNodeDepths(t,n,e){e.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,e);return e}optimize(t){const n=[...this.getNodeDepths(t,0,new Map).entries()].sort(((t,n)=>n[1]-t[1]));for(const t of n)this.run(t[0]);return this.modifiedFlag}}class DQ extends MQ{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class SQ extends DQ{mergeNodes(t,n){const e=n.shift();for(const r of n)t.removeChild(r),r.parent=e,r.remove()}run(t){const n=t.children.map((t=>t.hash())),e={};for(let r=0;r<n.length;r++)void 0===e[n[r]]?e[n[r]]=[t.children[r]]:e[n[r]].push(t.children[r]);for(const n of xR(e))e[n].length>1&&(this.setModified(),this.mergeNodes(t,e[n]))}}class FQ extends DQ{constructor(t){super(),this.requiresSelectionId=t&&JJ(t)}run(t){t instanceof vQ&&(this.requiresSelectionId&&(kQ(t.parent)||t.parent instanceof hQ||t.parent instanceof gQ)||(this.setModified(),t.remove()))}}class EQ extends MQ{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let e=new Set;t instanceof yX&&(e=t.producedFields(),vR(e,n)&&(this.setModified(),t.removeFormulas(n),0===t.producedFields.length&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...e]))}}class NQ extends DQ{constructor(){super()}run(t){t instanceof pX&&!t.isRequired()&&(this.setModified(),t.remove())}}class CQ extends AQ{run(t){if(!(kQ(t)||t.numChildren()>1))for(const n of t.children)if(n instanceof gQ)if(t instanceof gQ)this.setModified(),t.merge(n);else{if(bR(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}class OQ extends AQ{run(t){const n=[...t.children],e=t.children.filter((t=>t instanceof gQ));if(t.numChildren()>1&&e.length>=1){const r={},i=new Set;for(const t of e){const n=t.parse;for(const t of xR(n))t in r?r[t]!==n[t]&&i.add(t):r[t]=n[t]}for(const t of i)delete r[t];if(!wR(r)){this.setModified();const e=new gQ(t,r);for(const i of n){if(i instanceof gQ)for(const t of xR(r))delete i.parse[t];t.removeChild(i),i.parent=e,i instanceof gQ&&0===xR(i.parse).length&&i.remove()}}}}}class _Q extends AQ{run(t){t instanceof pX||t.numChildren()>0||t instanceof dQ||t instanceof wQ||(this.setModified(),t.remove())}}class zQ extends AQ{run(t){const n=t.children.filter((t=>t instanceof yX)),e=n.pop();for(const t of n)this.setModified(),e.merge(t)}}class BQ extends AQ{run(t){const n=t.children.filter((t=>t instanceof hQ)),e={};for(const t of n){const n=sR(t.groupBy);n in e||(e[n]=[]),e[n].push(t)}for(const n of xR(e)){const r=e[n];if(r.length>1){const n=r.pop();for(const e of r)n.merge(e)&&(t.removeChild(e),e.parent=n,e.remove(),this.setModified())}}}}class TQ extends AQ{constructor(t){super(),this.model=t}run(t){const n=!(kQ(t)||t instanceof eK||t instanceof gQ||t instanceof vQ),e=[],r=[];for(const i of t.children)i instanceof lQ&&(n&&!bR(t.producedFields(),i.dependentFields())?e.push(i):r.push(i));if(e.length>0){const n=e.pop();for(const t of e)n.merge(t,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof lQ?t.merge(n,this.model.renameSignal.bind(this.model)):n.swapWithParent()}if(r.length>1){const t=r.pop();for(const n of r)t.merge(n,this.model.renameSignal.bind(this.model));this.setModified()}}}class PQ extends AQ{run(t){const n=[...t.children];if(!lR(n,(t=>t instanceof pX))||t.numChildren()<=1)return;const e=[];let r;for(const i of n)if(i instanceof pX){let n=i;for(;1===n.numChildren();){const[t]=n.children;if(!(t instanceof pX))break;n=t}e.push(...n.children),r?(t.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setModified()):r=n}else e.push(i);if(e.length){this.setModified();for(const t of e)t.parent.removeChild(t),t.parent=r}}}class jQ extends mX{clone(){return new jQ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??sG(t)}hash(){return`JoinAggregateTransform ${sR(this.transform)}`}assemble(){const t=[],n=[],e=[];for(const r of this.transform.joinaggregate)n.push(r.op),e.push(this.getDefaultName(r)),t.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==r?{groupby:r}:{}}}}class RQ extends mX{clone(){return new RQ(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,e){const{config:r,markDef:i}=n,{marks:o,scales:a}=e;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const u=n.reduceFieldDef(((t,e,o)=>{const a=GI(o)&&n.getScaleComponent(o);if(a){const n=a.get("type"),{aggregate:u}=e,s=lH({scaleChannel:o,markDef:i,config:r,scaleType:n,isCountAggregate:rq(u)});"show"!==s&&"always-valid"!==s&&(t[e.field]=e)}return t}),{});return xR(u).length?new RQ(t,u):null}dependentFields(){return new Set(xR(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${sR(this.filter)}`}assemble(){const t=xR(this.filter).reduce(((t,n)=>{const e=this.filter[n],r=sG(e,{expr:"datum"});return null!==e&&("temporal"===e.type?t.push(`(isDate(${r}) || (${LQ(r)}))`):"quantitative"===e.type&&t.push(LQ(r))),t}),[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function LQ(t){return`isValid(${t}) && isFinite(+${t})`}class IQ extends mX{clone(){return new IQ(null,iR(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:e,groupby:r,as:i,offset:o="zero"}=n,a=[],u=[];if(void 0!==n.sort)for(const t of n.sort)a.push(t.field),u.push(PR(t.order,"ascending"));const s={field:a,order:u};let c;return c=function(t){return D(t)&&t.every((t=>xt(t)))&&t.length>1}(i)?i:xt(i)?[i,`${i}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new IQ(t,{dimensionFieldDefs:[],stackField:e,groupby:r,offset:o,sort:s,facetby:[],as:c})}static makeFromEncoding(t,n){const e=n.stack,{encoding:r}=n;if(!e)return null;const{groupbyChannels:i,fieldChannel:o,offset:a,impute:u}=e,s=i.map((t=>vG(r[t]))).filter((t=>!!t)),c=function(t){return t.stack.stackBy.reduce(((t,n)=>{const e=sG(n.fieldDef);return e&&t.push(e),t}),[])}(n),f=n.encoding.order;let l;if(D(f)||VH(f))l=Bq(f);else{const t=WH(f)?f.sort:"y"===o?"descending":"ascending";l=c.reduce(((n,e)=>(n.field.includes(e)||(n.field.push(e),n.order.push(t)),n)),{field:[],order:[]})}return new IQ(t,{dimensionFieldDefs:s,stackField:n.vgField(o),facetby:[],stackby:c,sort:l,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${sR(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:e}=this._stack;return t.length>0?t.map((t=>t.bin?n?[sG(t,{binSuffix:"mid"})]:[sG(t,{}),sG(t,{binSuffix:"end"})]:[sG(t)])).flat():e??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:e,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u)for(const o of e){const{bandPosition:e=.5,bin:a}=o;if(a){const n=sG(o,{expr:"datum"}),r=sG(o,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${LQ(n)} ? ${e}*${n}+${1-e}*${r} : ${n}`,as:sG(o,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...i,...n],key:sG(o,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:o,as:s,offset:a}),t}}class qQ extends mX{clone(){return new qQ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach((n=>t.add(n.field))),this.transform.window.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??sG(t)}hash(){return`WindowTransform ${sR(this.transform)}`}assemble(){const t=[],n=[],e=[],r=[];for(const i of this.transform.window)n.push(i.op),e.push(this.getDefaultName(i)),r.push(void 0===i.param?null:i.param),t.push(void 0===i.field?null:i.field);const i=this.transform.frame,o=this.transform.groupby;if(i&&null===i[0]&&null===i[1]&&n.every((t=>nq(t))))return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==o?{groupby:o}:{}};const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(t.order??"ascending");const s=this.transform.ignorePeers;return{type:"window",params:r,as:e,ops:n,fields:t,sort:{field:a,order:u},...void 0!==s?{ignorePeers:s}:{},...void 0!==o?{groupby:o}:{},...void 0!==i?{frame:i}:{}}}}function UQ(t){if(t instanceof dQ)if(1!==t.numChildren()||t.children[0]instanceof pX){const e=t.model.component.data.main;WQ(e);const r=(n=t,function t(e){if(!(e instanceof dQ)){const r=e.clone();if(r instanceof pX){const t=HQ+r.getSource();r.setSource(t),n.model.component.data.outputNodes[t]=r}else(r instanceof hQ||r instanceof IQ||r instanceof qQ||r instanceof jQ)&&r.addDimensions(n.fields);for(const n of e.children.flatMap(t))n.parent=r;return[r]}return e.children.flatMap(t)}),i=t.children.map(r).flat();for(const t of i)t.parent=e}else{const n=t.children[0];(n instanceof hQ||n instanceof IQ||n instanceof qQ||n instanceof jQ)&&n.addDimensions(t.fields),n.swapWithParent(),UQ(t)}else t.children.map(UQ);var n}function WQ(t){if(t instanceof pX&&t.type===hX.Main&&1===t.numChildren()){const n=t.children[0];n instanceof dQ||(n.swapWithParent(),WQ(t))}}const HQ="scale_";function GQ(t){for(const n of t){for(const t of n.children)if(t.parent!==n)return!1;if(!GQ(n.children))return!1}return!0}function YQ(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function VQ(t,n,e){let r=t.sources,i=!1;return i=YQ(new NQ,r)||i,i=YQ(new FQ(n),r)||i,r=r.filter((t=>t.numChildren()>0)),i=YQ(new _Q,r)||i,r=r.filter((t=>t.numChildren()>0)),e||(i=YQ(new CQ,r)||i,i=YQ(new TQ(n),r)||i,i=YQ(new EQ,r)||i,i=YQ(new OQ,r)||i,i=YQ(new BQ,r)||i,i=YQ(new zQ,r)||i,i=YQ(new SQ,r)||i,i=YQ(new PQ,r)||i),t.sources=r,i}class XQ{constructor(t){Object.defineProperty(this,"signal",{enumerable:!0,get:t})}static fromName(t,n){return new XQ((()=>t(n)))}}function JQ(t){SZ(t)?function(t){const n=t.component.scales;for(const e of xR(n)){const r=KQ(t,e);if(n[e].setWithExplicit("domains",r),nZ(t,e),t.component.data.isFaceted){let n=t;for(;!FZ(n)&&n.parent;)n=n.parent;if("shared"===n.component.resolve.scale[e])for(const t of r.value)yq(t)&&(t.data=HQ+t.data.replace(HQ,""))}}}(t):function(t){for(const n of t.children)JQ(n);const n=t.component.scales;for(const e of xR(n)){let r,i=null;for(const n of t.children){const t=n.component.scales[e];if(t){r=void 0===r?t.getWithExplicit("domains"):rX(r,t.getWithExplicit("domains"),"domains","scale",rZ);const n=t.get("selectionExtent");i&&n&&i.param!==n.param&&yU("The same selection must be used to override scale domains in a layered view."),i=n}}n[e].setWithExplicit("domains",r),i&&n[e].set("selectionExtent",i,!0)}}(t)}function KQ(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(t,n,e,r){if("unaggregated"===t){const{valid:t,reason:r}=eZ(n,e);if(!t)return void yU(r)}else if(void 0===t&&r.useUnaggregatedDomain){const{valid:t}=eZ(n,e);if(t)return"unaggregated"}return t}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),"x"===n&&yG(r.x2)?yG(r.x)?rX(ZQ(e,i,t,"x"),ZQ(e,i,t,"x2"),"domain","scale",rZ):ZQ(e,i,t,"x2"):"y"===n&&yG(r.y2)?yG(r.y)?rX(ZQ(e,i,t,"y"),ZQ(e,i,t,"y2"),"domain","scale",rZ):ZQ(e,i,t,"y2"):ZQ(e,i,t,n)}function QQ(t,n,e){const r=TU(e)?.unit;return"temporal"===n||r?function(t,n,e){return t.map((t=>({signal:`{data: ${AG(t,{timeUnit:e,type:n})}}`})))}(t,n,r):[t]}function ZQ(t,n,e,r){const{encoding:i,markDef:o,mark:a,config:u,stack:s}=e,c=yG(i[r]),{type:f}=c,l=c.timeUnit,h=function(t){const{marks:n,scales:e}=dX(t);return n===e?hX.Main:"include-invalid-values"===e?hX.PreFilterInvalid:hX.PostFilterInvalid}({invalid:Oq("invalid",o,u),isPath:JW(a)});if(function(t){return YR(t,"unionWith")}(n)){const i=ZQ(t,void 0,e,r);return ZV([...QQ(n.unionWith,f,l),...i.value])}if(gq(n))return ZV([n]);if(n&&"unaggregated"!==n&&!MW(n))return ZV(QQ(n,f,l));if(s&&r===s.fieldChannel){if("normalize"===s.offset)return tX([[0,1]]);const t=e.requestDataName(h);return tX([{data:t,field:e.vgField(r,{suffix:"start"})},{data:t,field:e.vgField(r,{suffix:"end"})}])}const d=GI(r)&&VH(c)?function(t,n,e){if(!wW(e))return;const r=t.fieldDef(n),i=r.sort;if(BH(i))return{op:"min",field:yK(r,n),order:"ascending"};const{stack:o}=t,a=o?new Set([...o.groupbyFields,...o.stackBy.map((t=>t.fieldDef.field))]):void 0;if(zH(i))return tZ(i,o&&!a.has(i.field));if(function(t){return YR(t,"encoding")}(i)){const{encoding:n,order:e}=i,r=t.fieldDef(n),{aggregate:u,field:s}=r,c=o&&!a.has(s);if(ZI(u)||tq(u))return tZ({field:sG(r),order:e},c);if(nq(u)||!u)return tZ({op:u,field:s,order:e},c)}else{if("descending"===i)return{op:"min",field:t.vgField(n),order:"descending"};if(fR(["ascending",void 0],i))return!0}}(e,r,t):void 0;if(JH(c))return tX(QQ([c.datum],f,l));const m=c;if("unaggregated"===n){const{field:t}=c;return tX([{data:e.requestDataName(h),field:sG({field:t,aggregate:"min"})},{data:e.requestDataName(h),field:sG({field:t,aggregate:"max"})}])}if(uq(m.bin)){if(wW(t))return tX("bin-ordinal"===t?[]:[{data:MR(d)?e.requestDataName(h):e.requestDataName(hX.Raw),field:e.vgField(r,SG(m,r)?{binSuffix:"range"}:{}),sort:!0!==d&&S(d)?d:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:t}=m;if(uq(t)){const n=cQ(e,m.field,t);return tX([new XQ((()=>{const t=e.getSignalName(n);return`[${t}.start, ${t}.stop]`}))])}return tX([{data:e.requestDataName(h),field:e.vgField(r,{})}])}}if(m.timeUnit&&fR(["time","utc"],t)){const t=i[eI(r)];if(UH(m,t,o,u)){const n=e.requestDataName(h),i=IH({fieldDef:m,fieldDef2:t,markDef:o,config:u}),s=KW(a)&&.5!==i&&DI(r);return tX([{data:n,field:e.vgField(r,s?{suffix:bX}:{})},{data:n,field:e.vgField(r,{suffix:s?wX:"end"})}])}}return tX(d?[{data:MR(d)?e.requestDataName(h):e.requestDataName(hX.Raw),field:e.vgField(r),sort:d}]:[{data:e.requestDataName(h),field:e.vgField(r)}])}function tZ(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":CH),...r?{field:_R(r)}:{},...i?{order:i}:{}}}function nZ(t,n){const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=t.fieldDef(n)?.bin,o=MW(r)?r:void 0,a=cq(i)&&fq(i.extent)?i.extent:void 0;(o||a)&&e.set("selectionExtent",o??a,!0)}function eZ(t,n){const{aggregate:e,type:r}=t;return e?xt(e)&&!oq.has(e)?{valid:!1,reason:uU(e)}:"quantitative"===r&&"log"===n?{valid:!1,reason:sU(t)}:{valid:!0}:{valid:!1,reason:aU(t)}}function rZ(t,n,e,r){return t.explicit&&n.explicit&&yU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${GR(e)} and ${GR(r)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function iZ(t){if(yq(t)&&xt(t.field))return t.field;if(function(t){return!D(t)&&YR(t,"fields")&&!YR(t,"data")}(t)){let n;for(const e of t.fields)if(yq(e)&&xt(e.field))if(n){if(n!==e.field)return yU("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=e.field;return yU("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(t){return!D(t)&&YR(t,"fields")&&YR(t,"data")}(t)){yU("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=t.fields[0];return xt(n)?n:void 0}}function oZ(t,n){const e=t.component.scales[n].get("domains").map((n=>(yq(n)&&(n.data=t.lookupDataSource(n.data)),n)));return function(t){const n=pR(t.map((t=>{if(yq(t)){const{sort:n,...e}=t;return e}return t})),sR),e=pR(t.map((t=>{if(yq(t)){const n=t.sort;return void 0===n||MR(n)||("op"in n&&"count"===n.op&&delete n.field,"ascending"===n.order&&delete n.order),n}})).filter((t=>void 0!==t)),sR);if(0===n.length)return;if(1===n.length){const n=t[0];if(yq(n)&&e.length>0){let t=e[0];if(e.length>1){yU(lU);const n=e.filter((t=>S(t)&&"op"in t&&"min"!==t.op));t=!e.every((t=>S(t)&&"op"in t))||1!==n.length||n[0]}else S(t)&&"field"in t&&n.field===t.field&&(t=!t.order||{order:t.order});return{...n,sort:t}}return n}const r=pR(e.map((t=>MR(t)||!("op"in t)||xt(t.op)&&ft(QI,t.op)?t:(yU(function(t){return`Dropping sort property ${GR(t)} as unioned domains only support boolean or op "count", "min", and "max".`}(t)),!0))),sR);let i;1===r.length?i=r[0]:r.length>1&&(yU(lU),i=!0);const o=pR(t.map((t=>yq(t)?t.data:null)),(t=>t));return 1===o.length&&null!==o[0]?{data:o[0],fields:n.map((t=>t.field)),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}(e)}function aZ(t){return NZ(t)||EZ(t)?t.children.reduce(((t,n)=>t.concat(aZ(n))),uZ(t)):uZ(t)}function uZ(t){return xR(t.component.scales).reduce(((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:c,reverse:f,...l}=i,h=function(t,n,e,r){if(DI(e)){if(vq(t))return{step:{signal:`${n}_step`}}}else if(S(t)&&yq(t))return{...t,data:r.lookupDataSource(t.data)};return t}(i.range,o,e,t),d=oZ(t,e),m=u?function(t,n,e,r){const i=iK(t,n.param,n);return{signal:xW(e.get("type"))&&D(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}(t,u,r,d):null;return n.push({name:o,type:a,...d?{domain:d}:{},...m?{domainRaw:m}:{},range:h,...void 0!==f?{reverse:f}:{},...l}),n}),[])}class sZ extends QV{constructor(t,n){super({},{name:t}),this.merged=!1,this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(fR(["log",aW,uW],t))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&fR([oW,"sqrt","pow"],t))return"definitely";const e=this.get("domains");if(e.length>0){let t=!1,n=!1,r=!1;for(const i of e){if(D(i)){const e=i[0],r=i[i.length-1];if(bt(e)&&bt(r)){if(e<=0&&r>=0){t=!0;continue}n=!0;continue}}r=!0}if(t)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const cZ=["range","scheme"];function fZ(t,n){const e=t.fieldDef(n);if(e?.bin){const{bin:r,field:i}=e,o=rI(n),a=t.getName(o);if(S(r)&&r.binned&&void 0!==r.step)return new XQ((()=>{const e=t.scaleName(n),i=`(domain("${e}")[1] - domain("${e}")[0]) / ${r.step}`;return`${t.getSignalName(a)} / (${i})`}));if(uq(r)){const n=cQ(t,i,r);return new XQ((()=>{const e=t.getSignalName(n),r=`(${e}.stop - ${e}.start) / ${e}.step`;return`${t.getSignalName(a)} / (${r})`}))}}}function lZ(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const r of cZ)if(void 0!==e[r]){const o=_W(i,r),a=zW(t,r);if(o)if(a)yU(a);else switch(r){case"range":{const r=e.range;if(D(r)){if(DI(t))return ZV(r.map((t=>{if("width"===t||"height"===t){const e=n.getName(t),r=n.getSignalName.bind(n);return XQ.fromName(r,e)}return t})))}else if(S(r))return ZV({data:n.requestDataName(hX.Main),field:r.field,sort:{op:"min",field:n.vgField(t)}});return ZV(r)}case"scheme":return ZV(hZ(e[r]))}else yU(cU(i,r,t))}const o=t===KR||"xOffset"===t?"width":"height",a=r[o];if(OY(a))if(DI(t))if(wW(i)){const e=mZ(a,n,t);if(e)return ZV({step:e})}else yU(fU(o));else if(CI(t)&&"band"===n.getScaleComponent(t===nL?"x":"y").get("type")){const t=pZ(a,i);if(t)return ZV(t)}const{rangeMin:u,rangeMax:s}=e,c=function(t,n){const{size:e,config:r,mark:i,encoding:o}=n,{type:a}=yG(o[t]),u=n.getScaleComponent(t).get("type"),{domain:s,domainMid:c}=n.specifiedScales[t];switch(t){case KR:case QR:if(fR(["point","band"],u)){const i=gZ(t,e,r.view);if(OY(i))return{step:mZ(i,n,t)}}return dZ(t,n,u);case nL:case eL:return function(t,n,e){const r=t===nL?"x":"y",i=n.getScaleComponent(r);if(!i)return dZ(r,n,e,{center:!0});const o=i.get("type"),a=n.scaleName(r),{markDef:u,config:s}=n;if("band"===o){const t=gZ(r,n.size,n.config.view);if(OY(t)){const n=pZ(t,e);if(n)return n}return[0,{signal:`bandwidth('${a}')`}]}{const e=n.encoding[r];if(VH(e)&&e.timeUnit){const t=PU(e.timeUnit,(t=>`scale('${a}', ${t})`)),r=n.config.scale.bandWithNestedOffsetPaddingInner,i=IH({fieldDef:e,markDef:u,config:s})-.5,o=0!==i?` + ${i}`:"";return r?[{signal:`${gq(r)?`${r.signal}/2`+o:`${r/2+i}`} * (${t})`},{signal:`${gq(r)?`(1 - ${r.signal}/2)`+o:`${1-r/2+i}`} * (${t})`}]:[0,{signal:t}]}return oR(`Cannot use ${t} scale if ${r} scale is not discrete.`)}}(t,n,u);case gL:{const o=function(t,n){switch(t){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(eU("size",t))}(i,r),a=function(t,n,e,r){const i={x:fZ(e,"x"),y:fZ(e,"y")};switch(t){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const t=yZ(n,i,r.view);return bt(t)?t-1:new XQ((()=>`${t.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 t=yZ(n,i,r.view);return bt(t)?Math.pow(vZ*t,2):new XQ((()=>`pow(${vZ} * ${t.signal}, 2)`))}}throw new Error(eU("size",t))}(i,e,n,r);return kW(u)?function(t,n,e){const r=()=>{const r=Fq(n),i=Fq(t),o=`(${r} - ${i}) / (${e} - 1)`;return`sequence(${i}, ${r} + ${o}, ${o})`};return gq(n)?new XQ(r):{signal:r()}}(o,a,function(t,n,e,r){switch(t){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==e&&D(e)?e.length+1:(yU(function(t){return`Domain for ${t} is required for threshold scale.`}(r)),3)}}(u,r,s,t)):[o,a]}case oL:return[0,2*Math.PI];case vL:return[0,360];case rL:return[0,new XQ((()=>`min(${n.getSignalName(FZ(n.parent)?"child_width":"width")},${n.getSignalName(FZ(n.parent)?"child_height":"height")})/2`))];case lL:return{step:1e3/r.scale.framesPerSecond};case xL:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case $L:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case pL:return"symbol";case hL:case dL:case mL:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===i||"geoshape"===i?"heatmap":"ramp";case yL:case bL:case wL:return[r.scale.minOpacity,r.scale.maxOpacity]}}(t,n);return(void 0!==u||void 0!==s)&&_W(i,"rangeMin")&&D(c)&&2===c.length?ZV([u??c[0],s??c[1]]):tX(c)}function hZ(t){return function(t){return!xt(t)&&YR(t,"name")}(t)?{scheme:t.name,...uR(t,["name"])}:{scheme:t}}function dZ(t,n,e,{center:r}={}){const i=rI(t),o=n.getName(i),a=n.getSignalName.bind(n);return t===QR&&xW(e)?r?[XQ.fromName((t=>`${a(t)}/2`),o),XQ.fromName((t=>`-${a(t)}/2`),o)]:[XQ.fromName(a,o),0]:r?[XQ.fromName((t=>`-${a(t)}/2`),o),XQ.fromName((t=>`${a(t)}/2`),o)]:[0,XQ.fromName(a,o)]}function mZ(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),o=oI(e),a=r[o];if("offset"===CY({step:t,offsetIsDiscrete:tG(a)&&ZU(a.type)})&&RG(r,o)){const e=n.getScaleComponent(o);let r=`domain('${n.scaleName(o)}').length`;"band"===e.get("type")&&(r=`bandspace(${r}, ${e.get("paddingInner")??e.get("padding")??0}, ${e.get("paddingOuter")??e.get("padding")??0})`);const a=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${r} / (1-${Dq(a)})`}}return t.step}function pZ(t,n){if("offset"===CY({step:t,offsetIsDiscrete:wW(n)}))return{step:t.step}}function gZ(t,n,e){const r=t===KR?"width":"height";return n[r]||PY(e,r)}const vZ=.95;function yZ(t,n,e){const r=OY(t.width)?t.width.step:TY(e,"width"),i=OY(t.height)?t.height.step:TY(e,"height");return n.x||n.y?new XQ((()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`)):Math.min(r,i)}function bZ(t,n){SZ(t)?function(t,n){const e=t.component.scales,{config:r,encoding:i,markDef:o,specifiedScales:a}=t;for(const u of xR(e)){const s=a[u],c=e[u],f=t.getScaleComponent(u),l=yG(i[u]),h=s[n],d=f.get("type"),m=f.get("padding"),p=f.get("paddingInner"),g=_W(d,n),v=zW(u,n);if(void 0!==h&&(g?v&&yU(v):yU(cU(d,n,u))),g&&void 0===v)if(void 0!==h){const t=l.timeUnit,e=l.type;switch(n){case"domainMax":case"domainMin":bU(s[n])||"temporal"===e||t?c.set(n,{signal:AG(s[n],{type:e,timeUnit:t})},!0):c.set(n,s[n],!0);break;default:c.copyKeyFromObject(n,s)}}else{const e=YR(wZ,n)?wZ[n]({model:t,channel:u,fieldOrDatumDef:l,scaleType:d,scalePadding:m,scalePaddingInner:p,domain:s.domain,domainMin:s.domainMin,domainMax:s.domainMax,markDef:o,config:r,hasNestedOffsetScale:LG(i,u),hasSecondaryRangeChannel:!!i[eI(u)]}):r.scale[n];void 0!==e&&c.set(n,e,!1)}}}(t,n):$Z(t,n)}const wZ={bins:({model:t,fieldOrDatumDef:n})=>VH(n)?function(t,n){const e=n.bin;if(uq(e)){const r=cQ(t,n.field,e);return new XQ((()=>t.getSignalName(r)))}if(sq(e)&&cq(e)&&void 0!==e.step)return{step:e.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(t,n){if(fR([hL,dL,mL],t)&&"nominal"!==n)return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:o})=>function(t,n,e,r,i,o){if(!(vG(o)?.bin||D(e)||null!=i||null!=r||fR([aW,uW],t)))return!!DI(n)||void 0}(t,n,e,r,i,o),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(t,n,e,r,i,o){if(DI(t)){if($W(n)){if(void 0!==e.continuousPadding)return e.continuousPadding;const{type:n,orient:a}=i;if("bar"===n&&(!VH(r)||!r.bin&&!r.timeUnit)&&("vertical"===a&&"x"===t||"horizontal"===a&&"y"===t))return o.continuousBandSize}if(n===sW)return e.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t){if(DI(n)){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:u}=i;return o?u:PR(t,"bar"===e?n:"tick"===e?a:r)}return CI(n)&&r===cW?i.offsetBandPaddingInner:void 0}}(t,n,e.type,r,i.scale,o),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t)if(DI(n)){const{bandPaddingOuter:t,bandWithNestedOffsetPaddingOuter:n}=i;if(o)return n;if(e===cW)return PR(t,gq(r)?{signal:`${r.signal}/2`}:r/2)}else if(CI(n)){if(e===sW)return.5;if(e===cW)return i.offsetBandPaddingOuter}}(t,n,e,r,i.scale,o),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(t,n,e,r){return"x"===e&&void 0!==r.xReverse?xW(t)&&"descending"===n?gq(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse:!(!xW(t)||"descending"!==n)||void 0}(n,VH(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:o,hasSecondaryRangeChannel:a})=>function(t,n,e,r,i,o,a){if(e&&"unaggregated"!==e&&xW(i)){if(D(e)){const t=e[0],n=e[e.length-1];if(bt(t)&&t<=0&&bt(n)&&n>=0)return!0}return!1}if("size"===t&&"quantitative"===n.type&&!kW(i))return!0;if((!VH(n)||!n.bin)&&fR([...AI,...FI],t)){const{orient:n,type:e}=r;return(!fR(["bar","area","line","trail"],e)||!("horizontal"===n&&"y"===t||"vertical"===n&&"x"===t))&&(!(!fR(["bar","area"],e)||a)||o?.zero)}return!1}(t,n,e,r,i,o.scale,a)};function xZ(t){SZ(t)?function(t){const n=t.component.scales;for(const e of HI){const r=n[e];if(!r)continue;const i=lZ(e,t);r.setWithExplicit("range",i)}}(t):$Z(t,"range")}function $Z(t,n){const e=t.component.scales;for(const e of t.children)"range"===n?xZ(e):bZ(e,n);for(const r of xR(e)){let i;for(const e of t.children){const t=e.component.scales[r];t&&(i=rX(i,t.getWithExplicit(n),n,"scale",nX(((t,e)=>"range"===n&&t.step&&e.step?t.step-e.step:0))))}e[r].setWithExplicit(n,i)}}function kZ(t,n,e,r,i=!1){const o=function(t,n,e,r){switch(n.type){case"nominal":case"ordinal":if(jL(t)||"discrete"===JI(t))return"shape"===t&&"ordinal"===n.type&&yU(oU(t,"ordinal")),"ordinal";if(_I(t))return"band";if(DI(t)||CI(t)){if(fR(["rect","bar","image","rule","tick"],e.type))return"band";if(r)return"band"}else if("arc"===e.type&&t in SI)return"band";return oH(e[rI(t)])||iG(n)&&n.axis?.tickBand?"band":"point";case"temporal":return jL(t)?"time":"discrete"===JI(t)?(yU(oU(t,"temporal")),"ordinal"):VH(n)&&n.timeUnit&&TU(n.timeUnit).utc?"utc":_I(t)?"band":"time";case"quantitative":return jL(t)?VH(n)&&uq(n.bin)?"bin-ordinal":"linear":"discrete"===JI(t)?(yU(oU(t,"quantitative")),"ordinal"):_I(t)?"band":"linear";case"geojson":return}throw new Error(Zq(n.type))}(n,e,r,i),{type:a}=t;return GI(n)?void 0!==a?function(t,n,e=!1){if(!GI(t))return!1;switch(t){case KR:case QR:case nL:case eL:case oL:case rL:return!!$W(n)||"band"===n||"point"===n&&!e;case lL:return fR(["linear","band"],n);case gL:case xL:case yL:case bL:case wL:case vL:return $W(n)||kW(n)||fR(["band","point","ordinal"],n);case hL:case dL:case mL:return"band"!==n;case $L:case pL:return"ordinal"===n||kW(n)}}(n,a)?VH(e)&&(u=a,!(fR([nW,rW],s=e.type)?void 0===u||wW(u):s===eW?fR([aW,uW,void 0],u):s!==tW||gW(u)||kW(u)||void 0===u))?(yU(function(t,n){return`FieldDef does not work with "${t}" scale. We are using "${n}" scale instead.`}(a,o)),o):a:(yU(function(t,n,e){return`Channel "${t}" does not work with "${n}" scale. We are using "${e}" scale instead.`}(n,a,o)),o):o:null;var u,s}function MZ(t){t.component.scales=SZ(t)?function(t){const{encoding:n,mark:e,markDef:r}=t,i={};for(const o of HI){const a=yG(n[o]);if(a&&e===XW&&o===pL&&a.type===iW)continue;let u=a&&a.scale;if(a&&null!==u&&!1!==u){u??(u={});const e=kZ(u,o,a,r,LG(n,o));i[o]=new sZ(t.scaleName(`${o}`,!0),{value:e,explicit:u.type===e})}}return i}(t):function(t){var n;const e=t.component.scales={},r={},i=t.component.resolve;for(const e of t.children){MZ(e);for(const o of xR(e.component.scales))if((n=i.scale)[o]??(n[o]=LK(o,t)),"shared"===i.scale[o]){const t=r[o],n=e.component.scales[o].getWithExplicit("type");t?lW(t.value,n.value)?r[o]=rX(t,n,"type","scale",AZ):(i.scale[o]="independent",delete r[o]):r[o]=n}}for(const n of xR(r)){const i=t.scaleName(n,!0);e[n]=new sZ(i,r[n]);for(const e of t.children){const t=e.component.scales[n];t&&(e.renameScale(t.get("name"),i),t.merged=!0)}}return e}(t)}const AZ=nX(((t,n)=>dW(t)-dW(n)));class DZ{constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return void 0!==this.nameMap[t]}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function SZ(t){return"unit"===t?.type}function FZ(t){return"facet"===t?.type}function EZ(t){return"concat"===t?.type}function NZ(t){return"layer"===t?.type}class CZ{constructor(t,n,e,r,i,o,a){this.type=n,this.parent=e,this.config=i,this.parent=e,this.config=i,this.view=dq(a),this.name=t.name??r,this.title=pq(t.title)?{text:t.title}:t.title?dq(t.title):void 0,this.scaleNameMap=e?e.scaleNameMap:new DZ,this.projectionNameMap=e?e.projectionNameMap:new DZ,this.signalNameMap=e?e.signalNameMap:new DZ,this.data=t.data,this.description=t.description,this.transforms=function(t){return t.map((t=>wV(t)?{filter:rR(t.filter,KU)}:t))}(t.transform??[]),this.layout="layer"===n||"unit"===n?{}:function(t,n,e){const r=e[n],i={},{spacing:o,columns:a}=r;void 0!==o&&(i.spacing=o),void 0!==a&&(jH(t)&&!TH(t.facet)||FY(t))&&(i.columns=a),EY(t)&&(i.columns=1);for(const n of zY)if(void 0!==t[n])if("spacing"===n){const e=t[n];i[n]=bt(e)?e:{row:e.row??o,column:e.column??o}}else i[n]=t[n];return i}(t,n,i),this.component={data:{sources:e?e.component.data.sources:[],outputNodes:e?e.component.data.outputNodes:{},outputNodeRefCounts:e?e.component.data.outputNodeRefCounts:{},isFaceted:jH(t)||e?.component.data.isFaceted&&void 0===t.data},layoutSize:new QV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?iR(o):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(t,{ignoreRange:n}={}){MZ(t),JQ(t);for(const n of OW)bZ(t,n);n||xZ(t)}(this)}parseProjection(){aQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){QK(this)}assembleEncodeFromView(t){const{style:n,...e}=t,r={};for(const t of xR(e)){const n=e[t];void 0!==n&&(r[t]=Aq(n))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),t||(this.description&&(n.description=Aq(this.description)),"unit"!==this.type&&"layer"!==this.type)?wR(n)?void 0:n:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:e,config:r}=this,i=function(t,n){const e={};for(const r of LL){const i=t[r];if(i?.facetFieldDef){const{titleAnchor:t,titleOrient:o}=xK(["titleAnchor","titleOrient"],i.facetFieldDef.header,n,r),a=bK(r,o),u=OK(t,a);void 0!==u&&(e[a]=u)}}return wR(e)?void 0:e}(e.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const e of LL)t[e].title&&n.push(MK(this,e));for(const t of $K)n=n.concat(SK(this,t));return n}assembleAxes(){return function(t,n){const{x:e=[],y:r=[]}=t;return[...e.map((t=>uK(t,"grid",n))),...r.map((t=>uK(t,"grid",n))),...e.map((t=>uK(t,"main",n))),...r.map((t=>uK(t,"main",n)))].filter((t=>t))}(this.component.axes,this.config)}assembleLegends(){return eQ(this)}assembleProjections(){return NZ(t=this)||EZ(t)?function(t){return t.children.reduce(((t,n)=>t.concat(n.assembleProjections())),rQ(t))}(t):rQ(t);var t}assembleTitle(){const{encoding:t,...n}=this.title??{},e={...mq(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(e.text)return fR(["unit","layer"],this.type)?fR(["middle",void 0],e.anchor)&&(e.frame??(e.frame="group")):e.anchor??(e.anchor="start"),wR(e)?void 0:e}assembleGroup(t=[]){const n={};(t=t.concat(this.assembleSignals())).length>0&&(n.signals=t);const e=this.assembleLayout();e&&(n.layout=e),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||FZ(this.parent)?aZ(this):[];r.length>0&&(n.scales=r);const i=this.assembleAxes();i.length>0&&(n.axes=i);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return AR((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(hX[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),e=this.component.data.outputNodeRefCounts;return e[n]=(e[n]||0)+1,n}getSizeSignalRef(t){if(FZ(this.parent)){const n=EI(jK(t)),e=this.component.scales[n];if(e&&!e.merged){const t=e.get("type"),r=e.get("range");if(wW(t)&&vq(r)){const t=e.get("name"),r=iZ(oZ(this,n));return r?{signal:PK(t,e,sG({aggregate:"distinct",field:r},{expr:"datum"}))}:(yU(Uq(n)),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){return n?this.getName(t):KL(t)&&GI(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?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(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let e=this.component.selection[t];if(!e&&this.parent&&(e=this.parent.getSelectionComponent(t,n)),!e)throw new Error(`Cannot find a selection named "${n}".`);return e}hasAxisOrientSignalRef(){return this.component.axes.x?.some((t=>t.hasOrientSignalRef()))||this.component.axes.y?.some((t=>t.hasOrientSignalRef()))}}class OZ extends CZ{vgField(t,n={}){const e=this.fieldDef(t);if(e)return sG(e,n)}reduceFieldDef(t,n){return function(t,n,e,r){return t?xR(t).reduce(((e,i)=>{const o=t[i];return D(o)?o.reduce(((t,e)=>n.call(r,t,e,i)),e):n.call(r,e,o,i)}),e):e}(this.getMapping(),((n,e,r)=>{const i=vG(e);return i?t(n,i,r):n}),n)}forEachFieldDef(t,n){HG(this.getMapping(),((n,e)=>{const r=vG(n);r&&t(r,e)}),n)}}class _Z extends mX{clone(){return new _Z(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"value",e[1]??"density"],this.transform.resolve=this.transform.resolve??"shared"}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${sR(this.transform)}`}assemble(){const{density:t,...n}=this.transform,e={type:"kde",field:t,...n};return e.resolve=this.transform.resolve,e}}class zZ extends mX{clone(){return new zZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${sR(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class BZ extends mX{clone(){return new BZ(this.parent,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const{flatten:e,as:r=[]}=this.transform;this.transform.as=e.map(((t,n)=>r[n]??t))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${sR(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class TZ extends mX{clone(){return new TZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"key",e[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${sR(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class PZ extends mX{clone(){return new PZ(null,iR(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let e=0;for(const r of[[sL,uL],[fL,cL]]){const i=r.map((t=>{const e=yG(n.encoding[t]);return VH(e)?e.field:JH(e)?{expr:`${e.datum}`}:eG(e)?{expr:`${e.value}`}:void 0}));(i[0]||i[1])&&(t=new PZ(t,i,null,n.getName("geojson_"+e++)))}if(n.channelHasField(pL)){const r=n.typedFieldDef(pL);r.type===iW&&(t=new PZ(t,null,r.field,n.getName("geojson_"+e++)))}return t}constructor(t,n,e,r){super(t),this.fields=n,this.geojson=e,this.signal=r}dependentFields(){const t=(this.fields??[]).filter(xt);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${sR(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class jZ extends mX{clone(){return new jZ(null,this.projection,iR(this.fields),iR(this.as))}constructor(t,n,e,r){super(t),this.projection=n,this.fields=e,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const e of[[sL,uL],[fL,cL]]){const r=e.map((t=>{const e=yG(n.encoding[t]);return VH(e)?e.field:JH(e)?{expr:`${e.datum}`}:eG(e)?{expr:`${e.value}`}:void 0})),i=e[0]===fL?"2":"";(r[0]||r[1])&&(t=new jZ(t,n.projectionName(),r,[n.getName(`x${i}`),n.getName(`y${i}`)]))}return t}dependentFields(){return new Set(this.fields.filter(xt))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${sR(this.fields)} ${sR(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class RZ extends mX{clone(){return new RZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:e,step:r}=t;return{signal:`sequence(${[n,e,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new RZ(t,n)}static makeFromEncoding(t,n){const e=n.encoding,r=e.x,i=e.y;if(VH(r)&&VH(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:c,keyvals:f}=o.impute,l=GG(n.mark,e);return new RZ(t,{impute:o.field,key:a.field,...u?{method:u}:{},...void 0!==s?{value:s}:{},...c?{frame:c}:{},...void 0!==f?{keyvals:f}:{},...l.length?{groupby:l}:{}})}return null}hash(){return`Impute ${sR(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:e,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...e?{keyvals:(s=e,YR(s,"stop")?this.processSequence(e):e)}:{},method:"value",...i?{groupby:i}:{},value:r&&"value"!==r?null:o};var s;return r&&"value"!==r?[u,{type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1,...i?{groupby:i}:{}},{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[u]}}class LZ extends mX{clone(){return new LZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${sR(this.transform)}`}assemble(){const{loess:t,on:n,...e}=this.transform;return{type:"loess",x:n,y:t,...e}}}class IZ extends mX{clone(){return new IZ(null,iR(this.transform),this.secondary)}constructor(t,n,e){super(t),this.transform=n,this.secondary=e}static make(t,n,e,r){const i=n.component.data.sources,{from:o}=e;let a=null;if(function(t){return YR(t,"data")}(o)){let t=n0(o.data,i);t||(t=new wQ(o.data),i.push(t));const e=n.getName(`lookup_${r}`);a=new pX(t,e,hX.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[e]=a}else if(function(t){return YR(t,"param")}(o)){const t=o.param;let r;e={as:t,...e};try{r=n.getSelectionComponent(AR(t),t)}catch(n){throw new Error(`Lookups can only be performed on selection parameters. "${t}" is a variable parameter.`)}if(a=r.materialized,!a)throw new Error(`Cannot define and lookup the "${t}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new IZ(t,e,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?K(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${sR({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:K(this.transform.as)}:{}};else{let n=this.transform.as;xt(n)||(yU('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"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class qZ extends mX{clone(){return new qZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"prob",e[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${sR(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class UZ extends mX{clone(){return new UZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=iR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${sR(this.transform)}`}assemble(){const{regression:t,on:n,...e}=this.transform;return{type:"regression",x:n,y:t,...e}}}class WZ extends mX{clone(){return new WZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=pR((this.transform.groupby??[]).concat(t),(t=>t))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${sR(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:e,limit:r,op:i}=this.transform;return{type:"pivot",field:t,value:n,...void 0!==r?{limit:r}:{},...void 0!==i?{op:i}:{},...void 0!==e?{groupby:e}:{}}}}class HZ extends mX{clone(){return new HZ(null,iR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${sR(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function GZ(t){let n=0;return function e(r,i){if(r instanceof wQ&&!r.isGenerator&&!oX(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof gQ&&(r.parent instanceof wQ&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof dQ)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof yQ||r instanceof bQ||r instanceof RQ||r instanceof eK||r instanceof vK||r instanceof jZ||r instanceof hQ||r instanceof IZ||r instanceof qQ||r instanceof jQ||r instanceof TZ||r instanceof BZ||r instanceof _Z||r instanceof LZ||r instanceof qZ||r instanceof UZ||r instanceof vQ||r instanceof HZ||r instanceof WZ||r instanceof zZ)&&i.transform.push(r.assemble()),(r instanceof lQ||r instanceof yX||r instanceof RZ||r instanceof IQ||r instanceof PZ)&&i.transform.push(...r.assemble()),r instanceof pX&&(i.source&&0===i.transform.length?r.setSource(i.source):r.parent instanceof pX?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),1===r.numChildren()&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof pX&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let o=i.name;!i.source||i.transform.length>0?t.push(i):o=i.source;for(const t of r.children)e(t,{name:null,source:o,transform:[]});break}}}}function YZ(t,n){const{facet:e,config:r,child:i,component:o}=t;if(t.channelHasField(n)){const a=e[n],u=wK("title",null,r,n);let s=dG(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});i.component.layoutHeaders[n].title&&(s=D(s)?s.join(", "):s,s+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=wK("labelOrient",a.header,r,n),f=null!==a.header&&PR(a.header?.labels,r.header.labels,!0),l=fR(["bottom","right"],c)?"footer":"header";o.layoutHeaders[n]={title:null!==a.header?s:null,facetFieldDef:a,[l]:"facet"===n?[]:[VZ(t,n,f)]}}}function VZ(t,n,e){const r="row"===n?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function XZ(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:i,resolve:o}=t.component;if(o.axis[n]=IK(o,n),"shared"===o.axis[n]){const o="x"===n?"column":"row",a=i[o];for(const i of e.component.axes[n]){const n="top"===(r=i.get("orient"))||"left"===r||gq(r)?"header":"footer";a[n]??(a[n]=[VZ(t,o,!1)]);const e=uK(i,"main",t.config,{header:!0});e&&a[n][0].axes.push(e),i.mainExtracted=!0}}}var r}function JZ(t){for(const n of t.children)n.parseLayoutSize()}function KZ(t,n){const e=jK(n),r=EI(e),i=t.component.resolve,o=t.component.layoutSize;let a;for(const n of t.children){const o=n.component.layoutSize.getWithExplicit(e),u=i.scale[r]??LK(r,t);if("independent"===u&&"step"===o.value){a=void 0;break}if(a){if("independent"===u&&a.value!==o.value){a=void 0;break}a=rX(a,o,e,"")}else a=o}if(a){for(const r of t.children)t.renameSignal(r.getName(e),t.getName(n)),r.component.layoutSize.set(e,"merged",!1);o.setWithExplicit(n,a)}else o.setWithExplicit(n,{explicit:!1,value:void 0})}function QZ(t,n){const e=t.config,r=t.getScaleComponent("width"===n?"x":"y");if(r){const t=r.get("type"),i=r.get("range");if(wW(t)){const t=PY(e.view,n);return vq(i)||OY(t)?"step":t}return BY(e.view,n)}if(t.hasProjection||"arc"===t.mark)return BY(e.view,n);{const t=PY(e.view,n);return OY(t)?t.step:t}}function ZZ(t,n,e){return sG(n,{suffix:`by_${sG(t)}`,...e})}class t0 extends OZ{constructor(t,n,e,r){super(t,"facet",n,e,r,t.resolve),this.child=M0(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!TH(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=xR(t),e={};for(const r of n){if(![VR,XR].includes(r)){yU(eU(r,"facet"));break}const n=t[r];if(void 0===n.field){yU(nU(n,r));break}e[r]=this.initFacetFieldDef(n,r)}return e}initFacetFieldDef(t,n){const e=xG(t,n);return e.header?e.header=dq(e.header):null===e.header&&(e.header=null),e}channelHasField(t){return YR(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=e0(this),this.child.parseData()}parseLayoutSize(){JZ(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(t){for(const n of LL)YZ(t,n);XZ(t,"x"),XZ(t,"y")}(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of LL)for(const e of kK){const r=this.component.layoutHeaders[n],i=r[e],{facetFieldDef:o}=r;if(o){const e=wK("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(e)){const r=bK(n,e);t.titleAnchor??(t.titleAnchor={}),t.titleAnchor[r]="end"}}if(i?.[0]){const i="header"===e?"headerBand":"footerBand";"facet"===n||this.child.component.layoutSize.get("row"===n?"height":"width")||(t[i]??(t[i]={}),t[i][n]=.5),r.title&&(t.offset??(t.offset={}),t.offset["row"===n?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,e=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(n||"independent"!==this.component.resolve.scale.x)&&(t||"independent"!==this.component.resolve.scale.y)||(r="none"),{...this.getHeaderLayoutMixins(),...e?{columns:e}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof t0))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof t0?{...this.channelHasField("column")?{encode:{update:{columns:{field:sG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],e=[];if(this.child instanceof t0){if(this.child.channelHasField("column")){const r=sG(this.child.facet.column);t.push(r),n.push("distinct"),e.push(`distinct_${r}`)}}else for(const r of AI){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(wW(o)&&vq(a)){const i=iZ(oZ(this.child,r));i?(t.push(i),n.push("distinct"),e.push(`distinct_${i}`)):yU(Uq(r))}}}return{fields:t,ops:n,as:e}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:e,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const t of LL){const n=this.facet[t];if(n){u.push(sG(n));const{bin:s,sort:c}=n;if(uq(s)&&u.push(sG(n,{binSuffix:"end"})),zH(c)){const{field:t,op:u=CH}=c,s=ZZ(n,c);e&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(t),o.push(u),a.push(s))}else if(D(c)){const e=yK(n,t);i.push(e),o.push("max"),a.push(e)}}}const s=!!e&&!!r;return{name:t,data:n,groupby:u,...s||i.length>0?{aggregate:{...s?{cross:s}:{},...i.length?{fields:i,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,e=n[t];return e?zH(e.sort)?[ZZ(e,e.sort,{expr:"datum"})]:D(e.sort)?[yK(e,t,{expr:"datum"})]:[sG(e,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,e=n[t];if(e){const{sort:t}=e;return[(zH(t)?t.order:!D(t)&&t)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return EK(t.facet,"facet",n);const e={row:["top","bottom"],column:["left","right"]};for(const r of $K)if(t[r]){const i=wK("labelOrient",t[r]?.header,n,r);if(e[r].includes(i))return EK(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=function(t){const n=[],e=GZ(n);for(const n of t.children)e(n,{source:t.name,name:null,transform:[]});return n}(this.component.data.facetRoot),e=t.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||t.assembleTitle(),i=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...r?{title:r}:{},...i?{style:i}:{},from:{facet:this.assembleFacet()},sort:{field:LL.map((t=>this.facetSortFields(t))).flat(),order:LL.map((t=>this.facetSortOrder(t))).flat()},...n.length>0?{data:n}:{},...e?{encode:{update:e}}:{},...t.assembleGroup(LX(this,[]))}]}getMapping(){return this.facet}}function n0(t,n){for(const e of n){const n=e.data;if(t.name&&e.hasName()&&t.name!==e.dataName)continue;const r=t.format?.mesh,i=n.format?.feature;if(r&&i)continue;const o=t.format?.feature;if((o||i)&&o!==i)continue;const a=n.format?.mesh;if(!r&&!a||r===a)if(aX(t)&&aX(n)){if(HR(t.values,n.values))return e}else if(oX(t)&&oX(n)){if(t.url===n.url)return e}else if(uX(t)&&t.name===e.dataName)return e}return null}function e0(t){let n=function(t,n){if(t.data||!t.parent){if(null===t.data){const t=new wQ({values:[]});return n.push(t),t}const e=n0(t.data,n);if(e)return sX(t.data)||(e.data.format=dR({},t.data.format,e.data.format)),!e.hasName()&&t.data.name&&(e.dataName=t.data.name),e;{const e=new wQ(t.data);return n.push(e),e}}return t.parent.component.data.facetRoot?t.parent.component.data.facetRoot:t.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,o=i&&(sX(i)||oX(i)||aX(i))||!t.parent?new iX:t.parent.component.data.ancestorParse.clone();sX(i)?(cX(i)?n=new bQ(n,i.sequence):lX(i)&&(n=new yQ(n,i.graticule)),o.parseNothing=!0):null===i?.format?.parse&&(o.parseNothing=!0),n=gQ.makeExplicit(n,t,o)??n,n=new vQ(n);const a=t.parent&&NZ(t.parent);(SZ(t)||FZ(t))&&a&&(n=lQ.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(t,n,e){let r=0;for(const i of n.transforms){let o,a;if(CV(i))a=t=new vK(t,i),o="derived";else if(wV(i)){const r=pQ(i);a=t=gQ.makeWithAncestors(t,{},r,e)??t,t=new eK(t,n,i.filter)}else if(OV(i))a=t=lQ.makeFromTransform(t,i,n),o="number";else if(zV(i))o="date",void 0===e.getWithExplicit(i.field).value&&(t=new gQ(t,{[i.field]:o}),e.set(i.field,o,!1)),a=t=yX.makeFromTransform(t,i);else if(BV(i))a=t=hQ.makeFromTransform(t,i),o="number",JJ(n)&&(t=new vQ(t));else if(xV(i))a=t=IZ.make(t,n,i,r++),o="derived";else if(FV(i))a=t=new qQ(t,i),o="number";else if(EV(i))a=t=new jQ(t,i),o="number";else if(TV(i))a=t=IQ.makeFromTransform(t,i),o="derived";else if(PV(i))a=t=new TZ(t,i),o="derived";else if(jV(i))a=t=new zZ(t,i),o="derived";else if(NV(i))a=t=new BZ(t,i),o="derived";else if($V(i))a=t=new WZ(t,i),o="derived";else if(SV(i))t=new HZ(t,i);else if(_V(i))a=t=RZ.makeFromTransform(t,i),o="derived";else if(kV(i))a=t=new _Z(t,i),o="derived";else if(MV(i))a=t=new qZ(t,i),o="derived";else if(AV(i))a=t=new UZ(t,i),o="derived";else{if(!DV(i)){yU(Jq(i));continue}a=t=new LZ(t,i),o="derived"}if(a&&void 0!==o)for(const t of a.producedFields()??[])e.set(t,o,!1)}return t}(n,t,o));const u=function(t){const n={};if(SZ(t)&&t.component.selection)for(const e of xR(t.component.selection)){const r=t.component.selection[e];for(const t of r.project.items)!t.channel&&TR(t.field)>1&&(n[t.field]="flatten")}return n}(t),s=function(t){const n={};function e(t){var e;MG(t)?n[t.field]="date":"quantitative"===t.type&&xt(e=t.aggregate)&&fR(["min","max"],e)?n[t.field]="number":TR(t.field)>1?t.field in n||(n[t.field]="flatten"):rG(t)&&zH(t.sort)&&TR(t.sort.field)>1&&(t.sort.field in n||(n[t.sort.field]="flatten"))}if((SZ(t)||FZ(t))&&t.forEachFieldDef(((n,r)=>{if(nG(n))e(n);else{const i=tI(r),o=t.fieldDef(i);e({...n,type:o.type})}})),SZ(t)){const{mark:e,markDef:r,encoding:i}=t;if(JW(e)&&!t.encoding.order){const t=i["horizontal"===r.orient?"y":"x"];VH(t)&&"quantitative"===t.type&&!(t.field in n)&&(n[t.field]="number")}}return n}(t);n=gQ.makeWithAncestors(n,{},{...u,...s},o)??n,SZ(t)&&(n=PZ.parseAll(n,t),n=jZ.parseAll(n,t)),(SZ(t)||FZ(t))&&(a||(n=lQ.makeFromEncoding(n,t)??n),n=yX.makeFromEncoding(n,t)??n,n=vK.parseAllForSortIndex(n,t));const c=n=r0(hX.Raw,t,n);if(SZ(t)){const e=hQ.makeFromEncoding(n,t);e&&(n=e,JJ(t)&&(n=new vQ(n))),n=RZ.makeFromEncoding(n,t)??n,n=IQ.makeFromEncoding(n,t)??n}let f,l;if(SZ(t)){const{markDef:e,mark:r,config:i}=t,o=Cq("invalid",e,i),{marks:a,scales:u}=l=dX({invalid:o,isPath:JW(r)});a!==u&&"include-invalid-values"===u&&(f=n=r0(hX.PreFilterInvalid,t,n)),"exclude-invalid-values"===a&&(n=RQ.make(n,t,l)??n)}const h=n=r0(hX.Main,t,n);let d;if(SZ(t)&&l){const{marks:e,scales:r}=l;"include-invalid-values"===e&&"exclude-invalid-values"===r&&(n=RQ.make(n,t,l)??n,d=n=r0(hX.PostFilterInvalid,t,n))}SZ(t)&&function(t,n){for(const[e,r]of kR(t.component.selection??{})){const i=t.getName(`lookup_${e}`);t.component.data.outputNodes[i]=r.materialized=new pX(new eK(n,t,{param:e}),i,hX.Lookup,t.component.data.outputNodeRefCounts)}}(t,h);let m=null;if(FZ(t)){const r=t.getName("facet");n=function(t,n){const{row:e,column:r}=n;if(e&&r){let n=null;for(const i of[e,r])if(zH(i.sort)){const{field:e,op:r=CH}=i.sort;t=n=new jQ(t,{joinaggregate:[{op:r,field:e,as:ZZ(i,i.sort,{forAs:!0})}],groupby:[sG(i)]})}return n}return null}(n,t.facet)??n,m=new dQ(n,t,r,h.getSource()),e[r]=m}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:o,preFilterInvalid:f,postFilterInvalid:d}}function r0(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,o=n.getDataName(t),a=new pX(e,o,t,i);return r[o]=a,a}class i0 extends CZ{constructor(t,n,e,r){super(t,"concat",n,e,r,t.resolve),"shared"!==t.resolve?.axis?.x&&"shared"!==t.resolve?.axis?.y||yU("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(t).map(((t,n)=>M0(t,this,this.getName(`concat_${n}`),void 0,r)))}parseData(){this.component.data=e0(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of xR(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return EY(t)?t.vconcat:NY(t)?t.hconcat:t.concat}parseLayoutSize(){!function(t){JZ(t);const n=void 0===t.layout.columns?"height":"childHeight";KZ(t,1===t.layout.columns?"width":"childWidth"),KZ(t,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.forEach((t=>t.assembleSignals())),[]}assembleLayoutSignals(){const t=zK(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleMarks(){return this.children.map((t=>{const n=t.assembleTitle(),e=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...e?{style:e}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...null!=t?{columns:t}:{},bounds:"full",align:"each"}}}const o0={disable:1,gridScale:1,scale:1,...OG,labelExpr:1,encode:1},a0=xR(o0);class u0 extends QV{constructor(t={},n={},e=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=e}clone(){return new u0(iR(this.explicit),iR(this.implicit),this.mainExtracted)}hasAxisPart(t){return!("axis"!==t&&("grid"===t||"title"===t?!this.get(t):!1===(n=this.get(t))||null===n));var n}hasOrientSignalRef(){return gq(this.explicit.orient)}}const s0={bottom:"top",top:"bottom",left:"right",right:"left"};function c0(t,n){if(!t)return n.map((t=>t.clone()));{if(t.length!==n.length)return;const e=t.length;for(let r=0;r<e;r++){const e=t[r],i=n[r];if(!!e!=!!i)return;if(e&&i){const n=e.getWithExplicit("orient"),o=i.getWithExplicit("orient");if(n.explicit&&o.explicit&&n.value!==o.value)return;t[r]=f0(e,i)}}}return t}function f0(t,n){for(const e of a0){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"axis",((t,n)=>{switch(e){case"title":return jq(t,n);case"gridScale":return{explicit:t.explicit,value:PR(t.value,n.value)}}return eX(t,n,e,"axis")}));t.setWithExplicit(e,r)}return t}function l0(t,n,e,r,i){if("disable"===n)return void 0!==e;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(gq(e.labelAngle)?e.labelAngle:qR(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===gK(r,i))return!0}return t===e[n]}const h0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function d0(t,n){let e=n.axis(t);const r=new u0,i=yG(n.encoding[t]),{mark:o,config:a}=n,u=e?.orient||a["x"===t?"axisX":"axisY"]?.orient||a.axis?.orient||function(t){return"x"===t?"bottom":"left"}(t),s=n.getScaleComponent(t).get("type"),c=function(t,n,e,r){const i="band"===n?["axisDiscrete","axisBand"]:"point"===n?["axisDiscrete","axisPoint"]:gW(n)?["axisQuantitative"]:"time"===n||"utc"===n?["axisTemporal"]:[],o="x"===t?"axisX":"axisY",a=gq(e)?"axisOrient":`axis${FR(e)}`,u=[...i,...i.map((t=>o+t.substr(4)))],s=["axis",a,o];return{vlOnlyAxisConfig:cK(u,r,t,e),vgAxisConfig:cK(s,r,t,e),axisConfigStyle:fK([...s,...u],r)}}(t,s,u,n.config),f=void 0!==e?!e:lK("disable",a.style,e?.style,c).configValue;if(r.set("disable",f,void 0!==e),f)return r;e=e||{};const l=function(t,n,e,r,i){const o=n?.labelAngle;if(void 0!==o)return gq(o)?o:qR(o);{const{configValue:o}=lK("labelAngle",r,n?.style,i);return void 0!==o?qR(o):e!==KR||!fR([rW,nW],t.type)||VH(t)&&t.timeUnit?void 0:270}}(i,e,t,a.style,c),h=DH(e.formatType,i,s),d=AH(i,i.type,e.format,e.formatType,a,!0),m={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:s,orient:u,labelAngle:l,format:d,formatType:h,mark:o,config:a};for(const i of a0){const o=i in hK?hK[i](m):zG(i)?e[i]:void 0,u=void 0!==o,s=l0(o,i,e,n,t);if(u&&s)r.set(i,o,s);else{const{configValue:t,configFrom:n}=zG(i)&&"values"!==i?lK(i,a.style,e.style,c):{},f=void 0!==t;u&&!f?r.set(i,o,s):("vgAxisConfig"!==n||h0.has(i)&&f||EG(t)||gq(t))&&r.set(i,t,!1)}}const p=e.encoding??{},g=NG.reduce(((e,i)=>{if(!r.hasAxisPart(i))return e;const o=RK(p[i]??{},n),a="labels"===i?function(t,n,e){const{encoding:r,config:i}=t,o=yG(r[n])??yG(r[eI(n)]),a=t.axis(n)||{},{format:u,formatType:s}=a;if(wH(s))return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:u,formatType:s,config:i}),...e};if(void 0===u&&void 0===s&&i.customFormatTypes){if("quantitative"===XH(o)){if(iG(o)&&"normalize"===o.stack&&i.normalizedNumberFormatType)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...e};if(i.numberFormatType)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...e}}if("temporal"===XH(o)&&i.timeFormatType&&VH(o)&&!o.timeUnit)return{text:MH({fieldOrDatumDef:o,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...e}}return e}(n,t,o):o;return void 0===a||wR(a)||(e[i]={update:a}),e}),{});return wR(g)||r.set("encode",g,!!e.encoding||void 0!==e.labelAngle),r}function m0(t,n){const{config:e}=t;return{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t),...aJ("angle",t),...p0(t,0,n)}}function p0(t,n,e){return e?{shape:{value:e}}:aJ("shape",t)}function g0(t,n,e){if(void 0===Cq("align",t,e))return"center"}function v0(t,n,e){if(void 0===Cq("baseline",t,e))return"middle"}const y0={arc:{vgMark:"arc",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...bJ(t,"radius"),...bJ(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...gJ("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===t.markDef.orient}),...gJ("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===t.markDef.orient}),...SJ(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>m0(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&VH(e)&&e.type===iW?{field:sG(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y"),...QX(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t,{vgChannel:"strokeWidth"}),...SJ(t)})},point:{vgMark:"symbol",encodeEntry:t=>m0(t)},rect:{vgMark:"rect",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,"x"),...bJ(t,"y")})},rule:{vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...gJ("x",t,{defaultPos:"horizontal"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==e}),...gJ("y",t,{defaultPos:"vertical"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==e}),...aJ("size",t,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:t=>m0(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...MJ(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...QX(t),...aJ("size",t,{vgChannel:"fontSize"}),...aJ("angle",t),...FJ("align",g0(t.markDef,0,n)),...FJ("baseline",v0(t.markDef,0,n)),...fJ("radius",t,{defaultPos:null}),...fJ("theta",t,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i="horizontal"===r?"x":"y",o="horizontal"===r?"y":"x",a="horizontal"===r?"height":"width";return{...MJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...bJ(t,i),...fJ(o,t,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:Aq(Cq("thickness",e,n))}}},trail:{vgMark:"trail",encodeEntry:t=>({...MJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...aJ("size",t),...SJ(t)})}};const b0="faceted_path_",w0="stack_group_";function x0(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:o}=t,a=PR(r.clip,function(t){const n=t.getScaleComponent("x"),e=t.getScaleComponent("y");return!(!n?.get("selectionExtent")&&!e?.get("selectionExtent"))||void 0}(t),function(t){const n=t.component.projection;return!(!n||n.isFit)||void 0}(t)),u=Nq(r),s=i.key,c=function(t){const{encoding:n,stack:e,mark:r,markDef:i,config:o}=t,a=n.order;if(!(!D(a)&&eG(a)&&cR(a.value)||!a&&cR(Cq("order",i,o)))){if((D(a)||VH(a))&&!e)return Bq(a,{expr:"datum"});if(JW(r)){const t="horizontal"===i.orient?"y":"x";if(VH(n[t]))return{field:t}}}}(t),f=function(t){if(!t.component.selection)return null;const n=xR(t.component.selection).length;let e=n,r=t.parent;for(;r&&0===e;)e=xR(r.component.selection).length,r=r.parent;return e?{interactive:n>0||"geoshape"===t.mark||!!t.encoding.tooltip||!!t.markDef.tooltip}:null}(t),l=Cq("aria",r,o),h=y0[e].postEncodingTransform?y0[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:y0[e].vgMark,...a?{clip:a}:{},...u?{style:u}:{},...s?{key:s.field}:{},...c?{sort:c}:{},...f||{},...!1===l?{aria:l}:{},from:{data:n.fromPrefix+t.requestDataName(hX.Main)},encode:{update:y0[e].encodeEntry(t)},...h?{transform:h}:{}}]}class $0 extends OZ{constructor(t,n,e,r={},i){super(t,"unit",n,e,i,void 0,_Y(t)?t.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=t=>(t.from?.data&&(t.from.data=this.lookupDataSource(t.from.data),"time"in this.encoding&&(t.from.data=t.from.data+SX)),t.from?.facet?.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t);const o=ZW(t.mark)?{...t.mark}:{type:t.mark},a=o.type;void 0===o.filled&&(o.filled=function(t,n,{graticule:e}){if(e)return!1;const r=Oq("filled",t,n),i=t.type;return PR(r,i!==IW&&i!==LW&&i!==UW)}(o,i,{graticule:t.data&&lX(t.data)}));const u=this.encoding=function(t,n,e,r){const i={};for(const n of xR(t))KL(n)||yU(`${o=n}-encoding is dropped as ${o} is not a valid encoding channel.`);var o;for(let o of uI){if(!t[o])continue;const a=t[o];if(CI(o)){const t=aI(o),n=i[t];if(VH(n)&&QU(n.type)&&VH(a)&&!n.timeUnit){yU(Qq(t));continue}}if("angle"!==o||"arc"!==n||t.theta||(yU("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=oL),UG(t,o,n)){if(o===gL&&"line"===n){const n=vG(t[o]);if(n?.aggregate){yU("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===hL&&(e?"fill"in t:"stroke"in t))yU(tU("encoding",{fill:"fill"in t,stroke:"stroke"in t}));else if(o===AL||o===ML&&!D(a)&&!eG(a)||o===SL&&D(a)){if(a){if(o===ML){const n=t[o];if(WH(n)){i[o]=n;continue}}i[o]=K(a).reduce(((t,n)=>(VH(n)?t.push(xG(n,o)):yU(nU(n,o)),t)),[])}}else{if(o===SL&&null===a)i[o]=null;else if(!(VH(a)||JH(a)||eG(a)||HH(a)||gq(a))){yU(nU(a,o));continue}i[o]=bG(a,o,r)}}else yU(eU(o,n))}return i}(t.encoding||{},a,o.filled,i);this.markDef=iV(o,u,i),this.size=function({encoding:t,size:n}){for(const e of AI){const r=rI(e);OY(n[r])&&KH(t[e])&&(delete n[r],yU(fU(r)))}return n}({encoding:u,size:_Y(t)?{...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}}:r}),this.stack=rV(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter((t=>DY(t)))}get hasProjection(){const{encoding:t}=this,n=this.mark===XW,e=t&&TL.some((n=>tG(t[n])));return n||e}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return HI.reduce(((t,e)=>{const r=yG(n[e]);return r&&(t[e]=this.initScale(r.scale??{})),t}),{})}initScale(t){const{domain:n,range:e}=t,r=dq(t);return D(n)&&(r.domain=n.map(kq)),D(e)&&(r.range=e.map(kq)),r}initAxes(t){return AI.reduce(((n,e)=>{const r=t[e];if(tG(r)||e===KR&&tG(t.x2)||e===QR&&tG(t.y2)){const t=tG(r)?r.axis:void 0;n[e]=t?this.initAxis({...t}):t}return n}),{})}initAxis(t){const n=xR(t),e={};for(const r of n){const n=t[r];e[r]=EG(n)?$q(n):kq(n)}return e}initLegends(t){return UI.reduce(((n,e)=>{const r=yG(t[e]);if(r&&function(t){switch(t){case hL:case dL:case mL:case gL:case pL:case yL:case xL:case $L:return!0;case bL:case wL:case vL:case lL:return!1}}(e)){const t=r.legend;n[e]=t?dq(t):t}return n}),{})}parseData(){this.component.data=e0(this)}parseLayoutSize(){!function(t){const{size:n,component:e}=t;for(const r of AI){const i=rI(r);if(n[i]){const t=n[i];e.layoutSize.set(i,OY(t)?"step":t,!0)}else{const n=QZ(t,i);e.layoutSize.set(i,n,!1)}}}(this)}parseSelections(){this.component.selection=function(t,n){const e={},r=t.config.selection;if(!n||!n.length)return e;let i=0;for(const o of n){const n=AR(o.name),a=o.select,u=xt(a)?a:a.type,s=S(a)?iR(a):{type:u},c=r[u];for(const t in c)"fields"!==t&&"encodings"!==t&&("mark"===t&&(s.mark={...c.mark,...s.mark}),void 0!==s[t]&&!0!==s[t]||(s[t]=iR(c[t]??s[t])));const f=e[n]={...s,name:n,type:u,init:o.value,bind:o.bind,events:xt(s.on)?iB(s.on,"scope"):K(iR(s.on))};if(QJ(f)&&(i++,i>1)){delete e[n];continue}const l=iR(o);for(const n of VJ)n.defined(f)&&n.parse&&n.parse(t,f,l)}return i>1&&yU("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),e}(this,this.selection)}parseMarkGroup(){this.component.mark=function(t){if(fR([LW,PW,GW],t.mark)){const n=GG(t.mark,t.encoding);if(n.length>0)return function(t,n){return[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:b0+t.requestDataName(hX.Main),data:t.requestDataName(hX.Main),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:x0(t,{fromPrefix:b0})}]}(t,n)}else if(t.mark===jW){const n=xq.some((n=>Cq(n,t.markDef,t.config)));if(t.stack&&!t.fieldDef("size")&&n)return function(t){const[n]=x0(t,{fromPrefix:w0}),e=t.scaleName(t.stack.fieldChannel),r=(n={})=>t.vgField(t.stack.fieldChannel,n),i=(t,n)=>`${t}(${[r({prefix:"min",suffix:"start",expr:n}),r({prefix:"max",suffix:"start",expr:n}),r({prefix:"min",suffix:"end",expr:n}),r({prefix:"max",suffix:"end",expr:n})].map((t=>`scale('${e}',${t})`)).join(",")})`;let o,a;"x"===t.stack.fieldChannel?(o={...aR(n.encode.update,["y","yc","y2","height",...xq]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...uR(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...aR(n.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...uR(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const e of xq){const r=Oq(e,t.markDef,t.config);n.encode.update[e]?(o[e]=n.encode.update[e],delete n.encode.update[e]):r&&(o[e]=Aq(r)),r&&(n.encode.update[e]={value:0})}const u=[];if(t.stack.groupbyChannels?.length>0)for(const n of t.stack.groupbyChannels){const e=t.fieldDef(n),r=sG(e);r&&u.push(r),(e?.bin||e?.timeUnit)&&u.push(sG(e,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((e,r)=>{if(n.encode.update[r])return{...e,[r]:n.encode.update[r]};{const n=Oq(r,t.markDef,t.config);return void 0!==n?{...e,[r]:Aq(n)}:e}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:t.requestDataName(hX.Main),name:w0+t.requestDataName(hX.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}(t)}return x0(t)}(this)}parseAxesAndHeaders(){var t;this.component.axes=(t=this,AI.reduce(((n,e)=>(t.component.scales[e]&&(n[e]=[d0(e,t)]),n)),{}))}assembleSelectionTopLevelSignals(t){return function(t,n){let e=!1;for(const r of $R(t.component.selection??{})){const i=r.name,o=Et(i+WJ);if(0===n.filter((t=>t.name===i)).length){const t="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${YJ}(${o}, ${Et("global"===r.resolve?"union":r.resolve)}${t}`})}e=!0;for(const e of VJ)e.defined(r)&&e.topLevelSignals&&(n=e.topLevelSignals(t,r,n))}return e&&0===n.filter((t=>"unit"===t.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),qX(n)}(this,t)}assembleSignals(){return[...sK(this),...RX(this,[])]}assembleSelectionData(t){return function(t,n){const e=[],r=[],i=XJ(t,{escape:!1});for(const o of $R(t.component.selection??{})){const a={name:o.name+WJ};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:$Y}}]),o.init){const t=o.project.items.map(PX);a.values=o.init.map(o.project.hasSelectionId?t=>({unit:i,[$Y]:jX(t,!1)[0]}):n=>({unit:i,fields:t,values:jX(n,!1)}))}if([...e,...n].filter((t=>t.name===o.name+WJ)).length||e.push(a),QJ(o)&&n.length){const e=t.lookupDataSource(t.getDataName(hX.Main)),i=n.find((t=>t.name===e)),o=i.transform.find((t=>"filter"===t.type&&t.expr.includes("vlSelectionTest")));o&&(i.transform=i.transform.filter((t=>t!==o)),r.push({name:i.name+SX,source:i.name,transform:[o]}))}}return e.concat(n,r)}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return zK(this)}assembleMarks(){let t=this.component.mark??[];return this.parent&&NZ(this.parent)||(t=IX(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return void 0!==t?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return jG(this.encoding,t)}fieldDef(t){return vG(this.encoding[t])}typedFieldDef(t){const n=this.fieldDef(t);return nG(n)?n:null}}class k0 extends CZ{constructor(t,n,e,r,i){super(t,"layer",n,e,i,t.resolve,t.view);const o={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map(((t,n)=>{if(JY(t))return new k0(t,this,this.getName(`layer_${n}`),o,i);if(TG(t))return new $0(t,this,this.getName(`layer_${n}`),o,i);throw new Error(Rq(t))}))}parseData(){this.component.data=e0(this);for(const t of this.children)t.parseData()}parseLayoutSize(){JZ(this),KZ(this,"width"),KZ(this,"height")}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of xR(t.component.selection))this.component.selection[n]=t.component.selection[n]}Object.values(this.component.selection).some((t=>QJ(t)))&&vU(Vq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){!function(t){const{axes:n,resolve:e}=t.component,r={top:0,bottom:0,right:0,left:0};for(const r of t.children){r.parseAxesAndHeaders();for(const i of xR(r.component.axes))e.axis[i]=IK(t.component.resolve,i),"shared"===e.axis[i]&&(n[i]=c0(n[i],r.component.axes[i]),n[i]||(e.axis[i]="independent",delete n[i]))}for(const i of AI){for(const o of t.children)if(o.component.axes[i]){if("independent"===e.axis[i]){n[i]=(n[i]??[]).concat(o.component.axes[i]);for(const t of o.component.axes[i]){const{value:n,explicit:e}=t.getWithExplicit("orient");if(!gq(n)){if(r[n]>0&&!e){const e=s0[n];r[n]>r[e]&&t.set("orient",e,!1)}r[n]++}}}delete o.component.axes[i]}if("independent"===e.axis[i]&&n[i]&&n[i].length>1)for(const[t,e]of(n[i]||[]).entries())t>0&&e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleSignals())),sK(this))}assembleLayoutSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleLayoutSignals())),zK(this))}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleGroupStyle(){const t=new Set;for(const n of this.children)for(const e of K(n.assembleGroupStyle()))t.add(e);const n=Array.from(t);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return function(t,n){for(const e of t.children)SZ(e)&&(n=IX(e,n));return n}(this,this.children.flatMap((t=>t.assembleMarks())))}assembleLegends(){return this.children.reduce(((t,n)=>t.concat(n.assembleLegends())),eQ(this))}}function M0(t,n,e,r,i){if(jH(t))return new t0(t,n,e,i);if(JY(t))return new k0(t,n,e,r,i);if(TG(t))return new $0(t,n,e,r,i);if(function(t){return EY(t)||NY(t)||FY(t)}(t))return new i0(t,n,e,i);throw new Error(Rq(t))}var A0=Object.freeze({__proto__:null,accessPathDepth:TR,accessPathWithDatum:ER,accessWithDatumToUnescapedPath:CR,compile:function(t,n={}){n.logger&&(gU=n.logger),n.fieldTitle&&hG(n.fieldTitle);try{const e=HY(E(n.config,t.config)),r=HV(t,e),i=M0(r,null,"",void 0,e);i.parse(),function(t,n){GQ(t.sources);let e=0,r=0;for(let r=0;r<5&&VQ(t,n,!0);r++)e++;t.sources.map(UQ);for(let e=0;e<5&&VQ(t,n,!1);e++)r++;GQ(t.sources),5===Math.max(e,r)&&yU("Maximum optimization runs(5) reached.")}(i.component.data,i);const o=function(t,n,e={},r){const i=t.config?function(t){t=iR(t);for(const n of YY)delete t[n];if(t.axis)for(const n in t.axis)EG(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of pY)delete t.legend[n];if(t.mark){for(const n of nH)delete t.mark[n];t.mark.tooltip&&S(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(SY(t.params)),delete t.params);for(const n of GY){for(const e of nH)delete t[n][e];const e=VY[n];if(e)for(const r of e)delete t[n][r];XY(t,n)}for(const n of xR(dY))delete t[n];!function(t){const{titleMarkConfig:n,subtitleMarkConfig:e,subtitle:r}=mq(t.title);wR(n)||(t.style["group-title"]={...t.style["group-title"],...n}),wR(e)||(t.style["group-subtitle"]={...t.style["group-subtitle"],...e}),wR(r)?delete t.title:t.title=r}(t);for(const n in t)S(t[n])&&wR(t[n])&&delete t[n];return wR(t)?void 0:t}(t.config):void 0,o=function(t,n){const e=[],r=GZ(e);let i=0;for(const n of t.sources){n.hasName()||(n.dataName="source_"+i++);const t=n.assemble();r(n,t)}for(const t of e)0===t.transform.length&&delete t.transform;let o=0;for(const[t,n]of e.entries())0!==(n.transform??[]).length||n.source||e.splice(o++,0,e.splice(t,1)[0]);for(const n of e)for(const e of n.transform??[])"lookup"===e.type&&(e.from=t.outputNodes[e.from].getSource());for(const t of e)t.name in n&&(t.values=n[t.name]);return e}(t.component.data,e),a=t.assembleSelectionData(o),u=t.assembleProjections(),s=t.assembleTitle(),c=t.assembleGroupStyle(),f=t.assembleGroupEncodeEntry(!0);let l=t.assembleLayoutSignals();l=l.filter((t=>"width"!==t.name&&"height"!==t.name||void 0===t.value||(n[t.name]=+t.value,!1)));const{params:h,...d}=n;return{$schema:"https://vega.github.io/schema/vega/v5.json",...t.description?{description:t.description}:{},...d,...s?{title:s}:{},...c?{style:c}:{},...f?{encode:{update:f}}:{},data:a,...u.length>0?{projections:u}:{},...t.assembleGroup([...l,...t.assembleSelectionTopLevelSignals([]),...SY(h)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}(i,function(t,n,e,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");if(void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):xt(n)&&(n={type:n}),i&&o&&["fit","fit-x","fit-y"].includes(n.type))if("step"===i&&"step"===o)yU(qq()),n.type="pad";else if("step"===i||"step"===o){const t="step"===i?"width":"height";yU(qq(EI(t))),n.type=function(t){return t?`fit-${EI(t)}`:"fit"}("width"===t?"height":"width")}return{...1===xR(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...KV(e,!1),...KV(t,!0)}}(t,r.autosize,e,i),t.datasets,t.usermeta);return{spec:o,normalized:r}}finally{n.logger&&(gU=pU),n.fieldTitle&&hG(fG)}},contains:fR,deepEqual:HR,deleteNestedProperty:SR,duplicate:iR,entries:kR,every:hR,fieldIntersection:bR,flatAccessWithDatum:NR,getFirstDefined:PR,hasIntersection:vR,hasProperty:YR,hash:sR,internalField:LR,isBoolean:MR,isEmpty:wR,isEqual:function(t,n){const e=xR(t),r=xR(n);if(e.length!==r.length)return!1;for(const r of e)if(t[r]!==n[r])return!1;return!0},isInternalField:IR,isNullOrFalse:cR,isNumeric:UR,keys:xR,logicalExpr:DR,mergeDeep:dR,never:oR,normalize:HV,normalizeAngle:qR,omit:uR,pick:aR,prefixGenerator:yR,removePathFromField:BR,replaceAll:zR,replacePathInField:_R,resetIdCounter:function(){jR=42},setEqual:gR,some:lR,stringify:GR,titleCase:FR,unique:pR,uniqueId:RR,vals:$R,varName:AR,version:"5.23.0"});function D0(t){const[n,e]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:n,version:e}}const S0="#fff",F0="#888",E0={background:"#333",view:{stroke:F0},title:{color:S0,subtitleColor:S0},style:{"guide-label":{fill:S0},"guide-title":{fill:S0}},axis:{domainColor:S0,gridColor:F0,tickColor:S0}},N0="#4572a7",C0={background:"#fff",arc:{fill:N0},area:{fill:N0},line:{stroke:N0,strokeWidth:2},path:{stroke:N0},rect:{fill:N0},shape:{stroke:N0},symbol:{fill:N0,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},O0="#30a2da",_0="#cbcbcb",z0="#f0f0f0",B0="#333",T0={arc:{fill:O0},area:{fill:O0},axis:{domainColor:_0,grid:!0,gridColor:_0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:_0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:z0,group:{fill:z0},legend:{labelColor:B0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:B0,titleFontSize:14,titlePadding:10},line:{stroke:O0,strokeWidth:2},path:{stroke:O0,strokeWidth:.5},rect:{fill:O0},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:O0},bar:{binSpacing:2,fill:O0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},P0="#000",j0={group:{fill:"#e5e5e5"},arc:{fill:P0},area:{fill:P0},line:{stroke:P0},path:{stroke:P0},rect:{fill:P0},shape:{stroke:P0},symbol:{fill:P0,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},R0="Benton Gothic, sans-serif",L0="#82c6df",I0="Benton Gothic Bold, sans-serif",q0="normal",U0={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},W0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:I0,fontSize:22,fontWeight:"normal"},arc:{fill:L0},area:{fill:L0},line:{stroke:L0,strokeWidth:2},path:{stroke:L0},rect:{fill:L0},shape:{stroke:L0},symbol:{fill:L0,size:30},axis:{labelFont:R0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:I0,titleFontSize:13,titleFontWeight:q0},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:R0,labelFontSize:11.5,symbolType:"square",titleFont:I0,titleFontSize:13,titleFontWeight:q0},range:{category:U0["category-6"],diverging:U0["fireandice-6"],heatmap:U0["fire-7"],ordinal:U0["fire-7"],ramp:U0["fire-7"]}},H0="#ab5787",G0="#979797",Y0={background:"#f9f9f9",arc:{fill:H0},area:{fill:H0},line:{stroke:H0},path:{stroke:H0},rect:{fill:H0},shape:{stroke:H0},symbol:{fill:H0,size:30},axis:{domainColor:G0,domainWidth:.5,gridWidth:.2,labelColor:G0,tickColor:G0,tickWidth:.2,titleColor:G0},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},V0="#3e5c69",X0={background:"#fff",arc:{fill:V0},area:{fill:V0},line:{stroke:V0},path:{stroke:V0},rect:{fill:V0},shape:{stroke:V0},symbol:{fill:V0},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},J0="#1696d2",K0="#000000",Q0="Lato",Z0="Lato",t1={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},n1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:Q0},axisX:{domain:!0,domainColor:K0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:Z0,labelAngle:0,tickColor:K0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Q0},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:Z0,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Q0,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:Z0,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Q0,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:t1["six-groups-cat-1"],diverging:t1["diverging-colors"],heatmap:t1["diverging-colors"],ordinal:t1["six-groups-seq"],ramp:t1["shades-blue"]},area:{fill:J0},rect:{fill:J0},line:{color:J0,stroke:J0,strokeWidth:5},trail:{color:J0,stroke:J0,strokeWidth:0,size:1},path:{stroke:J0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:J0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:J0,stroke:null}},arc:{fill:J0},shape:{stroke:J0},symbol:{fill:J0,size:30}},e1="#3366CC",r1="#ccc",i1="Arial, sans-serif",o1={arc:{fill:e1},area:{fill:e1},path:{stroke:e1},rect:{fill:e1},shape:{stroke:e1},symbol:{stroke:e1},circle:{fill:e1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:i1,fontSize:12},"guide-title":{font:i1,fontSize:12},"group-title":{font:i1,fontSize:12}},title:{font:i1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:r1,tickColor:r1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},a1=t=>t*(1/3+1),u1=a1(9),s1=a1(10),c1=a1(12),f1="Segoe UI",l1="wf_standard-font, helvetica, arial, sans-serif",h1="#252423",d1="#605E5C",m1="transparent",p1="#118DFF",g1="#DEEFFF",v1=[g1,p1],y1={view:{stroke:m1},background:m1,font:f1,header:{titleFont:l1,titleFontSize:c1,titleColor:h1,labelFont:f1,labelFontSize:s1,labelColor:d1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:d1,labelFontSize:u1,titleFont:l1,titleColor:h1,titleFontSize:c1,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:p1},line:{stroke:p1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:f1,fontSize:u1,fill:d1},arc:{fill:p1},area:{fill:p1,line:!0,opacity:.6},path:{stroke:p1},rect:{fill:p1},point:{fill:p1,filled:!0,size:75},shape:{stroke:p1},symbol:{fill:p1,strokeWidth:1.5,size:50},legend:{titleFont:f1,titleFontWeight:"bold",titleColor:d1,labelFont:f1,labelFontSize:s1,labelColor:d1,symbolType:"circle",symbolSize:75},range:{category:[p1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:v1,heatmap:v1,ordinal:[g1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",p1]}},b1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',w1={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},x1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],$1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function k1({theme:t,background:n}){const e=["white","g10"].includes(t)?"light":"dark",r=w1.gridBg[t],i=w1.textPrimary[t],o=w1.textSecondary[t],a="dark"===e?"#d4bbff":"#6929c4";return{background:n,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:b1,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:w1.layerAccent01[t],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:b1,fill:o,fontWeight:400},"guide-title":{font:b1,fill:o,fontWeight:400}},range:{category:"dark"===e?x1:$1,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const M1=k1({theme:"white",background:"#ffffff"}),A1=k1({theme:"g10",background:"#f4f4f4"}),D1=k1({theme:"g90",background:"#262626"}),S1=k1({theme:"g100",background:"#161616"});var F1=Object.freeze({__proto__:null,carbong10:A1,carbong100:S1,carbong90:D1,carbonwhite:M1,dark:E0,excel:C0,fivethirtyeight:T0,ggplot2:j0,googlecharts:o1,latimes:W0,powerbi:y1,quartz:Y0,urbaninstitute:n1,version:"2.15.0",vox:X0});function E1(t,n){return JSON.stringify(t,function(t){const n=[];return function(e,r){if("object"!=typeof r||null===r)return r;const i=n.indexOf(this)+1;return n.length=i,n.length>t?"[Object]":n.indexOf(r)>=0?"[Circular]":(n.push(r),r)}}(n))}const N1="vg-tooltip-element",C1={offsetX:10,offsetY:10,id:N1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(t,n,e,r){if(D(t))return`[${t.map((t=>n(xt(t)?t:E1(t,e)))).join(", ")}]`;if(S(t)){let i="";const{title:o,image:a,...u}=t;o&&(i+=`<h2>${n(o)}</h2>`),a&&(i+=`<img src="${new URL(n(a),r||location.href).href}">`);const s=Object.keys(u);if(s.length>0){i+="<table>";for(const t of s){let r=u[t];void 0!==r&&(S(r)&&(r=E1(r,e)),i+=`<tr><td class="key">${n(t)}</td><td class="value">${n(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return n(t)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function O1(t,n,{offsetX:e,offsetY:r}){const i=_1({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},n,e,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const t of o)if(z1(i[t],n))return i[t];return i["top-left"]}function _1(t,n,e,r){const i=t.x1-n.width-e,o=(t.x1+t.x2)/2-n.width/2,a=t.x2+e,u=t.y1-n.height-r,s=(t.y1+t.y2)/2-n.height/2,c=t.y2+r;return{top:{x:o,y:u},bottom:{x:o,y:c},left:{x:i,y:s},right:{x:a,y:s},"top-left":{x:i,y:u},"top-right":{x:a,y:u},"bottom-left":{x:i,y:c},"bottom-right":{x:a,y:c}}}function z1(t,n){return t.x>=0&&t.y>=0&&t.x+n.width<=window.innerWidth&&t.y+n.height<=window.innerHeight}function B1(t,n,e){return t.clientX>=n.x&&t.clientX<=n.x+e.width&&t.clientY>=n.y&&t.clientY<=n.y+e.height}class T1{constructor(t){this.options={...C1,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=function(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n".toString().replace(N1,t)}(n);const e=document.head;e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}}tooltipHandler(t,n,e,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}="mark"===this.options.anchor?function(t,n,e,r,i){const{position:o,offsetX:a,offsetY:u}=i,s=function(t,n,e){const r=e.isVoronoi?e.datum.bounds:e.bounds;let i=t.left+n[0]+r.x1,o=t.top+n[1]+r.y1,a=e;for(;a.mark.group;)a=a.mark.group,i+=a.x??0,o+=a.y??0;return{x1:i,x2:i+(r.x2-r.x1),y1:o,y2:o+(r.y2-r.y1)}}(t._el.getBoundingClientRect(),t._origin,e),c=_1(s,r,a,u),f=Array.isArray(o)?o:[o];for(const t of f)if(z1(c[t],r)&&!B1(n,c[t],r))return c[t];return O1(n,r,i)}(t,n,e,this.el.getBoundingClientRect(),this.options):O1(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}
2
2
  /*!
3
3
  * https://github.com/Starcounter-Jack/JSON-Patch
4
4
  * (c) 2017-2022 Joachim Wester