You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
472 KiB
1 lines
472 KiB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).vega={})}(this,(function(t){"use strict";function e(t,e,n){return t.fields=e||[],t.fname=n,t}function n(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){throw Error(t)}function a(t){var e,n,r,a=[],u=null,o=0,s=t.length,l="";function c(){a.push(l+t.substring(e,n)),l="",e=n+1}for(t+="",e=n=0;n<s;++n)if("\\"===(r=t[n]))l+=t.substring(e,n),l+=t.substring(++n,++n),e=n;else if(r===u)c(),u=null,o=-1;else{if(u)continue;e===o&&'"'===r||e===o&&"'"===r?(e=n+1,u=r):"."!==r||o?"["===r?(n>e&&c(),o=e=n+1):"]"===r&&(o||i("Access path missing open bracket: "+t),o>0&&c(),o=0,e=n+1):n>e?c():e=n+1}return o&&i("Access path missing closing bracket: "+t),u&&i("Access path missing closing quote: "+t),n>e&&(n++,c()),a}var u=Array.isArray;function o(t){return t===Object(t)}function s(t){return"string"==typeof t}function l(t){return u(t)?"["+t.map(l)+"]":o(t)||s(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function c(t,n){var r=a(t),i="return _["+r.map(l).join("][")+"];";return e(Function("_",i),[t=1===r.length?r[0]:t],n||t)}var f=[],h=c("id"),d=e((function(t){return t}),f,"identity"),p=e((function(){return 0}),f,"zero"),g=e((function(){return 1}),f,"one"),m=e((function(){return!0}),f,"true"),v=e((function(){return!1}),f,"false");function y(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}function _(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&y(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&y(e||"warn","WARN",arguments),this},info:function(){return n>=3&&y(e||"log","INFO",arguments),this},debug:function(){return n>=4&&y(e||"log","DEBUG",arguments),this}}}const x=t=>"__proto__"!==t;function b(...t){return t.reduce((t,e)=>{for(var n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;w(t,n,e[n],r)}return t},{})}function w(t,e,n,r){var i,a;if(x(e))if(o(n)&&!u(n))for(i in a=o(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?w(a,i,n[i]):x(i)&&(a[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function k(t){return t[t.length-1]}function M(t){return null==t||""===t?null:+t}function E(t){return function(e){return t*Math.exp(e)}}function D(t){return function(e){return Math.log(t*e)}}function C(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function F(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function S(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function B(t,e,n,r){var i=n(t[0]),a=n(k(t)),u=(a-i)*e;return[r(i-u),r(a-u)]}function z(t,e){return B(t,e,M,d)}function T(t,e){var n=Math.sign(t[0]);return B(t,e,D(n),E(n))}function N(t,e,n){return B(t,e,S(n),S(1/n))}function O(t,e,n){return B(t,e,C(n),F(n))}function R(t,e,n,r,i){var a=r(t[0]),u=r(k(t)),o=null!=e?r(e):(a+u)/2;return[i(o+(a-o)*n),i(o+(u-o)*n)]}function q(t,e,n){return R(t,e,n,M,d)}function U(t,e,n){var r=Math.sign(t[0]);return R(t,e,n,D(r),E(r))}function L(t,e,n,r){return R(t,e,n,S(r),S(1/r))}function P(t,e,n,r){return R(t,e,n,C(r),F(r))}function $(t){return 1+~~(new Date(t).getMonth()/3)}function j(t){return 1+~~(new Date(t).getUTCMonth()/3)}function I(t){return null!=t?u(t)?t:[t]:[]}function H(t,e,n){var r,i=t[0],a=t[1];return a<i&&(r=a,a=i,i=r),(r=a-i)>=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function W(t){return"function"==typeof t}function Y(t,n){var i,u,o,s,c,f,h,d,p,g=[],m=(t=I(t)).map((function(t,e){return null==t?null:(g.push(e),W(t)?t:a(t).map(l).join("]["))})),v=g.length-1,y=I(n),_="var u,v;return ";if(v<0)return null;for(u=0;u<=v;++u)W(o=m[i=g[u]])?(s="(u=this."+(f="f"+i)+"(a))",c="(v=this."+f+"(b))",(h=h||{})[f]=o):(s="(u=a["+o+"])",c="(v=b["+o+"])"),f="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==y[i]?(p=1,d=-1):(p=-1,d=1),_+="("+s+"<"+c+"||u==null)&&v!=null?"+d+":(u>v||v==null)&&u!=null?"+p+":"+f+"!==u&&v===v?"+d+":v!==v&&u===u?"+p+(i<v?":":":0");return o=Function("a","b",_+";"),h&&(o=o.bind(h)),t=t.reduce((function(t,e){return W(e)?(r(e)||[]).forEach((function(e){t[e]=1})):null!=e&&(t[e+""]=1),t}),{}),e(o,Object.keys(t))}function V(t){return W(t)?t:function(){return t}}function G(t,e){var n,r;function i(){e(r),n=r=null}return function(e){r=e,n&&clearTimeout(n),n=setTimeout(i,t)}}function X(t){for(var e,n,r=1,i=arguments.length;r<i;++r)for(n in e=arguments[r])t[n]=e[n];return t}function J(t,e){var n,r,i,a,u=0;if(t&&(n=t.length))if(null==e){for(r=t[u];u<n&&(null==r||r!=r);r=t[++u]);for(i=a=r;u<n;++u)null!=(r=t[u])&&(r<i&&(i=r),r>a&&(a=r))}else{for(r=e(t[u]);u<n&&(null==r||r!=r);r=e(t[++u]));for(i=a=r;u<n;++u)null!=(r=e(t[u]))&&(r<i&&(i=r),r>a&&(a=r))}return[i,a]}function Z(t,e){var n,r,i,a,u,o=-1,s=t.length;if(null==e){for(;++o<s;)if(null!=(r=t[o])&&r>=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++o<s;)null!=(r=t[o])&&(n>r&&(n=r,a=o),i<r&&(i=r,u=o))}else{for(;++o<s;)if(null!=(r=e(t[o],o,t))&&r>=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++o<s;)null!=(r=e(t[o],o,t))&&(n>r&&(n=r,a=o),i<r&&(i=r,u=o))}return[a,u]}const Q=Object.prototype.hasOwnProperty;function K(t,e){return Q.call(t,e)}var tt={};function et(t){var e,n,r={};function i(t){return K(r,t)&&r[t]!==tt}return e={size:0,empty:0,object:r,has:i,get:function(t){return i(t)?r[t]:void 0},set:function(t,n){return i(t)||(++e.size,r[t]===tt&&--e.empty),r[t]=n,this},delete:function(t){return i(t)&&(--e.size,++e.empty,r[t]=tt),this},clear:function(){e.size=e.empty=0,e.object=r={}},test:function(t){return arguments.length?(n=t,e):n},clean:function(){var t,i,a={},u=0;for(t in r)(i=r[t])===tt||n&&n(i)||(a[t]=i,++u);e.size=u,e.empty=0,e.object=r=a}},t&&Object.keys(t).forEach((function(n){e.set(n,t[n])})),e}function nt(t,e,n,r,i,a){if(!n&&0!==n)return a;var u,o,s=t[0],l=k(t),c=+n;return l<s&&(u=s,s=l,l=u),(u=Math.abs(e-s))<(o=Math.abs(l-e))&&u<=c?r:o<=c?i:a}function rt(t,e){var n=t.prototype=Object.create(e.prototype);return n.constructor=t,n}function it(t,e,n,r){var i,a=e[0],u=e[e.length-1];return a>u&&(i=a,a=u,u=i),r=void 0===r||r,((n=void 0===n||n)?a<=t:a<t)&&(r?t<=u:t<u)}function at(t){return"boolean"==typeof t}function ut(t){return"[object Date]"===Object.prototype.toString.call(t)}function ot(t){return"number"==typeof t}function st(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function lt(t,n){return t&&(t=n?I(t).map((function(t){return t.replace(/\\(.)/g,"$1")})):I(t)),e(t&&t.length?Function("_","return ''+"+t.map((function(t){return"_["+(n?l(t):a(t).map(l).join("]["))+"]"})).join("+'|'+")+";"):function(){return""},t,"key")}function ct(t,e){const n=t[0],r=k(t),i=+e;return i?1===i?r:n+i*(r-n):n}function ft(t){let e,n,r;t=+t||1e4;const i=()=>{e={},n={},r=0},a=(i,a)=>(++r>t&&(n=e,e={},r=1),e[i]=a);return i(),{clear:i,has:t=>K(e,t)||K(n,t),get:t=>K(e,t)?e[t]:K(n,t)?a(t,n[t]):void 0,set:(t,n)=>K(e,t)?e[t]=n:a(t,n)}}function ht(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var u=r||new e.constructor(i+a),o=0,s=0,l=0;o<i&&s<a;++l)u[l]=t(e[o],n[s])>0?n[s++]:e[o++];for(;o<i;++o,++l)u[l]=e[o];for(;s<a;++s,++l)u[l]=n[s];return u}function dt(t,e){for(var n="";--e>=0;)n+=t;return n}function pt(t,e,n,r){var i=n||" ",a=t+"",u=e-a.length;return u<=0?a:"left"===r?dt(i,u)+a:"center"===r?dt(i,~~(u/2))+a+dt(i,Math.ceil(u/2)):a+dt(i,u)}function gt(t){return t&&k(t)-t[0]||0}function mt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function vt(t){return ot(t)||ut(t)?t:Date.parse(t)}function yt(t,e){return e=e||vt,null==t||""===t?null:e(t)}function _t(t){return null==t||""===t?null:t+""}function xt(t){for(var e={},n=0,r=t.length;n<r;++n)e[t[n]]=!0;return e}function bt(t,e,n,r){var i=null!=r?r:"…",a=t+"",u=a.length,o=Math.max(0,e-i.length);return u<=e?a:"left"===n?i+a.slice(u-o):"center"===n?a.slice(0,Math.ceil(o/2))+i+a.slice(u-~~(o/2)):a.slice(0,o)+i}function wt(t,e,n){if(t){var r,i=0,a=t.length;if(e)for(;i<a;++i)(r=e(t[i]))&&n(r,i,t);else t.forEach(n)}}function At(t){var e=t||d,n=[],r={};return n.add=function(t){var i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=function(t){var i,a=e(t);return r[a]&&(r[a]=0,(i=n.indexOf(t))>=0&&n.splice(i,1)),n},n}async function kt(t,e){try{await e(t)}catch(e){t.error(e)}}var Mt=Symbol("vega_id"),Et=1;function Dt(t){return!(!t||!Ct(t))}function Ct(t){return t[Mt]}function Ft(t,e){return t[Mt]=e,t}function St(t){var e=t===Object(t)?t:{data:t};return Ct(e)?e:Ft(e,Et++)}function Bt(t){return zt(t,St({}))}function zt(t,e){for(var n in t)e[n]=t[n];return e}function Tt(t,e){return Ft(e,Ct(t))}function Nt(t,e){return t?e?(n,r)=>t(n,r)||Ct(e(n))-Ct(e(r)):(e,n)=>t(e,n)||Ct(e)-Ct(n):null}function Ot(t){return t&&t.constructor===Rt}function Rt(){var t=[],e=[],n=[],r=[],i=[],a=!1;return{constructor:Rt,insert:function(e){for(var n=I(e),r=0,i=n.length;r<i;++r)t.push(n[r]);return this},remove:function(t){for(var n=W(t)?r:e,i=I(t),a=0,u=i.length;a<u;++a)n.push(i[a]);return this},modify:function(t,e,r){var a={field:e,value:V(r)};return W(t)?(a.filter=t,i.push(a)):(a.tuple=t,n.push(a)),this},encode:function(t,e){return W(t)?i.push({filter:t,field:e}):n.push({tuple:t,field:e}),this},reflow:function(){return a=!0,this},pulse:function(u,o){var s,l,c,f,h,d,p={},g={};for(s=0,l=o.length;s<l;++s)p[Ct(o[s])]=1;for(s=0,l=e.length;s<l;++s)p[Ct(h=e[s])]=-1;for(s=0,l=r.length;s<l;++s)f=r[s],o.forEach((function(t){f(t)&&(p[Ct(t)]=-1)}));for(s=0,l=t.length;s<l;++s)d=Ct(h=t[s]),p[d]?p[d]=1:u.add.push(St(t[s]));for(s=0,l=o.length;s<l;++s)h=o[s],p[Ct(h)]<0&&u.rem.push(h);function m(t,e,n){n?t[e]=n(t):u.encode=e,a||(g[Ct(t)]=t)}for(s=0,l=n.length;s<l;++s)h=(c=n[s]).tuple,f=c.field,(d=p[Ct(h)])>0&&(m(h,f,c.value),u.modifies(f));for(s=0,l=i.length;s<l;++s)c=i[s],f=c.filter,o.forEach((function(t){f(t)&&p[Ct(t)]>0&&m(t,c.field,c.value)})),u.modifies(c.field);if(a)u.mod=e.length||r.length?o.filter((function(t){return p[Ct(t)]>0})):o.slice();else for(d in g)u.mod.push(g[d]);return u}}}var qt="_:mod:_";function Ut(){Object.defineProperty(this,qt,{writable:!0,value:{}})}var Lt=Ut.prototype;Lt.set=function(t,e,n,r){var i=this,a=i[t],o=i[qt];return null!=e&&e>=0?(a[e]!==n||r)&&(a[e]=n,o[e+":"+t]=-1,o[t]=-1):(a!==n||r)&&(i[t]=n,o[t]=u(n)?1+n.length:-1),i},Lt.modified=function(t,e){var n,r=this[qt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(u(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return null!=e&&e>=0?e+1<r[t]||!!r[e+":"+t]:!!r[t]},Lt.clear=function(){return this[qt]={},this};var Pt=0,$t=new Ut;function jt(t,e,n,r){this.id=++Pt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}var It=jt.prototype;function Ht(t){return function(e){var n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}It.targets=function(){return this._targets||(this._targets=At(h))},It.set=function(t){return this.value!==t?(this.value=t,1):0},It.skip=Ht(1),It.modified=Ht(2),It.parameters=function(t,e,n){e=!1!==e;var r,a,o,s,l=this,c=l._argval=l._argval||new Ut,f=l._argops=l._argops||[],h=[];function d(t,n,r){r instanceof jt?(r!==l&&(e&&r.targets().add(l),h.push(r)),f.push({op:r,name:t,index:n})):c.set(t,n,r)}for(r in t)if(a=t[r],"pulse"===r)I(a).forEach((function(t){t instanceof jt?t!==l&&(t.targets().add(l),h.push(t)):i("Pulse parameters must be operator instances.")})),l.source=a;else if(u(a))for(c.set(r,-1,Array(o=a.length)),s=0;s<o;++s)d(r,s,a[s]);else d(r,-1,a);return this.marshall().clear(),n&&(f.initonly=!0),h},It.marshall=function(t){var e,n,r,i,a,u=this._argval||$t,o=this._argops;if(o){for(n=0,r=o.length;n<r;++n)a=(i=(e=o[n]).op).modified()&&i.stamp===t,u.set(e.name,e.index,i.value,a);if(o.initonly){for(n=0;n<r;++n)(e=o[n]).op.targets().remove(this);this._argops=null,this._update=null}}return u},It.evaluate=function(t){var e=this._update;if(e){var n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},It.run=function(t){return t.stamp<this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.pulse=e||t);var e};var Wt=0;function Yt(t,e,n){this.id=++Wt,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function Vt(t,e,n){return new Yt(t,e,n)}var Gt=Yt.prototype;Gt._filter=m,Gt._apply=d,Gt.targets=function(){return this._targets||(this._targets=At(h))},Gt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},Gt.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),n=this._targets,r=n?n.length:0,i=0;i<r;++i)n[i].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},Gt.filter=function(t){var e=Vt(t);return this.targets().add(e),e},Gt.apply=function(t){var e=Vt(null,t);return this.targets().add(e),e},Gt.merge=function(){var t=Vt();this.targets().add(t);for(var e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},Gt.throttle=function(t){var e=-1;return this.filter((function(){var n=Date.now();return n-e>t?(e=n,1):0}))},Gt.debounce=function(t){var e=Vt();return this.targets().add(Vt(null,null,G(t,(function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},Gt.between=function(t,e){var n=!1;return t.targets().add(Vt(null,null,(function(){n=!0}))),e.targets().add(Vt(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const Xt=/^([A-Za-z]+:)?\/\//,Jt=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Zt=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Qt(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function Kt(t,e){e=X({},this.options,e);const n=this.fileAccess,r={href:null};let a,u,o;const s=Jt.test(t.replace(Zt,""));null!=t&&"string"==typeof t&&s||i("Sanitize failure, invalid URI: "+l(t));const c=Xt.test(t);return(o=e.baseURL)&&!c&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),u=(a=t.startsWith("file://"))||"file"===e.mode||"http"!==e.mode&&!c&&n,a?t=t.slice("file://".length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),u=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!u}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function te(t){return t?function(e){return new Promise((function(n,r){t.readFile(e,(function(t,e){t?r(t):n(e)}))}))}:ee}async function ee(){i("No file system access.")}function ne(t){return t?async function(e,n){const r=X({},this.options.http,n),a=n&&n.response,u=await t(e,r);return u.ok?W(u[a])?u[a]():u.text():i(u.status+""+u.statusText)}:re}async function re(){i("No HTTP fetch method available.")}var ie={boolean:mt,integer:M,number:M,date:yt,string:_t,unknown:d},ae=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return le(t)&&Number.isInteger(+t)},le,function(t){return!Number.isNaN(Date.parse(t))}],ue=["boolean","integer","number","date"];function oe(t,e){if(!t||!t.length)return"unknown";var n,r,i,a,u=0,o=t.length,s=ae.length,l=ae.map((function(t,e){return e+1}));for(r=0,o=t.length;r<o;++r)for(n=e?t[r][e]:t[r],i=0;i<s;++i)if(l[i]&&(null!=(a=n)&&a==a)&&!ae[i](n)&&(l[i]=0,++u===ae.length))return"string";return u=l.reduce((function(t,e){return 0===t?e:t}),0)-1,ue[u]}function se(t,e){return e.reduce((function(e,n){return e[n]=oe(t,n),e}),{})}function le(t){return!(Number.isNaN(+t)||t instanceof Date)}var ce={},fe={};function he(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function de(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function pe(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function ge(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+pe(-t,6):t>9999?"+"+pe(t,6):pe(t,4)}(t.getUTCFullYear())+"-"+pe(t.getUTCMonth()+1,2)+"-"+pe(t.getUTCDate(),2)+(i?"T"+pe(e,2)+":"+pe(n,2)+":"+pe(r,2)+"."+pe(i,3)+"Z":r?"T"+pe(e,2)+":"+pe(n,2)+":"+pe(r,2)+"Z":n||e?"T"+pe(e,2)+":"+pe(n,2)+"Z":"")}function me(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,u=0,o=0,s=a<=0,l=!1;function c(){if(s)return fe;if(l)return l=!1,ce;var e,r,i=u;if(34===t.charCodeAt(i)){for(;u++<a&&34!==t.charCodeAt(u)||34===t.charCodeAt(++u););return(e=u)>=a?s=!0:10===(r=t.charCodeAt(u++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(u)&&++u),t.slice(i+1,e-1).replace(/""/g,'"')}for(;u<a;){if(10===(r=t.charCodeAt(e=u++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(u)&&++u;else if(r!==n)continue;return t.slice(i,e)}return s=!0,t.slice(i,a)}for(10===t.charCodeAt(a-1)&&--a,13===t.charCodeAt(a-1)&&--a;(r=c())!==fe;){for(var f=[];r!==ce&&r!==fe;)f.push(r),r=c();e&&null==(f=e(f,o++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return u(e[t])})).join(t)}))}function a(e){return e.map(u).join(t)}function u(t){return null==t?"":t instanceof Date?ge(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,a=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=he(t);return function(r,i){return e(n(r),i,t)}}(t,e):he(t)}));return a.columns=i||[],a},parseRows:r,format:function(e,n){return null==n&&(n=de(e)),[n.map(u).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=de(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(a).join("\n")},formatRow:a,formatValue:u}}function ve(t){const e=function(e,n){const r={delimiter:t};return ye(e,n?X(n,r):r)};return e.responseType="text",e}function ye(t,e){return e.header&&(t=e.header.map(l).join(e.delimiter)+"\n"+t),me(e.delimiter).parse(t+"")}function _e(t,e){const n=e&&e.property?c(e.property):d;return!o(t)||(r=t,"function"==typeof Buffer&&W(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t));var r}function xe(t){return t}function be(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return we(t,e)}))}:we(t,e)}function we(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,a=Ae(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:n,properties:i,geometry:a}:{type:"Feature",id:n,bbox:r,properties:i,geometry:a}}function Ae(t,e){var n=function(t){if(null==t)return xe;var e,n,r=t.scale[0],i=t.scale[1],a=t.translate[0],u=t.translate[1];return function(t,o){o||(e=n=0);var s=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+a,c[1]=(n+=t[1])*i+u;s<l;)c[s]=t[s],++s;return c}}(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],a=0,u=i.length;a<u;++a)e.push(n(i[a],a));t<0&&function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}(e,u)}function a(t){return n(t)}function u(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function o(t){for(var e=u(t);e.length<4;)e.push(e[0]);return e}function s(t){return t.map(o)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=a(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(a);break;case"LineString":n=u(e.arcs);break;case"MultiLineString":n=e.arcs.map(u);break;case"Polygon":n=s(e.arcs);break;case"MultiPolygon":n=e.arcs.map(s);break;default:return null}return{type:r,coordinates:n}}(e)}function ke(t,e){var n={},r={},i={},a=[],u=-1;function o(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){n[t<0?~t:t]=1})),a.push(i)}}return e.forEach((function(n,r){var i,a=t.arcs[n<0?~n:n];a.length<3&&!a[1][0]&&!a[1][1]&&(i=e[++u],e[u]=n,e[r]=i)})),e.forEach((function(e){var n,a,u=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];t.transform?(n=[0,0],r.forEach((function(t){n[0]+=t[0],n[1]+=t[1]}))):n=r[r.length-1];return e<0?[n,i]:[i,n]}(e),o=u[0],s=u[1];if(n=i[o])if(delete i[n.end],n.push(e),n.end=s,a=r[s]){delete r[a.start];var l=a===n?n:n.concat(a);r[l.start=n.start]=i[l.end=a.end]=l}else r[n.start]=i[n.end]=n;else if(n=r[s])if(delete r[n.start],n.unshift(e),n.start=o,a=i[o]){delete i[a.end];var c=a===n?n:a.concat(n);r[c.start=a.start]=i[c.end=n.end]=c}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=o]=i[n.end=s]=n})),o(i,r),o(r,i),e.forEach((function(t){n[t<0?~t:t]||a.push([t])})),a}function Me(t){return Ae(t,Ee.apply(this,arguments))}function Ee(t,e,n){var r,i,a;if(arguments.length>1)r=De(t,e,n);else for(i=0,r=new Array(a=t.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:ke(t,r)}}function De(t,e,n){var r,i=[],a=[];function u(t){var e=t<0?~t:t;(a[e]||(a[e]=[])).push({i:t,g:r})}function o(t){t.forEach(u)}function s(t){t.forEach(o)}return function t(e){switch(r=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":o(e.arcs);break;case"MultiLineString":case"Polygon":s(e.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(e.arcs)}}(e),a.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}ye.responseType="text",_e.responseType="json";const Ce={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function Fe(t,e){let n,r,a,u;return t=_e(t,e),e&&e.feature?(n=be,a=e.feature):e&&e.mesh?(n=Me,a=e.mesh,u=Ce[e.filter]):i("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[a])?n(t,r,u):i("Invalid TopoJSON object: "+a),r&&r.features||[r]}Fe.responseType="json";const Se={dsv:ye,csv:ve(","),tsv:ve("\t"),json:_e,topojson:Fe};function Be(t,e){return arguments.length>1?(Se[t]=e,this):K(Se,t)?Se[t]:null}function ze(t){const e=Be(t);return e&&e.responseType||"text"}var Te=new Date,Ne=new Date;function Oe(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,a){var u,o=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return o;do{o.push(u=new Date(+n)),e(n,a),t(n)}while(u<n&&n<r);return o},i.filter=function(n){return Oe((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Te.setTime(+e),Ne.setTime(+r),t(Te),t(Ne),Math.floor(n(Te,Ne))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Re=Oe((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Re.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Oe((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Re:null};var qe=Oe((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),Ue=Oe((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),Le=Oe((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),Pe=Oe((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}));function $e(t){return Oe((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var je=$e(0),Ie=$e(1),He=($e(2),$e(3),$e(4)),We=($e(5),$e(6),Oe((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),Ye=Oe((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Ye.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Oe((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var Ve=Oe((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),Ge=Oe((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),Xe=Oe((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}));function Je(t){return Oe((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Ze=Je(0),Qe=Je(1),Ke=(Je(2),Je(3),Je(4)),tn=(Je(5),Je(6),Oe((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),en=Oe((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function rn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function an(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}en.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Oe((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var un,on,sn,ln,cn,fn={"-":"",_:" ",0:"0"},hn=/^\s*\d+/,dn=/^%/,pn=/[\\^$*+?|[\]().{}]/g;function gn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function mn(t){return t.replace(pn,"\\$&")}function vn(t){return new RegExp("^(?:"+t.map(mn).join("|")+")","i")}function yn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function _n(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function xn(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function bn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function wn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function An(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function kn(t,e,n){var r=hn.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Mn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function En(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Dn(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Cn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Fn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Sn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Bn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Tn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Nn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function On(t,e,n){var r=hn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Rn(t,e,n){var r=dn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function qn(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Un(t,e,n){var r=hn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ln(t,e){return gn(t.getDate(),e,2)}function Pn(t,e){return gn(t.getHours(),e,2)}function $n(t,e){return gn(t.getHours()%12||12,e,2)}function jn(t,e){return gn(1+Pe.count(Ye(t),t),e,3)}function In(t,e){return gn(t.getMilliseconds(),e,3)}function Hn(t,e){return In(t,e)+"000"}function Wn(t,e){return gn(t.getMonth()+1,e,2)}function Yn(t,e){return gn(t.getMinutes(),e,2)}function Vn(t,e){return gn(t.getSeconds(),e,2)}function Gn(t){var e=t.getDay();return 0===e?7:e}function Xn(t,e){return gn(je.count(Ye(t)-1,t),e,2)}function Jn(t,e){var n=t.getDay();return t=n>=4||0===n?He(t):He.ceil(t),gn(He.count(Ye(t),t)+(4===Ye(t).getDay()),e,2)}function Zn(t){return t.getDay()}function Qn(t,e){return gn(Ie.count(Ye(t)-1,t),e,2)}function Kn(t,e){return gn(t.getFullYear()%100,e,2)}function tr(t,e){return gn(t.getFullYear()%1e4,e,4)}function er(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+gn(e/60|0,"0",2)+gn(e%60,"0",2)}function nr(t,e){return gn(t.getUTCDate(),e,2)}function rr(t,e){return gn(t.getUTCHours(),e,2)}function ir(t,e){return gn(t.getUTCHours()%12||12,e,2)}function ar(t,e){return gn(1+Xe.count(en(t),t),e,3)}function ur(t,e){return gn(t.getUTCMilliseconds(),e,3)}function or(t,e){return ur(t,e)+"000"}function sr(t,e){return gn(t.getUTCMonth()+1,e,2)}function lr(t,e){return gn(t.getUTCMinutes(),e,2)}function cr(t,e){return gn(t.getUTCSeconds(),e,2)}function fr(t){var e=t.getUTCDay();return 0===e?7:e}function hr(t,e){return gn(Ze.count(en(t)-1,t),e,2)}function dr(t,e){var n=t.getUTCDay();return t=n>=4||0===n?Ke(t):Ke.ceil(t),gn(Ke.count(en(t),t)+(4===en(t).getUTCDay()),e,2)}function pr(t){return t.getUTCDay()}function gr(t,e){return gn(Qe.count(en(t)-1,t),e,2)}function mr(t,e){return gn(t.getUTCFullYear()%100,e,2)}function vr(t,e){return gn(t.getUTCFullYear()%1e4,e,4)}function yr(){return"+0000"}function _r(){return"%"}function xr(t){return+t}function br(t){return Math.floor(+t/1e3)}function wr(t){return un=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,u=t.shortDays,o=t.months,s=t.shortMonths,l=vn(i),c=yn(i),f=vn(a),h=yn(a),d=vn(u),p=yn(u),g=vn(o),m=yn(o),v=vn(s),y=yn(s),_={a:function(t){return u[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Ln,e:Ln,f:Hn,H:Pn,I:$n,j:jn,L:In,m:Wn,M:Yn,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xr,s:br,S:Vn,u:Gn,U:Xn,V:Jn,w:Zn,W:Qn,x:null,X:null,y:Kn,Y:tr,Z:er,"%":_r},x={a:function(t){return u[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:nr,e:nr,f:or,H:rr,I:ir,j:ar,L:ur,m:sr,M:lr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xr,s:br,S:cr,u:fr,U:hr,V:dr,w:pr,W:gr,x:null,X:null,y:mr,Y:vr,Z:yr,"%":_r},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return k(t,e,n,r)},d:Fn,e:Fn,f:On,H:Bn,I:Bn,j:Sn,L:Nn,m:Cn,M:zn,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:Dn,Q:qn,s:Un,S:Tn,u:xn,U:bn,V:wn,w:_n,W:An,x:function(t,e,r){return k(t,n,e,r)},X:function(t,e,n){return k(t,r,e,n)},y:Mn,Y:kn,Z:En,"%":Rn};function w(t,e){return function(n){var r,i,a,u=[],o=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++o<l;)37===t.charCodeAt(o)&&(u.push(t.slice(s,o)),null!=(i=fn[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),u.push(r),s=o+1);return u.push(t.slice(s,o)),u.join("")}}function A(t,e){return function(n){var r,i,a=an(1900,void 0,1);if(k(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(e&&!("Z"in a)&&(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=rn(an(a.y,0,1))).getUTCDay(),r=i>4||0===i?Qe.ceil(r):Qe(r),r=Xe.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=nn(an(a.y,0,1))).getDay(),r=i>4||0===i?Ie.ceil(r):Ie(r),r=Pe.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?rn(an(a.y,0,1)).getUTCDay():nn(an(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,rn(a)):nn(a)}}function k(t,e,n,r){for(var i,a,u=0,o=e.length,s=n.length;u<o;){if(r>=s)return-1;if(37===(i=e.charCodeAt(u++))){if(i=e.charAt(u++),!(a=b[i in fn?e.charAt(u++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=A(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=A(t+="",!0);return e.toString=function(){return t},e}}}(t),on=un.format,sn=un.parse,ln=un.utcFormat,cn=un.utcParse,un}function Ar(t,e,n){const r=Be((e=e||{}).type||"json");return r||i("Unknown data format type: "+e.type),t=r(t,e),e.parse&&function(t,e,n){if(!t.length)return;n=n||sn;var r,i,a,u,o,s,l,c=t.columns||Object.keys(t[0]);"auto"===e&&(e=se(t,c));for(c=Object.keys(e),r=c.map((function(t){var r,i,a=e[t];if(a&&(a.startsWith("date:")||a.startsWith("utc:")))return("'"===(i=(r=a.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?cn(i):n(i);if(!ie[a])throw Error("Illegal format pattern: "+t+":"+a);return ie[a]})),u=0,s=t.length,l=c.length;u<s;++u)for(i=t[u],o=0;o<l;++o)a=c[o],i[a]=r[o](i[a])}(t,e.parse,n),K(t,"columns")&&delete t.columns,t}wr({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"]});var kr=function(t,e){return function(n){return{options:n||{},sanitize:Kt,load:Qt,fileAccess:!!e,file:te(e),http:ne(t)}}}("undefined"!=typeof fetch&&fetch,null);const Mr=Ar;var Er={skip:!0};function Dr(t,e,n,r,i,a){var u,o,s=X({},a,Er);W(n)||(n=V(n)),void 0===r?u=e=>t.touch(n(e)):W(r)?(o=new jt(null,r,i,!1),u=e=>{o.evaluate(e);const r=n(e),i=o.value;Ot(i)?t.pulse(r,i,a):t.update(r,i,s)}):u=e=>t.update(n(e),r,s),e.apply(u)}function Cr(t,e,n,r,i,a){if(void 0===r)e.targets().add(n);else{const u=a||{},o=new jt(null,function(t,e){return e=W(e)?e:V(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);o.modified(u.force),o.rank=e.rank,e.targets().add(o),n&&(o.skip(!0),o.value=n.value,o.targets().add(n),t.connect(n,[o]))}}var Fr={};function Sr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}var Br=Sr.prototype;function zr(t,e){return t?function(n,r){return t(n,r)&&e(n,r)}:e}function Tr(t,e){var n=[];return wt(t,e,(function(t){n.push(t)})),n}function Nr(t,e){var n={};return t.visit(e,(function(t){n[Ct(t)]=1})),function(t){return n[Ct(t)]?null:t}}function Or(t,e,n,r){var i,a,u,o,s,l=this,c=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n,u=0,o=n.length;u<o;++u)if((i=n[u]).stamp===e){if(i.fields)for(s in a=l.fields||(l.fields={}),i.fields)a[s]=1;i.changed(l.ADD)&&(c|=l.ADD),i.changed(l.REM)&&(c|=l.REM),i.changed(l.MOD)&&(c|=l.MOD)}this.changes=c}Br.StopPropagation=Fr,Br.ADD=1,Br.REM=2,Br.MOD=4,Br.ADD_REM=3,Br.ADD_MOD=5,Br.ALL=7,Br.REFLOW=8,Br.SOURCE=16,Br.NO_SOURCE=32,Br.NO_FIELDS=64,Br.fork=function(t){return new Sr(this.dataflow).init(this,t)},Br.clone=function(){var 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)},Br.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?((t=new Sr(this.dataflow).init(this)).add=t.source,t):t},Br.init=function(t,e){var n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source),n},Br.runAfter=function(t){this.dataflow.runAfter(t)},Br.changed=function(t){var e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},Br.reflow=function(t){if(t)return this.fork(7).reflow();var e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Nr(this,1))),this},Br.modifies=function(t){var e=this.fields||(this.fields={});return u(t)?t.forEach(t=>e[t]=!0):e[t]=!0,this},Br.modified=function(t,e){var n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?u(t)?t.some((function(t){return n[t]})):n[t]:!!n)},Br.filter=function(t,e){var n=this;return 1&t&&(n.addF=zr(n.addF,e)),2&t&&(n.remF=zr(n.remF,e)),4&t&&(n.modF=zr(n.modF,e)),16&t&&(n.srcF=zr(n.srcF,e)),n},Br.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Tr(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Tr(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Tr(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},Br.visit=function(t,e){var n,r,i=this,a=e;return 16&t?(wt(i.source,i.srcF,a),i):(1&t&&wt(i.add,i.addF,a),2&t&&wt(i.rem,i.remF,a),4&t&&wt(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||wt(n,r?Nr(i,5):i.srcF,a)),i)};var Rr=rt(Or,Sr);function qr(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Rr.fork=function(t){var e=new Sr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(function(t){return e.add.push(t)})),t&e.REM&&this.visit(e.REM,(function(t){return e.rem.push(t)})),t&e.MOD&&this.visit(e.MOD,(function(t){return e.mod.push(t)}))),e},Rr.changed=function(t){return this.changes&t},Rr.modified=function(t){var e=this,n=e.fields;return n&&e.changes&e.MOD?u(t)?t.some((function(t){return n[t]})):n[t]:0},Rr.filter=function(){i("MultiPulse does not support filtering.")},Rr.materialize=function(){i("MultiPulse does not support materialization.")},Rr.visit=function(t,e){var n=this,r=n.pulses,i=r.length,a=0;if(t&n.SOURCE)for(;a<i;++a)r[a].visit(t,e);else for(;a<i;++a)r[a].stamp===n.stamp&&r[a].visit(t,e);return n};var Ur={skip:!1,force:!1};function Lr(t){var e=[];return{clear:()=>e=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Pr(e,0,e.length-1,t)),pop:()=>{var n,r=e.pop();return e.length?(n=e[0],e[0]=r,function(t,e,n){var r,i=e,a=t.length,u=t[e],o=1+(e<<1);for(;o<a;)(r=o+1)<a&&n(t[o],t[r])>=0&&(o=r),t[e]=t[o],o=1+((e=o)<<1);t[e]=u,Pr(t,i,e,n)}(e,0,t)):n=r,n}}}function Pr(t,e,n,r){var i,a,u;for(i=t[n];n>e&&r(i,a=t[u=n-1>>1])<0;)t[n]=a,n=u;return t[n]=i}function $r(){this.logger(_()),this.logLevel(1),this._clock=0,this._rank=0;try{this._loader=kr()}catch(t){}this._touched=At(h),this._input={},this._pulse=null,this._heap=Lr((t,e)=>t.qrank-e.qrank),this._postrun=[]}var jr=$r.prototype;function Ir(t){return function(){return this._log[t].apply(this,arguments)}}function Hr(t,e){jt.call(this,t,null,e)}jr.stamp=function(){return this._clock},jr.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},jr.cleanThreshold=1e4,jr.add=function(t,e,n,r){var i,a=1;return t instanceof jt?i=t:t&&t.prototype instanceof jt?i=new t:W(t)?i=new jt(null,t):(a=0,i=new jt(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},jr.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n<r;++n)if(i<e[n].rank)return void this.rerank(t)},jr.rank=function(t){t.rank=++this._rank},jr.rerank=function(t){for(var e,n,r,a=[t];a.length;)if(this.rank(e=a.pop()),n=e._targets)for(r=n.length;--r>=0;)a.push(e=n[r]),e===t&&i("Cycle detected in dataflow graph.")},jr.pulse=function(t,e,n){this.touch(t,n||Ur);var r=new Sr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},jr.touch=function(t,e){var n=e||Ur;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},jr.update=function(t,e,n){var r=n||Ur;return(t.set(e)||r.force)&&this.touch(t,r),this},jr.changeset=Rt,jr.ingest=function(t,e,n){return this.pulse(t,this.changeset().insert(Mr(e,n)))},jr.parse=Mr,jr.preload=async function(t,e,n){const r=this,i=r._pending||function(t){var e,n=new Promise((function(t){e=t}));return n.requests=0,n.done=function(){0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const a=await r.request(e,n);return r.pulse(t,r.changeset().remove(m).insert(a.data||[])),i.done(),a},jr.request=async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:ze(e&&e.type)});try{r=Mr(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},jr.events=function(t,e,n,r){for(var i,a=this,u=Vt(n,r),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):I(t)).length;s<l;++s)i[s].addEventListener(e,o);return u},jr.on=function(t,e,n,r,i){return(t instanceof jt?Cr:Dr)(this,t,e,n,r,i),this},jr.evaluate=async function(t,e,n){const r=this,i=r.logLevel(),a=[];if(r._pulse)return qr(r);if(r._pending&&await r._pending,e&&await kt(r,e),!r._touched.length)return r.info("Dataflow invoked, but nothing to do."),r;let u,o,s,l,c=++r._clock,f=0;r._pulse=new Sr(r,c,t),i>=3&&(s=Date.now(),r.debug("-- START PROPAGATION ("+c+") -----")),r._touched.forEach(t=>r._enqueue(t,!0)),r._touched=At(h);try{for(;r._heap.size()>0;)u=r._heap.pop(),u.rank===u.qrank?(o=u.run(r._getPulse(u,t)),o.then?o=await o:o.async&&(a.push(o.async),o=Fr),i>=4&&r.debug(u.id,o===Fr?"STOP":o,u),o!==Fr&&u._targets&&u._targets.forEach(t=>r._enqueue(t)),++f):r._enqueue(u,!0)}catch(t){r._heap.clear(),l=t}if(r._input={},r._pulse=null,i>=3&&(s=Date.now()-s,r.info("> Pulse "+c+": "+f+" operators; "+s+"ms")),l&&(r._postrun=[],r.error(l)),r._postrun.length){const t=r._postrun.sort((t,e)=>e.priority-t.priority);r._postrun=[];for(let e=0;e<t.length;++e)await kt(r,t[e].callback)}return n&&await kt(r,n),a.length&&Promise.all(a).then(t=>r.runAsync(null,()=>{t.forEach(t=>{try{t(r)}catch(t){r.error(t)}})})),r},jr.run=function(t,e,n){return this._pulse?qr(this):(this.evaluate(t,e,n),this)},jr.runAsync=async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},jr.runAfter=function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},jr._enqueue=function(t,e){var n=t.stamp<this._clock;n&&(t.stamp=this._clock),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},jr._getPulse=function(t,e){var n=t.source,r=this._clock;return n&&u(n)?new Or(this,r,n.map(t=>t.pulse),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Fr&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)},jr.logger=function(t){return arguments.length?(this._log=t,this):this._log},jr.error=Ir("error"),jr.warn=Ir("warn"),jr.info=Ir("info"),jr.debug=Ir("debug"),jr.logLevel=Ir("level");var Wr=rt(Hr,jt);Wr.run=function(t){return t.stamp<this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):e=this.evaluate(t),(e=e||t).then?e=e.then(t=>this.pulse=t):e!==t.StopPropagation&&(this.pulse=e),e);var e},Wr.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Wr.transform=function(){};var Yr={};function Vr(t){var e=Gr(t);return e&&e.Definition||null}function Gr(t){return t=t&&t.toLowerCase(),K(Yr,t)?Yr[t]:null}function Xr(t){return t&&t.length?1===t.length?t[0]:(e=t,function(t){for(var n=e.length,r=1,i=String(e[0](t));r<n;++r)i+="|"+e[r](t);return i}):function(){return""};var e}function Jr(t,e,n){return n||t+(e?"_"+e:"")}var Zr={values:ti({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:ti({name:"count",set:"cell.num"}),__count__:ti({name:"count",set:"this.missing + this.valid"}),missing:ti({name:"missing",set:"this.missing"}),valid:ti({name:"valid",set:"this.valid"}),sum:ti({name:"sum",init:"this.sum = 0;",add:"this.sum += +v;",rem:"this.sum -= v;",set:"this.sum"}),product:ti({name:"product",init:"this.product = 1;",add:"this.product *= v;",rem:"this.product /= v;",set:"this.valid ? this.product : undefined"}),mean:ti({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.valid ? this.mean : undefined"}),average:ti({name:"average",set:"this.valid ? this.mean : undefined",req:["mean"],idx:1}),variance:ti({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:ti({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:ti({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:ti({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:ti({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:ti({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:ti({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:ti({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:ti({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:ti({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:ti({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:ti({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:ti({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:ti({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:ti({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Qr=Object.keys(Zr);function Kr(t,e){return Zr[t](e)}function ti(t){return function(e){var n=X({init:"",add:"",rem:"",idx:0},t);return n.out=e||t.name,n}}function ei(t,e){return t.idx-e.idx}function ni(t,e){var n=e||d,r=function(t,e){var n,r=t.reduce((function t(n,r){function i(e){n[e]||t(n,n[e]=Zr[e]())}return r.req&&r.req.forEach(i),e&&r.str&&r.str.forEach(i),n}),t.reduce((function(t,e){return t[e.name]=e,t}),{})),i=[];for(n in r)i.push(r[n]);return i.sort(ei)}(t,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",a="this.cell = cell; this.init();",u="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",o="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach((function(t){i+=t.init,u+=t.add,o+=t.rem})),t.slice().sort(ei).forEach((function(t){s+="t["+l(t.out)+"]="+t.set+";"})),s+="return t;",(a=Function("cell",a)).prototype.init=Function(i),a.prototype.add=Function("v","t",u),a.prototype.rem=Function("v","t",o),a.prototype.set=Function("t",s),a.prototype.get=n,a.fields=t.map((function(t){return t.out})),a}function*ri(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}function ii(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ai(t){var e;return 1===t.length&&(e=t,t=function(t,n){return ii(e(t),n)}),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}var ui=ai(ii),oi=ui.right,si=ui.left;function li(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}var ci=Math.sqrt(50),fi=Math.sqrt(10),hi=Math.sqrt(2);function di(t,e,n){var r,i,a,u,o=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(u=pi(t,e,n))||!isFinite(u))return[];if(u>0)for(t=Math.ceil(t/u),e=Math.floor(e/u),a=new Array(i=Math.ceil(e-t+1));++o<i;)a[o]=(t+o)*u;else for(t=Math.floor(t*u),e=Math.ceil(e*u),a=new Array(i=Math.ceil(t-e+1));++o<i;)a[o]=(t-o)/u;return r&&a.reverse(),a}function pi(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=ci?10:a>=fi?5:a>=hi?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=ci?10:a>=fi?5:a>=hi?2:1)}function gi(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=ci?i*=10:a>=fi?i*=5:a>=hi&&(i*=2),e<t?-i:i}function mi(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function vi(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function yi(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _i(t){return null===t?NaN:+t}function xi(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return vi(t);if(e>=1)return mi(t);var r,i=(r-1)*e,a=Math.floor(i),u=mi(function t(e,n,r=0,i=e.length-1,a=ii){for(;i>r;){if(i-r>600){const u=i-r+1,o=n-r+1,s=Math.log(u),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(u-l)/u)*(o-u/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-o*l/u+c)),Math.min(i,Math.floor(n+(u-o)*l/u+c)),a)}const u=e[n];let o=r,s=i;for(yi(e,r,n),a(e[i],u)>0&&yi(e,r,i);o<s;){for(yi(e,o,s),++o,--s;a(e[o],u)<0;)++o;for(;a(e[s],u)>0;)--s}0===a(e[r],u)?yi(e,r,s):(++s,yi(e,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return e}(t,a).subarray(0,a+1));return u+(vi(t.subarray(a+1))-u)*(i-a)}}function bi(t,e){return xi(t,.5,e)}function wi(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function Ai(t,e,n){var r=Float64Array.from(ri(t,n));return r.sort(ii),e.map(t=>function(t,e,n=_i){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),u=+n(t[a],a,t);return u+(+n(t[a+1],a+1,t)-u)*(i-a)}}(r,t))}function ki(t,e){return Ai(t,[.25,.5,.75],e)}function Mi(t,e){var n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,a+=n*(e-i));else{let u=-1;for(let o of t)null!=(o=e(o,++u,t))&&(o=+o)>=o&&(n=o-i,i+=n/++r,a+=n*(o-i))}if(r>1)return a/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=ki(t,e),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function Ei(t){var e,n,r,i,a,u,o,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],g=t.span||p-d||Math.abs(d)||1;if(t.step)e=t.step;else if(t.steps){for(a=g/l,u=0,o=t.steps.length;u<o&&t.steps[u]<a;++u);e=t.steps[Math.max(0,u-1)]}else{for(n=Math.ceil(Math.log(l)/f),r=t.minstep||0,e=Math.max(r,Math.pow(c,Math.round(Math.log(g)/f)-n));Math.ceil(g/e)>l;)e*=c;for(u=0,o=h.length;u<o;++u)(a=e/h[u])>=r&&g/a<=l&&(e=a)}return i=(a=Math.log(e))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/e+s)*e)?a-e:a,p=Math.ceil(p/e)*e),{start:d,stop:p===d?d+e:p,step:e}}function Di(e,n,r,i){if(!e.length)return[void 0,void 0];var a,u,o,s,l=Float64Array.from(ri(e,i)),c=l.length,f=n;for(o=0,s=Array(f);o<f;++o){for(a=0,u=0;u<c;++u)a+=l[~~(t.random()*c)];s[o]=a/c}return s.sort(ii),[xi(s,r/2),xi(s,1-r/2)]}function Ci(t,e,n,r){r=r||(t=>t);let i,a=0,u=1,o=t.length,s=new Float64Array(o),l=r(t[0]),c=l,f=l+e;for(;u<o;++u){if(i=r(t[u]),i>=f){for(c=(l+c)/2;a<u;++a)s[a]=c;f=i+e,l=i}c=i}for(c=(l+c)/2;a<u;++a)s[a]=c;return n?function(t,e){let n,r,i=t.length,a=0,u=1;for(;t[a]===t[u];)++u;for(;u<i;){for(n=u+1;t[u]===t[n];)++n;if(t[u]-t[u-1]<e){for(r=u+(a+n-u-u>>1);r<u;)t[r++]=t[u];for(;r>u;)t[r--]=t[a]}a=u,u=n}return t}(s,e+e/4):s}t.random=Math.random;const Fi=Math.sqrt(2*Math.PI),Si=Math.SQRT2;let Bi=NaN;function zi(e,n){e=e||0,n=null==n?1:n;let r,i,a=0,u=0;if(Bi==Bi)a=Bi,Bi=NaN;else{do{a=2*t.random()-1,u=2*t.random()-1,r=a*a+u*u}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),a*=i,Bi=u*i}return e+a*n}function Ti(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Fi)}function Ni(t,e,n){let r,i=(t-(e=e||0))/(n=null==n?1:n),a=Math.abs(i);if(a>37)r=0;else{let t,e=Math.exp(-a*a/2);a<7.07106781186547?(t=.0352624965998911*a+.700383064443688,t=t*a+6.37396220353165,t=t*a+33.912866078383,t=t*a+112.079291497871,t=t*a+221.213596169931,t=t*a+220.206867912376,r=e*t,t=.0883883476483184*a+1.75566716318264,t=t*a+16.064177579207,t=t*a+86.7807322029461,t=t*a+296.564248779674,t=t*a+637.333633378831,t=t*a+793.826512519948,t=t*a+440.413735824752,r/=t):(t=a+.65,t=a+4/t,t=a+3/t,t=a+2/t,t=a+1/t,r=e/t/2.506628274631)}return i>0?1-r:r}function Oi(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*Si*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function Ri(t,e){var n,r,i={mean:function(t){return arguments.length?(n=t||0,i):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>zi(n,r),pdf:t=>Ti(t,n,r),cdf:t=>Ni(t,n,r),icdf:t=>Oi(t,n,r)};return i.mean(t).stdev(e)}function qi(e,n){var r=Ri(),i={},a=0;return i.data=function(t){return arguments.length?(e=t,a=t?t.length:0,i.bandwidth(n)):e},i.bandwidth=function(t){return arguments.length?(!(n=t)&&e&&(n=Mi(e)),i):n},i.sample=function(){return e[~~(t.random()*a)]+n*r.sample()},i.pdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.pdf((t-e[u])/n);return i/n/a},i.cdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.cdf((t-e[u])/n);return i/a},i.icdf=function(){throw Error("KDE icdf not supported.")},i.data(e)}function Ui(t,e){return t=t||0,e=null==e?1:e,Math.exp(t+zi()*e)}function Li(t,e,n){if(t<=0)return 0;e=e||0,n=null==n?1:n;const r=(Math.log(t)-e)/n;return Math.exp(-.5*r*r)/(n*Fi*t)}function Pi(t,e,n){return Ni(Math.log(t),e,n)}function $i(t,e,n){return Math.exp(Oi(t,e,n))}function ji(t,e){var n,r,i={mean:function(t){return arguments.length?(n=t||0,i):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Ui(n,r),pdf:t=>Li(t,n,r),cdf:t=>Pi(t,n,r),icdf:t=>$i(t,n,r)};return i.mean(t).stdev(e)}function Ii(e,n){var r,i={},a=0;function u(t){var e,n=[],r=0;for(e=0;e<a;++e)r+=n[e]=null==t[e]?1:+t[e];for(e=0;e<a;++e)n[e]/=r;return n}return i.weights=function(t){return arguments.length?(r=u(n=t||[]),i):n},i.distributions=function(t){return arguments.length?(t?(a=t.length,e=t):(a=0,e=[]),i.weights(n)):e},i.sample=function(){for(var n=t.random(),i=e[a-1],u=r[0],o=0;o<a-1;u+=r[++o])if(n<u){i=e[o];break}return i.sample()},i.pdf=function(t){for(var n=0,i=0;i<a;++i)n+=r[i]*e[i].pdf(t);return n},i.cdf=function(t){for(var n=0,i=0;i<a;++i)n+=r[i]*e[i].cdf(t);return n},i.icdf=function(){throw Error("Mixture icdf not supported.")},i.distributions(e).weights(n)}function Hi(e,n){return null==n&&(n=null==e?1:e,e=0),e+(n-e)*t.random()}function Wi(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=e&&t<=n?1/(n-e):0}function Yi(t,e,n){return null==n&&(n=null==e?1:e,e=0),t<e?0:t>n?1:(t-e)/(n-e)}function Vi(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Gi(t,e){var n,r,i={min:function(t){return arguments.length?(n=t||0,i):n},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Hi(n,r),pdf:t=>Wi(t,n,r),cdf:t=>Yi(t,n,r),icdf:t=>Vi(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Xi(t,e,n,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-a*t,a]}function Ji(t,e,n,r){t=t.filter(t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,n)=>e(t)-e(n));const i=t.length,a=new Float64Array(i),u=new Float64Array(i);let o,s,l,c=0,f=0,h=0;for(l of t)a[c]=o=+e(l),u[c]=s=+n(l),++c,f+=(o-f)/c,h+=(s-h)/c;for(c=0;c<i;++c)a[c]-=f,u[c]-=h;return[a,u,f,h]}function Zi(t,e,n,r){let i,a,u=-1;for(let o of t)i=e(o),a=n(o),null!=i&&(i=+i)>=i&&null!=a&&(a=+a)>=a&&r(i,a,++u)}function Qi(t,e,n,r,i){let a=0,u=0;return Zi(t,e,n,(t,e)=>{const n=e-i(t),o=e-r;a+=n*n,u+=o*o}),1-a/u}function Ki(t,e,n){let r=0,i=0,a=0,u=0,o=0;Zi(t,e,n,(t,e)=>{++o,r+=(t-r)/o,i+=(e-i)/o,a+=(t*e-a)/o,u+=(t*t-u)/o});const s=Xi(r,i,a,u),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Qi(t,e,n,i,l)}}function ta(t,e,n){let r=0,i=0,a=0,u=0,o=0;Zi(t,e,n,(t,e)=>{++o,t=Math.log(t),r+=(t-r)/o,i+=(e-i)/o,a+=(t*e-a)/o,u+=(t*t-u)/o});const s=Xi(r,i,a,u),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Qi(t,e,n,i,l)}}function ea(t,e,n){const[r,i,a,u]=Ji(t,e,n);let o,s,l,c=0,f=0,h=0,d=0,p=0;Zi(t,e,n,(t,e)=>{o=r[p++],s=Math.log(e),l=o*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(o*l-d)/p});const[g,m]=Xi(f/u,c/u,h/u,d/u),v=t=>Math.exp(g+m*(t-a));return{coef:[Math.exp(g-m*a),m],predict:v,rSquared:Qi(t,e,n,u,v)}}function na(t,e,n){let r=0,i=0,a=0,u=0,o=0,s=0;Zi(t,e,n,(t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,a+=(n*l-a)/s,u+=(n*n-u)/s,o+=(e-o)/s});const l=Xi(r,i,a,u),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Qi(t,e,n,o,c)}}function ra(t,e,n){const[r,i,a,u]=Ji(t,e,n),o=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s<o;)l=r[s],c=i[s++],f=l*l,h+=(f-h)/s,d+=(f*l-d)/s,p+=(f*f-p)/s,g+=(l*c-g)/s,m+=(f*c-m)/s;const v=p-h*h,y=h*v-d*d,_=(m*h-g*d)/y,x=(g*v-m*d)/y,b=-_*h,w=t=>_*(t-=a)*t+x*t+b+u;return{coef:[b-x*a+_*a*a+u,x-2*_*a,_],predict:w,rSquared:Qi(t,e,n,u,w)}}function ia(t,e,n,r){if(1===r)return Ki(t,e,n);if(2===r)return ra(t,e,n);const[i,a,u,o]=Ji(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;h<f;++h){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h)*a[p];for(l.push(g),m=new Float64Array(f),d=0;d<f;++d){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h+d);m[d]=g}c.push(m)}c.push(l);const v=function(t){const e=t.length-1,n=[];let r,i,a,u,o;for(r=0;r<e;++r){for(u=r,i=r+1;i<e;++i)Math.abs(t[r][i])>Math.abs(t[r][u])&&(u=i);for(a=r;a<e+1;++a)o=t[a][r],t[a][r]=t[a][u],t[a][u]=o;for(i=r+1;i<e;++i)for(a=e;a>=r;a--)t[a][i]-=t[a][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(o=0,a=i+1;a<e;++a)o+=t[a][i]*n[a];n[i]=(t[e][i]-o)/t[i][i]}return n}(c),y=t=>{t-=u;let e=o+v[0]+v[1]*t+v[2]*t*t;for(h=3;h<f;++h)e+=v[h]*Math.pow(t,h);return e};return{coef:aa(f,v,-u,o),predict:y,rSquared:Qi(t,e,n,o,y)}}function aa(t,e,n,r){const i=Array(t);let a,u,o,s;for(a=0;a<t;++a)i[a]=0;for(a=t-1;a>=0;--a)for(o=e[a],s=1,i[a]+=o,u=1;u<=a;++u)s*=(a+1-u)/u,i[a-u]+=o*Math.pow(n,u)*s;return i[0]+=r,i}function ua(t,e,n,r){const[i,a,u,o]=Ji(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;t<s;++t){const n=i[t],r=e[0],u=e[1],o=n-i[r]>i[u]-n?r:u;let s=0,l=0,d=0,p=0,g=0,m=1/Math.abs(i[o]-n||1);for(let t=r;t<=u;++t){const e=i[t],r=a[t],u=oa(Math.abs(n-e)*m)*h[t],o=e*u;s+=u,l+=o,d+=r*u,p+=r*o,g+=e*o}const[v,y]=Xi(l/s,d/s,p/s,g/s);c[t]=v+y*n,f[t]=Math.abs(a[t]-c[t]),sa(i,t+1,e)}if(2===t)break;const n=bi(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r<s;++r)t=f[r]/(6*n),h[r]=t>=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,a=[];let u,o=0,s=0,l=[];for(;o<i;++o)u=t[o]+n,l[0]===u?l[1]+=(e[o]-l[1])/++s:(s=0,l[1]+=r,l=[u,e[o]],a.push(l));return l[1]+=r,a}(i,c,u,o)}function oa(t){return(t=1-t*t*t)*t*t}function sa(t,e,n){let r=t[e],i=n[0],a=n[1]+1;if(!(a>=t.length))for(;e>i&&t[a]-r<=r-t[i];)n[0]=++i,n[1]=a,++a}const la=.1*Math.PI/180;function ca(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],a=e[0],u=e[1],o=u-a,s=o/r,l=[i(a)],c=[];if(n===r){for(let t=1;t<r;++t)l.push(i(a+t/n*o));return l.push(i(u)),l}c.push(i(u));for(let t=n;--t>0;)c.push(i(a+t/n*o));let f=l[0],h=c[c.length-1];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&fa(f,t,h)>la?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function fa(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function ha(t){this._key=t?c(t):Ct,this.reset()}var da=ha.prototype;function pa(t){Hr.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}da.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},da.add=function(t){this._add.push(t)},da.rem=function(t){this._rem.push(t)},da.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(t=0;t<o;++t)l[a(i[t])]=1;for(t=0,e=0;t<u;++t)l[a(n=r[t])]?l[a(n)]=0:s[e++]=n;return this._rem=[],this._add=s},da.distinct=function(t){for(var e,n=this.values(),r=n.length,i={},a=0;--r>=0;)K(i,e=t(n[r])+"")||(i[e]=1,++a);return a},da.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=Z(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},da.argmin=function(t){return this.extent(t)[0]||{}},da.argmax=function(t){return this.extent(t)[1]||{}},da.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):void 0},da.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):void 0},da.quartile=function(t){return this._get===t&&this._q||(this._q=ki(this.values(),t),this._get=t),this._q},da.q1=function(t){return this.quartile(t)[0]},da.q2=function(t){return this.quartile(t)[1]},da.q3=function(t){return this.quartile(t)[2]},da.ci=function(t){return this._get===t&&this._ci||(this._ci=Di(this.values(),1e3,.05,t),this._get=t),this._ci},da.ci0=function(t){return this.ci(t)[0]},da.ci1=function(t){return this.ci(t)[1]},pa.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Qr},{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"}]};var ga=rt(pa,Hr);ga.transform=function(t,e){var n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,t=>n.add(t))):(n.value=n.value||n.init(t),e.visit(e.REM,t=>n.rem(t)),e.visit(e.ADD,t=>n.add(t))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),n.changes(r)},ga.cross=function(){var t=this,e=t.value,n=t._dnames,r=n.map((function(){return{}})),i=n.length;function a(t){var e,a,u,o;for(e in t)for(u=t[e].tuple,a=0;a<i;++a)r[a][o=u[n[a]]]=o}a(t._prev),a(e),function a(u,o,s){var l,c,f=n[s],h=r[s++];for(l in h)o[f]=h[l],c=u?u+"|"+l:l,s<i?a(c,o,s):e[c]||t.cell(c,o)}("",{},0)},ga.init=function(t){var e=this._inputs=[],a=this._outputs=[],u={};function o(t){for(var n,i=I(r(t)),a=0,o=i.length;a<o;++a)u[n=i[a]]||(u[n]=1,e.push(n))}this._dims=I(t.groupby),this._dnames=this._dims.map((function(t){var e=n(t);return o(t),a.push(e),e})),this.cellkey=t.key?t.key:Xr(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];var s,l,c,f,h,d,p=t.fields||[null],g=t.ops||["count"],m=t.as||[],v=p.length,y={};for(v!==g.length&&i("Unmatched number of fields and aggregate ops."),d=0;d<v;++d)s=p[d],l=g[d],null==s&&"count"!==l&&i("Null aggregate field specified."),h=Jr(l,f=n(s),m[d]),a.push(h),"count"!==l?((c=y[f])||(o(s),(c=y[f]=[]).field=s,this._measures.push(c)),"count"!==l&&(this._countOnly=!1),c.push(Kr(l,h))):this._counts.push(h);return this._measures=this._measures.map((function(t){return ni(t,t.field)})),{}},ga.cellkey=Xr(),ga.cell=function(t,e){var n=this.value[t];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=n),n},ga.newcell=function(t,e){var n={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var r,i=this._measures,a=i.length;for(n.agg=Array(a),r=0;r<a;++r)n.agg[r]=new i[r](n)}return n.store&&(n.data=new ha),n},ga.newtuple=function(t,e){var n,r,i=this._dnames,a=this._dims,u={};for(n=0,r=a.length;n<r;++n)u[i[n]]=a[n](t);return e?Tt(e.tuple,u):St(u)},ga.add=function(t){var e,n,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num+=1,!this._countOnly)for(a.store&&a.data.add(t),n=0,r=(e=a.agg).length;n<r;++n)e[n].add(e[n].get(t),t)},ga.rem=function(t){var e,n,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num-=1,!this._countOnly)for(a.store&&a.data.rem(t),n=0,r=(e=a.agg).length;n<r;++n)e[n].rem(e[n].get(t),t)},ga.celltuple=function(t){var e,n,r,i=t.tuple,a=this._counts;for(t.store&&t.data.values(),n=0,r=a.length;n<r;++n)i[a[n]]=t.num;if(!this._countOnly)for(n=0,r=(e=t.agg).length;n<r;++n)e[n].set(i);return i},ga.changes=function(t){var e,n,r,i,a=this._adds,u=this._mods,o=this._prev,s=this._drop,l=t.add,c=t.rem,f=t.mod;if(o)for(n in o)e=o[n],s&&!e.num||c.push(e.tuple);for(r=0,i=this._alen;r<i;++r)l.push(this.celltuple(a[r])),a[r]=null;for(r=0,i=this._mlen;r<i;++r)(0===(e=u[r]).num&&s?c:f).push(this.celltuple(e)),u[r]=null;return this._alen=this._mlen=0,this._prev=null,t};function ma(t){Hr.call(this,null,t)}ma.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"]}]};var va=rt(ma,Hr);function ya(t,e,n){var r=t,i=e||[],a=n||[],u={},o=0;return{add:function(t){a.push(t)},remove:function(t){u[r(t)]=++o},size:function(){return i.length},data:function(t,e){return o&&(i=i.filter((function(t){return!u[r(t)]})),u={},o=0),e&&t&&i.sort(t),a.length&&(i=t?ht(t,i,a.sort(t)):i.concat(a),a=[]),i}}}function _a(t){Hr.call(this,[],t)}function xa(t){jt.call(this,null,ba,t)}function ba(t){return this.value&&!t.modified()?this.value:Y(t.fields,t.orders)}function wa(t){Hr.call(this,null,t)}va.transform=function(t,e){var n,i=!1!==t.interval,a=this._bins(t),u=a.start,o=a.step,s=t.as||["bin0","bin1"],l=s[0],c=s[1];return n=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(r(t.field))?e.ADD_MOD:e.ADD,e.visit(n,i?function(t){var e=a(t);t[l]=e,t[c]=null==e?null:u+o*(1+(e-u)/o)}:function(t){t[l]=a(t)}),e.modifies(i?s:l)},va._bins=function(t){if(this.value&&!t.modified())return this.value;var i,a,u=t.field,o=Ei(t),s=o.step,l=o.start,c=l+Math.ceil((o.stop-l)/s)*s;null!=(i=t.anchor)&&(a=i-(l+s*Math.floor((i-l)/s)),l+=a,c+=a);var f=function(t){var e=u(t);return null==e?null:e<l?-1/0:e>c?1/0:(e=Math.max(l,Math.min(+e,c-s)),l+s*Math.floor(1e-14+(e-l)/s))};return f.start=l,f.stop=o.stop,f.step=s,this.value=e(f,r(u),t.name||"bin_"+n(u))},_a.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},rt(_a,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=ya(Ct,this.value,n.materialize(n.ADD).add),i=t.sort,a=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(Nt(i),a),e.source&&e.source.root&&(this.value.root=e.source.root),n},rt(xa,jt),wa.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"]}]};var Aa=rt(wa,Hr);function ka(t){Hr.call(this,null,t)}Aa.transform=function(t,e){function n(e){return function(n){for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(o(n),t.case,a)||[],s=0,l=i.length;s<l;++s)u.test(r=i[s])||e(r)}}var r=this._parameterCheck(t,e),i=this._counts,a=this._match,u=this._stop,o=t.field,s=t.as||["text","count"],l=n((function(t){i[t]=1+(i[t]||0)})),c=n((function(t){i[t]-=1}));return r?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,c)),this._finish(e,s)},Aa._parameterCheck=function(t,e){var n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},Aa._finish=function(t,e){var n,r,i,a=this._counts,u=this._tuples||(this._tuples={}),o=e[0],s=e[1],l=t.fork(t.NO_SOURCE|t.NO_FIELDS);for(n in a)r=u[n],i=a[n]||0,!r&&i?(u[n]=r=St({}),r[o]=n,r[s]=i,l.add.push(r)):0===i?(r&&l.rem.push(r),a[n]=null,u[n]=null):r[s]!==i&&(r[s]=i,l.mod.push(r));return l.modifies(e)},ka.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},rt(ka,Hr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=this.value,i=t.as||["a","b"],a=i[0],u=i[1];return!r||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter")?(r&&(n.rem=r),r=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,a,u=[],o={},s=t.length,l=0;l<s;++l)for(o[e]=a=t[l],i=0;i<s;++i)o[n]=t[i],r(o)&&(u.push(St(o)),(o={})[e]=a);return u}(r,a,u,t.filter||m)):n.mod=r,n.source=this.value,n.modifies(i)};var Ma={kde:qi,mixture:Ii,normal:Ri,lognormal:ji,uniform:Gi};function Ea(t){Hr.call(this,null,t)}var Da=[{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}]}],Ca={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Da},{name:"weights",type:"number",array:!0}]};function Fa(t,e){return t?t.map((function(t,r){return e[r]||n(t)})):null}function Sa(t,e,n){var r,i,a,u,o,s,l=[],c=function(t){return t(u)};if(null==e)l.push(t.map(n));else for(r={},i=0,a=t.length;i<a;++i)u=t[i],(s=r[o=e.map(c)])||(r[o]=s=[],s.dims=o,l.push(s)),s.push(n(u));return l}Ea.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:Da.concat(Ca)},{name:"as",type:"string",array:!0,default:["value","density"]}]},rt(Ea,Hr).transform=function(t,e){var n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){var r=function t(e,n){var r=e.function;K(Ma,r)||i("Unknown distribution function: "+r);var a=Ma[r]();for(var u in e)"field"===u?a.data((e.from||n()).map(e[u])):"distributions"===u?a[u](e[u].map((function(e){return t(e,n)}))):"function"==typeof a[u]&&a[u](e[u]);return a}(t.distribution,function(t){return function(){return t.materialize(t.SOURCE).source}}(e)),a=t.steps||t.minsteps||25,u=t.steps||t.maxsteps||200,o=t.method||"pdf";"pdf"!==o&&"cdf"!==o&&i("Invalid density method: "+o),t.extent||r.data||i("Missing density extent parameter."),o=r[o];var s=t.as||["value","density"],l=ca(o,t.extent||J(r.data()),a,u).map(t=>{var e={};return e[s[0]]=t[0],e[s[1]]=t[1],St(e)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n};function Ba(t){Hr.call(this,null,t)}function za(t){jt.call(this,null,Ta,t),this.modified(!0)}function Ta(t){var i=t.expr;return this.value&&!t.modified("expr")?this.value:e(e=>i(e,t),r(i),n(i))}function Na(t){Hr.call(this,[void 0,void 0],t)}function Oa(t,e){jt.call(this,t),this.parent=e}Ba.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"}]},rt(Ba,Hr).transform=function(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=Sa(e.source,t.groupby,d),i=t.smooth||!1,a=t.field,u=t.step||function(t,e){return gt(J(t,e))/30}(n,a),o=Nt((t,e)=>a(t)-a(e)),s=t.as||"bin",l=r.length;let c,f=1/0,h=-1/0,p=0;for(;p<l;++p){const t=r[p].sort(o);c=-1;for(const e of Ci(t,u,i,a))e<f&&(f=e),e>h&&(h=e),t[++c][s]=e}return this.value={start:f,stop:h,step:u},e.reflow(!0).modifies(s)},rt(za,jt),Na.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},rt(Na,Hr).transform=function(t,e){var r,i=this.value,a=t.field,u=i[0],o=i[1];if(((r=e.changed()||e.modified(a.fields)||t.modified("field"))||null==u)&&(u=1/0,o=-1/0),e.visit(r?e.SOURCE:e.ADD,(function(t){var e=a(t);null!=e&&((e=+e)<u&&(u=e),e>o&&(o=e))})),!Number.isFinite(u)||!Number.isFinite(o)){let t=n(a);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${u}, ${o}]`),u=o=void 0}this.value=[u,o]};var Ra=rt(Oa,jt);function qa(t){Hr.call(this,{},t),this._keys=et();var e=this._targets=[];e.active=0,e.forEach=function(t){for(var n=0,r=e.active;n<r;++n)t(e[n],n,e)}}Ra.connect=function(t){return this.targets().add(t),t.source=this},Ra.add=function(t){this.value.add.push(t)},Ra.rem=function(t){this.value.rem.push(t)},Ra.mod=function(t){this.value.mod.push(t)},Ra.init=function(t){this.value.init(t,t.NO_SOURCE)},Ra.evaluate=function(){return this.value};var Ua=rt(qa,Hr);function La(t){jt.call(this,null,Pa,t)}function Pa(t){return this.value&&!t.modified()?this.value:u(t.name)?I(t.name).map((function(t){return c(t)})):c(t.name,t.as)}function $a(t){Hr.call(this,et(),t)}function ja(t){Hr.call(this,[],t)}function Ia(t){Hr.call(this,[],t)}function Ha(t){Hr.call(this,null,t)}function Wa(t){Hr.call(this,[],t)}Ua.activate=function(t){this._targets[this._targets.active++]=t},Ua.subflow=function(t,e,n,r){var i,a,u=this.value,o=K(u,t)&&u[t];return o?o.value.stamp<n.stamp&&(o.init(n),this.activate(o)):(a=r||(a=this._group[t])&&a.tuple,o=(i=n.dataflow).add(new Oa(n.fork(n.NO_SOURCE),this)).connect(e(i,t,a)),u[t]=o,this.activate(o)),o},Ua.transform=function(t,e){var n=e.dataflow,r=this,i=t.key,a=t.subflow,u=this._keys,o=t.modified("key");function s(t){return r.subflow(t,a,e)}return this._group=t.group||{},this._targets.active=0,e.visit(e.REM,(function(t){var e=Ct(t),n=u.get(e);void 0!==n&&(u.delete(e),s(n).rem(t))})),e.visit(e.ADD,(function(t){var e=i(t);u.set(Ct(t),e),s(e).add(t)})),o||e.modified(i.fields)?e.visit(e.MOD,(function(t){var e=Ct(t),n=u.get(e),r=i(t);n===r?s(r).mod(t):(u.set(e,r),s(n).rem(t),s(r).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(function(t){s(u.get(Ct(t))).mod(t)})),o&&e.visit(e.REFLOW,(function(t){var e=Ct(t),n=u.get(e),r=i(t);n!==r&&(u.set(e,r),s(n).rem(t),s(r).add(t))})),u.empty>n.cleanThreshold&&n.runAfter(u.clean),e},rt(La,jt),$a.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},rt($a,Hr).transform=function(t,e){var n=e.dataflow,r=this.value,i=e.fork(),a=i.add,u=i.rem,o=i.mod,s=t.expr,l=!0;function c(e){var n=Ct(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),a.push(e)):i||c?l&&i&&!c&&o.push(e):(r.set(n,1),u.push(e))}return e.visit(e.REM,(function(t){var e=Ct(t);r.has(e)?r.delete(e):u.push(t)})),e.visit(e.ADD,(function(e){s(e,t)?a.push(e):r.set(Ct(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},ja.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}]},rt(ja,Hr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=Fa(r,t.as||[]),a=t.index||null,u=i.length;return n.rem=this.value,e.visit(e.SOURCE,(function(t){for(var e,o,s,l=r.map(e=>e(t)),c=l.reduce((t,e)=>Math.max(t,e.length),0),f=0;f<c;++f){for(o=Bt(t),e=0;e<u;++e)o[i[e]]=null==(s=l[e][f])?null:s;a&&(o[a]=f),n.add.push(o)}})),this.value=n.source=n.add,a&&n.modifies(a),n.modifies(i)},Ia.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"]}]},rt(Ia,Hr).transform=function(t,e){var r=e.fork(e.NO_SOURCE),i=t.fields,a=i.map(n),u=t.as||["key","value"],o=u[0],s=u[1],l=i.length;return r.rem=this.value,e.visit(e.SOURCE,(function(t){for(var e,n=0;n<l;++n)(e=Bt(t))[o]=a[n],e[s]=i[n](t),r.add.push(e)})),this.value=r.source=r.add,r.modifies(u)},Ha.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},rt(Ha,Hr).transform=function(t,e){var n=t.expr,r=t.as,i=t.modified(),a=t.initonly?e.ADD:i?e.SOURCE:e.modified(n.fields)||e.modified(r)?e.ADD_MOD:e.ADD;return i&&(e=e.materialize().reflow(!0)),t.initonly||e.modifies(r),e.visit(a,e=>e[r]=n(e,t))},rt(Wa,Hr).transform=function(t,e){var n,r,i,a=this.value,u=e.fork(e.ALL),o=t.size-a.length,s=t.generator;if(o>0){for(n=[];--o>=0;)n.push(i=St(s(t))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(n):n}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var Ya={value:"value",median:bi,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n},min:vi,max:mi},Va=[];function Ga(t){Hr.call(this,[],t)}function Xa(t){pa.call(this,t)}Ga.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}]},rt(Ga,Hr).transform=function(t,e){var r,a,u,o,s,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Ya.value;if(null!=Ya[n])return n===Ya.value?(e=void 0!==t.value?t.value:0,function(){return e}):Ya[n];i("Unrecognized imputation method: "+n)}(t),m=function(t){var e=t.field;return function(t){return t?e(t):NaN}}(t),v=n(t.field),y=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,a,u,o,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],g={},m={};for(p.forEach((function(t,e){g[t]=e+1})),o=0,c=t.length;o<c;++o)f=t[o],l=n(f),s=g[l]||(g[l]=p.push(l)),a=(i=e?e.map(h):Va)+"",(u=m[a])||(u=m[a]=[],d.push(u),u.values=i),u[s-1]=f;return d.domain=p,d}(e.source,t.groupby,t.key,t.keyvals),b=[],w=this.value,A=x.domain.length;for(s=0,f=x.length;s<f;++s)for(u=(r=x[s]).values,a=NaN,c=0;c<A;++c)if(null==r[c]){for(o=x.domain[c],d={_impute:!0},l=0,h=u.length;l<h;++l)d[_[l]]=u[l];d[y]=o,d[v]=Number.isNaN(a)?a=g(r,m):a,b.push(St(d))}return b.length&&(p.add=p.materialize(p.ADD).add.concat(b)),w.length&&(p.rem=p.materialize(p.REM).rem.concat(w)),this.value=b,p},Xa.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:Qr},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};var Ja=rt(Xa,pa);function Za(t){Hr.call(this,null,t)}function Qa(t){jt.call(this,null,Ka,t)}function Ka(t){return this.value&&!t.modified()?this.value:lt(t.fields,t.flat)}function tu(t){Hr.call(this,[],t),this._pending=null}function eu(t,e,n){n.forEach(St);const r=e.fork(e.NO_FIELDS&e.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=n,t._pending=null,r}function nu(t){Hr.call(this,{},t)}function ru(t){jt.call(this,null,iu,t)}function iu(t){if(this.value&&!t.modified())return this.value;var e,n,r,i=1/0,a=-1/0,u=t.extents;for(e=0,n=u.length;e<n;++e)(r=u[e])[0]<i&&(i=r[0]),r[1]>a&&(a=r[1]);return[i,a]}function au(t){jt.call(this,null,uu,t)}function uu(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,e){return t.concat(e)}),[])}function ou(t){Hr.call(this,null,t)}function su(t){pa.call(this,t)}Ja.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs,!0))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,(function(t){r.add(t)}))):(n=r.value=r.value||this.init(t),e.visit(e.REM,(function(t){r.rem(t)})),e.visit(e.ADD,(function(t){r.add(t)}))),r.changes(),e.visit(e.SOURCE,(function(t){X(t,n[r.cellkey(t)].tuple)})),e.reflow(i).modifies(this._outputs)},Ja.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t<e;++t)this.celltuple(n[t]),n[t]=null;for(t=0,e=this._mlen;t<e;++t)this.celltuple(r[t]),r[t]=null;this._alen=this._mlen=0},Za.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"]}]},rt(Za,Hr).transform=function(t,e){var r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const a=e.materialize(e.SOURCE).source,u=Sa(a,t.groupby,t.field),o=(t.groupby||[]).map(n),s=t.bandwidth,l=t.cumulative?"cdf":"pdf",c=t.as||["value","density"],f=[];let h=t.extent,d=t.steps||t.minsteps||25,p=t.steps||t.maxsteps||200;"pdf"!==l&&"cdf"!==l&&i("Invalid density method: "+l),"shared"===t.resolve&&(h||(h=J(a,t.field)),d=p=t.steps||p),u.forEach(e=>{const n=qi(e,s)[l],r=t.counts?e.length:1;ca(n,h||J(e),d,p).forEach(t=>{const n={};for(let t=0;t<o.length;++t)n[o[t]]=e.dims[t];n[c[0]]=t[0],n[c[1]]=t[1]*r,f.push(St(n))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=f}return r},rt(Qa,jt),rt(tu,Hr).transform=function(t,e){const n=e.dataflow;if(this._pending)return eu(this,e,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return e.StopPropagation;if(t.values)return eu(this,e,n.parse(t.values,t.format));if(t.async){return{async:n.request(t.url,t.format).then(t=>(this._pending=I(t.data),t=>t.touch(this)))}}return n.request(t.url,t.format).then(t=>eu(this,e,I(t.data)))},nu.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}]},rt(nu,Hr).transform=function(t,e){var r,a,u=e,o=t.as,s=t.fields,l=t.index,c=t.values,f=null==t.default?null:t.default,h=t.modified(),d=h?e.SOURCE:e.ADD,p=s.length;return c?(a=c.length,p>1&&!o&&i('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==p*a&&i('The "as" parameter has too few output field names.'),o=o||c.map(n),r=function(t){for(var e,n,r=0,i=0;r<p;++r)if(null==(n=l.get(s[r](t))))for(e=0;e<a;++e,++i)t[o[i]]=f;else for(e=0;e<a;++e,++i)t[o[i]]=c[e](n)}):(o||i("Missing output field names."),r=function(t){for(var e,n=0;n<p;++n)e=l.get(s[n](t)),t[o[n]]=null==e?f:e}),h?u=e.reflow(!0):d|=s.some((function(t){return e.modified(t.fields)}))?e.MOD:0,e.visit(d,r),u.modifies(o)},rt(ru,jt),rt(au,jt),rt(ou,Hr),ou.prototype.transform=function(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)},su.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:Qr,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};var lu=rt(su,pa);function cu(t){qa.call(this,t)}function fu(t){Hr.call(this,null,t)}function hu(t){Hr.call(this,null,t)}function du(t){Hr.call(this,null,t)}lu._transform=lu.transform,lu.transform=function(t,n){return this._transform(function(t,n){var i=t.field,a=t.value,u=("count"===t.op?"__count__":t.op)||"sum",o=r(i).concat(r(a)),s=function(t,e,n){var r={},i=[];return n.visit(n.SOURCE,(function(e){var n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort((function(t,e){return(t<e||null==t)&&null!=e?-1:(t>e||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)})),e?i.slice(0,e):i}(i,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((function(){return u})),fields:s.map((function(t){return function(t,n,r,i){return e((function(e){return n(e)===t?r(e):NaN}),i,t+"")}(t,i,a,o)})),as:s.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,n),n)},rt(cu,qa).transform=function(t,e){var n=this,a=t.subflow,u=t.field;return(t.modified("field")||u&&e.modified(r(u)))&&i("PreFacet does not support field modification."),this._targets.active=0,e.visit(e.MOD,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.mod(t)})):r.mod(t)})),e.visit(e.ADD,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.add(St(t))})):r.add(t)})),e.visit(e.REM,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.rem(t)})):r.rem(t)})),e},fu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},rt(fu,Hr).transform=function(t,e){var n,r,i=t.fields,a=Fa(t.fields,t.as||[]),u=i?function(t,e){return function(t,e,n,r){for(var i=0,a=n.length;i<a;++i)e[r[i]]=n[i](t);return e}(t,e,i,a)}:zt;return this.value?r=this.value:(e=e.addAll(),r=this.value={}),n=e.fork(e.NO_SOURCE),e.visit(e.REM,(function(t){var e=Ct(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(function(t){var e=u(t,St({}));r[Ct(t)]=e,n.add.push(e)})),e.visit(e.MOD,(function(t){n.mod.push(u(t,r[Ct(t)]))})),n},rt(hu,Hr).transform=function(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation},du.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"]}]};var pu=rt(du,Hr);function gu(t){Hr.call(this,null,t)}function mu(t){Hr.call(this,[],t),this.count=0}function vu(t){Hr.call(this,null,t)}function yu(t){Hr.call(this,null,t),this.modified(!0)}pu.transform=function(t,e){var r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return r.source=this.value,r;const a=Sa(e.materialize(e.SOURCE).source,t.groupby,t.field),u=(t.groupby||[]).map(n),o=[],s=t.step||.01,l=t.probs||li(s/2,1-1e-14,s),c=l.length;return a.forEach(t=>{const e=Ai(t,l);for(let n=0;n<c;++n){const r={};for(let e=0;e<u.length;++e)r[u[e]]=t.dims[e];r[i[0]]=l[n],r[i[1]]=e[n],o.push(St(r))}}),this.value&&(r.rem=this.value),this.value=r.add=r.source=o,r},rt(gu,Hr).transform=function(t,e){var n,r;return this.value?r=this.value:(n=e=e.addAll(),r=this.value={}),t.derive&&(n=e.fork(e.NO_SOURCE),e.visit(e.REM,t=>{var e=Ct(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,t=>{var e=Bt(t);r[Ct(t)]=e,n.add.push(e)}),e.visit(e.MOD,t=>{var e,i=r[Ct(t)];for(e in t)i[e]=t[e],n.modifies(e);n.mod.push(i)})),n},mu.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},rt(mu,Hr).transform=function(e,n){var r=n.fork(n.NO_SOURCE),i=e.modified("size"),a=e.size,u=this.value,o=this.count,s=0,l=u.reduce((function(t,e){return t[Ct(e)]=1,t}),{});function c(e){var n,i;u.length<a?u.push(e):(i=~~((o+1)*t.random()))<u.length&&i>=s&&(n=u[i],l[Ct(n)]&&r.rem.push(n),u[i]=e),++o}if(n.rem.length&&(n.visit(n.REM,(function(t){var e=Ct(t);l[e]&&(l[e]=-1,r.rem.push(t)),--o})),u=u.filter((function(t){return-1!==l[Ct(t)]}))),(n.rem.length||i)&&u.length<a&&n.source&&(s=o=u.length,n.visit(n.SOURCE,(function(t){l[Ct(t)]||c(t)})),s=-1),i&&u.length>a){for(var f=0,h=u.length-a;f<h;++f)l[Ct(u[f])]=-1,r.rem.push(u[f]);u=u.slice(h)}return n.mod.length&&n.visit(n.MOD,(function(t){l[Ct(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||s<0)&&(r.add=u.filter((function(t){return!l[Ct(t)]}))),this.count=o,this.value=r.source=u,r},vu.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"}]},rt(vu,Hr).transform=function(t,e){if(!this.value||t.modified()){var n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=li(t.start,t.stop,t.step||1).map((function(t){var e={};return e[r]=t,St(e)})),n.add=e.add.concat(this.value),n}},rt(yu,Hr).transform=function(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation};const _u="year",xu="quarter",bu="month",wu="week",Au="date",ku="day",Mu="hours",Eu="minutes",Du="seconds",Cu="milliseconds",Fu=[_u,xu,bu,wu,Au,ku,Mu,Eu,Du,Cu].reduce((t,e,n)=>(t[e]=1+n,t),{});function Su(t){const e=I(t).slice(),n={};return e.length||i("Missing time unit."),e.forEach(t=>{K(Fu,t)?n[t]=1:i(`Invalid time unit: ${t}.`)}),(n[wu]||n[ku])&&(n[xu]||n[bu]||n[Au])&&i(`Incompatible time units: ${t}`),e.sort((t,e)=>Fu[t]-Fu[e]),e}const Bu=new Date;function zu(t,e,n,r,i){const a=e||1,u=k(t),o=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===u&&a,e),s=new Date,l=xt(t),c=l[_u]?o(_u):V(2012),f=l[bu]?o(bu):l[xu]?o(xu):p,h=l[wu]&&l[ku]?o(ku,1,wu+ku):l[wu]?o(wu,1):l[ku]?o(ku,1):l[Au]?o(Au,1):g,d=l[Mu]?o(Mu):p,m=l[Eu]?o(Eu):p,v=l[Du]?o(Du):p,y=l[Cu]?o(Cu):p;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),d(s),m(s),v(s),y(s))}}function Tu(t,e,n){return e+7*t-(n+6)%7}const Nu={[_u]:t=>t.getFullYear(),[xu]:t=>Math.floor(t.getMonth()/3),[bu]:t=>t.getMonth(),[Au]:t=>t.getDate(),[Mu]:t=>t.getHours(),[Eu]:t=>t.getMinutes(),[Du]:t=>t.getSeconds(),[Cu]:t=>t.getMilliseconds(),[wu]:t=>qu(t),[wu+ku]:(t,e)=>Tu(qu(t),t.getDay(),Uu(e)),[ku]:(t,e)=>Tu(1,t.getDay(),Uu(e))},Ou={[xu]:t=>3*t,[wu]:(t,e)=>Tu(t,0,Uu(e))};function Ru(t){return Bu.setFullYear(t),Bu.setMonth(0),Bu.setDate(1),Bu.setHours(0,0,0,0),Bu}function qu(t){return je.count(Ru(t.getFullYear())-1,t)}function Uu(t){return Ru(t).getDay()}function Lu(t,e,n,r,i,a,u){if(0<=t&&t<100){var o=new Date(-1,e,n,r,i,a,u);return o.setFullYear(t),o}return new Date(t,e,n,r,i,a,u)}function Pu(t,e){return zu(t,e||1,Nu,Ou,Lu)}const $u={[_u]:t=>t.getUTCFullYear(),[xu]:t=>Math.floor(t.getUTCMonth()/3),[bu]:t=>t.getUTCMonth(),[Au]:t=>t.getUTCDate(),[Mu]:t=>t.getUTCHours(),[Eu]:t=>t.getUTCMinutes(),[Du]:t=>t.getUTCSeconds(),[Cu]:t=>t.getUTCMilliseconds(),[wu]:t=>Iu(t),[ku]:(t,e)=>Tu(1,t.getUTCDay(),Hu(e)),[wu+ku]:(t,e)=>Tu(Iu(t),t.getUTCDay(),Hu(e))},ju={[xu]:t=>3*t,[wu]:(t,e)=>Tu(t,0,Hu(e))};function Iu(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Ze.count(e-1,t)}function Hu(t){return Bu.setTime(Date.UTC(t,0,1)),Bu.getUTCDay()}function Wu(t,e,n,r,i,a,u){if(0<=t&&t<100){var o=new Date(Date.UTC(-1,e,n,r,i,a,u));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(t,e,n,r,i,a,u))}function Yu(t,e){return zu(t,e||1,$u,ju,Wu)}const Vu={[_u]:Ye,[xu]:We.every(3),[bu]:We,[wu]:je,[Au]:Pe,[ku]:Pe,[Mu]:Le,[Eu]:Ue,[Du]:qe,[Cu]:Re},Gu={[_u]:en,[xu]:tn.every(3),[bu]:tn,[wu]:Ze,[Au]:Xe,[ku]:Xe,[Mu]:Ge,[Eu]:Ve,[Du]:qe,[Cu]:Re};function Xu(t){return Vu[t]}function Ju(t){return Gu[t]}function Zu(t,e,n){return t?t.offset(e,n):void 0}function Qu(t,e,n){return Zu(Xu(t),e,n)}function Ku(t,e,n){return Zu(Ju(t),e,n)}function to(t,e,n,r){return t?t.range(e,n,r):void 0}function eo(t,e,n,r){return to(Xu(t),e,n,r)}function no(t,e,n,r){return to(Ju(t),e,n,r)}const ro={[_u]:"%Y ",[xu]:"Q%q ",[bu]:"%b ",[Au]:"%d ",[wu]:"W%U ",[ku]:"%a ",[Mu]:"%H:00",[Eu]:"00:%M",[Du]:":%S",[Cu]:".%L",[`${_u}-${bu}`]:"%Y-%m ",[`${_u}-${bu}-${Au}`]:"%Y-%m-%d ",[`${Mu}-${Eu}`]:"%H:%M"};function io(t,e){const n=X({},ro,e),r=Su(t),i=r.length;let a,u,o="",s=0;for(s=0;s<i;)for(a=r.length;a>s;--a)if(u=r.slice(s,a).join("-"),null!=n[u]){o+=n[u],s=a;break}return o.trim()}function ao(t){return oo(on,Xu,t)}function uo(t){return oo(ln,Ju,t)}function oo(t,e,n){return s(n)?t(n):function(t,e,n){o(n=n||{})||i(`Invalid time multi-format specifier: ${n}`);const r=e(Du),a=e(Eu),u=e(Mu),s=e(Au),l=e(wu),c=e(bu),f=e(xu),h=e(_u),d=t(n[Cu]||".%L"),p=t(n[Du]||":%S"),g=t(n[Eu]||"%I:%M"),m=t(n[Mu]||"%I %p"),v=t(n[Au]||n[ku]||"%a %d"),y=t(n[wu]||"%b %d"),_=t(n[bu]||"%B"),x=t(n[xu]||"%B"),b=t(n[_u]||"%Y");return function(t){return(r(t)<t?d:a(t)<t?p:u(t)<t?g:s(t)<t?m:c(t)<t?l(t)<t?v:y:h(t)<t?f(t)<t?_:x:b)(t)}}(t,e,n)}const so=[_u,bu,Au,Mu,Eu,Du,Cu],lo=so.slice(0,-1),co=lo.slice(0,-1),fo=co.slice(0,-1),ho=fo.slice(0,-1),po=[_u,bu],go=[_u],mo=[[lo,1,1e3],[lo,5,5e3],[lo,15,15e3],[lo,30,3e4],[co,1,6e4],[co,5,3e5],[co,15,9e5],[co,30,18e5],[fo,1,36e5],[fo,3,108e5],[fo,6,216e5],[fo,12,432e5],[ho,1,864e5],[[_u,wu],1,6048e5],[po,1,2592e6],[po,3,7776e6],[go,1,31536e6]];function vo(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(gt(e))/n;let i,a,u=ai(t=>t[2]).right(mo,r);return u===mo.length?(i=go,a=gi(e[0]/31536e6,e[1]/31536e6,n)):u?(u=mo[r/mo[u-1][2]<mo[u][2]/r?u-1:u],i=u[0],a=u[1]):(i=so,a=Math.max(gi(e[0],e[1],n),1)),{units:i,step:a}}function yo(t){Hr.call(this,null,t)}const _o=["unit0","unit1"];yo.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"string",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:_o}]};var xo=rt(yo,Hr);function bo(t){Hr.call(this,et(),t)}function wo(t){Hr.call(this,null,t)}xo.transform=function(t,e){var n=t.field,i=!1!==t.interval,a="utc"===t.timezone,u=this._floor(t,e),o=(a?Ju:Xu)(u.unit).offset,s=t.as||_o,l=s[0],c=s[1],f=u.start||1/0,h=u.stop||-1/0,d=u.step,p=e.ADD;return(t.modified()||e.modified(r(n)))&&(p=(e=e.reflow(!0)).SOURCE,f=1/0,h=-1/0),e.visit(p,(function(t){var e,r,a=n(t);null==a?(t[l]=null,i&&(t[c]=null)):(t[l]=e=r=u(a),i&&(t[c]=r=o(e,d)),e<f&&(f=e),r>h&&(h=r))})),u.start=f,u.stop=h,e.modifies(i?s:l)},xo._floor=function(t,e){const n="utc"===t.timezone;let{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:vo({extent:t.extent||J(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins});r=Su(r);const a=this.value||{},u=(n?Yu:Pu)(r,i);return u.unit=k(r),u.units=r,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u},rt(bo,Hr).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,a=!0;function u(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,u)):e.changed()?(e.visit(e.REM,(function(t){i.delete(r(t))})),e.visit(e.ADD,u)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},rt(wo,Hr).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(Nt(t.sort)):e.source).map(t.field))};const Ao={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){let t=Ao.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{let n=e.index,r=e.data,i=e.compare;if(t<n){for(;n+1<r.length&&!i(r[n],r[n+1]);)++n;t=n}return(1+t)/r.length}}},ntile:function(t,e){(e=+e)>0||i("ntile num must be greater than zero.");let n=Ao.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{let r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{let r=n.index+e,i=n.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:e=>t(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||i("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(e-1);return r<n.i1?t(n.data[r]):null}}},prev_value:function(t){let e;return{init:()=>e=null,next:n=>{let r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{let i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;n<r;++n){if(null!=t(e[n]))return n}return-1}(t,i,r.index))<0?(n=i.length,e=null):e=t(i[n])}}}};var ko=Object.keys(Ao);function Mo(t){let e=this,a=I(t.ops),u=I(t.fields),o=I(t.params),s=I(t.as),l=e.outputs=[],c=e.windows=[],f={},h={},d=!0,g=[],m=[];function v(t){I(r(t)).forEach(t=>f[t]=1)}v(t.sort),a.forEach((function(t,e){let r=u[e],a=n(r),f=Jr(t,a,s[e]);if(v(r),l.push(f),K(Ao,t))c.push(function(t,e,n,r){let i=Ao[t](e,n);return{init:i.init||p,update:function(t,e){e[r]=i.next(t)}}}(t,u[e],o[e],f));else{if(null==r&&"count"!==t&&i("Null aggregate field specified."),"count"===t)return void g.push(f);d=!1;let e=h[a];e||(e=h[a]=[],e.field=r,m.push(e)),e.push(Kr(t,f))}})),(g.length||m.length)&&(e.cell=function(t,e,n){t=t.map(t=>ni(t,t.field));let r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,a=r.agg=Array(i),u=0;u<i;++u)a[u]=new t[u](r);if(r.store)var o=r.data=new ha;return r.add=function(t){if(r.num+=1,!n){o&&o.add(t);for(let e=0;e<i;++e)a[e].add(a[e].get(t),t)}},r.rem=function(t){if(r.num-=1,!n){o&&o.rem(t);for(let e=0;e<i;++e)a[e].rem(a[e].get(t),t)}},r.set=function(t){let i,u;for(o&&o.values(),i=0,u=e.length;i<u;++i)t[e[i]]=r.num;if(!n)for(i=0,u=a.length;i<u;++i)a[i].set(t)},r.init=function(){r.num=0,o&&o.reset();for(let t=0;t<i;++t)a[t].init()},r}(m,g,d)),e.inputs=Object.keys(f)}const Eo=Mo.prototype;function Do(t){Hr.call(this,{},t),this._mlen=0,this._mods=[]}Eo.init=function(){this.windows.forEach(t=>t.init()),this.cell&&this.cell.init()},Eo.update=function(t,e){let n,r=this.cell,i=this.windows,a=t.data,u=i&&i.length;if(r){for(n=t.p0;n<t.i0;++n)r.rem(a[n]);for(n=t.p1;n<t.i1;++n)r.add(a[n]);r.set(e)}for(n=0;n<u;++n)i[n].update(t,e)},Do.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ko.concat(Qr)},{name:"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}]};var Co=rt(Do,Hr);function Fo(t,e,n,r){var i=r.sort,a=i&&!r.ignorePeers,u=r.frame||[null,0],o=t.data(n),s=o.length,l=0,c=a?ai(i):null,f={i0:0,i1:0,p0:0,p1:0,index:0,data:o,compare:i||V(-1)};for(e.init();l<s;++l)So(f,u,l,s),a&&Bo(f,c),e.update(f,o[l])}function So(t,e,n,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==e[0]?0:Math.max(0,n-Math.abs(e[0])),t.i1=null==e[1]?r:Math.min(r,n+Math.abs(e[1])+1),t.index=n}function Bo(t,e){var n=t.i0,r=t.i1-1,i=t.compare,a=t.data,u=a.length-1;n>0&&!i(a[n],a[n-1])&&(t.i0=e.left(a,a[n])),r<u&&!i(a[r],a[r+1])&&(t.i1=e.right(a,a[r]))}Co.transform=function(t,e){var n,r,i=this,a=i.state,u=t.modified(),o=Nt(t.sort);this.stamp=e.stamp,a&&!u||(a=i.state=new Mo(t));var s=Xr(t.groupby);function l(t){return i.group(s(t))}for(u||e.modified(a.inputs)?(i.value={},e.visit(e.SOURCE,(function(t){l(t).add(t)}))):(e.visit(e.REM,(function(t){l(t).remove(t)})),e.visit(e.ADD,(function(t){l(t).add(t)}))),n=0,r=i._mlen;n<r;++n)Fo(i._mods[n],a,o,t);return i._mlen=0,i._mods=[],e.reflow(u).modifies(a.outputs)},Co.group=function(t){var e=this.value[t];return e||((e=this.value[t]=ya(Ct)).stamp=-1),e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e),e};var zo=Object.freeze({__proto__:null,aggregate:pa,bin:ma,collect:_a,compare:xa,countpattern:wa,cross:ka,density:Ea,dotbin:Ba,expression:za,extent:Na,facet:qa,field:La,filter:$a,flatten:ja,fold:Ia,formula:Ha,generate:Wa,impute:Ga,joinaggregate:Xa,kde:Za,key:Qa,load:tu,lookup:nu,multiextent:ru,multivalues:au,params:ou,pivot:su,prefacet:cu,project:fu,proxy:hu,quantile:du,relay:gu,sample:mu,sequence:vu,sieve:yu,subflow:Oa,timeunit:yo,tupleindex:bo,values:wo,window:Do});const To="top",No="left",Oo="right",Ro="end",qo="row";function Uo(t){this.clear(),t&&this.union(t)}var Lo=Uo.prototype;Lo.clone=function(){return new Uo(this)},Lo.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},Lo.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},Lo.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},Lo.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},Lo.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},Lo.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},Lo.round=function(){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},Lo.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},Lo.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},Lo.rotate=function(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},Lo.rotatedPoints=function(t,e,n){var{x1:r,y1:i,x2:a,y2:u}=this,o=Math.cos(t),s=Math.sin(t),l=e-e*o+n*s,c=n-e*s-n*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},Lo.union=function(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},Lo.intersect=function(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},Lo.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},Lo.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},Lo.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},Lo.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},Lo.width=function(){return this.x2-this.x1},Lo.height=function(){return this.y2-this.y1};var Po=0;function $o(t){return t&&t.gradient}function jo(t,e,n){let r=t.id,i=t.gradient,a="radial"===i?"p_":"";return r||(r=t.id="gradient_"+Po++,"radial"===i?(t.x1=Io(t.x1,.5),t.y1=Io(t.y1,.5),t.r1=Io(t.r1,0),t.x2=Io(t.x2,.5),t.y2=Io(t.y2,.5),t.r2=Io(t.r2,.5),a="p_"):(t.x1=Io(t.x1,0),t.y1=Io(t.y1,0),t.x2=Io(t.x2,1),t.y2=Io(t.y2,0))),e[r]=t,"url("+(n||"")+"#"+a+r+")"}function Io(t,e){return null!=t?t:e}function Ho(t,e){var n,r=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}function Wo(t){this.mark=t,this.bounds=this.bounds||new Uo}function Yo(t){Wo.call(this,t),this.items=this.items||[]}function Vo(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}function Go(){return"undefined"!=typeof Image?Image:null}function Xo(t){this._pending=0,this._loader=t||kr()}rt(Yo,Wo);var Jo=Xo.prototype;function Zo(t){t._pending+=1}function Qo(t){t._pending-=1}Jo.pending=function(){return this._pending},Jo.sanitizeURL=function(t){var e=this;return Zo(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return Qo(e),t})).catch((function(){return Qo(e),null}))},Jo.loadImage=function(t){const e=this,n=Go();return Zo(e),e._loader.sanitize(t,{context:"image"}).then((function(t){const r=t.href;if(!r||!n)throw{url:r};const i=new n,a=K(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=()=>Qo(e),i.onerror=()=>Qo(e),i.src=r,i})).catch((function(t){return Qo(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},Jo.ready=function(){var t=this;return new Promise((function(e){!function n(r){t.pending()?setTimeout((function(){n(!0)}),10):e(r)}(!1)}))};var Ko=Math.PI,ts=2*Ko,es=ts-1e-6;function ns(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function rs(){return new ns}function is(t){return function(){return t}}ns.prototype=rs.prototype={constructor:ns,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var a=this._x1,u=this._y1,o=n-t,s=r-e,l=a-t,c=u-e,f=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>1e-6)if(Math.abs(c*o-s*l)>1e-6&&i){var h=n-a,d=r-u,p=o*o+s*s,g=h*h+d*d,m=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((Ko-Math.acos((p+f-g)/(2*m*v)))/2),_=y/v,x=y/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*o)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e,a=!!a;var u=(n=+n)*Math.cos(r),o=n*Math.sin(r),s=t+u,l=e+o,c=1^a,f=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%ts+ts),f>es?this._+="A"+n+","+n+",0,1,"+c+","+(t-u)+","+(e-o)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=Ko)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var as=Math.abs,us=Math.atan2,os=Math.cos,ss=Math.max,ls=Math.min,cs=Math.sin,fs=Math.sqrt,hs=Math.PI,ds=hs/2,ps=2*hs;function gs(t){return t>1?0:t<-1?hs:Math.acos(t)}function ms(t){return t>=1?ds:t<=-1?-ds:Math.asin(t)}function vs(t){return t.innerRadius}function ys(t){return t.outerRadius}function _s(t){return t.startAngle}function xs(t){return t.endAngle}function bs(t){return t&&t.padAngle}function ws(t,e,n,r,i,a,u,o){var s=n-t,l=r-e,c=u-i,f=o-a,h=f*s-c*l;if(!(h*h<1e-12))return[t+(h=(c*(e-a)-f*(t-i))/h)*s,e+h*l]}function As(t,e,n,r,i,a,u){var o=t-n,s=e-r,l=(u?a:-a)/fs(o*o+s*s),c=l*s,f=-l*o,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,v=(d+g)/2,y=p-h,_=g-d,x=y*y+_*_,b=i-a,w=h*g-p*d,A=(_<0?-1:1)*fs(ss(0,b*b*x-w*w)),k=(w*_-y*A)/x,M=(-w*y-_*A)/x,E=(w*_+y*A)/x,D=(-w*y+_*A)/x,C=k-m,F=M-v,S=E-m,B=D-v;return C*C+F*F>S*S+B*B&&(k=E,M=D),{cx:k,cy:M,x01:-c,y01:-f,x11:k*(i/b-1),y11:M*(i/b-1)}}function ks(t){this._context=t}function Ms(t){return new ks(t)}function Es(t){return t[0]}function Ds(t){return t[1]}function Cs(){var t=Es,e=Ds,n=is(!0),r=null,i=Ms,a=null;function u(u){var o,s,l,c=u.length,f=!1;for(null==r&&(a=i(l=rs())),o=0;o<=c;++o)!(o<c&&n(s=u[o],o,u))===f&&((f=!f)?a.lineStart():a.lineEnd()),f&&a.point(+t(s,o,u),+e(s,o,u));if(l)return a=null,l+""||null}return u.x=function(e){return arguments.length?(t="function"==typeof e?e:is(+e),u):t},u.y=function(t){return arguments.length?(e="function"==typeof t?t:is(+t),u):e},u.defined=function(t){return arguments.length?(n="function"==typeof t?t:is(!!t),u):n},u.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),u):r},u}function Fs(){var t=Es,e=null,n=is(0),r=Ds,i=is(!0),a=null,u=Ms,o=null;function s(s){var l,c,f,h,d,p=s.length,g=!1,m=new Array(p),v=new Array(p);for(null==a&&(o=u(d=rs())),l=0;l<=p;++l){if(!(l<p&&i(h=s[l],l,s))===g)if(g=!g)c=l,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),f=l-1;f>=c;--f)o.point(m[f],v[f]);o.lineEnd(),o.areaEnd()}g&&(m[l]=+t(h,l,s),v[l]=+n(h,l,s),o.point(e?+e(h,l,s):m[l],r?+r(h,l,s):v[l]))}if(d)return o=null,d+""||null}function l(){return Cs().defined(i).curve(u).context(a)}return s.x=function(n){return arguments.length?(t="function"==typeof n?n:is(+n),e=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:is(+e),s):t},s.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:is(+t),s):e},s.y=function(t){return arguments.length?(n="function"==typeof t?t:is(+t),r=null,s):n},s.y0=function(t){return arguments.length?(n="function"==typeof t?t:is(+t),s):n},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:is(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(n)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(e).y(n)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:is(!!t),s):i},s.curve=function(t){return arguments.length?(u=t,null!=a&&(o=u(a)),s):u},s.context=function(t){return arguments.length?(null==t?a=o=null:o=u(a=t),s):a},s}ks.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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Ss={draw:function(t,e){var n=Math.sqrt(e/hs);t.moveTo(n,0),t.arc(0,0,n,0,ps)}};function Bs(){}function zs(t,e,n){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+e)/6,(t._y0+4*t._y1+n)/6)}function Ts(t){this._context=t}function Ns(t){this._context=t}function Os(t){this._context=t}function Rs(t,e){this._basis=new Ts(t),this._beta=e}Ts.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:zs(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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Ns.prototype={areaStart:Bs,areaEnd:Bs,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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Os.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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Rs.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],a=e[0],u=t[n]-i,o=e[n]-a,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*e[s]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var qs=function t(e){function n(t){return 1===e?new Ts(t):new Rs(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Us(t,e,n){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-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Ls(t,e){this._context=t,this._k=(1-e)/6}Ls.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:Us(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ps=function t(e){function n(t){return new Ls(t,e)}return n.tension=function(e){return t(+e)},n}(0);function $s(t,e){this._context=t,this._k=(1-e)/6}$s.prototype={areaStart:Bs,areaEnd:Bs,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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var js=function t(e){function n(t){return new $s(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Is(t,e){this._context=t,this._k=(1-e)/6}Is.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,e){switch(t=+t,e=+e,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:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Hs=function t(e){function n(t){return new Is(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ws(t,e,n){var r=t._x1,i=t._y1,a=t._x2,u=t._y2;if(t._l01_a>1e-12){var o=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*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>1e-12){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-e*t._l12_2a)/c,u=(u*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,u,t._x2,t._y2)}function Ys(t,e){this._context=t,this._alpha=e}Ys.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,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Ws(this,t,e)}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=e}};var Vs=function t(e){function n(t){return e?new Ys(t,e):new Ls(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Gs(t,e){this._context=t,this._alpha=e}Gs.prototype={areaStart:Bs,areaEnd:Bs,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,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Ws(this,t,e)}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=e}};var Xs=function t(e){function n(t){return e?new Gs(t,e):new $s(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Js(t,e){this._context=t,this._alpha=e}Js.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,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+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:Ws(this,t,e)}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=e}};var Zs=function t(e){function n(t){return e?new Js(t,e):new Is(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Qs(t){this._context=t}function Ks(t){return t<0?-1:1}function tl(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),u=(n-t._y1)/(i||r<0&&-0),o=(a*i+u*r)/(r+i);return(Ks(a)+Ks(u))*Math.min(Math.abs(a),Math.abs(u),.5*Math.abs(o))||0}function el(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nl(t,e,n){var r=t._x0,i=t._y0,a=t._x1,u=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*e,a-o,u-o*n,a,u)}function rl(t){this._context=t}function il(t){this._context=new al(t)}function al(t){this._context=t}function ul(t){this._context=t}function ol(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),u=new Array(r);for(i[0]=0,a[0]=2,u[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,u[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,u[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,u[e]-=n*u[e-1];for(i[r-1]=u[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(u[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function sl(t,e){this._context=t,this._t=e}Qs.prototype={areaStart:Bs,areaEnd:Bs,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},rl.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:nl(this,this._t0,el(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nl(this,el(this,n=tl(this,t,e)),n);break;default:nl(this,this._t0,n=tl(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(il.prototype=Object.create(rl.prototype)).point=function(t,e){rl.prototype.point.call(this,e,t)},al.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}},ul.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=ol(t),i=ol(e),a=0,u=1;u<n;++a,++u)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[u],e[u]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},sl.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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var ll={basis:{curve:function(t){return new Ts(t)}},"basis-closed":{curve:function(t){return new Ns(t)}},"basis-open":{curve:function(t){return new Os(t)}},bundle:{curve:qs,tension:"beta",value:.85},cardinal:{curve:Ps,tension:"tension",value:0},"cardinal-open":{curve:Hs,tension:"tension",value:0},"cardinal-closed":{curve:js,tension:"tension",value:0},"catmull-rom":{curve:Vs,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Xs,tension:"alpha",value:.5},"catmull-rom-open":{curve:Zs,tension:"alpha",value:.5},linear:{curve:Ms},"linear-closed":{curve:function(t){return new Qs(t)}},monotone:{horizontal:function(t){return new il(t)},vertical:function(t){return new rl(t)}},natural:{curve:function(t){return new ul(t)}},step:{curve:function(t){return new sl(t,.5)}},"step-after":{curve:function(t){return new sl(t,1)}},"step-before":{curve:function(t){return new sl(t,0)}}};function cl(t,e,n){var r=K(ll,t)&&ll[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var fl={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},hl=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function dl(t){var e,n,r,i,a,u,o,s,l,c,f,h=[];for(s=0,c=(e=t.slice().replace(hl[0],"###$1").split(hl[1]).slice(1)).length;s<c;++s){for(r=(n=e[s]).slice(1).trim().replace(hl[2],"$1###$2").split(hl[3]),i=[u=n.charAt(0)],l=0,f=r.length;l<f;++l)(a=+r[l])===a&&i.push(a);if(o=fl[u.toLowerCase()],i.length-1>o)for(l=1,f=i.length;l<f;l+=o)h.push([u].concat(i.slice(l,l+o)));else h.push(i)}return h}const pl=Math.PI/180,gl=Math.PI/2,ml=2*Math.PI,vl=Math.sqrt(3)/2;var yl={},_l={},xl=[].join;function bl(t){var e=xl.call(t);if(_l[e])return _l[e];var n=t[0],r=t[1],i=t[2],a=t[3],u=t[4],o=t[5],s=t[6],l=t[7],c=l*u,f=-s*o,h=s*u,d=l*o,p=Math.cos(i),g=Math.sin(i),m=Math.cos(a),v=Math.sin(a),y=.5*(a-i),_=Math.sin(.5*y),x=8/3*_*_/Math.sin(y),b=n+p-x*g,w=r+g+x*p,A=n+m,k=r+v,M=A+x*v,E=k-x*m;return _l[e]=[c*b+f*w,h*b+d*w,c*M+f*E,h*M+d*E,c*A+f*k,h*A+d*k]}var wl=["l",0,0,0,0,0,0,0];function Al(t,e,n){var r=wl[0]=t[0];if("a"===r||"A"===r)wl[1]=e*t[1],wl[2]=n*t[2],wl[3]=t[3],wl[4]=t[4],wl[5]=t[5],wl[6]=e*t[6],wl[7]=n*t[7];else if("h"===r||"H"===r)wl[1]=e*t[1];else if("v"===r||"V"===r)wl[1]=n*t[1];else for(var i=1,a=t.length;i<a;++i)wl[i]=(i%2==1?e:n)*t[i];return wl}function kl(t,e,n,r,i,a){var u,o,s,l,c,f=null,h=0,d=0,p=0,g=0;null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),null==a&&(a=i),t.beginPath&&t.beginPath();for(var m=0,v=e.length;m<v;++m){switch(u=e[m],1===i&&1===a||(u=Al(u,i,a)),u[0]){case"l":h+=u[1],d+=u[2],t.lineTo(h+n,d+r);break;case"L":h=u[1],d=u[2],t.lineTo(h+n,d+r);break;case"h":h+=u[1],t.lineTo(h+n,d+r);break;case"H":h=u[1],t.lineTo(h+n,d+r);break;case"v":d+=u[1],t.lineTo(h+n,d+r);break;case"V":d=u[1],t.lineTo(h+n,d+r);break;case"m":h+=u[1],d+=u[2],t.moveTo(h+n,d+r);break;case"M":h=u[1],d=u[2],t.moveTo(h+n,d+r);break;case"c":o=h+u[5],s=d+u[6],p=h+u[3],g=d+u[4],t.bezierCurveTo(h+u[1]+n,d+u[2]+r,p+n,g+r,o+n,s+r),h=o,d=s;break;case"C":h=u[5],d=u[6],p=u[3],g=u[4],t.bezierCurveTo(u[1]+n,u[2]+r,p+n,g+r,h+n,d+r);break;case"s":o=h+u[3],s=d+u[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,h+u[1]+n,d+u[2]+r,o+n,s+r),p=h+u[1],g=d+u[2],h=o,d=s;break;case"S":o=u[3],s=u[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,u[1]+n,u[2]+r,o+n,s+r),h=o,d=s,p=u[1],g=u[2];break;case"q":o=h+u[3],s=d+u[4],p=h+u[1],g=d+u[2],t.quadraticCurveTo(p+n,g+r,o+n,s+r),h=o,d=s;break;case"Q":o=u[3],s=u[4],t.quadraticCurveTo(u[1]+n,u[2]+r,o+n,s+r),h=o,d=s,p=u[1],g=u[2];break;case"t":o=h+u[1],s=d+u[2],null===f[0].match(/[QqTt]/)?(p=h,g=d):"t"===f[0]?(p=2*h-l,g=2*d-c):"q"===f[0]&&(p=2*h-p,g=2*d-g),l=p,c=g,t.quadraticCurveTo(p+n,g+r,o+n,s+r),d=s,p=(h=o)+u[1],g=d+u[2];break;case"T":o=u[1],s=u[2],p=2*h-p,g=2*d-g,t.quadraticCurveTo(p+n,g+r,o+n,s+r),h=o,d=s;break;case"a":Ml(t,h+n,d+r,[u[1],u[2],u[3],u[4],u[5],u[6]+h+n,u[7]+d+r]),h+=u[6],d+=u[7];break;case"A":Ml(t,h+n,d+r,[u[1],u[2],u[3],u[4],u[5],u[6]+n,u[7]+r]),h=u[6],d=u[7];break;case"z":case"Z":t.closePath()}f=u}}function Ml(t,e,n,r){for(var i=function(t,e,n,r,i,a,u,o,s){var l=xl.call(arguments);if(yl[l])return yl[l];var c=u*pl,f=Math.sin(c),h=Math.cos(c),d=h*(o-t)*.5+f*(s-e)*.5,p=h*(s-e)*.5-f*(o-t)*.5,g=d*d/((n=Math.abs(n))*n)+p*p/((r=Math.abs(r))*r);g>1&&(n*=g=Math.sqrt(g),r*=g);var m=h/n,v=f/n,y=-f/r,_=h/r,x=m*o+v*s,b=y*o+_*s,w=m*t+v*e,A=y*t+_*e,k=(w-x)*(w-x)+(A-b)*(A-b),M=1/k-.25;M<0&&(M=0);var E=Math.sqrt(M);a==i&&(E=-E);var D=.5*(x+w)-E*(A-b),C=.5*(b+A)+E*(w-x),F=Math.atan2(b-C,x-D),S=Math.atan2(A-C,w-D),B=S-F;B<0&&1===a?B+=ml:B>0&&0===a&&(B-=ml);for(var z=Math.ceil(Math.abs(B/(gl+.001))),T=[],N=0;N<z;++N){var O=F+N*B/z,R=F+(N+1)*B/z;T[N]=[D,C,O,R,n,r,f,h]}return yl[l]=T}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n),a=0;a<i.length;++a){var u=bl(i[a]);t.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5])}}var El=.5773502691896257,Dl={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,ml)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/2.5;t.moveTo(-n,-r),t.lineTo(-n,r),t.lineTo(-r,r),t.lineTo(-r,n),t.lineTo(r,n),t.lineTo(r,r),t.lineTo(n,r),t.lineTo(n,-r),t.lineTo(r,-r),t.lineTo(r,-n),t.lineTo(-r,-n),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/7,i=n/2.5,a=n/8;t.moveTo(-r,n),t.lineTo(r,n),t.lineTo(r,-a),t.lineTo(i,-a),t.lineTo(0,-n),t.lineTo(-i,-a),t.lineTo(-r,-a),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n,i=r-n*El,a=n/4;t.moveTo(0,-r-i),t.lineTo(-a,r-i),t.lineTo(a,r-i),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n,i=r-n*El;t.moveTo(0,-r-i),t.lineTo(-n,r-i),t.lineTo(n,r-i),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n;t.moveTo(0,-r),t.lineTo(-n,r),t.lineTo(n,r),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n;t.moveTo(0,r),t.lineTo(-n,-r),t.lineTo(n,-r),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n;t.moveTo(r,0),t.lineTo(-r,-n),t.lineTo(-r,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,r=vl*n;t.moveTo(-r,0),t.lineTo(r,-n),t.lineTo(r,n),t.closePath()}},stroke:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function Cl(t){return K(Dl,t)?Dl[t]:function(t){if(!K(Fl,t)){var e=dl(t);Fl[t]={draw:function(t,n){kl(t,e,0,0,Math.sqrt(n)/2)}}}return Fl[t]}(t)}var Fl={};const Sl=.448084975506;function Bl(t){return t.x}function zl(t){return t.y}function Tl(t){return t.width}function Nl(t){return t.height}function Ol(t){return"function"==typeof t?t:()=>+t}function Rl(t,e,n){return Math.max(e,Math.min(t,n))}function ql(){var t=Bl,e=zl,n=Tl,r=Nl,i=Ol(0),a=i,u=i,o=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),v=Math.min(g,m)/2,y=Rl(+i.call(this,l),0,v),_=Rl(+a.call(this,l),0,v),x=Rl(+u.call(this,l),0,v),b=Rl(+o.call(this,l),0,v);if(s||(s=h=rs()),y<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,A=p+m;s.moveTo(d+y,p),s.lineTo(w-_,p),s.bezierCurveTo(w-Sl*_,p,w,p+Sl*_,w,p+_),s.lineTo(w,A-b),s.bezierCurveTo(w,A-Sl*b,w-Sl*b,A,w-b,A),s.lineTo(d+x,A),s.bezierCurveTo(d+Sl*x,A,d,A-Sl*x,d,A-x),s.lineTo(d,p+y),s.bezierCurveTo(d,p+Sl*y,d+Sl*y,p,d+y,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Ol(e),l):t},l.y=function(t){return arguments.length?(e=Ol(t),l):e},l.width=function(t){return arguments.length?(n=Ol(t),l):n},l.height=function(t){return arguments.length?(r=Ol(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Ol(t),a=null!=e?Ol(e):i,o=null!=n?Ol(n):i,u=null!=r?Ol(r):a,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Ul(){var t,e,n,r,i,a,u,o,s=null;function l(t,e,n){var r=n/2;if(i){var l=u-e,c=t-a;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*o,d=(c/=f)*o,p=Math.atan2(c,l);s.moveTo(a-h,u-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(a+h,u+d),s.arc(a,u,o,p,p+Math.PI)}else s.arc(t,e,r,0,ml);s.closePath()}else i=1;a=t,u=e,o=r}function c(a){var u,o,c,f=a.length,h=!1;for(null==s&&(s=c=rs()),u=0;u<=f;++u)!(u<f&&r(o=a[u],u,a))===h&&(h=!h)&&(i=0),h&&l(+t(o,u,a),+e(o,u,a),+n(o,u,a));if(c)return s=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(r=t,c):r},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function Ll(t,e){return null!=t?t:e}const Pl=t=>t.x||0,$l=t=>t.y||0,jl=t=>!(!1===t.defined),Il=function(){var t=vs,e=ys,n=is(0),r=null,i=_s,a=xs,u=bs,o=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-ds,d=a.apply(this,arguments)-ds,p=as(d-h),g=d>h;if(o||(o=s=rs()),f<c&&(l=f,f=c,c=l),f>1e-12)if(p>ps-1e-12)o.moveTo(f*os(h),f*cs(h)),o.arc(0,0,f,h,d,!g),c>1e-12&&(o.moveTo(c*os(d),c*cs(d)),o.arc(0,0,c,d,h,g));else{var m,v,y=h,_=d,x=h,b=d,w=p,A=p,k=u.apply(this,arguments)/2,M=k>1e-12&&(r?+r.apply(this,arguments):fs(c*c+f*f)),E=ls(as(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>1e-12){var F=ms(M/c*cs(k)),S=ms(M/f*cs(k));(w-=2*F)>1e-12?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(A-=2*S)>1e-12?(y+=S*=g?1:-1,_-=S):(A=0,y=_=(h+d)/2)}var B=f*os(y),z=f*cs(y),T=c*os(b),N=c*cs(b);if(E>1e-12){var O,R=f*os(_),q=f*cs(_),U=c*os(x),L=c*cs(x);if(p<hs&&(O=ws(B,z,U,L,R,q,T,N))){var P=B-O[0],$=z-O[1],j=R-O[0],I=q-O[1],H=1/cs(gs((P*j+$*I)/(fs(P*P+$*$)*fs(j*j+I*I)))/2),W=fs(O[0]*O[0]+O[1]*O[1]);D=ls(E,(c-W)/(H-1)),C=ls(E,(f-W)/(H+1))}}A>1e-12?C>1e-12?(m=As(U,L,B,z,f,C,g),v=As(R,q,T,N,f,C,g),o.moveTo(m.cx+m.x01,m.cy+m.y01),C<E?o.arc(m.cx,m.cy,C,us(m.y01,m.x01),us(v.y01,v.x01),!g):(o.arc(m.cx,m.cy,C,us(m.y01,m.x01),us(m.y11,m.x11),!g),o.arc(0,0,f,us(m.cy+m.y11,m.cx+m.x11),us(v.cy+v.y11,v.cx+v.x11),!g),o.arc(v.cx,v.cy,C,us(v.y11,v.x11),us(v.y01,v.x01),!g))):(o.moveTo(B,z),o.arc(0,0,f,y,_,!g)):o.moveTo(B,z),c>1e-12&&w>1e-12?D>1e-12?(m=As(T,N,R,q,c,-D,g),v=As(B,z,U,L,c,-D,g),o.lineTo(m.cx+m.x01,m.cy+m.y01),D<E?o.arc(m.cx,m.cy,D,us(m.y01,m.x01),us(v.y01,v.x01),!g):(o.arc(m.cx,m.cy,D,us(m.y01,m.x01),us(m.y11,m.x11),!g),o.arc(0,0,c,us(m.cy+m.y11,m.cx+m.x11),us(v.cy+v.y11,v.cx+v.x11),g),o.arc(v.cx,v.cy,D,us(v.y11,v.x11),us(v.y01,v.x01),!g))):o.arc(0,0,c,b,x,g):o.lineTo(T,N)}else o.moveTo(0,0);if(o.closePath(),s)return o=null,s+""||null}return s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-hs/2;return[os(r)*n,cs(r)*n]},s.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:is(+e),s):t},s.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:is(+t),s):e},s.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:is(+t),s):n},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:is(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:is(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:is(+t),s):a},s.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:is(+t),s):u},s.context=function(t){return arguments.length?(o=null==t?null:t,s):o},s}().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),Hl=Fs().x(Pl).y1($l).y0(t=>(t.y||0)+(t.height||0)).defined(jl),Wl=Fs().y($l).x1(Pl).x0(t=>(t.x||0)+(t.width||0)).defined(jl),Yl=Cs().x(Pl).y($l).defined(jl),Vl=ql().x(Pl).y($l).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>Ll(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>Ll(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>Ll(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>Ll(t.cornerRadiusBottomLeft,t.cornerRadius)||0),Gl=function(){var t=is(Ss),e=is(64),n=null;function r(){var r;if(n||(n=r=rs()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(e){return arguments.length?(t="function"==typeof e?e:is(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:is(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type(t=>Cl(t.shape||"circle")).size(t=>Ll(t.size,64)),Xl=Ul().x(Pl).y($l).defined(jl).size(t=>t.size||1);function Jl(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Zl(t,e,n,r){return Vl.context(t)(e,n,r)}function Ql(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}var Kl,tc,ec,nc=ml-1e-8;function rc(t){return Kl=t,rc}function ic(){}function ac(t,e){Kl.add(t,e)}function uc(t,e){ac(tc=t,ec=e)}function oc(t){ac(t,Kl.y1)}function sc(t){ac(Kl.x1,t)}function lc(t,e,n,r){const i=(t-e)/(t+n-2*e);0<i&&i<1&&r(t+(e-t)*i)}function cc(t,e,n,r,i){const a=r-t+3*e-3*n,u=t+n-2*e,o=t-e;let s,l=0,c=0;Math.abs(a)>1e-14?(s=u*u+o*a,s>=0&&(s=Math.sqrt(s),l=(-u+s)/a,c=(-u-s)/a)):l=.5*o/u,0<l&&l<1&&i(fc(l,t,e,n,r)),0<c&&c<1&&i(fc(c,t,e,n,r))}function fc(t,e,n,r,i){const a=1-t,u=a*a,o=t*t;return u*a*e+3*u*t*n+3*a*o*r+o*t*i}rc.beginPath=ic,rc.closePath=ic,rc.moveTo=uc,rc.lineTo=uc,rc.rect=function(t,e,n,r){ac(t+n,e+r),uc(t,e)},rc.quadraticCurveTo=function(t,e,n,r){lc(tc,t,n,oc),lc(ec,e,r,sc),uc(n,r)},rc.bezierCurveTo=function(t,e,n,r,i,a){cc(tc,t,n,i,oc),cc(ec,e,r,a,sc),uc(i,a)},rc.arc=function(t,e,n,r,i,a){if(tc=n*Math.cos(i)+t,ec=n*Math.sin(i)+e,Math.abs(i-r)>nc)ac(t-n,e-n),ac(t+n,e+n);else{const u=r=>ac(n*Math.cos(r)+t,n*Math.sin(r)+e);let o,s;if(u(r),u(i),i!==r)if((r%=ml)<0&&(r+=ml),(i%=ml)<0&&(i+=ml),i<r&&(a=!a,o=r,r=i,i=o),a)for(i-=ml,o=r-r%gl,s=0;s<4&&o>i;++s,o-=gl)u(o);else for(o=r-r%gl+gl,s=0;s<4&&o<i;++s,o+=gl)u(o)}};var hc=(hc=Vo(1,1))?hc.getContext("2d"):null;const dc=new Uo;function pc(t){return function(e,n){if(!hc)return!0;t(hc,e),dc.clear().union(e.bounds).intersect(n).round();const{x1:r,y1:i,x2:a,y2:u}=dc;for(let t=i;t<=u;++t)for(let e=r;e<=a;++e)if(hc.isPointInPath(e,t))return!0;return!1}}function gc(t,e){return e.contains(t.x||0,t.y||0)}function mc(t,e){const n=t.x||0,r=t.y||0,i=t.width||0,a=t.height||0;return e.intersects(dc.set(n,r,n+i,r+a))}function vc(t,e){const n=t.x||0,r=t.y||0;return yc(e,n,r,null!=t.x2?t.x2:n,null!=t.y2?t.y2:r)}function yc(t,e,n,r,i){const{x1:a,y1:u,x2:o,y2:s}=t,l=r-e,c=i-n;let f,h,d,p,g=0,m=1;for(p=0;p<4;++p){if(0===p&&(f=-l,h=-(a-e)),1===p&&(f=l,h=o-e),2===p&&(f=-c,h=-(u-n)),3===p&&(f=c,h=s-n),Math.abs(f)<1e-10&&h<0)return!1;if(d=h/f,f<0){if(d>m)return!1;d>g&&(g=d)}else if(f>0){if(d<g)return!1;d<m&&(m=d)}}return!0}function _c(t,e){t.globalCompositeOperation=e.blend||"source-over"}function xc(t,e){return null==t?e:t}function bc(t,e){const n=e.length;for(let r=0;r<n;++r)t.addColorStop(e[r].offset,e[r].color);return t}function wc(t,e,n){return $o(n)?function(t,e,n){const r=n.width(),i=n.height();let a;if("radial"===e.gradient)a=t.createRadialGradient(n.x1+xc(e.x1,.5)*r,n.y1+xc(e.y1,.5)*i,Math.max(r,i)*xc(e.r1,0),n.x1+xc(e.x2,.5)*r,n.y1+xc(e.y2,.5)*i,Math.max(r,i)*xc(e.r2,.5));else{const u=xc(e.x1,0),o=xc(e.y1,0),s=xc(e.x2,1),l=xc(e.y2,0);if(u!==s&&o!==l&&r!==i){const n=Vo(Math.ceil(r),Math.ceil(i)),a=n.getContext("2d");return a.scale(r,i),a.fillStyle=bc(a.createLinearGradient(u,o,s,l),e.stops),a.fillRect(0,0,r,i),t.createPattern(n,"no-repeat")}a=t.createLinearGradient(n.x1+u*r,n.y1+o*i,n.x1+s*r,n.y1+l*i)}return bc(a,e.stops)}(t,n,e.bounds):n}function Ac(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=wc(t,e,e.fill),!0)}var kc=[];function Mc(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=wc(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||kc),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Ec(t,e){return t.zindex-e.zindex||t.index-e.index}function Dc(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,a=[];for(n=0,r=i.length;n<r;++n)(e=i[n]).index=n,e.zindex&&a.push(e);return t.zdirty=!1,t.zitems=a.sort(Ec)}function Cc(t,e){var n,r,i=t.items;if(i&&i.length){var a=Dc(t);if(a&&a.length){for(n=0,r=i.length;n<r;++n)i[n].zindex||e(i[n]);i=a}for(n=0,r=i.length;n<r;++n)e(i[n])}}function Fc(t,e){var n,r,i=t.items;if(!i||!i.length)return null;var a=Dc(t);for(a&&a.length&&(i=a),r=i.length;--r>=0;)if(n=e(i[r]))return n;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Sc(t){return function(e,n,r){Cc(n,(function(n){r&&!r.intersects(n.bounds)||zc(t,e,n,n)}))}}function Bc(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||zc(t,e,n.items[0],n.items)}}function zc(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(_c(e,n),n.fill&&Ac(e,n,i)&&e.fill(),n.stroke&&Mc(e,n,i)&&e.stroke()))}function Tc(t){return t=t||m,function(e,n,r,i,a,u){return r*=e.pixelRatio,i*=e.pixelRatio,Fc(n,(function(n){var o=n.bounds;if((!o||o.contains(a,u))&&o)return t(e,n,r,i,a,u)?n:void 0}))}}function Nc(t,e){return function(n,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,n.lineWidth=null!=u?u:1,n.lineCap=null!=o?o:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a))}}function Oc(t){return Tc(Nc(t))}function Rc(t,e){return"translate("+t+","+e+")"}function qc(t){return"rotate("+t+")"}function Uc(t){return Rc(t.x||0,t.y||0)}function Lc(t){return Rc(t.x||0,t.y||0)+(t.angle?" "+qc(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function Pc(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,a=n.angle||0;t.translate(r,i),a&&t.rotate(a*=pl),t.beginPath(),e(t,n),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Lc(n)),t("d",e(null,n))},bound:function(t,n){var r=n.x||0,i=n.y||0;return e(rc(t),n),Ql(t,n).translate(r,i),n.angle&&t.rotate(n.angle*pl,r,i),t},draw:Sc(r),pick:Oc(r),isect:n||pc(r)}}var $c=Pc("arc",(function(t,e){return Il.context(t)(e)}));function jc(t,e,n){function r(t,n){t.beginPath(),e(t,n)}var i=Nc(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(rc(t),r),Ql(t,r[0]))},draw:Bc(r),pick:function(t,e,n,r,a,u){var o=e.items,s=e.bounds;return!o||!o.length||s&&!s.contains(a,u)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,o,n,r)?o[0]:null)},isect:gc,tip:n}}var Ic=jc("area",(function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Wl:Hl).curve(cl(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],a="horizontal"===t[0].orient?"y":"x",u=t.length,o=1/0;--u>=0;)!1!==t[u].defined&&(r=Math.abs(t[u][a]-i))<o&&(o=r,n=t[u]);return n}));function Hc(t,e){t.beginPath(),Jl(e)?Zl(t,e,0,0):t.rect(0,0,e.width||0,e.height||0),t.clip()}var Wc=1;function Yc(t,e,n){var r=e.clip,i=t._defs,a=e.clip_id||(e.clip_id="clip"+Wc++),u=i.clipping[a]||(i.clipping[a]={id:a});return W(r)?u.path=r(null):Jl(n)?u.path=Zl(null,n,0,0):(u.width=n.width||0,u.height=n.height||0),"url(#"+a+")"}function Vc(t){var e=null!=(e=t.strokeWidth)?e:1;return null!=t.strokeOffset?t.strokeOffset:t.stroke&&e>.5&&e<1.5?.5-Math.abs(e-1):0}function Gc(t,e){var n=Vc(e);t("d",Zl(null,e,n,n))}function Xc(t,e,n,r){var i=Vc(e);t.beginPath(),Zl(t,e,(n||0)+i,(r||0)+i)}var Jc=Nc(Xc),Zc=Nc(Xc,!1);var Qc={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Uc(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,r=0,i=n.length;r<i;++r)t.union(n[r].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),Ql(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var r=this;Cc(e,(function(e){var i=e.x||0,a=e.y||0,u=e.strokeForeground,o=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&o&&(Xc(t,e,i,a),_c(t,e),e.fill&&Ac(t,e,o)&&t.fill(),e.stroke&&!u&&Mc(t,e,o)&&t.stroke()),t.save(),t.translate(i,a),e.clip&&Hc(t,e),n&&n.translate(-i,-a),Cc(e,(function(e){r.draw(t,e,n)})),n&&n.translate(i,a),t.restore(),u&&e.stroke&&o&&(Xc(t,e,i,a),_c(t,e),Mc(t,e,o)&&t.stroke())}))},pick:function(t,e,n,r,i,a){if(e.bounds&&!e.bounds.contains(i,a)||!e.items)return null;var u=this,o=n*t.pixelRatio,s=r*t.pixelRatio;return Fc(e,(function(l){var c,f,h,d,p,g,m,v,y;if((!(v=l.bounds)||v.contains(i,a))&&(d=l.x||0,p=l.y||0,g=d+(l.width||0),m=p+(l.height||0),!(y=l.clip)||!(i<d||i>g||a<d||a>m)))return t.save(),t.translate(d,p),d=i-d,p=a-p,y&&Jl(l)&&!Jc(t,l,o,s)?(t.restore(),null):(f=l.strokeForeground,(h=!1!==e.interactive)&&f&&l.stroke&&Zc(t,l,o,s)?(t.restore(),l):(!(c=Fc(l,(function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,d,p)?u.pick(t,n,r,d,p):null})))&&h&&(l.fill||!f&&l.stroke)&&Jc(t,l,o,s)&&(c=l),t.restore(),c||null))}))},isect:mc,content:function(t,e,n){t("clip-path",e.clip?Yc(n,e,e):null)},background:function(t,e){t("class","background"),Gc(t,e)},foreground:function(t,e){t("class","foreground"),e.strokeForeground?Gc(t,e):t("d","")}};function Kc(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function tf(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function ef(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function nf(t,e){return"center"===t?e/2:"right"===t?e:0}function rf(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var af={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var r=Kc(e,n),i=e.x||0,a=e.y||0,u=tf(e,r),o=ef(e,r),s=!1===e.aspect?"none":"xMidYMid";i-=nf(e.align,u),a-=rf(e.baseline,o),!r.src&&r.toDataURL?t("href",r.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Rc(i,a)),t("width",u),t("height",o),t("preserveAspectRatio",s)},bound:function(t,e){var n=e.image,r=e.x||0,i=e.y||0,a=tf(e,n),u=ef(e,n);return r-=nf(e.align,a),i-=rf(e.baseline,u),t.set(r,i,r+a,i+u)},draw:function(t,e,n){var r=this;Cc(e,(function(e){if(!n||n.intersects(e.bounds)){var i,a,u,o,s=Kc(e,r),l=e.x||0,c=e.y||0,f=tf(e,s),h=ef(e,s);l-=nf(e.align,f),c-=rf(e.baseline,h),!1!==e.aspect&&(a=s.width/s.height,u=e.width/e.height,a==a&&u==u&&a!==u&&(u<a?(c+=(h-(o=f/a))/2,h=o):(l+=(f-(o=h*a))/2,f=o))),(s.complete||s.toDataURL)&&(_c(t,e),t.globalAlpha=null!=(i=e.opacity)?i:1,t.imageSmoothingEnabled=!1!==e.smooth,t.drawImage(s,l,c,f,h))}}))},pick:Tc(),isect:m,get:Kc,xOffset:nf,yOffset:rf},uf=jc("line",(function(t,e){var n=e[0],r=n.interpolate||"linear";return Yl.curve(cl(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i=Math.pow(t[0].strokeWidth||1,2),a=t.length;--a>=0;)if(!1!==t[a].defined&&(n=t[a].x-e[0])*n+(r=t[a].y-e[1])*r<i)return t[a];return null}));function of(t,e){var n=e.path;if(null==n)return!0;var r=e.x||0,i=e.y||0,a=e.scaleX||1,u=e.scaleY||1,o=(e.angle||0)*pl,s=e.pathCache;s&&s.path===n||((e.pathCache=s=dl(n)).path=n),o&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(o),kl(t,s,0,0,a,u),t.rotate(-o),t.translate(-r,-i)):kl(t,s,r,i,a,u)}var sf={type:"path",tag:"path",nested:!1,attr:function(t,e){var n=e.scaleX||1,r=e.scaleY||1;1===n&&1===r||t("vector-effect","non-scaling-stroke"),t("transform",Lc(e)),t("d",e.path)},bound:function(t,e){return of(rc(t),e)?t.set(0,0,0,0):Ql(t,e,!0),e.angle&&t.rotate(e.angle*pl,e.x||0,e.y||0),t},draw:Sc(of),pick:Oc(of),isect:pc(of)};function lf(t,e){t.beginPath(),Zl(t,e)}var cf={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",Zl(null,e))},bound:function(t,e){var n,r;return Ql(t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0),e)},draw:Sc(lf),pick:Oc(lf),isect:mc};function ff(t,e,n){var r,i,a,u;return!(!e.stroke||!Mc(t,e,n))&&(r=e.x||0,i=e.y||0,a=null!=e.x2?e.x2:r,u=null!=e.y2?e.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(a,u),!0)}var hf={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Uc(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,r;return Ql(t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r),e)},draw:function(t,e,n){Cc(e,(function(e){if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&ff(t,e,r)&&(_c(t,e),t.stroke())}}))},pick:Tc((function(t,e,n,r){return!!t.isPointInStroke&&(ff(t,e,1)&&t.isPointInStroke(n,r))})),isect:vc},df=Pc("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),pf=Pc("symbol",(function(t,e){return Gl.context(t)(e)}),gc);const gf=ft();var mf={height:wf,measureWidth:xf,estimateWidth:yf,width:yf,canvas:vf};function vf(t){mf.width=t&&hc?xf:yf}function yf(t,e){return _f(Ef(t,e),wf(t))}function _f(t,e){return~~(.8*t.length*e)}function xf(t,e){return wf(t)<=0||!(e=Ef(t,e))?0:bf(e,Cf(t))}function bf(t,e){const n=`(${e}) ${t}`;let r=gf.get(n);return void 0===r&&(hc.font=e,r=hc.measureText(t).width,gf.set(n,r)),r}function wf(t){return null!=t.fontSize?+t.fontSize||0:11}function Af(t){return null!=t.lineHeight?t.lineHeight:wf(t)+2}function kf(t){return e=t.lineBreak&&t.text&&!u(t.text)?t.text.split(t.lineBreak):t.text,u(e)?e.length>1?e:e[0]:e;var e}function Mf(t){const e=kf(t);return(u(e)?e.length-1:0)*Af(t)}function Ef(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(mf.width===xf){const e=Cf(t);return t=>bf(t,e)}{const e=wf(t);return t=>_f(t,e)}}(t);if(r(e)<n)return e;var i,a=t.ellipsis||"…",u="rtl"===t.dir,o=0,s=e.length;if(n-=r(a),u){for(;o<s;)i=o+s>>>1,r(e.slice(i))>n?o=i+1:s=i;return a+e.slice(o)}for(;o<s;)i=1+(o+s>>>1),r(e.slice(0,i))<n?o=i:s=i-1;return e.slice(0,o)+a}(t,n):n}function Df(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function Cf(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+wf(t)+"px "+Df(t,e)}function Ff(t){var e=t.baseline,n=wf(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:"line-top"===e?.29*n+.5*Af(t):"line-bottom"===e?.29*n-.5*Af(t):0)}vf(!0);var Sf={left:"start",center:"middle",right:"end"},Bf=new Uo;function zf(t){var e,n=t.x||0,r=t.y||0,i=t.radius||0;return i&&(e=(t.theta||0)-gl,n+=i*Math.cos(e),r+=i*Math.sin(e)),Bf.x1=n,Bf.y1=r,Bf}function Tf(t,e,n){var r,i=mf.height(e),a=e.align,o=zf(e),s=o.x1,l=o.y1,c=e.dx||0,f=(e.dy||0)+Ff(e)-Math.round(.8*i),h=kf(e);if(u(h)?(i+=Af(e)*(h.length-1),r=h.reduce((t,n)=>Math.max(t,mf.width(e,n)),0)):r=mf.width(e,h),"center"===a?c-=r/2:"right"===a&&(c-=r),t.set(c+=s,f+=l,c+r,f+i),e.angle&&!n)t.rotate(e.angle*pl,s,l);else if(2===n)return t.rotatedPoints(e.angle*pl,s,l);return t}var Nf={arc:$c,area:Ic,group:Qc,image:af,line:uf,path:sf,rect:cf,rule:hf,shape:df,symbol:pf,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Ff(e),a=zf(e),u=a.x1,o=a.y1,s=e.angle||0;t("text-anchor",Sf[e.align]||"start"),s?(n=Rc(u,o)+" "+qc(s),(r||i)&&(n+=" "+Rc(r,i))):n=Rc(u+r,o+i),t("transform",n)},bound:Tf,draw:function(t,e,n){Cc(e,(function(e){var r,i,a,o,s,l,c,f=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===f||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=Cf(e),t.textAlign=e.align||"left",i=(r=zf(e)).x1,a=r.y1,e.angle&&(t.save(),t.translate(i,a),t.rotate(e.angle*pl),i=a=0),i+=e.dx||0,a+=(e.dy||0)+Ff(e),l=kf(e),_c(t,e),u(l))for(s=Af(e),o=0;o<l.length;++o)c=Ef(e,l[o]),e.fill&&Ac(t,e,f)&&t.fillText(c,i,a),e.stroke&&Mc(t,e,f)&&t.strokeText(c,i,a),a+=s;else c=Ef(e,l),e.fill&&Ac(t,e,f)&&t.fillText(c,i,a),e.stroke&&Mc(t,e,f)&&t.strokeText(c,i,a);e.angle&&t.restore()}}))},pick:Tc((function(t,e,n,r,i,a){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var u=zf(e),o=u.x1,s=u.y1,l=Tf(Bf,e,1),c=-e.angle*pl,f=Math.cos(c),h=Math.sin(c),d=f*i-h*a+(o-f*o+h*s),p=h*i+f*a+(s-h*o-f*s);return l.contains(d,p)})),isect:function(t,e){var n=Tf(Bf,t,2);return yc(e,n[0],n[1],n[2],n[3])||yc(e,n[0],n[1],n[4],n[5])||yc(e,n[4],n[5],n[6],n[7])||yc(e,n[2],n[3],n[6],n[7])}},trail:jc("trail",(function(t,e){return Xl.context(t)(e)}),(function(t,e){for(var n,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null}))};function Of(t,e,n){var r=Nf[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Uo),t,n)}var Rf={mark:null};function qf(t,e,n){var r,i,a,u,o=Nf[t.marktype],s=o.bound,l=t.items,c=l&&l.length;if(o.nested)return c?a=l[0]:(Rf.mark=t,a=Rf),u=Of(a,s,n),e=e&&e.union(u)||u;if(e=e||t.bounds&&t.bounds.clear()||new Uo,c)for(r=0,i=l.length;r<i;++r)e.union(Of(l[r],s,n));return t.bounds=e}var Uf=["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"];function Lf(t,e){return JSON.stringify(t,Uf,e)}function Pf(t){return function t(e){var n,r,i,a=e.marktype,u=e.items;if(u)for(r=0,i=u.length;r<i;++r)n=a?"mark":"group",u[r][n]=e,u[r].zindex&&(u[r][n].zdirty=!0),"group"===(a||n)&&t(u[r]);a&&qf(e);return e}("string"==typeof t?JSON.parse(t):t)}function $f(t){arguments.length?this.root=Pf(t):(this.root=If({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Yo(this.root)])}var jf=$f.prototype;function If(t,e){return{bounds:new Uo,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Hf(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Wf(t,e){e=e.toLowerCase();for(var n=t.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===e)return n[r]}function Yf(t,e,n,r){var i,a=t.childNodes[e];return a&&a.tagName.toLowerCase()===n.toLowerCase()||(i=a||null,a=Hf(t.ownerDocument,n,r),t.insertBefore(a,i)),a}function Vf(t,e){for(var n=t.childNodes,r=n.length;r>e;)t.removeChild(n[--r]);return t}function Gf(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Xf(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Jf(t,e){this._active=null,this._handlers={},this._loader=t||kr(),this._tooltip=e||Zf}function Zf(t,e,n,r){t.element().setAttribute("title",r||"")}jf.toJSON=function(t){return Lf(this.root,t||0)},jf.mark=function(t,e,n){var r=If(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Qf=Jf.prototype;function Kf(t){this._el=null,this._bgcolor=null,this._loader=new Xo(t)}Qf.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Qf.element=function(){return this._el},Qf.canvas=function(){return this._el&&this._el.firstChild},Qf.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Qf.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Qf.on=function(){},Qf.off=function(){},Qf._handlerIndex=function(t,e,n){for(var r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},Qf.handlers=function(t){var e,n=this._handlers,r=[];if(t)r.push.apply(r,n[this.eventName(t)]);else for(e in n)r.push.apply(r,n[e]);return r},Qf.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Qf.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then((function(e){var n=new MouseEvent(t.type,t),r=Hf(null,"a");for(var i in e)r.setAttribute(i,e[i]);r.dispatchEvent(n)})).catch((function(){}))},Qf.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,a,u=t&&t.mark;if(u&&(i=Nf[u.marktype]).tip){for((a=Xf(e,n))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(u.items,a)}return t}(e,t,this.canvas(),this._origin);var r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},Qf.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.x1+r[0]+n.left,u=i.y1+r[1]+n.top,o=i.width(),s=i.height();t.mark&&(t=t.mark.group);)a+=t.x||0,u+=t.y||0;return{x:a,y:u,width:o,height:s,left:a,top:u,right:a+o,bottom:u+s}}};var th=Kf.prototype;th.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},th.element=function(){return this._el},th.canvas=function(){return this._el&&this._el.firstChild},th.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},th.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},th.dirty=function(){},th.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},th._render=function(){},th.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},th._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(t){t&&i(),n._ready=null}))}return r},th.sanitizeURL=function(t){return this._load("sanitizeURL",t)},th.loadImage=function(t){return this._load("loadImage",t)};function eh(t,e){Jf.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var nh=rt(eh,Jf);function rh(t,e,n){return function(r){var i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(n,r),this._active=a,this.fire(e,r)),this.fire(t,r)}}function ih(t){return function(e){this.fire(t,e),this._active=null}}nh.initialize=function(t,e,n){var r=this._canvas=t&&Wf(t,"canvas");if(r){var i=this;this.events.forEach((function(t){r.addEventListener(t,(function(e){nh[t]?nh[t].call(i,e):i.fire(t,e)}))}))}return Jf.prototype.initialize.call(this,t,e,n)},nh.canvas=function(){return this._canvas},nh.context=function(){return this._canvas.getContext("2d")},nh.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],nh.DOMMouseScroll=function(t){this.fire("mousewheel",t)},nh.mousemove=rh("mousemove","mouseover","mouseout"),nh.dragover=rh("dragover","dragenter","dragleave"),nh.mouseout=ih("mouseout"),nh.dragleave=ih("dragleave"),nh.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},nh.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},nh.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},nh.touchmove=function(t){this.fire("touchmove",t,!0)},nh.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},nh.fire=function(t,e,n){var r,i,a=n?this._touch:this._active,u=this._handlers[t];if(e.vegaType=t,"click"===t&&a&&a.href?this.handleHref(e,a,a.href):"mousemove"!==t&&"mouseout"!==t||this.handleTooltip(e,a,"mouseout"!==t),u)for(r=0,i=u.length;r<i;++r)u[r].handler.call(this._obj,e,a)},nh.on=function(t,e){var n=this.eventName(t),r=this._handlers;return this._handlerIndex(r[n],t,e)<0&&(r[n]||(r[n]=[])).push({type:t,handler:e}),this},nh.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&r.splice(i,1),this},nh.pickEvent=function(t){var e=Xf(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},nh.pick=function(t,e,n,r,i){var a=this.context();return Nf[t.marktype].pick.call(this,a,t,e,n,r,i)};var ah="undefined"!=typeof window&&window.devicePixelRatio||1;function uh(t){Kf.call(this,t),this._redraw=!1,this._dirty=new Uo}var oh=rt(uh,Kf),sh=Kf.prototype,lh=new Uo;function ch(t,e,n){return lh.set(0,0,e,n).translate(-t[0],-t[1])}function fh(t,e){Jf.call(this,t,e);var n=this;n._hrefHandler=dh(n,(function(t,e){e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=dh(n,(function(t,e){n.handleTooltip(t,e,"mouseout"!==t.type)}))}oh.initialize=function(t,e,n,r,i,a){return this._options=a,this._canvas=Vo(1,1,a&&a.type),t&&(Vf(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),sh.initialize.call(this,t,e,n,r,i)},oh.resize=function(t,e,n,r){return sh.resize.call(this,t,e,n,r),function(t,e,n,r,i,a){const u="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,o=t.getContext("2d"),s=u?ah:i;t.width=e*s,t.height=n*s;for(const t in a)o[t]=a[t];u&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),o.pixelRatio=s,o.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},oh.canvas=function(){return this._canvas},oh.context=function(){return this._canvas?this._canvas.getContext("2d"):null},oh.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=lh.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},oh._render=function(t){var e=this.context(),n=this._origin,r=this._width,i=this._height,a=this._dirty;return e.save(),this._redraw||a.empty()?(this._redraw=!1,a=ch(n,r,i).expand(1)):a=function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,a.intersect(ch(n,r,i)),n),this.clear(-n[0],-n[1],r,i),this.draw(e,t,a),e.restore(),this._dirty.clear(),this},oh.draw=function(t,e,n){var r=Nf[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),W(n)?(t.beginPath(),n(t),t.clip()):Hc(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},oh.clear=function(t,e,n,r){var i=this.context();i.clearRect(t,e,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,e,n,r))};var hh=rt(fh,Jf);function dh(t,e){return function(n){var r=n.target.__data__;n.vegaType=n.type,r=Array.isArray(r)?r[0]:r,e.call(t._obj,n,r)}}function ph(t,e,n){var r,i,a="<"+t;if(e)for(r in e)null!=(i=e[r])&&(a+=" "+r+'="'+i+'"');return n&&(a+=" "+n),a+">"}function gh(t){return"</"+t+">"}hh.initialize=function(t,e,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener("mouseout",this._tooltipHandler)),this._svg=r=t&&Wf(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener("mouseout",this._tooltipHandler)),Jf.prototype.initialize.call(this,t,e,n)},hh.canvas=function(){return this._svg},hh.on=function(t,e){var n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){var i={type:t,handler:e,listener:dh(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},hh.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var mh={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},vh={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",blend:"mix-blend-mode"},yh=Object.keys(vh),_h=mh.xmlns;function xh(t){Kf.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var bh=rt(xh,Kf),wh=Kf.prototype;function Ah(t,e,n){var r,i,a;if("radial"===e.gradient){var u=Yf(t,n++,"pattern",_h);u.setAttribute("id","p_"+e.id),u.setAttribute("viewBox","0,0,1,1"),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("preserveAspectRatio","xMidYMid slice"),(u=Yf(u,0,"rect",_h)).setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","url("+zh()+"#"+e.id+")"),(t=Yf(t,n++,"radialGradient",_h)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=Yf(t,n++,"linearGradient",_h)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(r=0,i=e.stops.length;r<i;++r)(a=Yf(t,r,"stop",_h)).setAttribute("offset",e.stops[r].offset),a.setAttribute("stop-color",e.stops[r].color);return Vf(t,r),n}function kh(t,e,n){var r;return(t=Yf(t,n,"clipPath",_h)).setAttribute("id",e.id),e.path?(r=Yf(t,0,"path",_h)).setAttribute("d",e.path):((r=Yf(t,0,"rect",_h)).setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",e.width),r.setAttribute("height",e.height)),Vf(t,1),n+1}function Mh(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function Eh(t,e,n,r,i){var a,u=t._svg;if(!u&&(u=Hf(a=e.ownerDocument,r,_h),t._svg=u,t.mark&&(u.__data__=t,u.__values__={fill:"default"},"g"===r))){var o=Hf(a,"path",_h);u.appendChild(o),o.__data__=t;var s=Hf(a,"g",_h);u.appendChild(s),s.__data__=t;var l=Hf(a,"path",_h);u.appendChild(l),l.__data__=t,l.__values__={fill:"default"}}return(u.ownerSVGElement!==i||function(t,e){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=e}(u,n))&&e.insertBefore(u,n?n.nextSibling:e.firstChild),u}bh.initialize=function(t,e,n,r){return t&&(this._svg=Yf(t,0,"svg",_h),this._svg.setAttribute("class","marks"),Vf(t,1),this._root=Yf(this._svg,0,"g",_h),Vf(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),wh.initialize.call(this,t,e,n,r)},bh.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),wh.background.apply(this,arguments)},bh.resize=function(t,e,n,r){return wh.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},bh.canvas=function(){return this._svg},bh.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in mh)t[e]=mh[e];var n=this._bgcolor?ph("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+gh("rect"):"";return ph("svg",t)+n+this._svg.innerHTML+gh("svg")},bh._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Vf(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},bh.updateDefs=function(){var t,e=this._svg,n=this._defs,r=n.el,i=0;for(t in n.gradient)r||(n.el=r=Yf(e,0,"defs",_h)),i=Ah(r,n.gradient[t],i);for(t in n.clipping)r||(n.el=r=Yf(e,0,"defs",_h)),i=kh(r,n.clipping[t],i);r&&(0===i?(e.removeChild(r),n.el=null):Vf(r,i))},bh._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},bh.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},bh.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},bh._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=t.length;a<u;++a)(n=(e=t[a]).mark).marktype!==r&&(r=n.marktype,i=Nf[r]),n.zdirty&&n.dirty!==s&&(this._dirtyAll=!1,Mh(e,s),n.items.forEach((function(t){t.dirty=s}))),n.zdirty||(e.exit?(i.nested&&n.items.length?(o=n.items[0])._svg&&this._update(i,o._svg,o):e._svg&&(o=e._svg.parentNode)&&o.removeChild(e._svg),e._svg=null):(e=i.nested?n.items[0]:e)._update!==s&&(e._svg&&e._svg.ownerSVGElement?this._update(i,e._svg,e):(this._dirtyAll=!1,Mh(e,s)),e._update=s));return!this._dirtyAll},bh.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var r,i=this,a=this._svg,u=Nf[e.marktype],o=!1===e.interactive?"none":null,s="g"===u.tag,l=null,c=0;function f(t){var e=i.isDirty(t),n=Eh(t,r,l,u.tag,a);e&&(i._update(u,n,t),s&&function(t,e,n){e=e.lastChild.previousSibling;var r,i=0;Cc(n,(function(n){r=t.draw(e,n,r),++i})),Vf(e,1+i)}(i,n,t)),l=n,++c}return(r=Eh(e,t,n,"g",a)).setAttribute("class",Gf(e)),s||r.style.setProperty("pointer-events",o),e.clip?r.setAttribute("clip-path",Yc(i,e,e.group)):r.removeAttribute("clip-path"),u.nested?e.items.length&&f(e.items[0]):Cc(e,f),Vf(r,c),r};var Dh=null,Ch=null,Fh={group:function(t,e,n){var r,i;Dh=r=e.childNodes[2],Ch=r.__values__,t.foreground(Bh,n,this),Ch=e.__values__,Dh=e.childNodes[1],t.content(Bh,n,this),Dh=i=e.childNodes[0],t.background(Bh,n,this);var a=!1===n.mark.interactive?"none":null;if(a!==Ch.events&&(r.style.setProperty("pointer-events",a),i.style.setProperty("pointer-events",a),Ch.events=a),n.strokeForeground&&n.stroke){const t=n.fill;r.style.removeProperty("display"),this.style(i,n),i.style.removeProperty("stroke"),t&&(n.fill=null),Ch=r.__values__,this.style(r,n),t&&(n.fill=t),Dh=null}else r.style.setProperty("display","none"),r.style.setProperty("fill","none")},image:function(t,e,n){!1===n.smooth?(Sh(e,"image-rendering","optimizeSpeed"),Sh(e,"image-rendering","pixelated")):Sh(e,"image-rendering",null)},text:function(t,e,n){var r,i,a,o,s=kf(n);u(s)?(r=(i=s.map(t=>Ef(n,t))).join("\n"))!==Ch.text&&(Vf(e,0),a=e.ownerDocument,o=Af(n),i.forEach((t,r)=>{const i=Hf(a,"tspan",_h);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",o)),e.appendChild(i)}),Ch.text=r):(i=Ef(n,s))!==Ch.text&&(e.textContent=i,Ch.text=i),Sh(e,"font-family",Df(n)),Sh(e,"font-size",wf(n)+"px"),Sh(e,"font-style",n.fontStyle),Sh(e,"font-variant",n.fontVariant),Sh(e,"font-weight",n.fontWeight)}};function Sh(t,e,n){n!==Ch[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),Ch[e]=n)}function Bh(t,e,n){e!==Ch[t]&&(null!=e?n?Dh.setAttributeNS(n,t,e):Dh.setAttribute(t,e):n?Dh.removeAttributeNS(n,t):Dh.removeAttribute(t),Ch[t]=e)}function zh(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function Th(t){Kf.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}bh._update=function(t,e,n){Dh=e,Ch=e.__values__,t.attr(Bh,n,this);var r=Fh[t.type];r&&r.call(this,t,e,n),Dh&&this.style(Dh,n)},bh.style=function(t,e){var n,r,i,a,u;if(null!=e)for(n=0,r=yh.length;n<r;++n)u=e[i=yh[n]],"font"===i&&(u=Df(e)),u!==Ch[i]&&(a=vh[i],null==u?"fill"===a?t.style.setProperty(a,"none"):t.style.removeProperty(a):($o(u)&&(u=jo(u,this._defs.gradient,zh())),t.style.setProperty(a,u+"")),Ch[i]=u)};var Nh,Oh=rt(Th,Kf),Rh=Kf.prototype;function qh(t,e,n,r){Nh[r||t]=e}function Uh(t,e,n,r){if(null==t)return"";var i,a,u,o,s,l="";for("bgrect"===n&&!1===e.interactive&&(l+="pointer-events: none; "),"bgfore"===n&&(!1===e.interactive&&(l+="pointer-events: none; "),l+="display: none; "),"image"===n&&!1===t.smooth&&(l+="image-rendering: optimizeSpeed; image-rendering: pixelated; "),"text"===n&&(l+="font-family: "+Df(t)+"; ",l+="font-size: "+wf(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),i=0,a=yh.length;i<a;++i)u=yh[i],o=vh[u],null==(s=t[u])?"fill"===o&&(l+="fill: none; "):"transparent"!==s||"fill"!==o&&"stroke"!==o?($o(s)&&(s=jo(s,r.gradient,"")),l+=o+": "+s+"; "):l+=o+": none; ";return l?'style="'+l.trim()+'"':null}function Lh(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}Oh.resize=function(t,e,n,r){Rh.resize.call(this,t,e,n,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in mh)u[o]=mh[o];a.head=ph("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?ph("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+gh("rect"):"",a.root=ph("g",{transform:"translate("+i+")"}),a.foot=gh("g")+gh("svg"),this},Oh.background=function(){var t=Rh.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Oh.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},Oh._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Oh.buildDefs=function(){var t,e,n,r,i,a=this._defs,u="";for(e in a.gradient){for(i=(n=a.gradient[e]).stops,"radial"===n.gradient?(u+=ph(r="pattern",{id:"p_"+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),u+=ph("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+gh("rect"),u+=gh(r),u+=ph(r="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):u+=ph(r="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<i.length;++t)u+=ph("stop",{offset:i[t].offset,"stop-color":i[t].color})+gh("stop");u+=gh(r)}for(e in a.clipping)n=a.clipping[e],u+=ph("clipPath",{id:e}),n.path?u+=ph("path",{d:n.path})+gh("path"):u+=ph("rect",{x:0,y:0,width:n.width,height:n.height})+gh("rect"),u+=gh("clipPath");return u.length>0?ph("defs")+u+gh("defs"):""},Oh.attributes=function(t,e){return Nh={},t(qh,e,this),Nh},Oh.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then((function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t}))}return null},Oh.mark=function(t){var e,n=this,r=Nf[t.marktype],i=r.tag,a=this._defs,o="";function s(s){var l=n.href(s);if(l&&(o+=ph("a",l)),e="g"!==i?Uh(s,t,i,a):null,o+=ph(i,n.attributes(r.attr,s),e),"text"===i){const t=kf(s);if(u(t)){const e={x:0,dy:Af(s)};for(let n=0;n<t.length;++n)o+=ph("tspan",n?e:null)+Lh(Ef(s,t[n]))+gh("tspan")}else o+=Lh(Ef(s,t))}else if("g"===i){const e=s.strokeForeground,i=s.fill,u=s.stroke;e&&u&&(s.stroke=null),o+=ph("path",n.attributes(r.background,s),Uh(s,t,"bgrect",a))+gh("path"),o+=ph("g",n.attributes(r.content,s))+n.markGroup(s)+gh("g"),e&&u?(i&&(s.fill=null),s.stroke=u,o+=ph("path",n.attributes(r.foreground,s),Uh(s,t,"bgrect",a))+gh("path"),i&&(s.fill=i)):o+=ph("path",n.attributes(r.foreground,s),Uh({},t,"bgfore",a))+gh("path")}o+=gh(i),l&&(o+=gh("a"))}return"g"!==i&&!1===t.interactive&&(e='style="pointer-events: none;"'),o+=ph("g",{class:Gf(t),"clip-path":t.clip?Yc(n,t,t.group):null},e),r.nested?t.items&&t.items.length&&s(t.items[0]):Cc(t,s),o+gh("g")},Oh.markGroup=function(t){var e=this,n="";return Cc(t,(function(t){n+=e.mark(t)})),n};var Ph={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},$h={};function jh(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?($h[t]=e,this):$h[t]}function Ih(t,e,n){const r=[],a=(new Uo).union(e),u=t.marktype;return u?Hh(t,a,n,r):"group"===u?Wh(t,a,n,r):i("Intersect scene must be mark node or group item.")}function Hh(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,a=t.marktype,u=i.length;let o=0;if("group"===a)for(;o<u;++o)Wh(i[o],e,n,r);else for(const t=Nf[a].isect;o<u;++o){let n=i[o];Yh(n,e,t)&&r.push(n)}}return r}function Wh(t,e,n,r){n&&n(t.mark)&&Yh(t,e,Nf.group.isect)&&r.push(t);const i=t.items,a=i&&i.length;if(a){const u=t.x||0,o=t.y||0;e.translate(-u,-o);for(let t=0;t<a;++t)Hh(i[t],e,n,r);e.translate(u,o)}return r}function Yh(t,e,n){const r=t.bounds;return e.encloses(r)||e.intersects(r)&&n(t,e)}$h.canvas=$h.png={renderer:uh,headless:uh,handler:eh},$h.svg={renderer:xh,headless:Th,handler:fh},$h.none={};var Vh=new Uo;function Gh(t){var e=t.clip;if(W(e))e(rc(Vh.clear()));else{if(!e)return;Vh.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Vh)}function Xh(t,e,n){return t===e||("path"===n?Jh(t,e):t instanceof Date&&e instanceof Date?+t==+e:ot(t)&&ot(e)?Math.abs(t-e)<=1e-9:t&&e&&(o(t)||o(e))?null!=t&&null!=e&&function(t,e){var n,r,i=Object.keys(t),a=Object.keys(e);if(i.length!==a.length)return!1;for(i.sort(),a.sort(),r=i.length-1;r>=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Xh(t[n],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Jh(t,e){return Xh(dl(t),dl(e))}function Zh(t){Hr.call(this,null,t)}function Qh(t,e,n){return e(t.bounds.clear(),t,n)}rt(Zh,Hr).transform=function(t,e){var n,r=e.dataflow,i=t.mark,a=i.marktype,u=Nf[a],o=u.bound,s=i.bounds;if(u.nested)i.items.length&&r.dirty(i.items[0]),s=Qh(i,o),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if("group"===a||t.modified())switch(e.visit(e.MOD,(function(t){r.dirty(t)})),s.clear(),i.items.forEach((function(t){s.union(Qh(t,o))})),i.role){case"axis":case"legend":case"title":e.reflow()}else n=e.changed(e.REM),e.visit(e.ADD,(function(t){s.union(Qh(t,o))})),e.visit(e.MOD,(function(t){n=n||s.alignsWith(t.bounds),r.dirty(t),s.union(Qh(t,o))})),n&&(s.clear(),i.items.forEach((function(t){s.union(t.bounds)})));return Gh(i),e.modifies("bounds")};function Kh(t){Hr.call(this,0,t)}function td(t){Hr.call(this,null,t)}function ed(t){Hr.call(this,null,t)}Kh.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},rt(Kh,Hr).transform=function(t,e){var n=function(t){var e=t._signals[":vega_identifier:"];e||(t._signals[":vega_identifier:"]=e=t.add(0));return e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,(function(t){t[i]||(t[i]=++r)})),n.set(this.value=r),e},rt(td,Hr).transform=function(t,e){var n=this.value;n||((n=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);var r="group"===n.marktype?Yo:Wo;return e.visit(e.ADD,(function(t){r.call(t,n)})),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e};var nd=rt(ed,Hr),rd={parity:function(t){return t.filter((t,e)=>e%2?t.opacity=0:1)},greedy:function(t,e){var n;return t.filter((t,r)=>r&&id(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1))}};function id(t,e,n){return n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function ad(t,e){for(var n,r=1,i=t.length,a=t[0].bounds;r<i;a=n,++r)if(id(a,n=t[r].bounds,e))return!0}function ud(t){var e=t.bounds;return e.width()>1&&e.height()>1}function od(t){return t.forEach(t=>t.opacity=1),t}function sd(t,e){return t.reflow(e.modified()).modifies("opacity")}function ld(t){Hr.call(this,null,t)}nd.transform=function(t,e){var n,r,i,a=rd[t.method]||rd.parity,u=e.materialize(e.SOURCE).source,o=t.separation||0;if(u&&u.length){if(!t.method)return t.modified("method")&&(od(u),e=sd(e,t)),e;if((u=u.filter(ud)).length){if(t.sort&&(u=u.slice().sort(t.sort)),n=od(u),e=sd(e,t),n.length>=3&&ad(n,o)){do{n=a(n,o)}while(n.length>=3&&ad(n,o));n.length<3&&!k(u).opacity&&(n.length>1&&(k(n).opacity=0),k(u).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,e,n){var r=t.range(),i=new Uo;return e===To||"bottom"===e?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)}(t.boundScale,t.boundOrient,+t.boundTolerance),u.forEach(t=>{r(t)||(t.opacity=0)})),i=n[0].mark.bounds.clear(),u.forEach(t=>{t.opacity&&i.union(t.bounds)}),e}}},rt(ld,Hr).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,(function(t){n.dirty(t)})),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};const cd=new Uo;function fd(t,e,n){return t[e]===n?0:(t[e]=n,1)}function hd(t){var e=t.items[0].datum.orient;return e===No||e===Oo}function dd(t,e,n,r){var i,a,u=e.items[0],o=u.datum,s=o.orient,l=null!=o.translate?o.translate:.5,c=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(o),f=u.range,h=u.offset,d=u.position,p=u.minExtent,g=u.maxExtent,m=o.title&&u.items[c[2]].items[0],v=u.titlePadding,y=u.bounds,_=m&&Mf(m),x=0,b=0;switch(cd.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(u.items[i].bounds),(i=c[1])>-1&&y.union(u.items[i].bounds),s){case To:x=d||0,b=-h,a=Math.max(p,Math.min(g,-y.y1)),y.add(0,-a).add(f,0),m&&pd(t,m,a,v,_,0,-1,y);break;case No:x=-h,b=d||0,a=Math.max(p,Math.min(g,-y.x1)),y.add(-a,0).add(0,f),m&&pd(t,m,a,v,_,1,-1,y);break;case Oo:x=n+h,b=d||0,a=Math.max(p,Math.min(g,y.x2)),y.add(0,0).add(a,f),m&&pd(t,m,a,v,_,1,1,y);break;case"bottom":x=d||0,b=r+h,a=Math.max(p,Math.min(g,y.y2)),y.add(0,0).add(f,a),m&&pd(t,m,a,v,0,0,1,y);break;default:x=u.x,b=u.y}return Ql(y.translate(x,b),u),fd(u,"x",x+l)|fd(u,"y",b+l)&&(u.bounds=cd,t.dirty(u),u.bounds=y,t.dirty(u)),u.mark.bounds.clear().union(y)}function pd(t,e,n,r,i,a,u,o){const s=e.bounds;if(e.auto){const o=u*(n+i+r);let l=0,c=0;t.dirty(e),a?l=(e.x||0)-(e.x=o):c=(e.y||0)-(e.y=o),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}o.union(s)}function gd(t){return(new Uo).set(0,0,t.width||0,t.height||0)}function md(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function vd(t,e,n){var r=o(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function yd(t){return t<0?Math.ceil(-t):0}function _d(t,e,n){var r,i,a,u,o,s,l,c,f,h,d,p=!n.nodirty,g="flush"===n.bounds?gd:md,m=cd.set(0,0,0,0),v=vd(n.align,"column"),y=vd(n.align,qo),_=vd(n.padding,"column"),x=vd(n.padding,qo),b=n.columns||e.length,w=b<0?1:Math.ceil(e.length/b),A=e.length,k=Array(A),M=Array(b),E=0,D=Array(A),C=Array(w),F=0,S=Array(A),B=Array(A),z=Array(A);for(i=0;i<b;++i)M[i]=0;for(i=0;i<w;++i)C[i]=0;for(i=0;i<A;++i)s=e[i],o=z[i]=g(s),s.x=s.x||0,S[i]=0,s.y=s.y||0,B[i]=0,a=i%b,u=~~(i/b),E=Math.max(E,l=Math.ceil(o.x2)),F=Math.max(F,c=Math.ceil(o.y2)),M[a]=Math.max(M[a],l),C[u]=Math.max(C[u],c),k[i]=_+yd(o.x1),D[i]=x+yd(o.y1),p&&t.dirty(e[i]);for(i=0;i<A;++i)i%b==0&&(k[i]=0),i<b&&(D[i]=0);if("each"===v)for(a=1;a<b;++a){for(d=0,i=a;i<A;i+=b)d<k[i]&&(d=k[i]);for(i=a;i<A;i+=b)k[i]=d+M[a-1]}else if("all"===v){for(d=0,i=0;i<A;++i)i%b&&d<k[i]&&(d=k[i]);for(i=0;i<A;++i)i%b&&(k[i]=d+E)}else for(v=!1,a=1;a<b;++a)for(i=a;i<A;i+=b)k[i]+=M[a-1];if("each"===y)for(u=1;u<w;++u){for(d=0,r=(i=u*b)+b;i<r;++i)d<D[i]&&(d=D[i]);for(i=u*b;i<r;++i)D[i]=d+C[u-1]}else if("all"===y){for(d=0,i=b;i<A;++i)d<D[i]&&(d=D[i]);for(i=b;i<A;++i)D[i]=d+F}else for(y=!1,u=1;u<w;++u)for(r=(i=u*b)+b;i<r;++i)D[i]+=C[u-1];for(f=0,i=0;i<A;++i)f=k[i]+(i%b?f:0),S[i]+=f-e[i].x;for(a=0;a<b;++a)for(h=0,i=a;i<A;i+=b)h+=D[i],B[i]+=h-e[i].y;if(v&&vd(n.center,"column")&&w>1)for(i=0;i<A;++i)(f=(o="all"===v?E:M[i%b])-z[i].x2-e[i].x-S[i])>0&&(S[i]+=f/2);if(y&&vd(n.center,qo)&&1!==b)for(i=0;i<A;++i)(h=(o="all"===y?F:C[~~(i/b)])-z[i].y2-e[i].y-B[i])>0&&(B[i]+=h/2);for(i=0;i<A;++i)m.union(z[i].translate(S[i],B[i]));switch(f=vd(n.anchor,"x"),h=vd(n.anchor,"y"),vd(n.anchor,"column")){case Ro:f-=m.width();break;case"middle":f-=m.width()/2}switch(vd(n.anchor,qo)){case Ro:h-=m.height();break;case"middle":h-=m.height()/2}for(f=Math.round(f),h=Math.round(h),m.clear(),i=0;i<A;++i)e[i].mark.bounds.clear();for(i=0;i<A;++i)(s=e[i]).x+=S[i]+=f,s.y+=B[i]+=h,m.union(s.mark.bounds.union(s.bounds.translate(S[i],B[i]))),p&&t.dirty(s);return m}function xd(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function bd(t,e){return t.bounds[e]}function wd(t,e){return Math.floor(Math.min(t,e))}function Ad(t,e){return Math.ceil(Math.max(t,e))}function kd(t,e,n,r,i,a,u,o,s,l,c,f,h,d){var p,g,m,v,y,_,x,b,w,A=n.length,k=0,M=0;if(!A)return k;for(p=c;p<A;p+=f)n[p]&&(k=u(k,s(n[p],l)));if(!e.length)return k;for(e.length>i&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),k+=a,g=0,v=e.length;g<v;++g)t.dirty(e[g]),e[g].mark.bounds.clear();for(p=c,g=0,v=e.length;g<v;++g,p+=f){for(y=(_=e[g]).mark.bounds,m=p;m>=0&&null==(x=n[m]);m-=h);o?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=k):(b=k,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=u(M,y[l])}return M}function Md(t,e,n,r,i,a){if(e){t.dirty(e);var u=n,o=n;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),e.bounds.translate(u-(e.x||0),o-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=u,e.y=o,t.dirty(e)}}function Ed(t,e,n,r,i,a,u){const o=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){var n=-1/0;return t.forEach(t=>{null!=t.offset&&(n=Math.max(n,t.offset))}),n>-1/0?n:e}(t,o("offset",0)),l=o("anchor","start"),c=l===Ro?1:"middle"===l?.5:0,f={align:"each",bounds:o("bounds","flush"),columns:"vertical"===o("direction")?1:t.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(e){case No:f.anchor={x:Math.floor(r.x1)-s,column:Ro,y:c*(u||r.height()+2*r.y1),row:l};break;case Oo:f.anchor={x:Math.ceil(r.x2)+s,y:c*(u||r.height()+2*r.y1),row:l};break;case To:f.anchor={y:Math.floor(i.y1)-s,row:Ro,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:Ro};break;case"bottom-left":f.anchor={x:s,y:u-s,row:Ro};break;case"bottom-right":f.anchor={x:a-s,y:u-s,column:Ro,row:Ro}}return f}function Dd(t,e){var n,r,i,a,u=e.items[0],o=u.datum,s=u.orient,l=u.bounds,c=u.x,f=u.y;return u._bounds?u._bounds.clear().union(l):u._bounds=l.clone(),l.clear(),function(t,e,n){var r=e.padding,i=r-n.x,a=r-n.y;if(e.datum.title){var u=e.items[1].items[0],o=u.anchor,s=e.titlePadding||0,l=r-u.x,c=r-u.y;switch(u.orient){case No:i+=Math.ceil(u.bounds.width())+s;break;case Oo:case"bottom":break;default:a+=u.bounds.height()+s}switch((i||a)&&Fd(t,n,i,a),u.orient){case No:c+=Cd(e,n,u,o,1,1);break;case Oo:l+=Cd(e,n,u,Ro,0,0)+s,c+=Cd(e,n,u,o,1,1);break;case"bottom":l+=Cd(e,n,u,o,0,0),c+=Cd(e,n,u,Ro,-1,0,1)+s;break;default:l+=Cd(e,n,u,o,0,0)}(l||c)&&Fd(t,u,l,c),(l=Math.round(u.bounds.x1-r))<0&&(Fd(t,n,-l,0),Fd(t,u,-l,0))}else(i||a)&&Fd(t,n,i,a)}(t,u,u.items[0].items[0]),l=function(t,e){return t.items.forEach(t=>e.union(t.bounds)),e.x1=t.padding,e.y1=t.padding,e}(u,l),n=2*u.padding,r=2*u.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===o.type&&(i=u.items[0].items[0].items[0].items,a=i.reduce((function(t,e){return t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t}),{}),i.forEach((function(t){t.width=a[t.column],t.height=t.bounds.y2-t.y}))),"none"!==s&&(u.x=c=0,u.y=f=0),u.width=n,u.height=r,Ql(l.set(c,f,c+n,f+r),u),u.mark.bounds.clear().union(l),u}function Cd(t,e,n,r,i,a,u){const o="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!o||!a&&s||u?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,h=i<=0?0:Mf(n);return Math.round("start"===r?c:r===Ro?f-h:.5*(l-h))}function Fd(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function Sd(t){Hr.call(this,null,t)}rt(Sd,Hr).transform=function(t,e){var n=e.dataflow;return t.mark.items.forEach((function(e){t.layout&&function(t,e,n){var r,i,a,u,o,s,l,c=function(t){for(var e,n,r=t.items,i=r.length,a=0,u={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<i;++a)if(n=(e=r[a]).items,"group"===e.marktype)switch(e.role){case"axis":case"legend":case"title":break;case"row-header":u.rowheaders.push(...n);break;case"row-footer":u.rowfooters.push(...n);break;case"column-header":u.colheaders.push(...n);break;case"column-footer":u.colfooters.push(...n);break;case"row-title":u.rowtitle=n[0];break;case"column-title":u.coltitle=n[0];break;default:u.marks.push(...n)}return u}(e),f=c.marks,h="flush"===n.bounds?xd:bd,d=n.offset,p=n.columns||f.length,g=p<0?1:Math.ceil(f.length/p),m=g*p;const v=_d(t,f,n);c.rowheaders&&(s=vd(n.headerBand,qo,null),r=kd(t,c.rowheaders,f,p,g,-vd(d,"rowHeader"),wd,0,h,"x1",0,p,1,s)),c.colheaders&&(s=vd(n.headerBand,"column",null),i=kd(t,c.colheaders,f,p,p,-vd(d,"columnHeader"),wd,1,h,"y1",0,1,p,s)),c.rowfooters&&(s=vd(n.footerBand,qo,null),a=kd(t,c.rowfooters,f,p,g,vd(d,"rowFooter"),Ad,0,h,"x2",p-1,p,1,s)),c.colfooters&&(s=vd(n.footerBand,"column",null),u=kd(t,c.colfooters,f,p,p,vd(d,"columnFooter"),Ad,1,h,"y2",m-p,1,p,s)),c.rowtitle&&(o=vd(n.titleAnchor,qo),l=vd(d,"rowTitle"),l=o===Ro?a+l:r-l,s=vd(n.titleBand,qo,.5),Md(t,c.rowtitle,l,0,v,s)),c.coltitle&&(o=vd(n.titleAnchor,"column"),l=vd(d,"columnTitle"),l=o===Ro?u+l:i-l,s=vd(n.titleBand,"column",.5),Md(t,c.coltitle,l,1,v,s))}(n,e,t.layout),function(t,e,n){var r,i,a,u,o,s=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new Uo).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(u=0,o=s.length;u<o;++u)switch((i=s[u]).role){case"axis":(hd(i)?h:d).union(dd(t,i,l,c));break;case"title":r=i;break;case"legend":p.push(Dd(t,i));break;case"frame":case"scope":case"row-header":case"row-footer":case"row-title":case"column-header":case"column-footer":case"column-title":h.union(i.bounds),d.union(i.bounds);break;default:f.union(i.bounds)}if(p.length){const e={};p.forEach(t=>{"none"!==(a=t.orient||Oo)&&(e[a]||(e[a]=[])).push(t)});for(let r in e){const i=e[r];_d(t,i,Ed(i,r,n.legends,h,d,l,c))}p.forEach(e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&"fit"===n.autosize.type)switch(e.orient){case No:case Oo:f.add(r.x1,0).add(r.x2,0);break;case To:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var a,u=e.items[0],o=u.frame,s=u.orient,l=u.anchor,c=u.offset,f=u.padding,h=u.items[0].items[0],d=u.items[1]&&u.items[1].items[0],p=s===No||s===Oo?r:n,g=0,m=0,v=0,y=0,_=0;if("group"!==o?s===No?(g=i.y2,p=i.y1):s===Oo?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===No&&(g=r,p=0),a="start"===l?g:l===Ro?p:(g+p)/2,d&&d.text){switch(s){case To:case"bottom":_=h.bounds.height()+f;break;case No:y=h.bounds.width()+f;break;case Oo:y=-h.bounds.width()-f}cd.clear().union(d.bounds),cd.translate(y-(d.x||0),_-(d.y||0)),fd(d,"x",y)|fd(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(cd),d.mark.bounds.clear().union(cd),t.dirty(d)),cd.clear().union(d.bounds)}else cd.clear();switch(cd.union(h.bounds),s){case To:m=a,v=i.y1-cd.height()-c;break;case No:m=i.x1-cd.width()-c,v=a;break;case Oo:m=i.x2+cd.width()+c,v=a;break;case"bottom":m=a,v=i.y2+c;break;default:m=u.x,v=u.y}return fd(u,"x",m)|fd(u,"y",v)&&(cd.translate(m,v),t.dirty(u),u.bounds.clear().union(cd),e.bounds.clear().union(cd),t.dirty(u)),u.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},a=i.type;if(t._autosize<1||!a)return;let u=t._width,o=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,Math.ceil(n.x2-s)),f=Math.max(0,e.height||0),h=Math.max(0,Math.ceil(-n.y1)),d=Math.max(0,Math.ceil(n.y2-f));if("padding"===i.contains){const e=t.padding();u-=e.left+e.right,o-=e.top+e.bottom}"none"===a?(l=0,h=0,s=u,f=o):"fit"===a?(s=Math.max(0,u-l-c),f=Math.max(0,o-h-d)):"fit-x"===a?(s=Math.max(0,u-l-c),o=f+h+d):"fit-y"===a?(u=s+l+c,f=Math.max(0,o-h-d)):"pad"===a&&(u=s+l+c,o=f+h+d);t._resizeView(u,o,s,f,[l,h],i.resize)}(t,e,f,n)}(n,e,t)})),t.modified()&&e.reflow(),e};var Bd=Object.freeze({__proto__:null,bound:Zh,identifier:Kh,mark:td,overlap:ed,render:ld,viewlayout:Sd});function zd(t,e,n){var r=t-e+2*n;return t?r>0?r:1:0}const Td="log",Nd="utc",Od="continuous";function Rd(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function qd(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Ud=Symbol("implicit");function Ld(){var t=new Map,e=[],n=[],r=Ud;function i(i){var a=i+"",u=t.get(a);if(!u){if(r!==Ud)return r;t.set(a,u=e.push(i))}return n[(u-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Ld(e,n).unknown(r)},Rd.apply(i,arguments),i}function Pd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function $d(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function jd(){}var Id="\\s*([+-]?\\d+)\\s*",Hd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yd=/^#([0-9a-f]{3,8})$/,Vd=new RegExp("^rgb\\("+[Id,Id,Id]+"\\)$"),Gd=new RegExp("^rgb\\("+[Wd,Wd,Wd]+"\\)$"),Xd=new RegExp("^rgba\\("+[Id,Id,Id,Hd]+"\\)$"),Jd=new RegExp("^rgba\\("+[Wd,Wd,Wd,Hd]+"\\)$"),Zd=new RegExp("^hsl\\("+[Hd,Wd,Wd]+"\\)$"),Qd=new RegExp("^hsla\\("+[Hd,Wd,Wd,Hd]+"\\)$"),Kd={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 tp(){return this.rgb().formatHex()}function ep(){return this.rgb().formatRgb()}function np(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Yd.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rp(e):3===n?new op(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?new op(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?new op(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Vd.exec(t))?new op(e[1],e[2],e[3],1):(e=Gd.exec(t))?new op(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xd.exec(t))?ip(e[1],e[2],e[3],e[4]):(e=Jd.exec(t))?ip(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zd.exec(t))?fp(e[1],e[2]/100,e[3]/100,1):(e=Qd.exec(t))?fp(e[1],e[2]/100,e[3]/100,e[4]):Kd.hasOwnProperty(t)?rp(Kd[t]):"transparent"===t?new op(NaN,NaN,NaN,0):null}function rp(t){return new op(t>>16&255,t>>8&255,255&t,1)}function ip(t,e,n,r){return r<=0&&(t=e=n=NaN),new op(t,e,n,r)}function ap(t){return t instanceof jd||(t=np(t)),t?new op((t=t.rgb()).r,t.g,t.b,t.opacity):new op}function up(t,e,n,r){return 1===arguments.length?ap(t):new op(t,e,n,null==r?1:r)}function op(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function sp(){return"#"+cp(this.r)+cp(this.g)+cp(this.b)}function lp(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function cp(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function fp(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new pp(t,e,n,r)}function hp(t){if(t instanceof pp)return new pp(t.h,t.s,t.l,t.opacity);if(t instanceof jd||(t=np(t)),!t)return new pp;if(t instanceof pp)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),u=NaN,o=a-i,s=(a+i)/2;return o?(u=e===a?(n-r)/o+6*(n<r):n===a?(r-e)/o+2:(e-n)/o+4,o/=s<.5?a+i:2-a-i,u*=60):o=s>0&&s<1?0:u,new pp(u,o,s,t.opacity)}function dp(t,e,n,r){return 1===arguments.length?hp(t):new pp(t,e,n,null==r?1:r)}function pp(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function gp(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Pd(jd,np,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:tp,formatHex:tp,formatHsl:function(){return hp(this).formatHsl()},formatRgb:ep,toString:ep}),Pd(op,up,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new op(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new op(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:sp,formatHex:sp,formatRgb:lp,toString:lp})),Pd(pp,dp,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new pp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new pp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new op(gp(t>=240?t-240:t+120,i,r),gp(t,i,r),gp(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var mp=Math.PI/180,vp=180/Math.PI,yp=6/29*3*(6/29);function _p(t){if(t instanceof bp)return new bp(t.l,t.a,t.b,t.opacity);if(t instanceof Cp)return Fp(t);t instanceof op||(t=ap(t));var e,n,r=Mp(t.r),i=Mp(t.g),a=Mp(t.b),u=wp((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=u:(e=wp((.4360747*r+.3850649*i+.1430804*a)/.96422),n=wp((.0139322*r+.0971045*i+.7141733*a)/.82521)),new bp(116*u-16,500*(e-u),200*(u-n),t.opacity)}function xp(t,e,n,r){return 1===arguments.length?_p(t):new bp(t,e,n,null==r?1:r)}function bp(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function wp(t){return t>6/29*(6/29)*(6/29)?Math.pow(t,1/3):t/yp+4/29}function Ap(t){return t>6/29?t*t*t:yp*(t-4/29)}function kp(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Mp(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ep(t){if(t instanceof Cp)return new Cp(t.h,t.c,t.l,t.opacity);if(t instanceof bp||(t=_p(t)),0===t.a&&0===t.b)return new Cp(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*vp;return new Cp(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Dp(t,e,n,r){return 1===arguments.length?Ep(t):new Cp(t,e,n,null==r?1:r)}function Cp(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Fp(t){if(isNaN(t.h))return new bp(t.l,0,0,t.opacity);var e=t.h*mp;return new bp(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Pd(bp,xp,$d(jd,{brighter:function(t){return new bp(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new bp(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new op(kp(3.1338561*(e=.96422*Ap(e))-1.6168667*(t=1*Ap(t))-.4906146*(n=.82521*Ap(n))),kp(-.9787684*e+1.9161415*t+.033454*n),kp(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Pd(Cp,Dp,$d(jd,{brighter:function(t){return new Cp(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Cp(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Fp(this).rgb()}}));var Sp=-.14861,Bp=1.78277,zp=-.29227,Tp=-.90649,Np=1.97294,Op=Np*Tp,Rp=Np*Bp,qp=Bp*zp-Tp*Sp;function Up(t){if(t instanceof Pp)return new Pp(t.h,t.s,t.l,t.opacity);t instanceof op||(t=ap(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(qp*r+Op*e-Rp*n)/(qp+Op-Rp),a=r-i,u=(Np*(n-i)-zp*a)/Tp,o=Math.sqrt(u*u+a*a)/(Np*i*(1-i)),s=o?Math.atan2(u,a)*vp-120:NaN;return new Pp(s<0?s+360:s,o,i,t.opacity)}function Lp(t,e,n,r){return 1===arguments.length?Up(t):new Pp(t,e,n,null==r?1:r)}function Pp(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $p(t,e,n,r,i){var a=t*t,u=a*t;return((1-3*t+3*a-u)*e+(4-6*a+3*u)*n+(1+3*t+3*a-3*u)*r+u*i)/6}function jp(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],u=r>0?t[r-1]:2*i-a,o=r<e-1?t[r+2]:2*a-i;return $p((n-r/e)*e,u,i,a,o)}}function Ip(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],a=t[r%e],u=t[(r+1)%e],o=t[(r+2)%e];return $p((n-r/e)*e,i,a,u,o)}}function Hp(t){return function(){return t}}function Wp(t,e){return function(n){return t+n*e}}function Yp(t,e){var n=e-t;return n?Wp(t,n>180||n<-180?n-360*Math.round(n/360):n):Hp(isNaN(t)?e:t)}function Vp(t){return 1==(t=+t)?Gp:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Hp(isNaN(e)?n:e)}}function Gp(t,e){var n=e-t;return n?Wp(t,n):Hp(isNaN(t)?e:t)}Pd(Pp,Lp,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Pp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Pp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*mp,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new op(255*(e+n*(Sp*r+Bp*i)),255*(e+n*(zp*r+Tp*i)),255*(e+n*(Np*r)),this.opacity)}}));var Xp=function t(e){var n=Vp(e);function r(t,e){var r=n((t=up(t)).r,(e=up(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),u=Gp(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=u(e),t+""}}return r.gamma=t,r}(1);function Jp(t){return function(e){var n,r,i=e.length,a=new Array(i),u=new Array(i),o=new Array(i);for(n=0;n<i;++n)r=up(e[n]),a[n]=r.r||0,u[n]=r.g||0,o[n]=r.b||0;return a=t(a),u=t(u),o=t(o),r.opacity=1,function(t){return r.r=a(t),r.g=u(t),r.b=o(t),r+""}}}var Zp=Jp(jp),Qp=Jp(Ip);function Kp(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(a){for(n=0;n<r;++n)i[n]=t[n]*(1-a)+e[n]*a;return i}}function tg(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function eg(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),u=new Array(r);for(n=0;n<i;++n)a[n]=sg(t[n],e[n]);for(;n<r;++n)u[n]=e[n];return function(t){for(n=0;n<i;++n)u[n]=a[n](t);return u}}function ng(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function rg(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function ig(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=sg(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var ag=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ug=new RegExp(ag.source,"g");function og(t,e){var n,r,i,a=ag.lastIndex=ug.lastIndex=0,u=-1,o=[],s=[];for(t+="",e+="";(n=ag.exec(t))&&(r=ug.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),o[u]?o[u]+=i:o[++u]=i),(n=n[0])===(r=r[0])?o[u]?o[u]+=r:o[++u]=r:(o[++u]=null,s.push({i:u,x:rg(n,r)})),a=ug.lastIndex;return a<e.length&&(i=e.slice(a),o[u]?o[u]+=i:o[++u]=i),o.length<2?s[0]?function(t){return function(e){return t(e)+""}}(s[0].x):function(t){return function(){return t}}(e):(e=s.length,function(t){for(var n,r=0;r<e;++r)o[(n=s[r]).i]=n.x(t);return o.join("")})}function sg(t,e){var n,r=typeof e;return null==e||"boolean"===r?Hp(e):("number"===r?rg:"string"===r?(n=np(e))?(e=n,Xp):og:e instanceof np?Xp:e instanceof Date?ng:tg(e)?Kp:Array.isArray(e)?eg:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?ig:rg)(t,e)}function lg(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var cg,fg,hg,dg,pg=180/Math.PI,gg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mg(t,e,n,r,i,a){var u,o,s;return(u=Math.sqrt(t*t+e*e))&&(t/=u,e/=u),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(o=Math.sqrt(n*n+r*r))&&(n/=o,r/=o,s/=o),t*r<e*n&&(t=-t,e=-e,s=-s,u=-u),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*pg,skewX:Math.atan(s)*pg,scaleX:u,scaleY:o}}function vg(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,u){var o=[],s=[];return a=t(a),u=t(u),function(t,r,i,a,u,o){if(t!==i||r!==a){var s=u.push("translate(",null,e,null,n);o.push({i:s-4,x:rg(t,i)},{i:s-2,x:rg(r,a)})}else(i||a)&&u.push("translate("+i+e+a+n)}(a.translateX,a.translateY,u.translateX,u.translateY,o,s),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:rg(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,u.rotate,o,s),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:rg(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,u.skewX,o,s),function(t,e,n,r,a,u){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");u.push({i:o-4,x:rg(t,n)},{i:o-2,x:rg(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,u.scaleX,u.scaleY,o,s),a=u=null,function(t){for(var e,n=-1,r=s.length;++n<r;)o[(e=s[n]).i]=e.x(t);return o.join("")}}}var yg=vg((function(t){return"none"===t?gg:(cg||(cg=document.createElement("DIV"),fg=document.documentElement,hg=document.defaultView),cg.style.transform=t,t=hg.getComputedStyle(fg.appendChild(cg),null).getPropertyValue("transform"),fg.removeChild(cg),mg(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),_g=vg((function(t){return null==t?gg:(dg||(dg=document.createElementNS("http://www.w3.org/2000/svg","g")),dg.setAttribute("transform",t),(t=dg.transform.baseVal.consolidate())?mg((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):gg)}),", ",")",")"),xg=Math.SQRT2;function bg(t){return((t=Math.exp(t))+1/t)/2}function wg(t){return function(e,n){var r=t((e=dp(e)).h,(n=dp(n)).h),i=Gp(e.s,n.s),a=Gp(e.l,n.l),u=Gp(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=a(t),e.opacity=u(t),e+""}}}var Ag=wg(Yp),kg=wg(Gp);function Mg(t){return function(e,n){var r=t((e=Dp(e)).h,(n=Dp(n)).h),i=Gp(e.c,n.c),a=Gp(e.l,n.l),u=Gp(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=a(t),e.opacity=u(t),e+""}}}var Eg=Mg(Yp),Dg=Mg(Gp);function Cg(t){return function e(n){function r(e,r){var i=t((e=Lp(e)).h,(r=Lp(r)).h),a=Gp(e.s,r.s),u=Gp(e.l,r.l),o=Gp(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=a(t),e.l=u(Math.pow(t,n)),e.opacity=o(t),e+""}}return n=+n,r.gamma=e,r}(1)}var Fg=Cg(Yp),Sg=Cg(Gp);function Bg(t,e){for(var n=0,r=e.length-1,i=e[0],a=new Array(r<0?0:r);n<r;)a[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return a[e](t-e)}}var zg=Object.freeze({__proto__:null,interpolate:sg,interpolateArray:function(t,e){return(tg(e)?Kp:eg)(t,e)},interpolateBasis:jp,interpolateBasisClosed:Ip,interpolateDate:ng,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateHue:function(t,e){var n=Yp(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateNumber:rg,interpolateNumberArray:Kp,interpolateObject:ig,interpolateRound:lg,interpolateString:og,interpolateTransformCss:yg,interpolateTransformSvg:_g,interpolateZoom:function(t,e){var n,r,i=t[0],a=t[1],u=t[2],o=e[0],s=e[1],l=e[2],c=o-i,f=s-a,h=c*c+f*f;if(h<1e-12)r=Math.log(l/u)/xg,n=function(t){return[i+t*c,a+t*f,u*Math.exp(xg*t*r)]};else{var d=Math.sqrt(h),p=(l*l-u*u+4*h)/(2*u*2*d),g=(l*l-u*u-4*h)/(2*l*2*d),m=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(g*g+1)-g);r=(v-m)/xg,n=function(t){var e=t*r,n=bg(m),o=u/(2*d)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(xg*e+m)-function(t){return((t=Math.exp(t))-1/t)/2}(m));return[i+o*c,a+o*f,u*n/bg(xg*e+m)]}}return n.duration=1e3*r,n},interpolateRgb:Xp,interpolateRgbBasis:Zp,interpolateRgbBasisClosed:Qp,interpolateHsl:Ag,interpolateHslLong:kg,interpolateLab:function(t,e){var n=Gp((t=xp(t)).l,(e=xp(e)).l),r=Gp(t.a,e.a),i=Gp(t.b,e.b),a=Gp(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=a(e),t+""}},interpolateHcl:Eg,interpolateHclLong:Dg,interpolateCubehelix:Fg,interpolateCubehelixLong:Sg,piecewise:Bg,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}});function Tg(t){return+t}var Ng=[0,1];function Og(t){return t}function Rg(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function qg(t,e,n){var r=t[0],i=t[1],a=e[0],u=e[1];return i<r?(r=Rg(i,r),a=n(u,a)):(r=Rg(r,i),a=n(a,u)),function(t){return a(r(t))}}function Ug(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),a=new Array(r),u=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++u<r;)i[u]=Rg(t[u],t[u+1]),a[u]=n(e[u],e[u+1]);return function(e){var n=oi(t,e,1,r)-1;return a[n](i[n](e))}}function Lg(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Pg(){var t,e,n,r,i,a,u=Ng,o=Ng,s=sg,l=Og;function c(){var t=Math.min(u.length,o.length);return l!==Og&&(l=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(u[0],u[t-1])),r=t>2?Ug:qg,i=a=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(u.map(t),o,s)))(t(l(e)))}return f.invert=function(n){return l(e((a||(a=r(o,u.map(t),rg)))(n)))},f.domain=function(t){return arguments.length?(u=Array.from(t,Tg),c()):u.slice()},f.range=function(t){return arguments.length?(o=Array.from(t),c()):o.slice()},f.rangeRound=function(t){return o=Array.from(t),s=lg,c()},f.clamp=function(t){return arguments.length?(l=!!t||Og,c()):l!==Og},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function $g(){return Pg()(Og,Og)}function jg(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ig(t){return(t=jg(Math.abs(t)))?t[1]:NaN}var Hg,Wg=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Yg(t){if(!(e=Wg.exec(t)))throw new Error("invalid format: "+t);var e;return new Vg({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Vg(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 Gg(t,e){var n=jg(t,e);if(!n)return t+"";var r=n[0],i=n[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")}Yg.prototype=Vg.prototype,Vg.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 Xg={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Gg(100*t,e)},r:Gg,s:function(t,e){var n=jg(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Hg=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return a===u?r:a>u?r+new Array(a-u+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+jg(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Jg(t){return t}var Zg,Qg,Kg,tm=Array.prototype.map,em=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nm(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Jg:(e=tm.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],u=0,o=e[0],s=0;i>0&&o>0&&(s+o+1>r&&(o=Math.max(1,r-s)),a.push(t.substring(i-=o,i+o)),!((s+=o+1)>r));)o=e[u=(u+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",u=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Jg:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tm.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Yg(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Xg[y]||(void 0===m&&(m=12),v=!0,y="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===h?a:/[%p]/.test(y)?s:"",b=Xg[y],w=/[defgprs%]/.test(y);function A(t){var i,a,s,h=_,A=x;if("c"===y)A=b(t)+A,t="";else{var k=(t=+t)<0;if(t=isNaN(t)?c:b(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&(k=!1),h=(k?"("===f?f:l:"-"===f||"("===f?"":f)+h,A=("s"===y?em[8+Hg/3]:"")+A+(k&&"("===f?")":""),w)for(i=-1,a=t.length;++i<a;)if(48>(s=t.charCodeAt(i))||s>57){A=(46===s?u+t.slice(i+1):t.slice(i))+A,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+A.length,E=M<p?new Array(p-M+1).join(e):"";switch(g&&d&&(t=r(E+t,E.length?p-A.length:1/0),E=""),n){case"<":t=h+t+A+E;break;case"=":t=h+E+t+A;break;case"^":t=E.slice(0,M=E.length>>1)+h+t+A+E.slice(M);break;default:t=E+h+t+A}return o(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),A.toString=function(){return t+""},A}return{format:f,formatPrefix:function(t,e){var n=f(((t=Yg(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Ig(e)/3))),i=Math.pow(10,-r),a=em[8+r/3];return function(t){return n(i*t)+a}}}}function rm(t){return Zg=nm(t),Qg=Zg.format,Kg=Zg.formatPrefix,Zg}function im(t,e,n,r){var i,a=gi(t,e,n);switch((r=Yg(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ig(e)/3)))-Ig(Math.abs(t)))}(a,u))||(r.precision=i),Kg(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ig(e)-Ig(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Ig(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Qg(r)}function am(t){var e=t.domain;return t.ticks=function(t){var n=e();return di(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return im(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),a=0,u=i.length-1,o=i[a],s=i[u];return s<o&&(r=o,o=s,s=r,r=a,a=u,u=r),(r=pi(o,s,n))>0?r=pi(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=pi(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,e(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,e(i)),t},t}function um(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],u=t[i];return u<a&&(n=r,r=i,i=n,n=a,a=u,u=n),t[r]=e.floor(a),t[i]=e.ceil(u),t}function om(t){return Math.log(t)}function sm(t){return Math.exp(t)}function lm(t){return-Math.log(-t)}function cm(t){return-Math.exp(-t)}function fm(t){return isFinite(t)?+("1e"+t):t<0?0:t}function hm(t){return function(e){return-t(-e)}}function dm(t){var e,n,r=t(om,sm),i=r.domain,a=10;function u(){return e=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(e){return Math.log(e)/t})}(a),n=function(t){return 10===t?fm:t===Math.E?Math.exp:function(e){return Math.pow(t,e)}}(a),i()[0]<0?(e=hm(e),n=hm(n),t(lm,cm)):t(om,sm),r}return r.base=function(t){return arguments.length?(a=+t,u()):a},r.domain=function(t){return arguments.length?(i(t),u()):i()},r.ticks=function(t){var r,u=i(),o=u[0],s=u[u.length-1];(r=s<o)&&(h=o,o=s,s=h);var l,c,f,h=e(o),d=e(s),p=null==t?10:+t,g=[];if(!(a%1)&&d-h<p){if(h=Math.floor(h),d=Math.ceil(d),o>0){for(;h<=d;++h)for(c=1,l=n(h);c<a;++c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}}else for(;h<=d;++h)for(c=a-1,l=n(h);c>=1;--c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}2*g.length<p&&(g=di(o,s,p))}else g=di(h,d,Math.min(d-h,p)).map(n);return r?g.reverse():g},r.tickFormat=function(t,i){if(null==i&&(i=10===a?".0e":","),"function"!=typeof i&&(i=Qg(i)),t===1/0)return i;null==t&&(t=10);var u=Math.max(1,a*t/r.ticks().length);return function(t){var r=t/n(Math.round(e(t)));return r*a<a-.5&&(r*=a),r<=u?i(t):""}},r.nice=function(){return i(um(i(),{floor:function(t){return n(Math.floor(e(t)))},ceil:function(t){return n(Math.ceil(e(t)))}}))},r}function pm(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function gm(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function mm(t){var e=1,n=t(pm(e),gm(e));return n.constant=function(n){return arguments.length?t(pm(e=+n),gm(e)):e},am(n)}function vm(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function ym(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function _m(t){return t<0?-t*t:t*t}function xm(t){var e=t(Og,Og),n=1;function r(){return 1===n?t(Og,Og):.5===n?t(ym,_m):t(vm(n),vm(1/n))}return e.exponent=function(t){return arguments.length?(n=+t,r()):n},am(e)}function bm(){var t=xm(Pg());return t.copy=function(){return Lg(t,bm()).exponent(t.exponent())},Rd.apply(t,arguments),t}rm({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function wm(t){return new Date(t)}function Am(t){return t instanceof Date?+t:+new Date(+t)}function km(t,e,n,r,i,a,u,o,s){var l=$g(),c=l.invert,f=l.domain,h=s(".%L"),d=s(":%S"),p=s("%I:%M"),g=s("%I %p"),m=s("%a %d"),v=s("%b %d"),y=s("%B"),_=s("%Y"),x=[[u,1,1e3],[u,5,5e3],[u,15,15e3],[u,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function b(o){return(u(o)<o?h:a(o)<o?d:i(o)<o?p:r(o)<o?g:e(o)<o?n(o)<o?m:v:t(o)<o?y:_)(o)}function w(e,n,r){if(null==e&&(e=10),"number"==typeof e){var i,a=Math.abs(r-n)/e,u=ai((function(t){return t[2]})).right(x,a);return u===x.length?(i=gi(n/31536e6,r/31536e6,e),e=t):u?(i=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],e=u[0]):(i=Math.max(gi(n,r,e),1),e=o),e.every(i)}return e}return l.invert=function(t){return new Date(c(t))},l.domain=function(t){return arguments.length?f(Array.from(t,Am)):f().map(wm)},l.ticks=function(t){var e,n=f(),r=n[0],i=n[n.length-1],a=i<r;return a&&(e=r,r=i,i=e),e=(e=w(t,r,i))?e.range(r,i+1):[],a?e.reverse():e},l.tickFormat=function(t,e){return null==e?b:s(e)},l.nice=function(t){var e=f();return(t=w(t,e[0],e[e.length-1]))?f(um(e,t)):l},l.copy=function(){return Lg(l,km(t,e,n,r,i,a,u,o,s))},l}function Mm(){var t,e,n,r,i,a=0,u=1,o=Og,s=!1;function l(e){return isNaN(e=+e)?i:o(0===n?.5:(e=(r(e)-t)*n,s?Math.max(0,Math.min(1,e)):e))}function c(t){return function(e){var n,r;return arguments.length?([n,r]=e,o=t(n,r),l):[o(0),o(1)]}}return l.domain=function(i){return arguments.length?([a,u]=i,t=r(a=+a),e=r(u=+u),n=t===e?0:1/(e-t),l):[a,u]},l.clamp=function(t){return arguments.length?(s=!!t,l):s},l.interpolator=function(t){return arguments.length?(o=t,l):o},l.range=c(sg),l.rangeRound=c(lg),l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(a),e=i(u),n=t===e?0:1/(e-t),l}}function Em(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Dm(){var t=am(Mm()(Og));return t.copy=function(){return Em(t,Dm())},qd.apply(t,arguments)}function Cm(){var t=xm(Mm());return t.copy=function(){return Em(t,Cm()).exponent(t.exponent())},qd.apply(t,arguments)}function Fm(){var t,e,n,r,i,a,u,o=0,s=.5,l=1,c=1,f=Og,h=!1;function d(t){return isNaN(t=+t)?u:(t=.5+((t=+a(t))-e)*(c*t<c*e?r:i),f(h?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,f=Bg(t,[n,r,i]),d):[f(0),f(.5),f(1)]}}return d.domain=function(u){return arguments.length?([o,s,l]=u,t=a(o=+o),e=a(s=+s),n=a(l=+l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d):[o,s,l]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(f=t,d):f},d.range=p(sg),d.rangeRound=p(lg),d.unknown=function(t){return arguments.length?(u=t,d):u},function(u){return a=u,t=u(o),e=u(s),n=u(l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d}}function Sm(){var t=xm(Fm());return t.copy=function(){return Em(t,Sm()).exponent(t.exponent())},qd.apply(t,arguments)}function Bm(){var t,e,n=Ld().unknown(void 0),r=n.domain,i=n.range,a=[0,1],u=!1,o=0,s=0,l=.5;function c(){var n=r().length,c=a[1]<a[0],f=a[c-0],h=a[1-c],d=zd(n,o,s);t=(h-f)/(d||1),u&&(t=Math.floor(t)),f+=(h-f-t*(n-o))*l,e=t*(1-o),u&&(f=Math.round(f),e=Math.round(e));var p=li(n).map((function(e){return f+t*e}));return i(c?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),c()):r()},n.range=function(t){return arguments.length?(a=[+t[0],+t[1]],c()):a.slice()},n.rangeRound=function(t){return a=[+t[0],+t[1]],u=!0,c()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(u=!!t,c()):u},n.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),o=s,c()):o},n.paddingInner=function(t){return arguments.length?(o=Math.max(0,Math.min(1,t)),c()):o},n.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},n.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},n.invertRange=function(t){if(null!=t[0]&&null!=t[1]){var n,u,o,s=+t[0],l=+t[1],c=a[1]<a[0],f=c?i().reverse():i(),h=f.length-1;if(s==s&&l==l&&(l<s&&(o=s,s=l,l=o),!(l<f[0]||s>a[1-c])))return n=Math.max(0,oi(f,s)-1),u=s===l?n:oi(f,l)-1,s-f[n]>e+1e-10&&++n,c&&(o=n,n=h-u,u=h-o),n>u?void 0:r().slice(n,u+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return Bm().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var zm=Array.prototype.map;function Tm(t){return zm.call(t,(function(t){return+t}))}var Nm=Array.prototype.slice;const Om={};function Rm(t,e,n){const r=function(){var n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){var n,r=e[0],i=e[1];return i<r&&(n=r,r=i,i=n),[t.invert(r),t.invert(i)]}}(n):n.invertExtent?function(t){return function(e){var n,r,i,a,u=t.range(),o=e[0],s=e[1],l=-1;for(s<o&&(r=o,o=s,s=r),i=0,a=u.length;i<a;++i)u[i]>=o&&u[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return o=t.invertExtent(u[l]),s=t.invertExtent(u[n]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=xt(I(n)),r}function qm(t,e,n){return arguments.length>1?(Om[t]=Rm(t,e,n),this):Um(t)?Om[t]:void 0}function Um(t){return K(Om,t)}function Lm(t,e){const n=Om[t];return n&&n.metadata[e]}function Pm(t){return Lm(t,Od)}function $m(t){return Lm(t,"discrete")}function jm(t){return Lm(t,"discretizing")}function Im(t){return Lm(t,Td)}function Hm(t){return Lm(t,"interpolating")}function Wm(t){return Lm(t,"quantile")}qm("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Tg),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Tg):[0,1],am(r)})),qm("linear",(function t(){var e=$g();return e.copy=function(){return Lg(e,t())},Rd.apply(e,arguments),am(e)}),Od),qm(Td,(function t(){var e=dm(Pg()).domain([1,10]);return e.copy=function(){return Lg(e,t()).base(e.base())},Rd.apply(e,arguments),e}),[Od,Td]),qm("pow",bm,Od),qm("sqrt",(function(){return bm.apply(null,arguments).exponent(.5)}),Od),qm("symlog",(function t(){var e=mm(Pg());return e.copy=function(){return Lg(e,t()).constant(e.constant())},Rd.apply(e,arguments)}),Od),qm("time",(function(){return Rd.apply(km(Ye,We,je,Pe,Le,Ue,qe,Re,on).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Od,"temporal"]),qm(Nd,(function(){return Rd.apply(km(en,tn,Ze,Xe,Ge,Ve,qe,Re,ln).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Od,"temporal"]),qm("sequential",Dm,[Od,"interpolating"]),qm("sequential-linear",Dm,[Od,"interpolating"]),qm("sequential-log",(function t(){var e=dm(Mm()).domain([1,10]);return e.copy=function(){return Em(e,t()).base(e.base())},qd.apply(e,arguments)}),[Od,"interpolating",Td]),qm("sequential-pow",Cm,[Od,"interpolating"]),qm("sequential-sqrt",(function(){return Cm.apply(null,arguments).exponent(.5)}),[Od,"interpolating"]),qm("sequential-symlog",(function t(){var e=mm(Mm());return e.copy=function(){return Em(e,t()).constant(e.constant())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("diverging-linear",(function t(){var e=am(Fm()(Og));return e.copy=function(){return Em(e,t())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("diverging-log",(function t(){var e=dm(Fm()).domain([.1,1,10]);return e.copy=function(){return Em(e,t()).base(e.base())},qd.apply(e,arguments)}),[Od,"interpolating",Td]),qm("diverging-pow",Sm,[Od,"interpolating"]),qm("diverging-sqrt",(function(){return Sm.apply(null,arguments).exponent(.5)}),[Od,"interpolating"]),qm("diverging-symlog",(function t(){var e=mm(Fm());return e.copy=function(){return Em(e,t()).constant(e.constant())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("quantile",(function t(){var e,n=[],r=[],i=[];function a(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t<e;)i[t-1]=xi(n,t/e);return u}function u(t){return isNaN(t=+t)?e:r[oi(i,t)]}return u.invertExtent=function(t){var e=r.indexOf(t);return e<0?[NaN,NaN]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},u.domain=function(t){if(!arguments.length)return n.slice();n=[];for(let e of t)null==e||isNaN(e=+e)||n.push(e);return n.sort(ii),a()},u.range=function(t){return arguments.length?(r=Array.from(t),a()):r.slice()},u.unknown=function(t){return arguments.length?(e=t,u):e},u.quantiles=function(){return i.slice()},u.copy=function(){return t().domain(n).range(r).unknown(e)},Rd.apply(u,arguments)}),["discretizing","quantile"]),qm("quantize",(function t(){var e,n=0,r=1,i=1,a=[.5],u=[0,1];function o(t){return t<=t?u[oi(a,t,0,i)]:e}function s(){var t=-1;for(a=new Array(i);++t<i;)a[t]=((t+1)*r-(t-i)*n)/(i+1);return o}return o.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,s()):[n,r]},o.range=function(t){return arguments.length?(i=(u=Array.from(t)).length-1,s()):u.slice()},o.invertExtent=function(t){var e=u.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,a[0]]:e>=i?[a[i-1],r]:[a[e-1],a[e]]},o.unknown=function(t){return arguments.length?(e=t,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return t().domain([n,r]).range(u).unknown(e)},Rd.apply(am(o),arguments)}),"discretizing"),qm("threshold",(function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[oi(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},Rd.apply(a,arguments)}),"discretizing"),qm("bin-ordinal",(function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(oi(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=Tm(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Nm.call(t),r):n.slice()},r.tickFormat=function(t,n){return im(e[0],k(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),qm("ordinal",Ld,"discrete"),qm("band",Bm,"discrete"),qm("point",(function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(Bm().paddingInner(1))}),"discrete");const Ym=["clamp","base","constant","exponent"];function Vm(t,e){var n=e[0],r=k(e)-n;return function(e){return t(n+e*r)}}function Gm(t,e,n){return Bg(Zm(e||"rgb",n),t)}function Xm(t,e){for(var n=new Array(e),r=e+1,i=0;i<e;)n[i]=t(++i/r);return n}function Jm(t,e,n){var r,i,a,u=n-e;return u&&Number.isFinite(u)?(r=(i=t.type).indexOf("-"),i=r<0?i:i.slice(r+1),a=qm(i)().domain([e,n]).range([0,1]),Ym.forEach(e=>t[e]?a[e](t[e]()):0),a):V(.5)}function Zm(t,e){var n=zg[function(t){return"interpolate"+t.toLowerCase().split("-").map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function Qm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}function Km(t,e){for(let n in t)ev(n,e(t[n]))}const tv={};function ev(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(tv[t]=e,this):tv[t]}Km({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Qm),Km({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",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",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=>Gm(Qm(t)));const nv=t=>u(t)?t.map(t=>String(t)):String(t);function rv(t,e,n){var r;return ot(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,~~(gt(t.domain())/n)||1))),o(e)&&(r=e.step,e=e.interval),s(e)&&(e="time"===t.type?Xu(e):t.type==Nd?Ju(e):i("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function iv(t,e,n){var r=t.range(),i=Math.floor(r[0]),a=Math.ceil(k(r));if(i>a&&(r=a,a=i,i=r),e=e.filter((function(e){return e=t(e),i<=e&&e<=a})),n>0&&e.length>1){for(var u=[e[0],k(e)];e.length>n&&e.length>=3;)e=e.filter((function(t,e){return!(e%2)}));e.length<3&&(e=u)}return e}function av(t,e){return t.bins?iv(t,t.bins):t.ticks?t.ticks(e):t.domain()}function uv(t,e,n,r,i){var a,u,o=t.type,s="time"===o||"time"===r?ao(n):o===Nd||r===Nd?uo(n):t.tickFormat?t.tickFormat(e,n):n?Qg(n):nv;if(Im(o)){var l=function(t){var e=Yg(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,e){return function(n){var r,i,a=t(n),u=a.indexOf(e);if(u<0)return a;for(i=(r=function(t,e){var n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if((n=t.charCodeAt(r))>=48&&n<=57)return r+1}(a,u))<a.length?a.slice(r):"";--r>u;)if("0"!==a[r]){++r;break}return a.slice(0,r)+i}}(Qg(e),Qg(".1f")(1)[1])}return Qg(e)}(n);s=i||t.bins?l:(a=s,u=l,t=>a(t)?u(t):"")}return s}function ov(t){Hr.call(this,null,t)}function sv(t){Hr.call(this,null,t)}function lv(){return St({})}function cv(t){return t.exit}function fv(t){Hr.call(this,null,t)}rt(ov,Hr).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=this.value,i=t.scale,a=rv(i,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||uv(i,a,t.formatSpecifier,t.formatType,!!t.values),o=t.values?iv(i,t.values,a):av(i,a);return r&&(n.rem=r),r=o.map((function(t,e){return St({index:e/(o.length-1||1),value:t,label:u(t)})})),t.extra&&r.length&&r.push(St({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},rt(sv,Hr).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=t.item||lv,o=t.key||Ct,s=this.value;return u(r.encode)&&(r.encode=null),s&&(t.modified("key")||e.modified(o))&&i("DataJoin does not support modified key function or fields."),s||(e=e.addAll(),this.value=s=et().test(cv),s.lookup=function(t){return s.get(o(t))}),e.visit(e.ADD,(function(t){var e=o(t),n=s.get(e);n?n.exit?(s.empty--,r.add.push(n)):r.mod.push(n):(s.set(e,n=a(t)),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(function(t){var e=o(t),n=s.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(function(t){var e=o(t),n=s.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++s.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),t.clean&&s.empty>n.cleanThreshold&&n.runAfter(s.clean),r},rt(fv,Hr).transform=function(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,a=e.encode;if(u(a)){if(!n.changed()&&!a.every((function(t){return i[t]})))return e.StopPropagation;a=a[0],n.encode=null}var o="enter"===a,s=i.update||v,l=i.enter||v,c=i.exit||v,f=(a&&!o?i[a]:s)||v;if(e.changed(e.ADD)&&(e.visit(e.ADD,(function(e){l(e,t),s(e,t)})),n.modifies(l.output),n.modifies(s.output),f!==v&&f!==s&&(e.visit(e.ADD,(function(e){f(e,t)})),n.modifies(f.output))),e.changed(e.REM)&&c!==v&&(e.visit(e.REM,(function(e){c(e,t)})),n.modifies(c.output)),o||f!==v){var h=e.MOD|(t.modified()?e.REFLOW:0);o?(e.visit(h,(function(e){var i=l(e,t)||r;(f(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(l.output)):e.visit(h,(function(e){(f(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(f.output)}return n.changed()?n:e.StopPropagation};const hv={quantile:"quantiles",quantize:"thresholds",threshold:"domain"},dv={quantile:"quantiles",quantize:"domain"};function pv(t,e){return t.bins?function(t){const e=t.slice(0,-1);return e.max=k(t),e}(t.bins):t.type===Td?function(t,e){var n=av(t,e),r=t.base(),i=Math.log(r),a=Math.max(1,r*e/n.length);return n.filter(t=>{var e=t/Math.pow(r,Math.round(Math.log(t)/i));return e*r<r-.5&&(e*=r),e<=a})}(t,e):hv[t.type]?function(t){const e=[-1/0].concat(t);return e.max=1/0,e}(t[hv[t.type]]()):av(t,e)}function gv(t,e,n,r,i,a){const u=dv[t.type]&&"time"!==i&&i!==Nd?function(t,e){var n,r=t[dv[t.type]](),i=r.length,a=i>1?r[1]-r[0]:r[0];for(n=1;n<i;++n)a=Math.min(a,r[n]-r[n-1]);return im(0,a,30,e)}(t,r):uv(t,e,r,i,a);return"symbol"===n&&function(t){return hv[t.type]||t.bins}(t)?function(t){return function(e,n,r){var i=mv(r[n+1],mv(r.max,1/0)),a=vv(e,t),u=vv(i,t);return a&&u?a+" – "+u:u?"< "+u:"≥ "+a}}(u):"discrete"===n?function(t){return function(e,n){return n?t(e):null}}(u):function(t){return function(e){return t(e)}}(u)}function mv(t,e){return null!=t?t:e}function vv(t,e){return Number.isFinite(t)?e(t):null}function yv(t){Hr.call(this,[],t)}rt(yv,Hr).transform=function(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,a,u,o=e.fork(e.NO_SOURCE|e.NO_FIELDS),s=this.value,l=t.type||"symbol",c=t.scale,f=+t.limit,h=rv(c,null==t.count?5:t.count,t.minstep),d=!!t.values||"symbol"===l,p=t.format||gv(c,h,l,t.formatSpecifier,t.formatType,d),g=t.values||pv(c,h);return s&&(o.rem=s),"symbol"===l?(f&&g.length>f?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),s=g.slice(0,f-1),u=!0):s=g,W(i=t.size)?(t.values||0!==c(s[0])||(s=s.slice(1)),a=s.reduce((function(e,n){return Math.max(e,i(n,t))}),0)):i=V(a=i||8),s=s.map((function(e,n){return St({index:n,label:p(e,n,s),value:e,offset:a,size:i(e,t)})})),u&&(u=g[s.length],s.push(St({index:s.length,label:`…${g.length-s.length} entries`,value:u,offset:a,size:i(u,t)})))):"gradient"===l?(n=c.domain(),r=Jm(c,n[0],k(n)),g.length<3&&!t.values&&n[0]!==k(n)&&(g=[n[0],k(n)]),s=g.map((function(t,e){return St({index:e,label:p(t,e,g),value:t,perc:r(t)})}))):(i=g.length-1,r=function(t){var e=t.domain(),n=e.length-1,r=+e[0],i=+k(e),a=i-r;if("threshold"===t.type){var u=n?a/n:.1;a=(i+=u)-(r-=u)}return function(t){return(t-r)/a}}(c),s=g.map((function(t,e){return St({index:e,label:p(t,e,g),value:t,perc:e?r(t):0,perc2:e===i?1:r(g[e+1])})}))),o.source=s,o.add=s,this.value=s,o};var _v=et({line:Mv,"line-radial":function(t,e,n,r){return Mv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:Ev,"arc-radial":function(t,e,n,r){return Ev(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:Dv,"curve-radial":function(t,e,n,r){return Dv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(n),o=Math.sin(n),s=Math.abs(n-t)>Math.PI?n<=t:n>t;return"M"+e*i+","+e*a+"A"+e+","+e+" 0 0,"+(s?1:0)+" "+e*u+","+e*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(n),o=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function xv(t){return t.source.x}function bv(t){return t.source.y}function wv(t){return t.target.x}function Av(t){return t.target.y}function kv(t){Hr.call(this,{},t)}function Mv(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function Ev(t,e,n,r){var i=n-t,a=r-e,u=Math.sqrt(i*i+a*a)/2;return"M"+t+","+e+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function Dv(t,e,n,r){var i=n-t,a=r-e,u=.2*(i+a),o=.2*(a-i);return"M"+t+","+e+"C"+(t+u)+","+(e+o)+" "+(n+o)+","+(r-u)+" "+n+","+r}function Cv(t){Hr.call(this,null,t)}kv.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"}]},rt(kv,Hr).transform=function(t,e){var n=t.sourceX||xv,r=t.sourceY||bv,a=t.targetX||wv,u=t.targetY||Av,o=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=_v.get(l+"-"+s)||_v.get(l);return c||i("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(function(t){t[o]=c(n(t),r(t),a(t),u(t))})),e.reflow(t.modified()).modifies(o)},Cv.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"]}]},rt(Cv,Hr).transform=function(t,e){var n,r,i,a=t.as||["startAngle","endAngle"],u=a[0],o=a[1],s=t.field||g,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,p=l,m=(c-l)/wi(h),v=li(d);for(t.sort&&v.sort((function(t,e){return h[t]-h[e]})),n=0;n<d;++n)i=h[v[n]],(r=f[v[n]])[u]=p,r[o]=p+=i*m;return this.value=h,e.reflow(t.modified()).modifies(a)};function Fv(t){return Pm(t)&&"sequential"!==t}var Sv=xt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function Bv(t){Hr.call(this,null,t),this.modified(!0)}function zv(t,e,n){Im(t)&&(Math.abs(e.reduce((function(t,e){return t+(e<0?-1:e>0?1:0)}),0))!==e.length&&n.warn("Log scale domain includes zero: "+l(e)));return e}function Tv(t,e,n){return W(t)&&(e||n)?Vm(t,Nv(e||[0,1],n)):t}function Nv(t,e){return e?t.slice().reverse():t}function Ov(t){Hr.call(this,null,t)}rt(Bv,Hr).transform=function(t,e){var n=e.dataflow,r=this.value,a=function(t){var e,n=t.type,r="";if("sequential"===n)return"sequential-linear";(function(t){const e=t.type;return Pm(e)&&"time"!==e&&e!==Nd&&(t.scheme||t.range&&t.range.length&&t.range.every(s))})(t)&&(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===e?"sequential-":3===e?"diverging-":"");return(r+n||"linear").toLowerCase()}(t);for(a in r&&a===r.type||(this.value=r=qm(a)()),t)if(!Sv[a]){if("padding"===a&&Fv(r.type))continue;W(r[a])?r[a](t[a]):n.warn("Unsupported scale property: "+a)}return function(t,e,n){var r=t.type,a=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){"band"!==t&&"point"!==t&&i("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,a="point"===t?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*zd(n,a,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,a,o=e.schemeExtent;u(e.scheme)?a=Gm(e.scheme,e.interpolate,e.interpolateGamma):(r=e.scheme.toLowerCase(),(a=ev(r))||i(`Unrecognized scheme name: ${e.scheme}`));return n="threshold"===t?n+1:"bin-ordinal"===t?n-1:"quantile"===t||"quantize"===t?+e.schemeCount||5:n,Hm(t)?Tv(a,o,e.reverse):W(a)?Xm(Tv(a,o),n):"ordinal"===t?a:a.slice(0,n)}(r,e,n),W(o))){if(t.interpolator)return t.interpolator(o);i(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&Hm(r))return t.interpolator(Gm(Nv(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(Zm(e.interpolate,e.interpolateGamma)):W(t.round)?t.round(a):W(t.rangeRound)&&t.interpolate(a?lg:sg);o&&t.range(Nv(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!u(r)){let e=t.domain(),n=e[0],a=k(e),u=null==r.start?n:r.start,o=null==r.stop?a:r.stop,s=r.step;s||i("Scale bins parameter missing step property."),u<n&&(u=s*Math.ceil(n/s)),o>a&&(o=s*Math.floor(a/s)),r=li(u,o+s/2,s)}r?t.bins=r:t.bins&&delete t.bins;"bin-ordinal"===t.type&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){var r=function(t,e,n){return e?(t.domain(zv(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,a,u=e.domain,o=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&("linear"===e||"pow"===e||"sqrt"===e)}(t);if(!u)return 0;Fv(o)&&e.padding&&u[0]!==k(u)&&(u=function(t,e,n,r,i,a){var u=Math.abs(k(n)-n[0]),o=u/(u-2*r),s=t===Td?U(e,null,o):"sqrt"===t?L(e,null,o,.5):"pow"===t?L(e,null,o,i||1):"symlog"===t?P(e,null,o,a||1):q(e,null,o);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(o,u,e.range,e.padding,e.exponent,e.constant));(s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=e.domainMin&&(u[0]=e.domainMin),null!=e.domainMax&&(u[i]=e.domainMax),null!=e.domainMid&&(((a=e.domainMid)<u[0]||a>u[i])&&n.warn("Scale domainMid exceeds domain min or max.",a),u.splice(i,0,a)));t.domain(zv(o,u,n)),"ordinal"===o&&t.unknown(e.domainImplicit?Ud:void 0);e.nice&&t.nice&&t.nice(!0!==e.nice&&rv(t,e.nice)||null);return u.length}(r,t,n))),e.fork(e.NO_SOURCE|e.NO_FIELDS)},rt(Ov,Hr).transform=function(t,e){var n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(Nt(t.sort)),this.modified(n),e};var Rv=["y0","y1"];function qv(t){Hr.call(this,null,t)}function Uv(t,e,n,r,i){for(var a,u=(e-t.sum)/2,o=t.length,s=0;s<o;++s)(a=t[s])[r]=u,a[i]=u+=Math.abs(n(a))}function Lv(t,e,n,r,i){for(var a,u=1/t.sum,o=0,s=t.length,l=0,c=0;l<s;++l)(a=t[l])[r]=o,a[i]=o=u*(c+=Math.abs(n(a)))}function Pv(t,e,n,r,i){for(var a,u,o=0,s=0,l=t.length,c=0;c<l;++c)(a=+n(u=t[c]))<0?(u[r]=s,u[i]=s+=a):(u[r]=o,u[i]=o+=a)}qv.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:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:Rv}]},rt(qv,Hr).transform=function(t,e){var n,r,i,a,u=t.as||Rv,o=u[0],s=u[1],l=Nt(t.sort),c=t.field||g,f="center"===t.offset?Uv:"normalize"===t.offset?Lv:Pv;for(n=function(t,e,n,r){var i,a,u,o,s,l,c,f,h,d=[],p=function(t){return t(s)};if(null==e)d.push(t.slice());else for(i={},a=0,u=t.length;a<u;++a)s=t[a],l=e.map(p),(c=i[l])||(i[l]=c=[],d.push(c)),c.push(s);for(l=0,h=0,o=d.length;l<o;++l){for(c=d[l],a=0,f=0,u=c.length;a<u;++a)f+=Math.abs(r(c[a]));c.sum=f,f>h&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,a=n.max;r<i;++r)f(n[r],a,c,o,s);return e.reflow(t.modified()).modifies(u)};var $v=Object.freeze({__proto__:null,axisticks:ov,datajoin:sv,encode:fv,legendentries:yv,linkpath:kv,pie:Cv,scale:Bv,sortitems:Ov,stack:qv,validTicks:iv});function jv(){}const Iv=[[],[[[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 Hv(){var t=1,e=1,n=o;function r(t,e){return e.map(e=>a(t,e))}function a(r,i){var a=[],o=[];return function(n,r,i){var a,o,s,l,c,f,h=new Array,d=new Array;a=o=-1,l=n[0]>=r,Iv[l<<1].forEach(p);for(;++a<t-1;)s=l,l=n[a+1]>=r,Iv[s|l<<1].forEach(p);Iv[l<<0].forEach(p);for(;++o<e-1;){for(a=-1,l=n[o*t+t]>=r,c=n[o*t]>=r,Iv[l<<1|c<<2].forEach(p);++a<t-1;)s=l,l=n[o*t+t+a+1]>=r,f=c,c=n[o*t+a+1]>=r,Iv[s|l<<1|c<<2|f<<3].forEach(p);Iv[l|c<<3].forEach(p)}a=-1,c=n[o*t]>=r,Iv[c<<2].forEach(p);for(;++a<t-1;)f=c,c=n[o*t+a+1]>=r,Iv[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+o],s=[t[1][0]+a,t[1][1]+o],l=u(r),c=u(s);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(s),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(s),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,s]}}Iv[c<<3].forEach(p)}(r,i,(function(t){n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?a.push([t]):o.push(t)})),o.forEach((function(t){for(var e,n=0,r=a.length;n<r;++n)if(-1!==Wv((e=a[n])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function u(e){return 2*e[0]+e[1]*(t+1)*4}function o(n,r,i){n.forEach((function(n){var a,u=n[0],o=n[1],s=0|u,l=0|o,c=r[l*t+s];u>0&&u<t&&s===u&&(a=r[l*t+s-1],n[0]=u+(i-a)/(c-a)-.5),o>0&&o<e&&l===o&&(a=r[(l-1)*t+s],n[1]=o+(i-a)/(c-a)-.5)}))}return r.contour=a,r.size=function(n){if(!arguments.length)return[t,e];var a=Math.ceil(n[0]),u=Math.ceil(n[1]);return a>0&&u>0||i("invalid size"),t=a,e=u,r},r.smooth=function(t){return arguments.length?(n=t?o:jv,r):n===o},r}function Wv(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Yv(t,e[r]))return n;return 0}function Yv(t,e){for(var n=e[0],r=e[1],i=-1,a=0,u=t.length,o=u-1;a<u;o=a++){var s=t[a],l=s[0],c=s[1],f=t[o],h=f[0],d=f[1];if(Vv(s,f,e))return 0;c>r!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function Vv(t,e,n){var r,i,a,u;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],a=n[r],u=e[r],i<=a&&a<=u||u<=a&&a<=i)}function Gv(t,e,n){return function(r){var i=J(r),a=n?Math.min(i[0],0):i[0],u=i[1],o=u-a,s=e?gi(a,u,t):o/(t+1);return li(s,u,s)}}function Xv(t){Hr.call(this,null,t)}function Jv(t,e,n,r,i){const a=t.x1||0,u=t.y1||0,o=e*n<0;function s(t){t.forEach(l)}function l(t){o&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*e+r,t[1]=(t[1]-u)*n+i}return function(t){return t.coordinates.forEach(s),t}}function Zv(t,e,n){const r=t>=0?t:Mi(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Qv(t){return W(t)?t:V(+t)}function Kv(){var t=t=>t[0],e=t=>t[1],n=g,r=[-1,-1],a=960,u=500,o=2;function s(i,s){const l=Zv(r[0],i,t)>>o,c=Zv(r[1],i,e)>>o,f=l?l+2:0,h=c?c+2:0,d=2*f+(a>>o),p=2*h+(u>>o),g=new Float32Array(d*p),m=new Float32Array(d*p);let v=g;i.forEach(r=>{const i=f+(+t(r)>>o),a=h+(+e(r)>>o);i>=0&&i<d&&a>=0&&a<p&&(g[i+a*d]+=+n(r))}),l>0&&c>0?(ty(d,p,g,m,l),ey(d,p,m,g,c),ty(d,p,g,m,l),ey(d,p,m,g,c),ty(d,p,g,m,l),ey(d,p,m,g,c)):l>0?(ty(d,p,g,m,l),ty(d,p,m,g,l),ty(d,p,g,m,l),v=m):c>0&&(ey(d,p,g,m,c),ey(d,p,m,g,c),ey(d,p,g,m,c),v=m);let y=s?Math.pow(2,-2*o):1/wi(v);for(let t=0,e=d*p;t<e;++t)v[t]*=y;return{values:v,scale:1<<o,width:d,height:p,x1:f,y1:h,x2:f+(a>>o),y2:h+(u>>o)}}return s.x=function(e){return arguments.length?(t=Qv(e),s):t},s.y=function(t){return arguments.length?(e=Qv(t),s):e},s.weight=function(t){return arguments.length?(n=Qv(t),s):n},s.size=function(t){if(!arguments.length)return[a,u];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);return e>=0||e>=0||i("invalid size"),a=e,u=n,s},s.cellSize=function(t){return arguments.length?((t=+t)>=1||i("invalid cell size"),o=Math.floor(Math.log(t)/Math.LN2),s):1<<o},s.bandwidth=function(t){return arguments.length?(1===(t=I(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&i("invalid bandwidth"),r=t,s):r},s}function ty(t,e,n,r,i){const a=1+(i<<1);for(let u=0;u<e;++u)for(let e=0,o=0;e<t+i;++e)e<t&&(o+=n[e+u*t]),e>=i&&(e>=a&&(o-=n[e-a+u*t]),r[e-i+u*t]=o/Math.min(e+1,t-1+a-e,a))}function ey(t,e,n,r,i){const a=1+(i<<1);for(let u=0;u<t;++u)for(let o=0,s=0;o<e+i;++o)o<e&&(s+=n[u+o*t]),o>=i&&(o>=a&&(s-=n[u+(o-a)*t]),r[u+(o-i)*t]=s/Math.min(o+1,e-1+a-o,a))}function ny(t){Hr.call(this,null,t)}Xv.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"}]},rt(Xv,Hr).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||d,a=Hv().smooth(!1!==t.smooth),o=t.thresholds||function(t,e,n){const r=Gv(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map(t=>mi(e(t).values)))}(r,i,t),s=null===t.as?null:t.as||"contour",l=[];return r.forEach(e=>{const n=i(e),r=a.size([n.width,n.height])(n.values,u(o)?o:o(n.values));!function(t,e,n,r){let i=r.scale||e.scale,a=r.translate||e.translate;W(i)&&(i=i(n,r));W(a)&&(a=a(n,r));if((1===i||null==i)&&!a)return;const u=(ot(i)?i:i[0])||1,o=(ot(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(Jv(e,u,o,s,l))}(r,n,e,t),r.forEach(t=>{l.push(zt(e,St(null!=s?{[s]:t}:t)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n},ny.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"}]};var ry=rt(ny,Hr);const iy=["x","y","weight","size","cellSize","bandwidth"];function ay(t,e){return iy.forEach(n=>null!=e[n]?t[n](e[n]):0),t}function uy(t){Hr.call(this,null,t)}ry.transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=function(t,e){var n,r,i,a,u,o,s=[],l=t=>t(a);if(null==e)s.push(t);else for(n={},r=0,i=t.length;r<i;++r)a=t[r],u=e.map(l),(o=n[u])||(n[u]=o=[],o.dims=u,s.push(o)),o.push(a);return s}(e.materialize(e.SOURCE).source,t.groupby),u=(t.groupby||[]).map(n),o=ay(Kv(),t),s=t.as||"grid";return r=a.map(e=>St(function(t,e){for(let n=0;n<u.length;++n)t[u[n]]=e[n];return t}({[s]:o(e,t.counts)},e.dims))),this.value&&(i.rem=this.value),this.value=i.source=i.add=r,i},uy.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}]},rt(uy,Hr).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=Hv().smooth(!1!==t.smooth),o=t.values,s=t.thresholds||Gv(t.count||10,t.nice,!!o),l=t.size;return o||(o=e.materialize(e.SOURCE).source,r=Jv(n=ay(Kv(),t)(o,!0),n.scale||1,n.scale||1,0,0),l=[n.width,n.height],o=n.values),s=u(s)?s:s(o),o=a.size(l)(o,s),r&&o.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(o||[]).map(St),i};function oy(t){Hr.call(this,null,t)}function sy(){return new ly}function ly(){this.reset()}oy.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},rt(oy,Hr).transform=function(t,e){var n,i=this._features,a=this._points,u=t.fields,o=u&&u[0],s=u&&u[1],l=t.geojson||!u&&d,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(r(l))||o&&e.modified(r(o))||s&&e.modified(r(s)),this.value&&!n||(c=e.SOURCE,this._features=i=[],this._points=a=[]),l&&e.visit(c,(function(t){i.push(l(t))})),o&&s&&(e.visit(c,(function(t){var e=o(t),n=s(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&a.push([e,n])})),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:a}})),this.value={type:"FeatureCollection",features:i}},ly.prototype={constructor:ly,reset:function(){this.s=this.t=0},add:function(t){fy(cy,t,this.t),fy(this,cy.s,this.s),this.s?this.t+=cy.t:this.s=cy.t},valueOf:function(){return this.s}};var cy=new ly;function fy(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}var hy=Math.PI,dy=hy/2,py=hy/4,gy=2*hy,my=180/hy,vy=hy/180,yy=Math.abs,_y=Math.atan,xy=Math.atan2,by=Math.cos,wy=Math.ceil,Ay=Math.exp,ky=Math.log,My=Math.pow,Ey=Math.sin,Dy=Math.sign||function(t){return t>0?1:t<0?-1:0},Cy=Math.sqrt,Fy=Math.tan;function Sy(t){return t>1?0:t<-1?hy:Math.acos(t)}function By(t){return t>1?dy:t<-1?-dy:Math.asin(t)}function zy(){}function Ty(t,e){t&&Oy.hasOwnProperty(t.type)&&Oy[t.type](t,e)}var Ny={Feature:function(t,e){Ty(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Ty(n[r].geometry,e)}},Oy={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Ry(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Ry(n[r],e,0)},Polygon:function(t,e){qy(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)qy(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Ty(n[r],e)}};function Ry(t,e,n){var r,i=-1,a=t.length-n;for(e.lineStart();++i<a;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function qy(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Ry(t[n],e,1);e.polygonEnd()}function Uy(t,e){t&&Ny.hasOwnProperty(t.type)?Ny[t.type](t,e):Ty(t,e)}var Ly,Py,$y,jy,Iy,Hy=sy(),Wy=sy(),Yy={point:zy,lineStart:zy,lineEnd:zy,polygonStart:function(){Hy.reset(),Yy.lineStart=Vy,Yy.lineEnd=Gy},polygonEnd:function(){var t=+Hy;Wy.add(t<0?gy+t:t),this.lineStart=this.lineEnd=this.point=zy},sphere:function(){Wy.add(gy)}};function Vy(){Yy.point=Xy}function Gy(){Jy(Ly,Py)}function Xy(t,e){Yy.point=Jy,Ly=t,Py=e,$y=t*=vy,jy=by(e=(e*=vy)/2+py),Iy=Ey(e)}function Jy(t,e){var n=(t*=vy)-$y,r=n>=0?1:-1,i=r*n,a=by(e=(e*=vy)/2+py),u=Ey(e),o=Iy*u,s=jy*a+o*by(i),l=o*r*Ey(i);Hy.add(xy(l,s)),$y=t,jy=a,Iy=u}function Zy(t){return[xy(t[1],t[0]),By(t[2])]}function Qy(t){var e=t[0],n=t[1],r=by(n);return[r*by(e),r*Ey(e),Ey(n)]}function Ky(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function t_(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function e_(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function n_(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function r_(t){var e=Cy(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var i_,a_,u_,o_,s_,l_,c_,f_,h_,d_,p_,g_,m_,v_,y_,__,x_,b_,w_,A_,k_,M_,E_,D_,C_,F_,S_=sy(),B_={point:z_,lineStart:N_,lineEnd:O_,polygonStart:function(){B_.point=R_,B_.lineStart=q_,B_.lineEnd=U_,S_.reset(),Yy.polygonStart()},polygonEnd:function(){Yy.polygonEnd(),B_.point=z_,B_.lineStart=N_,B_.lineEnd=O_,Hy<0?(i_=-(u_=180),a_=-(o_=90)):S_>1e-6?o_=90:S_<-1e-6&&(a_=-90),d_[0]=i_,d_[1]=u_},sphere:function(){i_=-(u_=180),a_=-(o_=90)}};function z_(t,e){h_.push(d_=[i_=t,u_=t]),e<a_&&(a_=e),e>o_&&(o_=e)}function T_(t,e){var n=Qy([t*vy,e*vy]);if(f_){var r=t_(f_,n),i=t_([r[1],-r[0],0],r);r_(i),i=Zy(i);var a,u=t-s_,o=u>0?1:-1,s=i[0]*my*o,l=yy(u)>180;l^(o*s_<s&&s<o*t)?(a=i[1]*my)>o_&&(o_=a):l^(o*s_<(s=(s+360)%360-180)&&s<o*t)?(a=-i[1]*my)<a_&&(a_=a):(e<a_&&(a_=e),e>o_&&(o_=e)),l?t<s_?L_(i_,t)>L_(i_,u_)&&(u_=t):L_(t,u_)>L_(i_,u_)&&(i_=t):u_>=i_?(t<i_&&(i_=t),t>u_&&(u_=t)):t>s_?L_(i_,t)>L_(i_,u_)&&(u_=t):L_(t,u_)>L_(i_,u_)&&(i_=t)}else h_.push(d_=[i_=t,u_=t]);e<a_&&(a_=e),e>o_&&(o_=e),f_=n,s_=t}function N_(){B_.point=T_}function O_(){d_[0]=i_,d_[1]=u_,B_.point=z_,f_=null}function R_(t,e){if(f_){var n=t-s_;S_.add(yy(n)>180?n+(n>0?360:-360):n)}else l_=t,c_=e;Yy.point(t,e),T_(t,e)}function q_(){Yy.lineStart()}function U_(){R_(l_,c_),Yy.lineEnd(),yy(S_)>1e-6&&(i_=-(u_=180)),d_[0]=i_,d_[1]=u_,f_=null}function L_(t,e){return(e-=t)<0?e+360:e}function P_(t,e){return t[0]-e[0]}function $_(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var j_={sphere:zy,point:I_,lineStart:W_,lineEnd:G_,polygonStart:function(){j_.lineStart=X_,j_.lineEnd=J_},polygonEnd:function(){j_.lineStart=W_,j_.lineEnd=G_}};function I_(t,e){t*=vy;var n=by(e*=vy);H_(n*by(t),n*Ey(t),Ey(e))}function H_(t,e,n){++p_,m_+=(t-m_)/p_,v_+=(e-v_)/p_,y_+=(n-y_)/p_}function W_(){j_.point=Y_}function Y_(t,e){t*=vy;var n=by(e*=vy);D_=n*by(t),C_=n*Ey(t),F_=Ey(e),j_.point=V_,H_(D_,C_,F_)}function V_(t,e){t*=vy;var n=by(e*=vy),r=n*by(t),i=n*Ey(t),a=Ey(e),u=xy(Cy((u=C_*a-F_*i)*u+(u=F_*r-D_*a)*u+(u=D_*i-C_*r)*u),D_*r+C_*i+F_*a);g_+=u,__+=u*(D_+(D_=r)),x_+=u*(C_+(C_=i)),b_+=u*(F_+(F_=a)),H_(D_,C_,F_)}function G_(){j_.point=I_}function X_(){j_.point=Z_}function J_(){Q_(M_,E_),j_.point=I_}function Z_(t,e){M_=t,E_=e,t*=vy,e*=vy,j_.point=Q_;var n=by(e);D_=n*by(t),C_=n*Ey(t),F_=Ey(e),H_(D_,C_,F_)}function Q_(t,e){t*=vy;var n=by(e*=vy),r=n*by(t),i=n*Ey(t),a=Ey(e),u=C_*a-F_*i,o=F_*r-D_*a,s=D_*i-C_*r,l=Cy(u*u+o*o+s*s),c=By(l),f=l&&-c/l;w_+=f*u,A_+=f*o,k_+=f*s,g_+=c,__+=c*(D_+(D_=r)),x_+=c*(C_+(C_=i)),b_+=c*(F_+(F_=a)),H_(D_,C_,F_)}function K_(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function tx(t,e){return[yy(t)>hy?t+Math.round(-t/gy)*gy:t,e]}function ex(t,e,n){return(t%=gy)?e||n?K_(rx(t),ix(e,n)):rx(t):e||n?ix(e,n):tx}function nx(t){return function(e,n){return[(e+=t)>hy?e-gy:e<-hy?e+gy:e,n]}}function rx(t){var e=nx(t);return e.invert=nx(-t),e}function ix(t,e){var n=by(t),r=Ey(t),i=by(e),a=Ey(e);function u(t,e){var u=by(e),o=by(t)*u,s=Ey(t)*u,l=Ey(e),c=l*n+o*r;return[xy(s*i-c*a,o*n-l*r),By(c*i+s*a)]}return u.invert=function(t,e){var u=by(e),o=by(t)*u,s=Ey(t)*u,l=Ey(e),c=l*i-s*a;return[xy(s*i+l*a,o*n+c*r),By(c*n-o*r)]},u}function ax(t,e){(e=Qy(e))[0]-=t,r_(e);var n=Sy(-e[1]);return((-e[2]<0?-n:n)+gy-1e-6)%gy}function ux(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:zy,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ox(t,e){return yy(t[0]-e[0])<1e-6&&yy(t[1]-e[1])<1e-6}function sx(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lx(t,e,n,r,i){var a,u,o=[],s=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],u=t[e];if(ox(r,u)){for(i.lineStart(),a=0;a<e;++a)i.point((r=t[a])[0],r[1]);i.lineEnd()}else o.push(n=new sx(r,t,null,!0)),s.push(n.o=new sx(r,null,n,!1)),o.push(n=new sx(u,t,null,!1)),s.push(n.o=new sx(u,null,n,!0))}})),o.length){for(s.sort(e),cx(o),cx(s),a=0,u=s.length;a<u;++a)s[a].e=n=!n;for(var l,c,f=o[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,u=l.length;a<u;++a)i.point((c=l[a])[0],c[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(l=h.p.z,a=l.length-1;a>=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function cx(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}tx.invert=tx;var fx=sy();function hx(t){return yy(t[0])<=hy?t[0]:Dy(t[0])*((yy(t[0])+hy)%gy-hy)}function dx(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}!function(t){var e;1===t.length&&(e=t,t=function(t,n){return dx(e(t),n)})}(dx);function px(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}function gx(t){for(var e,n,r,i=t.length,a=-1,u=0;++a<i;)u+=t[a].length;for(n=new Array(u);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--u]=r[e];return n}function mx(t,e,n,r){return function(i){var a,u,o,s=e(i),l=ux(),c=e(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=_,u=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,u=gx(u);var t=function(t,e){var n=hx(e),r=e[1],i=Ey(r),a=[Ey(n),-by(n),0],u=0,o=0;fx.reset(),1===i?r=dy+1e-6:-1===i&&(r=-dy-1e-6);for(var s=0,l=t.length;s<l;++s)if(f=(c=t[s]).length)for(var c,f,h=c[f-1],d=hx(h),p=h[1]/2+py,g=Ey(p),m=by(p),v=0;v<f;++v,d=_,g=b,m=w,h=y){var y=c[v],_=hx(y),x=y[1]/2+py,b=Ey(x),w=by(x),A=_-d,k=A>=0?1:-1,M=k*A,E=M>hy,D=g*b;if(fx.add(xy(D*k*Ey(M),m*w+D*by(M))),u+=E?A+k*gy:A,E^d>=n^_>=n){var C=t_(Qy(h),Qy(y));r_(C);var F=t_(a,C);r_(F);var S=(E^A>=0?-1:1)*By(F[2]);(r>S||r===S&&(C[0]||C[1]))&&(o+=E^A>=0?1:-1)}}return(u<-1e-6||u<1e-6&&fx<-1e-6)^1&o}(a,r);u.length?(f||(i.polygonStart(),f=!0),lx(u,yx,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),u=a=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){s.point(t,e)}function g(){h.point=p,s.lineStart()}function m(){h.point=d,s.lineEnd()}function v(t,e){o.push([t,e]),c.point(t,e)}function y(){c.lineStart(),o=[]}function _(){v(o[0][0],o[0][1]),c.lineEnd();var t,e,n,r,s=c.clean(),h=l.result(),d=h.length;if(o.pop(),a.push(o),o=null,d)if(1&s){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),u.push(h.filter(vx))}return h}}function vx(t){return t.length>1}function yx(t,e){return((t=t.x)[0]<0?t[1]-dy-1e-6:dy-t[1])-((e=e.x)[0]<0?e[1]-dy-1e-6:dy-e[1])}var _x=mx((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,u){var o=a>0?hy:-hy,s=yy(a-n);yy(s-hy)<1e-6?(t.point(n,r=(r+u)/2>0?dy:-dy),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),e=0):i!==o&&s>=hy&&(yy(n-i)<1e-6&&(n-=1e-6*i),yy(a-o)<1e-6&&(a-=1e-6*o),r=function(t,e,n,r){var i,a,u=Ey(t-n);return yy(u)>1e-6?_y((Ey(e)*(a=by(r))*Ey(n)-Ey(r)*(i=by(e))*Ey(t))/(i*a*u)):(e+r)/2}(n,r,a,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),e=0),t.point(n=a,r=u),i=o},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*dy,r.point(-hy,i),r.point(0,i),r.point(hy,i),r.point(hy,0),r.point(hy,-i),r.point(0,-i),r.point(-hy,-i),r.point(-hy,0),r.point(-hy,i);else if(yy(t[0]-e[0])>1e-6){var a=t[0]<e[0]?hy:-hy;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(e[0],e[1])}),[-hy,-dy]);function xx(t){var e=by(t),n=6*vy,r=e>0,i=yy(e)>1e-6;function a(t,n){return by(t)*by(n)>e}function u(t,n,r){var i=[1,0,0],a=t_(Qy(t),Qy(n)),u=Ky(a,a),o=a[0],s=u-o*o;if(!s)return!r&&t;var l=e*u/s,c=-e*o/s,f=t_(i,a),h=n_(i,l);e_(h,n_(a,c));var d=f,p=Ky(h,d),g=Ky(d,d),m=p*p-g*(Ky(h,h)-1);if(!(m<0)){var v=Cy(m),y=n_(d,(-p-v)/g);if(e_(y,h),y=Zy(y),!r)return y;var _,x=t[0],b=n[0],w=t[1],A=n[1];b<x&&(_=x,x=b,b=_);var k=b-x,M=yy(k-hy)<1e-6;if(!M&&A<w&&(_=w,w=A,A=_),M||k<1e-6?M?w+A>0^y[1]<(yy(y[0]-x)<1e-6?w:A):w<=y[1]&&y[1]<=A:k>hy^(x<=y[0]&&y[0]<=b)){var E=n_(d,(-p+v)/g);return e_(E,h),[y,Zy(E)]}}}function o(e,n){var i=r?t:hy-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return mx(a,(function(t){var e,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=a(f,h),m=r?g?0:o(f,h):g?o(f+(f<0?hy:-hy),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=u(e,p))||ox(e,d)||ox(p,d))&&(p[0]+=1e-6,p[1]+=1e-6,g=a(p[0],p[1])),g!==s)c=0,g?(t.lineStart(),d=u(p,e),t.point(d[0],d[1])):(d=u(e,p),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(i&&e&&r^g){var v;m&n||!(v=u(p,e,!0))||(c=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])))}!g||e&&ox(e,p)||t.point(p[0],p[1]),e=p,s=g,n=m},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return c|(l&&s)<<1}}}),(function(e,r,i,a){!function(t,e,n,r,i,a){if(n){var u=by(e),o=Ey(e),s=r*n;null==i?(i=e+r*gy,a=e-s/2):(i=ax(u,i),a=ax(u,a),(r>0?i<a:i>a)&&(i+=r*gy));for(var l,c=i;r>0?c>a:c<a;c-=s)l=Zy([u,-o*by(c),-o*Ey(c)]),t.point(l[0],l[1])}}(a,t,n,i,e,r)}),r?[0,-t]:[-hy,t-hy])}function bx(t,e,n,r){function i(i,a){return t<=i&&i<=n&&e<=a&&a<=r}function a(i,a,o,l){var c=0,f=0;if(null==i||(c=u(i,o))!==(f=u(a,o))||s(i,a)<0^o>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+o+4)%4)!==f);else l.point(a[0],a[1])}function u(r,i){return yy(r[0]-t)<1e-6?i>0?0:3:yy(r[0]-n)<1e-6?i>0?2:1:yy(r[1]-e)<1e-6?i>0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var n=u(t,1),r=u(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(u){var s,l,c,f,h,d,p,g,m,v,y,_=u,x=ux(),b={point:w,lineStart:function(){b.point=A,l&&l.push(c=[]);v=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(A(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var a,u,o=l[n],s=1,c=o.length,f=o[0],h=f[0],d=f[1];s<c;++s)a=h,u=d,f=o[s],h=f[0],d=f[1],u<=r?d>r&&(h-a)*(r-u)>(d-u)*(t-a)&&++e:d<=r&&(h-a)*(r-u)<(d-u)*(t-a)&&--e;return e}(),n=y&&e,i=(s=gx(s)).length;(n||i)&&(u.polygonStart(),n&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),i&&lx(s,o,e,a,u),u.polygonEnd());_=u,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function A(a,u){var o=i(a,u);if(l&&c.push([a,u]),v)f=a,h=u,d=o,v=!1,o&&(_.lineStart(),_.point(a,u));else if(o&&m)_.point(a,u);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),g=Math.max(-1e9,Math.min(1e9,g))],x=[a=Math.max(-1e9,Math.min(1e9,a)),u=Math.max(-1e9,Math.min(1e9,u))];!function(t,e,n,r,i,a){var u,o=t[0],s=t[1],l=0,c=1,f=e[0]-o,h=e[1]-s;if(u=n-o,f||!(u>0)){if(u/=f,f<0){if(u<l)return;u<c&&(c=u)}else if(f>0){if(u>c)return;u>l&&(l=u)}if(u=i-o,f||!(u<0)){if(u/=f,f<0){if(u>c)return;u>l&&(l=u)}else if(f>0){if(u<l)return;u<c&&(c=u)}if(u=r-s,h||!(u>0)){if(u/=h,h<0){if(u<l)return;u<c&&(c=u)}else if(h>0){if(u>c)return;u>l&&(l=u)}if(u=a-s,h||!(u<0)){if(u/=h,h<0){if(u>c)return;u>l&&(l=u)}else if(h>0){if(u<l)return;u<c&&(c=u)}return l>0&&(t[0]=o+l*f,t[1]=s+l*h),c<1&&(e[0]=o+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?o&&(_.lineStart(),_.point(a,u),y=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),o||_.lineEnd(),y=!1)}p=a,g=u,m=o}return b}}function wx(t,e,n){var r=px(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Ax(t,e,n){var r=px(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}function kx(t){return t}var Mx,Ex,Dx,Cx,Fx=sy(),Sx=sy(),Bx={point:zy,lineStart:zy,lineEnd:zy,polygonStart:function(){Bx.lineStart=zx,Bx.lineEnd=Ox},polygonEnd:function(){Bx.lineStart=Bx.lineEnd=Bx.point=zy,Fx.add(yy(Sx)),Sx.reset()},result:function(){var t=Fx/2;return Fx.reset(),t}};function zx(){Bx.point=Tx}function Tx(t,e){Bx.point=Nx,Mx=Dx=t,Ex=Cx=e}function Nx(t,e){Sx.add(Cx*t-Dx*e),Dx=t,Cx=e}function Ox(){Nx(Mx,Ex)}var Rx=1/0,qx=Rx,Ux=-Rx,Lx=Ux,Px={point:function(t,e){t<Rx&&(Rx=t);t>Ux&&(Ux=t);e<qx&&(qx=e);e>Lx&&(Lx=e)},lineStart:zy,lineEnd:zy,polygonStart:zy,polygonEnd:zy,result:function(){var t=[[Rx,qx],[Ux,Lx]];return Ux=Lx=-(qx=Rx=1/0),t}};var $x,jx,Ix,Hx,Wx=0,Yx=0,Vx=0,Gx=0,Xx=0,Jx=0,Zx=0,Qx=0,Kx=0,tb={point:eb,lineStart:nb,lineEnd:ab,polygonStart:function(){tb.lineStart=ub,tb.lineEnd=ob},polygonEnd:function(){tb.point=eb,tb.lineStart=nb,tb.lineEnd=ab},result:function(){var t=Kx?[Zx/Kx,Qx/Kx]:Jx?[Gx/Jx,Xx/Jx]:Vx?[Wx/Vx,Yx/Vx]:[NaN,NaN];return Wx=Yx=Vx=Gx=Xx=Jx=Zx=Qx=Kx=0,t}};function eb(t,e){Wx+=t,Yx+=e,++Vx}function nb(){tb.point=rb}function rb(t,e){tb.point=ib,eb(Ix=t,Hx=e)}function ib(t,e){var n=t-Ix,r=e-Hx,i=Cy(n*n+r*r);Gx+=i*(Ix+t)/2,Xx+=i*(Hx+e)/2,Jx+=i,eb(Ix=t,Hx=e)}function ab(){tb.point=eb}function ub(){tb.point=sb}function ob(){lb($x,jx)}function sb(t,e){tb.point=lb,eb($x=Ix=t,jx=Hx=e)}function lb(t,e){var n=t-Ix,r=e-Hx,i=Cy(n*n+r*r);Gx+=i*(Ix+t)/2,Xx+=i*(Hx+e)/2,Jx+=i,Zx+=(i=Hx*t-Ix*e)*(Ix+t),Qx+=i*(Hx+e),Kx+=3*i,eb(Ix=t,Hx=e)}function cb(t){this._context=t}cb.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,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,gy)}},result:zy};var fb,hb,db,pb,gb,mb=sy(),vb={point:zy,lineStart:function(){vb.point=yb},lineEnd:function(){fb&&_b(hb,db),vb.point=zy},polygonStart:function(){fb=!0},polygonEnd:function(){fb=null},result:function(){var t=+mb;return mb.reset(),t}};function yb(t,e){vb.point=_b,hb=pb=t,db=gb=e}function _b(t,e){pb-=t,gb-=e,mb.add(Cy(pb*pb+gb*gb)),pb=t,gb=e}function xb(){this._string=[]}function bb(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wb(t,e){var n,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Uy(t,n(r))),r.result()}return a.area=function(t){return Uy(t,n(Bx)),Bx.result()},a.measure=function(t){return Uy(t,n(vb)),vb.result()},a.bounds=function(t){return Uy(t,n(Px)),Px.result()},a.centroid=function(t){return Uy(t,n(tb)),tb.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,kx):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new xb):new cb(e=t),"function"!=typeof i&&r.pointRadius(i),a):e},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(e)}function Ab(t){return function(e){var n=new kb;for(var r in t)n[r]=t[r];return n.stream=e,n}}function kb(){}function Mb(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Uy(n,t.stream(Px)),e(Px.result()),null!=r&&t.clipExtent(r),t}function Eb(t,e,n){return Mb(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),u=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,o=+e[0][1]+(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([u,o])}),n)}function Db(t,e,n){return Eb(t,[[0,0],e],n)}function Cb(t,e,n){return Mb(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,u=-i*n[0][1];t.scale(150*i).translate([a,u])}),n)}function Fb(t,e,n){return Mb(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],u=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,u])}),n)}xb.prototype={_radius:4.5,_circle:bb(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=bb(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},kb.prototype={constructor:kb,point:function(t,e){this.stream.point(t,e)},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 Sb=by(30*vy);function Bb(t,e){return+e?function(t,e){function n(r,i,a,u,o,s,l,c,f,h,d,p,g,m){var v=l-r,y=c-i,_=v*v+y*y;if(_>4*e&&g--){var x=u+h,b=o+d,w=s+p,A=Cy(x*x+b*b+w*w),k=By(w/=A),M=yy(yy(w)-1)<1e-6||yy(a-f)<1e-6?(a+f)/2:xy(b,x),E=t(M,k),D=E[0],C=E[1],F=D-r,S=C-i,B=y*F-v*S;(B*B/_>e||yy((v*F+y*S)/_-.5)>.3||u*h+o*d+s*p<Sb)&&(n(r,i,a,u,o,s,D,C,M,x/=A,b/=A,w,g,m),m.point(D,C),n(D,C,M,x,b,w,l,c,f,h,d,p,g,m))}}return function(e){var r,i,a,u,o,s,l,c,f,h,d,p,g={point:m,lineStart:v,lineEnd:_,polygonStart:function(){e.polygonStart(),g.lineStart=x},polygonEnd:function(){e.polygonEnd(),g.lineStart=v}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function v(){c=NaN,g.point=y,e.lineStart()}function y(r,i){var a=Qy([r,i]),u=t(r,i);n(c,f,l,h,d,p,c=u[0],f=u[1],l=r,h=a[0],d=a[1],p=a[2],16,e),e.point(c,f)}function _(){g.point=m,e.lineEnd()}function x(){v(),g.point=b,g.lineEnd=w}function b(t,e){y(r=t,e),i=c,a=f,u=h,o=d,s=p,g.point=y}function w(){n(c,f,l,h,d,p,i,a,r,u,o,s,16,e),g.lineEnd=_,_()}return g}}(t,e):function(t){return Ab({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var zb=Ab({point:function(t,e){this.stream.point(t*vy,e*vy)}});function Tb(t,e,n){function r(r,i){return[e+t*r,n-t*i]}return r.invert=function(r,i){return[(r-e)/t,(n-i)/t]},r}function Nb(t,e,n,r){var i=by(r),a=Ey(r),u=i*t,o=a*t,s=i/t,l=a/t,c=(a*n-i*e)/t,f=(a*e+i*n)/t;function h(t,r){return[u*t-o*r+e,n-o*t-u*r]}return h.invert=function(t,e){return[s*t-l*e+c,f-l*t-s*e]},h}function Ob(t){return Rb((function(){return t}))()}function Rb(t){var e,n,r,i,a,u,o,s,l,c,f=150,h=480,d=250,p=0,g=0,m=0,v=0,y=0,_=0,x=null,b=_x,w=null,A=kx,k=.5;function M(t){return s(t[0]*vy,t[1]*vy)}function E(t){return(t=s.invert(t[0],t[1]))&&[t[0]*my,t[1]*my]}function D(){var t=Nb(f,0,0,_).apply(null,e(p,g)),r=(_?Nb:Tb)(f,h-t[0],d-t[1],_);return n=ex(m,v,y),o=K_(e,r),s=K_(n,o),u=Bb(o,k),C()}function C(){return l=c=null,M}return M.stream=function(t){return l&&c===t?l:l=zb(function(t){return Ab({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(b(u(A(c=t)))))},M.preclip=function(t){return arguments.length?(b=t,x=void 0,C()):b},M.postclip=function(t){return arguments.length?(A=t,w=r=i=a=null,C()):A},M.clipAngle=function(t){return arguments.length?(b=+t?xx(x=t*vy):(x=null,_x),C()):x*my},M.clipExtent=function(t){return arguments.length?(A=null==t?(w=r=i=a=null,kx):bx(w=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),C()):null==w?null:[[w,r],[i,a]]},M.scale=function(t){return arguments.length?(f=+t,D()):f},M.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],D()):[h,d]},M.center=function(t){return arguments.length?(p=t[0]%360*vy,g=t[1]%360*vy,D()):[p*my,g*my]},M.rotate=function(t){return arguments.length?(m=t[0]%360*vy,v=t[1]%360*vy,y=t.length>2?t[2]%360*vy:0,D()):[m*my,v*my,y*my]},M.angle=function(t){return arguments.length?(_=t%360*vy,D()):_*my},M.precision=function(t){return arguments.length?(u=Bb(o,k=t*t),C()):Cy(k)},M.fitExtent=function(t,e){return Eb(M,t,e)},M.fitSize=function(t,e){return Db(M,t,e)},M.fitWidth=function(t,e){return Cb(M,t,e)},M.fitHeight=function(t,e){return Fb(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&E,D()}}function qb(t){var e=0,n=hy/3,r=Rb(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*vy,n=t[1]*vy):[e*my,n*my]},i}function Ub(t,e){var n=Ey(t),r=(n+Ey(e))/2;if(yy(r)<1e-6)return function(t){var e=by(t);function n(t,n){return[t*e,Ey(n)/e]}return n.invert=function(t,n){return[t/e,By(n*e)]},n}(t);var i=1+n*(2*r-n),a=Cy(i)/r;function u(t,e){var n=Cy(i-2*r*Ey(e))/r;return[n*Ey(t*=r),a-n*by(t)]}return u.invert=function(t,e){var n=a-e;return[xy(t,yy(n))/r*Dy(n),By((i-(t*t+n*n)*r*r)/(2*r))]},u}function Lb(){return qb(Ub).scale(155.424).center([0,33.6442])}function Pb(){return Lb().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function $b(t){return function(e,n){var r=by(e),i=by(n),a=t(r*i);return[a*i*Ey(e),a*Ey(n)]}}function jb(t){return function(e,n){var r=Cy(e*e+n*n),i=t(r),a=Ey(i),u=by(i);return[xy(e*a,r*u),By(r&&n*a/r)]}}var Ib=$b((function(t){return Cy(2/(1+t))}));Ib.invert=jb((function(t){return 2*By(t/2)}));var Hb=$b((function(t){return(t=Sy(t))&&t/Ey(t)}));function Wb(t,e){return[t,ky(Fy((dy+e)/2))]}function Yb(t){var e,n,r,i=Ob(t),a=i.center,u=i.scale,o=i.translate,s=i.clipExtent,l=null;function c(){var a=hy*u(),o=i(function(t){function e(e){return(e=t(e[0]*vy,e[1]*vy))[0]*=my,e[1]*=my,e}return t=ex(t[0]*vy,t[1]*vy,t.length>2?t[2]*vy:0),e.invert=function(e){return(e=t.invert(e[0]*vy,e[1]*vy))[0]*=my,e[1]*=my,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[o[0]-a,o[1]-a],[o[0]+a,o[1]+a]]:t===Wb?[[Math.max(o[0]-a,l),e],[Math.min(o[0]+a,n),r]]:[[l,Math.max(o[1]-a,e)],[n,Math.min(o[1]+a,r)]])}return i.scale=function(t){return arguments.length?(u(t),c()):u()},i.translate=function(t){return arguments.length?(o(t),c()):o()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function Vb(t){return Fy((dy+t)/2)}function Gb(t,e){var n=by(t),r=t===e?Ey(t):ky(n/by(e))/ky(Vb(e)/Vb(t)),i=n*My(Vb(t),r)/r;if(!r)return Wb;function a(t,e){i>0?e<1e-6-dy&&(e=1e-6-dy):e>dy-1e-6&&(e=dy-1e-6);var n=i/My(Vb(e),r);return[n*Ey(r*t),i-n*by(r*t)]}return a.invert=function(t,e){var n=i-e,a=Dy(r)*Cy(t*t+n*n);return[xy(t,yy(n))/r*Dy(n),2*_y(My(i/a,1/r))-dy]},a}function Xb(t,e){return[t,e]}function Jb(t,e){var n=by(t),r=t===e?Ey(t):(n-by(e))/(e-t),i=n/r+t;if(yy(r)<1e-6)return Xb;function a(t,e){var n=i-e,a=r*t;return[n*Ey(a),i-n*by(a)]}return a.invert=function(t,e){var n=i-e;return[xy(t,yy(n))/r*Dy(n),i-Dy(r)*Cy(t*t+n*n)]},a}Hb.invert=jb((function(t){return t})),Wb.invert=function(t,e){return[t,2*_y(Ay(e))-dy]},Xb.invert=Xb;var Zb=1.340264,Qb=-.081106,Kb=893e-6,tw=.003796,ew=Cy(3)/2;function nw(t,e){var n=By(ew*Ey(e)),r=n*n,i=r*r*r;return[t*by(n)/(ew*(Zb+3*Qb*r+i*(7*Kb+9*tw*r))),n*(Zb+Qb*r+i*(Kb+tw*r))]}function rw(t,e){var n=by(e),r=by(t)*n;return[n*Ey(t)/r,Ey(e)/r]}function iw(t,e,n,r){return 1===t&&1===e&&0===n&&0===r?kx:Ab({point:function(i,a){this.stream.point(i*t+n,a*e+r)}})}function aw(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function uw(t,e){return[by(e)*Ey(t),Ey(e)]}function ow(t,e){var n=by(e),r=1+by(t)*n;return[n*Ey(t)/r,Ey(e)/r]}function sw(t,e){return[ky(Fy((dy+e)/2)),-t]}nw.invert=function(t,e){for(var n,r=e,i=r*r,a=i*i*i,u=0;u<12&&(a=(i=(r-=n=(r*(Zb+Qb*i+a*(Kb+tw*i))-e)/(Zb+3*Qb*i+a*(7*Kb+9*tw*i)))*r)*i*i,!(yy(n)<1e-12));++u);return[ew*t*(Zb+3*Qb*i+a*(7*Kb+9*tw*i))/by(r),By(Ey(r)/ew)]},rw.invert=jb(_y),aw.invert=function(t,e){var n,r=e,i=25;do{var a=r*r,u=a*a;r-=n=(r*(1.007226+a*(.015085+u*(.028874*a-.044475-.005916*u)))-e)/(1.007226+a*(.045255+u*(.259866*a-.311325-.005916*11*u)))}while(yy(n)>1e-6&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},uw.invert=jb(By),ow.invert=jb((function(t){return 2*_y(t)})),sw.invert=function(t,e){return[-e,2*_y(Ay(t))-dy]};var lw=Math.abs,cw=Math.cos,fw=Math.sin,hw=Math.PI,dw=hw/2,pw=function(t){return t>0?Math.sqrt(t):0}(2);function gw(t){return t>1?dw:t<-1?-dw:Math.asin(t)}function mw(t,e){var n,r=t*fw(e),i=30;do{e-=n=(e+fw(e)-r)/(1+cw(e))}while(lw(n)>1e-6&&--i>0);return e/2}var vw=function(t,e,n){function r(r,i){return[t*r*cw(i=mw(n,i)),e*fw(i)]}return r.invert=function(r,i){return i=gw(i/e),[r/(t*cw(i)),gw((2*i+fw(2*i))/n)]},r}(pw/dw,pw,hw);var yw=wb(),_w=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function xw(t,e){return function n(){var r=e();return r.type=t,r.path=wb().projection(r),r.copy=r.copy||function(){var t=n();return _w.forEach((function(e){r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function bw(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(Aw[t]=xw(t,e),this):Aw[t]||null}function ww(t){return t&&t.path||yw}var Aw={albers:Pb,albersusa:function(){var t,e,n,r,i,a,u=Pb(),o=Lb().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Lb().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){a=[t,e]}};function c(t){var e=t[0],u=t[1];return a=null,n.point(e,u),a||(r.point(e,u),a)||(i.point(e,u),a)}function f(){return t=e=null,c}return c.invert=function(t){var e=u.scale(),n=u.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:u).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[u.stream(e=n),o.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},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},c.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),s.precision(t),f()):u.precision()},c.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),s.scale(t),c.translate(u.translate())):u.scale()},c.translate=function(t){if(!arguments.length)return u.translate();var e=u.scale(),a=+t[0],c=+t[1];return n=u.translate(t).clipExtent([[a-.455*e,c-.238*e],[a+.455*e,c+.238*e]]).stream(l),r=o.translate([a-.307*e,c+.201*e]).clipExtent([[a-.425*e+1e-6,c+.12*e+1e-6],[a-.214*e-1e-6,c+.234*e-1e-6]]).stream(l),i=s.translate([a-.205*e,c+.212*e]).clipExtent([[a-.214*e+1e-6,c+.166*e+1e-6],[a-.115*e-1e-6,c+.234*e-1e-6]]).stream(l),f()},c.fitExtent=function(t,e){return Eb(c,t,e)},c.fitSize=function(t,e){return Db(c,t,e)},c.fitWidth=function(t,e){return Cb(c,t,e)},c.fitHeight=function(t,e){return Fb(c,t,e)},c.scale(1070)},azimuthalequalarea:function(){return Ob(Ib).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Ob(Hb).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return qb(Gb).scale(109.5).parallels([30,30])},conicequalarea:Lb,conicequidistant:function(){return qb(Jb).scale(131.154).center([0,13.9389])},equalEarth:function(){return Ob(nw).scale(177.158)},equirectangular:function(){return Ob(Xb).scale(152.63)},gnomonic:function(){return Ob(rw).scale(144.049).clipAngle(60)},identity:function(){var t,e,n,r,i,a,u=1,o=0,s=0,l=1,c=1,f=kx,h=null,d=kx;function p(){return r=i=null,a}return a={stream:function(t){return r&&i===t?r:r=f(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=e=n=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=e=n=null,kx):bx(h=+r[0][0],t=+r[0][1],e=+r[1][0],n=+r[1][1]),p()):null==h?null:[[h,t],[e,n]]},scale:function(t){return arguments.length?(f=iw((u=+t)*l,u*c,o,s),p()):u},translate:function(t){return arguments.length?(f=iw(u*l,u*c,o=+t[0],s=+t[1]),p()):[o,s]},reflectX:function(t){return arguments.length?(f=iw(u*(l=t?-1:1),u*c,o,s),p()):l<0},reflectY:function(t){return arguments.length?(f=iw(u*l,u*(c=t?-1:1),o,s),p()):c<0},fitExtent:function(t,e){return Eb(a,t,e)},fitSize:function(t,e){return Db(a,t,e)},fitWidth:function(t,e){return Cb(a,t,e)},fitHeight:function(t,e){return Fb(a,t,e)}}},mercator:function(){return Yb(Wb).scale(961/gy)},mollweide:function(){return Ob(vw).scale(169.529)},naturalEarth1:function(){return Ob(aw).scale(175.295)},orthographic:function(){return Ob(uw).scale(249.5).clipAngle(90.000001)},stereographic:function(){return Ob(ow).scale(250).clipAngle(142)},transversemercator:function(){var t=Yb(sw),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(var kw in Aw)bw(kw,Aw[kw]);function Mw(t){Hr.call(this,null,t)}function Ew(t){Hr.call(this,null,t)}function Dw(t){Hr.call(this,null,t)}function Cw(t){Hr.call(this,[],t),this.generator=function(){var t,e,n,r,i,a,u,o,s,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return px(wy(r/p)*p,n,p).map(c).concat(px(wy(o/g)*g,u,g).map(f)).concat(px(wy(e/h)*h,t,h).filter((function(t){return yy(t%p)>1e-6})).map(s)).concat(px(wy(a/d)*d,i,d).filter((function(t){return yy(t%g)>1e-6})).map(l))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(u).slice(1),c(n).reverse().slice(1),f(o).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],o=+t[0][1],u=+t[1][1],r>n&&(t=r,r=n,n=t),o>u&&(t=o,o=u,u=t),v.precision(m)):[[r,o],[n,u]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),v.precision(m)):[[e,a],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(m=+h,s=wx(a,i,90),l=Ax(e,t,m),c=wx(o,u,90),f=Ax(r,n,m),v):m},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Fw(t){Hr.call(this,null,t)}function Sw(t){if(!W(t))return!1;const e=xt(r(t));return e.$x||e.$y||e.$value||e.$max}function Bw(t){Hr.call(this,null,t),this.modified(!0)}function zw(t,e,n){W(t[e])&&t[e](n)}Mw.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"}]},rt(Mw,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||d,a=t.as||"path",u=n.SOURCE;!r||t.modified()?(this.value=r=ww(t.projection),n.materialize().reflow()):u=i===d||e.modified(i.fields)?n.ADD_MOD:n.ADD;var o=function(t,e){var n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(u,(function(t){t[a]=r(i(t))})),r.pointRadius(o),n.modifies(a)},Ew.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"]}]},rt(Ew,Hr).transform=function(t,e){var n,r=t.projection,i=t.fields[0],a=t.fields[1],u=t.as||["x","y"],o=u[0],s=u[1];function l(t){var e=r([i(t),a(t)]);e?(t[o]=e[0],t[s]=e[1]):(t[o]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(a.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(u)},Dw.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"}]},rt(Dw,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",a=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){var r=null==n?function(n){return t(e(n))}:function(r){var i=t.pointRadius(),a=t.pointRadius(n)(e(r));return t.pointRadius(i),a};return r.context=function(e){return t.context(e),r},r}(ww(t.projection),t.field||c("datum"),t.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(function(t){t[i]=r})),n.modifies(i)},Cw.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}]},rt(Cw,Hr).transform=function(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)W(i[a])&&i[a](t[a]);return n=i(),r.length?e.mod.push(Tt(r[0],n)):e.add.push(St(n)),r[0]=n,e},Fw.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"}]},rt(Fw,Hr).transform=function(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||d,a=function(t,e){let n;W(t)?(n=n=>t(n,e),n.dep=Sw(t)):t?n=V(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),u=function(t,e){let n;W(t)?(n=n=>up(t(n,e)),n.dep=Sw(t)):n=V(up(t||"#888"));return n}(t.color,t),o=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?mi(n.map(t=>mi(i(t).values))):0};return n.forEach(t=>{const e=i(t),n=X({},t,s);r||(n.$max=mi(e.values||[])),t[o]=function(t,e,n,r){const i=t.width,a=t.height,u=t.x1||0,o=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?t=>c[t]:p,h=Vo(s-u,l-o),d=h.getContext("2d"),g=d.getImageData(0,0,s-u,l-o),m=g.data;for(let t=o,a=0;t<l;++t){e.$y=t-o;for(let o=u,l=t*i;o<s;++o,a+=4){e.$x=o-u,e.$value=f(o+l);const t=n(e);m[a+0]=t.r,m[a+1]=t.g,m[a+2]=t.b,m[a+3]=~~(255*r(e))}}return d.putImageData(g,0,0),h}(e,n,u.dep?u:V(u(n)),a.dep?a:V(a(n)))}),e.reflow(!0).modifies(o)},rt(Bw,Hr).transform=function(t,e){var n=this.value;return!n||t.modified("type")?(this.value=n=function(t){var e=bw((t||"mercator").toLowerCase());e||i("Unrecognized projection type: "+t);return e()}(t.type),_w.forEach((function(e){null!=t[e]&&zw(n,e,t[e])}))):_w.forEach((function(e){t.modified(e)&&zw(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){var n=function(t){return 1===(t=I(t)).length?t[0]:{type:"FeatureCollection",features:t.reduce((t,e)=>t.concat(function(t){return"FeatureCollection"===t.type?t.features:I(t).filter(t=>null!=t).map(t=>"Feature"===t.type?t:{type:"Feature",geometry:t})}(e)),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)};var Tw=Object.freeze({__proto__:null,contour:uy,geojson:oy,geopath:Mw,geopoint:Ew,geoshape:Dw,graticule:Cw,heatmap:Fw,isocontour:Xv,kde2d:ny,projection:Bw});function Nw(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,u,o,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(u=(m+y)/2))?m=u:y=u,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(o=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===o&&n===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(u=(m+y)/2))?m=u:y=u}while((f=c<<1|l)==(h=(s>=u)<<1|o>=a));return i[h]=d,i[f]=p,t}function Ow(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Rw(t){return t[0]}function qw(t){return t[1]}function Uw(t,e,n){var r=new Lw(null==e?Rw:e,null==n?qw:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Lw(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function Pw(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var $w=Uw.prototype=Lw.prototype;function jw(t){return function(){return t}}function Iw(){return 1e-6*(Math.random()-.5)}function Hw(t){return t.x+t.vx}function Ww(t){return t.y+t.vy}function Yw(t){return t.index}function Vw(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}$w.copy=function(){var t,e,n=new Lw(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Pw(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Pw(e));return n},$w.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Nw(this.cover(e,n),e,n,t)},$w.addAll=function(t){var e,n,r,i,a=t.length,u=new Array(a),o=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<a;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(u[n]=r,o[n]=i,r<s&&(s=r),r>c&&(c=r),i<l&&(l=i),i>f&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;n<a;++n)Nw(this,u[n],o[n],t[n]);return this},$w.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{for(var u,o,s=i-n,l=this._root;n>t||t>=i||r>e||e>=a;)switch(o=(e<r)<<1|t<n,(u=new Array(4))[o]=l,l=u,s*=2,o){case 0:i=n+s,a=r+s;break;case 1:n=i-s,a=r+s;break;case 2:i=n+s,r=a-s;break;case 3:n=i-s,r=a-s}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this},$w.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},$w.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]]},$w.find=function(t,e,n){var r,i,a,u,o,s,l,c=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new Ow(g,c,f,h,d)),null==n?n=1/0:(c=t-n,f=e-n,h=t+n,d=e+n,n*=n);s=p.pop();)if(!(!(g=s.node)||(i=s.x0)>h||(a=s.y0)>d||(u=s.x1)<c||(o=s.y1)<f))if(g.length){var m=(i+u)/2,v=(a+o)/2;p.push(new Ow(g[3],m,v,u,o),new Ow(g[2],i,v,m,o),new Ow(g[1],m,a,u,v),new Ow(g[0],i,a,m,v)),(l=(e>=v)<<1|t>=m)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=y*y+_*_;if(x<n){var b=Math.sqrt(n=x);c=t-b,f=e-b,h=t+b,d=e+b,r=g.data}}return r},$w.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var e,n,r,i,a,u,o,s,l,c,f,h,d=this._root,p=this._x0,g=this._y0,m=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((l=a>=(o=(p+m)/2))?p=o:m=o,(c=u>=(s=(g+v)/2))?g=s:v=s,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}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):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},$w.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},$w.root=function(){return this._root},$w.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},$w.visit=function(t){var e,n,r,i,a,u,o=[],s=this._root;for(s&&o.push(new Ow(s,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,a=e.x1,u=e.y1)&&s.length){var l=(r+a)/2,c=(i+u)/2;(n=s[3])&&o.push(new Ow(n,l,c,a,u)),(n=s[2])&&o.push(new Ow(n,r,c,l,u)),(n=s[1])&&o.push(new Ow(n,l,i,a,c)),(n=s[0])&&o.push(new Ow(n,r,i,l,c))}return this},$w.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Ow(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var a,u=e.x0,o=e.y0,s=e.x1,l=e.y1,c=(u+s)/2,f=(o+l)/2;(a=i[0])&&n.push(new Ow(a,u,o,c,f)),(a=i[1])&&n.push(new Ow(a,c,o,s,f)),(a=i[2])&&n.push(new Ow(a,u,f,c,l)),(a=i[3])&&n.push(new Ow(a,c,f,s,l))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},$w.x=function(t){return arguments.length?(this._x=t,this):this._x},$w.y=function(t){return arguments.length?(this._y=t,this):this._y};var Gw={value:function(){}};function Xw(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Jw(r)}function Jw(t){this._=t}function Zw(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Qw(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Kw(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Gw,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Jw.prototype=Xw.prototype={constructor:Jw,on:function(t,e){var n,r=this._,i=Zw(t+"",r),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=i[a]).type)r[n]=Kw(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Kw(r[n],t.name,null);return this}for(;++a<u;)if((n=(t=i[a]).type)&&(n=Qw(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Jw(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var tA,eA,nA=0,rA=0,iA=0,aA=0,uA=0,oA=0,sA="object"==typeof performance&&performance.now?performance:Date,lA="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function cA(){return uA||(lA(fA),uA=sA.now()+oA)}function fA(){uA=0}function hA(){this._call=this._time=this._next=null}function dA(t,e,n){var r=new hA;return r.restart(t,e,n),r}function pA(){uA=(aA=sA.now())+oA,nA=rA=0;try{!function(){cA(),++nA;for(var t,e=tA;e;)(t=uA-e._time)>=0&&e._call.call(null,t),e=e._next;--nA}()}finally{nA=0,function(){var t,e,n=tA,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:tA=e);eA=t,mA(r)}(),uA=0}}function gA(){var t=sA.now(),e=t-aA;e>1e3&&(oA-=e,aA=t)}function mA(t){nA||(rA&&(rA=clearTimeout(rA)),t-uA>24?(t<1/0&&(rA=setTimeout(pA,t-sA.now()-oA)),iA&&(iA=clearInterval(iA))):(iA||(aA=sA.now(),iA=setInterval(gA,1e3)),nA=1,lA(pA)))}function vA(t){return t.x}function yA(t){return t.y}hA.prototype=dA.prototype={constructor:hA,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?cA():+n)+(null==e?0:+e),this._next||eA===this||(eA?eA._next=this:tA=this,eA=this),this._call=t,this._time=n,mA()},stop:function(){this._call&&(this._call=null,this._time=1/0,mA())}};var _A=Math.PI*(3-Math.sqrt(5));var xA={center:function(t,e){var n;function r(){var r,i,a=n.length,u=0,o=0;for(r=0;r<a;++r)u+=(i=n[r]).x,o+=i.y;for(u=u/a-t,o=o/a-e,r=0;r<a;++r)(i=n[r]).x-=u,i.y-=o}return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r},collide:function(t){var e,n,r=1,i=1;function a(){for(var t,a,o,s,l,c,f,h=e.length,d=0;d<i;++d)for(a=Uw(e,Hw,Ww).visitAfter(u),t=0;t<h;++t)o=e[t],c=n[o.index],f=c*c,s=o.x+o.vx,l=o.y+o.vy,a.visit(p);function p(t,e,n,i,a){var u=t.data,h=t.r,d=c+h;if(!u)return e>s+d||i<s-d||n>l+d||a<l-d;if(u.index>o.index){var p=s-u.x-u.vx,g=l-u.y-u.vy,m=p*p+g*g;m<d*d&&(0===p&&(m+=(p=Iw())*p),0===g&&(m+=(g=Iw())*g),m=(d-(m=Math.sqrt(m)))/m*r,o.vx+=(p*=m)*(d=(h*=h)/(f+h)),o.vy+=(g*=m)*d,u.vx-=p*(d=1-d),u.vy-=g*d)}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function o(){if(e){var r,i,a=e.length;for(n=new Array(a),r=0;r<a;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=jw(null==t?1:+t)),a.initialize=function(t){e=t,o()},a.iterations=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:jw(+e),o(),a):t},a},nbody:function(){var t,e,n,r,i=jw(-30),a=1,u=1/0,o=.81;function s(r){var i,a=t.length,u=Uw(t,vA,yA).visitAfter(c);for(n=r,i=0;i<a;++i)e=t[i],u.visit(f)}function l(){if(t){var e,n,a=t.length;for(r=new Array(a),e=0;e<a;++e)n=t[e],r[n.index]=+i(n,e,t)}}function c(t){var e,n,i,a,u,o=0,s=0;if(t.length){for(i=a=u=0;u<4;++u)(e=t[u])&&(n=Math.abs(e.value))&&(o+=e.value,s+=n,i+=n*e.x,a+=n*e.y);t.x=i/s,t.y=a/s}else{(e=t).x=e.data.x,e.y=e.data.y;do{o+=r[e.data.index]}while(e=e.next)}t.value=o}function f(t,i,s,l){if(!t.value)return!0;var c=t.x-e.x,f=t.y-e.y,h=l-i,d=c*c+f*f;if(h*h/o<d)return d<u&&(0===c&&(d+=(c=Iw())*c),0===f&&(d+=(f=Iw())*f),d<a&&(d=Math.sqrt(a*d)),e.vx+=c*t.value*n/d,e.vy+=f*t.value*n/d),!0;if(!(t.length||d>=u)){(t.data!==e||t.next)&&(0===c&&(d+=(c=Iw())*c),0===f&&(d+=(f=Iw())*f),d<a&&(d=Math.sqrt(a*d)));do{t.data!==e&&(h=r[t.data.index]*n/d,e.vx+=c*h,e.vy+=f*h)}while(t=t.next)}}return s.initialize=function(e){t=e,l()},s.strength=function(t){return arguments.length?(i="function"==typeof t?t:jw(+t),l(),s):i},s.distanceMin=function(t){return arguments.length?(a=t*t,s):Math.sqrt(a)},s.distanceMax=function(t){return arguments.length?(u=t*t,s):Math.sqrt(u)},s.theta=function(t){return arguments.length?(o=t*t,s):Math.sqrt(o)},s},link:function(t){var e,n,r,i,a,u=Yw,o=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},s=jw(30),l=1;function c(r){for(var i=0,u=t.length;i<l;++i)for(var o,s,c,f,h,d,p,g=0;g<u;++g)s=(o=t[g]).source,f=(c=o.target).x+c.vx-s.x-s.vx||Iw(),h=c.y+c.vy-s.y-s.vy||Iw(),f*=d=((d=Math.sqrt(f*f+h*h))-n[g])/d*r*e[g],h*=d,c.vx-=f*(p=a[g]),c.vy-=h*p,s.vx+=f*(p=1-p),s.vy+=h*p}function f(){if(r){var o,s,l=r.length,c=t.length,f=new Map(r.map((t,e)=>[u(t,e,r),t]));for(o=0,i=new Array(l);o<c;++o)(s=t[o]).index=o,"object"!=typeof s.source&&(s.source=Vw(f,s.source)),"object"!=typeof s.target&&(s.target=Vw(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(o=0,a=new Array(c);o<c;++o)s=t[o],a[o]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);e=new Array(c),h(),n=new Array(c),d()}}function h(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+o(t[n],n,t)}function d(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+s(t[e],e,t)}return null==t&&(t=[]),c.initialize=function(t){r=t,f()},c.links=function(e){return arguments.length?(t=e,f(),c):t},c.id=function(t){return arguments.length?(u=t,c):u},c.iterations=function(t){return arguments.length?(l=+t,c):l},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:jw(+t),h(),c):o},c.distance=function(t){return arguments.length?(s="function"==typeof t?t:jw(+t),d(),c):s},c},x:function(t){var e,n,r,i=jw(.1);function a(t){for(var i,a=0,u=e.length;a<u;++a)(i=e[a]).vx+=(r[a]-i.x)*n[a]*t}function u(){if(e){var a,u=e.length;for(n=new Array(u),r=new Array(u),a=0;a<u;++a)n[a]=isNaN(r[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return"function"!=typeof t&&(t=jw(null==t?0:+t)),a.initialize=function(t){e=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:jw(+t),u(),a):i},a.x=function(e){return arguments.length?(t="function"==typeof e?e:jw(+e),u(),a):t},a},y:function(t){var e,n,r,i=jw(.1);function a(t){for(var i,a=0,u=e.length;a<u;++a)(i=e[a]).vy+=(r[a]-i.y)*n[a]*t}function u(){if(e){var a,u=e.length;for(n=new Array(u),r=new Array(u),a=0;a<u;++a)n[a]=isNaN(r[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return"function"!=typeof t&&(t=jw(null==t?0:+t)),a.initialize=function(t){e=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:jw(+t),u(),a):i},a.y=function(e){return arguments.length?(t="function"==typeof e?e:jw(+e),u(),a):t},a}},bA=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],wA=["static","iterations"],AA=["x","y","vx","vy"];function kA(t){Hr.call(this,null,t)}kA.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},{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:AA}]};var MA=rt(kA,Hr);function EA(t,e,n,r){var i,a,u,o,s=I(e.forces);for(i=0,a=bA.length;i<a;++i)"forces"!==(u=bA[i])&&e.modified(u)&&t[u](e[u]);for(i=0,a=s.length;i<a;++i)o="forces"+i,(u=n||e.modified("forces",i)?CA(s[i]):r&&DA(s[i],r)?t.force(o):null)&&t.force(o,u);for(a=t.numForces||0;i<a;++i)t.force("forces"+i,null);return t.numForces=s.length,t}function DA(t,e){var n,i;for(n in t)if(W(i=t[n])&&e.modified(r(i)))return 1;return 0}function CA(t){var e,n;for(n in K(xA,t.force)||i("Unrecognized force: "+t.force),e=xA[t.force](),t)W(e[n])&&FA(e[n],t[n],t);return e}function FA(t,e,n){t(W(e)?function(t){return e(t,n)}:e)}MA.transform=function(t,e){var n,r,i=this.value,a=e.changed(e.ADD_REM),u=t.modified(bA),o=t.iterations||300;if(i?(a&&(e.modifies("index"),i.nodes(e.source)),(u||e.changed(e.MOD))&&EA(i,t,0,e)):(this.value=i=function(t,e){var n=function(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),a=0,u=.6,o=new Map,s=dA(c),l=Xw("tick","end");function c(){f(),l.call("tick",e),n<r&&(s.stop(),l.call("end",e))}function f(r){var s,l,c=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(n+=(a-n)*i,o.forEach((function(t){t(n)})),s=0;s<c;++s)null==(l=t[s]).fx?l.x+=l.vx*=u:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=u:(l.y=l.fy,l.vy=0);return e}function h(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(n),a=n*_A;e.x=i*Math.cos(a),e.y=i*Math.sin(a)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function d(e){return e.initialize&&e.initialize(t),e}return null==t&&(t=[]),h(),e={tick:f,restart:function(){return s.restart(c),e},stop:function(){return s.stop(),e},nodes:function(n){return arguments.length?(t=n,h(),o.forEach(d),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(a=+t,e):a},velocityDecay:function(t){return arguments.length?(u=1-t,e):1-u},force:function(t,n){return arguments.length>1?(null==n?o.delete(t):o.set(t,d(n)),e):o.get(t)},find:function(e,n,r){var i,a,u,o,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l<c;++l)(u=(i=e-(o=t[l]).x)*i+(a=n-o.y)*a)<r&&(s=o,r=u);return s},on:function(t,n){return arguments.length>1?(l.on(t,n),e):l.on(t)}}}(t),r=!1,i=n.stop,a=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,a()},n.stop=function(){return r=!0,i()},EA(n,e,!0).on("end",(function(){r=!0}))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,function(){n.touch(r).run()})),t.static||(a=!0,i.tick()),e.modifies("index")),u||a||t.modified(wA)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/o)),t.static)for(i.stop();--o>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return e.StopPropagation;return this.finish(t,e)},MA.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,a=0,u=i.length;a<u;++a)if("forces"===(n=i[a]).name&&"link"===n.op._argval.force)for(var o,s=n.op._argops,l=0,c=s.length;l<c;++l)if("links"===s[l].name&&(o=s[l].op.source)){r.pulse(o,r.changeset().reflow());break}return e.reflow(t.modified()).modifies(AA)};var SA=Object.freeze({__proto__:null,force:kA});function BA(t,e,n){var r={};return t.each((function(t){var i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function zA(t,e){return t.parent===e.parent?1:2}function TA(t,e){return t+e.x}function NA(t,e){return Math.max(t,e.y)}function OA(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function RA(t,e){var n,r,i,a,u,o=new PA(t),s=+t.value&&(o.value=t.value),l=[o];for(null==e&&(e=qA);n=l.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(u=i.length))for(n.children=new Array(u),a=u-1;a>=0;--a)l.push(r=n.children[a]=new PA(i[a])),r.parent=n,r.depth=n.depth+1;return o.eachBefore(LA)}function qA(t){return t.children}function UA(t){t.data=t.data.data}function LA(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function PA(t){this.data=t,this.depth=this.height=0,this.parent=null}PA.prototype=RA.prototype={constructor:PA,count:function(){return this.eachAfter(OA)},each:function(t){var e,n,r,i,a=this,u=[a];do{for(e=u.reverse(),u=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r<i;++r)u.push(n[r])}while(u.length);return this},eachAfter:function(t){for(var e,n,r,i=this,a=[i],u=[];i=a.pop();)if(u.push(i),e=i.children)for(n=0,r=e.length;n<r;++n)a.push(e[n]);for(;i=u.pop();)t(i);return this},eachBefore:function(t){for(var e,n,r=this,i=[r];r=i.pop();)if(t(r),e=r.children)for(n=e.length-1;n>=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return RA(this).eachBefore(UA)}};var $A=Array.prototype.slice;function jA(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}($A.call(t))).length,a=[];r<i;)e=t[r],n&&WA(n,e)?++r:(n=VA(a=IA(a,e)),r=0);return n}function IA(t,e){var n,r;if(YA(e,t))return[e];for(n=0;n<t.length;++n)if(HA(e,t[n])&&YA(GA(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(HA(GA(t[n],t[r]),e)&&HA(GA(t[n],e),t[r])&&HA(GA(t[r],e),t[n])&&YA(XA(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function HA(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function WA(t,e){var n=t.r-e.r+1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function YA(t,e){for(var n=0;n<e.length;++n)if(!WA(t,e[n]))return!1;return!0}function VA(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return GA(t[0],t[1]);case 3:return XA(t[0],t[1],t[2])}var e}function GA(t,e){var n=t.x,r=t.y,i=t.r,a=e.x,u=e.y,o=e.r,s=a-n,l=u-r,c=o-i,f=Math.sqrt(s*s+l*l);return{x:(n+a+s/f*c)/2,y:(r+u+l/f*c)/2,r:(f+i+o)/2}}function XA(t,e,n){var r=t.x,i=t.y,a=t.r,u=e.x,o=e.y,s=e.r,l=n.x,c=n.y,f=n.r,h=r-u,d=r-l,p=i-o,g=i-c,m=s-a,v=f-a,y=r*r+i*i-a*a,_=y-u*u-o*o+s*s,x=y-l*l-c*c+f*f,b=d*p-h*g,w=(p*x-g*_)/(2*b)-r,A=(g*m-p*v)/b,k=(d*_-h*x)/(2*b)-i,M=(h*v-d*m)/b,E=A*A+M*M-1,D=2*(a+w*A+k*M),C=w*w+k*k-a*a,F=-(E?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+A*F,y:i+k+M*F,r:F}}function JA(t,e,n){var r,i,a,u,o=t.x-e.x,s=t.y-e.y,l=o*o+s*s;l?(i=e.r+n.r,i*=i,u=t.r+n.r,i>(u*=u)?(r=(l+u-i)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),n.x=t.x-r*o-a*s,n.y=t.y-r*s+a*o):(r=(l+i-u)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*o-a*s,n.y=e.y+r*s+a*o)):(n.x=e.x+n.r,n.y=e.y)}function ZA(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function QA(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,a=(e.y*n.r+n.y*e.r)/r;return i*i+a*a}function KA(t){this._=t,this.next=null,this.previous=null}function tk(t){return null==t?null:ek(t)}function ek(t){if("function"!=typeof t)throw new Error;return t}function nk(){return 0}function rk(t){return function(){return t}}function ik(t){return Math.sqrt(t.value)}function ak(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function uk(t,e){return function(n){if(r=n.children){var r,i,a,u=r.length,o=t(n)*e||0;if(o)for(i=0;i<u;++i)r[i].r+=o;if(a=function(t){if(!(i=t.length))return 0;var e,n,r,i,a,u,o,s,l,c,f;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;JA(n,e,r=t[2]),e=new KA(e),n=new KA(n),r=new KA(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(o=3;o<i;++o){JA(e._,n._,r=t[o]),r=new KA(r),s=n.next,l=e.previous,c=n._.r,f=e._.r;do{if(c<=f){if(ZA(s._,r._)){n=s,e.next=n,n.previous=e,--o;continue t}c+=s._.r,s=s.next}else{if(ZA(l._,r._)){(e=l).next=n,n.previous=e,--o;continue t}f+=l._.r,l=l.previous}}while(s!==l.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,a=QA(e);(r=r.next)!==n;)(u=QA(r))<a&&(e=r,a=u);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=jA(e),o=0;o<i;++o)(e=t[o]).x-=r.x,e.y-=r.y;return r.r}(r),o)for(i=0;i<u;++i)r[i].r-=o;n.r=a+o}}}function ok(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function sk(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 lk(t,e,n,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(r-e)/t.value;++o<s;)(a=u[o]).y0=n,a.y1=i,a.x0=e,a.x1=e+=a.value*l}var ck={depth:-1},fk={};function hk(t){return t.id}function dk(t){return t.parentId}function pk(){var t=hk,e=dk;function n(n){var r,i,a,u,o,s,l,c=n.length,f=new Array(c),h={};for(i=0;i<c;++i)r=n[i],o=f[i]=new PA(r),null!=(s=t(r,i,n))&&(s+="")&&(h[l="$"+(o.id=s)]=l in h?fk:o);for(i=0;i<c;++i)if(o=f[i],null!=(s=e(n[i],i,n))&&(s+="")){if(!(u=h["$"+s]))throw new Error("missing: "+s);if(u===fk)throw new Error("ambiguous: "+s);u.children?u.children.push(o):u.children=[o],o.parent=u}else{if(a)throw new Error("multiple roots");a=o}if(!a)throw new Error("no root");if(a.parent=ck,a.eachBefore((function(t){t.depth=t.parent.depth+1,--c})).eachBefore(LA),a.parent=null,c>0)throw new Error("cycle");return a}return n.id=function(e){return arguments.length?(t=ek(e),n):t},n.parentId=function(t){return arguments.length?(e=ek(t),n):e},n}function gk(t,e){return t.parent===e.parent?1:2}function mk(t){var e=t.children;return e?e[0]:t.t}function vk(t){var e=t.children;return e?e[e.length-1]:t.t}function yk(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function _k(t,e,n){return t.a.parent===e.parent?t.a:n}function xk(t,e){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=e}function bk(t,e,n,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(i-n)/t.value;++o<s;)(a=u[o]).x0=e,a.x1=r,a.y0=n,a.y1=n+=a.value*l}xk.prototype=Object.create(PA.prototype);var wk=(1+Math.sqrt(5))/2;function Ak(t,e,n,r,i,a){for(var u,o,s,l,c,f,h,d,p,g,m,v=[],y=e.children,_=0,x=0,b=y.length,w=e.value;_<b;){s=i-n,l=a-r;do{c=y[x++].value}while(!c&&x<b);for(f=h=c,m=c*c*(g=Math.max(l/s,s/l)/(w*t)),p=Math.max(h/m,m/f);x<b;++x){if(c+=o=y[x].value,o<f&&(f=o),o>h&&(h=o),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=o;break}p=d}v.push(u={value:c,dice:s<l,children:y.slice(_,x)}),u.dice?lk(u,n,r,i,w?r+=l*c/w:a):bk(u,n,r,w?n+=s*c/w:i,a),w-=c,_=x}return v}var kk=function t(e){function n(t,n,r,i,a){Ak(e,t,n,r,i,a)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(wk);var Mk=function t(e){function n(t,n,r,i,a){if((u=t._squarify)&&u.ratio===e)for(var u,o,s,l,c,f=-1,h=u.length,d=t.value;++f<h;){for(s=(o=u[f]).children,l=o.value=0,c=s.length;l<c;++l)o.value+=s[l].value;o.dice?lk(o,n,r,i,r+=(a-r)*o.value/d):bk(o,n,r,n+=(i-n)*o.value/d,a),d-=o.value}else t._squarify=u=Ak(e,t,n,r,i,a),u.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(wk);function Ek(t){Hr.call(this,null,t)}function Dk(t){return t.values}function Ck(){var t,e=[];return t={entries:t=>function t(n,r){if(++r>e.length)return n;var i,a=[];for(i in n)a.push({key:i,values:t(n[i],r)});return a}(function t(n,r){if(r>=e.length)return n;for(var i,a,u,o=-1,s=n.length,l=e[r++],c={},f={};++o<s;)(u=c[i=l(a=n[o])+""])?u.push(a):c[i]=[a];for(i in c)f[i]=t(c[i],r);return f}(t,0),0),key:n=>(e.push(n),t)}}function Fk(t){Hr.call(this,null,t)}function Sk(t,e){return t.parent===e.parent?1:2}Ek.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},rt(Ek,Hr).transform=function(t,e){e.source||i("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),a=e.clone(),u=this.value;return(!u||r||e.changed())&&(u&&u.each(t=>{t.children&&Dt(t.data)&&a.rem.push(t.data)}),this.value=u=RA({values:I(t.keys).reduce((t,e)=>(t.key(e),t),Ck()).entries(a.source)},Dk),n&&u.each(t=>{t.children&&(t=St(t.data),a.add.push(t),a.source.push(t))}),BA(u,Ct,Ct)),a.source.root=u,a},rt(Fk,Hr).transform=function(t,e){e.source&&e.source.root||i(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,a=e.source.root,u=t.as||r;t.field?a.sum(t.field):a.count(),t.sort&&a.sort(Nt(t.sort,t=>t.data)),function(t,e,n){for(var r,i=0,a=e.length;i<a;++i)(r=e[i])in n&&t[r](n[r])}(n,this.params,t),n.separation&&n.separation(!1!==t.separation?Sk:g);try{this.value=n(a)}catch(t){i(t)}return a.each((function(t){!function(t,e,n){for(var r=t.data,i=0,a=e.length-1;i<a;++i)r[n[i]]=t[e[i]];r[n[a]]=t.children?t.children.length:0}(t,r,u)})),e.reflow(t.modified()).modifies(u).modifies("leaf")};var Bk=["x","y","r","depth","children"];function zk(t){Fk.call(this,t)}zk.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:Bk.length,default:Bk}]};var Tk=rt(zk,Fk);Tk.layout=function(){var t=null,e=1,n=1,r=nk;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(ak(t)).eachAfter(uk(r,.5)).eachBefore(ok(1)):i.eachBefore(ak(ik)).eachAfter(uk(nk,1)).eachAfter(uk(r,i.r/Math.min(e,n))).eachBefore(ok(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=tk(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:rk(+t),i):r},i},Tk.params=["radius","size","padding"],Tk.fields=Bk;var Nk=["x0","y0","x1","y1","depth","children"];function Ok(t){Fk.call(this,t)}Ok.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:Nk.length,default:Nk}]};var Rk=rt(Ok,Fk);function qk(t){Hr.call(this,null,t)}Rk.layout=function(){var t=1,e=1,n=0,r=!1;function i(i){var a=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/a,i.eachBefore(function(t,e){return function(r){r.children&&lk(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,a=r.y0,u=r.x1-n,o=r.y1-n;u<i&&(i=u=(i+u)/2),o<a&&(a=o=(a+o)/2),r.x0=i,r.y0=a,r.x1=u,r.y1=o}}(e,a)),r&&i.eachBefore(sk),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},Rk.params=["size","round","padding"],Rk.fields=Nk,qk.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},rt(qk,Hr).transform=function(t,e){e.source||i("Stratify transform requires an upstream data source.");var n=this.value,r=t.modified(),a=e.fork(e.ALL).materialize(e.SOURCE),u=!this.value||r||e.changed(e.ADD_REM)||e.modified(t.key.fields)||e.modified(t.parentKey.fields);return a.source=a.source.slice(),u&&(n=a.source.length?BA(pk().id(t.key).parentId(t.parentKey)(a.source),t.key,m):BA(pk()([{}]),t.key,t.key)),a.source.root=this.value=n,a};var Uk={tidy:function(){var t=gk,e=1,n=1,r=null;function i(i){var s=function(t){for(var e,n,r,i,a,u=new xk(t,0),o=[u];e=o.pop();)if(r=e._.children)for(e.children=new Array(a=r.length),i=a-1;i>=0;--i)o.push(n=e.children[i]=new xk(r[i],i)),n.parent=e;return(u.parent=new xk(null,0)).children=[u],u}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(u),r)i.eachBefore(o);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.x<l.x&&(l=t),t.x>c.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var a=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,a=e,u=e,o=n,s=a.parent.children[0],l=a.m,c=u.m,f=o.m,h=s.m;o=vk(o),a=mk(a),o&&a;)s=mk(s),(u=vk(u)).a=e,(i=o.z+f-a.z-l+t(o._,a._))>0&&(yk(_k(o,e,r),e,i),l+=i,c+=i),f+=o.m,l+=a.m,h+=s.m,c+=u.m;o&&!vk(u)&&(u.t=o,u.m+=f-c),a&&!mk(s)&&(s.t=a,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function o(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=zA,e=1,n=1,r=!1;function i(i){var a,u=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(TA,0)/t.length}(n),e.y=function(t){return 1+t.reduce(NA,0)}(n)):(e.x=a?u+=t(e,a):0,e.y=0,a=e)}));var o=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=o.x-t(o,s)/2,c=s.x+t(s,o)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},Lk=["x","y","depth","children"];function Pk(t){Fk.call(this,t)}Pk.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:Lk.length,default:Lk}]};var $k=rt(Pk,Fk);function jk(t){Hr.call(this,[],t)}$k.layout=function(t){var e=t||"tidy";if(K(Uk,e))return Uk[e]();i("Unrecognized Tree layout method: "+e)},$k.params=["size","nodeSize"],$k.fields=Lk,jk.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},rt(jk,Hr).transform=function(t,e){var n=this.value,r=e.source&&e.source.root,a=e.fork(e.NO_SOURCE),u={};return r||i("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(a.rem=n,e.visit(e.SOURCE,(function(t){u[Ct(t)]=1})),r.each((function(t){var e=t.data,n=t.parent&&t.parent.data;n&&u[Ct(e)]&&u[Ct(n)]&&a.add.push(St({source:n,target:e}))})),this.value=a.add):e.changed(e.MOD)&&(e.visit(e.MOD,(function(t){u[Ct(t)]=1})),n.forEach((function(t){(u[Ct(t.source)]||u[Ct(t.target)])&&a.mod.push(t)}))),a};var Ik={binary:function(t,e,n,r,i){var a,u,o=t.children,s=o.length,l=new Array(s+1);for(l[0]=u=a=0;a<s;++a)l[a+1]=u+=o[a].value;!function t(e,n,r,i,a,u,s){if(e>=n-1){var c=o[e];return c.x0=i,c.y0=a,c.x1=u,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;l[g]<h?d=g+1:p=g}h-l[d-1]<l[d]-h&&e+1<d&&--d;var m=l[d]-f,v=r-m;if(u-i>s-a){var y=(i*v+u*m)/r;t(e,d,m,i,a,y,s),t(d,n,v,y,a,u,s)}else{var _=(a*v+s*m)/r;t(e,d,m,i,a,u,_),t(d,n,v,i,_,u,s)}}(0,s,t.value,e,n,r,i)},dice:lk,slice:bk,slicedice:function(t,e,n,r,i){(1&t.depth?bk:lk)(t,e,n,r,i)},squarify:kk,resquarify:Mk},Hk=["x0","y0","x1","y1","depth","children"];function Wk(t){Fk.call(this,t)}Wk.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:Hk.length,default:Hk}]};var Yk=rt(Wk,Fk);Yk.layout=function(){var t=function(){var t=kk,e=!1,n=1,r=1,i=[0],a=nk,u=nk,o=nk,s=nk,l=nk;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(sk),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f<r&&(r=f=(r+f)/2),h<c&&(c=h=(c+h)/2),e.x0=r,e.y0=c,e.x1=f,e.y1=h,e.children&&(n=i[e.depth+1]=a(e)/2,r+=l(e)-n,c+=u(e)-n,(f-=o(e)-n)<r&&(r=f=(r+f)/2),(h-=s(e)-n)<c&&(c=h=(c+h)/2),t(e,r,c,f,h))}return c.round=function(t){return arguments.length?(e=!!t,c):e},c.size=function(t){return arguments.length?(n=+t[0],r=+t[1],c):[n,r]},c.tile=function(e){return arguments.length?(t=ek(e),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:rk(+t),c):a},c.paddingOuter=function(t){return arguments.length?c.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):c.paddingTop()},c.paddingTop=function(t){return arguments.length?(u="function"==typeof t?t:rk(+t),c):u},c.paddingRight=function(t){return arguments.length?(o="function"==typeof t?t:rk(+t),c):o},c.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:rk(+t),c):s},c.paddingLeft=function(t){return arguments.length?(l="function"==typeof t?t:rk(+t),c):l},c}();return t.ratio=function(e){var n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=function(e){K(Ik,e)?t.tile(Ik[e]):i("Unrecognized Treemap layout method: "+e)},t},Yk.params=["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],Yk.fields=Hk;var Vk=Object.freeze({__proto__:null,nest:Ek,pack:zk,partition:Ok,stratify:qk,tree:Pk,treelinks:jk,treemap:Wk});function Gk(t,e){var n,r,i,a,u,o,s=[],l=function(t){return t(a)};if(null==e)s.push(t);else for(n={},r=0,i=t.length;r<i;++r)a=t[r],(o=n[u=e.map(l)])||(n[u]=o=[],o.dims=u,s.push(o)),o.push(a);return s}function Xk(t){Hr.call(this,null,t)}Xk.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}]},rt(Xk,Hr).transform=function(t,e){var r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=Gk(e.materialize(e.SOURCE).source,t.groupby),a=(t.groupby||[]).map(n),u=a.length,o=t.as||[n(t.x),n(t.y)],s=[];i.forEach(e=>{ua(e,t.x,t.y,t.bandwidth||.3).forEach(t=>{const n={};for(let t=0;t<u;++t)n[a[t]]=e.dims[t];n[o[0]]=t[0],n[o[1]]=t[1],s.push(St(n))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=s}return r};const Jk={linear:Ki,log:ta,exp:ea,pow:na,quad:ra,poly:ia};function Zk(t){Hr.call(this,null,t)}Zk.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(Jk)},{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}]},rt(Zk,Hr).transform=function(t,e){var r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const a=Gk(e.materialize(e.SOURCE).source,t.groupby),u=(t.groupby||[]).map(n),o=t.method||"linear",s=t.order||3,l=function(t,e){return"poly"===t?e:"quad"===t?2:1}(o,s),c=t.as||[n(t.x),n(t.y)],f=Jk[o],h=[];let d=t.extent;K(Jk,o)||i("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),a.forEach(n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,s);if(t.params)return void h.push(St({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||J(n,t.x),a=t=>{const e={};for(let t=0;t<u.length;++t)e[u[t]]=n.dims[t];e[c[0]]=t[0],e[c[1]]=t[1],h.push(St(e))};"linear"===o?i.forEach(t=>a([t,r.predict(t)])):ca(r.predict,i,25,200).forEach(a)}),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r};var Qk=Object.freeze({__proto__:null,loess:Xk,regression:Zk});const Kk=Math.pow(2,-52),tM=new Uint32Array(512);class eM{static from(t,e=lM,n=cM){const r=t.length,i=new Float64Array(2*r);for(let a=0;a<r;a++){const r=t[a];i[2*a]=e(r),i[2*a+1]=n(r)}return new eM(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let u=1/0,o=1/0,s=-1/0,l=-1/0;for(let e=0;e<a;e++){const n=t[2*e],r=t[2*e+1];n<u&&(u=n),r<o&&(o=r),n>s&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(u+s)/2,f=(o+l)/2;let h,d,p,g=1/0;for(let e=0;e<a;e++){const n=nM(c,f,t[2*e],t[2*e+1]);n<g&&(h=e,g=n)}const m=t[2*h],v=t[2*h+1];g=1/0;for(let e=0;e<a;e++){if(e===h)continue;const n=nM(m,v,t[2*e],t[2*e+1]);n<g&&n>0&&(d=e,g=n)}let y=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;e<a;e++){if(e===h||e===d)continue;const n=uM(m,v,y,_,t[2*e],t[2*e+1]);n<x&&(p=e,x=n)}let b=t[2*p],w=t[2*p+1];if(x===1/0){for(let e=0;e<a;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];oM(this._ids,this._dists,0,a-1);const e=new Uint32Array(a);let n=0;for(let t=0,r=-1/0;t<a;t++){const i=this._ids[t];this._dists[i]>r&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(iM(m,v,y,_,b,w)){const t=d,e=y,n=_;d=p,y=b,_=w,p=t,b=e,w=n}const A=function(t,e,n,r,i,a){const u=n-t,o=r-e,s=i-t,l=a-e,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s);return{x:t+(l*c-o*f)*h,y:e+(u*f-s*c)*h}}(m,v,y,_,b,w);this._cx=A.x,this._cy=A.y;for(let e=0;e<a;e++)this._dists[e]=nM(t[2*e],t[2*e+1],A.x,A.y);oM(this._ids,this._dists,0,a-1),this._hullStart=h;let k=3;n[h]=e[p]=d,n[d]=e[h]=p,n[p]=e[d]=h,r[h]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(m,v)]=h,i[this._hashKey(y,_)]=d,i[this._hashKey(b,w)]=p,this.trianglesLen=0,this._addTriangle(h,d,p,-1,-1,-1);for(let a,u,o=0;o<this._ids.length;o++){const s=this._ids[o],l=t[2*s],c=t[2*s+1];if(o>0&&Math.abs(l-a)<=Kk&&Math.abs(c-u)<=Kk)continue;if(a=l,u=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t<this._hashSize&&(f=i[(e+t)%this._hashSize],-1===f||f===n[f]);t++);f=e[f];let g,m=f;for(;g=n[m],!iM(l,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1]);)if(m=g,m===f){m=-1;break}if(-1===m)continue;let v=this._addTriangle(m,s,n[m],-1,-1,r[m]);r[s]=this._legalize(v+2),r[m]=v,k++;let y=n[m];for(;g=n[y],iM(l,c,t[2*y],t[2*y+1],t[2*g],t[2*g+1]);)v=this._addTriangle(y,s,g,r[s],-1,r[y]),r[s]=this._legalize(v+2),n[y]=y,k--,y=g;if(m===f)for(;g=e[m],iM(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1]);)v=this._addTriangle(g,s,m,-1,r[m],r[g]),this._legalize(v+2),r[g]=v,n[m]=m,k--,m=g;this._hullStart=e[s]=m,n[m]=e[y]=s,n[s]=y,i[this._hashKey(l,c)]=s,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(k);for(let t=0,e=this._hullStart;t<k;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const u=n[t],o=t-t%3;if(a=o+(t+2)%3,-1===u){if(0===i)break;t=tM[--i];continue}const s=u-u%3,l=o+(t+1)%3,c=s+(u+2)%3,f=e[a],h=e[t],d=e[l],p=e[c];if(aM(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[u]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(u,n[a]),this._link(a,c);const o=s+(u+1)%3;i<tM.length&&(tM[i++]=o)}else{if(0===i)break;t=tM[--i]}}return a}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,a){const u=this.trianglesLen;return this._triangles[u]=t,this._triangles[u+1]=e,this._triangles[u+2]=n,this._link(u,r),this._link(u+1,i),this._link(u+2,a),this.trianglesLen+=3,u}}function nM(t,e,n,r){const i=t-n,a=e-r;return i*i+a*a}function rM(t,e,n,r,i,a){const u=(r-e)*(i-t),o=(n-t)*(a-e);return Math.abs(u-o)>=33306690738754716e-32*Math.abs(u+o)?u-o:0}function iM(t,e,n,r,i,a){return(rM(i,a,t,e,n,r)||rM(t,e,n,r,i,a)||rM(n,r,i,a,t,e))<0}function aM(t,e,n,r,i,a,u,o){const s=t-u,l=e-o,c=n-u,f=r-o,h=i-u,d=a-o,p=c*c+f*f,g=h*h+d*d;return s*(f*g-p*d)-l*(c*g-p*h)+(s*s+l*l)*(c*d-f*h)<0}function uM(t,e,n,r,i,a){const u=n-t,o=r-e,s=i-t,l=a-e,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s),d=(l*c-o*f)*h,p=(u*f-s*c)*h;return d*d+p*p}function oM(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],a=e[r];let u=i-1;for(;u>=n&&e[t[u]]>a;)t[u+1]=t[u--];t[u+1]=r}else{let i=n+1,a=r;sM(t,n+r>>1,i),e[t[n]]>e[t[r]]&&sM(t,n,r),e[t[i]]>e[t[r]]&&sM(t,i,r),e[t[n]]>e[t[i]]&&sM(t,n,i);const u=t[i],o=e[u];for(;;){do{i++}while(e[t[i]]<o);do{a--}while(e[t[a]]>o);if(a<i)break;sM(t,i,a)}t[n+1]=t[a],t[a]=u,r-i+1>=a-n?(oM(t,e,i,r),oM(t,e,n,a-1)):(oM(t,e,n,a-1),oM(t,e,i,r))}}function sM(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function lM(t){return t[0]}function cM(t){return t[1]}class fM{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class hM{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class dM{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))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=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,a=0,u=0,o=n.length;a<o;a+=3,u+=2){const o=2*n[a],s=2*n[a+1],l=2*n[a+2],c=t[o],f=t[o+1],h=t[s],d=t[s+1],p=t[l],g=t[l+1],m=h-c,v=d-f,y=p-c,_=g-f,x=m*m+v*v,b=y*y+_*_,w=2*(m*_-v*y);if(w)if(Math.abs(w)<1e-8)e=(c+p)/2,r=(f+g)/2;else{const t=1/w;e=c+(_*x-v*b)*t,r=f+(m*b-y*x)*t}else e=(c+p)/2-1e8*_,r=(f+g)/2+1e8*y;i[u]=e,i[u+1]=r}let a,u,o,s=e[e.length-1],l=4*s,c=t[2*s],f=t[2*s+1];r.fill(0);for(let n=0;n<e.length;++n)s=e[n],a=l,u=c,o=f,l=4*s,c=t[2*s],f=t[2*s+1],r[a+2]=r[l]=o-f,r[a+3]=r[l+1]=c-u}render(t){const e=null==t?t=new fM:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:a,vectors:u}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),u=2*Math.floor(r/3),o=a[i],s=a[i+1],l=a[u],c=a[u+1];this._renderSegment(o,s,l,c,t)}let o,s=i[i.length-1];for(let e=0;e<i.length;++e){o=s,s=i[e];const n=2*Math.floor(r[s]/3),l=a[n],c=a[n+1],f=4*o,h=this._project(l,c,u[f+2],u[f+3]);h&&this._renderSegment(l,c,h[0],h[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new fM:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new fM:void 0,r=this._clip(t);if(null===r)return;e.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]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(yield t)}}cellPolygon(t){const e=new hM;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let a;const u=this._regioncode(t,e),o=this._regioncode(n,r);0===u&&0===o?(i.moveTo(t,e),i.lineTo(n,r)):(a=this._clipSegment(t,e,n,r,u,o))&&(i.moveTo(a[0],a[1]),i.lineTo(a[2],a[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let a=0,u=t.length;a<u;a+=2)if(e[r]==t[a]&&e[r+1]==t[a+1]&&e[(r+2)%i]==t[(a+u-2)%u]&&e[(r+3)%i]==t[(a+u-1)%u]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,a=n[t];if(-1===a)return null;const u=[];let o=a;do{const n=Math.floor(o/3);if(u.push(e[2*n],e[2*n+1]),o=o%3==2?o-2:o+1,i[o]!==t)break;o=r[o]}while(o!==a&&-1!==o);return u}_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 e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e)}_clipFinite(t,e){const n=e.length;let r,i,a,u,o,s=null,l=e[n-2],c=e[n-1],f=this._regioncode(l,c);for(let h=0;h<n;h+=2)if(r=l,i=c,l=e[h],c=e[h+1],a=f,f=this._regioncode(l,c),0===a&&0===f)u=o,o=0,s?s.push(l,c):s=[l,c];else{let e,n,h,d,p;if(0===a){if(null===(e=this._clipSegment(r,i,l,c,a,f)))continue;[n,h,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,f,a)))continue;[d,p,n,h]=e,u=o,o=this._edgecode(n,h),u&&o&&this._edge(t,u,o,s,s.length),s?s.push(n,h):s=[n,h]}u=o,o=this._edgecode(d,p),u&&o&&this._edge(t,u,o,s,s.length),s?s.push(d,p):s=[d,p]}if(s)u=o,o=this._edgecode(s[0],s[1]),u&&o&&this._edge(t,u,o,s,s.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 s}_clipSegment(t,e,n,r,i,a){for(;;){if(0===i&&0===a)return[t,e,n,r];if(i&a)return null;let u,o,s=i||a;8&s?(u=t+(n-t)*(this.ymax-e)/(r-e),o=this.ymax):4&s?(u=t+(n-t)*(this.ymin-e)/(r-e),o=this.ymin):2&s?(o=e+(r-e)*(this.xmax-t)/(n-t),u=this.xmax):(o=e+(r-e)*(this.xmin-t)/(n-t),u=this.xmin),i?(t=u,e=o,i=this._regioncode(t,e)):(n=u,r=o,a=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,a){let u,o=Array.from(e);if((u=this._project(o[0],o[1],n,r))&&o.unshift(u[0],u[1]),(u=this._project(o[o.length-2],o[o.length-1],i,a))&&o.push(u[0],u[1]),o=this._clipFinite(t,o))for(let e,n=0,r=o.length,i=this._edgecode(o[r-2],o[r-1]);n<r;n+=2)e=i,i=this._edgecode(o[n],o[n+1]),e&&i&&(n=this._edge(t,e,i,o,n),r=o.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(o=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return o}_edge(t,e,n,r,i){for(;e!==n;){let n,a;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,a=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,a=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,a=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,a=this.ymin}r[i]===n&&r[i+1]===a||!this.contains(t,n,a)||(r.splice(i,0,n,a),i+=2)}if(r.length>4)for(let t=0;t<r.length;t+=2){const e=(t+2)%r.length,n=(t+4)%r.length;(r[t]===r[e]&&r[e]===r[n]||r[t+1]===r[e+1]&&r[e+1]===r[n+1])&&(r.splice(e,2),t-=2)}return i}_project(t,e,n,r){let i,a,u,o=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<o&&(u=this.ymin,a=t+(o=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<o&&(u=this.ymax,a=t+(o=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<o&&(a=this.xmax,u=e+(o=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<o&&(a=this.xmin,u=e+(o=i)*r)}return[a,u]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}}const pM=2*Math.PI;function gM(t){return t[0]}function mM(t){return t[1]}function vM(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class yM{static from(t,e=gM,n=mM,r){return new yM("length"in t?function(t,e,n,r){const i=t.length,a=new Float64Array(2*i);for(let u=0;u<i;++u){const i=t[u];a[2*u]=e.call(r,i,u,t),a[2*u+1]=n.call(r,i,u,t)}return a}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const a of t)yield e.call(r,a,i,t),yield n.call(r,a,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new eM(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,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],a=2*e[t+2];if((n[a]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[a+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.sqrt((r[3]-r[1])**2+(r[2]-r[0])**2);for(let t=0,n=e.length/2;t<n;++t){const n=vM(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new eM(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),u=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==a[e]||(a[e]=t)}for(let t=0,e=r.length;t<e;++t)u[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],this.triangles[1]=r[1],this.triangles[2]=r[1],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(t){return new dM(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:u}=this;if(u){const e=u.indexOf(t);return e>0&&(yield u[e-1]),void(e<u.length-1&&(yield u[e+1]))}const o=e[t];if(-1===o)return;let s=o,l=-1;do{if(yield l=a[s],s=s%3==2?s-2:s+1,a[s]!==t)return;if(s=i[s],-1===s){const e=n[(r[t]+1)%n.length];return void(e!==l&&(yield e))}}while(s!==o)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:u,triangles:o,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=(e-s[2*t])**2+(n-s[2*t+1])**2;const f=r[t];let h=f;do{let r=o[h];const f=(e-s[2*r])**2+(n-s[2*r+1])**2;if(f<c&&(c=f,l=r),h=h%3==2?h-2:h+1,o[h]!==t)break;if(h=u[h],-1===h){if(h=i[(a[t]+1)%i.length],h!==r&&(e-s[2*h])**2+(n-s[2*h+1])**2<c)return h;break}}while(h!==f);return l}render(t){const e=null==t?t=new fM:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,a=r.length;e<a;++e){const a=r[e];if(a<e)continue;const u=2*i[e],o=2*i[a];t.moveTo(n[u],n[u+1]),t.lineTo(n[o],n[o+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e=2){const n=null==t?t=new fM:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],a=r[n+1];t.moveTo(i+e,a),t.arc(i,a,e,0,pM)}return n&&n.value()}renderHull(t){const e=null==t?t=new fM:void 0,{hull:n,points:r}=this,i=2*n[0],a=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<a;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new hM;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new fM:void 0,{points:r,triangles:i}=this,a=2*i[t*=3],u=2*i[t+1],o=2*i[t+2];return e.moveTo(r[a],r[a+1]),e.lineTo(r[u],r[u+1]),e.lineTo(r[o],r[o+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new hM;return this.renderTriangle(t,e),e.value()}}function _M(t){Hr.call(this,null,t)}_M.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 xM=rt(_M,Hr),bM=[-1e5,-1e5,1e5,1e5];function wM(t){const e=t[0][0],n=t[0][1];let r=t.length-1;for(;t[r][0]===e&&t[r][1]===n;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}xM.transform=function(t,e){const n=t.as||"path",r=e.source;if(!r||!r.length)return e;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]]:bM;const a=this.value=yM.from(r,t.x,t.y).voronoi(i);for(let t=0,e=r.length;t<e;++t){const e=a.cellPolygon(t);r[t][n]=e?wM(e):null}return e.reflow(t.modified()).modifies(n)};var AM=Object.freeze({__proto__:null,voronoi:_M}),kM=Math.PI/180;function MM(){var t,e,n,r,i,a,u,o=[256,256],s=SM,l=[],c=Math.random,f={};function h(t,e,n){for(var r,i,a,u=e.x,l=e.y,f=Math.sqrt(o[0]*o[0]+o[1]*o[1]),h=s(o),d=c()<.5?1:-1,p=-d;(r=h(p+=d))&&(i=~~r[0],a=~~r[1],!(Math.min(Math.abs(i),Math.abs(a))>=f));)if(e.x=u+i,e.y=l+a,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>o[0]||e.y+e.y1>o[1])&&(!n||!DM(e,t,o[0]))&&(!n||FM(e,n))){for(var g,m=e.sprite,v=e.width>>5,y=o[0]>>5,_=e.x-(v<<4),x=127&_,b=32-x,w=e.y1-e.y0,A=(e.y+e.y0)*y+(_>>5),k=0;k<w;k++){g=0;for(var M=0;M<=v;M++)t[A+M]|=g<<b|(M<v?(g=m[k*v+M])>>>x:0);A+=y}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=2048/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Vo()),f=function(t){var e=[],n=-1;for(;++n<t;)e[n]=0;return e}((o[0]>>5)*o[1]),d=null,p=l.length,g=-1,m=[],v=l.map((function(o){return{text:t(o),font:e(o),style:r(o),weight:i(o),rotate:a(o),size:~~(n(o)+1e-14),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}})).sort((function(t,e){return e.size-t.size}));++g<p;){var y=v[g];y.x=o[0]*(c()+.5)>>1,y.y=o[1]*(c()+.5)>>1,EM(s,y,v,g),y.hasText&&h(f,y,d)&&(m.push(y),d?CM(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-=o[0]>>1,y.y-=o[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(o=[+t[0],+t[1]],f):o},f.font=function(t){return arguments.length?(e=BM(t),f):e},f.fontStyle=function(t){return arguments.length?(r=BM(t),f):r},f.fontWeight=function(t){return arguments.length?(i=BM(t),f):i},f.rotate=function(t){return arguments.length?(a=BM(t),f):a},f.text=function(e){return arguments.length?(t=BM(e),f):t},f.spiral=function(t){return arguments.length?(s=zM[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=BM(t),f):n},f.padding=function(t){return arguments.length?(u=BM(t),f):u},f.random=function(t){return arguments.length?(c=t,f):c},f}function EM(t,e,n,r){if(!e.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,2048/a);var u,o,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r<p;){if(e=n[r],i.save(),i.font=e.style+" "+e.weight+" "+~~((e.size+1)/a)+"px "+e.font,u=i.measureText(e.text+"m").width*a,s=e.size<<1,e.rotate){var g=Math.sin(e.rotate*kM),m=Math.cos(e.rotate*kM),v=u*m,y=u*g,_=s*m,x=s*g;u=Math.max(Math.abs(v+x),Math.abs(v-x))+31>>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else u=u+31>>5<<5;if(s>d&&(d=s),f+u>=2048&&(f=0,h+=d,d=0),h+s>=2048)break;i.translate((f+(u>>1))/a,(h+(s>>1))/a),e.rotate&&i.rotate(e.rotate*kM),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=u,e.height=s,e.xoff=f,e.yoff=h,e.x1=u>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=u}for(var b=i.getImageData(0,0,2048/a,2048/a).data,w=[];--r>=0;)if((e=n[r]).hasText){for(o=(u=e.width)>>5,s=e.y1-e.y0,l=0;l<s*o;l++)w[l]=0;if(null==(f=e.xoff))return;h=e.yoff;var A=0,k=-1;for(c=0;c<s;c++){for(l=0;l<u;l++){var M=o*c+(l>>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,A|=E}A?k=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+k,e.sprite=w.slice(0,(e.y1-e.y0)*o)}}}function DM(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,u=t.x-(a<<4),o=127&u,s=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*n+(u>>5),f=0;f<l;f++){r=0;for(var h=0;h<=a;h++)if((r<<s|(h<a?(r=i[f*a+h])>>>o:0))&e[c+h])return!0;c+=n}return!1}function CM(t,e){var n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function FM(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function SM(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function BM(t){return"function"==typeof t?t:function(){return t}}var zM={archimedean:SM,rectangular:function(t){var e=4*t[0]/t[1],n=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}},TM=["x","y","font","fontSize","fontStyle","fontWeight","angle"],NM=["text","font","rotate","fontSize","fontStyle","fontWeight"];function OM(t){Hr.call(this,MM(),t)}OM.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:TM}]},rt(OM,Hr).transform=function(e,n){!e.size||e.size[0]&&e.size[1]||i("Wordcloud size dimensions must be non-zero.");var r=e.modified();if(r||n.changed(n.ADD_REM)||NM.some((function(t){var r=e[t];return W(r)&&n.modified(r.fields)}))){var a,u=n.materialize(n.SOURCE).source,o=this.value,s=e.as||TM,l=e.fontSize||14;if(W(l)?a=e.fontSizeRange:l=V(l),a){var c=l,f=qm("sqrt")().domain(J(u,c)).range(a);l=function(t){return f(c(t))}}u.forEach((function(t){t[s[0]]=NaN,t[s[1]]=NaN,t[s[3]]=0}));for(var h,d,p=o.words(u).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(t.random).layout(),g=o.size(),m=g[0]>>1,v=g[1]>>1,y=0,_=p.length;y<_;++y)(d=(h=p[y]).datum)[s[0]]=h.x+m,d[s[1]]=h.y+v,d[s[2]]=h.font,d[s[3]]=h.size,d[s[4]]=h.style,d[s[5]]=h.weight,d[s[6]]=h.rotate;return n.reflow(r).modifies(s)}};var RM=Object.freeze({__proto__:null,wordcloud:OM});function qM(t){return new Uint8Array(t)}function UM(t){return new Uint16Array(t)}function LM(t){return new Uint32Array(t)}function PM(t,e,n){var r=(e<257?qM:e<65537?UM:LM)(t);return n&&r.set(n),r}function $M(t,e,n){var r=1<<e;return{one:r,zero:~r,range:n.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd:function(t,e){var n,i=this.bisect(this.range,t.value),a=t.index,u=i[0],o=i[1],s=a.length;for(n=0;n<u;++n)e[a[n]]|=r;for(n=o;n<s;++n)e[a[n]]|=r;return this}}}function jM(){var t=LM(0),e=[],n=0;return{insert:function(r,i,a){if(!i.length)return[];var u,o,s,l=n,c=i.length,f=Array(c),h=LM(c);for(s=0;s<c;++s)f[s]=r(i[s]),h[s]=s;if(f=function(t,e){return t.sort.call(e,(function(e,n){var r=t[e],i=t[n];return r<i?-1:r>i?1:0})),function(t,e){return Array.from(e,e=>t[e])}(t,e)}(f,h),l)u=e,o=t,e=Array(l+c),t=LM(l+c),function(t,e,n,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c<r&&f<u;++l)e[c]<i[f]?(o[l]=e[c],s[l]=n[c++]):(o[l]=i[f],s[l]=a[f++]+t);for(;c<r;++c,++l)o[l]=e[c],s[l]=n[c];for(;f<u;++f,++l)o[l]=i[f],s[l]=a[f]+t}(a,u,o,l,f,h,c,e,t);else{if(a>0)for(s=0;s<c;++s)h[s]+=a;e=f,t=h}return n=l+c,{index:h,value:f}},remove:function(r,i){var a,u,o,s=n;for(u=0;!i[t[u]]&&u<s;++u);for(o=u;u<s;++u)i[a=t[u]]||(t[o]=a,e[o]=e[u],++o);n=s-r},bisect:function(t,r){var i;return r?i=r.length:(r=e,i=n),[si(r,t[0],0,i),oi(r,t[1],0,i)]},reindex:function(e){for(var r=0,i=n;r<i;++r)t[r]=e[t[r]]},index:function(){return t},size:function(){return n}}}function IM(t){Hr.call(this,function(){var t=8,e=[],n=LM(0),r=PM(0,t),i=PM(0,t);return{data:function(){return e},seen:function(){return n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length)},add:function(t){for(var n,r=0,i=e.length,a=t.length;r<a;++r)(n=t[r])._index=i++,e.push(n)},remove:function(t,n){var a,u,o,s=e.length,l=Array(s-t),c=e;for(u=0;!n[u]&&u<s;++u)l[u]=e[u],c[u]=u;for(o=u;u<s;++u)a=e[u],n[u]?c[u]=-1:(c[u]=o,r[o]=r[u],i[o]=i[u],l[o]=a,a._index=o++),r[u]=0;return e=l,c},size:function(){return e.length},curr:function(){return r},prev:function(){return i},reset:function(t){i[t]=r[t]},all:function(){return t<257?255:t<65537?65535:4294967295},set:function(t,e){r[t]|=e},clear:function(t,e){r[t]&=~e},resize:function(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=PM(e,t,r),i=PM(e,t))}}}(),t),this._indices=null,this._dims=null}IM.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}}]};var HM=rt(IM,Hr);function WM(t){Hr.call(this,null,t)}HM.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some((function(t){return e.modified(t.fields)}))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},HM.init=function(t,e){for(var n,r,i=t.fields,a=t.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;l<s;++l)r=u[n=i[l].fname]||(u[n]=jM()),o.push($M(r,l,a[l]));return this.eval(t,e)},HM.reinit=function(t,e){var n,r,i,a,u,o,s,l,c,f=e.materialize().fork(),h=t.fields,d=t.query,p=this._indices,g=this._dims,m=this.value,v=m.curr(),y=m.prev(),_=m.all(),x=f.rem=f.add,b=f.mod,w=d.length,A={};if(y.set(v),e.rem.length&&(u=this.remove(t,e,f)),e.add.length&&m.add(e.add),e.mod.length)for(o={},s=0,l=(a=e.mod).length;s<l;++s)o[a[s]._index]=1;for(s=0;s<w;++s)c=h[s],(!g[s]||t.modified("fields",s)||e.modified(c.fields))&&((n=A[i=c.fname])||(p[i]=r=jM(),A[i]=n=r.insert(c,e.source,0)),g[s]=$M(r,s,d[s]).onAdd(n,v));for(s=0,l=m.data().length;s<l;++s)u[s]||(y[s]!==v[s]?x.push(s):o[s]&&v[s]!==_&&b.push(s));return m.mask=(1<<w)-1,f},HM.eval=function(t,e){var n=e.materialize().fork(),r=this._dims.length,i=0;return e.rem.length&&(this.remove(t,e,n),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,e,n)),e.add.length&&(this.insert(t,e,n),i|=(1<<r)-1),e.mod.length&&(this.modify(e,n),i|=(1<<r)-1),this.value.mask=i,n},HM.insert=function(t,e,n){var r,i,a,u=e.add,o=this.value,s=this._dims,l=this._indices,c=t.fields,f={},h=n.add,d=o.size(),p=d+u.length,g=s.length;o.resize(p,g),o.add(u);var m=o.curr(),v=o.prev(),y=o.all();for(r=0;r<g;++r)a=f[i=c[r].fname]||(f[i]=l[i].insert(c[r],u,d)),s[r].onAdd(a,m);for(;d<p;++d)v[d]=y,m[d]!==y&&h.push(d)},HM.modify=function(t,e){var n,r,i,a=e.mod,u=this.value,o=u.curr(),s=u.all(),l=t.mod;for(n=0,r=l.length;n<r;++n)o[i=l[n]._index]!==s&&a.push(i)},HM.remove=function(t,e,n){var r,i,a,u,o=this._indices,s=this.value,l=s.curr(),c=s.prev(),f=s.all(),h={},d=n.rem,p=e.rem;for(r=0,i=p.length;r<i;++r)h[a=p[r]._index]=1,c[a]=u=l[a],l[a]=f,u!==f&&d.push(a);for(a in o)o[a].remove(i,h);return this.reindex(e,i,h),h},HM.reindex=function(t,e,n){var r=this._indices,i=this.value;t.runAfter((function(){var t=i.remove(e,n);for(var a in r)r[a].reindex(t)}))},HM.update=function(t,e,n){var r,i,a=this._dims,u=t.query,o=e.stamp,s=a.length,l=0;for(n.filters=0,i=0;i<s;++i)t.modified("query",i)&&(r=i,++l);if(1===l)l=a[r].one,this.incrementOne(a[r],u[r],n.add,n.rem);else for(i=0,l=0;i<s;++i)t.modified("query",i)&&(l|=a[i].one,this.incrementAll(a[i],u[i],o,n.add),n.rem=n.add);return l},HM.incrementAll=function(t,e,n,r){var i,a,u,o=this.value,s=o.seen(),l=o.curr(),c=o.prev(),f=t.index(),h=t.bisect(t.range),d=t.bisect(e),p=d[0],g=d[1],m=h[0],v=h[1],y=t.one;if(p<m)for(i=p,a=Math.min(m,g);i<a;++i)s[u=f[i]]!==n&&(c[u]=l[u],s[u]=n,r.push(u)),l[u]^=y;else if(p>m)for(i=m,a=Math.min(p,v);i<a;++i)s[u=f[i]]!==n&&(c[u]=l[u],s[u]=n,r.push(u)),l[u]^=y;if(g>v)for(i=Math.max(p,v),a=g;i<a;++i)s[u=f[i]]!==n&&(c[u]=l[u],s[u]=n,r.push(u)),l[u]^=y;else if(g<v)for(i=Math.max(m,g),a=v;i<a;++i)s[u=f[i]]!==n&&(c[u]=l[u],s[u]=n,r.push(u)),l[u]^=y;t.range=e.slice()},HM.incrementOne=function(t,e,n,r){var i,a,u,o=this.value.curr(),s=t.index(),l=t.bisect(t.range),c=t.bisect(e),f=c[0],h=c[1],d=l[0],p=l[1],g=t.one;if(f<d)for(i=f,a=Math.min(d,h);i<a;++i)o[u=s[i]]^=g,n.push(u);else if(f>d)for(i=d,a=Math.min(f,p);i<a;++i)o[u=s[i]]^=g,r.push(u);if(h>p)for(i=Math.max(f,p),a=h;i<a;++i)o[u=s[i]]^=g,n.push(u);else if(h<p)for(i=Math.max(d,h),a=p;i<a;++i)o[u=s[i]]^=g,r.push(u);t.range=e.slice()},WM.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."}]},rt(WM,Hr).transform=function(t,e){var n=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&n))return e.StopPropagation;var a=e.fork(e.ALL),u=r.data(),o=r.curr(),s=r.prev(),l=function(t){return o[t]&n?null:u[t]};return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,(function(t){var e=o[t]&n;return!e&&e^s[t]&n?u[t]:null})),a.filter(a.REM,(function(t){var e=o[t]&n;return e&&!(e^e^s[t]&n)?u[t]:null}))):(a.filter(a.ADD,l),a.filter(a.REM,(function(t){return(o[t]&n)===i?u[t]:null}))),a.filter(a.SOURCE,(function(t){return l(t._index)}))};var YM=Object.freeze({__proto__:null,crossfilter:IM,resolvefilter:WM});function VM(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}function GM(t){var e=t._signals.cursor;e||(t._signals.cursor=e=t.add({user:"default",item:null})),t.on(t.events("view","mousemove"),e,(function(t,n){var r=e.value,i=r?s(r)?r:r.user:"default",a=n.item&&n.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}})),t.add(null,(function(t){var e=t.cursor,n=this.value;return s(e)||(n=e.item,e=e.user),function(t){"undefined"!=typeof document&&document.body&&(document.body.style.cursor=t)}(e&&"default"!==e?e:n||e),n}),{cursor:e})}function XM(t,e){var n=t._runtime.data;return K(n,e)||i("Unrecognized data set: "+e),n[e]}function JM(t,e){Ot(e)||i("Second argument to changes must be a changeset.");var n=XM(this,t);return n.modified=!0,this.pulse(n.input,e)}function ZM(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function QM(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function KM(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function tE(t,e,n){var r,i,a=t._renderer,u=a&&a.canvas();return u&&(i=KM(t),(r=Xf(e.changedTouches?e.changedTouches[0]:e,u))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){var r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function a(t){if(!t)return n;s(t)&&(t=i(t));for(var e=n.slice();t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:V(t),item:V(e||{}),group:i,xy:a,x:function(t){return a(t)[0]},y:function(t){return a(t)[1]}}}(t,n,r),e}const eE={trap:!1};function nE(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||o(r)&&!r[n])||(t.warn(`Blocked ${e} ${n} event listener.`),!1)}function rE(t){return t.item}function iE(t){return t.item.mark.source}function aE(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function uE(t,e,n){var r=document.createElement(t);for(var i in e)r.setAttribute(i,e[i]);return null!=n&&(r.textContent=n),r}function oE(t,e,n){if(e){var r=n.param,i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:function(e){e!==t.signal(r.signal)&&t.runAsync(null,(function(){i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=G(r.debounce,i.update))),function(t,e,n,r){var i=uE("div",{class:"vega-bind"});i.appendChild(uE("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(i);var a=sE;switch(n.input){case"checkbox":a=lE;break;case"select":a=cE;break;case"radio":a=fE;break;case"range":a=hE}a(t,i,n,r)}(i,e,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,(function(){i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0),i}}function sE(t,e,n,r){var i=uE("input");for(var a in n)"signal"!==a&&"element"!==a&&i.setAttribute("input"===a?"type":a,n[a]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",(function(){t.update(i.value)})),t.elements=[i],t.set=function(t){i.value=t}}function lE(t,e,n,r){var i={type:"checkbox",name:n.signal};r&&(i.checked=!0);var a=uE("input",i);e.appendChild(a),a.addEventListener("change",(function(){t.update(a.checked)})),t.elements=[a],t.set=function(t){a.checked=!!t||null}}function cE(t,e,n,r){var i=uE("select",{name:n.signal}),a=n.labels||[];n.options.forEach((function(t,e){var n={value:t};dE(t,r)&&(n.selected=!0),i.appendChild(uE("option",n,(a[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(function(){t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=function(t){for(var e=0,r=n.options.length;e<r;++e)if(dE(n.options[e],t))return void(i.selectedIndex=e)}}function fE(t,e,n,r){var i=uE("span",{class:"vega-bind-radio"}),a=n.labels||[];e.appendChild(i),t.elements=n.options.map((function(e,u){var o="vega-option-"+n.signal+"-"+e,s={id:o,type:"radio",name:n.signal,value:e};dE(e,r)&&(s.checked=!0);var l=uE("input",s);return l.addEventListener("change",(function(){t.update(e)})),i.appendChild(l),i.appendChild(uE("label",{for:o},(a[u]||e)+"")),l})),t.set=function(e){for(var n=t.elements,r=0,i=n.length;r<i;++r)dE(n[r].value,e)&&(n[r].checked=!0)}}function hE(t,e,n,r){r=void 0!==r?r:(+n.max+ +n.min)/2;var i=null!=n.max?n.max:Math.max(100,+r)||100,a=n.min||Math.min(0,i,+r)||0,u=n.step||gi(a,i,100),o=uE("input",{type:"range",name:n.signal,min:a,max:i,step:u});o.value=r;var s=uE("label",{},+r);function l(){s.textContent=o.value,t.update(+o.value)}e.appendChild(o),e.appendChild(s),o.addEventListener("input",l),o.addEventListener("change",l),t.elements=[o],t.set=function(t){o.value=t,s.textContent=t}}function dE(t,e){return t===e||t+""==e+""}function pE(t,e,n,r,i,a){return(e=e||new r(t.loader())).initialize(n,ZM(t),QM(t),KM(t),i,a).background(t.background())}function gE(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function mE(t,e){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}const vE=t=>+t||0;function yE(t){return o(t)?{top:vE(t.top),bottom:vE(t.bottom),left:vE(t.left),right:vE(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(vE(t))}async function _E(t,e,n,r){const a=jh(e),u=a&&a.headless;return u||i("Unrecognized renderer type: "+e),await t.runAsync(),pE(t,null,null,u,n,r).renderAsync(t._scenegraph.root)}var xE,bE,wE,AE,kE;function ME(t){this.type=t}ME.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;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];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n<r;++n)if(e[n].visit(t))return 1};(xE={})[1]="Boolean",xE[2]="<end>",xE[3]="Identifier",xE[4]="Keyword",xE[5]="Null",xE[6]="Numeric",xE[7]="Punctuator",xE[8]="String",xE[9]="RegularExpression";var EE="ILLEGAL",DE=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]"),CE=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 FE(t,e){if(!t)throw new Error("ASSERT: "+e)}function SE(t){return t>=48&&t<=57}function BE(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function zE(t){return"01234567".indexOf(t)>=0}function TE(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].indexOf(t)>=0}function NE(t){return 10===t||13===t||8232===t||8233===t}function OE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&DE.test(String.fromCharCode(t))}function RE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&CE.test(String.fromCharCode(t))}var qE={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 UE(){for(var t;wE<AE&&(TE(t=bE.charCodeAt(wE))||NE(t));)++wE}function LE(t){var e,n,r,i=0;for(n="u"===t?4:2,e=0;e<n;++e)wE<AE&&BE(bE[wE])?(r=bE[wE++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):eD({},"Unexpected token %0",EE);return String.fromCharCode(i)}function PE(){var t,e,n,r;for(e=0,"}"===(t=bE[wE])&&eD({},"Unexpected token %0",EE);wE<AE&&BE(t=bE[wE++]);)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(e>1114111||"}"!==t)&&eD({},"Unexpected token %0",EE),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function $E(){var t,e;for(t=bE.charCodeAt(wE++),e=String.fromCharCode(t),92===t&&(117!==bE.charCodeAt(wE)&&eD({},"Unexpected token %0",EE),++wE,(t=LE("u"))&&"\\"!==t&&OE(t.charCodeAt(0))||eD({},"Unexpected token %0",EE),e=t);wE<AE&&RE(t=bE.charCodeAt(wE));)++wE,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==bE.charCodeAt(wE)&&eD({},"Unexpected token %0",EE),++wE,(t=LE("u"))&&"\\"!==t&&RE(t.charCodeAt(0))||eD({},"Unexpected token %0",EE),e+=t);return e}function jE(){var t,e;return t=wE,{type:1===(e=92===bE.charCodeAt(wE)?$E():function(){var t,e;for(t=wE++;wE<AE;){if(92===(e=bE.charCodeAt(wE)))return wE=t,$E();if(!RE(e))break;++wE}return bE.slice(t,wE)}()).length?3:qE.hasOwnProperty(e)?4:"null"===e?5:"true"===e||"false"===e?1:3,value:e,start:t,end:wE}}function IE(){var t,e,n,r,i=wE,a=bE.charCodeAt(wE),u=bE[wE];switch(a){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++wE,{type:7,value:String.fromCharCode(a),start:i,end:wE};default:if(61===(t=bE.charCodeAt(wE+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return wE+=2,{type:7,value:String.fromCharCode(a)+String.fromCharCode(t),start:i,end:wE};case 33:case 61:return wE+=2,61===bE.charCodeAt(wE)&&++wE,{type:7,value:bE.slice(i,wE),start:i,end:wE}}}return">>>="===(r=bE.substr(wE,4))?{type:7,value:r,start:i,end:wE+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:wE+=3}:u===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===e?{type:7,value:e,start:i,end:wE+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?{type:7,value:u,start:i,end:++wE}:void eD({},"Unexpected token %0",EE)}function HE(){var t,e,n;if(FE(SE((n=bE[wE]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=wE,t="","."!==n){if(t=bE[wE++],n=bE[wE],"0"===t){if("x"===n||"X"===n)return++wE,function(t){for(var e="";wE<AE&&BE(bE[wE]);)e+=bE[wE++];return 0===e.length&&eD({},"Unexpected token %0",EE),OE(bE.charCodeAt(wE))&&eD({},"Unexpected token %0",EE),{type:6,value:parseInt("0x"+e,16),start:t,end:wE}}(e);if(zE(n))return function(t){for(var e="0"+bE[wE++];wE<AE&&zE(bE[wE]);)e+=bE[wE++];return(OE(bE.charCodeAt(wE))||SE(bE.charCodeAt(wE)))&&eD({},"Unexpected token %0",EE),{type:6,value:parseInt(e,8),octal:!0,start:t,end:wE}}(e);n&&SE(n.charCodeAt(0))&&eD({},"Unexpected token %0",EE)}for(;SE(bE.charCodeAt(wE));)t+=bE[wE++];n=bE[wE]}if("."===n){for(t+=bE[wE++];SE(bE.charCodeAt(wE));)t+=bE[wE++];n=bE[wE]}if("e"===n||"E"===n)if(t+=bE[wE++],"+"!==(n=bE[wE])&&"-"!==n||(t+=bE[wE++]),SE(bE.charCodeAt(wE)))for(;SE(bE.charCodeAt(wE));)t+=bE[wE++];else eD({},"Unexpected token %0",EE);return OE(bE.charCodeAt(wE))&&eD({},"Unexpected token %0",EE),{type:6,value:parseFloat(t),start:e,end:wE}}function WE(){var t,e,n,r;return kE=null,UE(),t=wE,e=function(){var t,e,n,r;for(FE("/"===(t=bE[wE]),"Regular expression literal must start with a slash"),e=bE[wE++],n=!1,r=!1;wE<AE;)if(e+=t=bE[wE++],"\\"===t)NE((t=bE[wE++]).charCodeAt(0))&&eD({},"Invalid regular expression: missing /"),e+=t;else if(NE(t.charCodeAt(0)))eD({},"Invalid regular expression: missing /");else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||eD({},"Invalid regular expression: missing /"),{value:e.substr(1,e.length-2),literal:e}}(),n=function(){var t,e,n;for(e="",n="";wE<AE&&RE((t=bE[wE]).charCodeAt(0));)++wE,"\\"===t&&wE<AE?eD({},"Unexpected token %0",EE):(n+=t,e+=t);return n.search(/[^gimuy]/g)>=0&&eD({},"Invalid regular expression",n),{value:n,literal:e}}(),r=function(t,e){var n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,e){if(parseInt(e,16)<=1114111)return"x";eD({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){eD({},"Invalid regular expression")}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:wE}}function YE(){var t;return UE(),wE>=AE?{type:2,start:wE,end:wE}:OE(t=bE.charCodeAt(wE))?jE():40===t||41===t||59===t?IE():39===t||34===t?function(){var t,e,n,r,i="",a=!1;for(FE("'"===(t=bE[wE])||'"'===t,"String literal must starts with a quote"),e=wE,++wE;wE<AE;){if((n=bE[wE++])===t){t="";break}if("\\"===n)if((n=bE[wE++])&&NE(n.charCodeAt(0)))"\r"===n&&"\n"===bE[wE]&&++wE;else switch(n){case"u":case"x":"{"===bE[wE]?(++wE,i+=PE()):i+=LE(n);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:zE(n)?(0!==(r="01234567".indexOf(n))&&(a=!0),wE<AE&&zE(bE[wE])&&(a=!0,r=8*r+"01234567".indexOf(bE[wE++]),"0123".indexOf(n)>=0&&wE<AE&&zE(bE[wE])&&(r=8*r+"01234567".indexOf(bE[wE++]))),i+=String.fromCharCode(r)):i+=n}else{if(NE(n.charCodeAt(0)))break;i+=n}}return""!==t&&eD({},"Unexpected token %0",EE),{type:8,value:i,octal:a,start:e,end:wE}}():46===t?SE(bE.charCodeAt(wE+1))?HE():IE():SE(t)?HE():IE()}function VE(){var t;return wE=(t=kE).end,kE=YE(),wE=t.end,t}function GE(){var t;t=wE,kE=YE(),wE=t}function XE(t,e,n){var r=new ME("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=e,r.right=n,r}function JE(t,e){var n=new ME("CallExpression");return n.callee=t,n.arguments=e,n}function ZE(t){var e=new ME("Identifier");return e.name=t,e}function QE(t){var e=new ME("Literal");return e.value=t.value,e.raw=bE.slice(t.start,t.end),t.regex&&("//"===e.raw&&(e.raw="/(?:)/"),e.regex=t.regex),e}function KE(t,e,n){var r=new ME("MemberExpression");return r.computed="["===t,r.object=e,r.property=n,r.computed||(n.member=!0),r}function tD(t,e,n){var r=new ME("Property");return r.key=e,r.value=n,r.kind=t,r}function eD(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\d)/g,(function(t,e){return FE(e<r.length,"Message reference must be in range"),r[e]}));throw(n=new Error(i)).index=wE,n.description=i,n}function nD(t){2===t.type&&eD(t,"Unexpected end of input"),6===t.type&&eD(t,"Unexpected number"),8===t.type&&eD(t,"Unexpected string"),3===t.type&&eD(t,"Unexpected identifier"),4===t.type&&eD(t,"Unexpected reserved word"),eD(t,"Unexpected token %0",t.value)}function rD(t){var e=VE();7===e.type&&e.value===t||nD(e)}function iD(t){return 7===kE.type&&kE.value===t}function aD(t){return 4===kE.type&&kE.value===t}function uD(){var t=[];for(wE=kE.start,rD("[");!iD("]");)iD(",")?(VE(),t.push(null)):(t.push(yD()),iD("]")||rD(","));return VE(),function(t){var e=new ME("ArrayExpression");return e.elements=t,e}(t)}function oD(){var t;return wE=kE.start,8===(t=VE()).type||6===t.type?(t.octal&&eD(t,"Octal literals are not allowed in strict mode."),QE(t)):ZE(t.value)}function sD(){var t,e,n;return wE=kE.start,3===(t=kE).type?(n=oD(),rD(":"),tD("init",n,yD())):2!==t.type&&7!==t.type?(e=oD(),rD(":"),tD("init",e,yD())):void nD(t)}function lD(){var t,e,n=[],r={},i=String;for(wE=kE.start,rD("{");!iD("}");)e="$"+("Identifier"===(t=sD()).key.type?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,e)?eD({},"Duplicate data property in object literal not allowed in strict mode"):r[e]=!0,n.push(t),iD("}")||rD(",");return rD("}"),function(t){var e=new ME("ObjectExpression");return e.properties=t,e}(n)}var cD={if:1,this:1};function fD(){var t,e,n;if(iD("("))return function(){var t;return rD("("),t=_D(),rD(")"),t}();if(iD("["))return uD();if(iD("{"))return lD();if(t=kE.type,wE=kE.start,3===t||cD[kE.value])n=ZE(VE().value);else if(8===t||6===t)kE.octal&&eD(kE,"Octal literals are not allowed in strict mode."),n=QE(VE());else{if(4===t)throw new Error("Disabled.");1===t?((e=VE()).value="true"===e.value,n=QE(e)):5===t?((e=VE()).value=null,n=QE(e)):iD("/")||iD("/=")?(n=QE(WE()),GE()):nD(VE())}return n}function hD(){var t=[];if(rD("("),!iD(")"))for(;wE<AE&&(t.push(yD()),!iD(")"));)rD(",");return rD(")"),t}function dD(){return rD("."),wE=kE.start,function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t=VE())||nD(t),ZE(t.value);var t}function pD(){var t;return rD("["),t=_D(),rD("]"),t}function gD(){var t=function(){var t;for(t=fD();;)if(iD("."))t=KE(".",t,dD());else if(iD("("))t=JE(t,hD());else{if(!iD("["))break;t=KE("[",t,pD())}return t}();if(7===kE.type&&(iD("++")||iD("--")))throw new Error("Disabled.");return t}function mD(){var t,e;if(7!==kE.type&&4!==kE.type)e=gD();else{if(iD("++")||iD("--"))throw new Error("Disabled.");if(iD("+")||iD("-")||iD("~")||iD("!"))t=VE(),e=mD(),e=function(t,e){var n=new ME("UnaryExpression");return n.operator=t,n.argument=e,n.prefix=!0,n}(t.value,e);else{if(aD("delete")||aD("void")||aD("typeof"))throw new Error("Disabled.");e=gD()}}return e}function vD(t){var e=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function yD(){var t,e;return t=function(){var t,e,n,r,i,a,u,o,s,l;if(t=kE,s=mD(),0===(i=vD(r=kE)))return s;for(r.prec=i,VE(),e=[t,kE],a=[s,r,u=mD()];(i=vD(kE))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),e.pop(),n=XE(o,s,u),a.push(n);(r=VE()).prec=i,a.push(r),e.push(kE),n=mD(),a.push(n)}for(n=a[l=a.length-1],e.pop();l>1;)e.pop(),n=XE(a[l-1].value,a[l-2],n),l-=2;return n}(),iD("?")&&(VE(),e=yD(),rD(":"),t=function(t,e,n){var r=new ME("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,yD())),t}function _D(){var t=yD();if(iD(","))throw new Error("Disabled.");return t}var xD={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 bD(t){function e(e,n,r){return function(i){return function(e,n,r,i){var a=t(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}}var n="new Date";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",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(e){e.length<3&&i("Missing arguments to clamp function."),e.length>3&&i("Too many arguments to clamp function.");var n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),join:e("join",null),indexof:e("indexOf",null),lastindexof:e("lastIndexOf",null),slice:e("slice",null),reverse:function(e){return"("+t(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase","String",0),lower:e("toLowerCase","String",0),substring:e("substring","String"),split:e("split","String"),replace:e("replace","String"),trim:e("trim","String",0),regexp:"RegExp",test:e("test","RegExp"),if:function(e){e.length<3&&i("Missing arguments to if function."),e.length>3&&i("Too many arguments to if function.");var n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function wD(t,e){for(var n,r,i=e.fields,a=e.values,o=i.length,s=0;s<o;++s)if((r=i[s]).getter=c.getter||c(r.field),ut(n=r.getter(t))&&(n=M(n)),ut(a[s])&&(a[s]=M(a[s])),ut(a[s][0])&&(a[s]=a[s].map(M)),"E"===r.type){if(u(a[s])?a[s].indexOf(n)<0:n!==a[s])return!1}else if("R"===r.type){if(!it(n,a[s]))return!1}else if("R-RE"===r.type){if(!it(n,a[s],!0,!1))return!1}else if("R-E"===r.type){if(!it(n,a[s],!1,!1))return!1}else if("R-LE"===r.type&&!it(n,a[s],!1,!0))return!1;return!0}var AD={E_union:function(t,e){if(!t.length)return e;for(var n=0,r=e.length;n<r;++n)t.indexOf(e[n])<0&&t.push(e[n]);return t},E_intersect:function(t,e){return t.length?t.filter((function(t){return e.indexOf(t)>=0})):e},R_union:function(t,e){var n=M(e[0]),r=M(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]<r&&(t[1]=r),t):[n,r]},R_intersect:function(t,e){var n=M(e[0]),r=M(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?r<t[0]||t[1]<n?[]:(t[0]<n&&(t[0]=n),t[1]>r&&(t[1]=r),t):[n,r]}};function kD(t,e,n,r){"Literal"!==e[0].type&&i("First argument to selection functions must be a string literal.");const a=e[0].value,u=":"+a;"intersect"!==(e.length>=2&&k(e).value)||K(r,"@unit")||(r["@unit"]=n.getData(a).indataRef(n,"unit")),K(r,u)||(r[u]=n.getData(a).tuplesRef())}function MD(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ED(t){const e=up(t);return.2126*MD(e.r)+.7152*MD(e.g)+.0722*MD(e.b)}function DD(t){const e=this.context.data[t];return e?e.values.value:[]}const CD={};function FD(t,e,n){let r=t+":"+n,i=CD[r];return i&&i[0]===e||(CD[r]=i=[e,e(n)]),i[1]}function SD(t,e){return FD("timeFormat",ao,e)(t)}var BD=new Date(2e3,0,1);function zD(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(BD.setYear(2e3),BD.setMonth(t),BD.setDate(e),SD(BD,n)):""}function TD(t,e){let n;return W(t)?t:s(t)?(n=e.scales[t])&&n.value:void 0}function ND(t,e){return function(n,r,i){if(n){const e=TD(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const OD=ND("area",(function(t){return Wy.reset(),Uy(t,Yy),2*Wy})),RD=ND("bounds",(function(t){var e,n,r,i,a,u,o;if(o_=u_=-(i_=a_=1/0),h_=[],Uy(t,B_),n=h_.length){for(h_.sort(P_),e=1,a=[r=h_[0]];e<n;++e)$_(r,(i=h_[e])[0])||$_(r,i[1])?(L_(r[0],i[1])>L_(r[0],r[1])&&(r[1]=i[1]),L_(i[0],r[1])>L_(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(u=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(o=L_(r[1],i[0]))>u&&(u=o,i_=i[0],u_=r[1])}return h_=d_=null,i_===1/0||a_===1/0?[[NaN,NaN],[NaN,NaN]]:[[i_,a_],[u_,o_]]})),qD=ND("centroid",(function(t){p_=g_=m_=v_=y_=__=x_=b_=w_=A_=k_=0,Uy(t,j_);var e=w_,n=A_,r=k_,i=e*e+n*n+r*r;return i<1e-12&&(e=__,n=x_,r=b_,g_<1e-6&&(e=m_,n=v_,r=y_),(i=e*e+n*n+r*r)<1e-12)?[NaN,NaN]:[xy(n,e)*my,By(r/Cy(i))*my]}));function UD(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function LD(t,e){return t===e||t!=t&&e!=e||(u(t)?!(!u(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;n<r;++n)if(!LD(t[n],e[n]))return!1;return!0}(t,e):!(!o(t)||!o(e))&&PD(t,e))}function PD(t,e){for(let n in t)if(!LD(t[n],e[n]))return!1;return!0}function $D(t){return e=>PD(t,e)}const jD={};function ID(t){return t.data}function HD(t,e){const n=DD.call(e,t);return n.root&&n.root.lookup||jD}const WD="undefined"!=typeof window&&window||null;function YD(t,e,n,r){"Literal"!==e[0].type&&i("First argument to data functions must be a string literal.");const a=e[0].value,u=":"+a;if(!K(u,r))try{r[u]=n.getData(a).tuplesRef()}catch(t){}}function VD(t,e,n,r){if("Literal"===e[0].type)GD(n,r,e[0].value);else if("Identifier"===e[0].type)for(t in n.scales)GD(n,r,t)}function GD(t,e,n){const r="%"+n;if(!K(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}const XD={random:function(){return t.random()},cumulativeNormal:Ni,cumulativeLogNormal:Pi,cumulativeUniform:Yi,densityNormal:Ti,densityLogNormal:Li,densityUniform:Wi,quantileNormal:Oi,quantileLogNormal:$i,quantileUniform:Vi,sampleNormal:zi,sampleLogNormal:Ui,sampleUniform:Hi,isArray:u,isBoolean:at,isDate:ut,isDefined:function(t){return void 0!==t},isNumber:ot,isObject:o,isRegExp:st,isString:s,isTuple:Dt,isValid:function(t){return null!=t&&t==t},toBoolean:mt,toDate:yt,toNumber:M,toString:_t,flush:nt,lerp:ct,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),X.apply(null,t)},pad:pt,peek:k,span:gt,inrange:it,truncate:bt,rgb:up,lab:xp,hcl:Dp,hsl:dp,luminance:ED,contrast:function(t,e){const n=ED(t),r=ED(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:li,format:function(t,e){return FD("format",Qg,e)(t)},utcFormat:function(t,e){return FD("utcFormat",uo,e)(t)},utcParse:function(t,e){return FD("utcParse",cn,e)(t)},utcOffset:Ku,utcSequence:no,timeFormat:SD,timeParse:function(t,e){return FD("timeParse",sn,e)(t)},timeOffset:Qu,timeSequence:eo,timeUnitSpecifier:io,monthFormat:function(t){return zD(t,1,"%B")},monthAbbrevFormat:function(t){return zD(t,1,"%b")},dayFormat:function(t){return zD(0,2+t,"%A")},dayAbbrevFormat:function(t){return zD(0,2+t,"%a")},quarter:$,utcquarter:j,warn:function(){return UD(this.context.dataflow,"warn",arguments)},info:function(){return UD(this.context.dataflow,"info",arguments)},debug:function(){return UD(this.context.dataflow,"debug",arguments)},extent:J,inScope:function(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,a=(new Uo).set(r[0],r[1],i[0],i[1]);return Ih(n||this.context.dataflow.scenegraph().root,a,function(t){let e=null;if(t){const n=I(t.marktype),r=I(t.markname);e=t=>(!n.length||n.some(e=>t.marktype===e))&&(!r.length||r.some(e=>t.name===e))}return e}(e))},clampRange:H,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){return WD?WD.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){return WD?[WD.innerWidth,WD.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return zd(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(m).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?kl(n,e=e||dl(t)):t}},panLinear:z,panLog:T,panPow:N,panSymlog:O,zoomLinear:q,zoomLog:U,zoomPow:L,zoomSymlog:P,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,a){let o,s,l=this.context.dataflow,c=this.context.data[t],f=c.input,h=c.changes,d=l.stamp();if(!1===l._trigger||!(f.value.length||e||r))return 0;if((!h||h.stamp<d)&&(c.changes=h=l.changeset(),h.stamp=d,l.runAfter((function(){c.modified=!0,l.pulse(f,h).run()}),!0,1)),n&&(o=!0===n?m:u(n)||Dt(n)?n:$D(n),h.remove(o)),e&&h.insert(e),r&&(o=$D(r),f.value.some(o)?h.remove(o):h.insert(r)),i)for(s in a)h.modify(i,s,a[s]);return 1}},JD=["view","item","group","xy","x","y"],ZD={};function QD(t,e,n){return 1===arguments.length?XD[t]:(XD[t]=e,n&&(ZD[t]=n),tC&&(tC.functions[t]="this."+t),this)}QD("bandwidth",(function(t,e){const n=TD(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),VD),QD("copy",(function(t,e){const n=TD(t,(e||this).context);return n?n.copy():void 0}),VD),QD("domain",(function(t,e){const n=TD(t,(e||this).context);return n?n.domain():[]}),VD),QD("range",(function(t,e){const n=TD(t,(e||this).context);return n&&n.range?n.range():[]}),VD),QD("invert",(function(t,e,n){const r=TD(t,(n||this).context);return r?u(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),VD),QD("scale",(function(t,e,n){const r=TD(t,(n||this).context);return r&&void 0!==e?r(e):void 0}),VD),QD("gradient",(function(t,e,n,r,i){t=TD(t,(i||this).context);const a=Ho(e,n);let u=t.domain(),o=u[0],s=k(u),l=d;return s-o?l=Jm(t,o,s):t=(t.interpolator?qm("sequential")().interpolator(t.interpolator()):qm("linear")().interpolate(t.interpolate()).range(t.range())).domain([o=0,s=1]),t.ticks&&(u=t.ticks(+r||15),o!==u[0]&&u.unshift(o),s!==k(u)&&u.push(s)),u.forEach(e=>a.stop(l(e),t(e))),a}),VD),QD("geoArea",OD,VD),QD("geoBounds",RD,VD),QD("geoCentroid",qD,VD),QD("geoShape",(function(t,e,n){const r=TD(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),VD),QD("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){"Literal"!==e[0].type&&i("First argument to indata must be a string literal."),"Literal"!==e[1].type&&i("Second argument to indata must be a string literal.");const a=e[0].value,u=e[1].value,o="@"+u;K(o,r)||(r[o]=n.getData(a).indataRef(n,u))})),QD("data",DD,YD),QD("treePath",(function(t,e,n){const r=HD(t,this),i=r[e],a=r[n];return i&&a?i.path(a).map(ID):void 0}),YD),QD("treeAncestors",(function(t,e){const n=HD(t,this)[e];return n?n.ancestors().map(ID):void 0}),YD),QD("vlSelectionTest",(function(t,e,n){for(var r,i,a,u,o,s=this.context.data[t],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,h=l.length,d=0;d<h;++d)if(r=l[d],c&&f){if(-1===(a=(i=i||{})[u=r.unit]||0))continue;if(o=wD(e,r),i[u]=o?-1:++a,o&&1===c.size)return!0;if(!o&&a===c.get(u).count)return!1}else if(f^(o=wD(e,r)))return o;return h&&f}),kD),QD("vlSelectionResolve",(function(t,e,n){for(var r,i,a,u,o,s,l,c,f,h,d,p=this.context.data[t],g=p?p.values.value:[],m={},v={},y={},_=g.length,x=0;x<_;++x){for(u=(r=g[x]).unit,i=r.fields,a=r.values,h=0,d=i.length;h<d;++h)o=i[h],l=(s=m[o.field]||(m[o.field]={}))[u]||(s[u]=[]),y[o.field]=c=o.type.charAt(0),f=AD[c+"_union"],s[u]=f(l,I(a[h]));n&&(l=v[u]||(v[u]=[])).push(I(a).reduce((t,e,n)=>(t[i[n].field]=e,t),{}))}return e=e||"union",Object.keys(m).forEach((function(t){m[t]=Object.keys(m[t]).map(e=>m[t][e]).reduce((n,r)=>void 0===n?r:AD[y[t]+"_"+e](n,r))})),g=Object.keys(v),n&&g.length&&(m.vlMulti="union"===e?{or:g.reduce((t,e)=>(t.push.apply(t,v[e]),t),[])}:{and:g.map(t=>({or:v[t]}))}),m}),kD);const KD={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+l("$"+t)+"]"},functions:function(t){const e=bD(t);JD.forEach(t=>e[t]="event.vega."+t);for(let t in XD)e[t]="this."+t;return e},constants:xD,visitors:ZD};var tC=function(t){var e=(t=t||{}).whitelist?xt(t.whitelist):{},n=t.blacklist?xt(t.blacklist):{},r=t.constants||xD,a=(t.functions||bD)(d),u=t.globalvar,o=t.fieldvar,l={},c={},f=0,h=W(u)?u:function(t){return u+'["'+t+'"]'};function d(t){if(s(t))return t;var e=p[t.type];return null==e&&i("Unsupported type: "+t.type),e(t)}var p={Literal:function(t){return t.raw},Identifier:function(t){var a=t.name;return f>0?a:K(n,a)?i("Illegal identifier: "+a):K(r,a)?r[a]:K(e,a)?a:(l[a]=1,h(a))},MemberExpression:function(t){var e=!t.computed,n=d(t.object);e&&(f+=1);var r=d(t.property);return n===o&&(c[function(t){var e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&i("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=K(a,e)&&a[e];return r||i("Unrecognized function: "+e),W(r)?r(n):r+"("+n.map(d).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(d).join(",")+"]"},BinaryExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+d(t.argument)+")"},ConditionalExpression:function(t){return"("+d(t.test)+"?"+d(t.consequent)+":"+d(t.alternate)+")"},LogicalExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(d).join(",")+"}"},Property:function(t){f+=1;var e=d(t.key);return f-=1,e+":"+d(t.value)}};function g(t){var e={code:d(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return g.functions=a,g.constants=r,g}(KD);function eC(t,e,n){";"!==e[e.length-1]&&(e="return("+e+");");var r=Function.apply(null,t.concat(e));return n&&n.functions?r.bind(n.functions):r}function nC(t,e){return eC(["event"],t,e)}function rC(t,e){return eC(["item","_"],t,e)}function iC(t,e,n){var r,i;for(r in n=n||{},t)i=t[r],n[r]=u(i)?i.map((function(t){return aC(t,e,n)})):aC(i,e,n);return n}function aC(t,e,n){if(!t||!o(t))return t;for(var r,i=0,a=uC.length;i<a;++i)if(K(t,(r=uC[i]).key))return r.parse(t,e,n);return t}var uC=[{key:"$ref",parse:function(t,e){return e.get(t.$ref)||i("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,e){var n="k:"+t.$key+"_"+!!t.$flat;return e.fn[n]||(e.fn[n]=lt(t.$key,t.$flat))}},{key:"$expr",parse:function(t,n,r){t.$params&&iC(t.$params,n,r);var i="e:"+t.$expr+"_"+t.$name;return n.fn[i]||(n.fn[i]=e(function(t,e){return eC(["datum","_"],t,e)}(t.$expr,n),t.$fields,t.$name))}},{key:"$field",parse:function(t,e){if(!t.$field)return null;var n="f:"+t.$field+"_"+t.$name;return e.fn[n]||(e.fn[n]=c(t.$field,t.$name))}},{key:"$encode",parse:function(t,n){var r,i,a=t.$encode,u={};for(r in a)i=a[r],u[r]=e(rC(i.$expr,n),i.$fields),u[r].output=i.$output;return u}},{key:"$compare",parse:function(t,e){var n="c:"+t.$compare+"_"+t.$order,r=I(t.$compare).map((function(t){return t&&t.$tupleid?Ct:t}));return e.fn[n]||(e.fn[n]=Y(r,t.$order))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){var n=t.$subflow;return function(t,r,i){var a=cC(n,e.fork()),u=a.get(n.operators[0].id),o=a.signals.parent;return o&&o.set(i),u}}},{key:"$tupleid",parse:function(){return Ct}}];function oC(t){return(t+"").toLowerCase()}function sC(t,e){!function(t){return"operator"===oC(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?function(t,e){return eC(["_"],t,e)}(t.update,e):null)}function lC(t,e){var n=o(n=t.source)?n.$ref:n,r=e.get(n),a=null,u=t.update,s=void 0;r||i("Source not defined: "+t.source),a=t.target&&t.target.$expr?nC(t.target.$expr,e):e.get(t.target),u&&u.$expr&&(u.$params&&(s=iC(u.$params,e)),u=function(t,e){return eC(["_","event"],t,e)}(u.$expr,e)),e.update(t,r,a,u,s)}function cC(t,e){var n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),n.forEach((function(t){sC(t,e)})),n.forEach((function(t){!function(t,e){if(t.params){var n=e.get(t.id);n||i("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(iC(t.params,e),t.react,t.initonly))}}(t,e)})),(t.streams||[]).forEach((function(t){!function(t,e){var n,r=null!=t.filter?nC(t.filter,e):void 0,a=null!=t.stream?e.get(t.stream):void 0;t.source?a=e.events(t.source,t.type,r):t.merge&&(a=(n=t.merge.map(e.get.bind(e)))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map(e.get.bind(e)),a=a.between(n[0],n[1])),t.filter&&(a=a.filter(r)),null!=t.throttle&&(a=a.throttle(+t.throttle)),null!=t.debounce&&(a=a.debounce(+t.debounce)),null==a&&i("Invalid stream definition: "+JSON.stringify(t)),t.consume&&a.consume(!0),e.stream(t,a)}(t,e)})),(t.updates||[]).forEach((function(t){lC(t,e)})),e.resolve()}var fC={skip:!0};function hC(t,e,n){return new dC(t,e,n)}function dC(t,e,n){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function pC(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.functions=t.functions,this.events=t.events,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)}dC.prototype=pC.prototype={fork:function(){var t=new pC(this);return(this.subcontext||(this.subcontext=[])).push(t),t},get:function(t){return this.nodes[t]},set:function(t,e){return this.nodes[t]=e},add:function(t,e){var n,r=this,i=r.dataflow;if(r.set(t.id,e),function(t){return"collect"===oC(t)}(t.type)&&(n=t.value)&&(n.$ingest?i.ingest(e,n.$ingest,n.$format):n.$request?i.preload(e,n.$request,n.$format):i.pulse(e,i.changeset().insert(n))),t.root&&(r.root=e),t.parent){var a=r.get(t.parent.$ref);a?(i.connect(a,[e]),e.targets().add(a)):(r.unresolved=r.unresolved||[]).push((function(){a=r.get(t.parent.$ref),i.connect(a,[e]),e.targets().add(a)}))}if(t.signal&&(r.signals[t.signal]=e),t.scale&&(r.scales[t.scale]=e),t.data)for(var u in t.data)n=r.data[u]||(r.data[u]={}),t.data[u].forEach((function(t){n[t]=e}))},resolve:function(){return(this.unresolved||[]).forEach((function(t){t()})),delete this.unresolved,this},operator:function(t,e){this.add(t,this.dataflow.add(t.value,e))},transform:function(t,e){this.add(t,this.dataflow.add(this.transforms[oC(e)]))},stream:function(t,e){this.set(t.id,e)},update:function(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((function(n){var i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((function(n){var r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((function(e){return e.getState(t)}))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((function(t){n.update(e.signals[t],i[t],fC)})),Object.keys(r||{}).forEach((function(t){n.pulse(e.data[t].input,n.changeset().remove(m).insert(r[t]))})),(t.subcontext||[]).forEach((function(t,n){var r=e.subcontext[n];r&&r.setState(t)}))}};var gC={skip:!0};function mC(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.left+r.right:0)}function vC(t,e){var n=t.autosize(),r=t.padding();return e-(n&&"padding"===n.contains?r.top+r.bottom:0)}function yC(t,e){return e.modified&&u(e.input.value)&&t.indexOf("_:vega:_")}function _C(t,e){return!("parent"===t||e instanceof Yr.proxy)}function xC(t,e,n,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":u(t)?bC(t):o(t)&&!ut(t)?(e=t,Object.keys(e).map((function(t){var n=e[t];return t+": "+(u(n)?bC(n):wC(n))})).join("\n")):t+"";var e}(r))}function bC(t){return"["+t.map(wC).join(", ")+"]"}function wC(t){return u(t)?"[…]":o(t)&&!ut(t)?"{…}":t}function AC(t,e){e=e||{},$r.call(this),e.loader&&this.loader(e.loader),e.logger&&this.logger(e.logger),null!=e.logLevel&&this.logLevel(e.logLevel),this._el=null,this._elBind=null,this._renderType=e.renderer||Ph.Canvas,this._scenegraph=new $f;var n=this._scenegraph.root;this._renderer=null,this._tooltip=e.tooltip||xC,this._redraw=!0,this._handler=(new eh).scene(n),this._preventDefault=!1,this._timers=[],this._eventListeners=[],this._resizeListeners=[],this._eventConfig=function(t){const e=X({defaults:{}},t),n=(t,e)=>{e.forEach(e=>{u(t[e])&&(t[e]=xt(t[e]))})};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig);var r=function(t,e,n){return cC(e,hC(t,Yr,n||XD))}(this,t,e.functions);this._runtime=r,this._signals=r.signals,this._bind=(t.bindings||[]).map((function(t){return{state:null,param:X({},t)}})),r.root&&r.root.set(n),n.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(n.items)),this._width=this.width(),this._height=this.height(),this._viewWidth=mC(this,this._width),this._viewHeight=vC(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(function(e){t._width=e.size,t._viewWidth=mC(t,e.size),a()}),{size:n}),t._resizeHeight=t.add(null,(function(e){t._height=e.size,t._viewHeight=vC(t,e.size),a()}),{size:r});var u=t.add(null,a,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,u.rank=i.rank+1}(this),function(t){t.add(null,e=>(t._background=e.bg,t._resize=1,e.bg),{bg:t._signals.background})}(this),GM(this),this.description(t.description),e.hover&&this.hover(),e.container&&this.initialize(e.container,e.bind)}var kC=rt(AC,$r);function MC(t,e){return K(t._signals,e)?t._signals[e]:i("Unrecognized signal name: "+l(e))}function EC(t,e){var n=(t._targets||[]).filter((function(t){var n=t._update;return n&&n.handler===e}));return n.length?n[0]:null}function DC(t,e,n,r){var i=EC(n,r);return i||((i=gE(this,(function(){r(e,n.value)}))).handler=r,t.on(n,null,i)),t}function CC(t,e,n){var r=EC(e,n);return r&&e._targets.remove(r),t}function FC(t){return o(t)?t:{type:t||"pad"}}kC.evaluate=async function(t,e,n){if(await $r.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=KM(t),n=ZM(t),r=QM(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((function(e){try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&kt(this,n),this},kC.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},kC.description=function(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&VM(this._el,this._desc=e),this}return this._desc},kC.container=function(){return this._el},kC.scenegraph=function(){return this._scenegraph},kC.origin=function(){return this._origin.slice()},kC.signal=function(t,e,n){var r=MC(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},kC.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},kC.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},kC.padding=function(t){return arguments.length?this.signal("padding",yE(t)):yE(this.signal("padding"))},kC.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},kC.background=function(t){return arguments.length?this.signal("background",t):this.signal("background")},kC.renderer=function(t){return arguments.length?(jh(t)||i("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},kC.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},kC.loader=function(t){return arguments.length?(t!==this._loader&&($r.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},kC.resize=function(){return this._autosize=1,this.touch(MC(this,"autosize"))},kC._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},kC._resizeView=function(t,e,n,r,i,a){this.runAfter((function(u){var o=0;u._autosize=0,u.width()!==n&&(o=1,u.signal("width",n,gC),u._resizeWidth.skip(!0)),u.height()!==r&&(o=1,u.signal("height",r,gC),u._resizeHeight.skip(!0)),u._viewWidth!==t&&(u._resize=1,u._viewWidth=t),u._viewHeight!==e&&(u._resize=1,u._viewHeight=e),u._origin[0]===i[0]&&u._origin[1]===i[1]||(u._resize=1,u._origin=i),o&&u.run("enter"),a&&u.runAfter(t=>t.resize())}),!1,1)},kC.addEventListener=function(t,e,n){var r=e;return n&&!1===n.trap||((r=gE(this,e)).raw=e),this._handler.on(t,r),this},kC.removeEventListener=function(t,e){for(var n,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,n=i[a].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},kC.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},kC.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},kC.addSignalListener=function(t,e){return DC(this,t,MC(this,t),e)},kC.removeSignalListener=function(t,e){return CC(this,MC(this,t),e)},kC.addDataListener=function(t,e){return DC(this,t,XM(this,t).values,e)},kC.removeDataListener=function(t,e){return CC(this,XM(this,t).values,e)},kC.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},kC.timer=function(t,e){this._timers.push(function(t,e,n){var r=new hA,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?cA():+n,r.restart((function a(u){u+=i,r.restart(a,i+=e,n),t(u)}),e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},kC.events=function(t,e,n){var r,i=this,a=new Yt(n),u=function(n,r){i.runAsync(null,()=>{"view"===t&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),a.receive(tE(i,n,r))})};if("timer"===t)nE(i,"timer",e)&&i.timer(u,e);else if("view"===t)nE(i,"view",e)&&i.addEventListener(e,u,eE);else if("window"===t?nE(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&nE(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var o=0,s=r.length;o<s;++o)r[o].addEventListener(e,u);i._eventListeners.push({type:e,sources:r,handler:u})}else i.warn("Can not resolve event source: "+t);return a},kC.finalize=function(){var t,e,n,r=this._tooltip,i=this._timers,a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(e=(n=a[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},kC.hover=function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",rE),iE,aE(t)),this.on(this.events("view","mouseout",rE),iE,aE(e)),this},kC.data=function(t,e){return arguments.length<2?XM(this,t).values.value:JM.call(this,t,Rt().remove(m).insert(e))},kC.change=JM,kC.insert=function(t,e){return JM.call(this,t,Rt().insert(e))},kC.remove=function(t,e){return JM.call(this,t,Rt().remove(e))},kC.scale=function(t){var e=this._runtime.scales;return K(e,t)||i("Unrecognized scale or projection: "+t),e[t].value},kC.initialize=function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,a=jh(r);t=n._el=t?mE(n,t):null,function(t){const e=t.container();e&&(e.setAttribute("role","figure"),VM(e,t.description()))}(n),a||n.error("Unrecognized renderer type: "+r);const u=a.handler||eh,o=t?a.renderer:a.headless;return n._renderer=o?pE(n,n._renderer,t,o):null,n._handler=function(t,e,n,r){var i=new r(t.loader(),gE(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,KM(t),t);return e&&e.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(n,n._handler,t,u),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=mE(n,e):t.appendChild(uE("div",{class:"vega-bindings"})),n._bind.forEach((function(t){t.param.element&&"container"!==i&&(t.element=mE(n,t.param.element))})),n._bind.forEach((function(t){oE(n,t.element||e,t)}))),n},kC.toImageURL=async function(t,e){t!==Ph.Canvas&&t!==Ph.SVG&&t!==Ph.PNG&&i("Unrecognized image type: "+t);const n=await _E(this,t,e);return t===Ph.SVG?function(t,e){var n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},kC.toCanvas=async function(t,e){return(await _E(this,Ph.Canvas,t,e)).canvas()},kC.toSVG=async function(t){return(await _E(this,Ph.SVG,t)).svg()},kC.getState=function(t){return this._runtime.getState(t||{data:yC,signals:_C,recurse:!0})},kC.setState=function(t){return this.runAsync(null,e=>{e._trigger=!1,e._runtime.setState(t)},t=>{t._trigger=!0}),this};const SC=t=>+t||0;function BC(t){return o(t)?t.signal?t:{top:SC(t.top),bottom:SC(t.bottom),left:SC(t.left),right:SC(t.right)}:{top:e=SC(t),bottom:e,left:e,right:e};var e}var zC=["value","update","init","react","bind"];function TC(t,e){i(t+' for "outer" push: '+l(e))}function NC(t,e){var n=t.name;if("outer"===t.push)e.signals[n]||TC("No prior signal definition",n),zC.forEach((function(e){void 0!==t[e]&&TC("Invalid property ",e)}));else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function OC(t,e,n){var r,a,u={};try{r=function(t){wE=0,AE=(bE=t).length,kE=null,GE();var e=_D();if(2!==kE.type)throw new Error("Unexpect token after expression.");return e}(t=s(t)?t:l(t)+"")}catch(e){i("Expression parse error: "+t)}return r.visit((function(t){if("CallExpression"===t.type){var n=t.callee.name,r=KD.visitors[n];r&&r(n,t.arguments,e,u)}})),(a=tC(r)).globals.forEach((function(t){var n="$"+t;!K(u,n)&&e.getSignal(t)&&(u[n]=e.signalRef(t))})),{$expr:n?n+"return("+a.code+");":a.code,$fields:a.fields,$params:u}}function RC(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function qC(t,e,n,r){return new RC(t,e,n,r)}function UC(t,e){return qC("operator",t,e)}function LC(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function PC(t,e){return e?{$field:t,$name:e}:{$field:t}}var $C=PC("key");function jC(t,e){return{$compare:t,$order:e}}function IC(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}function HC(t){return t&&t.signal}function WC(t){if(HC(t))return!0;if(o(t))for(var e in t)if(WC(t[e]))return!0;return!1}function YC(t,e){return null!=t?t:e}function VC(t){return t&&t.signal||t}function GC(t,e){return(t.merge?XC:t.stream?JC:t.type?ZC:i("Invalid stream specification: "+l(t)))(t,e)}function XC(t,e){var n=QC({merge:t.merge.map(t=>GC(t,e))},t,e);return e.addStream(n).id}function JC(t,e){var n=QC({stream:GC(t.stream,e)},t,e);return e.addStream(n).id}function ZC(t,e){var n,r;return"timer"===t.type?(n=e.event("timer",t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return"scope"===t?"view":t||"view"}(t.source),t.type),r=QC({stream:n},t,e),1===Object.keys(r).length?n:e.addStream(r).id}function QC(t,e,n){var r=e.between;return r&&(2!==r.length&&i('Stream "between" parameter must have 2 entries: '+l(e)),t.between=[GC(r[0],n),GC(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),"scope"===e.source&&r.push("inScope(event.item)"),r.length&&(t.filter=OC("("+r.join(")&&(")+")").$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}var KC,tF,eF="view",nF=/[[\]{}]/,rF={"*":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};function iF(t,e,n,r,i){for(var a,u=0,o=t.length;e<o;++e){if(a=t[e],!u&&a===n)return e;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return e}function aF(t){for(var e=[],n=0,r=t.length,i=0;i<r;)i=iF(t,i,",","[{","]}"),e.push(t.substring(n,i).trim()),n=++i;if(0===e.length)throw"Empty event selector: "+t;return e}function uF(t){return"["===t[0]?function(t){var e,n,r=t.length,i=1;if((i=iF(t,i,"]","[","]"))===r)throw"Empty between selector: "+t;if(2!==(e=aF(t.substring(1,i))).length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+t;if(e=e.map(uF),(n=uF(t.slice(1).trim())).between)return{between:e,stream:n};n.between=e;return n}(t):function(t){var e,n,r={source:KC},i=[],a=[0,0],u=0,o=0,s=t.length,l=0;if("}"===t[s-1]){if(!((l=t.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((function(e){var n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;"@"===t[0]&&(u=++l);(e=iF(t,l,":"))<s&&(i.push(t.substring(o,e).trim()),o=l=++e);if((l=iF(t,l,"["))===s)i.push(t.substring(o,s).trim());else if(i.push(t.substring(o,l).trim()),n=[],(o=++l)===s)throw"Unmatched left bracket: "+t;for(;l<s;){if((l=iF(t,l,"]"))===s)throw"Unmatched left bracket: "+t;if(n.push(t.substring(o,l).trim()),l<s-1&&"["!==t[++l])throw"Expected left bracket: "+t;o=++l}if(!(s=i.length)||nF.test(i[s-1]))throw"Invalid event selector: "+t;s>1?(r.type=i[1],u?r.markname=i[0].slice(1):!function(t){return tF[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var oF="var datum=event.item&&event.item.datum;";function sF(t,e,n){var r=t.events,a=t.update,u=t.encode,o=[],c={target:n};r||i("Signal update missing events specification."),s(r)&&(r=function(t,e,n){return KC=e||eF,tF=n||rF,aF(t.trim()).map(uF)}(r,e.isSubscope()?"scope":"view")),r=I(r).filter(t=>t.signal||t.scale?(o.push(t),0):1),o.length>1&&(o=[lF(o)]),r.length&&o.push(r.length>1?{merge:r}:r[0]),null!=u&&(a&&i("Signal encode and update are mutually exclusive."),a="encode(item(),"+l(u)+")"),c.update=s(a)?OC(a,e,oF):null!=a.expr?OC(a.expr,e,oF):null!=a.value?a.value:null!=a.signal?{$expr:"_.value",$params:{value:e.signalRef(a.signal)}}:i("Invalid signal update specification."),t.force&&(c.options={force:!0}),o.forEach((function(t){e.addUpdate(X(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):GC(t,e)}}(t,e),c))}))}function lF(t){return{signal:"["+t.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function cF(t){return function(e,n,r){return qC(t,n,e||void 0,r)}}var fF=cF("aggregate"),hF=cF("axisticks"),dF=cF("bound"),pF=cF("collect"),gF=cF("compare"),mF=cF("datajoin"),vF=cF("encode"),yF=cF("expression"),_F=cF("facet"),xF=cF("field"),bF=cF("key"),wF=cF("legendentries"),AF=cF("load"),kF=cF("mark"),MF=cF("multiextent"),EF=cF("multivalues"),DF=cF("overlap"),CF=cF("params"),FF=cF("prefacet"),SF=cF("projection"),BF=cF("proxy"),zF=cF("relay"),TF=cF("render"),NF=cF("scale"),OF=cF("sieve"),RF=cF("sortitems"),qF=cF("viewlayout"),UF=cF("values"),LF=0,PF={min:"min",max:"max",count:"sum"};function $F(t,e){var n,r=e.getScale(t.name).params;for(n in r.domain=WF(t.domain,t,e),null!=t.range&&(r.range=function t(e,n,r){var a=e.range,o=n.config.range;if(a.signal)return n.signalRef(a.signal);if(s(a)){if(o&&K(o,a))return e=X({},e,{range:o[a]}),t(e,n,r);"width"===a?a=[0,{signal:"width"}]:"height"===a?a=$m(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:i("Unrecognized scale range value: "+l(a))}else{if(a.scheme)return r.scheme=u(a.scheme)?IF(a.scheme,n):jF(a.scheme,n),a.extent&&(r.schemeExtent=IF(a.extent,n)),void(a.count&&(r.schemeCount=jF(a.count,n)));if(a.step)return void(r.rangeStep=jF(a.step,n));if($m(e.type)&&!u(a))return WF(a,e,n);u(a)||i("Unsupported range type: "+l(a))}return a.map(t=>(u(t)?IF:jF)(t,n))}(t,e,r)),null!=t.interpolate&&function(t,e){e.interpolate=jF(t.type||t),null!=t.gamma&&(e.interpolateGamma=jF(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return o(t)?{interval:jF(t.interval),step:jF(t.step)}:jF(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,e){return t.signal||u(t)?IF(t,e):e.objectProperty(t)}(t.bins,e)),t)K(r,n)||"name"===n||(r[n]=jF(t[n],e))}function jF(t,e){return o(t)?t.signal?e.signalRef(t.signal):i("Unsupported object: "+l(t)):t}function IF(t,e){return t.signal?e.signalRef(t.signal):t.map(t=>jF(t,e))}function HF(t){i("Can not find data set: "+l(t))}function WF(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(u(t)?YF:t.fields?GF:VF)(t,e,n);null==e.domainMin&&null==e.domainMax||i("No scale domain defined for domainMin/domainMax to override.")}function YF(t,e,n){return t.map((function(t){return jF(t,n)}))}function VF(t,e,n){var r=n.getData(t.data);return r||HF(t.data),$m(e.type)?r.valuesRef(n,t.field,JF(t.sort,!1)):Wm(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function GF(t,e,n){var r=t.data,i=t.fields.reduce((function(t,e){return e=s(e)?{data:r,field:e}:u(e)||e.signal?function(t,e){var n="_:vega:_"+LF++,r=pF({});if(u(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+l(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,OF({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t}),[]);return($m(e.type)?XF:Wm(e.type)?ZF:QF)(t,n,i)}function XF(t,e,n){var r,i,a,u,o,s=JF(t.sort,!0);return r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.countsRef(e,t.field,s)})),i={groupby:$C,pulse:r},s&&(a=s.op||"count",o=s.field?IC(a,s.field):"count",i.ops=[PF[a]],i.fields=[e.fieldRef(o)],i.as=[o]),a=e.add(fF(i)),u=e.add(pF({pulse:LC(a)})),o=e.add(UF({field:$C,sort:e.sortRef(s),pulse:LC(u)})),LC(o)}function JF(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!PF[t.op]&&i("Multiple domain scales can not be sorted using "+t.op):i("No field provided for sort aggregate op: "+t.op):o(t)?t.field="key":t={field:"key"}),t}function ZF(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.domainRef(e,t.field)}));return LC(e.add(EF({values:r})))}function QF(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.extentRef(e,t.field)}));return LC(e.add(MF({extents:r})))}function KF(t,e,n){return u(t)?t.map((function(t){return KF(t,e,n)})):o(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:i("Unsupported parameter object: "+l(t)):t}const tS="value",eS=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],nS={name:1,style:1,interactive:1},rS={value:0},iS={value:1};var aS=xt(["rule"]),uS=xt(["group","image","rect"]);function oS(t,e,n,r){var i=OC(t,e);return i.$fields.forEach((function(t){r[t]=1})),X(n,i.$params),i.$expr}function sS(t,e,n,r){return function t(e,n,r,u){var o,c,f;if(e.signal)o="datum",f=oS(e.signal,n,r,u);else if(e.group||e.parent){for(c=Math.max(1,e.level||1),o="item";c-- >0;)o+=".mark.group";e.parent?(f=e.parent,o+=".datum"):f=e.group}else e.datum?(o="datum",f=e.datum):i("Invalid field reference: "+l(e));e.signal||(s(f)?(u[f]=1,f=a(f).map(l).join("][")):f=t(f,n,r,u));return o+"["+f+"]"}(o(t)?t:{datum:t},e,n,r)}function lS(t,e,n,r){return o(t)?"("+hS(null,t,e,n,r)+")":t}function cS(t,e,n,r,i){var a,u,o,l=fS(t.scale,n,r,i);return null!=t.range?(u=l+".range()",e=0===(a=+t.range)?u+"[0]":"($="+u+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==e&&(e=l+"("+e+")"),t.band&&(o=function(t,e){if(!s(t))return-1;var n=e.scaleType(t);return"band"===n||"point"===n?1:0}(t.scale,n))&&(u=l+".bandwidth",a=t.band.signal?u+"()*"+lS(t.band,n,r,i):u+"()"+(1===(a=+t.band)?"":"*"+a),o<0&&(a="("+u+"?"+a+":0)"),e=(e?e+"+":"")+a,t.extra&&(e="(datum.extra?"+l+"(datum.extra.value):"+e+")")),null==e&&(e="0")),e}function fS(t,e,n,r){var i;if(s(t))K(n,i="%"+t)||(n[i]=e.scaleRef(t)),i=l(i);else{for(i in e.scales)n["%"+i]=e.scaleRef(i);i=l("%")+"+"+(t.signal?"("+oS(t.signal,e,n,r)+")":sS(t,e,n,r))}return"_["+i+"]"}function hS(t,e,n,r,i){if(null!=e.gradient)return function(t,e,n,r){return"this.gradient("+fS(t.gradient,e,n,r)+","+l(t.start)+","+l(t.stop)+","+l(t.count)+")"}(e,n,r,i);var a=e.signal?oS(e.signal,n,r,i):e.color?function(t,e,n,r){function i(t,i,a,u){return"this."+t+"("+[hS(null,i,e,n,r),hS(null,a,e,n,r),hS(null,u,e,n,r)].join(",")+").toString()"}return t.c?i("hcl",t.h,t.c,t.l):t.h||t.s?i("hsl",t.h,t.s,t.l):t.l||t.a?i("lab",t.l,t.a,t.b):t.r||t.g||t.b?i("rgb",t.r,t.g,t.b):null}(e.color,n,r,i):null!=e.field?sS(e.field,n,r,i):void 0!==e.value?l(e.value):void 0;return null!=e.scale&&(a=cS(e,a,n,r,i)),void 0===a&&(a=null),null!=e.exponent&&(a="Math.pow("+a+","+lS(e.exponent,n,r,i)+")"),null!=e.mult&&(a+="*"+lS(e.mult,n,r,i)),null!=e.offset&&(a+="+"+lS(e.offset,n,r,i)),e.round&&(a="Math.round("+a+")"),a}function dS(t,e,n){const r=t+"["+l(e)+"]";return`$=${n};if(${r}!==$)${r}=$,m=1;`}function pS(t,e,n,r,i){var a="";return e.forEach((function(t){var e=hS(0,t,n,r,i);a+=t.test?oS(t.test,n,r,i)+"?"+e+":":e})),":"===k(a)&&(a+="null"),dS("o",t,a)}function gS(t,e,n,r){var i,a,o={},s="var o=item,datum=o.datum,m=0,$;";for(i in t)a=t[i],u(a)?s+=pS(i,a,r,n,o):s+=dS("o",i,hS(0,a,r,n,o));return s+=function(t,e){var n="";return aS[e]||(t.x2&&(t.x?(uS[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(uS[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(t,e),{$expr:s+="return m;",$fields:Object.keys(o),$output:Object.keys(t)}}function mS(t){return o(t)&&!u(t)?X({},t):{value:t}}function vS(t,e,n,r){return null!=n?(o(n)&&!u(n)?t.update[e]=n:t[r||"enter"][e]={value:n},1):0}function yS(t,e,n){for(let n in e)vS(t,n,e[n]);for(let e in n)vS(t,e,n[e],"update")}function _S(t,e,n){for(var r in e)n&&K(n,r)||(t[r]=X(t[r]||{},e[r]));return t}function xS(t,e,n,r,i,a){var u,o;for(o in(a=a||{}).encoders={$encode:u={}},t=function(t,e,n,r,i){var a,u,o,s={},l={};u="lineBreak","text"!==e||null==i[u]||wS(u,t)||bS(s,u,i[u]);("legend"==n||String(n).startsWith("axis"))&&(n=null);for(u in o="frame"===n?i.group:"mark"===n?X({},i.mark,i[e]):null)wS(u,t)||("fill"===u||"stroke"===u)&&(wS("fill",t)||wS("stroke",t))||bS(s,u,o[u]);for(u in I(r).forEach((function(e){var n=i.style&&i.style[e];for(var r in n)wS(r,t)||bS(s,r,n[r])})),t=X({},t),s)(o=s[u]).signal?(a=a||{})[u]=o:l[u]=o;t.enter=X(l,t.enter),a&&(t.update=X(a,t.update));return t}(t,e,n,r,i.config))u[o]=gS(t[o],e,a,i);return a}function bS(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}function wS(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}function AS(t,e,n,r,i,a,u){return{type:t,name:u?u.name:void 0,role:e,style:u&&u.style||n,key:r,from:i,interactive:!(!u||!u.interactive),encode:_S(a,u,nS)}}function kS(t,e){const n=(n,r)=>YC(t[n],YC(e[n],r));return n.isVertical=n=>"vertical"===YC(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>YC(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>YC(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>YC(t.columns,YC(e.columns,+n.isVertical(!0))),n}function MS(t,e){var n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function ES(t,e,n){return`item.anchor === "start" ? ${t} : item.anchor === "end" ? ${e} : ${n}`}const DS=ES(l("left"),l("right"),l("center"));function CS(t,e){return e?t?o(t)?{...t,offset:CS(t.offset,e)}:{value:t,offset:e}:e:t}function FS(t,e,n,r){var i,a,u,o,s,l,c=kS(t,n),f=c.isVertical(),h=c.gradientThickness(),d=c.gradientLength();return f?(u=[0,1],o=[0,0],s=h,l=d):(u=[0,0],o=[1,0],s=d,l=h),yS(i={enter:a={opacity:rS,x:rS,y:rS,width:mS(s),height:mS(l)},update:X({},a,{opacity:iS,fill:{gradient:e,start:u,stop:o}}),exit:{opacity:rS}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),AS("rect","legend-gradient",null,void 0,void 0,i,r)}function SS(t,e,n,r,i){var a,u,o,s,l,c,f=kS(t,n),h=f.isVertical(),d=f.gradientThickness(),p=f.gradientLength(),g="";return h?(o="y",l="y2",s="x",c="width",g="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:rS,fill:{scale:e,field:tS}})[o]={signal:g+"datum.perc",mult:p},u[s]=rS,u[l]={signal:g+"datum.perc2",mult:p},u[c]=mS(d),yS(a={enter:u,update:X({},u,{opacity:iS}),exit:{opacity:rS}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),AS("rect","legend-band",null,tS,i,a,r)}function BS(t,e,n,r){var i,a,u,o,s,l=kS(t,e),c=l.isVertical(),f=mS(l.gradientThickness()),h=l.gradientLength(),d=l("labelOverlap"),p=l("labelSeparation"),g="";return yS(i={enter:a={opacity:rS},update:u={opacity:iS,text:{field:"label"}},exit:{opacity:rS}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:YC(t.labelLimit,e.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=u.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},o="y",s="x",g="1-"):(a.align=u.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:g+"datum.perc",mult:h},a[s]=u[s]=f,f.offset=YC(t.labelOffset,e.gradientLabelOffset)||0,t=AS("text","legend-label","guide-label",tS,r,i,n),d&&(t.overlap={separation:p,method:d,order:"datum.index"}),t}function zS(t,e,n,r,i,a,u,o){return{type:"group",name:n,role:t,style:e,from:r,interactive:i||!1,encode:a,marks:u,layout:o}}function TS(t,e,n,r,i){var a,u,o,s,l,c,f,h=kS(t,e),d=n.entries,p=!(!d||!d.interactive),g=d?d.name:void 0,m=h("clipHeight"),v=h("symbolOffset"),y={data:"value"},_={},x=`(${i}) ? datum.offset : datum.size`,b=m?mS(m):{field:"size"},w="datum.index",A=`max(1, ${i})`;b.mult=.5,_={enter:a={opacity:rS,x:{signal:x,mult:.5,offset:v},y:b},update:u={opacity:iS,x:a.x,y:a.y},exit:{opacity:rS}};var k=null,M=null;return t.fill||(k=e.symbolBaseFillColor,M=e.symbolBaseStrokeColor),yS(_,{fill:h("symbolFillColor",k),shape:h("symbolType"),size:h("symbolSize"),stroke:h("symbolStrokeColor",M),strokeDash:h("symbolDash"),strokeDashOffset:h("symbolDashOffset"),strokeWidth:h("symbolStrokeWidth")},{opacity:h("symbolOpacity")}),eS.forEach((function(e){t[e]&&(u[e]=a[e]={scale:t[e],field:tS})})),s=AS("symbol","legend-symbol",null,tS,y,_,n.symbols),m&&(s.clip=!0),(o=mS(v)).offset=h("labelOffset"),yS(_={enter:a={opacity:rS,x:{signal:x,offset:o},y:b},update:u={opacity:iS,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:rS}},{align:h("labelAlign"),baseline:h("labelBaseline"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontStyle:h("labelFontStyle"),fontWeight:h("labelFontWeight"),limit:h("labelLimit")}),l=AS("text","legend-label","guide-label",tS,y,_,n.labels),_={enter:{noBound:{value:!m},width:rS,height:m?mS(m):rS,opacity:rS},exit:{opacity:rS},update:u={opacity:iS,row:{signal:null},column:{signal:null}}},h.isVertical(!0)?(c=`ceil(item.mark.items.length / ${A})`,u.row.signal=`${w}%${c}`,u.column.signal=`floor(${w} / ${c})`,f={field:["row",w]}):(u.row.signal=`floor(${w} / ${A})`,u.column.signal=`${w} % ${A}`,f={field:w}),u.column.signal=`(${i})?${u.column.signal}:${w}`,(t=zS("scope",null,g,r={facet:{data:r,name:"value",groupby:"index"}},p,_S(_,d,nS),[s,l])).sort=f,t}const NS='item.orient === "left"',OS='item.orient === "right"',RS=`(${NS} || ${OS})`,qS=`datum.vgrad && ${RS}`,US=ES('"top"','"bottom"','"middle"'),LS=`datum.vgrad && ${OS} ? (${ES('"right"','"left"','"center"')}) : (${RS} && !(datum.vgrad && ${NS})) ? "left" : ${DS}`,PS=`item._anchor || (${RS} ? "middle" : "start")`,$S=`${qS} ? (${NS} ? -90 : 90) : 0`,jS=`${RS} ? (datum.vgrad ? (${OS} ? "bottom" : "top") : ${US}) : "top"`;function IS(t,e){var n;return o(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+HS(t.path)+")":t.sphere&&(n="geoShape("+HS(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function HS(t){return o(t)&&t.signal?t.signal:l(t)}function WS(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?"group"===t.type?"scope":e||"mark":e}function YS(t){return{marktype:t.type,name:t.name||void 0,role:t.role||WS(t),zindex:+t.zindex||void 0}}function VS(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function GS(t,e){var n=Vr(t.type);n||i("Unrecognized transform type: "+l(t.type));var r=qC(n.type.toLowerCase(),null,XS(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function XS(t,e,n){var r,i,a,u={};for(i=0,a=t.params.length;i<a;++i)u[(r=t.params[i]).name]=JS(r,e,n);return u}function JS(t,e,n){var r=t.type,a=e[t.name];return"index"===r?function(t,e,n){s(e.from)||i('Lookup "from" parameter must be a string literal.');return n.getData(e.from).lookupRef(n,e.key)}(0,e,n):void 0!==a?"param"===r?function(t,e,n){var r=e[t.name];return t.array?(u(r)||i("Expected an array of sub-parameters. Instead: "+l(r)),r.map((function(e){return QS(t,e,n)}))):QS(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!HC(a)?a.map((function(e){return ZS(t,e,n)})):ZS(t,a,n):void(t.required&&i("Missing required "+l(e.type)+" parameter: "+l(t.name)))}function ZS(t,e,n){var r=t.type;if(HC(e))return KS(r)?i("Expression references can not be signals."):tB(r)?n.fieldRef(e):eB(r)?n.compareRef(e):n.signalRef(e.signal);var a,u=t.expr||tB(r);return u&&((a=e)&&a.expr)?n.exprRef(e.expr,e.as):u&&function(t){return t&&t.field}(e)?PC(e.field,e.as):KS(r)?OC(e,n):function(t){return"data"===t}(r)?LC(n.getData(e).values):tB(r)?PC(e):eB(r)?n.compareRef(e):e}function QS(t,e,n){var r,a,u,o,s;for(o=0,s=t.params.length;o<s;++o){for(u in(a=t.params[o]).key)if(a.key[u]!==e[u]){a=null;break}if(a)break}return a||i("Unsupported parameter: "+l(e)),r=X(XS(a,e,n),a.key),LC(n.add(CF(r)))}function KS(t){return"expr"===t}function tB(t){return"field"===t}function eB(t){return"compare"===t}function nB(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:LC(e.getData(t.data).output)}function rB(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}rB.fromEntries=function(t,e){var n=e.length,r=1,i=e[0],a=e[n-1],u=e[n-2],o=null;for(i&&"load"===i.type&&(i=e[1]),t.add(e[0]);r<n;++r)e[r].params.pulse=LC(e[r-1]),t.add(e[r]),"aggregate"===e[r].type&&(o=e[r]);return new rB(t,i,u,a,o)};var iB=rB.prototype;function aB(t){return s(t)?t:null}function uB(t,e,n){var r,i=IC(n.op,n.field);if(e.ops){for(var a=0,u=e.as.length;a<u;++a)if(e.as[a]===i)return}else e.ops=["count"],e.fields=[null],e.as=["count"];n.op&&(e.ops.push((r=n.op.signal)?t.signalRef(r):n.op),e.fields.push(t.fieldRef(n.field)),e.as.push(i))}function oB(t,e,n,r,i,a,u){var s,l,c=e[n]||(e[n]={}),f=function(t){return o(t)?("descending"===t.order?"-":"+")+IC(t.op,t.field):""}(a),h=aB(i);if(null!=h&&(t=e.scope,s=c[h+=f?"|"+f:""]),!s){var d=a?{field:$C,pulse:e.countsRef(t,i,a)}:{field:t.fieldRef(i),pulse:LC(e.output)};f&&(d.sort=t.sortRef(a)),l=t.add(qC(r,void 0,d)),u&&(e.index[i]=l),s=LC(l),null!=h&&(c[h]=s)}return s}function sB(t,e,n){var r,i=t.remove,a=t.insert,u=t.toggle,o=t.modify,s=t.values,l=e.add(UC());r=OC("if("+t.trigger+',modify("'+n+'",'+[a,i,u,o,s].map((function(t){return null==t?"null":t})).join(",")+"),0)",e),l.update=r.$expr,l.params=r.$params}function lB(t,e){var n,r,a,u,o,s,c,f,h,d,p,g,m,v,y=WS(t),_="group"===t.type,x=t.from&&t.from.facet,b=t.layout||"scope"===y||"frame"===y,w="mark"===y||b||x,A=t.overlap;a=function(t,e,n){var r,a,u,o,s;return t?(r=t.facet)&&(e||i("Only group marks can be faceted."),null!=r.field?o=s=nB(r,n):(t.data?s=LC(n.getData(t.data).aggregate):((u=GS(X({type:"aggregate",groupby:I(r.groupby)},r.aggregate),n)).params.key=n.keyRef(r.groupby),u.params.pulse=nB(r,n),o=s=LC(n.add(u))),a=n.keyRef(r.groupby,!0))):o=LC(n.add(pF(null,[{}]))),o||(o=nB(t,n)),{key:a,pulse:o,parent:s}}(t.from,_,e),d=LC(r=e.add(mF({key:a.key||(t.key?PC(t.key):void 0),pulse:a.pulse,clean:!_}))),r=u=e.add(pF({pulse:d})),r=e.add(kF({markdef:YS(t),interactive:VS(t.interactive,e),clip:IS(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:LC(r)})),p=LC(r),(r=o=e.add(vF(xS(t.encode,t.type,y,t.style,e,{mod:!1,pulse:p})))).params.parent=e.encode(),t.transform&&t.transform.forEach((function(t){const n=GS(t,e),a=n.metadata;(a.generates||a.changes)&&i("Mark transforms should not generate new data."),a.nomod||(o.params.mod=!0),n.params.pulse=LC(r),e.add(r=n)})),t.sort&&(r=e.add(RF({sort:e.compareRef(t.sort),pulse:LC(r)}))),g=LC(r),(x||b)&&(m=LC(b=e.add(qF({layout:e.objectProperty(t.layout),legends:e.legends,mark:p,pulse:g})))),v=LC(s=e.add(dF({mark:p,pulse:m||g}))),_&&(w&&((n=e.operators).pop(),b&&n.pop()),e.pushState(g,m||v,d),x?function(t,e,n){var r,a,u,o,s=t.from.facet,c=s.name,f=nB(s,e);s.name||i("Facet must have a name: "+l(s)),s.data||i("Facet must reference a data set: "+l(s)),s.field?o=e.add(FF({field:e.fieldRef(s.field),pulse:f})):s.groupby?o=e.add(_F({key:e.keyRef(s.groupby),group:LC(e.proxy(n.parent)),pulse:f})):i("Facet must specify groupby or field: "+l(s)),a=(r=e.fork()).add(pF()),u=r.add(OF({pulse:LC(a)})),r.addData(c,new rB(r,a,a,u)),r.addSignal("parent",null),o.params.subflow={$subflow:xB(t,r).toRuntime()}}(t,e,a):w?function(t,e,n){var r=e.add(FF({pulse:n.pulse})),i=e.fork();i.add(OF()),i.addSignal("parent",null),r.params.subflow={$subflow:xB(t,i).toRuntime()}}(t,e,a):xB(t,e),e.popState(),w&&(b&&n.push(b),n.push(s))),A&&(v=function(t,e,n){var r,i=t.method,a=t.bound,u=t.separation,o={separation:HC(u)?n.signalRef(u.signal):u,method:HC(i)?n.signalRef(i.signal):i,pulse:e};t.order&&(o.sort=n.compareRef({field:t.order}));a&&(r=a.tolerance,o.boundTolerance=HC(r)?n.signalRef(r.signal):+r,o.boundScale=n.scaleRef(a.scale),o.boundOrient=a.orient);return LC(n.add(DF(o)))}(A,v,e)),c=e.add(TF({pulse:v})),f=e.add(OF({pulse:LC(c)},void 0,e.parent())),null!=t.name&&(h=t.name,e.addData(h,new rB(e,u,c,f)),t.on&&t.on.forEach((function(t){(t.insert||t.remove||t.toggle)&&i("Marks only support modify triggers."),sB(t,e,h)})))}function cB(t,e){var n,r,a,u,o,s,l,c,f,h=e.config.legend,d=t.encode||{},p=d.legend||{},g=p.name||void 0,m=p.interactive,v=p.style,y=kS(t,h),_=eS.reduce((function(e,n){return e||t[n]}),0);return _||i("Missing valid scale for legend."),o=function(t,e){var n=t.type||"symbol";t.type||1!==function(t){return eS.reduce((function(e,n){return e+(t[n]?1:0)}),0)}(t)||!t.fill&&!t.stroke||(n=Pm(e)?"gradient":jm(e)?"discrete":"symbol");return"gradient"!==n?n:jm(e)?"discrete":"gradient"}(t,e.scaleType(_)),s={title:null!=t.title,type:o,vgrad:"symbol"!==o&&y.isVertical()},l=LC(e.add(pF(null,[s]))),p=_S(function(t,e){var n={enter:{},update:{}};return yS(n,{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")}),n}(y,h),p,nS),n={enter:{x:{value:0},y:{value:0}}},c=LC(e.add(wF(a={type:o,scale:e.scaleRef(_),count:e.objectProperty(y("tickCount")),limit:e.property(y("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),"gradient"===o?(u=[FS(t,_,h,d.gradient),BS(t,h,d.labels,c)],a.count=a.count||e.signalRef(`max(2,2*floor((${VC(y.gradientLength())})/100))`)):"discrete"===o?u=[SS(t,_,h,d.gradient,c),BS(t,h,d.labels,c)]:(r=function(t,e){const n=kS(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,h),u=[TS(t,h,d,c,VC(r.columns))],a.size=function(t,e,n){var r=VC(fB("size",t,n)),i=VC(fB("strokeWidth",t,n)),a=VC(function(t,e,n){return MS("fontSize",t)||function(t,e,n){var r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,"guide-label"));return OC(`max(ceil(sqrt(${r})+${i}),${a})`,e)}(t,e,u[0].marks)),u=[zS("legend-entry",null,null,l,m,n,u,r)],s.title&&u.push(function(t,e,n,r){var i,a=kS(t,e);return yS(i={enter:{opacity:rS},update:{opacity:iS,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:rS}},{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:PS},angle:{signal:$S},align:{signal:LS},baseline:{signal:jS},text:t.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),AS("text","legend-title","guide-title",null,r,i,n)}(t,h,d.title,l)),f=zS("legend",v,g,l,m,p,u),t.zindex&&(f.zindex=t.zindex),lB(f,e)}function fB(t,e,n){return e[t]?`scale("${e[t]}",datum)`:MS(t,n[0].encode)}iB.countsRef=function(t,e,n){var r,i,a,u=this.counts||(this.counts={}),o=aB(e);return null!=o&&(t=this.scope,r=u[o]),r?n&&n.field&&uB(t,r.agg.params,n):(a={groupby:t.fieldRef(e,"key"),pulse:LC(this.output)},n&&n.field&&uB(t,a,n),i=t.add(fF(a)),r=t.add(pF({pulse:LC(i)})),r={agg:i,ref:LC(r)},null!=o&&(u[o]=r)),r.ref},iB.tuplesRef=function(){return LC(this.values)},iB.extentRef=function(t,e){return oB(t,this,"extent","extent",e,!1)},iB.domainRef=function(t,e){return oB(t,this,"domain","values",e,!1)},iB.valuesRef=function(t,e,n){return oB(t,this,"vals","values",e,n||!0)},iB.lookupRef=function(t,e){return oB(t,this,"lookup","tupleindex",e,!1)},iB.indataRef=function(t,e){return oB(t,this,"indata","tupleindex",e,!0,!0)};function hB(t,e){var n,r,i=kS(t=s(t)?{text:t}:t,e.config.title),a=t.encode||{},u=a.group||{},o=u.name||void 0,l=u.interactive,c=u.style,f=[];return n=LC(e.add(pF(null,[{}]))),f.push(function(t,e,n,r){var i={value:0},a=t.text,u={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return yS(u,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),AS("text","title-text","group-title",null,r,u,n)}(t,i,function(t){const e=t.encode;return e&&e.title||X({name:t.name,interactive:t.interactive,style:t.style},e)}(t),n)),t.subtitle&&f.push(function(t,e,n,r){var i={value:0},a=t.subtitle,u={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return yS(u,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),AS("text","title-subtitle","group-subtitle",null,r,u,n)}(t,i,a.subtitle,n)),r=zS("title",c,o,n,l,function(t,e){var n={enter:{},update:{}};return yS(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:DS},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),_S(n,e,nS)}(i,u),f),t.zindex&&(r.zindex=t.zindex),lB(r,e)}function dB(t,e){var n=[];t.transform&&t.transform.forEach((function(t){n.push(GS(t,e))})),t.on&&t.on.forEach((function(n){sB(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){var r,i,a,u,o,s=[],l=null,c=!1,f=!1;t.values?WC(t.values)||WC(t.format)?(s.push(gB(e,t)),s.push(l=pB())):s.push(l=pB({$ingest:t.values,$format:t.format})):t.url?WC(t.url)||WC(t.format)?(s.push(gB(e,t)),s.push(l=pB())):s.push(l=pB({$request:t.url,$format:t.format})):t.source&&(l=r=I(t.source).map((function(t){return LC(e.getData(t).output)})),s.push(null));for(i=0,a=n.length;i<a;++i)u=n[i],o=u.metadata,l||o.source||s.push(l=pB()),s.push(u),o.generates&&(f=!0),o.modifies&&!f&&(c=!0),o.source?l=u:o.changes&&(l=null);r&&(a=r.length-1,s[0]=zF({derive:c,pulse:a?r:r[0]}),(c||a)&&s.splice(1,0,pB()));l||s.push(pB());return s.push(OF({})),s}(t,e,n))}function pB(t){var e=pF({},t);return e.metadata={source:!0},e}function gB(t,e){return AF({url:e.url?t.property(e.url):void 0,async:e.async?t.property(e.async):void 0,values:e.values?t.property(e.values):void 0,format:t.objectProperty(e.format)})}function mB(t,e){return{scale:t.scale,range:e}}function vB(t,e,n,r,i){var a,u,s,l,c,f,h,d,p,g=kS(t,e),m=t.orient,v=t.gridScale,y="left"===m||"top"===m?1:-1,_=function(t,e){if(1===e);else if(o(t)){for(var n=t=X({},t);null!=n.mult;){if(!o(n.mult))return n.mult*=e,t;n=n.mult=X({},n.mult)}n.mult=e}else t=e*(t||0);return t}(t.offset,y);return yS(a={enter:u={opacity:rS},update:l={opacity:iS},exit:s={opacity:rS}},{stroke:g("gridColor"),strokeDash:g("gridDash"),strokeDashOffset:g("gridDashOffset"),strokeOpacity:g("gridOpacity"),strokeWidth:g("gridWidth")}),c={scale:t.scale,field:tS,band:i.band,extra:i.extra,offset:i.offset,round:g("tickRound")},"top"===m||"bottom"===m?(f="x",h="y",p="height"):(f="y",h="x",p="width"),d=h+"2",l[f]=u[f]=s[f]=c,v?(l[h]=u[h]={scale:v,range:0,mult:y,offset:_},l[d]=u[d]={scale:v,range:1,mult:y,offset:_}):(l[h]=u[h]={value:0,offset:_},l[d]=u[d]={signal:p,mult:y,offset:_}),AS("rule","axis-grid",null,tS,r,a,n)}function yB(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function _B(t,e){var n,r,i,a,u,s,l=function(t,e){var n=e.config,r=t.orient,i="top"===r||"bottom"===r?n.axisX:n.axisY,a=n["axis"+r[0].toUpperCase()+r.slice(1)],u="band"===e.scaleType(t.scale)&&n.axisBand;return i||a||u?X({},n.axis,i,a,u):n.axis}(t,e),c=t.encode||{},f=c.axis||{},h=f.name||void 0,d=f.interactive,p=f.style,g=kS(t,l),m=function(t){let e,n,r=t("tickBand"),i=t("tickOffset");return r?r.signal?(e={signal:`(${r.signal})==='extent'?1:0.5`},n={signal:`(${r.signal})==='extent'?true:false`},o(i)||(i={signal:`(${r.signal})==='extent'?0:${i}`})):"extent"===r?(e=1,n=!0,i=0):(e=.5,n=!1):(e=t("bandPosition"),n=t("tickExtra")),{extra:n,band:e,offset:i}}(g);return n={orient:t.orient,ticks:!!g("ticks"),labels:!!g("labels"),grid:!!g("grid"),domain:!!g("domain"),title:null!=t.title,translate:g("translate")},r=LC(e.add(pF({},[n]))),f=_S({update:{offset:mS(g("offset")||0),position:mS(YC(t.position,0)),titlePadding:mS(g("titlePadding")),minExtent:mS(g("minExtent")),maxExtent:mS(g("maxExtent")),range:{signal:`abs(span(range("${t.scale}")))`}}},c.axis,nS),i=LC(e.add(hF({scale:e.scaleRef(t.scale),extra:e.property(m.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),s=[],n.grid&&s.push(vB(t,l,c.grid,i,m)),n.ticks&&(a=g("tickSize"),s.push(function(t,e,n,r,i,a){var u,o,s,l,c,f,h=kS(t,e),d=t.orient,p="left"===d||"top"===d?-1:1;return yS(u={enter:o={opacity:rS},update:l={opacity:iS},exit:s={opacity:rS}},{stroke:h("tickColor"),strokeDash:h("tickDash"),strokeDashOffset:h("tickDashOffset"),strokeOpacity:h("tickOpacity"),strokeWidth:h("tickWidth")}),(c=mS(i)).mult=p,f={scale:t.scale,field:tS,band:a.band,extra:a.extra,offset:a.offset,round:h("tickRound")},"top"===d||"bottom"===d?(l.y=o.y=rS,l.y2=o.y2=c,l.x=o.x=s.x=f):(l.x=o.x=rS,l.x2=o.x2=c,l.y=o.y=s.y=f),AS("rule","axis-tick",null,tS,r,u,n)}(t,l,c.ticks,i,a,m))),n.labels&&(a=n.ticks?a:0,s.push(function(t,e,n,r,i,a){var u,o,s,l,c,f,h,d,p,g,m=kS(t,e),v=t.orient,y="left"===v||"top"===v?-1:1,_="top"===v||"bottom"===v,x=t.scale,b=VC(m("labelFlush")),w=VC(m("labelFlushOffset")),A=0===b||!!b,k=m("labelAlign"),M=m("labelBaseline");return(s=mS(i)).mult=y,s.offset=mS(m("labelPadding")||0),s.offset.mult=y,l={scale:x,field:tS,band:.5,offset:CS(a.offset,m("labelOffset"))},_?(c=k||(A?yB(x,b,'"left"','"right"','"center"'):"center"),f=M||("top"===v?"bottom":"top"),h=!k):(c=k||("right"===v?"left":"right"),f=M||(A?yB(x,b,'"top"','"bottom"','"middle"'):"middle"),h=!M),h=h&&A&&w?yB(x,b,"-("+w+")",w,0):null,yS(u={enter:o={opacity:rS,x:_?l:s,y:_?s:l},update:{opacity:iS,text:{field:"label"},x:o.x,y:o.y},exit:{opacity:rS,x:o.x,y:o.y}},{[_?"dx":"dy"]:h,align:c,baseline:f,angle:m("labelAngle"),fill:m("labelColor"),fillOpacity:m("labelOpacity"),font:m("labelFont"),fontSize:m("labelFontSize"),fontWeight:m("labelFontWeight"),fontStyle:m("labelFontStyle"),limit:m("labelLimit"),lineHeight:m("labelLineHeight")}),d=m("labelBound"),p=m("labelOverlap"),g=m("labelSeparation"),t=AS("text","axis-label","guide-label",tS,r,u,n),(p||d)&&(t.overlap={separation:g,method:p,order:"datum.index",bound:d?{scale:x,orient:v,tolerance:d}:null}),t}(t,l,c.labels,i,a,m))),n.domain&&s.push(function(t,e,n,r){var i,a,u,o,s,l,c=kS(t,e),f=t.orient;return yS(i={enter:a={opacity:rS},update:u={opacity:iS},exit:{opacity:rS}},{stroke:c("domainColor"),strokeDash:c("domainDash"),strokeDashOffset:c("domainDashOffset"),strokeWidth:c("domainWidth"),strokeOpacity:c("domainOpacity")}),"top"===f||"bottom"===f?(o="x",l="y"):(o="y",l="x"),s=o+"2",a[l]=rS,u[o]=a[o]=mB(t,0),u[s]=a[s]=mB(t,1),AS("rule","axis-domain",null,null,r,i,n)}(t,l,c.domain,r)),n.title&&s.push(function(t,e,n,r){var i,a,u,o,s=kS(t,e),l=t.orient,c="left"===l||"top"===l?-1:1,f="top"===l||"bottom"===l;return i={enter:a={opacity:rS,anchor:mS(s("titleAnchor")),align:{signal:DS}},update:u=X({},a,{opacity:iS,text:mS(t.title)}),exit:{opacity:rS}},o={signal:`lerp(range("${t.scale}"), ${ES(0,1,.5)})`},f?(u.x=o,a.angle={value:0},a.baseline={value:"top"===l?"bottom":"top"}):(u.y=o,a.angle={value:90*c},a.baseline={value:"bottom"}),yS(i,{angle:s("titleAngle"),baseline:s("titleBaseline"),fill:s("titleColor"),fillOpacity:s("titleOpacity"),font:s("titleFont"),fontSize:s("titleFontSize"),fontStyle:s("titleFontStyle"),fontWeight:s("titleFontWeight"),limit:s("titleLimit"),lineHeight:s("titleLineHeight")},{align:s("titleAlign")}),!vS(i,"x",s("titleX"),"update")&&!f&&!wS("x",n)&&(i.enter.auto={value:!0}),!vS(i,"y",s("titleY"),"update")&&f&&!wS("y",n)&&(i.enter.auto={value:!0}),AS("text","axis-title","guide-title",null,r,i,n)}(t,l,c.title,r)),u=zS("axis",p,h,r,d,f,s),t.zindex&&(u.zindex=t.zindex),lB(u,e)}function xB(t,e,n){var r=I(t.signals),a=I(t.scales);return n||r.forEach(t=>NC(t,e)),I(t.projections).forEach(t=>function(t,e){var n=e.config.projection||{},r={};for(var i in t)"name"!==i&&(r[i]=KF(t[i],i,e));for(i in n)null==r[i]&&(r[i]=KF(n[i],i,e));e.addProjection(t.name,r)}(t,e)),a.forEach(t=>function(t,e){var n=t.type||"linear";Um(n)||i("Unrecognized scale type: "+l(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e)),I(t.data).forEach(t=>dB(t,e)),a.forEach(t=>$F(t,e)),(n||r).forEach(t=>function(t,e){var n=e.getSignal(t.name),r=t.update;t.init&&(r?i("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=OC(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((function(t){sF(t,e,n.id)}))}(t,e)),I(t.axes).forEach(t=>_B(t,e)),I(t.marks).forEach(t=>lB(t,e)),I(t.legends).forEach(t=>cB(t,e)),t.title&&hB(t.title,e),e.parseLambdas(),e}function bB(t,e){var n,r,i,a,u,o,s=e.config;return u=LC(e.root=e.add(UC())),(o=function(t,e){const n=n=>YC(t[n],e[n]),r=[wB("background",n("background")),wB("autosize",FC(n("autosize"))),wB("padding",BC(n("padding"))),wB("width",n("width")||0),wB("height",n("height")||0)],i=r.reduce((t,e)=>(t[e.name]=e,t),{}),a={};return I(t.signals).forEach(t=>{K(i,t.name)?t=X(i[t.name],t):r.push(t),a[t.name]=t}),I(e.signals).forEach(t=>{K(a,t.name)||K(i,t.name)||r.push(t)}),r}(t,s)).forEach(t=>NC(t,e)),e.description=t.description||s.description,e.eventConfig=s.events,e.legends=e.objectProperty(s.legend&&s.legend.layout),r=e.add(pF()),i=_S({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t.encode),i=e.add(vF(xS(i,"group","frame",t.style,e,{pulse:LC(r)}))),a=e.add(qF({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:u,pulse:LC(i)})),e.operators.pop(),e.pushState(LC(i),LC(a),null),xB(t,e,o),e.operators.push(a),n=e.add(dF({mark:u,pulse:LC(a)})),n=e.add(TF({pulse:LC(n)})),n=e.add(OF({pulse:LC(n)})),e.addData("root",new rB(e,r,r,n)),e}function wB(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function AB(t){this.config=t,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function kB(t){this.config=t.config,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}var MB=AB.prototype=kB.prototype;function EB(t){return(u(t)?DB:CB)(t)}function DB(t){for(var e,n="[",r=0,i=t.length;r<i;++r)n+=(r>0?",":"")+(o(e=t[r])?e.signal||EB(e):l(e));return n+"]"}function CB(t){var e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+l(e)+":"+(o(n)?n.signal||EB(n):l(n));return r+"}"}MB.fork=function(){return new kB(this)},MB.isSubscope=function(){return this._subid>0},MB.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},MB.id=function(){return(this._subid?this._subid+":":0)+this._id++},MB.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(e){e.$ref=t.id})),t.refs=null),t},MB.proxy=function(t){var e=t instanceof RC?LC(t):t;return this.add(BF({value:e}))},MB.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},MB.addUpdate=function(t){return this.updates.push(t),t},MB.finish=function(){var t,e;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 n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},MB.pushState=function(t,e,n){this._encode.push(LC(this.add(OF({pulse:t})))),this._parent.push(e),this._lookup.push(n?LC(this.proxy(n)):null),this._markpath.push(-1)},MB.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},MB.parent=function(){return k(this._parent)},MB.encode=function(){return k(this._encode)},MB.lookup=function(){return k(this._lookup)},MB.markpath=function(){var t=this._markpath;return++t[t.length-1]},MB.fieldRef=function(t,e){if(s(t))return PC(t,e);t.signal||i("Unsupported field reference: "+l(t));var n,r=t.signal,a=this.field[r];return a||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=a=LC(this.add(xF(n)))),a},MB.compareRef=function(t){function e(t){return HC(t)?(r=!0,n.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,n.exprRef(t.expr)):t}var n=this,r=!1,i=I(t.field).map(e),a=I(t.order).map(e);return r?LC(this.add(gF({fields:i,orders:a}))):jC(i,a)},MB.keyRef=function(t,e){var n=this.signals,r=!1;return t=I(t).map((function(t){return HC(t)?(r=!0,LC(n[t.signal])):t})),r?LC(this.add(bF({fields:t,flat:e}))):function(t,e){var n={$key:t};return e&&(n.$flat=!0),n}(t,e)},MB.sortRef=function(t){if(!t)return t;var e=IC(t.op,t.field),n=t.order||"ascending";return n.signal?LC(this.add(gF({fields:e,orders:this.signalRef(n.signal)}))):jC(e,n)},MB.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},MB.hasOwnSignal=function(t){return K(this.signals,t)},MB.addSignal=function(t,e){this.hasOwnSignal(t)&&i("Duplicate signal name: "+l(t));var n=e instanceof RC?e:this.add(UC(e));return this.signals[t]=n},MB.getSignal=function(t){return this.signals[t]||i("Unrecognized signal name: "+l(t)),this.signals[t]},MB.signalRef=function(t){return this.signals[t]?LC(this.signals[t]):(K(this.lambdas,t)||(this.lambdas[t]=this.add(UC(null))),LC(this.lambdas[t]))},MB.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e<n;++e){var r=t[e],i=OC(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},MB.property=function(t){return t&&t.signal?this.signalRef(t.signal):t},MB.objectProperty=function(t){return t&&o(t)?this.signalRef(t.signal||EB(t)):t},MB.exprRef=function(t,e){var n={expr:OC(t,this)};return e&&(n.expr.$name=e),LC(this.add(yF(n)))},MB.addBinding=function(t,e){this.bindings||i("Nested signals do not support binding: "+l(t)),this.bindings.push(X({signal:t},e))},MB.addScaleProj=function(t,e){K(this.scales,t)&&i("Duplicate scale or projection name: "+l(t)),this.scales[t]=this.add(e)},MB.addScale=function(t,e){this.addScaleProj(t,NF(e))},MB.addProjection=function(t,e){this.addScaleProj(t,SF(e))},MB.getScale=function(t){return this.scales[t]||i("Unrecognized scale name: "+l(t)),this.scales[t]},MB.projectionRef=MB.scaleRef=function(t){return LC(this.getScale(t))},MB.projectionType=MB.scaleType=function(t){return this.getScale(t).params.type},MB.addData=function(t,e){return K(this.data,t)&&i("Duplicate data set name: "+l(t)),this.data[t]=e},MB.getData=function(t){return this.data[t]||i("Undefined data set name: "+l(t)),this.data[t]},MB.addDataPipeline=function(t,e){return K(this.data,t)&&i("Duplicate data set name: "+l(t)),this.addData(t,rB.fromEntries(this,e))};X(Yr,zo,Bd,$v,Tw,SA,Vk,Qk,AM,RM,YM),t.Bounds=Uo,t.CanvasHandler=eh,t.CanvasRenderer=uh,t.Dataflow=$r,t.Debug=4,t.Error=1,t.EventStream=Yt,t.Gradient=Ho,t.GroupItem=Yo,t.Handler=Jf,t.Info=3,t.Item=Wo,t.Marks=Nf,t.MultiPulse=Or,t.None=0,t.Operator=jt,t.Parameters=Ut,t.Pulse=Sr,t.RenderType=Ph,t.Renderer=Kf,t.ResourceLoader=Xo,t.SVGHandler=fh,t.SVGRenderer=xh,t.SVGStringRenderer=Th,t.Scenegraph=$f,t.Transform=Hr,t.View=AC,t.Warn=2,t.accessor=e,t.accessorFields=r,t.accessorName=n,t.array=I,t.bandwidthNRD=Mi,t.bin=Ei,t.bootstrapCI=Di,t.boundClip=Gh,t.boundContext=rc,t.boundItem=Of,t.boundMark=qf,t.boundStroke=Ql,t.changeset=Rt,t.clampRange=H,t.closeTag=gh,t.compare=Y,t.constant=V,t.cumulativeLogNormal=Pi,t.cumulativeNormal=Ni,t.cumulativeUniform=Yi,t.debounce=G,t.definition=Vr,t.densityLogNormal=Li,t.densityNormal=Ti,t.densityUniform=Wi,t.domChild=Yf,t.domClear=Vf,t.domCreate=Hf,t.domFind=Wf,t.dotbin=Ci,t.error=i,t.expressionFunction=QD,t.extend=X,t.extent=J,t.extentIndex=Z,t.falsy=v,t.fastmap=et,t.field=c,t.flush=nt,t.font=Cf,t.fontFamily=Df,t.fontSize=wf,t.format=Se,t.formatLocale=rm,t.formats=Be,t.hasOwnProperty=K,t.id=h,t.identity=d,t.inferType=oe,t.inferTypes=se,t.ingest=St,t.inherits=rt,t.inrange=it,t.interpolate=Zm,t.interpolateColors=Gm,t.interpolateRange=Vm,t.intersect=Ih,t.intersectBoxLine=yc,t.intersectPath=pc,t.intersectPoint=gc,t.intersectRule=vc,t.isArray=u,t.isBoolean=at,t.isDate=ut,t.isFunction=W,t.isNumber=ot,t.isObject=o,t.isRegExp=st,t.isString=s,t.isTuple=Dt,t.key=lt,t.lerp=ct,t.lineHeight=Af,t.loader=kr,t.logger=_,t.lruCache=ft,t.merge=ht,t.mergeConfig=b,t.multiLineOffset=Mf,t.one=g,t.openTag=ph,t.pad=pt,t.panLinear=z,t.panLog=T,t.panPow=N,t.panSymlog=O,t.parse=function(t,e){return o(t)||i("Input Vega specification must be an object."),bB(t,new AB(e=b({description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:"#4c78a8"},area:{fill:"#4c78a8"},image:null,line:{stroke:"#4c78a8",strokeWidth:2},path:{stroke:"#4c78a8"},rect:{fill:"#4c78a8"},rule:{stroke:"#000"},shape:{stroke:"#4c78a8"},symbol:{fill:"#4c78a8",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11},trail:{fill:"#4c78a8",size:2},style:{"guide-label":{fill:"#000",font:"sans-serif",fontSize:10},"guide-title":{fill:"#000",font:"sans-serif",fontSize:11,fontWeight:"bold"},"group-title":{fill:"#000",font:"sans-serif",fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:"#000",font:"sans-serif",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:"#ddd"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:"#888",grid:!1,gridWidth:1,gridColor:"#ddd",labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:"#888",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:"#ddd",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:"#888",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"]}},e,t.config))).toRuntime()},t.pathCurves=cl,t.pathEqual=Jh,t.pathParse=dl,t.pathRectangle=ql,t.pathRender=kl,t.pathSymbols=Cl,t.pathTrail=Ul,t.peek=k,t.point=Xf,t.projection=bw,t.quantileLogNormal=$i,t.quantileNormal=Oi,t.quantileUniform=Vi,t.quantiles=Ai,t.quantizeInterpolator=Xm,t.quarter=$,t.quartiles=ki,t.randomInteger=function(e,n){null==n&&(n=e,e=0);var r,i,a,u={};return u.min=function(t){return arguments.length?(a=i-(r=t||0),u):r},u.max=function(t){return arguments.length?(a=(i=t||0)-r,u):i},u.sample=function(){return r+Math.floor(a*t.random())},u.pdf=function(t){return t===Math.floor(t)&&t>=r&&t<i?1/a:0},u.cdf=function(t){var e=Math.floor(t);return e<r?0:e>=i?1:(e-r+1)/a},u.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},u.min(e).max(n)},t.randomKDE=qi,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=ji,t.randomMixture=Ii,t.randomNormal=Ri,t.randomUniform=Gi,t.read=Ar,t.regressionExp=ea,t.regressionLinear=Ki,t.regressionLoess=ua,t.regressionLog=ta,t.regressionPoly=ia,t.regressionPow=na,t.regressionQuad=ra,t.renderModule=jh,t.repeat=dt,t.resetSVGClipId=function(){Wc=1},t.responseType=ze,t.runtime=cC,t.runtimeContext=hC,t.sampleCurve=ca,t.sampleLogNormal=Ui,t.sampleNormal=zi,t.sampleUniform=Hi,t.scale=qm,t.sceneEqual=Xh,t.sceneFromJSON=Pf,t.scenePickVisit=Fc,t.sceneToJSON=Lf,t.sceneVisit=Cc,t.sceneZOrder=Dc,t.scheme=ev,t.setRandom=function(e){t.random=e},t.span=gt,t.splitAccessPath=a,t.stringValue=l,t.textMetrics=mf,t.timeBin=vo,t.timeFloor=Pu,t.timeFormat=ao,t.timeFormatLocale=wr,t.timeInterval=Xu,t.timeOffset=Qu,t.timeSequence=eo,t.timeUnitSpecifier=io,t.timeUnits=Su,t.toBoolean=mt,t.toDate=yt,t.toNumber=M,t.toSet=xt,t.toString=_t,t.transform=Gr,t.transforms=Yr,t.truncate=bt,t.truthy=m,t.tupleid=Ct,t.typeParsers=ie,t.utcFloor=Yu,t.utcFormat=uo,t.utcInterval=Ju,t.utcOffset=Ku,t.utcSequence=no,t.utcquarter=j,t.version="5.10.1",t.visitArray=wt,t.writeConfig=w,t.zero=p,t.zoomLinear=q,t.zoomLog=U,t.zoomPow=L,t.zoomSymlog=P,Object.defineProperty(t,"__esModule",{value:!0})}));
|