[email protected] Maven / Gradle / Ivy
Show all versions of hbase-server Show documentation
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis: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){return 1===t.length?o(t[0]):a(t)}const o=t=>function(e){return e[t]},a=t=>{const e=t.length;return function(n){for(let r=0;rr&&c(),s=r=i+1):"]"===o&&(s||u("Access path missing open bracket: "+t),s>0&&c(),s=0,r=i+1):i>r?c():r=i+1}return s&&u("Access path missing closing bracket: "+t),a&&u("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function l(t,n,r){const o=s(t);return t=1===o.length?o[0]:t,e((r&&r.get||i)(o),[t],n||t)}const c=l("id"),f=e((t=>t),[],"identity"),h=e((()=>0),[],"zero"),d=e((()=>1),[],"one"),p=e((()=>!0),[],"true"),g=e((()=>!1),[],"false");function m(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const y=0,v=1,_=2,x=3,b=4;function w(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m,r=t||y;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=v&&n(e||"error","ERROR",arguments),this},warn(){return r>=_&&n(e||"warn","WARN",arguments),this},info(){return r>=x&&n(e||"log","INFO",arguments),this},debug(){return r>=b&&n(e||"log","DEBUG",arguments),this}}}var k=Array.isArray;function A(t){return t===Object(t)}const M=t=>"__proto__"!==t;function E(){for(var t=arguments.length,e=new Array(t),n=0;n{for(const n in e)if("signals"===n)t.signals=C(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;D(t,n,e[n],r)}return t}),{})}function D(t,e,n,r){if(!M(e))return;let i,o;if(A(n)&&!k(n))for(i in o=A(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?D(o,i,n[i]):M(i)&&(o[i]=n[i]);else t[e]=n}function C(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 F(t){return t[t.length-1]}function S(t){return null==t||""===t?null:+t}const $=t=>e=>t*Math.exp(e),T=t=>e=>Math.log(t*e),B=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),N=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,z=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function O(t,e,n,r){const i=n(t[0]),o=n(F(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function R(t,e){return O(t,e,S,f)}function U(t,e){var n=Math.sign(t[0]);return O(t,e,T(n),$(n))}function L(t,e,n){return O(t,e,z(n),z(1/n))}function q(t,e,n){return O(t,e,B(n),N(n))}function P(t,e,n,r,i){const o=r(t[0]),a=r(F(t)),u=null!=e?r(e):(o+a)/2;return[i(u+(o-u)*n),i(u+(a-u)*n)]}function j(t,e,n){return P(t,e,n,S,f)}function I(t,e,n){const r=Math.sign(t[0]);return P(t,e,n,T(r),$(r))}function W(t,e,n,r){return P(t,e,n,z(r),z(1/r))}function H(t,e,n,r){return P(t,e,n,B(r),N(r))}function Y(t){return 1+~~(new Date(t).getMonth()/3)}function G(t){return 1+~~(new Date(t).getUTCMonth()/3)}function V(t){return null!=t?k(t)?t:[t]:[]}function X(t,e,n){let r,i=t[0],o=t[1];return o=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function J(t){return"function"==typeof t}const Z="descending";function Q(t,n,i){i=i||{},n=V(n)||[];const o=[],a=[],u={},s=i.comparator||tt;return V(t).forEach(((t,e)=>{null!=t&&(o.push(n[e]===Z?-1:1),a.push(t=J(t)?t:l(t,null,i)),(r(t)||[]).forEach((t=>u[t]=1)))})),0===a.length?null:e(s(a,o),Object.keys(u))}const K=(t,e)=>(te||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),tt=(t,e)=>1===t.length?et(t[0],e[0]):nt(t,e,t.length),et=(t,e)=>function(n,r){return K(t(n),t(r))*e},nt=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++ut}function it(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function ot(t){for(let e,n,r=1,i=arguments.length;ro&&(o=r))}else{for(r=e(t[a]);ao&&(o=r))}return[i,o]}function ut(t,e){const n=t.length;let r,i,o,a,u,s=-1;if(null==e){for(;++s=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++si&&(r=i,a=s),o=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++si&&(r=i,a=s),or(t)?n[t]:void 0,set(t,e){return r(t)||(++i.size,n[t]===ct&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=ct),this},clear(){i.size=i.empty=0,i.object=n={}},test(t){return arguments.length?(e=t,i):e},clean(){const t={};let r=0;for(const i in n){const o=n[i];o===ct||e&&e(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=n=t}};return t&&Object.keys(t).forEach((e=>{i.set(e,t[e])})),i}function ht(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let u,s=t[0],l=F(t);la&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:ot.replace(/\\(.)/g,"$1"))):V(t));const o=t&&t.length,a=r&&r.get||i,u=t=>a(n?[t]:s(t));let l;if(o)if(1===o){const e=u(t[0]);l=function(t){return""+e(t)}}else{const e=t.map(u);l=function(t){let n=""+e[0](t),r=0;for(;++r{e={},n={},r=0},o=(i,o)=>(++r>t&&(n=e,e={},r=1),e[i]=o);return i(),{clear:i,has:t=>lt(e,t)||lt(n,t),get:t=>lt(e,t)?e[t]:lt(n,t)?o(t,n[t]):void 0,set:(t,n)=>lt(e,t)?e[t]=n:o(t,n)}}function Mt(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let u=0,s=0,l=0;for(;u0?n[s++]:e[u++];for(;u=0;)n+=t;return n}function Dt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?Et(i,a)+o:"center"===r?Et(i,~~(a/2))+o+Et(i,Math.ceil(a/2)):o+Et(i,a)}function Ct(t){return t&&F(t)-t[0]||0}function Ft(t){return k(t)?"["+t.map(Ft)+"]":A(t)||xt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function St(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const $t=t=>vt(t)||mt(t)?t:Date.parse(t);function Tt(t,e){return e=e||$t,null==t||""===t?null:e(t)}function Bt(t){return null==t||""===t?null:t+""}function Nt(t){const e={},n=t.length;for(let r=0;r9999?"+"+Wt(e,6):Wt(e,4))+"-"+Wt(t.getUTCMonth()+1,2)+"-"+Wt(t.getUTCDate(),2)+(o?"T"+Wt(n,2)+":"+Wt(r,2)+":"+Wt(i,2)+"."+Wt(o,3)+"Z":i?"T"+Wt(n,2)+":"+Wt(r,2)+":"+Wt(i,2)+"Z":r||n?"T"+Wt(n,2)+":"+Wt(r,2)+"Z":"")}function Yt(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Ut;if(l)return l=!1,Rt;var e,r,i=a;if(t.charCodeAt(i)===Lt){for(;a++=o?s=!0:(r=t.charCodeAt(a++))===qt?l=!0:r===Pt&&(l=!0,t.charCodeAt(a)===qt&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a1)r=function(t,e,n){var r,i=[],o=[];function a(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}function l(t){t.forEach(s)}function c(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":u(t.arcs);break;case"MultiLineString":case"Polygon":s(t.arcs);break;case"MultiPolygon":l(t.arcs)}}return c(e),o.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}(0,e,n);else for(i=0,r=new Array(o=t.arcs.length);ie?1:t>=e?0:NaN}function ee(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function ne(t){let e,n,r;function i(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(ite(t(e),n),r=(e,n)=>t(e)-n):(e=t===te||t===ee?t:re,n=t,r=t),{left:i,center:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const o=i(t,e,n,(arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length)-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length;if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class ce extends Map{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ge;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(he(this,t))}has(t){return super.has(he(this,t))}set(t,e){return super.set(de(this,t),e)}delete(t){return super.delete(pe(this,t))}}class fe extends Set{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ge;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(he(this,t))}add(t){return super.add(de(this,t))}delete(t){return super.delete(pe(this,t))}}function he(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)?n.get(i):e}function de(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)?n.get(i):(n.set(i,e),e)}function pe(t,e){let{_intern:n,_key:r}=t;const i=r(e);return n.has(i)&&(e=n.get(i),n.delete(i)),e}function ge(t){return null!==t&&"object"==typeof t?t.valueOf():t}function me(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}const ye=Math.sqrt(50),ve=Math.sqrt(10),_e=Math.sqrt(2);function xe(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=ye?10:o>=ve?5:o>=_e?2:1;let u,s,l;return i<0?(l=Math.pow(10,-i)/a,u=Math.round(t*l),s=Math.round(e*l),u/le&&--s,l=-l):(l=Math.pow(10,i)*a,u=Math.round(t/l),s=Math.round(e/l),u*le&&--s),s0))return[];if((t=+t)===(e=+e))return[t];const r=e=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function Me(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 Ee(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0,i=arguments.length>4?arguments[4]:void 0;if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?me:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te;if(t===te)return me;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||0===r?r:(0===t(n,n))-(0===t(e,e))}}(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,u=Math.log(o),s=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);Ee(t,e,Math.max(n,Math.floor(e-a*s/o+l)),Math.min(r,Math.floor(e+(o-a)*s/o+l)),i)}const o=t[e];let a=n,u=r;for(De(t,n,e),i(t[r],o)>0&&De(t,n,r);a0;)--u}0===i(t[n],o)?De(t,n,u):(++u,De(t,u,r)),u<=e&&(n=u+1),e<=u&&(r=u-1)}return t}function De(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Ce(t,e,n){if(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)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return Me(t);if(e>=1)return Ae(t);var r,i=(r-1)*e,o=Math.floor(i),a=Ae(Ee(t,o).subarray(0,o+1));return a+(Me(t.subarray(o+1))-a)*(i-o)}}function Fe(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ie;if((r=t.length)&&!isNaN(e=+e)){if(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,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function Se(t,e){return Ce(t,.5,e)}function $e(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function Te(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)),o=new Array(i);++r1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Oe(t){return(t=ze(Math.abs(t)))?t[1]:NaN}var Re,Ue=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){if(!(e=Ue.exec(t)))throw new Error("invalid format: "+t);var e;return new qe({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 qe(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 Pe(t,e){var n=ze(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")}Le.prototype=qe.prototype,qe.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 je={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Pe(100*t,e),r:Pe,s:function(t,e){var n=ze(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Re=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ze(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ie(t){return t}var We,He,Ye,Ge=Array.prototype.map,Ve=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xe(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ie:(e=Ge.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ie:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ge.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=Le(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):je[v]||(void 0===m&&(m=12),y=!0,v="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?o:/[%p]/.test(v)?s:"",b=je[v],w=/[defgprs%]/.test(v);function k(t){var i,o,s,h=_,k=x;if("c"===v)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===v?Ve[8+Re/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return u(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=f(((t=Le(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Oe(e)/3))),i=Math.pow(10,-r),o=Ve[8+r/3];return function(t){return n(i*t)+o}}}}function Je(t){return Math.max(0,-Oe(Math.abs(t)))}function Ze(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Oe(e)/3)))-Oe(Math.abs(t)))}function Qe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Oe(e)-Oe(t))+1}!function(t){We=Xe(t),He=We.format,Ye=We.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const Ke=new Date,tn=new Date;function en(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n0))return a;let u;do{a.push(u=new Date(+n)),e(n,o),t(n)}while(uen((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((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=(e,r)=>(Ke.setTime(+e),tn.setTime(+r),t(Ke),t(tn),Math.floor(n(Ke,tn))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const nn=en((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));nn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?en((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):nn:null),nn.range;const rn=1e3,on=60*rn,an=60*on,un=24*an,sn=7*un,ln=30*un,cn=365*un,fn=en((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*rn)}),((t,e)=>(e-t)/rn),(t=>t.getUTCSeconds()));fn.range;const hn=en((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*rn)}),((t,e)=>{t.setTime(+t+e*on)}),((t,e)=>(e-t)/on),(t=>t.getMinutes()));hn.range;const dn=en((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*on)}),((t,e)=>(e-t)/on),(t=>t.getUTCMinutes()));dn.range;const pn=en((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*rn-t.getMinutes()*on)}),((t,e)=>{t.setTime(+t+e*an)}),((t,e)=>(e-t)/an),(t=>t.getHours()));pn.range;const gn=en((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*an)}),((t,e)=>(e-t)/an),(t=>t.getUTCHours()));gn.range;const mn=en((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*on)/un),(t=>t.getDate()-1));mn.range;const yn=en((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/un),(t=>t.getUTCDate()-1));yn.range;const vn=en((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/un),(t=>Math.floor(t/un)));function _n(t){return en((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*on)/sn))}vn.range;const xn=_n(0),bn=_n(1),wn=_n(2),kn=_n(3),An=_n(4),Mn=_n(5),En=_n(6);function Dn(t){return en((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/sn))}xn.range,bn.range,wn.range,kn.range,An.range,Mn.range,En.range;const Cn=Dn(0),Fn=Dn(1),Sn=Dn(2),$n=Dn(3),Tn=Dn(4),Bn=Dn(5),Nn=Dn(6);Cn.range,Fn.range,Sn.range,$n.range,Tn.range,Bn.range,Nn.range;const zn=en((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()));zn.range;const On=en((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()));On.range;const Rn=en((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Rn.every=t=>isFinite(t=Math.floor(t))&&t>0?en((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Rn.range;const Un=en((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Ln(t,e,n,r,i,o){const a=[[fn,1,rn],[fn,5,5*rn],[fn,15,15*rn],[fn,30,30*rn],[o,1,on],[o,5,5*on],[o,15,15*on],[o,30,30*on],[i,1,an],[i,3,3*an],[i,6,6*an],[i,12,12*an],[r,1,un],[r,2,2*un],[n,1,sn],[e,1,ln],[e,3,3*ln],[t,1,cn]];function u(e,n,r){const i=Math.abs(n-e)/r,o=ne((t=>{let[,,e]=t;return e})).right(a,i);if(o===a.length)return t.every(ke(e/cn,n/cn,r));if(0===o)return nn.every(Math.max(ke(e,n,r),1));const[u,s]=a[i/a[o-1][2]isFinite(t=Math.floor(t))&&t>0?en((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Un.range;const[qn,Pn]=Ln(Un,On,Cn,vn,gn,dn),[jn,In]=Ln(Rn,zn,xn,mn,pn,hn),Wn="year",Hn="quarter",Yn="month",Gn="week",Vn="date",Xn="day",Jn="dayofyear",Zn="hours",Qn="minutes",Kn="seconds",tr="milliseconds",er=[Wn,Hn,Yn,Gn,Vn,Xn,Jn,Zn,Qn,Kn,tr],nr=er.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function rr(t){const e=V(t).slice(),n={};e.length||u("Missing time unit."),e.forEach((t=>{lt(nr,t)?n[t]=1:u(`Invalid time unit: ${t}.`)}));return(n[Gn]||n[Xn]?1:0)+(n[Hn]||n[Yn]||n[Vn]?1:0)+(n[Jn]?1:0)>1&&u(`Incompatible time units: ${t}`),e.sort(((t,e)=>nr[t]-nr[e])),e}const ir={[Wn]:"%Y ",[Hn]:"Q%q ",[Yn]:"%b ",[Vn]:"%d ",[Gn]:"W%U ",[Xn]:"%a ",[Jn]:"%j ",[Zn]:"%H:00",[Qn]:"00:%M",[Kn]:":%S",[tr]:".%L",[`${Wn}-${Yn}`]:"%Y-%m ",[`${Wn}-${Yn}-${Vn}`]:"%Y-%m-%d ",[`${Zn}-${Qn}`]:"%H:%M"};function or(t,e){const n=ot({},ir,e),r=rr(t),i=r.length;let o,a,u="",s=0;for(s=0;ss;--o)if(a=r.slice(s,o).join("-"),null!=n[a]){u+=n[a],s=o;break}return u.trim()}const ar=new Date;function ur(t){return ar.setFullYear(t),ar.setMonth(0),ar.setDate(1),ar.setHours(0,0,0,0),ar}function sr(t){return cr(new Date(t))}function lr(t){return fr(new Date(t))}function cr(t){return mn.count(ur(t.getFullYear())-1,t)}function fr(t){return xn.count(ur(t.getFullYear())-1,t)}function hr(t){return ur(t).getDay()}function dr(t,e,n,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,e,n,r,i,o,a);return u.setFullYear(t),u}return new Date(t,e,n,r,i,o,a)}function pr(t){return mr(new Date(t))}function gr(t){return yr(new Date(t))}function mr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return yn.count(e-1,t)}function yr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Cn.count(e-1,t)}function vr(t){return ar.setTime(Date.UTC(t,0,1)),ar.getUTCDay()}function _r(t,e,n,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,i,o,a));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,i,o,a))}function xr(t,e,n,r,i){const o=e||1,a=F(t),u=(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===a&&o,e),s=new Date,l=Nt(t),c=l[Wn]?u(Wn):rt(2012),f=l[Yn]?u(Yn):l[Hn]?u(Hn):h,p=l[Gn]&&l[Xn]?u(Xn,1,Gn+Xn):l[Gn]?u(Gn,1):l[Xn]?u(Xn,1):l[Vn]?u(Vn,1):l[Jn]?u(Jn,1):d,g=l[Zn]?u(Zn):h,m=l[Qn]?u(Qn):h,y=l[Kn]?u(Kn):h,v=l[tr]?u(tr):h;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),p(s,e),g(s),m(s),y(s),v(s))}}function br(t,e,n){return e+7*t-(n+6)%7}const wr={[Wn]:t=>t.getFullYear(),[Hn]:t=>Math.floor(t.getMonth()/3),[Yn]:t=>t.getMonth(),[Vn]:t=>t.getDate(),[Zn]:t=>t.getHours(),[Qn]:t=>t.getMinutes(),[Kn]:t=>t.getSeconds(),[tr]:t=>t.getMilliseconds(),[Jn]:t=>cr(t),[Gn]:t=>fr(t),[Gn+Xn]:(t,e)=>br(fr(t),t.getDay(),hr(e)),[Xn]:(t,e)=>br(1,t.getDay(),hr(e))},kr={[Hn]:t=>3*t,[Gn]:(t,e)=>br(t,0,hr(e))};function Ar(t,e){return xr(t,e||1,wr,kr,dr)}const Mr={[Wn]:t=>t.getUTCFullYear(),[Hn]:t=>Math.floor(t.getUTCMonth()/3),[Yn]:t=>t.getUTCMonth(),[Vn]:t=>t.getUTCDate(),[Zn]:t=>t.getUTCHours(),[Qn]:t=>t.getUTCMinutes(),[Kn]:t=>t.getUTCSeconds(),[tr]:t=>t.getUTCMilliseconds(),[Jn]:t=>mr(t),[Gn]:t=>yr(t),[Xn]:(t,e)=>br(1,t.getUTCDay(),vr(e)),[Gn+Xn]:(t,e)=>br(yr(t),t.getUTCDay(),vr(e))},Er={[Hn]:t=>3*t,[Gn]:(t,e)=>br(t,0,vr(e))};function Dr(t,e){return xr(t,e||1,Mr,Er,_r)}const Cr={[Wn]:Rn,[Hn]:zn.every(3),[Yn]:zn,[Gn]:xn,[Vn]:mn,[Xn]:mn,[Jn]:mn,[Zn]:pn,[Qn]:hn,[Kn]:fn,[tr]:nn},Fr={[Wn]:Un,[Hn]:On.every(3),[Yn]:On,[Gn]:Cn,[Vn]:yn,[Xn]:yn,[Jn]:yn,[Zn]:gn,[Qn]:dn,[Kn]:fn,[tr]:nn};function Sr(t){return Cr[t]}function $r(t){return Fr[t]}function Tr(t,e,n){return t?t.offset(e,n):void 0}function Br(t,e,n){return Tr(Sr(t),e,n)}function Nr(t,e,n){return Tr($r(t),e,n)}function zr(t,e,n,r){return t?t.range(e,n,r):void 0}function Or(t,e,n,r){return zr(Sr(t),e,n,r)}function Rr(t,e,n,r){return zr($r(t),e,n,r)}const Ur=1e3,Lr=6e4,qr=36e5,Pr=864e5,jr=2592e6,Ir=31536e6,Wr=[Wn,Yn,Vn,Zn,Qn,Kn,tr],Hr=Wr.slice(0,-1),Yr=Hr.slice(0,-1),Gr=Yr.slice(0,-1),Vr=Gr.slice(0,-1),Xr=[Wn,Yn],Jr=[Wn],Zr=[[Hr,1,Ur],[Hr,5,5e3],[Hr,15,15e3],[Hr,30,3e4],[Yr,1,Lr],[Yr,5,3e5],[Yr,15,9e5],[Yr,30,18e5],[Gr,1,qr],[Gr,3,108e5],[Gr,6,216e5],[Gr,12,432e5],[Vr,1,Pr],[[Wn,Gn],1,6048e5],[Xr,1,jr],[Xr,3,7776e6],[Jr,1,Ir]];function Qr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(Ct(e))/n;let i,o,a=ne((t=>t[2])).right(Zr,r);return a===Zr.length?(i=Jr,o=ke(e[0]/Ir,e[1]/Ir,n)):a?(a=Zr[r/Zr[a-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ao,s:Mo,S:Wi,u:Hi,U:Yi,V:Vi,w:Xi,W:Ji,x:null,X:null,y:Zi,Y:Ki,Z:eo,"%":ko},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:no,e:no,f:uo,g:_o,G:bo,H:ro,I:io,j:oo,L:ao,m:so,M:lo,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ao,s:Mo,S:co,u:fo,U:ho,V:go,w:mo,W:yo,x:null,X:null,y:vo,Y:xo,Z:wo,"%":ko},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(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.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=v.get(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.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Ei,e:Ei,f:Ti,g:wi,G:bi,H:Ci,I:Ci,j:Di,L:$i,m:Mi,M:Fi,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:Ai,Q:Ni,s:zi,S:Si,u:yi,U:vi,V:_i,w:mi,W:xi,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:wi,Y:bi,Z:ki,"%":Bi};function w(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=ti(ei(o.y,0,1))).getUTCDay(),r=i>4||0===i?Fn.ceil(r):Fn(r),r=yn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Kr(ei(o.y,0,1))).getDay(),r=i>4||0===i?bn.ceil(r):bn(r),r=mn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?ti(ei(o.y,0,1)).getUTCDay():Kr(ei(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,ti(o)):Kr(o)}}function A(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=b[i in si?e.charAt(a++):i])||(r=o(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=k(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=k(t+="",!0);return e.toString=function(){return t},e}}}var ri,ii,oi,ai,ui,si={"-":"",_:" ",0:"0"},li=/^\s*\d+/,ci=/^%/,fi=/[\\^$*+?|[\]().{}]/g;function hi(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function mi(t,e,n){var r=li.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function yi(t,e,n){var r=li.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function vi(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function _i(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function xi(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function bi(t,e,n){var r=li.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function wi(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ki(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 Ai(t,e,n){var r=li.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Mi(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ei(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Di(t,e,n){var r=li.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ci(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Fi(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Si(t,e,n){var r=li.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function $i(t,e,n){var r=li.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ti(t,e,n){var r=li.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Bi(t,e,n){var r=ci.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ni(t,e,n){var r=li.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function zi(t,e,n){var r=li.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Oi(t,e){return hi(t.getDate(),e,2)}function Ri(t,e){return hi(t.getHours(),e,2)}function Ui(t,e){return hi(t.getHours()%12||12,e,2)}function Li(t,e){return hi(1+mn.count(Rn(t),t),e,3)}function qi(t,e){return hi(t.getMilliseconds(),e,3)}function Pi(t,e){return qi(t,e)+"000"}function ji(t,e){return hi(t.getMonth()+1,e,2)}function Ii(t,e){return hi(t.getMinutes(),e,2)}function Wi(t,e){return hi(t.getSeconds(),e,2)}function Hi(t){var e=t.getDay();return 0===e?7:e}function Yi(t,e){return hi(xn.count(Rn(t)-1,t),e,2)}function Gi(t){var e=t.getDay();return e>=4||0===e?An(t):An.ceil(t)}function Vi(t,e){return t=Gi(t),hi(An.count(Rn(t),t)+(4===Rn(t).getDay()),e,2)}function Xi(t){return t.getDay()}function Ji(t,e){return hi(bn.count(Rn(t)-1,t),e,2)}function Zi(t,e){return hi(t.getFullYear()%100,e,2)}function Qi(t,e){return hi((t=Gi(t)).getFullYear()%100,e,2)}function Ki(t,e){return hi(t.getFullYear()%1e4,e,4)}function to(t,e){var n=t.getDay();return hi((t=n>=4||0===n?An(t):An.ceil(t)).getFullYear()%1e4,e,4)}function eo(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+hi(e/60|0,"0",2)+hi(e%60,"0",2)}function no(t,e){return hi(t.getUTCDate(),e,2)}function ro(t,e){return hi(t.getUTCHours(),e,2)}function io(t,e){return hi(t.getUTCHours()%12||12,e,2)}function oo(t,e){return hi(1+yn.count(Un(t),t),e,3)}function ao(t,e){return hi(t.getUTCMilliseconds(),e,3)}function uo(t,e){return ao(t,e)+"000"}function so(t,e){return hi(t.getUTCMonth()+1,e,2)}function lo(t,e){return hi(t.getUTCMinutes(),e,2)}function co(t,e){return hi(t.getUTCSeconds(),e,2)}function fo(t){var e=t.getUTCDay();return 0===e?7:e}function ho(t,e){return hi(Cn.count(Un(t)-1,t),e,2)}function po(t){var e=t.getUTCDay();return e>=4||0===e?Tn(t):Tn.ceil(t)}function go(t,e){return t=po(t),hi(Tn.count(Un(t),t)+(4===Un(t).getUTCDay()),e,2)}function mo(t){return t.getUTCDay()}function yo(t,e){return hi(Fn.count(Un(t)-1,t),e,2)}function vo(t,e){return hi(t.getUTCFullYear()%100,e,2)}function _o(t,e){return hi((t=po(t)).getUTCFullYear()%100,e,2)}function xo(t,e){return hi(t.getUTCFullYear()%1e4,e,4)}function bo(t,e){var n=t.getUTCDay();return hi((t=n>=4||0===n?Tn(t):Tn.ceil(t)).getUTCFullYear()%1e4,e,4)}function wo(){return"+0000"}function ko(){return"%"}function Ao(t){return+t}function Mo(t){return Math.floor(+t/1e3)}function Eo(t){const e={};return n=>e[n]||(e[n]=t(n))}function Do(t){const e=Eo(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=Le(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),i=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(i);if(n<0)return e;let o=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const a=on;)if("0"!==e[o]){++o;break}return e.slice(0,o)+a}}return e(n);var r,i},formatSpan(t,r,i,o){o=Le(null==o?",f":o);const a=ke(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=Ze(a,u))||(o.precision=s),n(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=Qe(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=Je(a))||(o.precision=s-2*("%"===o.type))}return e(o)}}}let Co,Fo;function So(){return Co=Do({format:He,formatPrefix:Ye})}function $o(t){return Do(Xe(t))}function To(t){return arguments.length?Co=$o(t):Co}function Bo(t,e,n){A(n=n||{})||u(`Invalid time multi-format specifier: ${n}`);const r=e(Kn),i=e(Qn),o=e(Zn),a=e(Vn),s=e(Gn),l=e(Yn),c=e(Hn),f=e(Wn),h=t(n[tr]||".%L"),d=t(n[Kn]||":%S"),p=t(n[Qn]||"%I:%M"),g=t(n[Zn]||"%I %p"),m=t(n[Vn]||n[Xn]||"%a %d"),y=t(n[Gn]||"%b %d"),v=t(n[Yn]||"%B"),_=t(n[Hn]||"%B"),x=t(n[Wn]||"%Y");return t=>(r(t)xt(t)?e(t):Bo(e,Sr,t),utcFormat:t=>xt(t)?n(t):Bo(n,$r,t),timeParse:Eo(t.parse),utcParse:Eo(t.utcParse)}}function zo(){return Fo=No({format:ii,parse:oi,utcFormat:ai,utcParse:ui})}function Oo(t){return No(ni(t))}function Ro(t){return arguments.length?Fo=Oo(t):Fo}!function(t){ri=ni(t),ii=ri.format,oi=ri.parse,ai=ri.utcFormat,ui=ri.utcParse}({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"]}),So(),zo();const Uo=(t,e)=>ot({},t,e);function Lo(t,e){const n=t?$o(t):To(),r=e?Oo(e):Ro();return Uo(n,r)}function qo(t,e){const n=arguments.length;return n&&2!==n&&u("defaultLocale expects either zero or two arguments."),n?Uo(To(t),Ro(e)):Uo(To(),Ro())}const Po=/^(data:|([A-Za-z]+:)?\/\/)/,jo=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Io=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Wo="file://";async function Ho(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function Yo(t,e){e=ot({},this.options,e);const n=this.fileAccess,r={href:null};let i,o,a;const s=jo.test(t.replace(Io,""));null!=t&&"string"==typeof t&&s||u("Sanitize failure, invalid URI: "+Ft(t));const l=Po.test(t);return(a=e.baseURL)&&!l&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith(Wo))||"file"===e.mode||"http"!==e.mode&&!l&&n,i?t=t.slice(Wo.length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),o=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),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 Go(t){return t?e=>new Promise(((n,r)=>{t.readFile(e,((t,e)=>{t?r(t):n(e)}))})):Vo}async function Vo(){u("No file system access.")}function Xo(t){return t?async function(e,n){const r=ot({},this.options.http,n),i=n&&n.response,o=await t(e,r);return o.ok?J(o[i])?o[i]():o.text():u(o.status+""+o.statusText)}:Jo}async function Jo(){u("No HTTP fetch method available.")}const Zo=t=>null!=t&&t==t,Qo=t=>!(Number.isNaN(+t)||t instanceof Date),Ko={boolean:St,integer:S,number:S,date:Tt,string:Bt,unknown:f},ta=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>Qo(t)&&Number.isInteger(+t),Qo,t=>!Number.isNaN(Date.parse(t))],ea=["boolean","integer","number","date"];function na(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=ta.length,i=ta.map(((t,e)=>e+1));for(let o,a,u=0,s=0;u0===t?e:t),0)-1]}function ra(t,e){return e.reduce(((e,n)=>(e[n]=na(t,n),e)),{})}function ia(t){const e=function(e,n){const r={delimiter:t};return oa(e,n?ot(n,r):r)};return e.responseType="text",e}function oa(t,e){return e.header&&(t=e.header.map(Ft).join(e.delimiter)+"\n"+t),Yt(e.delimiter).parse(t+"")}function aa(t,e){const n=e&&e.property?l(e.property):f;return!A(t)||(r=t,"function"==typeof Buffer&&J(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){!k(t)&&yt(t)&&(t=[...t]);return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t),e);var r}oa.responseType="text",aa.responseType="json";const ua={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function sa(t,e){let n,r,i,o;return t=aa(t,e),e&&e.feature?(n=Vt,i=e.feature):e&&e.mesh?(n=Qt,i=e.mesh,o=ua[e.filter]):u("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):u("Invalid TopoJSON object: "+i),r&&r.features||[r]}sa.responseType="json";const la={dsv:oa,csv:ia(","),tsv:ia("\t"),json:aa,topojson:sa};function ca(t,e){return arguments.length>1?(la[t]=e,this):lt(la,t)?la[t]:null}function fa(t){const e=ca(t);return e&&e.responseType||"text"}function ha(t,e,n,r){const i=ca((e=e||{}).type||"json");return i||u("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=Ro();n=n||i.timeParse,r=r||i.utcParse;let o,a,u,s,l,c,f=t.columns||Object.keys(t[0]);"auto"===e&&(e=ra(t,f));f=Object.keys(e);const h=f.map((t=>{const i=e[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:"))){o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===o[0]?r:n)(a)}if(!Ko[i])throw Error("Illegal format pattern: "+t+":"+i);return Ko[i]}));for(u=0,l=t.length,c=f.length;u({options:n||{},sanitize:Yo,load:Ho,fileAccess:!!e,file:Go(e),http:Xo(t)})}("undefined"!=typeof fetch&&fetch,null);function pa(t){const e=t||f,n=[],r={};return n.add=t=>{const i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=t=>{const i=e(t);if(r[i]){r[i]=0;const e=n.indexOf(t);e>=0&&n.splice(e,1)}return n},n}async function ga(t,e){try{await e(t)}catch(e){t.error(e)}}const ma=Symbol("vega_id");let ya=1;function va(t){return!(!t||!_a(t))}function _a(t){return t[ma]}function xa(t,e){return t[ma]=e,t}function ba(t){const e=t===Object(t)?t:{data:t};return _a(e)?e:xa(e,ya++)}function wa(t){return ka(t,ba({}))}function ka(t,e){for(const n in t)e[n]=t[n];return e}function Aa(t,e){return xa(e,_a(t))}function Ma(t,e){return t?e?(n,r)=>t(n,r)||_a(e(n))-_a(e(r)):(e,n)=>t(e,n)||_a(e)-_a(n):null}function Ea(t){return t&&t.constructor===Da}function Da(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:Da,insert(e){const n=V(e),r=n.length;for(let e=0;e{p(t)&&(l[_a(t)]=-1)}));for(f=0,h=t.length;f0&&(y(g,p,d.value),u.modifies(p));for(f=0,h=i.length;f{p(t)&&l[_a(t)]>0&&y(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=e.length||r.length?s.filter((t=>l[_a(t)]>0)):s.slice();else for(m in c)u.mod.push(c[m]);return(o||null==o&&(e.length||r.length))&&u.clean(!0),u}}}const Ca="_:mod:_";function Fa(){Object.defineProperty(this,Ca,{writable:!0,value:{}})}Fa.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[Ca];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=k(n)?1+n.length:-1),i},modified(t,e){const n=this[Ca];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(k(t)){for(let e=0;e=0?e+1{a instanceof Ta?(a!==this&&(e&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:n})):r.set(t,n,a)};for(a in t)if(s=t[a],"pulse"===a)V(s).forEach((t=>{t instanceof Ta?t!==this&&(t.targets().add(this),o.push(t)):u("Pulse parameters must be operator instances.")})),this.source=s;else if(k(s))for(r.set(a,-1,Array(l=s.length)),c=0;c{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=Oa();return this.targets().add(Oa(null,null,it(t,(t=>{const n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},between(t,e){let n=!1;return t.targets().add(Oa(null,null,(()=>n=!0))),e.targets().add(Oa(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=p,this._targets=null}};const Ra={skip:!0};function Ua(t,e,n,r,i,o){const a=ot({},o,Ra);let u,s;J(n)||(n=rt(n)),void 0===r?u=e=>t.touch(n(e)):J(r)?(s=new Ta(null,r,i,!1),u=e=>{s.evaluate(e);const r=n(e),i=s.value;Ea(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=e=>t.update(n(e),r,a),e.apply(u)}function La(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},u=new Ta(null,function(t,e){return e=J(e)?e:rt(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);u.modified(a.force),u.rank=e.rank,e.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),t.connect(n,[u]))}}const qa={};function Pa(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}function ja(t,e){const n=[];return Ot(t,e,(t=>n.push(t))),n}function Ia(t,e){const n={};return t.visit(e,(t=>{n[_a(t)]=1})),t=>n[_a(t)]?null:t}function Wa(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function Ha(t,e,n,r){const i=this;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(const t of n)if(t.stamp===e){if(t.fields){const e=i.fields||(i.fields={});for(const n in t.fields)e[n]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function Ya(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Pa.prototype={StopPropagation:qa,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new Pa(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new Pa(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const 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,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Ia(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const e=this.fields||(this.fields={});return k(t)?t.forEach((t=>e[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?k(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=Wa(n.addF,e)),2&t&&(n.remF=Wa(n.remF,e)),4&t&&(n.modF=Wa(n.modF,e)),16&t&&(n.srcF=Wa(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=ja(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=ja(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=ja(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,e){const n=this,r=e;if(16&t)return Ot(n.source,n.srcF,r),n;1&t&&Ot(n.add,n.addF,r),2&t&&Ot(n.rem,n.remF,r),4&t&&Ot(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||Ot(i,t?Ia(n,5):n.srcF,r)}return n}},dt(Ha,Pa,{fork(t){const e=new Pa(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const e=this,n=e.fields;return n&&e.changes&e.MOD?k(t)?t.some((t=>n[t])):n[t]:0},filter(){u("MultiPulse does not support filtering.")},materialize(){u("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,i=r.length;let o=0;if(t&n.SOURCE)for(;oe=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Xa(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,i=t.length,o=t[e];let a,u=1+(e<<1);for(;u=0&&(u=a),t[e]=t[u],u=1+((e=u)<<1);t[e]=o,Xa(t,r,e,n)}(e,0,t)):r=n,r}}}function Xa(t,e,n,r){let i,o;const a=t[n];for(;n>e&&(o=n-1>>1,i=t[o],r(a,i)<0);)t[n]=i,n=o;return t[n]=a}function Ja(){this.logger(w()),this.logLevel(v),this._clock=0,this._rank=0,this._locale=qo();try{this._loader=da()}catch(t){}this._touched=pa(c),this._input={},this._pulse=null,this._heap=Va(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function Za(t){return function(){return this._log[t].apply(this,arguments)}}function Qa(t,e){Ta.call(this,t,null,e)}Ja.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Za("error"),warn:Za("warn"),info:Za("info"),debug:Za("debug"),logLevel:Za("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof Ta?i=t:t&&t.prototype instanceof Ta?i=new t:J(t)?i=new Ta(null,t):(o=0,i=new Ta(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let i=0;i=0;)e.push(n=r[i]),n===t&&u("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||Ga);const r=new Pa(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},touch:function(t,e){const n=e||Ga;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||Ga;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:Da,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const n=this.locale();return ha(t,e,n.timeParse,n.utcParse)},preload:async function(t,e,n){const r=this,i=r._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const o=await r.request(e,n);return r.pulse(t,r.changeset().remove(p).insert(o.data||[])),i.done(),o},request:async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:fa(e&&e.type)});try{r=n.parse(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}},events:function(t,e,n,r){const i=this,o=Oa(n,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):V(t);const s=u.length;for(let t=0;tr._enqueue(t,!0))),r._touched=pa(c);let a,u,s,l=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=qa),u!==qa&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++l):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${l} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,e)=>e.priority-t.priority));r._postrun=[];for(let e=0;er.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,e,n){return this._pulse?Ya(this):(this.evaluate(t,e,n),this)},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},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)}},_enqueue:function(t,e){const n=t.stampt.pulse)),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==qa&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},dt(Qa,Ta,{run(t){if(t.stampthis.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const Ka={};function tu(t){const e=eu(t);return e&&e.Definition||null}function eu(t){return t=t&&t.toLowerCase(),lt(Ka,t)?Ka[t]:null}function*nu(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function ru(t,e,n){const r=Float64Array.from(nu(t,n));return r.sort(te),e.map((t=>Fe(r,t)))}function iu(t,e){return ru(t,[.25,.5,.75],e)}function ou(t,e){const n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let u of t)null!=(u=e(u,++a,t))&&(u=+u)>=u&&(n=u-i,i+=n/++r,o+=n*(u-i))}if(r>1)return o/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=iu(t,e),o=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function au(t){const e=t.maxbins||20,n=t.base||10,r=Math.log(n),i=t.divide||[5,2];let o,a,u,s,l,c,f=t.extent[0],h=t.extent[1];const d=t.span||h-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(s=d/e,l=0,c=t.steps.length;le;)o*=n;for(l=0,c=i.length;l=u&&d/s<=e&&(o=s)}s=Math.log(o);const p=s>=0?0:1+~~(-s/r),g=Math.pow(n,-p-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(f/o+g)*o,f=ft);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,l=r(t[0]),c=l,f=l+e;for(;s=f){for(c=(l+c)/2;u>1);ia;)t[i--]=t[o]}o=a,a=r}return t}(o,e+e/4):o}t.random=Math.random;const lu=Math.sqrt(2*Math.PI),cu=Math.SQRT2;let fu=NaN;function hu(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(fu==fu)o=fu,fu=NaN;else{do{o=2*t.random()-1,a=2*t.random()-1,r=o*o+a*a}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),o*=i,fu=a*i}return e+o*n}function du(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*lu)}function pu(t,e,n){const r=(t-(e=e||0))/(n=null==n?1:n),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let e;i<7.07106781186547?(e=.0352624965998911*i+.700383064443688,e=e*i+6.37396220353165,e=e*i+33.912866078383,e=e*i+112.079291497871,e=e*i+221.213596169931,e=e*i+220.206867912376,o=t*e,e=.0883883476483184*i+1.75566716318264,e=e*i+16.064177579207,e=e*i+86.7807322029461,e=e*i+296.564248779674,e=e*i+637.333633378831,e=e*i+793.826512519948,e=e*i+440.413735824752,o/=e):(e=i+.65,e=i+4/e,e=i+3/e,e=i+2/e,e=i+1/e,o=t/e/2.506628274631)}return r>0?1-o:o}function gu(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*cu*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 mu(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>hu(n,r),pdf:t=>du(t,n,r),cdf:t=>pu(t,n,r),icdf:t=>gu(t,n,r)};return i.mean(t).stdev(e)}function yu(e,n){const r=mu();let i=0;const o={data(t){return arguments.length?(e=t,i=t?t.length:0,o.bandwidth(n)):e},bandwidth(t){return arguments.length?(!(n=t)&&e&&(n=ou(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;avu(n,r),pdf:t=>_u(t,n,r),cdf:t=>xu(t,n,r),icdf:t=>bu(t,n,r)};return i.mean(t).stdev(e)}function ku(e,n){let r,i=0;const o={weights(t){return arguments.length?(r=function(t){const e=[];let n,r=0;for(n=0;n=e&&t<=n?1/(n-e):0}function Eu(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Du(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Cu(t,e){let n,r;const i={min(t){return arguments.length?(n=t||0,i):n},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Au(n,r),pdf:t=>Mu(t,n,r),cdf:t=>Eu(t,n,r),icdf:t=>Du(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Fu(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]}function Su(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,o=new Float64Array(i),a=new Float64Array(i);let u,s,l,c=0,f=0,h=0;for(l of t)o[c]=u=+e(l),a[c]=s=+n(l),++c,f+=(u-f)/c,h+=(s-h)/c;for(c=0;c=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function Tu(t,e,n,r,i){let o=0,a=0;return $u(t,e,n,((t,e)=>{const n=e-i(t),u=e-r;o+=n*n,a+=u*u})),1-o/a}function Bu(t,e,n){let r=0,i=0,o=0,a=0,u=0;$u(t,e,n,((t,e)=>{++u,r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=Fu(r,i,o,a),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Tu(t,e,n,i,l)}}function Nu(t,e,n){let r=0,i=0,o=0,a=0,u=0;$u(t,e,n,((t,e)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=Fu(r,i,o,a),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Tu(t,e,n,i,l)}}function zu(t,e,n){const[r,i,o,a]=Su(t,e,n);let u,s,l,c=0,f=0,h=0,d=0,p=0;$u(t,e,n,((t,e)=>{u=r[p++],s=Math.log(e),l=u*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(u*l-d)/p}));const[g,m]=Fu(f/a,c/a,h/a,d/a),y=t=>Math.exp(g+m*(t-o));return{coef:[Math.exp(g-m*o),m],predict:y,rSquared:Tu(t,e,n,a,y)}}function Ou(t,e,n){let r=0,i=0,o=0,a=0,u=0,s=0;$u(t,e,n,((t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,o+=(n*l-o)/s,a+=(n*n-a)/s,u+=(e-u)/s}));const l=Fu(r,i,o,a),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Tu(t,e,n,u,c)}}function Ru(t,e,n){const[r,i,o,a]=Su(t,e,n),u=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s_*(t-=o)*t+x*t+b+a;return{coef:[b-x*o+_*o*o+a,x-2*_*o,_],predict:w,rSquared:Tu(t,e,n,a,w)}}function Uu(t,e,n,r){if(1===r)return Bu(t,e,n);if(2===r)return Ru(t,e,n);const[i,o,a,u]=Su(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;hMath.abs(t[r][a])&&(a=i);for(o=r;o=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(u=0,o=i+1;o{t-=a;let e=u+y[0]+y[1]*t+y[2]*t*t;for(h=3;h=0;--o)for(u=e[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(n,a)*s;return i[0]+=r,i}const qu=2,Pu=1e-12;function ju(t,e,n,r){const[i,o,a,u]=Su(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<=qu;){const e=[0,l-1];for(let t=0;ti[a]-n?r:a;let s=0,l=0,d=0,p=0,g=0;const m=1/Math.abs(i[u]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=Iu(Math.abs(n-e)*m)*h[t],u=e*a;s+=a,l+=u,d+=r*a,p+=r*u,g+=e*u}const[y,v]=Fu(l/s,d/s,p/s,g/s);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),Wu(i,t+1,e)}if(t===qu)break;const n=Se(f);if(Math.abs(n)=1?Pu:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,o=[];let a,u=0,s=0,l=[];for(;u=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const Hu=.5*Math.PI/180;function Yu(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],u=a-o,s=u/r,l=[i(o)],c=[];if(n===r){for(let t=1;t0;)c.push(i(o+t/n*u));let f=l[0],h=c[c.length-1];const d=1/u,p=function(t,e){let n=t,r=t;const i=e.length;for(let t=0;tr&&(r=i)}return 1/(r-n)}(f[1],c);for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&Gu(f,t,h,d,p)>Hu?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function Gu(t,e,n,r,i){const o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0])),a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0]));return Math.abs(o-a)}function Vu(t){return t&&t.length?1===t.length?t[0]:(e=t,t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r{},Zu={init:Ju,add:Ju,rem:Ju,idx:0},Qu={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.sum,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},Ku=Object.keys(Qu).filter((t=>"__count__"!==t));function ts(t,e){return Qu[t](e)}function es(t,e){return t.idx-e.idx}function ns(){this.valid=0,this.missing=0,this._ops.forEach((t=>t.init(this)))}function rs(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function is(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function os(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function as(t,e){const n=e||f,r=function(t){const e={};t.forEach((t=>e[t.name]=t));const n=t=>{t.req&&t.req.forEach((t=>{e[t]||n(e[t]=Qu[t]())}))};return t.forEach(n),Object.values(e).sort(es)}(t),i=t.slice().sort(es);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=ns,o.prototype.add=rs,o.prototype.rem=is,o.prototype.set=os,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function us(t){this._key=t?l(t):_a,this.reset()}[...Ku,"__count__"].forEach((t=>{Qu[t]=function(t,e){return n=>ot({name:t,out:n||t},Zu,e)}(t,Qu[t])}));const ss=us.prototype;function ls(t){Qa.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}ss.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},ss.add=function(t){this._add.push(t)},ss.rem=function(t){this._rem.push(t)},ss.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,e=this._rem,n=this._key,r=t.length,i=e.length,o=Array(r-i),a={};let u,s,l;for(u=0;u=0;)r=t(e[i])+"",lt(n,r)||(n[r]=1,++o);return o},ss.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=ut(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},ss.argmin=function(t){return this.extent(t)[0]||{}},ss.argmax=function(t){return this.extent(t)[1]||{}},ss.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},ss.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},ss.quartile=function(t){return this._get===t&&this._q||(this._q=iu(this.values(),t),this._get=t),this._q},ss.q1=function(t){return this.quartile(t)[0]},ss.q2=function(t){return this.quartile(t)[1]},ss.q3=function(t){return this.quartile(t)[2]},ss.ci=function(t){return this._get===t&&this._ci||(this._ci=uu(this.values(),1e3,.05,t),this._get=t),this._ci},ss.ci0=function(t){return this.ci(t)[0]},ss.ci1=function(t){return this.ci(t)[1]},ls.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ku},{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"}]},dt(ls,Qa,{transform(t,e){const 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()),e.clean()&&n._drop&&r.clean(!0).runAfter((()=>this.clean())),n.changes(r)},cross(){const t=this,e=t.value,n=t._dnames,r=n.map((()=>({}))),i=n.length;function o(t){let e,o,a,u;for(e in t)for(a=t[e].tuple,o=0;o{const e=n(t);return a(t),i.push(e),e})),this.cellkey=t.key?t.key:Vu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const s=t.fields||[null],l=t.ops||["count"],c=t.as||[],f=s.length,h={};let d,p,g,m,y,v;for(f!==l.length&&u("Unmatched number of fields and aggregate ops."),v=0;vas(t,t.field))),{}},cellkey:Vu(),cell(t,e){let n=this.value[t];return n?0===n.num&&this._drop&&n.stampo.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,e)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),e&&t&&i.sort(t),o.length&&(i=t?Mt(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function hs(t){Qa.call(this,[],t)}function ds(t){Ta.call(this,null,ps,t)}function ps(t){return this.value&&!t.modified()?this.value:Q(t.fields,t.orders)}function gs(t){Qa.call(this,null,t)}function ms(t){Qa.call(this,null,t)}cs.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"]}]},dt(cs,Qa,{transform(t,e){const n=!1!==t.interval,i=this._bins(t),o=i.start,a=i.step,u=t.as||["bin0","bin1"],s=u[0],l=u[1];let c;return c=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(r(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=i(t);t[s]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[s]=i(t)),e.modifies(n?u:s)},_bins(t){if(this.value&&!t.modified())return this.value;const i=t.field,o=au(t),a=o.step;let u,s,l=o.start,c=l+Math.ceil((o.stop-l)/a)*a;null!=(u=t.anchor)&&(s=u-(l+a*Math.floor((u-l)/a)),l+=s,c+=s);const f=function(t){let e=S(i(t));return null==e?null:ec?1/0:(e=Math.max(l,Math.min(e,c-a)),l+a*Math.floor(1e-14+(e-l)/a))};return f.start=l,f.stop=o.stop,f.step=a,this.value=e(f,r(i),t.name||"bin_"+n(i))}}),hs.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},dt(hs,Qa,{transform(t,e){const n=e.fork(e.ALL),r=fs(_a,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(Ma(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),dt(ds,Ta),gs.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"]}]},dt(gs,Qa,{transform(t,e){const n=e=>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)}(u(n),t.case,o)||[],s=0,l=i.length;si[t]=1+(i[t]||0))),c=n((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)},_parameterCheck(t,e){let 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},_finish(t,e){const n=this._counts,r=this._tuples||(this._tuples={}),i=e[0],o=e[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,l;for(u in n)s=r[u],l=n[u]||0,!s&&l?(r[u]=s=ba({}),s[i]=u,s[o]=l,a.add.push(s)):0===l?(s&&a.rem.push(s),n[u]=null,r[u]=null):s[o]!==l&&(s[o]=l,a.mod.push(s));return a.modifies(e)}}),ms.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},dt(ms,Qa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(n.rem=u),u=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],u={},s=t.length,l=0;lbs(t,e)))):typeof r[n]===_s&&r[n](t[n]);return r}function ws(t){Qa.call(this,null,t)}const ks=[{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}]}],As={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ks},{name:"weights",type:"number",array:!0}]};function Ms(t,e){return t?t.map(((t,r)=>e[r]||n(t))):null}function Es(t,e,n){const r=[],i=t=>t(s);let o,a,u,s,l,c;if(null==e)r.push(t.map(n));else for(o={},a=0,u=t.length;at.materialize(t.SOURCE).source}(e)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&u("Invalid density method: "+a),t.extent||r.data||u("Missing density extent parameter."),a=r[a];const s=t.as||["value","density"],l=Yu(a,t.extent||at(r.data()),i,o).map((t=>{const e={};return e[s[0]]=t[0],e[s[1]]=t[1],ba(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function Ds(t){Qa.call(this,null,t)}Ds.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"}]};function Cs(t){Ta.call(this,null,Fs,t),this.modified(!0)}function Fs(t){const i=t.expr;return this.value&&!t.modified("expr")?this.value:e((e=>i(e,t)),r(i),n(i))}function Ss(t){Qa.call(this,[void 0,void 0],t)}function $s(t,e){Ta.call(this,t),this.parent=e,this.count=0}function Ts(t){Qa.call(this,{},t),this._keys=ft();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nl(t))):l(t.name,t.as)}function zs(t){Qa.call(this,ft(),t)}function Os(t){Qa.call(this,[],t)}function Rs(t){Qa.call(this,[],t)}function Us(t){Qa.call(this,null,t)}function Ls(t){Qa.call(this,[],t)}dt(Ds,Qa,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=Es(e.source,t.groupby,f),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>Ct(at(t,e))/30)(n,o),u=Ma(((t,e)=>o(t)-o(e))),s=t.as||"bin",l=r.length;let c,h=1/0,d=-1/0,p=0;for(;pd&&(d=e),t[++c][s]=e}return this.value={start:h,stop:d,step:a},e.reflow(!0).modifies(s)}}),dt(Cs,Ta),Ss.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},dt(Ss,Qa,{transform(t,e){const r=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=r[0],u=r[1];if((o||null==a)&&(a=1/0,u=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=S(i(t));null!=e&&(eu&&(u=e))})),!Number.isFinite(a)||!Number.isFinite(u)){let t=n(i);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${a}, ${u}]`),a=u=void 0}this.value=[a,u]}}),dt($s,Ta,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),dt(Ts,Qa,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,u=lt(i,t)&&i[t];return u?u.value.stampt&&t.count>0));this.initTargets(t)}},initTargets(t){const e=this._targets,n=e.length,r=t?t.length:0;let i=0;for(;ithis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=_a(t),n=o.get(e);void 0!==n&&(o.delete(e),u(n).rem(t))})),e.visit(e.ADD,(t=>{const e=r(t);o.set(_a(t),e),u(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=_a(t),n=o.get(e),i=r(t);n===i?u(i).mod(t):(o.set(e,i),u(n).rem(t),u(i).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(t=>{u(o.get(_a(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=_a(t),n=o.get(e),i=r(t);n!==i&&(o.set(e,i),u(n).rem(t),u(i).add(t))})),e.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),e}}),dt(Bs,Ta),zs.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},dt(zs,Qa,{transform(t,e){const n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let l=!0;function c(e){const n=_a(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),o.push(e)):i||c?l&&i&&!c&&u.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,(t=>{const e=_a(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{s(e,t)?o.push(e):r.set(_a(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}}),Os.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}]},dt(Os,Qa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Ms(r,t.as||[]),o=t.index||null,a=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{const e=r.map((e=>e(t))),u=e.reduce(((t,e)=>Math.max(t,e.length)),0);let s,l,c,f=0;for(;f{for(let e,n=0;ne[r]=n(e,t)))}}),dt(Ls,Qa,{transform(t,e){const n=e.fork(e.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ba(r(t))),u.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(i):i}else o=u.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,u=u.slice(-s);return n.source=this.value=u,n}});const qs={value:"value",median:Se,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 o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:Me,max:Ae},Ps=[];function js(t){Qa.call(this,[],t)}function Is(t){ls.call(this,t)}function Ws(t){Qa.call(this,null,t)}function Hs(t){Ta.call(this,null,Ys,t)}function Ys(t){return this.value&&!t.modified()?this.value:bt(t.fields,t.flat)}function Gs(t){Qa.call(this,[],t),this._pending=null}function Vs(t,e,n){n.forEach(ba);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.rem.length&&r.clean(!0),r}function Xs(t){Qa.call(this,{},t)}function Js(t){Ta.call(this,null,Zs,t)}function Zs(t){if(this.value&&!t.modified())return this.value;const e=t.extents,n=e.length;let r,i,o=1/0,a=-1/0;for(r=0;ra&&(a=i[1]);return[o,a]}function Qs(t){Ta.call(this,null,Ks,t)}function Ks(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function tl(t){Qa.call(this,null,t)}function el(t){ls.call(this,t)}function nl(t){Ts.call(this,t)}function rl(t){Qa.call(this,null,t)}function il(t){Qa.call(this,null,t)}function ol(t){Qa.call(this,null,t)}js.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}]},dt(js,Qa,{transform(t,e){var r,i,o,a,s,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||qs.value;if(null!=qs[n])return n===qs.value?(e=void 0!==t.value?t.value:0,()=>e):qs[n];u("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=n(t.field),v=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,o,a,u,s,l,c,f,h=t=>t(f),d=[],p=r?r.slice():[],g={},m={};for(p.forEach(((t,e)=>g[t]=e+1)),u=0,c=t.length;un.add(t)))):(i=n.value=n.value||this.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),n.changes(),e.visit(e.SOURCE,(t=>{ot(t,i[n.cellkey(t)].tuple)})),e.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,e=this._mods;let n,r;for(n=0,r=this._alen;n{const n=yu(e,s)[l],r=t.counts?e.length:1;Yu(n,h||at(e),d,p).forEach((t=>{const n={};for(let t=0;t(this._pending=V(t.data),t=>t.touch(this))));return{async:e}}return n.request(t.url,t.format).then((t=>Vs(this,e,V(t.data))))}}),Xs.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}]},dt(Xs,Qa,{transform(t,e){const r=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,s=t.modified(),l=r.length;let c,f,h,d=s?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&u('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&u('The "as" parameter has too few output field names.'),g=g||o.map(n),c=function(t){for(var e,n,u=0,s=0;ue.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),dt(Js,Ta),dt(Qs,Ta),dt(tl,Qa,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),el.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:Ku,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},dt(el,ls,{_transform:ls.prototype.transform,transform(t,n){return this._transform(function(t,n){const i=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",u=r(i).concat(r(o)),s=function(t,e,n){const r={},i=[];return n.visit(n.SOURCE,(e=>{const n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort(K),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((()=>a)),fields:s.map((t=>function(t,n,r,i){return e((e=>n(e)===t?r(e):NaN),i,t+"")}(t,i,o,u))),as:s.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),dt(nl,Ts,{transform(t,e){const n=t.subflow,i=t.field,o=t=>this.subflow(_a(t),n,e,t);return(t.modified("field")||i&&e.modified(r(i)))&&u("PreFacet does not support field modification."),this.initTargets(),i?(e.visit(e.MOD,(t=>{const e=o(t);i(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);i(t).forEach((t=>e.add(ba(t))))})),e.visit(e.REM,(t=>{const e=o(t);i(t).forEach((t=>e.rem(t)))}))):(e.visit(e.MOD,(t=>o(t).mod(t))),e.visit(e.ADD,(t=>o(t).add(t))),e.visit(e.REM,(t=>o(t).rem(t)))),e.clean()&&e.runAfter((()=>this.clean())),e}}),rl.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},dt(rl,Qa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Ms(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i{const e=_a(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,ba({}));a[_a(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[_a(t)]))})),n}}),dt(il,Qa,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),ol.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"]}]};function al(t){Qa.call(this,null,t)}function ul(t){Qa.call(this,[],t),this.count=0}function sl(t){Qa.call(this,null,t)}function ll(t){Qa.call(this,null,t),this.modified(!0)}function cl(t){Qa.call(this,null,t)}dt(ol,Qa,{transform(t,e){const 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 o=Es(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(n),u=[],s=t.step||.01,l=t.probs||Te(s/2,1-1e-14,s),c=l.length;return o.forEach((t=>{const e=ru(t,l);for(let n=0;n{const e=_a(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=wa(t);r[_a(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[_a(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),ul.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},dt(ul,Qa,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[_a(e)]=1,t)),{});let u=this.value,s=this.count,l=0;function c(e){let n,i;u.length=l&&(n=u[i],a[_a(n)]&&r.rem.push(n),u[i]=e)),++s}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=_a(t);a[e]&&(a[e]=-1,r.rem.push(t)),--s})),u=u.filter((t=>-1!==a[_a(t)]))),(n.rem.length||i)&&u.length{a[_a(t)]||c(t)})),l=-1),i&&u.length>o){const t=u.length-o;for(let e=0;e{a[_a(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=u.filter((t=>!a[_a(t)]))),this.count=s,this.value=r.source=u,r}}),sl.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"}]},dt(sl,Qa,{transform(t,e){if(this.value&&!t.modified())return;const n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=Te(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,ba(e)})),n.add=e.add.concat(this.value),n}}),dt(ll,Qa,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const fl=["unit0","unit1"];function hl(t){Qa.call(this,ft(),t)}function dl(t){Qa.call(this,null,t)}cl.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:er,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:fl}]},dt(cl,Qa,{transform(t,e){const n=t.field,i=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),u=(o?$r:Sr)(a.unit).offset,s=t.as||fl,l=s[0],c=s[1],f=a.step;let h=a.start||1/0,d=a.stop||-1/0,p=e.ADD;return(t.modified()||e.changed(e.REM)||e.modified(r(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let r,o;null==e?(t[l]=null,i&&(t[c]=null)):(t[l]=r=o=a(e),i&&(t[c]=o=u(r,f)),rd&&(d=o))})),a.start=h,a.stop=d,e.modifies(i?s:l)},_floor(t,e){const n="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Qr({extent:t.extent||at(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=rr(r),a=this.value||{},u=(n?Dr:Ar)(o,i);return u.unit=F(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),dt(hl,Qa,{transform(t,e){const n=e.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(t=>i.delete(r(t)))),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()}}),dt(dl,Qa,{transform(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(Ma(t.sort)):e.source).map(t.field))}});const pl={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{const 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=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){const t=pl.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=>{const n=e.data,r=e.compare;let i=e.index;if(t0||u("ntile num must be greater than zero.");const n=pl.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=>{const r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{const r=n.index+e,i=n.data;return rt(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||u("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(e-1);return re=null,next:n=>{const 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=>{const i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;nc[t]=1))}m(t.sort),e.forEach(((t,e)=>{const r=i[e],c=n(r),y=Xu(t,c,a[e]);if(m(r),s.push(y),lt(pl,t))l.push(function(t,e,n,r){const i=pl[t](e,n);return{init:i.init||h,update:function(t,e){e[r]=i.next(t)}}}(t,i[e],o[e],y));else{if(null==r&&"count"!==t&&u("Null aggregate field specified."),"count"===t)return void d.push(y);g=!1;let e=f[c];e||(e=f[c]=[],e.field=r,p.push(e)),e.push(ts(t,y))}})),(d.length||p.length)&&(this.cell=function(t,e,n){t=t.map((t=>as(t,t.field)));const r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),rt.init())),this.cell&&this.cell.init()},yl.update=function(t,e){const n=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(n){for(a=t.p0;athis.group(i(t));let a=this.state;a&&!n||(a=this.state=new ml(t)),n||e.modified(a.inputs)?(this.value={},e.visit(e.SOURCE,(t=>o(t).add(t)))):(e.visit(e.REM,(t=>o(t).remove(t))),e.visit(e.ADD,(t=>o(t).add(t))));for(let e=0,n=this._mlen;e=1?Bl:t<=-1?-Bl:Math.asin(t)}const Ol=Math.PI,Rl=2*Ol,Ul=1e-6,Ll=Rl-Ul;function ql(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return ql;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;eUl)if(Math.abs(c*u-s*l)>Ul&&i){let h=n-o,d=r-a,p=u*u+s*s,g=h*h+d*d,m=Math.sqrt(p),y=Math.sqrt(f),v=i*Math.tan((Ol-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>Ul&&this._append`L${t+_*l},${e+_*c}`,this._append`A${i},${i},0,0,${+(c*h>l*d)},${this._x1=t+x*u},${this._y1=e+x*s}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),u=n*Math.sin(r),s=t+a,l=e+u,c=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${s},${l}`:(Math.abs(this._x1-s)>Ul||Math.abs(this._y1-l)>Ul)&&this._append`L${s},${l}`,n&&(f<0&&(f=f%Rl+Rl),f>Ll?this._append`A${n},${n},0,1,${c},${t-a},${e-u}A${n},${n},0,1,${c},${this._x1=s},${this._y1=l}`:f>Ul&&this._append`A${n},${n},0,${+(f>=Ol)},${c},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function jl(){return new Pl}function Il(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Pl(e)}function Wl(t){return t.innerRadius}function Hl(t){return t.outerRadius}function Yl(t){return t.startAngle}function Gl(t){return t.endAngle}function Vl(t){return t&&t.padAngle}function Xl(t,e,n,r,i,o,a){var u=t-n,s=e-r,l=(a?o:-o)/Sl(u*u+s*s),c=l*s,f=-l*u,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,y=(d+g)/2,v=p-h,_=g-d,x=v*v+_*_,b=i-o,w=h*g-p*d,k=(_<0?-1:1)*Sl(Dl(0,b*b*x-w*w)),A=(w*_-v*k)/x,M=(-w*v-_*k)/x,E=(w*_+v*k)/x,D=(-w*v+_*k)/x,C=A-m,F=M-y,S=E-m,$=D-y;return C*C+F*F>S*S+$*$&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function Jl(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Zl(t){this._context=t}function Ql(t){return new Zl(t)}function Kl(t){return t[0]}function tc(t){return t[1]}function ec(t,e){var n=kl(!0),r=null,i=Ql,o=null,a=Il(u);function u(u){var s,l,c,f=(u=Jl(u)).length,h=!1;for(null==r&&(o=i(c=a())),s=0;s<=f;++s)!(s=f;--h)u.point(y[h],v[h]);u.lineEnd(),u.areaEnd()}m&&(y[c]=+t(d,c,l),v[c]=+e(d,c,l),u.point(r?+r(d,c,l):y[c],n?+n(d,c,l):v[c]))}if(p)return u=null,p+""||null}function c(){return ec().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Kl:kl(+t),e="function"==typeof e?e:kl(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?tc:kl(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:kl(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:kl(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:kl(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:kl(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:kl(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:kl(+t),l):n},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(n)},l.lineX1=function(){return c().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:kl(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),l):o},l}jl.prototype=Pl.prototype,Zl.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 rc={draw(t,e){const n=Sl(e/Tl);t.moveTo(n,0),t.arc(0,0,n,0,Nl)}};function ic(){}function oc(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 ac(t){this._context=t}function uc(t){this._context=t}function sc(t){this._context=t}function lc(t,e){this._basis=new ac(t),this._beta=e}ac.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:oc(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:oc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},uc.prototype={areaStart:ic,areaEnd:ic,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:oc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},sc.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:oc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},lc.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],o=e[0],a=t[n]-i,u=e[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*a),this._beta*e[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var cc=function t(e){function n(t){return 1===e?new ac(t):new lc(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function fc(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 hc(t,e){this._context=t,this._k=(1-e)/6}hc.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:fc(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:fc(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 dc=function t(e){function n(t){return new hc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function pc(t,e){this._context=t,this._k=(1-e)/6}pc.prototype={areaStart:ic,areaEnd:ic,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:fc(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 gc=function t(e){function n(t){return new pc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function mc(t,e){this._context=t,this._k=(1-e)/6}mc.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:fc(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 yc=function t(e){function n(t){return new mc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function vc(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>$l){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>$l){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);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function _c(t,e){this._context=t,this._alpha=e}_c.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:vc(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 xc=function t(e){function n(t){return e?new _c(t,e):new hc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function bc(t,e){this._context=t,this._alpha=e}bc.prototype={areaStart:ic,areaEnd:ic,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:vc(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 wc=function t(e){function n(t){return e?new bc(t,e):new pc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function kc(t,e){this._context=t,this._alpha=e}kc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(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:vc(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 Ac=function t(e){function n(t){return e?new kc(t,e):new mc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Mc(t){this._context=t}function Ec(t){return t<0?-1:1}function Dc(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(Ec(o)+Ec(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Cc(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Fc(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*e,o-u,a-u*n,o,a)}function Sc(t){this._context=t}function $c(t){this._context=new Tc(t)}function Tc(t){this._context=t}function Bc(t){this._context=t}function Nc(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e=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}};const Rc=()=>"undefined"!=typeof Image?Image:null;function Uc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Lc(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 qc=Symbol("implicit");function Pc(){var t=new ce,e=[],n=[],r=qc;function i(i){let o=t.get(i);if(void 0===o){if(r!==qc)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new ce;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);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 Pc(e,n).unknown(r)},Uc.apply(i,arguments),i}function jc(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ic(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Wc(){}var Hc=.7,Yc=1/Hc,Gc="\\s*([+-]?\\d+)\\s*",Vc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jc=/^#([0-9a-f]{3,8})$/,Zc=new RegExp(`^rgb\\(${Gc},${Gc},${Gc}\\)$`),Qc=new RegExp(`^rgb\\(${Xc},${Xc},${Xc}\\)$`),Kc=new RegExp(`^rgba\\(${Gc},${Gc},${Gc},${Vc}\\)$`),tf=new RegExp(`^rgba\\(${Xc},${Xc},${Xc},${Vc}\\)$`),ef=new RegExp(`^hsl\\(${Vc},${Xc},${Xc}\\)$`),nf=new RegExp(`^hsla\\(${Vc},${Xc},${Xc},${Vc}\\)$`),rf={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 of(){return this.rgb().formatHex()}function af(){return this.rgb().formatRgb()}function uf(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Jc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?sf(e):3===n?new hf(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?lf(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?lf(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=Zc.exec(t))?new hf(e[1],e[2],e[3],1):(e=Qc.exec(t))?new hf(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Kc.exec(t))?lf(e[1],e[2],e[3],e[4]):(e=tf.exec(t))?lf(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ef.exec(t))?vf(e[1],e[2]/100,e[3]/100,1):(e=nf.exec(t))?vf(e[1],e[2]/100,e[3]/100,e[4]):rf.hasOwnProperty(t)?sf(rf[t]):"transparent"===t?new hf(NaN,NaN,NaN,0):null}function sf(t){return new hf(t>>16&255,t>>8&255,255&t,1)}function lf(t,e,n,r){return r<=0&&(t=e=n=NaN),new hf(t,e,n,r)}function cf(t){return t instanceof Wc||(t=uf(t)),t?new hf((t=t.rgb()).r,t.g,t.b,t.opacity):new hf}function ff(t,e,n,r){return 1===arguments.length?cf(t):new hf(t,e,n,null==r?1:r)}function hf(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function df(){return`#${yf(this.r)}${yf(this.g)}${yf(this.b)}`}function pf(){const t=gf(this.opacity);return`${1===t?"rgb(":"rgba("}${mf(this.r)}, ${mf(this.g)}, ${mf(this.b)}${1===t?")":`, ${t})`}`}function gf(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function mf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function yf(t){return((t=mf(t))<16?"0":"")+t.toString(16)}function vf(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new bf(t,e,n,r)}function _f(t){if(t instanceof bf)return new bf(t.h,t.s,t.l,t.opacity);if(t instanceof Wc||(t=uf(t)),!t)return new bf;if(t instanceof bf)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=e===o?(n-r)/u+6*(n0&&s<1?0:a,new bf(a,u,s,t.opacity)}function xf(t,e,n,r){return 1===arguments.length?_f(t):new bf(t,e,n,null==r?1:r)}function bf(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function wf(t){return(t=(t||0)%360)<0?t+360:t}function kf(t){return Math.max(0,Math.min(1,t||0))}function Af(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}jc(Wc,uf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:of,formatHex:of,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return _f(this).formatHsl()},formatRgb:af,toString:af}),jc(hf,ff,Ic(Wc,{brighter(t){return t=null==t?Yc:Math.pow(Yc,t),new hf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Hc:Math.pow(Hc,t),new hf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new hf(mf(this.r),mf(this.g),mf(this.b),gf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:df,formatHex:df,formatHex8:function(){return`#${yf(this.r)}${yf(this.g)}${yf(this.b)}${yf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:pf,toString:pf})),jc(bf,xf,Ic(Wc,{brighter(t){return t=null==t?Yc:Math.pow(Yc,t),new bf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Hc:Math.pow(Hc,t),new bf(this.h,this.s,this.l*t,this.opacity)},rgb(){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 hf(Af(t>=240?t-240:t+120,i,r),Af(t,i,r),Af(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new bf(wf(this.h),kf(this.s),kf(this.l),gf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=gf(this.opacity);return`${1===t?"hsl(":"hsla("}${wf(this.h)}, ${100*kf(this.s)}%, ${100*kf(this.l)}%${1===t?")":`, ${t})`}`}}));const Mf=Math.PI/180,Ef=180/Math.PI,Df=.96422,Cf=1,Ff=.82521,Sf=4/29,$f=6/29,Tf=3*$f*$f,Bf=$f*$f*$f;function Nf(t){if(t instanceof Of)return new Of(t.l,t.a,t.b,t.opacity);if(t instanceof jf)return If(t);t instanceof hf||(t=cf(t));var e,n,r=qf(t.r),i=qf(t.g),o=qf(t.b),a=Rf((.2225045*r+.7168786*i+.0606169*o)/Cf);return r===i&&i===o?e=n=a:(e=Rf((.4360747*r+.3850649*i+.1430804*o)/Df),n=Rf((.0139322*r+.0971045*i+.7141733*o)/Ff)),new Of(116*a-16,500*(e-a),200*(a-n),t.opacity)}function zf(t,e,n,r){return 1===arguments.length?Nf(t):new Of(t,e,n,null==r?1:r)}function Of(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function Rf(t){return t>Bf?Math.pow(t,1/3):t/Tf+Sf}function Uf(t){return t>$f?t*t*t:Tf*(t-Sf)}function Lf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function qf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Pf(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof jf)return new jf(t.h,t.c,t.l,t.opacity);if(t instanceof Of||(t=Nf(t)),0===t.a&&0===t.b)return new jf(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r()=>t;function ih(t,e){return function(n){return t+n*e}}function oh(t,e){var n=e-t;return n?ih(t,n>180||n<-180?n-360*Math.round(n/360):n):rh(isNaN(t)?e:t)}function ah(t){return 1==(t=+t)?uh: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):rh(isNaN(e)?n:e)}}function uh(t,e){var n=e-t;return n?ih(t,n):rh(isNaN(t)?e:t)}var sh=function t(e){var n=ah(e);function r(t,e){var r=n((t=ff(t)).r,(e=ff(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=uh(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function lh(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),u=new Array(i);for(n=0;no&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:mh(n,r)})),o=_h.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:mh(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,s),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:mh(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:mh(t,n)},{i:u-2,x:mh(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var e,n=-1,r=s.length;++ne&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?Xh:Vh,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),u,s)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(u,a.map(t),mh)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Wh),c()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=wh,c()},f.clamp=function(t){return arguments.length?(l=!!t||Yh,c()):l!==Yh},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 Qh(){return Zh()(Yh,Yh)}function Kh(t,e,n,r){var i,o=ke(t,e,n);switch((r=Le(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Ze(o,a))||(r.precision=i),Ye(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Qe(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Je(o))||(r.precision=i-2*("%"===r.type))}return He(r)}function td(t){var e=t.domain;return t.ticks=function(t){var n=e();return be(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Kh(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,u=o.length-1,s=o[a],l=o[u],c=10;for(l0;){if((i=we(s,l,n))===r)return o[a]=s,o[u]=l,e(o);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function ed(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a-t(-e,n)}function sd(t){const e=t(nd,rd),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?ad:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=ud(r),i=ud(i),t(id,od)):t(nd,rd),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],u=e[e.length-1];const s=u0){for(;f<=h;++f)for(l=1;lu)break;p.push(c)}}else for(;f<=h;++f)for(l=o-1;l>=1;--l)if(c=f>0?l/i(-f):l*i(f),!(cu)break;p.push(c)}2*p.length{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=Le(n)).precision||(n.trim=!0),n=He(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*on(ed(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function ld(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function cd(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function fd(t){var e=1,n=t(ld(e),cd(e));return n.constant=function(n){return arguments.length?t(ld(e=+n),cd(e)):e},td(n)}function hd(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function dd(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function pd(t){return t<0?-t*t:t*t}function gd(t){var e=t(Yh,Yh),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(Yh,Yh):.5===n?t(dd,pd):t(hd(n),hd(1/n)):n},td(e)}function md(){var t=gd(Zh());return t.copy=function(){return Jh(t,md()).exponent(t.exponent())},Uc.apply(t,arguments),t}function yd(t){return new Date(t)}function vd(t){return t instanceof Date?+t:+new Date(+t)}function _d(t,e,n,r,i,o,a,u,s,l){var c=Qh(),f=c.invert,h=c.domain,d=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),y=l("%a %d"),v=l("%b %d"),_=l("%B"),x=l("%Y");function b(t){return(s(t)0?r:1:0}const Dd="linear",Cd="log",Fd="pow",Sd="sqrt",$d="symlog",Td="time",Bd="utc",Nd="sequential",zd="diverging",Od="quantile",Rd="quantize",Ud="threshold",Ld="ordinal",qd="point",Pd="band",jd="bin-ordinal",Id="continuous",Wd="discrete",Hd="discretizing",Yd="interpolating",Gd="temporal";function Vd(){const t=Pc().unknown(void 0),e=t.domain,n=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,l=.5;function c(){const t=e().length,c=o[1]d+r*t));return n(c?p.reverse():p)}return delete t.unknown,t.domain=function(t){return arguments.length?(e(t),c()):e()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],c()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,c()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,c()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),c()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},t.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]o[1-r])?void 0:(s=Math.max(0,ae(a,f)-1),l=f===h?s:ae(a,h)-1,f-a[s]>i+1e-10&&++s,r&&(c=s,s=u-l,l=u-c),s>l?void 0:e().slice(s,l+1))},t.invert=function(e){const n=t.invertRange([e,e]);return n?n[0]:n},t.copy=function(){return Vd().domain(e()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}function Xd(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Xd(e())},t}var Jd=Array.prototype.map;const Zd=Array.prototype.slice;const Qd=new Map,Kd=Symbol("vega_scale");function tp(t){return t[Kd]=!0,t}function ep(t,e,n){return arguments.length>1?(Qd.set(t,function(t,e,n){const r=function(){const n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){let n,r=e[0],i=e[1];return i=u&&n[o]<=s&&(l<0&&(l=o),r=o);if(!(l<0))return u=t.invertExtent(n[l]),s=t.invertExtent(n[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,tp(n)};return r.metadata=Nt(V(n)),r}(t,e,n)),this):np(t)?Qd.get(t):void 0}function np(t){return Qd.has(t)}function rp(t,e){const n=Qd.get(t);return n&&n.metadata[e]}function ip(t){return rp(t,Id)}function op(t){return rp(t,Wd)}function ap(t){return rp(t,Hd)}function up(t){return rp(t,Cd)}function sp(t){return rp(t,Yd)}function lp(t){return rp(t,Od)}ep("identity",(function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Wh),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,Wh):[0,1],td(r)})),ep(Dd,(function t(){var e=Qh();return e.copy=function(){return Jh(e,t())},Uc.apply(e,arguments),td(e)}),Id),ep(Cd,(function t(){const e=sd(Zh()).domain([1,10]);return e.copy=()=>Jh(e,t()).base(e.base()),Uc.apply(e,arguments),e}),[Id,Cd]),ep(Fd,md,Id),ep(Sd,(function(){return md.apply(null,arguments).exponent(.5)}),Id),ep($d,(function t(){var e=fd(Zh());return e.copy=function(){return Jh(e,t()).constant(e.constant())},Uc.apply(e,arguments)}),Id),ep(Td,(function(){return Uc.apply(_d(jn,In,Rn,zn,xn,mn,pn,hn,fn,ii).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Id,Gd]),ep(Bd,(function(){return Uc.apply(_d(qn,Pn,Un,On,Cn,yn,gn,dn,fn,ai).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Id,Gd]),ep(Nd,wd,[Id,Yd]),ep(`${Nd}-${Dd}`,wd,[Id,Yd]),ep(`${Nd}-${Cd}`,(function t(){var e=sd(xd()).domain([1,10]);return e.copy=function(){return bd(e,t()).base(e.base())},Lc.apply(e,arguments)}),[Id,Yd,Cd]),ep(`${Nd}-${Fd}`,kd,[Id,Yd]),ep(`${Nd}-${Sd}`,(function(){return kd.apply(null,arguments).exponent(.5)}),[Id,Yd]),ep(`${Nd}-${$d}`,(function t(){var e=fd(xd());return e.copy=function(){return bd(e,t()).constant(e.constant())},Lc.apply(e,arguments)}),[Id,Yd]),ep(`${zd}-${Dd}`,(function t(){var e=td(Ad()(Yh));return e.copy=function(){return bd(e,t())},Lc.apply(e,arguments)}),[Id,Yd]),ep(`${zd}-${Cd}`,(function t(){var e=sd(Ad()).domain([.1,1,10]);return e.copy=function(){return bd(e,t()).base(e.base())},Lc.apply(e,arguments)}),[Id,Yd,Cd]),ep(`${zd}-${Fd}`,Md,[Id,Yd]),ep(`${zd}-${Sd}`,(function(){return Md.apply(null,arguments).exponent(.5)}),[Id,Yd]),ep(`${zd}-${$d}`,(function t(){var e=fd(Ad());return e.copy=function(){return bd(e,t()).constant(e.constant())},Lc.apply(e,arguments)}),[Id,Yd]),ep(Od,(function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[o[i-1],r]:[o[e-1],o[e]]},u.unknown=function(t){return arguments.length?(e=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([n,r]).range(a).unknown(e)},Uc.apply(td(u),arguments)}),Hd),ep(Ud,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[se(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Uc.apply(o,arguments)}),Hd),ep(jd,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(se(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=function(t){return Jd.call(t,S)}(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Zd.call(t),r):n.slice()},r.tickFormat=function(t,n){return Kh(e[0],F(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Wd,Hd]),ep(Ld,Pc,Wd),ep(Pd,Vd,Wd),ep(qd,(function(){return Xd(Vd().paddingInner(1))}),Wd);const cp=["clamp","base","constant","exponent"];function fp(t,e){const n=e[0],r=F(e)-n;return function(e){return t(n+e*r)}}function hp(t,e,n){return jh(gp(e||"rgb",n),t)}function dp(t,e){const n=new Array(e),r=e+1;for(let i=0;it[e]?a[e](t[e]()):0)),a):rt(.5)}function gp(t,e){const n=Ih[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function mp(t){const e=t.length/6|0,n=new Array(e);for(let r=0;r1?(vp[t]=e,this):vp[t]}yp({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"},mp),yp({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>hp(mp(t))));const xp="symbol",bp="discrete",wp=t=>k(t)?t.map((t=>String(t))):String(t),kp=(t,e)=>t[1]-e[1],Ap=(t,e)=>e[1]-t[1];function Mp(t,e,n){let r;return vt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(Ct(t.domain())/n||1)))),A(e)&&(r=e.step,e=e.interval),xt(e)&&(e=t.type===Td?Sr(e):t.type==Bd?$r(e):u("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function Ep(t,e,n){let r=t.range(),i=r[0],o=F(r),a=kp;if(i>o&&(r=o,o=i,i=r,a=Ap),i=Math.floor(i),o=Math.ceil(o),e=e.map((e=>[e,t(e)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),n>0&&e.length>1){const t=[e[0],F(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Dp(t,e){return t.bins?Ep(t,t.bins):t.ticks?t.ticks(e):t.domain()}function Cp(t,e,n,r,i,o){const a=e.type;let u=wp;if(a===Td||i===Td)u=t.timeFormat(r);else if(a===Bd||i===Bd)u=t.utcFormat(r);else if(up(a)){const i=t.formatFloat(r);if(o||e.bins)u=i;else{const t=Fp(e,n,!1);u=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();u=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(u=t.format(r));return u}function Fp(t,e,n){const r=Dp(t,e),i=t.base(),o=Math.log(i),a=Math.max(1,i*e/r.length),u=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/o));return e*iSp[t.type]||t.bins;function Np(t,e,n,r,i,o,a){const u=$p[e.type]&&o!==Td&&o!==Bd?function(t,e,n){const r=e[$p[e.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o(e,n,r)=>{const i=Op(r[n+1],Op(r.max,1/0)),o=Lp(e,t),a=Lp(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Op=(t,e)=>null!=t?t:e,Rp=t=>(e,n)=>n?t(e):null,Up=t=>e=>t(e),Lp=(t,e)=>Number.isFinite(t)?e(t):null;function qp(t,e,n,r){const i=r||e.type;return xt(n)&&function(t){return rp(t,Gd)}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Td?n||i!==Bd?Np(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Pp(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=qp(t,e,n.format,n.formatType);if(ap(e.type)){const t=Tp(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(op(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(F(t))}`}}let jp=0;const Ip="p_";function Wp(t){return t&&t.gradient}function Hp(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?Ip:"";return i||(i=t.id="gradient_"+jp++,"radial"===r?(t.x1=Yp(t.x1,.5),t.y1=Yp(t.y1,.5),t.r1=Yp(t.r1,0),t.x2=Yp(t.x2,.5),t.y2=Yp(t.y2,.5),t.r2=Yp(t.r2,.5),o=Ip):(t.x1=Yp(t.x1,0),t.y1=Yp(t.y1,0),t.x2=Yp(t.x2,1),t.y2=Yp(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function Yp(t,e){return null!=t?t:e}function Gp(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}}}const Vp={basis:{curve:function(t){return new ac(t)}},"basis-closed":{curve:function(t){return new uc(t)}},"basis-open":{curve:function(t){return new sc(t)}},bundle:{curve:cc,tension:"beta",value:.85},cardinal:{curve:dc,tension:"tension",value:0},"cardinal-open":{curve:yc,tension:"tension",value:0},"cardinal-closed":{curve:gc,tension:"tension",value:0},"catmull-rom":{curve:xc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:wc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ac,tension:"alpha",value:.5},linear:{curve:Ql},"linear-closed":{curve:function(t){return new Mc(t)}},monotone:{horizontal:function(t){return new $c(t)},vertical:function(t){return new Sc(t)}},natural:{curve:function(t){return new Bc(t)}},step:{curve:function(t){return new zc(t,.5)}},"step-after":{curve:function(t){return new zc(t,1)}},"step-before":{curve:function(t){return new zc(t,0)}}};function Xp(t,e,n){var r=lt(Vp,t)&&Vp[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const Jp={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Zp=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Qp=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Kp=/^((\s+,?\s*)|(,\s*))/,tg=/^[01]/;function eg(t){const e=[];return(t.match(Zp)||[]).forEach((t=>{let n=t[0];const r=n.toLowerCase(),i=Jp[r],o=function(t,e,n){const r=[];for(let i=0;e&&i1&&(g=Math.sqrt(g),n*=g,r*=g);const m=h/n,y=f/n,v=-f/r,_=h/r,x=m*u+y*s,b=v*u+_*s,w=m*t+y*e,k=v*t+_*e;let A=1/((w-x)*(w-x)+(k-b)*(k-b))-.25;A<0&&(A=0);let M=Math.sqrt(A);o==i&&(M=-M);const E=.5*(x+w)-M*(k-b),D=.5*(b+k)+M*(w-x),C=Math.atan2(b-D,x-E);let F=Math.atan2(k-D,w-E)-C;F<0&&1===o?F+=og:F>0&&0===o&&(F-=og);const S=Math.ceil(Math.abs(F/(ig+.001))),$=[];for(let t=0;t+t}function Mg(t,e,n){return Math.max(e,Math.min(t,n))}function Eg(){var t=xg,e=bg,n=wg,r=kg,i=Ag(0),o=i,a=i,u=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),y=Math.min(g,m)/2,v=Mg(+i.call(this,l),0,y),_=Mg(+o.call(this,l),0,y),x=Mg(+a.call(this,l),0,y),b=Mg(+u.call(this,l),0,y);if(s||(s=h=jl()),v<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,k=p+m;s.moveTo(d+v,p),s.lineTo(w-_,p),s.bezierCurveTo(w-_g*_,p,w,p+_g*_,w,p+_),s.lineTo(w,k-b),s.bezierCurveTo(w,k-_g*b,w-_g*b,k,w-b,k),s.lineTo(d+x,k),s.bezierCurveTo(d+_g*x,k,d,k-_g*x,d,k-x),s.lineTo(d,p+v),s.bezierCurveTo(d,p+_g*v,d+_g*v,p,d+v,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Ag(e),l):t},l.y=function(t){return arguments.length?(e=Ag(t),l):e},l.width=function(t){return arguments.length?(n=Ag(t),l):n},l.height=function(t){return arguments.length?(r=Ag(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Ag(t),o=null!=e?Ag(e):i,u=null!=n?Ag(n):i,a=null!=r?Ag(r):o,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Dg(){var t,e,n,r,i,o,a,u,s=null;function l(t,e,n){const r=n/2;if(i){var l=a-e,c=t-o;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*u,d=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(o-h,a-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(o+h,a+d),s.arc(o,a,u,p,p+Math.PI)}else s.arc(t,e,r,0,og);s.closePath()}else i=1;o=t,a=e,u=r}function c(o){var a,u,c,f=o.length,h=!1;for(null==s&&(s=c=jl()),a=0;a<=f;++a)!(at.x||0,Sg=t=>t.y||0,$g=t=>!(!1===t.defined),Tg=function(){var t=Wl,e=Hl,n=kl(0),r=null,i=Yl,o=Gl,a=Vl,u=null,s=Il(l);function l(){var l,c,f=+t.apply(this,arguments),h=+e.apply(this,arguments),d=i.apply(this,arguments)-Bl,p=o.apply(this,arguments)-Bl,g=Al(p-d),m=p>d;if(u||(u=l=s()),h$l)if(g>Nl-$l)u.moveTo(h*El(d),h*Fl(d)),u.arc(0,0,h,d,p,!m),f>$l&&(u.moveTo(f*El(p),f*Fl(p)),u.arc(0,0,f,p,d,m));else{var y,v,_=d,x=p,b=d,w=p,k=g,A=g,M=a.apply(this,arguments)/2,E=M>$l&&(r?+r.apply(this,arguments):Sl(f*f+h*h)),D=Cl(Al(h-f)/2,+n.apply(this,arguments)),C=D,F=D;if(E>$l){var S=zl(E/f*Fl(M)),$=zl(E/h*Fl(M));(k-=2*S)>$l?(b+=S*=m?1:-1,w-=S):(k=0,b=w=(d+p)/2),(A-=2*$)>$l?(_+=$*=m?1:-1,x-=$):(A=0,_=x=(d+p)/2)}var T=h*El(_),B=h*Fl(_),N=f*El(w),z=f*Fl(w);if(D>$l){var O,R=h*El(x),U=h*Fl(x),L=f*El(b),q=f*Fl(b);if(g1?0:t<-1?Tl:Math.acos(t)}((P*I+j*W)/(Sl(P*P+j*j)*Sl(I*I+W*W)))/2),Y=Sl(O[0]*O[0]+O[1]*O[1]);C=Cl(D,(f-Y)/(H-1)),F=Cl(D,(h-Y)/(H+1))}else C=F=0}A>$l?F>$l?(y=Xl(L,q,T,B,h,F,m),v=Xl(R,U,N,z,h,F,m),u.moveTo(y.cx+y.x01,y.cy+y.y01),F$l&&k>$l?C>$l?(y=Xl(N,z,R,U,f,-C,m),v=Xl(T,B,L,q,f,-C,m),u.lineTo(y.cx+y.x01,y.cy+y.y01),Ct.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)),Bg=nc().x(Fg).y1(Sg).y0((t=>(t.y||0)+(t.height||0))).defined($g),Ng=nc().y(Sg).x1(Fg).x0((t=>(t.x||0)+(t.width||0))).defined($g),zg=ec().x(Fg).y(Sg).defined($g),Og=Eg().x(Fg).y(Sg).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Cg(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Cg(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Cg(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Cg(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),Rg=function(t,e){let n=null,r=Il(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:kl(t||rc),e="function"==typeof e?e:kl(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:kl(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:kl(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i}().type((t=>yg(t.shape||"circle"))).size((t=>Cg(t.size,64))),Ug=Dg().x(Fg).y(Sg).defined($g).size((t=>t.size||1));function Lg(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function qg(t,e,n,r){return Og.context(t)(e,n,r)}var Pg=1;function jg(){Pg=1}function Ig(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+Pg++),a=i.clipping[o]||(i.clipping[o]={id:o});return J(r)?a.path=r(null):Lg(n)?a.path=qg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Wg(t){this.clear(),t&&this.union(t)}function Hg(t){this.mark=t,this.bounds=this.bounds||new Wg}function Yg(t){Hg.call(this,t),this.items=this.items||[]}function Gg(t){this._pending=0,this._loader=t||da()}function Vg(t){t._pending+=1}function Xg(t){t._pending-=1}function Jg(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}Wg.prototype={clone(){return new Wg(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,e,n,r){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rotate(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])},rotatedPoints(t,e,n){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),l=e-e*u+n*s,c=n-e*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*a+l,s*r+u*a+c,u*o-s*i+l,s*o+u*i+c,u*o-s*a+l,s*o+u*a+c]},union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)},contains(t,e){return!(tthis.x2||ethis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},dt(Yg,Hg),Gg.prototype={pending(){return this._pending},sanitizeURL(t){const e=this;return Vg(e),e._loader.sanitize(t,{context:"href"}).then((t=>(Xg(e),t))).catch((()=>(Xg(e),null)))},loadImage(t){const e=this,n=Rc();return Vg(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=lt(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Xg(e),i.onerror=()=>Xg(e),i.src=r,i})).catch((t=>(Xg(e),{complete:!1,width:0,height:0,src:t&&t.url||""})))},ready(){const t=this;return new Promise((e=>{!function n(r){t.pending()?setTimeout((()=>{n(!0)}),10):e(r)}(!1)}))}};const Zg=og-1e-8;let Qg,Kg,tm,em,nm,rm,im,om;const am=(t,e)=>Qg.add(t,e),um=(t,e)=>am(Kg=t,tm=e),sm=t=>am(t,Qg.y1),lm=t=>am(Qg.x1,t),cm=(t,e)=>nm*t+im*e,fm=(t,e)=>rm*t+om*e,hm=(t,e)=>am(cm(t,e),fm(t,e)),dm=(t,e)=>um(cm(t,e),fm(t,e));function pm(t,e){return Qg=t,e?(em=e*ng,nm=om=Math.cos(em),rm=Math.sin(em),im=-rm):(nm=om=1,em=rm=im=0),gm}const gm={beginPath(){},closePath(){},moveTo:dm,lineTo:dm,rect(t,e,n,r){em?(hm(t+n,e),hm(t+n,e+r),hm(t,e+r),dm(t,e)):(am(t+n,e+r),um(t,e))},quadraticCurveTo(t,e,n,r){const i=cm(t,e),o=fm(t,e),a=cm(n,r),u=fm(n,r);mm(Kg,i,a,sm),mm(tm,o,u,lm),um(a,u)},bezierCurveTo(t,e,n,r,i,o){const a=cm(t,e),u=fm(t,e),s=cm(n,r),l=fm(n,r),c=cm(i,o),f=fm(i,o);ym(Kg,a,s,c,sm),ym(tm,u,l,f,lm),um(c,f)},arc(t,e,n,r,i,o){if(r+=em,i+=em,Kg=n*Math.cos(i)+t,tm=n*Math.sin(i)+e,Math.abs(i-r)>Zg)am(t-n,e-n),am(t+n,e+n);else{const a=r=>am(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(a(r),a(i),i!==r)if((r%=og)<0&&(r+=og),(i%=og)<0&&(i+=og),ii;++s,u-=ig)a(u);else for(u=r-r%ig+ig,s=0;s<4&&urg?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),l=(-a+s)/o,c=(-a-s)/o)):l=.5*u/a,0m)return!1;d>g&&(g=d)}else if(f>0){if(d0&&(t.globalAlpha=n,t.fillStyle=Fm(t,e,e.fill),!0)}var $m=[];function Tm(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=Fm(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||$m),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Bm(t,e){return t.zindex-e.zindex||t.index-e.index}function Nm(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Rm(t){return function(e,n,r){zm(n,(n=>{r&&!r.intersects(n.bounds)||Lm(t,e,n,n)}))}}function Um(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Lm(t,e,n.items[0],n.items)}}function Lm(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Em(e,n),n.fill&&Sm(e,n,i)&&e.fill(),n.stroke&&Tm(e,n,i)&&e.stroke()))}function qm(t){return t=t||p,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,Om(n,(n=>{const u=n.bounds;if((!u||u.contains(o,a))&&u)return t(e,n,r,i,o,a)?n:void 0}))}}function Pm(t,e){return function(n,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(a=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=u?u:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function jm(t){return qm(Pm(t))}function Im(t,e){return"translate("+t+","+e+")"}function Wm(t){return"rotate("+t+")"}function Hm(t){return Im(t.x||0,t.y||0)}function Ym(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,o=n.angle||0;t.translate(r,i),o&&t.rotate(o*=ng),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return Im(t.x||0,t.y||0)+(t.angle?" "+Wm(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(pm(t,n.angle),n),Jg(t,n).translate(n.x||0,n.y||0)},draw:Rm(r),pick:jm(r),isect:n||bm(r)}}var Gm=Ym("arc",(function(t,e){return Tg.context(t)(e)}));function Vm(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=Pm(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(pm(t),r),Jg(t,r[0]))},draw:Um(r),pick:function(t,e,n,r,o,a){var u=e.items,s=e.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,u,n,r)?u[0]:null)},isect:wm,tip:n}}var Xm=Vm("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Ng:Bg).curve(Xp(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function Qm(t,e){const n=Zm(e);t("d",qg(null,e,n,n))}function Km(t,e,n,r){const i=Zm(e);t.beginPath(),qg(t,e,(n||0)+i,(r||0)+i)}const ty=Pm(Km),ey=Pm(Km,!1),ny=Pm(Km,!0);var ry={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Hm(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e{const r=e.x||0,i=e.y||0,o=e.strokeForeground,a=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&a&&(Km(t,e,r,i),Em(t,e),e.fill&&Sm(t,e,a)&&t.fill(),e.stroke&&!o&&Tm(t,e,a)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&Jm(t,e),n&&n.translate(-r,-i),zm(e,(e=>{this.draw(t,e,n)})),n&&n.translate(r,i),t.restore(),o&&e.stroke&&a&&(Km(t,e,r,i),Em(t,e),Tm(t,e,a)&&t.stroke())}))},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;const a=n*t.pixelRatio,u=r*t.pixelRatio;return Om(e,(s=>{let l,c,f;const h=s.bounds;if(h&&!h.contains(i,o))return;c=s.x||0,f=s.y||0;const d=c+(s.width||0),p=f+(s.height||0),g=s.clip;if(g&&(id||op))return;if(t.save(),t.translate(c,f),c=i-c,f=o-f,g&&Lg(s)&&!ny(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,y=!1!==e.interactive;return y&&m&&s.stroke&&ey(t,s,a,u)?(t.restore(),s):(l=Om(s,(t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?this.pick(t,n,r,c,f):null)),!l&&y&&(s.fill||!m&&s.stroke)&&ty(t,s,a,u)&&(l=s),t.restore(),l||null)}))},isect:km,content:function(t,e,n){t("clip-path",e.clip?Ig(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),Qm(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?Qm(t,e):t("d","")}},iy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function oy(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 ay(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 uy(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 sy(t,e){return"center"===t?e/2:"right"===t?e:0}function ly(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var cy={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=oy(e,n),i=ay(e,r),o=uy(e,r),a=(e.x||0)-sy(e.align,i),u=(e.y||0)-ly(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",iy["xmlns:xlink"],"xlink:href"),t("transform",Im(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=ay(e,n),i=uy(e,n),o=(e.x||0)-sy(e.align,r),a=(e.y||0)-ly(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){zm(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=oy(e,this);let i=ay(e,r),o=uy(e,r);if(0===i||0===o)return;let a,u,s,l,c=(e.x||0)-sy(e.align,i),f=(e.y||0)-ly(e.baseline,o);!1!==e.aspect&&(u=r.width/r.height,s=e.width/e.height,u==u&&s==s&&u!==s&&(s=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r{if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&my(t,e,r)&&(Em(t,e),t.stroke())}}))},pick:qm((function(t,e,n,r){return!!t.isPointInStroke&&(my(t,e,1)&&t.isPointInStroke(n,r))})),isect:Am},vy=Ym("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),_y=Ym("symbol",(function(t,e){return Rg.context(t)(e)}),wm);const xy=At();var by={height:Dy,measureWidth:My,estimateWidth:ky,width:ky,canvas:wy};function wy(t){by.width=t&&_m?My:ky}function ky(t,e){return Ay($y(t,e),Dy(t))}function Ay(t,e){return~~(.8*t.length*e)}function My(t,e){return Dy(t)<=0||!(e=$y(t,e))?0:Ey(e,By(t))}function Ey(t,e){const n=`(${e}) ${t}`;let r=xy.get(n);return void 0===r&&(_m.font=e,r=_m.measureText(t).width,xy.set(n,r)),r}function Dy(t){return null!=t.fontSize?+t.fontSize||0:11}function Cy(t){return null!=t.lineHeight?t.lineHeight:Dy(t)+2}function Fy(t){return e=t.lineBreak&&t.text&&!k(t.text)?t.text.split(t.lineBreak):t.text,k(e)?e.length>1?e:e[0]:e;var e}function Sy(t){const e=Fy(t);return(k(e)?e.length-1:0)*Cy(t)}function $y(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(by.width===My){const e=By(t);return t=>Ey(t,e)}{const e=Dy(t);return t=>Ay(t,e)}}(t);if(r(e)>>1,r(e.slice(i))>n?u=i+1:s=i;return o+e.slice(u)}for(;u>>1),r(e.slice(0,i))Math.max(t,by.width(e,n))),0)):r=by.width(e,f),"center"===o?l-=r/2:"right"===o&&(l-=r),t.set(l+=u,c+=s,l+r,c+i),e.angle&&!n)t.rotate(e.angle*ng,u,s);else if(2===n)return t.rotatedPoints(e.angle*ng,u,s);return t}var Ly={type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Ny(e),o=Ry(e),a=o.x1,u=o.y1,s=e.angle||0;t("text-anchor",zy[e.align]||"start"),s?(n=Im(a,u)+" "+Wm(s),(r||i)&&(n+=" "+Im(r,i))):n=Im(a+r,u+i),t("transform",n)},bound:Uy,draw:function(t,e,n){zm(e,(e=>{var r,i,o,a,u,s,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=By(e),t.textAlign=e.align||"left",i=(r=Ry(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*ng),i=o=0),i+=e.dx||0,o+=(e.dy||0)+Ny(e),s=Fy(e),Em(t,e),k(s))for(u=Cy(e),a=0;a=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})),Py={arc:Gm,area:Xm,group:ry,image:cy,line:fy,path:dy,rect:gy,rule:yy,shape:vy,symbol:_y,text:Ly,trail:qy};function jy(t,e,n){var r=Py[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Wg),t,n)}var Iy={mark:null};function Wy(t,e,n){var r,i,o,a,u=Py[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(Iy.mark=t,o=Iy),a=jy(o,s,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new Wg,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function ev(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function nv(t,e){const n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function rv(t,e){this._active=null,this._handlers={},this._loader=t||da(),this._tooltip=e||iv}function iv(t,e,n,r){t.element().setAttribute("title",r||"")}function ov(t){this._el=null,this._bgcolor=null,this._loader=new Gg(t)}Xy.prototype={toJSON(t){return Yy(this.root,t||0)},mark(t,e,n){const r=Jy(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r}},rv.prototype={initialize(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},scene(t){return arguments.length?(this._scene=t,this):this._scene},on(){},off(){},_handlerIndex(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},handlers(t){const e=this._handlers,n=[];if(t)n.push(...e[this.eventName(t)]);else for(const t in e)n.push(...e[t]);return n},eventName(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},handleHref(t,e,n){this._loader.sanitize(n,{context:"href"}).then((e=>{const n=new MouseEvent(t.type,t),r=Zy(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=Py[a.marktype]).tip){for((o=nv(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},getItemBoundingClientRect(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}},ov.prototype={initialize(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},resize(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},dirty(){},render(t){const e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},_render(){},renderAsync(t){const e=this.render(t);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)},_load(t,e){var n=this,r=n._loader[t](e);if(!n._ready){const t=n._call;n._ready=n._loader.ready().then((e=>{e&&t(),n._ready=null}))}return r},sanitizeURL(t){return this._load("sanitizeURL",t)},loadImage(t){return this._load("loadImage",t)}};const av="dragenter",uv="dragleave",sv="dragover",lv="mousedown",cv="mousemove",fv="mouseout",hv="mouseover",dv="click",pv="mousewheel",gv="touchstart",mv="touchmove",yv="touchend",vv=cv,_v=fv,xv=dv;function bv(t,e){rv.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}const wv=t=>t===gv||t===mv||t===yv?[gv,mv,yv]:[t];function kv(t,e){wv(e).forEach((e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e)))}function Av(t,e,n){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||this.fire(n,r),this._active=o,this.fire(e,r)),this.fire(t,r)}}function Mv(t){return function(e){this.fire(t,e),this._active=null}}dt(bv,rv,{initialize(t,e,n){return this._canvas=t&&Qy(t,"canvas"),[dv,lv,cv,fv,uv].forEach((t=>kv(this,t))),rv.prototype.initialize.call(this,t,e,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",av,uv,sv,lv,"mouseup",cv,fv,hv,dv,"dblclick","wheel",pv,gv,mv,yv],DOMMouseScroll(t){this.fire(pv,t)},mousemove:Av(cv,hv,fv),dragover:Av(sv,av,uv),mouseout:Mv(fv),dragleave:Mv(uv),mousedown(t){this._down=this._active,this.fire(lv,t)},click(t){this._down===this._active&&(this.fire(dv,t),this._down=null)},touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(gv,t,!0)},touchmove(t){this.fire(mv,t,!0)},touchend(t){this.fire(yv,t,!0),this._touch=null},fire(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===xv&&r&&r.href?this.handleHref(e,r,r.href):t!==vv&&t!==_v||this.handleTooltip(e,r,t!==_v),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this},pickEvent(t){const e=nv(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},pick(t,e,n,r,i){const o=this.context();return Py[t.marktype].pick.call(this,o,t,e,n,r,i)}});var Ev="undefined"!=typeof window&&window.devicePixelRatio||1;function Dv(t){ov.call(this,t),this._options={},this._redraw=!1,this._dirty=new Wg,this._tempb=new Wg}const Cv=ov.prototype;function Fv(t,e){rv.call(this,t,e);const n=this;n._hrefHandler=Sv(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=Sv(n,((t,e)=>{n.handleTooltip(t,e,t.type!==_v)}))}dt(Dv,ov,{initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Oc(1,1,this._options.type),t&&this._canvas&&(tv(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Cv.initialize.call(this,t,e,n,r,i)},resize(t,e,n,r){if(Cv.resize.call(this,t,e,n,r),this._canvas)!function(t,e,n,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?Ev:i;t.width=e*s,t.height=n*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||u("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(t){const e=this._tempb.clear().union(t.bounds);let n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)},_render(t){const e=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty,a=((t,e,n)=>(new Wg).set(0,0,e,n).translate(-t[0],-t[1]))(n,r,i);e.save();const u=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):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(o),n);return this.clear(-n[0],-n[1],r,i),this.draw(e,t,u),e.restore(),o.clear(),this},draw(t,e,n){const r=Py[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),J(n)?(t.beginPath(),n(t),t.clip()):Jm(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},clear(t,e,n,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,e,n,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,r))}});const Sv=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)};dt(Fv,rv,{initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(xv,this._hrefHandler),r.removeEventListener(vv,this._tooltipHandler),r.removeEventListener(_v,this._tooltipHandler)),this._svg=r=t&&Qy(t,"svg"),r&&(r.addEventListener(xv,this._hrefHandler),r.addEventListener(vv,this._tooltipHandler),r.addEventListener(_v,this._tooltipHandler)),rv.prototype.initialize.call(this,t,e,n)},canvas(){return this._svg},on(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:Sv(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},off(t,e){const 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}});const $v="aria-hidden",Tv="aria-label",Bv="role",Nv="aria-roledescription",zv="graphics-object",Ov="graphics-symbol",Rv=(t,e,n)=>({[Bv]:t,[Nv]:e,[Tv]:n||void 0}),Uv=Nt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Lv={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?Wv(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),u=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${op(u)?"discrete":u} scale`+` with ${Pp(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?Wv(t):null,r=`${e.type||""} legend`.trim(),i=e.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(t){return t=t.map((t=>t+("fill"===t||"stroke"===t?" color":""))),t.length<2?t[0]:t.slice(0,-1).join(", ")+" and "+F(t)}(o)}`+` with ${Pp(s,u,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${Iv(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Iv(t)}'`}},qv={ariaRole:Bv,ariaRoleDescription:Nv,description:Tv};function Pv(t,e){const n=!1===e.aria;if(t($v,n||void 0),n||null==e.description)for(const e in qv)t(qv[e],void 0);else{const n=e.mark.marktype;t(Tv,e.description),t(Bv,e.ariaRole||("group"===n?zv:Ov)),t(Nv,e.ariaRoleDescription||`${n} mark`)}}function jv(t){return!1===t.aria?{[$v]:!0}:Uv[t.role]?null:Lv[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return Rv(e.role||Ov,e.desc,n.description||r(n))}catch(t){return null}}(t,Lv[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return Rv(n?zv:Ov,`${e} mark container`,t.description)}(t)}function Iv(t){return V(t.text).join(" ")}function Wv(t){try{return V(F(t.items).items[0].text).join(" ")}catch(t){return null}}const Hv=t=>(t+"").replace(/&/g,"&").replace(/ /g,">"),Yv=t=>Hv(t).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g,"
").replace(/\r/g,"
");function Gv(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>(null!=n&&(e+=` ${t}="${Yv(n)}"`),a),a={open(u){(o=>{e&&(t+=`${e}>${n}`,i()),r.push(o)})(u),e="<"+u;for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c${n}${o}>`:"/>"):`${o}>`,i(),a},attr:o,text:t=>(n+=Hv(t),a),toString:()=>t};return a}const Vv=t=>Xv(Gv(),t)+"";function Xv(t,e){if(t.open(e.tagName),e.hasAttributes()){const n=e.attributes,r=n.length;for(let e=0;e1&&t.previousSibling!=e}(a,n))&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}dt(e_,ov,{initialize(t,e,n,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=Ky(t,0,"svg",t_),this._svg.setAttributeNS(Kv,"xmlns",t_),this._svg.setAttributeNS(Kv,"xmlns:xlink",iy["xmlns:xlink"]),this._svg.setAttribute("version",iy.version),this._svg.setAttribute("class","marks"),tv(t,1),this._root=Ky(this._svg,0,"g",t_),h_(this._root,Qv),tv(this._svg,1)),this.background(this._bgcolor),n_.initialize.call(this,t,e,n,r,i)},background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),n_.background.apply(this,arguments)},resize(t,e,n,r){return n_.resize.call(this,t,e,n,r),this._svg&&(h_(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const t=this._svg,e=this._bgcolor;if(!t)return null;let n;e&&(t.removeAttribute("style"),n=Ky(t,0,"rect",t_),h_(n,{width:this._width,height:this._height,fill:e}));const r=Vv(t);return e&&(t.removeChild(n),this._svg.style.setProperty("background-color",e)),r},_render(t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t),tv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const e=++this._dirtyID;let n,r,i,o,a,u,s;for(a=0,u=t.length;a{t.dirty=e}))),r.zdirty||(n.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):n._svg&&(s=n._svg.parentNode,s&&s.removeChild(n._svg)),n._svg=null):(n=o.nested?r.items[0]:n,n._update!==e&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,r_(n,e)),n._update=e)));return!this._dirtyAll},mark(t,e,n){if(!this.isDirty(e))return e._svg;const r=this._svg,i=Py[e.marktype],o=!1===e.interactive?"none":null,a="g"===i.tag,u=a_(e,t,n,"g",r);u.setAttribute("class",ev(e));const s=jv(e);for(const t in s)d_(u,t,s[t]);a||d_(u,"pointer-events",o),d_(u,"clip-path",e.clip?Ig(this,e,e.group):null);let l=null,c=0;const f=t=>{const e=this.isDirty(t),n=a_(t,u,l,i.tag,r);e&&(this._update(i,n,t),a&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;zm(n,(n=>{r=t.mark(e,n,r),++i})),tv(e,1+i)}(this,n,t)),l=n,++c};return i.nested?e.items.length&&f(e.items[0]):zm(e,f),tv(u,c),u},_update(t,e,n){u_=e,s_=e.__values__,Pv(c_,n),t.attr(c_,n,this);const r=l_[t.type];r&&r.call(this,t,e,n),u_&&this.style(u_,n)},style(t,e){if(null!=e){for(const n in Jv){let r="font"===n?Ty(e):e[n];if(r===s_[n])continue;const i=Jv[n];null==r?t.removeAttribute(i):(Wp(r)&&(r=Hp(r,this._defs.gradient,p_())),t.setAttribute(i,r+"")),s_[n]=r}for(const n in Zv)f_(t,Zv[n],e[n])}},defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=Ky(t,1,"defs",t_)),r=i_(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=Ky(t,1,"defs",t_)),r=o_(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):tv(n,r))},_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}});let u_=null,s_=null;const l_={group(t,e,n){const r=u_=e.childNodes[2];s_=r.__values__,t.foreground(c_,n,this),s_=e.__values__,u_=e.childNodes[1],t.content(c_,n,this);const i=u_=e.childNodes[0];t.background(c_,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==s_.events&&(d_(r,"pointer-events",o),d_(i,"pointer-events",o),s_.events=o),n.strokeForeground&&n.stroke){const t=n.fill;d_(r,"display",null),this.style(i,n),d_(i,"stroke",null),t&&(n.fill=null),s_=r.__values__,this.style(r,n),t&&(n.fill=t),u_=null}else d_(r,"display","none")},image(t,e,n){!1===n.smooth?(f_(e,"image-rendering","optimizeSpeed"),f_(e,"image-rendering","pixelated")):f_(e,"image-rendering",null)},text(t,e,n){const r=Fy(n);let i,o,a,u;k(r)?(o=r.map((t=>$y(n,t))),i=o.join("\n"),i!==s_.text&&(tv(e,0),a=e.ownerDocument,u=Cy(n),o.forEach(((t,r)=>{const i=Zy(a,"tspan",t_);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),e.appendChild(i)})),s_.text=i)):(o=$y(n,r),o!==s_.text&&(e.textContent=o,s_.text=o)),d_(e,"font-family",Ty(n)),d_(e,"font-size",Dy(n)+"px"),d_(e,"font-style",n.fontStyle),d_(e,"font-variant",n.fontVariant),d_(e,"font-weight",n.fontWeight)}};function c_(t,e,n){e!==s_[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(u_,t,e,n):d_(u_,t,e),s_[t]=e)}function f_(t,e,n){n!==s_[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),s_[e]=n)}function h_(t,e){for(const n in e)d_(t,n,e[n])}function d_(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function p_(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function g_(t){ov.call(this,t),this._text=null,this._defs={gradient:{},clipping:{}}}dt(g_,ov,{svg(){return this._text},_render(t){const e=Gv();e.open("svg",ot({},iy,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&e.open("rect",{width:this._width,height:this._height,fill:n}).close(),e.open("g",Qv,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this},mark(t,e){const n=Py[e.marktype],r=n.tag,i=[Pv,n.attr];t.open("g",{class:ev(e),"clip-path":e.clip?Ig(this,e,e.group):null},jv(e),{"pointer-events":"g"!==r&&!1===e.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(e,o,i,"g"!==r?r:null)),"text"===r){const e=Fy(o);if(k(e)){const n={x:0,dy:Cy(o)};for(let r=0;rthis.mark(t,e))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(e,o,n.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(e,o,n.foreground,"bgfore")).close()}t.close(),a&&t.close()};return n.nested?e.items&&e.items.length&&o(e.items[0]):zm(e,o),t.close()},href(t){const e=t.href;let n;if(e){if(n=this._hrefs&&this._hrefs[e])return n;this.sanitizeURL(e).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[e]=t}))}return null},attr(t,e,n,r){const i={},o=(t,e,n,r)=>{i[r||t]=e};return Array.isArray(n)?n.forEach((t=>t(o,e,this))):n(o,e,this),r&&function(t,e,n,r,i){let o;if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===r&&(t["font-family"]=Ty(e),t["font-size"]=Dy(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in Jv){let r=e[n];const o=Jv[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Wp(r)&&(r=Hp(r,i.gradient,"")),t[o]=r)}for(const t in Zv){const n=e[t];null!=n&&(o=o||[],o.push(`${Zv[t]}: ${n};`))}o&&(t.style=o.join(" "))}(i,e,t,r,this._defs),i},defs(t){const e=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(e).length+Object.keys(n).length){t.open("defs");for(const n in e){const r=e[n],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Ip+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),t.close(),t.open("radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let e=0;e1?(__[t]=e,this):__[t]}function b_(t,e,n){const r=[],i=(new Wg).union(e),o=t.marktype;return o?w_(t,i,n,r):"group"===o?k_(t,i,n,r):u("Intersect scene must be mark node or group item.")}function w_(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,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!C_(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function F_(t,e){return C_(eg(t),eg(e))}const S_="top",$_="left",T_="right",B_="bottom",N_="top-left",z_="top-right",O_="bottom-left",R_="bottom-right",U_="start",L_="middle",q_="end",P_="x",j_="y",I_="group",W_="axis",H_="title",Y_="frame",G_="scope",V_="legend",X_="row-header",J_="row-footer",Z_="row-title",Q_="column-header",K_="column-footer",tx="column-title",ex="padding",nx="symbol",rx="fit",ix="fit-x",ox="fit-y",ax="pad",ux="none",sx="all",lx="each",cx="flush",fx="column",hx="row";function dx(t){Qa.call(this,null,t)}function px(t,e,n){return e(t.bounds.clear(),t,n)}dt(dx,Qa,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=Py[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),s=px(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===I_||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),s.clear(),r.items.forEach((t=>s.union(px(t,a)))),r.role){case W_:case V_:case H_:e.reflow()}else u=e.changed(e.REM),e.visit(e.ADD,(t=>{s.union(px(t,a))})),e.visit(e.MOD,(t=>{u=u||s.alignsWith(t.bounds),n.dirty(t),s.union(px(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return E_(r),e.modifies("bounds")}});const gx=":vega_identifier:";function mx(t){Qa.call(this,0,t)}function yx(t){Qa.call(this,null,t)}function vx(t){Qa.call(this,null,t)}mx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},dt(mx,Qa,{transform(t,e){const n=(i=e.dataflow)._signals[gx]||(i._signals[gx]=i.add(0)),r=t.as;var i;let o=n.value;return e.visit(e.ADD,(t=>t[r]=t[r]||++o)),n.set(this.value=o),e}}),dt(yx,Qa,{transform(t,e){let n=this.value;n||(n=e.dataflow.scenegraph().mark(t.markdef,function(t){const 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),n.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);const r=n.marktype===I_?Yg:Hg;return e.visit(e.ADD,(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}});const _x={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&xx(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},xx=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),bx=(t,e)=>{for(var n,r=1,i=t.length,o=t[0].bounds;r{const e=t.bounds;return e.width()>1&&e.height()>1},kx=t=>(t.forEach((t=>t.opacity=1)),t),Ax=(t,e)=>t.reflow(e.modified()).modifies("opacity");function Mx(t){Qa.call(this,null,t)}dt(vx,Qa,{transform(t,e){const n=_x[t.method]||_x.parity,r=t.separation||0;let i,o,a=e.materialize(e.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(kx(a),e=Ax(e,t)),e;if(a=a.filter(wx),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=kx(a),e=Ax(e,t),i.length>=3&&bx(i,r)){do{i=n(i,r)}while(i.length>=3&&bx(i,r));i.length<3&&!F(a).opacity&&(i.length>1&&(F(i).opacity=0),F(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new Wg;return e===S_||e===B_?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),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),e}}),dt(Mx,Qa,{transform(t,e){const n=e.dataflow;if(e.visit(e.ALL,(t=>n.dirty(t))),e.fields&&e.fields.zindex){const t=e.source&&e.source[0];t&&(t.mark.zdirty=!0)}}});const Ex=new Wg;function Dx(t,e,n){return t[e]===n?0:(t[e]=n,1)}function Cx(t){var e=t.items[0].orient;return e===$_||e===T_}function Fx(t,e,n,r){var i,o,a=e.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,l=a.orient,c=function(t){let e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(u),f=a.range,h=a.offset,d=a.position,p=a.minExtent,g=a.maxExtent,m=u.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,_=m&&Sy(m),x=0,b=0;switch(Ex.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),l){case S_:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&Sx(t,m,o,y,_,0,-1,v);break;case $_:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&Sx(t,m,o,y,_,1,-1,v);break;case T_:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&Sx(t,m,o,y,_,1,1,v);break;case B_:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&Sx(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return Jg(v.translate(x,b),a),Dx(a,"x",x+s)|Dx(a,"y",b+s)&&(a.bounds=Ex,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function Sx(t,e,n,r,i,o,a,u){const s=e.bounds;if(e.auto){const u=a*(n+i+r);let l=0,c=0;t.dirty(e),o?l=(e.x||0)-(e.x=u):c=(e.y||0)-(e.y=u),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}u.union(s)}const $x=(t,e)=>Math.floor(Math.min(t,e)),Tx=(t,e)=>Math.ceil(Math.max(t,e));function Bx(t){return(new Wg).set(0,0,t.width||0,t.height||0)}function Nx(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function zx(t,e,n){const r=A(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function Ox(t){return t<0?Math.ceil(-t):0}function Rx(t,e,n){var r,i,o,a,u,s,l,c,f,h,d,p=!n.nodirty,g=n.bounds===cx?Bx:Nx,m=Ex.set(0,0,0,0),y=zx(n.align,fx),v=zx(n.align,hx),_=zx(n.padding,fx),x=zx(n.padding,hx),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),k=e.length,A=Array(k),M=Array(b),E=0,D=Array(k),C=Array(w),F=0,S=Array(k),$=Array(k),T=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(v&&zx(n.center,hx)&&1!==b)for(i=0;i0&&($[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),A+=o,g=0,y=e.length;g=0&&null==(x=n[m]);m-=h);u?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),v.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=a(M,v[l])}return M}function jx(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,u=n;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=u,t.dirty(e)}}function Ix(t,e,n,r,i,o,a){const u=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){let n=-1/0;return t.forEach((t=>{null!=t.offset&&(n=Math.max(n,t.offset))})),n>-1/0?n:e}(t,u("offset",0)),l=u("anchor",U_),c=l===q_?1:l===L_?.5:0,f={align:lx,bounds:u("bounds",cx),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case $_:f.anchor={x:Math.floor(r.x1)-s,column:q_,y:c*(a||r.height()+2*r.y1),row:l};break;case T_:f.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case S_:f.anchor={y:Math.floor(i.y1)-s,row:q_,x:c*(o||i.width()+2*i.x1),column:l};break;case B_:f.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case N_:f.anchor={x:s,y:s};break;case z_:f.anchor={x:o-s,y:s,column:q_};break;case O_:f.anchor={x:s,y:a-s,row:q_};break;case R_:f.anchor={x:o-s,y:a-s,column:q_,row:q_}}return f}function Wx(t,e){var n,r,i=e.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,l=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,e,n){var r=e.padding,i=r-n.x,o=r-n.y;if(e.datum.title){var a=e.items[1].items[0],u=a.anchor,s=e.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case $_:i+=Math.ceil(a.bounds.width())+s;break;case T_:case B_:break;default:o+=a.bounds.height()+s}switch((i||o)&&Yx(t,n,i,o),a.orient){case $_:c+=Hx(e,n,a,u,1,1);break;case T_:l+=Hx(e,n,a,q_,0,0)+s,c+=Hx(e,n,a,u,1,1);break;case B_:l+=Hx(e,n,a,u,0,0),c+=Hx(e,n,a,q_,-1,0,1)+s;break;default:l+=Hx(e,n,a,u,0,0)}(l||c)&&Yx(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(Yx(t,n,-l,0),Yx(t,a,-l,0))}else(i||o)&&Yx(t,n,i,o)}(t,i,i.items[0].items[0]),u=function(t,e){return t.items.forEach((t=>e.union(t.bounds))),e.x1=t.padding,e.y1=t.padding,e}(i,u),n=2*i.padding,r=2*i.padding,u.empty()||(n=Math.ceil(u.width()+n),r=Math.ceil(u.height()+r)),o.type===nx&&function(t){const e=t.reduce(((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t)),{});t.forEach((t=>{t.width=e[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==ux&&(i.x=s=0,i.y=l=0),i.width=n,i.height=r,Jg(u.set(s,l,s+n,l+r),i),i.mark.bounds.clear().union(u),i}function Hx(t,e,n,r,i,o,a){const u="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!u||!o&&s||a?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&o?l:0,f=s&&o?0:l,h=i<=0?0:Sy(n);return Math.round(r===U_?c:r===q_?f-h:.5*(l-h))}function Yx(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 Gx(t){Qa.call(this,null,t)}dt(Gx,Qa,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&Ux(n,e,t.layout),function(t,e,n){var r,i,o,a,u,s=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new Wg).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,u=s.length;a{(o=t.orient||T_)!==ux&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];Rx(t,i,Ix(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||n.autosize.type!==rx&&n.autosize.type!==ix&&n.autosize.type!==ox)f.union(r);else switch(e.orient){case $_:case T_:f.add(r.x1,0).add(r.x2,0);break;case S_:case B_:f.add(0,r.y1).add(0,r.y2)}}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var o,a=e.items[0],u=a.frame,s=a.orient,l=a.anchor,c=a.offset,f=a.padding,h=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],p=s===$_||s===T_?r:n,g=0,m=0,y=0,v=0,_=0;if(u!==I_?s===$_?(g=i.y2,p=i.y1):s===T_?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===$_&&(g=r,p=0),o=l===U_?g:l===q_?p:(g+p)/2,d&&d.text){switch(s){case S_:case B_:_=h.bounds.height()+f;break;case $_:v=h.bounds.width()+f;break;case T_:v=-h.bounds.width()-f}Ex.clear().union(d.bounds),Ex.translate(v-(d.x||0),_-(d.y||0)),Dx(d,"x",v)|Dx(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(Ex),d.mark.bounds.clear().union(Ex),t.dirty(d)),Ex.clear().union(d.bounds)}else Ex.clear();switch(Ex.union(h.bounds),s){case S_:m=o,y=i.y1-Ex.height()-c;break;case $_:m=i.x1-Ex.width()-c,y=o;break;case T_:m=i.x2+Ex.width()+c,y=o;break;case B_:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return Dx(a,"x",m)|Dx(a,"y",y)&&(Ex.translate(m,y),t.dirty(a),a.bounds.clear().union(Ex),e.bounds.clear().union(Ex),t.dirty(a)),a.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||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,e.height||0),f=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-s)),d=Math.max(0,Math.ceil(n.y2-c));if(i.contains===ex){const e=t.padding();a-=e.left+e.right,u-=e.top+e.bottom}o===ux?(l=0,f=0,s=a,c=u):o===rx?(s=Math.max(0,a-l-h),c=Math.max(0,u-f-d)):o===ix?(s=Math.max(0,a-l-h),u=c+f+d):o===ox?(a=s+l+h,c=Math.max(0,u-f-d)):o===ax&&(a=s+l+h,u=c+f+d);t._resizeView(a,u,s,c,[l,f],i.resize)}(t,e,f,n)}(n,e,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e}});var Vx=Object.freeze({__proto__:null,bound:dx,identifier:mx,mark:yx,overlap:vx,render:Mx,viewlayout:Gx});function Xx(t){Qa.call(this,null,t)}function Jx(t){Qa.call(this,null,t)}function Zx(){return ba({})}function Qx(t){Qa.call(this,null,t)}function Kx(t){Qa.call(this,[],t)}dt(Xx,Qa,{transform(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,o=t.scale,a=Mp(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Cp(n,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Ep(o,t.values,a):Dp(o,a);return i&&(r.rem=i),i=s.map(((t,e)=>ba({index:e/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ba({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),dt(Jx,Qa,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||Zx,o=t.key||_a,a=this.value;return k(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&u("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=ft().test((t=>t.exit));return e.lookup=n=>e.get(t(n)),e}(o)),e.visit(e.ADD,(t=>{const e=o(t);let n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),a.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(t=>{const e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(t=>{const e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),r}}),dt(Qx,Qa,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(k(o)){if(!n.changed()&&!o.every((t=>i[t])))return e.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,u=i.update||g,s=i.enter||g,l=i.exit||g,c=(o&&!a?i[o]:u)||g;if(e.changed(e.ADD)&&(e.visit(e.ADD,(e=>{s(e,t),u(e,t)})),n.modifies(s.output),n.modifies(u.output),c!==g&&c!==u&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==g&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==g){const i=e.MOD|(t.modified()?e.REFLOW:0);a?(e.visit(i,(e=>{const i=s(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(s.output)):e.visit(i,(e=>{(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation}}),dt(Kx,Qa,{transform(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a,u=e.dataflow.locale(),s=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||xp,f=t.scale,h=+t.limit,d=Mp(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===xp,g=t.format||Np(u,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Tp(f,d);return l&&(s.rem=l),c===xp?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,J(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),o=l.reduce(((e,n)=>Math.max(e,i(n,t))),0)):i=rt(o=i||8),l=l.map(((e,n)=>ba({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(ba({index:l.length,label:`…${m.length-l.length} entries`,value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=pp(f,n[0],F(n)),m.length<3&&!t.values&&n[0]!==F(n)&&(m=[n[0],F(n)]),l=m.map(((t,e)=>ba({index:e,label:g(t,e,m),value:t,perc:r(t)})))):(i=m.length-1,r=function(t){const e=t.domain(),n=e.length-1;let r=+e[0],i=+F(e),o=i-r;if(t.type===Ud){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>ba({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})))),s.source=l,s.add=l,this.value=l,s}});const tb=t=>t.source.x,eb=t=>t.source.y,nb=t=>t.target.x,rb=t=>t.target.y;function ib(t){Qa.call(this,{},t)}ib.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"}]},dt(ib,Qa,{transform(t,e){var n=t.sourceX||tb,r=t.sourceY||eb,i=t.targetX||nb,o=t.targetY||rb,a=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=sb.get(l+"-"+s)||sb.get(l);return c||u("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(t=>{t[a]=c(n(t),r(t),i(t),o(t))})),e.reflow(t.modified()).modifies(a)}});const ob=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,ab=(t,e,n,r)=>{var i=n-t,o=r-e,a=Math.sqrt(i*i+o*o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r},ub=(t,e,n,r)=>{const i=n-t,o=r-e,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+u)+" "+(n+u)+","+(r-a)+" "+n+","+r},sb=ft({line:ob,"line-radial":(t,e,n,r)=>ob(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:ab,"arc-radial":(t,e,n,r)=>ab(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:ub,"curve-radial":(t,e,n,r)=>ub(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(t,e,n,r)=>"M"+t+","+e+"V"+r+"H"+n,"orthogonal-vertical":(t,e,n,r)=>"M"+t+","+e+"H"+n+"V"+r,"orthogonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,e,n,r)=>{const i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(t,e,n,r)=>{const i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function lb(t){Qa.call(this,null,t)}lb.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"]}]},dt(lb,Qa,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.field||d,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),p=h.length,g=l,m=(c-l)/Be(h),y=Te(p);for(t.sort&&y.sort(((t,e)=>h[t]-h[e])),n=0;nt+(e<0?-1:e>0?1:0)),0))!==e.length&&n.warn("Log scale domain includes zero: "+Ft(e)));return e}function gb(t,e,n){return J(t)&&(e||n)?fp(t,mb(e||[0,1],n)):t}function mb(t,e){return e?t.slice().reverse():t}function yb(t){Qa.call(this,null,t)}dt(db,Qa,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===Nd)return Nd+"-"+Dd;(function(t){const e=t.type;return ip(e)&&e!==Td&&e!==Bd&&(t.scheme||t.range&&t.range.length&&t.range.every(xt))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?Nd+"-":3===e?zd+"-":"");return(r+n||Dd).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=ep(i)()),t)if(!hb[i]){if("padding"===i&&fb(r.type))continue;J(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){t!==Pd&&t!==qd&&u("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===qd?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Ed(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;k(e.scheme)?r=hp(e.scheme,e.interpolate,e.interpolateGamma):(r=_p(e.scheme.toLowerCase()))||u(`Unrecognized scheme name: ${e.scheme}`);return n=t===Ud?n+1:t===jd?n-1:t===Od||t===Rd?+e.schemeCount||cb:n,sp(t)?gb(r,i,e.reverse):J(r)?dp(gb(r,i),n):t===Ld?r:r.slice(0,n)}(r,e,n),J(o))){if(t.interpolator)return t.interpolator(o);u(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&sp(r))return t.interpolator(hp(mb(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(gp(e.interpolate,e.interpolateGamma)):J(t.round)?t.round(i):J(t.rangeRound)&&t.interpolate(i?wh:bh);o&&t.range(mb(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!k(r)){const e=t.domain(),n=e[0],i=F(e),o=r.step;let a=null==r.start?n:r.start,s=null==r.stop?i:r.stop;o||u("Scale bins parameter missing step property."),ai&&(s=o*Math.floor(i/o)),r=Te(a,s+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===jd&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){const r=function(t,e,n){return e?(t.domain(pb(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,u=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&(e===Dd||e===Fd||e===Sd)}(t);if(!a)return 0;fb(u)&&e.padding&&a[0]!==F(a)&&(a=function(t,e,n,r,i,o){var a=Math.abs(F(n)-n[0]),u=a/(a-2*r),s=t===Cd?I(e,null,u):t===Sd?W(e,null,u,.5):t===Fd?W(e,null,u,i||1):t===$d?H(e,null,u,o||1):j(e,null,u);return e=e.slice(),e[0]=s[0],e[e.length-1]=s[1],e}(u,a,e.range,e.padding,e.exponent,e.constant));if((s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid)){const t=(o=e.domainMid)>a[i]?i+1:ot(s);if(null==e)d.push(t.slice());else for(i={},o=0,a=t.length;oh&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,o=n.max;r0?1:t<0?-1:0},Yb=Math.sqrt,Gb=Math.tan;function Vb(t){return t>1?0:t<-1?Fb:Math.acos(t)}function Xb(t){return t>1?Sb:t<-1?-Sb:Math.asin(t)}function Jb(){}function Zb(t,e){t&&Kb.hasOwnProperty(t.type)&&Kb[t.type](t,e)}var Qb={Feature:function(t,e){Zb(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=Ub(e=(e*=Nb)/2+$b),a=Wb(e),u=uw*a,s=aw*o+u*Ub(i),l=u*r*Wb(i);_w.add(Rb(l,s)),ow=t,aw=o,uw=a}function Ew(t){return[Rb(t[1],t[0]),Xb(t[2])]}function Dw(t){var e=t[0],n=t[1],r=Ub(n);return[r*Ub(e),r*Wb(e),Wb(n)]}function Cw(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Fw(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 Sw(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function $w(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Tw(t){var e=Yb(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Bw,Nw,zw,Ow,Rw,Uw,Lw,qw,Pw,jw,Iw,Ww,Hw,Yw,Gw,Vw,Xw={point:Jw,lineStart:Qw,lineEnd:Kw,polygonStart:function(){Xw.point=tk,Xw.lineStart=ek,Xw.lineEnd=nk,mw=new le,bw.polygonStart()},polygonEnd:function(){bw.polygonEnd(),Xw.point=Jw,Xw.lineStart=Qw,Xw.lineEnd=Kw,_w<0?(sw=-(cw=180),lw=-(fw=90)):mw>Db?fw=90:mw<-Db&&(lw=-90),vw[0]=sw,vw[1]=cw},sphere:function(){sw=-(cw=180),lw=-(fw=90)}};function Jw(t,e){yw.push(vw=[sw=t,cw=t]),efw&&(fw=e)}function Zw(t,e){var n=Dw([t*Nb,e*Nb]);if(gw){var r=Fw(gw,n),i=Fw([r[1],-r[0],0],r);Tw(i),i=Ew(i);var o,a=t-hw,u=a>0?1:-1,s=i[0]*Bb*u,l=zb(a)>180;l^(u*hwfw&&(fw=o):l^(u*hw<(s=(s+360)%360-180)&&sfw&&(fw=e)),l?trk(sw,cw)&&(cw=t):rk(t,cw)>rk(sw,cw)&&(sw=t):cw>=sw?(tcw&&(cw=t)):t>hw?rk(sw,t)>rk(sw,cw)&&(cw=t):rk(t,cw)>rk(sw,cw)&&(sw=t)}else yw.push(vw=[sw=t,cw=t]);efw&&(fw=e),gw=n,hw=t}function Qw(){Xw.point=Zw}function Kw(){vw[0]=sw,vw[1]=cw,Xw.point=Jw,gw=null}function tk(t,e){if(gw){var n=t-hw;mw.add(zb(n)>180?n+(n>0?360:-360):n)}else dw=t,pw=e;bw.point(t,e),Zw(t,e)}function ek(){bw.lineStart()}function nk(){tk(dw,pw),bw.lineEnd(),zb(mw)>Db&&(sw=-(cw=180)),vw[0]=sw,vw[1]=cw,gw=null}function rk(t,e){return(e-=t)<0?e+360:e}function ik(t,e){return t[0]-e[0]}function ok(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eFb&&(t-=Math.round(t/Tb)*Tb),[t,e]}function _k(t,e,n){return(t%=Tb)?e||n?yk(bk(t),wk(e,n)):bk(t):e||n?wk(e,n):vk}function xk(t){return function(e,n){return zb(e+=t)>Fb&&(e-=Math.round(e/Tb)*Tb),[e,n]}}function bk(t){var e=xk(t);return e.invert=xk(-t),e}function wk(t,e){var n=Ub(t),r=Wb(t),i=Ub(e),o=Wb(e);function a(t,e){var a=Ub(e),u=Ub(t)*a,s=Wb(t)*a,l=Wb(e),c=l*n+u*r;return[Rb(s*i-c*o,u*n-l*r),Xb(c*i+s*o)]}return a.invert=function(t,e){var a=Ub(e),u=Ub(t)*a,s=Wb(t)*a,l=Wb(e),c=l*i-s*o;return[Rb(s*i+l*o,u*n+c*r),Xb(c*n-u*r)]},a}function kk(t,e){(e=Dw(e))[0]-=t,Tw(e);var n=Vb(-e[1]);return((-e[2]<0?-n:n)+Tb-Db)%Tb}function Ak(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Jb,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Mk(t,e){return zb(t[0]-e[0])=0;--o)i.point((c=l[o])[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 Ck(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,E=M*A,D=E>Fb,C=m*w;if(s.add(Rb(C*M*Wb(E),y*k+C*Ub(E))),a+=D?A+M*Tb:A,D^p>=n^x>=n){var F=Fw(Dw(d),Dw(_));Tw(F);var S=Fw(o,F);Tw(S);var $=(D^A>=0?-1:1)*Xb(S[2]);(r>$||r===$&&(F[0]||F[1]))&&(u+=D^A>=0?1:-1)}}return(a<-Db||a0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter($k))}return h}}function $k(t){return t.length>1}function Tk(t,e){return((t=t.x)[0]<0?t[1]-Sb-Db:Sb-t[1])-((e=e.x)[0]<0?e[1]-Sb-Db:Sb-e[1])}vk.invert=vk;var Bk=Sk((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var u=o>0?Fb:-Fb,s=zb(o-n);zb(s-Fb)0?Sb:-Sb),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),e=0):i!==u&&s>=Fb&&(zb(n-i)Db?Ob((Wb(e)*(o=Ub(r))*Wb(n)-Wb(r)*(i=Ub(e))*Wb(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),e=0),t.point(n=o,r=a),i=u},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*Sb,r.point(-Fb,i),r.point(0,i),r.point(Fb,i),r.point(Fb,0),r.point(Fb,-i),r.point(0,-i),r.point(-Fb,-i),r.point(-Fb,0),r.point(-Fb,i);else if(zb(t[0]-e[0])>Db){var o=t[0]0,i=zb(e)>Db;function o(t,n){return Ub(t)*Ub(n)>e}function a(t,n,r){var i=[1,0,0],o=Fw(Dw(t),Dw(n)),a=Cw(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var l=e*a/s,c=-e*u/s,f=Fw(i,o),h=$w(i,l);Sw(h,$w(o,c));var d=f,p=Cw(h,d),g=Cw(d,d),m=p*p-g*(Cw(h,h)-1);if(!(m<0)){var y=Yb(m),v=$w(d,(-p-y)/g);if(Sw(v,h),v=Ew(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],k=n[1];b0^v[1]<(zb(v[0]-x)Fb^(x<=v[0]&&v[0]<=b)){var E=$w(d,(-p+y)/g);return Sw(E,h),[v,Ew(E)]}}}function u(e,n){var i=r?t:Fb-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return Sk(o,(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=o(f,h),m=r?g?0:u(f,h):g?u(f+(f<0?Fb:-Fb),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=a(e,p))||Mk(e,d)||Mk(p,d))&&(p[2]=1),g!==s)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;m&n||!(y=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&Mk(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,o){!function(t,e,n,r,i,o){if(n){var a=Ub(e),u=Wb(e),s=r*n;null==i?(i=e+r*Tb,o=e-s/2):(i=kk(a,i),o=kk(a,o),(r>0?io)&&(i+=r*Tb));for(var l,c=i;r>0?c>o:c0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return zb(r[0]-t)0?0:3:zb(r[0]-n)0?2:1:zb(r[1]-e)0?1:0:i>0?3:2}function u(t,e){return s(t.x,e.x)}function s(t,e){var n=a(t,1),r=a(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(a){var s,l,c,f,h,d,p,g,m,y,v,_=a,x=Ak(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);y=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(k(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(h-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=v&&e,i=(s=$e(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Dk(s,u,e,o,a),a.polygonEnd());_=a,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function k(o,a){var u=i(o,a);if(l&&c.push([o,a]),y)f=o,h=a,d=u,y=!1,u&&(_.lineStart(),_.point(o,a));else if(u&&m)_.point(o,a);else{var s=[p=Math.max(Ok,Math.min(zk,p)),g=Math.max(Ok,Math.min(zk,g))],x=[o=Math.max(Ok,Math.min(zk,o)),a=Math.max(Ok,Math.min(zk,a))];!function(t,e,n,r,i,o){var a,u=t[0],s=t[1],l=0,c=1,f=e[0]-u,h=e[1]-s;if(a=n-u,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=h,h<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a0&&(t[0]=u+l*f,t[1]=s+l*h),c<1&&(e[0]=u+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?u&&(_.lineStart(),_.point(o,a),v=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),u||_.lineEnd(),v=!1)}p=o,g=a,m=u}return b}}function Uk(t,e,n){var r=Te(t,e-Db,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Lk(t,e,n){var r=Te(t,e-Db,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var qk,Pk,jk,Ik,Wk=t=>t,Hk=new le,Yk=new le,Gk={point:Jb,lineStart:Jb,lineEnd:Jb,polygonStart:function(){Gk.lineStart=Vk,Gk.lineEnd=Zk},polygonEnd:function(){Gk.lineStart=Gk.lineEnd=Gk.point=Jb,Hk.add(zb(Yk)),Yk=new le},result:function(){var t=Hk/2;return Hk=new le,t}};function Vk(){Gk.point=Xk}function Xk(t,e){Gk.point=Jk,qk=jk=t,Pk=Ik=e}function Jk(t,e){Yk.add(Ik*t-jk*e),jk=t,Ik=e}function Zk(){Jk(qk,Pk)}var Qk=Gk,Kk=1/0,tA=Kk,eA=-Kk,nA=eA,rA={point:function(t,e){teA&&(eA=t);enA&&(nA=e)},lineStart:Jb,lineEnd:Jb,polygonStart:Jb,polygonEnd:Jb,result:function(){var t=[[Kk,tA],[eA,nA]];return eA=nA=-(tA=Kk=1/0),t}};var iA,oA,aA,uA,sA=rA,lA=0,cA=0,fA=0,hA=0,dA=0,pA=0,gA=0,mA=0,yA=0,vA={point:_A,lineStart:xA,lineEnd:kA,polygonStart:function(){vA.lineStart=AA,vA.lineEnd=MA},polygonEnd:function(){vA.point=_A,vA.lineStart=xA,vA.lineEnd=kA},result:function(){var t=yA?[gA/yA,mA/yA]:pA?[hA/pA,dA/pA]:fA?[lA/fA,cA/fA]:[NaN,NaN];return lA=cA=fA=hA=dA=pA=gA=mA=yA=0,t}};function _A(t,e){lA+=t,cA+=e,++fA}function xA(){vA.point=bA}function bA(t,e){vA.point=wA,_A(aA=t,uA=e)}function wA(t,e){var n=t-aA,r=e-uA,i=Yb(n*n+r*r);hA+=i*(aA+t)/2,dA+=i*(uA+e)/2,pA+=i,_A(aA=t,uA=e)}function kA(){vA.point=_A}function AA(){vA.point=EA}function MA(){DA(iA,oA)}function EA(t,e){vA.point=DA,_A(iA=aA=t,oA=uA=e)}function DA(t,e){var n=t-aA,r=e-uA,i=Yb(n*n+r*r);hA+=i*(aA+t)/2,dA+=i*(uA+e)/2,pA+=i,gA+=(i=uA*t-aA*e)*(aA+t),mA+=i*(uA+e),yA+=3*i,_A(aA=t,uA=e)}var CA=vA;function FA(t){this._context=t}FA.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,Tb)}},result:Jb};var SA,$A,TA,BA,NA,zA=new le,OA={point:Jb,lineStart:function(){OA.point=RA},lineEnd:function(){SA&&UA($A,TA),OA.point=Jb},polygonStart:function(){SA=!0},polygonEnd:function(){SA=null},result:function(){var t=+zA;return zA=new le,t}};function RA(t,e){OA.point=UA,$A=BA=t,TA=NA=e}function UA(t,e){BA-=t,NA-=e,zA.add(Yb(BA*BA+NA*NA)),BA=t,NA=e}var LA=OA;let qA,PA,jA,IA;class WA{constructor(t){this._append=null==t?HA:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return HA;if(e!==qA){const t=10**e;qA=e,PA=function(e){let n=1;this._+=e[0];for(const r=e.length;n=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new WA(i)),a},a.projection(t).digits(i).context(e)}function GA(t){return function(e){var n=new VA;for(var r in t)n[r]=t[r];return n.stream=e,n}}function VA(){}function XA(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),nw(n,t.stream(sA)),e(sA.result()),null!=r&&t.clipExtent(r),t}function JA(t,e,n){return XA(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,u])}),n)}function ZA(t,e,n){return JA(t,[[0,0],e],n)}function QA(t,e,n){return XA(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function KA(t,e,n){return XA(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}VA.prototype={constructor:VA,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 tM=16,eM=Ub(30*Nb);function nM(t,e){return+e?function(t,e){function n(r,i,o,a,u,s,l,c,f,h,d,p,g,m){var y=l-r,v=c-i,_=y*y+v*v;if(_>4*e&&g--){var x=a+h,b=u+d,w=s+p,k=Yb(x*x+b*b+w*w),A=Xb(w/=k),M=zb(zb(w)-1)e||zb((y*F+v*S)/_-.5)>.3||a*h+u*d+s*p2?t[2]%360*Nb:0,F()):[m*Bb,y*Bb,v*Bb]},D.angle=function(t){return arguments.length?(_=t%360*Nb,F()):_*Bb},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(a=nM(u,E=t*t),S()):Yb(E)},D.fitExtent=function(t,e){return JA(D,t,e)},D.fitSize=function(t,e){return ZA(D,t,e)},D.fitWidth=function(t,e){return QA(D,t,e)},D.fitHeight=function(t,e){return KA(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function uM(t){var e=0,n=Fb/3,r=aM(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Nb,n=t[1]*Nb):[e*Bb,n*Bb]},i}function sM(t,e){var n=Wb(t),r=(n+Wb(e))/2;if(zb(r)2?t[2]*Nb:0),e.invert=function(e){return(e=t.invert(e[0]*Nb,e[1]*Nb))[0]*=Bb,e[1]*=Bb,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===gM?[[Math.max(u[0]-o,l),e],[Math.min(u[0]+o,n),r]]:[[l,Math.max(u[1]-o,e)],[n,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),c()):a()},i.translate=function(t){return arguments.length?(u(t),c()):u()},i.center=function(t){return arguments.length?(o(t),c()):o()},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 yM(t){return Gb((Sb+t)/2)}function vM(t,e){var n=Ub(t),r=t===e?Wb(t):jb(n/Ub(e))/jb(yM(e)/yM(t)),i=n*Ib(yM(t),r)/r;if(!r)return gM;function o(t,e){i>0?e<-Sb+Db&&(e=-Sb+Db):e>Sb-Db&&(e=Sb-Db);var n=i/Ib(yM(e),r);return[n*Wb(r*t),i-n*Ub(r*t)]}return o.invert=function(t,e){var n=i-e,o=Hb(r)*Yb(t*t+n*n),a=Rb(t,zb(n))*Hb(n);return n*r<0&&(a-=Fb*Hb(t)*Hb(n)),[a/r,2*Ob(Ib(i/o,1/r))-Sb]},o}function _M(t,e){return[t,e]}function xM(t,e){var n=Ub(t),r=t===e?Wb(t):(n-Ub(e))/(e-t),i=n/r+t;if(zb(r)Db&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},FM.invert=hM(Xb),SM.invert=hM((function(t){return 2*Ob(t)})),$M.invert=function(t,e){return[-e,2*Ob(qb(t))-Sb]};var TM=Math.abs,BM=Math.cos,NM=Math.sin,zM=1e-6,OM=Math.PI,RM=OM/2,UM=function(t){return t>0?Math.sqrt(t):0}(2);function LM(t){return t>1?RM:t<-1?-RM:Math.asin(t)}function qM(t,e){var n,r=t*NM(e),i=30;do{e-=n=(e+NM(e)-r)/(1+BM(e))}while(TM(n)>zM&&--i>0);return e/2}var PM=function(t,e,n){function r(r,i){return[t*r*BM(i=qM(n,i)),e*NM(i)]}return r.invert=function(r,i){return i=LM(i/e),[r/(t*BM(i)),LM((2*i+NM(2*i))/n)]},r}(UM/RM,UM,OM);const jM=YA(),IM=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function WM(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(YM[t]=function(t,e){return function n(){const r=e();return r.type=t,r.path=YA().projection(r),r.copy=r.copy||function(){const t=n();return IM.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},tp(r)}}(t,e),this):YM[t]||null}function HM(t){return t&&t.path||jM}const YM={albers:cM,albersusa:function(){var t,e,n,r,i,o,a=cM(),u=lM().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=lM().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){o=[t,e]}};function c(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),u.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(const t in YM)WM(t,YM[t]);function GM(){}const VM=[[],[[[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 XM(){var t=1,e=1,n=a;function r(t,e){return e.map((e=>i(t,e)))}function i(r,i){var a=[],u=[];return function(n,r,i){var a,u,s,l,c,f,h=new Array,d=new Array;a=u=-1,l=n[0]>=r,VM[l<<1].forEach(p);for(;++a=r,VM[s|l<<1].forEach(p);VM[l<<0].forEach(p);for(;++u=r,c=n[u*t]>=r,VM[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[u*t+a+1]>=r,VM[s|l<<1|c<<2|f<<3].forEach(p);VM[l|c<<3].forEach(p)}a=-1,c=n[u*t]>=r,VM[c<<2].forEach(p);for(;++a=r,VM[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],l=o(r),c=o(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]}}VM[c<<3].forEach(p)}(r,i,(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(;++e0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var e,n=0,r=a.length;n{var o,a=n[0],u=n[1],s=0|a,l=0|u,c=r[l*t+s];a>0&&a0&&u=0&&o>=0||u("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:GM,r):n===a},r}function JM(t,e){for(var n,r=-1,i=e.length;++rr!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function QM(t,e,n){var r,i,o,a;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])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function KM(t,e,n){return function(r){var i=at(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=e?ke(o,a,t):u/(t+1);return Te(o+s,a,s)}}function tE(t){Qa.call(this,null,t)}function eE(t,e,n,r,i){const o=t.x1||0,a=t.y1||0,u=e*n<0;function s(t){t.forEach(l)}function l(t){u&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-o)*e+r,t[1]=(t[1]-a)*n+i}return function(t){return t.coordinates.forEach(s),t}}function nE(t,e,n){const r=t>=0?t:ou(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function rE(t){return J(t)?t:rt(+t)}function iE(){var t=t=>t[0],e=t=>t[1],n=d,r=[-1,-1],i=960,o=500,a=2;function s(u,s){const l=nE(r[0],u,t)>>a,c=nE(r[1],u,e)>>a,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>a),p=2*h+(o>>a),g=new Float32Array(d*p),m=new Float32Array(d*p);let y=g;u.forEach((r=>{const i=f+(+t(r)>>a),o=h+(+e(r)>>a);i>=0&&i=0&&o0&&c>0?(oE(d,p,g,m,l),aE(d,p,m,g,c),oE(d,p,g,m,l),aE(d,p,m,g,c),oE(d,p,g,m,l),aE(d,p,m,g,c)):l>0?(oE(d,p,g,m,l),oE(d,p,m,g,l),oE(d,p,g,m,l),y=m):c>0&&(aE(d,p,g,m,c),aE(d,p,m,g,c),aE(d,p,g,m,c),y=m);const v=s?Math.pow(2,-2*a):1/Be(y);for(let t=0,e=d*p;t>a),y2:h+(o>>a)}}return s.x=function(e){return arguments.length?(t=rE(e),s):t},s.y=function(t){return arguments.length?(e=rE(t),s):e},s.weight=function(t){return arguments.length?(n=rE(t),s):n},s.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||u("invalid size"),i=e,o=n,s},s.cellSize=function(t){return arguments.length?((t=+t)>=1||u("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),s):1<=i&&(e>=o&&(u-=n[e-o+a*t]),r[e-i+a*t]=u/Math.min(e+1,t-1+o-e,o))}function aE(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a=i&&(u>=o&&(s-=n[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,e-1+o-u,o))}function uE(t){Qa.call(this,null,t)}tE.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"}]},dt(tE,Qa,{transform(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||f,o=XM().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=KM(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>Ae(e(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((e=>{const n=i(e),r=o.size([n.width,n.height])(n.values,k(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;J(i)&&(i=i(n,r));J(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(vt(i)?i:i[0])||1,u=(vt(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;t.forEach(eE(e,a,u,s,l))}(r,n,e,t),r.forEach((t=>{s.push(ka(e,ba(null!=u?{[u]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n}}),uE.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const sE=["x","y","weight","size","cellSize","bandwidth"];function lE(t,e){return sE.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function cE(t){Qa.call(this,null,t)}dt(uE,Qa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=function(t,e){var n,r,i,o,a,u,s=[],l=t=>t(o);if(null==e)s.push(t);else for(n={},r=0,i=t.length;rba(function(t,e){for(let n=0;nDb})).map(s)).concat(Te(Lb(o/d)*d,i,d).filter((function(t){return zb(t%g)>Db})).map(l))}return y.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],u=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),u>a&&(t=u,u=a,a=t),y.precision(m)):[[r,u],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(m)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],y):[h,d]},y.precision=function(h){return arguments.length?(m=+h,s=Uk(o,i,90),l=Lk(e,t,m),c=Uk(u,a,90),f=Lk(r,n,m),y):m},y.extentMajor([[-180,-90+Db],[180,90-Db]]).extentMinor([[-180,-80-Db],[180,80+Db]])}()}function vE(t){Qa.call(this,null,t)}function _E(t){if(!J(t))return!1;const e=Nt(r(t));return e.$x||e.$y||e.$value||e.$max}function xE(t){Qa.call(this,null,t),this.modified(!0)}function bE(t,e,n){J(t[e])&&t[e](n)}dE.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},dt(dE,Qa,{transform(t,e){var n,i=this._features,o=this._points,a=t.fields,u=a&&a[0],s=a&&a[1],l=t.geojson||!a&&f,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(r(l))||u&&e.modified(r(u))||s&&e.modified(r(s)),this.value&&!n||(c=e.SOURCE,this._features=i=[],this._points=o=[]),l&&e.visit(c,(t=>i.push(l(t)))),u&&s&&(e.visit(c,(t=>{var e=u(t),n=s(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&o.push([e,n])})),i=i.concat({type:fE,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:hE,features:i}}}),pE.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"}]},dt(pE,Qa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||f,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=HM(t.projection),n.materialize().reflow()):a=i===f||e.modified(i.fields)?n.ADD_MOD:n.ADD;const u=function(t,e){const n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),n.modifies(o)}}),gE.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"]}]},dt(gE,Qa,{transform(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function l(t){const e=r([i(t),o(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=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(o.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(a)}}),mE.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"}]},dt(mE,Qa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",o=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){const r=null==n?n=>t(e(n)):r=>{var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=e=>(t.context(e),r),r}(HM(t.projection),t.field||l("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),yE.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}]},dt(yE,Qa,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)J(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push(Aa(r[0],n)):e.add.push(ba(n)),r[0]=n,e}}),vE.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"}]},dt(vE,Qa,{transform(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||f,o=function(t,e){let n;J(t)?(n=n=>t(n,e),n.dep=_E(t)):t?n=rt(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;J(t)?(n=n=>ff(t(n,e)),n.dep=_E(t)):n=rt(ff(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?Ae(n.map((t=>Ae(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=ot({},t,s);r||(n.$max=Ae(e.values||[])),t[u]=function(t,e,n,r){const i=t.width,o=t.height,a=t.x1||0,u=t.y1||0,s=t.x2||i,l=t.y2||o,c=t.values,f=c?t=>c[t]:h,d=Oc(s-a,l-u),p=d.getContext("2d"),g=p.getImageData(0,0,s-a,l-u),m=g.data;for(let t=u,o=0;t{null!=t[e]&&bE(n,e,t[e])}))):IM.forEach((e=>{t.modified(e)&&bE(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return t=V(t),1===t.length?t[0]:{type:hE,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===hE?t.features:V(t).filter((t=>null!=t)).map((t=>t.type===fE?t:{type:fE,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 wE=Object.freeze({__proto__:null,contour:cE,geojson:dE,geopath:pE,geopoint:gE,geoshape:mE,graticule:yE,heatmap:vE,isocontour:tE,kde2d:uE,projection:xE});function kE(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,y=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&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>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a}while((f=c<<1|l)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[f]=p,t}function AE(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function ME(t){return t[0]}function EE(t){return t[1]}function DE(t,e,n){var r=new CE(null==e?ME:e,null==n?EE:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function CE(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function FE(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var SE=DE.prototype=CE.prototype;function $E(t){return function(){return t}}function TE(t){return 1e-6*(t()-.5)}function BE(t){return t.x+t.vx}function NE(t){return t.y+t.vy}function zE(t){return t.index}function OE(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}SE.copy=function(){var t,e,n=new CE(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=FE(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]=FE(e));return n},SE.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return kE(this.cover(e,n),e,n,t)},SE.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;nt||t>=i||r>e||e>=o;)switch(u=(eh||(o=s.y0)>d||(a=s.x1)=y)<<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 v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=v*v+_*_;if(x=(u=(p+m)/2))?p=u:m=u,(c=a>=(s=(g+y)/2))?g=s:y=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)},SE.removeAll=function(t){for(var e=0,n=t.length;e{}};function UE(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--WE}()}finally{WE=0,function(){var t,e,n=jE,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:jE=e);IE=t,oD(r)}(),XE=0}}function iD(){var t=ZE.now(),e=t-VE;e>GE&&(JE-=e,VE=t)}function oD(t){WE||(HE&&(HE=clearTimeout(HE)),t-XE>24?(t<1/0&&(HE=setTimeout(rD,t-ZE.now()-JE)),YE&&(YE=clearInterval(YE))):(YE||(VE=ZE.now(),YE=setInterval(iD,GE)),WE=1,QE(rD)))}eD.prototype=nD.prototype={constructor:eD,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?KE():+n)+(null==e?0:+e),this._next||IE===this||(IE?IE._next=this:jE=this,IE=this),this._call=t,this._time=n,oD()},stop:function(){this._call&&(this._call=null,this._time=1/0,oD())}};const aD=1664525,uD=1013904223,sD=4294967296;function lD(t){return t.x}function cD(t){return t.y}var fD=10,hD=Math.PI*(3-Math.sqrt(5));function dD(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=nD(f),l=UE("tick","end"),c=function(){let t=1;return()=>(t=(aD*t+uD)%sD)/sD}();function f(){h(),l.call("tick",e),n1?(null==n?u.delete(t):u.set(t,p(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,u,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,n),e):l.on(t)}}}const pD={center:function(t,e){var n,r=1;function i(){var i,o,a=n.length,u=0,s=0;for(i=0;il+p||oc+p||as.index){var g=l-u.x-u.vx,m=c-u.y-u.vy,y=g*g+m*m;yt.r&&(t.r=t[e].r)}function s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r=u)){(t.data!==e||t.next)&&(0===f&&(p+=(f=TE(n))*f),0===h&&(p+=(h=TE(n))*h),p