All Downloads are FREE. Search and download functionalities are using the official Maven repository.

[email protected] Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta-1
Show newest version
!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}`:"/>"):``,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[u(t,e,r),t])));for(a=0,i=new Array(l);ae(t,n):e)}_D.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:vD}]},dt(_D,Qa,{transform(t,e){var n,r,i=this.value,o=e.changed(e.ADD_REM),a=t.modified(mD),u=t.iterations||300;if(i?(o&&(e.modifies("index"),i.nodes(e.source)),(a||e.changed(e.MOD))&&xD(i,t,0,e)):(this.value=i=function(t,e){const n=dD(t),r=n.stop,i=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,i()),n.stop=()=>(o=!0,r()),xD(n,e,!0).on("end",(()=>o=!0))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,()=>n.touch(r).run())),t.static||(o=!0,i.tick()),e.modifies("index")),a||o||t.modified(yD)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return e.StopPropagation;return this.finish(t,e)},finish(t,e){const n=e.dataflow;for(let t,e=this._argops,u=0,s=e.length;u=0;)e+=n[r].value;else e=1;t.value=e}function FD(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=$D)):void 0===e&&(e=SD);for(var n,r,i,o,a,u=new ND(t),s=[u];n=s.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new ND(i[o])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(BD)}function SD(t){return t.children}function $D(t){return Array.isArray(t)?t[1]:null}function TD(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function BD(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function ND(t){this.data=t,this.depth=this.height=0,this.parent=null}function zD(t){return null==t?null:OD(t)}function OD(t){if("function"!=typeof t)throw new Error;return t}function RD(){return 0}function UD(t){return function(){return t}}ND.prototype=FD.prototype={constructor:ND,count:function(){return this.eachAfter(CD)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return FD(this).eachBefore(TD)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n0&&n*n>r*r+i*i}function HD(t,e){for(var n=0;n1e-6?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+k*F,y:i+A+M*F,r:F}}function XD(t,e,n){var r,i,o,a,u=t.x-e.x,s=t.y-e.y,l=u*u+s*s;l?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*u-o*s,n.y=t.y-r*s+o*u):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*u-o*s,n.y=e.y+r*s+o*u)):(n.x=e.x+n.r,n.y=e.y)}function JD(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function ZD(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function QD(t){this._=t,this.next=null,this.previous=null}function KD(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,u,s,l,c,f,h;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;XD(r,n,i=t[2]),n=new QD(n),r=new QD(r),i=new QD(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(s=3;sfunction(t){t=`${t}`;let e=t.length;dC(t,e-1)&&!dC(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r)))),n=e.map(hC),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(hC(t)),h.push(sC));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=h.length;a=0&&(l=h[t]).data===sC;--t)l.data=null}if(u.parent=aC,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(BD),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(e=zD(t),r):e},r.parentId=function(t){return arguments.length?(n=zD(t),r):n},r.path=function(e){return arguments.length?(t=zD(e),r):t},r}function hC(t){let e=t.length;if(e<2)return"";for(;--e>1&&!dC(t,e););return t.slice(0,e)}function dC(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(0==(1&n))return!0}return!1}function pC(t,e){return t.parent===e.parent?1:2}function gC(t){var e=t.children;return e?e[0]:t.t}function mC(t){var e=t.children;return e?e[e.length-1]:t.t}function yC(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function vC(t,e,n){return t.a.parent===e.parent?t.a:n}function _C(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function xC(t,e,n,r,i){for(var o,a=t.children,u=-1,s=a.length,l=t.value&&(i-n)/t.value;++uh&&(h=u),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=u;break}p=d}y.push(a={value:c,dice:s1?e:1)},n}(bC);var AC=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,u,s,l,c,f=-1,h=a.length,d=t.value;++f1?e:1)},n}(bC);function MC(t,e,n){const r={};return t.each((t=>{const i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function EC(t){Qa.call(this,null,t)}EC.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const DC=t=>t.values;function CC(){const t=[],e={entries:t=>r(n(t,0),0),key:n=>(t.push(n),e)};function n(e,r){if(r>=t.length)return e;const i=e.length,o=t[r++],a={},u={};let s,l,c,f=-1;for(;++ft.length)return e;const i=[];for(const t in e)i.push({key:t,values:r(e[t],n)});return i}return e}function FC(t){Qa.call(this,null,t)}dt(EC,Qa,{transform(t,e){e.source||u("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each((t=>{t.children&&va(t.data)&&i.rem.push(t.data)})),this.value=o=FD({values:V(t.keys).reduce(((t,e)=>(t.key(e),t)),CC()).entries(i.source)},DC),n&&o.each((t=>{t.children&&(t=ba(t.data),i.add.push(t),i.source.push(t))})),MC(o,_a,_a)),i.source.root=o,i}});const SC=(t,e)=>t.parent===e.parent?1:2;dt(FC,Qa,{transform(t,e){e.source&&e.source.root||u(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(Ma(t.sort,(t=>t.data))),function(t,e,n){for(let r,i=0,o=e.length;ifunction(t,e,n){const r=t.data,i=e.length-1;for(let o=0;o(t=(LD*t+qD)%PD)/PD}();return i.x=e/2,i.y=n/2,t?i.eachBefore(eC(t)).eachAfter(nC(r,.5,o)).eachBefore(rC(1)):i.eachBefore(eC(tC)).eachAfter(nC(RD,1,o)).eachAfter(nC(r,i.r/Math.min(e,n),o)).eachBefore(rC(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=zD(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:UD(+t),i):r},i},params:["radius","size","padding"],fields:$C});const BC=["x0","y0","x1","y1","depth","children"];function NC(t){FC.call(this,t)}function zC(t){Qa.call(this,null,t)}NC.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:BC.length,default:BC}]},dt(NC,FC,{layout:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&oC(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,u=r.y1-n;a=0;--i)u.push(n=e.children[i]=new _C(r[i],i)),n.parent=e;return(a.parent=new _C(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,u=n,s=o.parent.children[0],l=o.m,c=a.m,f=u.m,h=s.m;u=mC(u),o=gC(o),u&&o;)s=gC(s),(a=mC(a)).a=e,(i=u.z+f-o.z-l+t(u._,o._))>0&&(yC(vC(u,e,r),e,i),l+=i,c+=i),f+=u.m,l+=o.m,h+=s.m,c+=a.m;u&&!mC(a)&&(a.t=u,a.m+=f-c),o&&!gC(s)&&(s.t=o,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=MD,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(ED,0)/t.length}(n),e.y=function(t){return 1+t.reduce(DD,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)}));var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=u.x-t(u,s)/2,c=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},RC=["x","y","depth","children"];function UC(t){FC.call(this,t)}function LC(t){Qa.call(this,[],t)}UC.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:RC.length,default:RC}]},dt(UC,FC,{layout(t){const e=t||"tidy";if(lt(OC,e))return OC[e]();u("Unrecognized Tree layout method: "+e)},params:["size","nodeSize"],fields:RC}),LC.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},dt(LC,Qa,{transform(t,e){const n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||u("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(t=>o[_a(t)]=1)),r.each((t=>{const e=t.data,n=t.parent&&t.parent.data;n&&o[_a(e)]&&o[_a(n)]&&i.add.push(ba({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(t=>o[_a(t)]=1)),n.forEach((t=>{(o[_a(t.source)]||o[_a(t.target)])&&i.mod.push(t)}))),i}});const qC={binary:function(t,e,n,r,i){var o,a,u=t.children,s=u.length,l=new Array(s+1);for(l[0]=a=o=0;o=n-1){var c=u[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d>>1;l[g]s-o){var v=r?(i*y+a*m)/r:a;t(e,d,m,i,o,v,s),t(d,n,y,v,o,a,s)}else{var _=r?(o*y+s*m)/r:s;t(e,d,m,i,o,a,_),t(d,n,y,i,_,a,s)}}(0,s,t.value,e,n,r,i)},dice:oC,slice:xC,slicedice:function(t,e,n,r,i){(1&t.depth?xC:oC)(t,e,n,r,i)},squarify:kC,resquarify:AC},PC=["x0","y0","x1","y1","depth","children"];function jC(t){FC.call(this,t)}jC.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:PC.length,default:PC}]},dt(jC,FC,{layout(){const t=function(){var t=kC,e=!1,n=1,r=1,i=[0],o=RD,a=RD,u=RD,s=RD,l=RD;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(iC),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f{const n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=e=>{lt(qC,e)?t.tile(qC[e]):u("Unrecognized Treemap layout method: "+e)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:PC});var IC=Object.freeze({__proto__:null,nest:EC,pack:TC,partition:NC,stratify:zC,tree:UC,treelinks:LC,treemap:jC});const WC=4278190080;function HC(t,e,n){return new Uint32Array(t.getImageData(0,0,e,n).data.buffer)}function YC(t,e,n){if(!e.length)return;const r=e[0].mark.marktype;"group"===r?e.forEach((e=>{e.items.forEach((e=>YC(t,e.items,n)))})):Py[r].draw(t,{items:n?e.map(GC):e})}function GC(t){const e=ka(t,{});return e.stroke&&0!==e.strokeOpacity||e.fill&&0!==e.fillOpacity?{...e,strokeOpacity:1,stroke:"#000",fillOpacity:0}:e}const VC=5,XC=31,JC=32,ZC=new Uint32Array(JC+1),QC=new Uint32Array(JC+1);QC[0]=0,ZC[0]=~QC[0];for(let t=1;t<=JC;++t)QC[t]=QC[t-1]<<1|1,ZC[t]=~QC[t];function KC(t,e,n){const r=Math.max(1,Math.sqrt(t*e/1e6)),i=~~((t+2*n+r)/r),o=~~((e+2*n+r)/r),a=t=>~~((t+n)/r);return a.invert=t=>t*r-n,a.bitmap=()=>function(t,e){const n=new Uint32Array(~~((t*e+JC)/JC));function r(t,e){n[t]|=e}function i(t,e){n[t]&=e}return{array:n,get:(e,r)=>{const i=r*t+e;return n[i>>>VC]&1<<(i&XC)},set:(e,n)=>{const i=n*t+e;r(i>>>VC,1<<(i&XC))},clear:(e,n)=>{const r=n*t+e;i(r>>>VC,~(1<<(r&XC)))},getRange:(e,r,i,o)=>{let a,u,s,l,c=o;for(;c>=r;--c)if(a=c*t+e,u=c*t+i,s=a>>>VC,l=u>>>VC,s===l){if(n[s]&ZC[a&XC]&QC[1+(u&XC)])return!0}else{if(n[s]&ZC[a&XC])return!0;if(n[l]&QC[1+(u&XC)])return!0;for(let t=s+1;t{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+i,s=a>>>VC,l=u>>>VC,s===l)r(s,ZC[a&XC]&QC[1+(u&XC)]);else for(r(s,ZC[a&XC]),r(l,QC[1+(u&XC)]),c=s+1;c{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+r,s=a>>>VC,l=u>>>VC,s===l)i(s,QC[a&XC]|ZC[1+(u&XC)]);else for(i(s,QC[a&XC]),i(l,ZC[1+(u&XC)]),c=s+1;cn<0||r<0||o>=e||i>=t}}(i,o),a.ratio=r,a.padding=n,a.width=t,a.height=e,a}function tF(t,e,n,r,i,o){let a=n/2;return t-a<0||t+a>i||e-(a=r/2)<0||e+a>o}function eF(t,e,n,r,i,o,a,u){const s=i*o/(2*r),l=t(e-s),c=t(e+s),f=t(n-(o/=2)),h=t(n+o);return a.outOfBounds(l,f,c,h)||a.getRange(l,f,c,h)||u&&u.getRange(l,f,c,h)}const nF=[-1,-1,1,1],rF=[-1,1,-1,1];const iF=["right","center","left"],oF=["bottom","middle","top"];function aF(t,e,n,r,i,o,a,u,s,l,c,f){return!(i.outOfBounds(t,n,e,r)||(f&&o||i).getRange(t,n,e,r))}const uF={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},sF={naive:function(t,e,n,r){const i=t.width,o=t.height;return function(t){const e=t.datum.datum.items[r].items,n=e.length,a=t.datum.fontSize,u=by.width(t.datum,t.datum.text);let s,l,c,f,h,d,p,g=0;for(let r=0;r=g&&(g=p,t.x=h,t.y=d);return h=u/2,d=a/2,s=t.x-h,l=t.x+h,c=t.y-d,f=t.y+d,t.align="center",s<0&&l<=i?t.align="left":0<=s&&i=1;)h=(d+p)/2,eF(t,c,f,l,s,h,a,u)?p=h:d=h;if(d>r)return[c,f,d,!0]}}return function(e){const u=e.datum.datum.items[r].items,l=u.length,c=e.datum.fontSize,f=by.width(e.datum,e.datum.text);let h,d,p,g,m,y,v,_,x,b,w,k,A,M,E,D,C,F=n?c:0,S=!1,$=!1,T=0;for(let r=0;rd&&(C=h,h=d,d=C),p>g&&(C=p,p=g,g=C),x=t(h),w=t(d),b=~~((x+w)/2),k=t(p),M=t(g),A=~~((k+M)/2),v=b;v>=x;--v)for(_=A;_>=k;--_)D=s(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);for(v=b;v<=w;++v)for(_=A;_<=M;++_)D=s(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);S||n||(E=Math.abs(d-h+g-p),m=(h+d)/2,y=(p+g)/2,E>=T&&!tF(m,y,f,c,i,o)&&!eF(t,m,y,c,f,c,a,null)&&(T=E,e.x=m,e.y=y,$=!0))}return!(!S&&!$)&&(m=f/2,y=c/2,a.setRange(t(e.x-m),t(e.y-y),t(e.x+m),t(e.y+y)),e.align="center",e.baseline="middle",!0)}},floodfill:function(t,e,n,r){const i=t.width,o=t.height,a=e[0],u=e[1],s=t.bitmap();return function(e){const l=e.datum.datum.items[r].items,c=l.length,f=e.datum.fontSize,h=by.width(e.datum,e.datum.text),d=[];let p,g,m,y,v,_,x,b,w,k,A,M,E=n?f:0,D=!1,C=!1,F=0;for(let r=0;r=1;)A=(w+k)/2,eF(t,v,_,f,h,A,a,u)?k=A:w=A;w>E&&(e.x=v,e.y=_,E=w,D=!0)}}D||n||(M=Math.abs(g-p+y-m),v=(p+g)/2,_=(m+y)/2,M>=F&&!tF(v,_,h,f,i,o)&&!eF(t,v,_,f,h,f,a,null)&&(F=M,e.x=v,e.y=_,C=!0))}return!(!D&&!C)&&(v=h/2,_=f/2,a.setRange(t(e.x-v),t(e.y-_),t(e.x+v),t(e.y+_)),e.align="center",e.baseline="middle",!0)}}};function lF(t,e,n,r,i,o,a,u,s,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),h=function(t,e){const n=new Float64Array(e),r=t.length;for(let e=0;e[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===e?t=>{const e=t.datum.items[r].items;return i(e.length?e["start"===n?0:e.length-1]:{x:NaN,y:NaN})}:t=>{const e=t.datum.bounds;return[e.x1,(e.x1+e.x2)/2,e.x2,e.y1,(e.y1+e.y2)/2,e.y2]}:i}(p,g,u,s),v=null===l||l===1/0,_=m&&"naive"===c;var x;let b=-1,w=-1;const k=t.map((t=>{const e=v?by.width(t,t.text):void 0;return b=Math.max(b,e),w=Math.max(w,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(t),textWidth:e}}));l=null===l||l===1/0?Math.max(b,w)+Math.max(...r):l;const A=KC(e[0],e[1],l);let M;if(!_){n&&k.sort(((t,e)=>n(t.datum,e.datum)));let e=!1;for(let t=0;tt.datum));M=o.length||r?function(t,e,n,r,i){const o=t.width,a=t.height,u=r||i,s=Oc(o,a).getContext("2d"),l=Oc(o,a).getContext("2d"),c=u&&Oc(o,a).getContext("2d");n.forEach((t=>YC(s,t,!1))),YC(l,e,!1),u&&YC(c,e,!0);const f=HC(s,o,a),h=HC(l,o,a),d=u&&HC(c,o,a),p=t.bitmap(),g=u&&t.bitmap();let m,y,v,_,x,b,w,k;for(y=0;yn.set(t(e.boundary[0]),t(e.boundary[3])))),[n,void 0]}(A,a&&k)}const E=m?sF[c](A,M,a,s):function(t,e,n,r){const i=t.width,o=t.height,a=e[0],u=e[1],s=r.length;return function(e){const l=e.boundary,c=e.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>o)return!1;let f,h,d,p,g,m,y,v,_,x,b,w,k,A,M,E=e.textWidth??0;for(let i=0;i>>2&3)-1,d=0===f&&0===h||r[i]<0,p=f&&h?Math.SQRT1_2:1,g=r[i]<0?-1:1,m=l[1+f]+r[i]*f*p,b=l[4+h]+g*c*h/2+r[i]*h*p,v=b-c/2,_=b+c/2,w=t(m),A=t(v),M=t(_),!E){if(!aF(w,w,A,M,a,u,0,0,0,0,0,d))continue;E=by.width(e.datum,e.datum.text)}if(x=m+g*E*f/2,m=x-E/2,y=x+E/2,w=t(m),k=t(y),aF(w,k,A,M,a,u,0,0,0,0,0,d))return e.x=f?f*g<0?y:m:x,e.y=h?h*g<0?_:v:b,e.align=iF[f*g+1],e.baseline=oF[h*g+1],a.setRange(w,A,k,M),!0}return!1}}(A,M,d,h);return k.forEach((t=>t.opacity=+E(t))),k}const cF=["x","y","opacity","align","baseline"],fF=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function hF(t){Qa.call(this,null,t)}hF.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:fF},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:cF.length,default:cF}]},dt(hF,Qa,{transform(t,e){const n=t.modified();if(!(n||e.changed(e.ADD_REM)||function(n){const r=t[n];return J(r)&&e.modified(r.fields)}("sort")))return;t.size&&2===t.size.length||u("Size parameter should be specified as a [width, height] array.");const r=t.as||cF;return lF(e.materialize(e.SOURCE).source||[],t.size,t.sort,V(null==t.offset?1:t.offset),V(t.anchor||fF),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const e=t.datum;e[r[0]]=t.x,e[r[1]]=t.y,e[r[2]]=t.opacity,e[r[3]]=t.align,e[r[4]]=t.baseline})),e.reflow(n).modifies(r)}});var dF=Object.freeze({__proto__:null,label:hF});function pF(t,e){var n,r,i,o,a,u,s=[],l=function(t){return t(o)};if(null==e)s.push(t);else for(n={},r=0,i=t.length;r{ju(e,t.x,t.y,t.bandwidth||.3).forEach((t=>{const n={};for(let t=0;t"poly"===t?e:"quad"===t?2:1)(a,s),c=t.as||[n(t.x),n(t.y)],f=mF[a],h=[];let d=t.extent;lt(mF,a)||u("Invalid regression method: "+a),null!=d&&"log"===a&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,s);if(t.params)return void h.push(ba({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||at(n,t.x),u=t=>{const e={};for(let t=0;tu([t,r.predict(t)]))):Yu(r.predict,i,25,200).forEach(u)})),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r}});var vF=Object.freeze({__proto__:null,loess:gF,regression:yF});const _F=134217729,xF=33306690738754706e-32;function bF(t,e,n,r,i){let o,a,u,s,l=e[0],c=r[0],f=0,h=0;c>l==c>-l?(o=l,l=e[++f]):(o=c,c=r[++h]);let d=0;if(fl==c>-l?(a=l+o,u=o-(a-l),l=e[++f]):(a=c+o,u=o-(a-c),c=r[++h]),o=a,0!==u&&(i[d++]=u);fl==c>-l?(a=o+l,s=a-o,u=o-(a-s)+(l-s),l=e[++f]):(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=r[++h]),o=a,0!==u&&(i[d++]=u);for(;f0!=u>0)return s;const l=Math.abs(a+u);return Math.abs(s)>=kF*l?s:-function(t,e,n,r,i,o,a){let u,s,l,c,f,h,d,p,g,m,y,v,_,x,b,w,k,A;const M=t-i,E=n-i,D=e-o,C=r-o;x=M*C,h=_F*M,d=h-(h-M),p=M-d,h=_F*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=D*E,h=_F*D,d=h-(h-D),p=D-d,h=_F*E,g=h-(h-E),m=E-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,EF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,EF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,EF[2]=v-(A-f)+(y-f),EF[3]=A;let F=function(t,e){let n=e[0];for(let r=1;r=S||-F>=S)return F;if(f=t-M,u=t-(M+f)+(f-i),f=n-E,l=n-(E+f)+(f-i),f=e-D,s=e-(D+f)+(f-o),f=r-C,c=r-(C+f)+(f-o),0===u&&0===s&&0===l&&0===c)return F;if(S=MF*a+xF*Math.abs(F),F+=M*c+C*u-(D*l+E*s),F>=S||-F>=S)return F;x=u*C,h=_F*u,d=h-(h-u),p=u-d,h=_F*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=s*E,h=_F*s,d=h-(h-s),p=s-d,h=_F*E,g=h-(h-E),m=E-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,SF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,SF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,SF[2]=v-(A-f)+(y-f),SF[3]=A;const $=bF(4,EF,4,SF,DF);x=M*c,h=_F*M,d=h-(h-M),p=M-d,h=_F*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=D*l,h=_F*D,d=h-(h-D),p=D-d,h=_F*l,g=h-(h-l),m=l-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,SF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,SF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,SF[2]=v-(A-f)+(y-f),SF[3]=A;const T=bF($,DF,4,SF,CF);x=u*c,h=_F*u,d=h-(h-u),p=u-d,h=_F*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=s*l,h=_F*s,d=h-(h-s),p=s-d,h=_F*l,g=h-(h-l),m=l-g,k=p*m-(w-d*g-p*g-d*m),y=b-k,f=b-y,SF[0]=b-(y+f)+(f-k),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,SF[1]=_-(y+f)+(f-w),A=v+y,f=A-v,SF[2]=v-(A-f)+(y-f),SF[3]=A;const B=bF(T,CF,4,SF,FF);return FF[B-1]}(t,e,n,r,i,o,l)}const TF=Math.pow(2,-52),BF=new Uint32Array(512);class NF{static from(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qF,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:PF;const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,l=-1/0;for(let e=0;es&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(a+s)/2,f=(u+l)/2;let h,d,p,g=1/0;for(let e=0;e0&&(d=e,g=n)}let v=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if($F(m,y,v,_,b,w)<0){const t=d,e=v,n=_;d=p,v=b,_=w,p=t,b=e,w=n}const k=function(t,e,n,r,i,o){const a=n-t,u=r-e,s=i-t,l=o-e,c=a*a+u*u,f=s*s+l*l,h=.5/(a*l-u*s),d=t+(l*c-u*f)*h,p=e+(a*f-s*c)*h;return{x:d,y:p}}(m,y,v,_,b,w);this._cx=k.x,this._cy=k.y;for(let e=0;e0&&Math.abs(l-o)<=TF&&Math.abs(c-a)<=TF)continue;if(o=l,a=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t=0;)if(m=g,m===f){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,s,n[m],-1,-1,r[m]);r[s]=this._legalize(y+2),r[m]=y,A++;let v=n[m];for(;g=n[v],$F(l,c,t[2*v],t[2*v+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(v,s,g,r[s],-1,r[v]),r[s]=this._legalize(y+2),n[v]=v,A--,v=g;if(m===f)for(;g=e[m],$F(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1])<0;)y=this._addTriangle(g,s,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,A--,m=g;this._hullStart=e[s]=m,n[m]=e[v]=s,n[s]=v,i[this._hashKey(l,c)]=s,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(A);for(let t=0,e=this._hullStart;t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=BF[--i];continue}const s=a-a%3,l=u+(t+1)%3,c=s+(a+2)%3,f=e[o],h=e[t],d=e[l],p=e[c];if(OF(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,c);const u=s+(a+1)%3;i=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;LF(t,n+r>>1,i),e[t[n]]>e[t[r]]&&LF(t,n,r),e[t[i]]>e[t[r]]&&LF(t,i,r),e[t[n]]>e[t[i]]&&LF(t,n,i);const a=t[i],u=e[a];for(;;){do{i++}while(e[t[i]]u);if(o=o-n?(UF(t,e,i,r),UF(t,e,n,o-1)):(UF(t,e,n,o-1),UF(t,e,i,r))}}function LF(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function qF(t){return t[0]}function PF(t){return t[1]}const jF=1e-6;class IF{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>jF||Math.abs(this._y1-i)>jF)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class WF{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}const HF=2*Math.PI,YF=Math.pow;function GF(t){return t[0]}function VF(t){return t[1]}function XF(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class JF{static from(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:GF,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:VF,r=arguments.length>3?arguments[3]:void 0;return new JF("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new class{constructor(t){let[e,n,r,i]=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,960,500];if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,o=0,a=0,u=n.length;o1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e2&&void 0!==arguments[2]?arguments[2]:0;if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=YF(e-s[2*t],2)+YF(n-s[2*t+1],2);const f=r[t];let h=f;do{let r=u[h];const f=YF(e-s[2*r],2)+YF(n-s[2*r+1],2);if(f=f));)if(e.x=a+i,e.y=l+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>u[0]||e.y+e.y1>u[1])&&(!n||!aS(e,t,u[0]))&&(!n||sS(e,n))){for(var g,m=e.sprite,y=e.width>>5,v=u[0]>>5,_=e.x-(y<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*v+(_>>5),A=0;A>>x:0);k+=v}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(nS<<5)/e,t.height=rS/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Oc()),f=function(t){var e=[],n=-1;for(;++n>5)*u[1]),d=null,p=l.length,g=-1,m=[],y=l.map((u=>({text:t(u),font:e(u),style:r(u),weight:i(u),rotate:o(u),size:~~(n(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,e)=>e.size-t.size));++g>1,v.y=u[1]*(c()+.5)>>1,oS(s,v,y,g),v.hasText&&h(f,v,d)&&(m.push(v),d?uS(d,v):d=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=u[0]>>1,v.y-=u[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(e=cS(t),f):e},f.fontStyle=function(t){return arguments.length?(r=cS(t),f):r},f.fontWeight=function(t){return arguments.length?(i=cS(t),f):i},f.rotate=function(t){return arguments.length?(o=cS(t),f):o},f.text=function(e){return arguments.length?(t=cS(e),f):t},f.spiral=function(t){return arguments.length?(s=fS[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=cS(t),f):n},f.padding=function(t){return arguments.length?(a=cS(t),f):a},f.random=function(t){return arguments.length?(c=t,f):c},f}function oS(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,(nS<<5)/o,rS/o);var a,u,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(v+_),Math.abs(v-_))}else a=a+31>>5<<5;if(s>d&&(d=s),f+a>=nS<<5&&(f=0,h+=d,d=0),h+s>=rS)break;i.translate((f+(a>>1))/o,(h+(s>>1))/o),e.rotate&&i.rotate(e.rotate*eS),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=s,e.xoff=f,e.yoff=h,e.x1=a>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var b=i.getImageData(0,0,(nS<<5)/o,rS/o).data,w=[];--r>=0;)if((e=n[r]).hasText){for(u=(a=e.width)>>5,s=e.y1-e.y0,l=0;l>5),E=b[(h+c)*(nS<<5)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+A,e.sprite=w.slice(0,(e.y1-e.y0)*u)}}}function aS(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,l=t.y1-t.y0,c=(t.y+t.y0)*n+(a>>5),f=0;f>>u:0))&e[c+h])return!0;c+=n}return!1}function uS(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function sS(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0e(t(n))}i.forEach((t=>{t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0}));const c=o.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(t.random).layout(),f=o.size(),h=f[0]>>1,d=f[1]>>1,p=c.length;for(let t,e,n=0;nnew Uint8Array(t),yS=t=>new Uint16Array(t),vS=t=>new Uint32Array(t);function _S(t,e,n){const r=(e<257?mS:e<65537?yS:vS)(t);return n&&r.set(n),r}function xS(t,e,n){const r=1<{const r=t[e],i=t[n];return ri?1:0})),function(t,e){return Array.from(e,(e=>t[e]))}(t,e)}(h,s),a)l=e,c=t,e=Array(a+u),t=vS(a+u),function(t,e,n,r,i,o,a,u,s){let l,c=0,f=0;for(l=0;c0)for(f=0;ft,size:()=>n}}function wS(t){Qa.call(this,function(){let t=8,e=[],n=vS(0),r=_S(0,t),i=_S(0,t);return{data:()=>e,seen:()=>n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length),add(t){for(let n,r=0,i=e.length,o=t.length;re.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,e){r[t]|=e},clear(t,e){r[t]&=~e},resize(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=_S(e,t,r),i=_S(e,t))}}}(),t),this._indices=null,this._dims=null}function kS(t){Qa.call(this,null,t)}wS.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},dt(wS,Qa,{transform(t,e){return this._dims?t.modified("fields")||t.fields.some((t=>e.modified(t.fields)))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},init(t,e){const n=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,l=0;for(;l{const t=i.remove(e,n);for(const e in r)r[e].reindex(t)}))},update(t,e,n){const r=this._dims,i=t.query,o=e.stamp,a=r.length;let u,s,l=0;for(n.filters=0,s=0;sd)for(m=d,y=Math.min(f,p);mp)for(m=Math.max(f,p),y=h;mc)for(d=c,p=Math.min(s,f);df)for(d=Math.max(s,f),p=l;du[t]&n?null:a[t];return o.filter(o.MOD,l),i&i-1?(o.filter(o.ADD,(t=>{const e=u[t]&n;return!e&&e^s[t]&n?a[t]:null})),o.filter(o.REM,(t=>{const e=u[t]&n;return e&&!(e^e^s[t]&n)?a[t]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(t=>(u[t]&n)===i?a[t]:null))),o.filter(o.SOURCE,(t=>l(t._index)))}});var AS=Object.freeze({__proto__:null,crossfilter:wS,resolvefilter:kS});const MS="Literal",ES="Property",DS="ArrayExpression",CS="BinaryExpression",FS="CallExpression",SS="ConditionalExpression",$S="LogicalExpression",TS="MemberExpression",BS="ObjectExpression",NS="UnaryExpression";function zS(t){this.type=t}var OS,RS,US,LS,qS;zS.prototype.visit=function(t){let e,n,r;if(t(this))return 1;for(e=function(t){switch(t.type){case DS:return t.elements;case CS:case $S:return[t.left,t.right];case FS:return[t.callee].concat(t.arguments);case SS:return[t.test,t.consequent,t.alternate];case TS:return[t.object,t.property];case BS:return t.properties;case ES:return[t.key,t.value];case NS:return[t.argument];default:return[]}}(this),n=0,r=e.length;n",OS[IS]="Identifier",OS[WS]="Keyword",OS[HS]="Null",OS[YS]="Numeric",OS[GS]="Punctuator",OS[VS]="String",OS[9]="RegularExpression";var XS="ArrayExpression",JS="BinaryExpression",ZS="CallExpression",QS="ConditionalExpression",KS="Identifier",t$="Literal",e$="LogicalExpression",n$="MemberExpression",r$="ObjectExpression",i$="Property",o$="UnaryExpression",a$="Unexpected token %0",u$="Unexpected number",s$="Unexpected string",l$="Unexpected identifier",c$="Unexpected reserved word",f$="Unexpected end of input",h$="Invalid regular expression",d$="Invalid regular expression: missing /",p$="Octal literals are not allowed in strict mode.",g$="Duplicate data property in object literal not allowed in strict mode",m$="ILLEGAL",y$="Disabled.",v$=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),_$=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function x$(t,e){if(!t)throw new Error("ASSERT: "+e)}function b$(t){return t>=48&&t<=57}function w$(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function k$(t){return"01234567".indexOf(t)>=0}function A$(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function M$(t){return 10===t||13===t||8232===t||8233===t}function E$(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&v$.test(String.fromCharCode(t))}function D$(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&_$.test(String.fromCharCode(t))}const C$={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function F$(){for(;US1114111||"}"!==t)&&Y$({},a$,m$),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function T$(){var t,e;for(t=RS.charCodeAt(US++),e=String.fromCharCode(t),92===t&&(117!==RS.charCodeAt(US)&&Y$({},a$,m$),++US,(t=S$("u"))&&"\\"!==t&&E$(t.charCodeAt(0))||Y$({},a$,m$),e=t);US>>="===(r=RS.substr(US,4))?{type:GS,value:r,start:i,end:US+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:GS,value:n,start:i,end:US+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===e?{type:GS,value:e,start:i,end:US+=2}:("//"===e&&Y$({},a$,m$),"<>=!+-*%&|^/".indexOf(a)>=0?(++US,{type:GS,value:a,start:i,end:US}):void Y$({},a$,m$))}function z$(){var t,e,n;if(x$(b$((n=RS[US]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=US,t="","."!==n){if(t=RS[US++],n=RS[US],"0"===t){if("x"===n||"X"===n)return++US,function(t){let e="";for(;US=0&&Y$({},h$,n),{value:n,literal:e}}(),r=function(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,e)=>{if(parseInt(e,16)<=1114111)return"x";Y$({},h$)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){Y$({},h$)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:US}}function R$(){if(F$(),US>=LS)return{type:jS,start:US,end:US};const t=RS.charCodeAt(US);return E$(t)?B$():40===t||41===t||59===t?N$():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(x$("'"===(t=RS[US])||'"'===t,"String literal must starts with a quote"),e=US,++US;US=0&&US(x$(e":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function lT(){var t,e;return t=function(){var t,e,n,r,i,o,a,u,s,l;if(t=qS,s=uT(),0===(i=sT(r=qS)))return s;for(r.prec=i,U$(),e=[t,qS],o=[s,r,a=uT()];(i=sT(qS))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),e.pop(),n=q$(u,s,a),o.push(n);(r=U$()).prec=i,o.push(r),e.push(qS),n=uT(),o.push(n)}for(n=o[l=o.length-1],e.pop();l>1;)e.pop(),n=q$(o[l-1].value,o[l-2],n),l-=2;return n}(),X$("?")&&(U$(),e=lT(),V$(":"),t=function(t,e,n){const r=new zS(QS);return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,lT())),t}function cT(){const t=lT();if(X$(","))throw new Error(y$);return t}function fT(t){US=0,LS=(RS=t).length,qS=null,L$();const e=cT();if(qS.type!==jS)throw new Error("Unexpect token after expression.");return e}var hT={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function dT(t){function e(e,n,r){return i=>function(e,n,r,i){let o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}const n="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&u("Missing arguments to clamp function."),e.length>3&&u("Too many arguments to clamp function.");const n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase",r,0),lower:e("toLowerCase",r,0),substring:e("substring",r),split:e("split",r),trim:e("trim",r,0),regexp:i,test:e("test",i),if:function(e){e.length<3&&u("Missing arguments to if function."),e.length>3&&u("Too many arguments to if function.");const n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function pT(t){const e=(t=t||{}).allowed?Nt(t.allowed):{},n=t.forbidden?Nt(t.forbidden):{},r=t.constants||hT,i=(t.functions||dT)(h),o=t.globalvar,a=t.fieldvar,s=J(o)?o:t=>`${o}["${t}"]`;let l={},c={},f=0;function h(t){if(xt(t))return t;const e=d[t.type];return null==e&&u("Unsupported type: "+t.type),e(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:lt(n,i)?u("Illegal identifier: "+i):lt(r,i)?r[i]:lt(e,i)?i:(l[i]=1,s(i))},MemberExpression:t=>{const e=!t.computed,n=h(t.object);e&&(f+=1);const r=h(t.property);return n===a&&(c[function(t){const e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&u("Illegal callee type: "+t.callee.type);const e=t.callee.name,n=t.arguments,r=lt(i,e)&&i[e];return r||u("Unrecognized function: "+e),J(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(h).join(",")+"]",BinaryExpression:t=>"("+h(t.left)+" "+t.operator+" "+h(t.right)+")",UnaryExpression:t=>"("+t.operator+h(t.argument)+")",ConditionalExpression:t=>"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")",LogicalExpression:t=>"("+h(t.left)+t.operator+h(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(h).join(",")+"}",Property:t=>{f+=1;const e=h(t.key);return f-=1,e+":"+h(t.value)}};function p(t){const e={code:h(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return p.functions=i,p.constants=r,p}const gT="intersect",mT="union",yT="vlMulti",vT="vlPoint",_T="or",xT="and",bT="_vgsid_",wT=l(bT),kT="E",AT="R",MT="R-E",ET="R-LE",DT="R-RE",CT="index:unit";function FT(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,u=0;u1?e-1:0),r=1;re.indexOf(t)>=0)):e},R_union:function(t,e){var n=S(e[0]),r=S(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};const NT=":",zT="@";function OT(t,e,n,r){e[0].type!==MS&&u("First argument to selection functions must be a string literal.");const i=e[0].value,o=e.length>=2&&F(e).value,a="unit",s=zT+a,l=NT+i;o!==gT||lt(r,s)||(r[s]=n.getData(i).indataRef(n,a)),lt(r,l)||(r[l]=n.getData(i).tuplesRef())}function RT(t){const e=this.context.data[t];return e?e.values.value:[]}const UT=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},LT=UT("format"),qT=UT("timeFormat"),PT=UT("utcFormat"),jT=UT("timeParse"),IT=UT("utcParse"),WT=new Date(2e3,0,1);function HT(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(WT.setYear(2e3),WT.setMonth(t),WT.setDate(e),qT.call(this,WT,n)):""}const YT=":",GT="@",VT="%",XT="$";function JT(t,e,n,r){e[0].type!==MS&&u("First argument to data functions must be a string literal.");const i=e[0].value,o=YT+i;if(!lt(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(t){}}function ZT(t,e,n,r){if(e[0].type===MS)QT(n,r,e[0].value);else for(t in n.scales)QT(n,r,t)}function QT(t,e,n){const r=VT+n;if(!lt(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function KT(t,e){if(J(t))return t;if(xt(t)){const n=e.scales[t];return n&&function(t){return t&&!0===t[Kd]}(n.value)?n.value:void 0}}function tB(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=ZT,n._range=ZT,n._scale=ZT;const r=e=>"_["+(e.type===MS?Ft(VT+e.value):Ft(VT)+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:e=>`${r(e[0])}(${t(e[1])})`}}function eB(t,e){return function(n,r,i){if(n){const e=KT(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const nB=eB("area",(function(t){return xw=new le,nw(t,bw),2*xw})),rB=eB("bounds",(function(t){var e,n,r,i,o,a,u;if(fw=cw=-(sw=lw=1/0),yw=[],nw(t,Xw),n=yw.length){for(yw.sort(ik),e=1,o=[r=yw[0]];erk(r[0],r[1])&&(r[1]=i[1]),rk(i[0],r[1])>rk(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(u=rk(r[1],i[0]))>a&&(a=u,sw=i[0],cw=r[1])}return yw=vw=null,sw===1/0||lw===1/0?[[NaN,NaN],[NaN,NaN]]:[[sw,lw],[cw,fw]]})),iB=eB("centroid",(function(t){Bw=Nw=zw=Ow=Rw=Uw=Lw=qw=0,Pw=new le,jw=new le,Iw=new le,nw(t,ak);var e=+Pw,n=+jw,r=+Iw,i=Pb(e,n,r);return ilB(t,e)}const fB={};function hB(t){return k(t)||ArrayBuffer.isView(t)?t:null}function dB(t){return hB(t)||(xt(t)?t:null)}const pB=t=>t.data;function gB(t,e){const n=RT.call(e,t);return n.root&&n.root.lookup||{}}const mB=()=>"undefined"!=typeof window&&window||null;function yB(t,e,n){if(!t)return[];const[r,i]=t,o=(new Wg).set(r[0],r[1],i[0],i[1]);return b_(n||this.context.dataflow.scenegraph().root,o,function(t){let e=null;if(t){const n=V(t.marktype),r=V(t.markname);e=t=>(!n.length||n.some((e=>t.marktype===e)))&&(!r.length||r.some((e=>t.name===e)))}return e}(e))}const vB={random:()=>t.random(),cumulativeNormal:pu,cumulativeLogNormal:xu,cumulativeUniform:Eu,densityNormal:du,densityLogNormal:_u,densityUniform:Mu,quantileNormal:gu,quantileLogNormal:bu,quantileUniform:Du,sampleNormal:hu,sampleLogNormal:vu,sampleUniform:Au,isArray:k,isBoolean:gt,isDate:mt,isDefined:t=>void 0!==t,isNumber:vt,isObject:A,isRegExp:_t,isString:xt,isTuple:va,isValid:t=>null!=t&&t==t,toBoolean:St,toDate:t=>Tt(t),toNumber:S,toString:Bt,indexof:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;rat(t),inScope:function(t){const e=this.context.group;let n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:yB,clampRange:X,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=mB();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=mB();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return Ed(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(p).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?dg(n,e=e||eg(t)):t}},panLinear:R,panLog:U,panPow:L,panSymlog:q,zoomLinear:j,zoomLog:I,zoomPow:W,zoomSymlog:H,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,l=a.stamp();let c,f,h=u.changes;if(!1===a._trigger||!(s.value.length||e||r))return 0;if((!h||h.stamp{u.modified=!0,a.pulse(s,h).run()}),!0,1)),n&&(c=!0===n?p:k(n)||va(n)?n:cB(n),h.remove(c)),e&&h.insert(e),r&&(c=cB(r),s.value.some(c)?h.remove(c):h.insert(r)),i)for(f in o)h.modify(i,f,o[f]);return 1},lassoAppend:function(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const i=(t=V(t))[t.length-1];return void 0===i||Math.sqrt((i[0]-e)**2+(i[1]-n)**2)>r?[...t,[e,n]]:t},lassoPath:function(t){return V(t).reduce(((e,n,r)=>{let[i,o]=n;return e+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,e,n){const{x:r,y:i,mark:o}=n,a=(new Wg).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,n]of e)ta.x2&&(a.x2=t),na.y2&&(a.y2=n);return a.translate(r,i),yB([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,e,n){let r=0;for(let i=0,o=n.length-1;ie!=u>e&&t<(a-s)*(e-l)/(u-l)+s&&r++}return 1&r}(t.x,t.y,e)))}},_B=["view","item","group","xy","x","y"],xB="event.vega.",bB="this.",wB={},kB={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Ft(XT+t)}]`,functions:function(t){const e=dT(t);_B.forEach((t=>e[t]=xB+t));for(const t in vB)e[t]=bB+t;return ot(e,tB(t,vB,wB)),e},constants:hT,visitors:wB},AB=pT(kB);function MB(t,e,n){return 1===arguments.length?vB[t]:(vB[t]=e,n&&(wB[t]=n),AB&&(AB.functions[t]=bB+t),this)}function EB(t,e){const n={};let r;try{r=fT(t=xt(t)?t:Ft(t)+"")}catch(e){u("Expression parse error: "+t)}r.visit((t=>{if(t.type!==FS)return;const r=t.callee.name,i=kB.visitors[r];i&&i(r,t.arguments,e,n)}));const i=AB(r);return i.globals.forEach((t=>{const r=XT+t;!lt(n,r)&&e.getSignal(t)&&(n[r]=e.signalRef(t))})),{$expr:ot({code:i.code},e.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}MB("bandwidth",(function(t,e){const n=KT(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),ZT),MB("copy",(function(t,e){const n=KT(t,(e||this).context);return n?n.copy():void 0}),ZT),MB("domain",(function(t,e){const n=KT(t,(e||this).context);return n?n.domain():[]}),ZT),MB("range",(function(t,e){const n=KT(t,(e||this).context);return n&&n.range?n.range():[]}),ZT),MB("invert",(function(t,e,n){const r=KT(t,(n||this).context);return r?k(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),ZT),MB("scale",(function(t,e,n){const r=KT(t,(n||this).context);return r?r(e):void 0}),ZT),MB("gradient",(function(t,e,n,r,i){t=KT(t,(i||this).context);const o=Gp(e,n);let a=t.domain(),u=a[0],s=F(a),l=f;return s-u?l=pp(t,u,s):t=(t.interpolator?ep("sequential")().interpolator(t.interpolator()):ep("linear")().interpolate(t.interpolate()).range(t.range())).domain([u=0,s=1]),t.ticks&&(a=t.ticks(+r||15),u!==a[0]&&a.unshift(u),s!==F(a)&&a.push(s)),a.forEach((e=>o.stop(l(e),t(e)))),o}),ZT),MB("geoArea",nB,ZT),MB("geoBounds",rB,ZT),MB("geoCentroid",iB,ZT),MB("geoShape",(function(t,e,n){const r=KT(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),ZT),MB("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){e[0].type!==MS&&u("First argument to indata must be a string literal."),e[1].type!==MS&&u("Second argument to indata must be a string literal.");const i=e[0].value,o=e[1].value,a=GT+o;lt(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),MB("data",RT,JT),MB("treePath",(function(t,e,n){const r=gB(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(pB):void 0}),JT),MB("treeAncestors",(function(t,e){const n=gB(t,this)[e];return n?n.ancestors().map(pB):void 0}),JT),MB("vlSelectionTest",(function(t,e,n){for(var r,i,o,a,u,s=this.context.data[t],l=s?s.values.value:[],c=s?s[CT]&&s[CT].value:void 0,f=n===gT,h=l.length,d=0;d(t[o[n].field]=e,t)),{}))}else s=bT,l=wT(i),(f=(c=v[s]||(v[s]={}))[u]||(c[u]=[])).push(l),n&&(f=_[u]||(_[u]=[])).push({[bT]:l});if(e=e||mT,v[bT]?v[bT]=BT[`${bT}_${e}`](...Object.values(v[bT])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((e=>v[t][e])).reduce(((n,r)=>void 0===n?r:BT[`${x[t]}_${e}`](n,r)))})),y=Object.keys(_),n&&y.length){v[r?vT:yT]=e===mT?{[_T]:y.reduce(((t,e)=>(t.push(..._[e]),t)),[])}:{[xT]:y.map((t=>({[_T]:_[t]})))}}return v}),OT),MB("vlSelectionTuples",(function(t,e){return t.map((t=>ot(e.fields?{values:e.fields.map((e=>(e.getter||(e.getter=l(e.field)))(t.datum)))}:{[bT]:wT(t.datum)},e)))}));const DB=Nt(["rule"]),CB=Nt(["group","image","rect"]);function FB(t){return(t+"").toLowerCase()}function SB(t,e,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...e.concat(n));return t&&t.functions?r.bind(t.functions):r}var $B={operator:(t,e)=>SB(t,["_"],e.code),parameter:(t,e)=>SB(t,["datum","_"],e.code),event:(t,e)=>SB(t,["event"],e.code),handler:(t,e)=>SB(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+Ft(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return DB[e]||(t.x2&&(t.x?(CB[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(CB[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",SB(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(Ft).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=e[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((n=n||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n  : (u > v || v == null) && u != null ? ${r}\n  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n  : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return n?r.bind(n):r}}};function TB(t,e,n){if(!t||!A(t))return t;for(let r,i=0,o=BB.length;it&&t.$tupleid?_a:t));return e.fn[n]||(e.fn[n]=Q(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const o=e.fork().parse(n),a=o.get(n.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>e.detach(o),a}}},{key:"$tupleid",parse:function(){return _a}}];const NB={skip:!0};function zB(t,e,n,r){return new OB(t,e,n,r)}function OB(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||$B,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function RB(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function UB(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}OB.prototype=RB.prototype={fork(){const t=new RB(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((e=>e!==t));const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===FB(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){let i=n.get(t.parent.$ref);i?(r.connect(i,[e]),e.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(t.parent.$ref),r.connect(i,[e]),e.targets().add(i)}))}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach((t=>i[t]=e))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[FB(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach((t=>e.parseOperator(t))),n.forEach((t=>e.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>e.parseStream(t))),(t.updates||[]).forEach((t=>e.parseUpdate(t))),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===FB(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||u("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=k(i)?i.map((t=>TB(t,n,e))):TB(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map((t=>n.get(t))))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map((t=>n.get(t))),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&u("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=this,r=A(r=t.source)?r.$ref:r,i=n.get(r),o=t.update,a=void 0;i||u("Source not defined: "+t.source),e=t.target&&t.target.$expr?n.eventExpression(t.target.$expr):n.get(t.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(t,i,e,o,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((n=>{const i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((n=>{const r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((e=>e.getState(t)))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{n.update(e.signals[t],i[t],NB)})),Object.keys(r||{}).forEach((t=>{n.pulse(e.data[t].input,n.changeset().remove(p).insert(r[t]))})),(t.subcontext||[]).forEach(((t,n)=>{const r=e.subcontext[n];r&&r.setState(t)}))}};const LB="default";function qB(t,e){const n=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(n)return null==e?n.style.removeProperty("cursor"):n.style.cursor=e}function PB(t,e){var n=t._runtime.data;return lt(n,e)||u("Unrecognized data set: "+e),n[e]}function jB(t,e){Ea(e)||u("Second argument to changes must be a changeset.");const n=PB(this,t);return n.modified=!0,this.pulse(n.input,e)}function IB(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function WB(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function HB(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function YB(t,e,n){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=HB(t),(r=nv(e.changedTouches?e.changedTouches[0]:e,a))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){const r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;xt(t)&&(t=i(t));const e=n.slice();for(;t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:rt(t),item:rt(e||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,n,r),e}const GB="view",VB="timer",XB="window",JB={trap:!1};function ZB(t,e,n,r){t._eventListeners.push({type:n,sources:V(e),handler:r})}function QB(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||A(r)&&!r[n])||(t.warn(`Blocked ${e} ${n} event listener.`),!1)}function KB(t){return t.item}function tN(t){return t.item.mark.source}function eN(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function nN(t,e,n){const r=document.createElement(t);for(const t in e)r.setAttribute(t,e[t]);return null!=n&&(r.textContent=n),r}const rN="vega-bind",iN="vega-bind-name",oN="vega-bind-radio";function aN(t,e,n,r){const i=n.event||"input",o=()=>t.update(e.value);r.signal(n.signal,e.value),e.addEventListener(i,o),ZB(r,e,i,o),t.set=t=>{e.value=t,e.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function uN(t,e,n,r){const i=r.signal(n.signal),o=nN("div",{class:rN}),a="radio"===n.input?o:o.appendChild(nN("label"));a.appendChild(nN("span",{class:iN},n.name||n.signal)),e.appendChild(o);let u=sN;switch(n.input){case"checkbox":u=lN;break;case"select":u=cN;break;case"radio":u=fN;break;case"range":u=hN}u(t,a,n,i)}function sN(t,e,n,r){const i=nN("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function lN(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const o=nN("input",i);e.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function cN(t,e,n,r){const i=nN("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((t,e)=>{const n={value:t};dN(t,r)&&(n.selected=!0),i.appendChild(nN("option",n,(o[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(()=>{t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e{const u={type:"radio",name:n.signal,value:e};dN(e,r)&&(u.checked=!0);const s=nN("input",u);s.addEventListener("change",(()=>t.update(e)));const l=nN("label",{},(o[a]||e)+"");return l.prepend(s),i.appendChild(l),s})),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",l),u.addEventListener("change",l),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function dN(t,e){return t===e||t+""==e+""}function pN(t,e,n,r,i,o){return(e=e||new r(t.loader())).initialize(n,IB(t),WB(t),HB(t),i,o).background(t.background())}function gN(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function mN(t,e,n){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e&&n)try{e.textContent=""}catch(n){e=null,t.error(n)}return e}const yN=t=>+t||0,vN=t=>({top:t,bottom:t,left:t,right:t});function _N(t){return A(t)?{top:yN(t.top),bottom:yN(t.bottom),left:yN(t.left),right:yN(t.right)}:vN(yN(t))}async function xN(t,e,n,r){const i=x_(e),o=i&&i.headless;return o||u("Unrecognized renderer type: "+e),await t.runAsync(),pN(t,null,null,o,n,r).renderAsync(t._scenegraph.root)}var bN="width",wN="height",kN="padding",AN={skip:!0};function MN(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===kN?r.left+r.right:0)}function EN(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===kN?r.top+r.bottom:0)}function DN(t,e){return e.modified&&k(e.input.value)&&t.indexOf("_:vega:_")}function CN(t,e){return!("parent"===t||e instanceof Ka.proxy)}function FN(t,e,n,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":k(t)?SN(t):A(t)&&!mt(t)?(e=t,Object.keys(e).map((t=>{const n=e[t];return t+": "+(k(n)?SN(n):$N(n))})).join("\n")):t+"";var e}(r))}function SN(t){return"["+t.map($N).join(", ")+"]"}function $N(t){return k(t)?"[…]":A(t)&&!mt(t)?"{…}":t}function TN(t,e){const n=this;if(e=e||{},Ja.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=ot({},t.locale,e.locale);n.locale(Lo(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||v_.Canvas,n._scenegraph=new Xy;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||FN,n._redraw=!0,n._handler=(new bv).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=ot({defaults:{}},t),n=(t,e)=>{e.forEach((e=>{k(t[e])&&(t[e]=Nt(t[e]))}))};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return zB(t,Ka,vB,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map((t=>({state:null,param:ot({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=MN(n,n._width),n._viewHeight=EN(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e[bN],r=e[wN],i=e[kN];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(e=>{t._width=e.size,t._viewWidth=MN(t,e.size),o()}),{size:n}),t._resizeHeight=t.add(null,(e=>{t._height=e.size,t._viewHeight=EN(t,e.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(n),function(t){t.add(null,(e=>(t._background=e.bg,t._resize=1,e.bg)),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:LB,item:null}));t.on(t.events("view","mousemove"),e,((t,n)=>{const r=e.value,i=r?xt(r)?r:r.user:LB,o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return xt(n)||(r=n.item,n=n.user),qB(t,n&&n!==LB?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind)}function BN(t,e){return lt(t._signals,e)?t._signals[e]:u("Unrecognized signal name: "+Ft(e))}function NN(t,e){const n=(t._targets||[]).filter((t=>t._update&&t._update.handler===e));return n.length?n[0]:null}function zN(t,e,n,r){let i=NN(n,r);return i||(i=gN(t,(()=>r(e,n.value))),i.handler=r,t.on(n,null,i)),t}function ON(t,e,n){const r=NN(e,n);return r&&e._targets.remove(r),t}dt(TN,Ja,{async evaluate(t,e,n){if(await Ja.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=HB(t),n=IB(t),r=WB(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((e=>{try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&ga(this,n),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&UB(this._el,this._desc=e),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,e,n){const r=BN(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",_N(t)):_N(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(x_(t)||u("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(Ja.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(BN(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,e,n,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==n&&(u=1,a.signal(bN,n,AN),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(wN,r,AN),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,e,n){let r=e;return n&&!1===n.trap||(r=gN(this,e),r.raw=e),this._handler.on(t,r),this},removeEventListener(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},addResizeListener(t){const e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},removeResizeListener(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},addSignalListener(t,e){return zN(this,t,BN(this,t),e)},removeSignalListener(t,e){return ON(this,BN(this,t),e)},addDataListener(t,e){return zN(this,t,PB(this,t).values,e)},removeDataListener(t,e){return ON(this,PB(this,t).values,e)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=qB(this,null);this._globalCursor=!!t,e&&qB(this,e)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,e){this._timers.push(function(t,e,n){var r=new eD,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?KE():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},events:function(t,e,n){var r,i=this,o=new za(n),a=function(n,r){i.runAsync(null,(()=>{t===GB&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),o.receive(YB(i,n,r))}))};if(t===VB)QB(i,"timer",e)&&i.timer(a,e);else if(t===GB)QB(i,"view",e)&&i.addEventListener(e,a,JB);else if(t===XB?QB(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&QB(i,"selector",e)&&(r=Array.from(document.querySelectorAll(t))),r){for(var u=0,s=r.length;u=0;)i[t].stop();for(t=o.length;--t>=0;)for(e=(n=o[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},hover:function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",KB),tN,eN(t)),this.on(this.events("view","mouseout",KB),tN,eN(e)),this},data:function(t,e){return arguments.length<2?PB(this,t).values.value:jB.call(this,t,Da().remove(p).insert(e))},change:jB,insert:function(t,e){return jB.call(this,t,Da().insert(e))},remove:function(t,e){return jB.call(this,t,Da().remove(e))},scale:function(t){var e=this._runtime.scales;return lt(e,t)||u("Unrecognized scale or projection: "+t),e[t].value},initialize:function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,o=x_(r);t=n._el=t?mN(n,t,!0):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),UB(e,t.description()))}(n),o||n.error("Unrecognized renderer type: "+r);const a=o.handler||bv,u=t?o.renderer:o.headless;return n._renderer=u?pN(n,n._renderer,t,u):null,n._handler=function(t,e,n,r){const i=new r(t.loader(),gN(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,HB(t),t);return e&&e.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(n,n._handler,t,a),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=mN(n,e,!0):t.appendChild(nN("form",{class:"vega-bindings"})),n._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=mN(n,t.param.element,!!t.param.input))})),n._bind.forEach((t=>{!function(t,e,n){if(!e)return;const r=n.param;let i=n.state;i||(i=n.state={elements:null,active:!1,set:null,update:e=>{e!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=it(r.debounce,i.update))),(null==r.input&&r.element?aN:uN)(i,e,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(n,t.element||e,t)}))),n},toImageURL:async function(t,e){t!==v_.Canvas&&t!==v_.SVG&&t!==v_.PNG&&u("Unrecognized image type: "+t);const n=await xN(this,t,e);return t===v_.SVG?function(t,e){const n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(t,e){return(await xN(this,v_.Canvas,t,e)).canvas()},toSVG:async function(t){return(await xN(this,v_.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:DN,signals:CN,recurse:!0})},setState:function(t){return this.runAsync(null,(e=>{e._trigger=!1,e._runtime.setState(t)}),(t=>{t._trigger=!0})),this}});const RN="view",UN="[",LN="]",qN="{",PN="}",jN=":",IN=",",WN="@",HN=">",YN=/[[\]{}]/,GN={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let VN,XN;function JN(t,e,n){return VN=e||RN,XN=n||GN,QN(t.trim()).map(KN)}function ZN(t,e,n,r,i){const o=t.length;let a,u=0;for(;e=0?--u:r&&r.indexOf(a)>=0&&++u}return e}function QN(t){const e=[],n=t.length;let r=0,i=0;for(;i' after between selector: "+t;n=n.map(KN);const i=KN(t.slice(1).trim());if(i.between)return{between:n,stream:i};i.between=n;return i}(t):function(t){const e={source:VN},n=[];let r,i,o=[0,0],a=0,u=0,s=t.length,l=0;if(t[s-1]===PN){if(l=t.lastIndexOf(qN),!(l>=0))throw"Unmatched right brace: "+t;try{o=function(t){const e=t.split(IN);if(!t.length||e.length>2)throw t;return e.map((e=>{const n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,l).trim()).length,l=0}if(!s)throw t;t[0]===WN&&(a=++l);r=ZN(t,l,jN),r1?(e.type=n[1],a?e.markname=n[0].slice(1):!function(t){return XN[t]}(n[0])?e.source=n[0]:e.marktype=n[0]):e.type=n[0];"!"===e.type.slice(-1)&&(e.consume=!0,e.type=e.type.slice(0,-1));null!=i&&(e.filter=i);o[0]&&(e.throttle=o[0]);o[1]&&(e.debounce=o[1]);return e}(t)}function tz(t){return A(t)?t:{type:t||"pad"}}const ez=t=>+t||0,nz=t=>({top:t,bottom:t,left:t,right:t});function rz(t){return A(t)?t.signal?t:{top:ez(t.top),bottom:ez(t.bottom),left:ez(t.left),right:ez(t.right)}:nz(ez(t))}const iz=t=>A(t)&&!k(t)?ot({},t):{value:t};function oz(t,e,n,r){if(null!=n){return A(n)&&!k(n)||k(n)&&n.length&&A(n[0])?t.update[e]=n:t[r||"enter"][e]={value:n},1}return 0}function az(t,e,n){for(const n in e)oz(t,n,e[n]);for(const e in n)oz(t,e,n[e],"update")}function uz(t,e,n){for(const r in e)n&<(n,r)||(t[r]=ot(t[r]||{},e[r]));return t}function sz(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const lz="mark",cz="frame",fz="scope",hz="axis",dz="axis-domain",pz="axis-grid",gz="axis-label",mz="axis-tick",yz="axis-title",vz="legend",_z="legend-band",xz="legend-entry",bz="legend-gradient",wz="legend-label",kz="legend-symbol",Az="legend-title",Mz="title",Ez="title-text",Dz="title-subtitle";function Cz(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const Fz=t=>xt(t)?Ft(t):t.signal?`(${t.signal})`:Bz(t);function Sz(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map((t=>null==t?null:Ft(t)));for(;e.length&&null==F(e);)e.pop();return e.unshift(Fz(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?$z("hcl",t.h,t.c,t.l):t.h||t.s?$z("hsl",t.h,t.s,t.l):t.l||t.a?$z("lab",t.l,t.a,t.b):t.r||t.g||t.b?$z("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?Bz(t.field):void 0!==t.value?Ft(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=Fz(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+Tz(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${Tz(t.exponent)})`),null!=t.mult&&(e+=`*${Tz(t.mult)}`),null!=t.offset&&(e+=`+${Tz(t.offset)}`),t.round&&(e=`round(${e})`),e}const $z=(t,e,n,r)=>`(${t}(${[e,n,r].map(Sz).join(",")})+'')`;function Tz(t){return A(t)?"("+Sz(t)+")":t}function Bz(t){return Nz(A(t)?t:{datum:t})}function Nz(t){let e,n,r;if(t.signal)e="datum",r=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(r=t.parent,e+=".datum"):r=t.group}else t.datum?(e="datum",r=t.datum):u("Invalid field reference: "+Ft(t));return t.signal||(r=xt(r)?s(r).map(Ft).join("]["):Nz(r)),e+"["+r+"]"}function zz(t,e,n,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,e,n,r,i){const o={},a={};let u,s,l,c;for(s in s="lineBreak","text"!==e||null==i[s]||sz(s,t)||Cz(o,s,i[s]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===cz?i.group:n===lz?ot({},i.mark,i[e]):null,c)l=sz(s,t)||("fill"===s||"stroke"===s)&&(sz("fill",t)||sz("stroke",t)),l||Cz(o,s,c[s]);for(s in V(r).forEach((e=>{const n=i.style&&i.style[e];for(const e in n)sz(e,t)||Cz(o,e,n[e])})),t=ot({},t),o)c=o[s],c.signal?(u=u||{})[s]=c:a[s]=c;return t.enter=ot(a,t.enter),u&&(t.update=ot(u,t.update)),t}(t,e,n,r,i.config);for(const n in t)a[n]=Oz(t[n],e,o,i);return o}function Oz(t,e,n,r){const i={},o={};for(const e in t)null!=t[e]&&(i[e]=Rz((a=t[e],k(a)?function(t){let e="";return t.forEach((t=>{const n=Sz(t);e+=t.test?`(${t.test})?${n}:`:n})),":"===F(e)&&(e+="null"),e}(a):Sz(a)),r,n,o));var a;return{$expr:{marktype:e,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function Rz(t,e,n,r){const i=EB(t,e);return i.$fields.forEach((t=>r[t]=1)),ot(n,i.$params),i.$expr}const Uz="outer",Lz=["value","update","init","react","bind"];function qz(t,e){u(t+' for "outer" push: '+Ft(e))}function Pz(t,e){const n=t.name;if(t.push===Uz)e.signals[n]||qz("No prior signal definition",n),Lz.forEach((e=>{void 0!==t[e]&&qz("Invalid property ",e)}));else{const r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function jz(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function Iz(t,e,n,r){return new jz(t,e,n,r)}function Wz(t,e){return Iz("operator",t,e)}function Hz(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function Yz(t,e){return e?{$field:t,$name:e}:{$field:t}}const Gz=Yz("key");function Vz(t,e){return{$compare:t,$order:e}}const Xz="descending";function Jz(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}const Zz="scope",Qz="view";function Kz(t){return t&&t.signal}function tO(t){if(Kz(t))return!0;if(A(t))for(const e in t)if(tO(t[e]))return!0;return!1}function eO(t,e){return null!=t?t:e}function nO(t){return t&&t.signal||t}const rO="timer";function iO(t,e){return(t.merge?oO:t.stream?aO:t.type?uO:u("Invalid stream specification: "+Ft(t)))(t,e)}function oO(t,e){const n=sO({merge:t.merge.map((t=>iO(t,e)))},t,e);return e.addStream(n).id}function aO(t,e){const n=sO({stream:iO(t.stream,e)},t,e);return e.addStream(n).id}function uO(t,e){let n;t.type===rO?(n=e.event(rO,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===Zz?Qz:t||Qz}(t.source),t.type);const r=sO({stream:n},t,e);return 1===Object.keys(r).length?n:e.addStream(r).id}function sO(t,e,n){let r=e.between;return r&&(2!==r.length&&u('Stream "between" parameter must have 2 entries: '+Ft(e)),t.between=[iO(r[0],n),iO(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===Zz&&r.push("inScope(event.item)"),r.length&&(t.filter=EB("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}const lO={code:"_.$value",ast:{type:"Identifier",value:"value"}};function cO(t,e,n){const r=t.encode,i={target:n};let o=t.events,a=t.update,s=[];o||u("Signal update missing events specification."),xt(o)&&(o=JN(o,e.isSubscope()?Zz:Qz)),o=V(o).filter((t=>t.signal||t.scale?(s.push(t),0):1)),s.length>1&&(s=[fO(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&u("Signal encode and update are mutually exclusive."),a="encode(item(),"+Ft(r)+")"),i.update=xt(a)?EB(a,e):null!=a.expr?EB(a.expr,e):null!=a.value?a.value:null!=a.signal?{$expr:lO,$params:{$value:e.signalRef(a.signal)}}:u("Invalid signal update specification."),t.force&&(i.options={force:!0}),s.forEach((t=>e.addUpdate(ot(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):iO(t,e)}}(t,e),i))))}function fO(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const hO=t=>(e,n,r)=>Iz(t,n,e||void 0,r),dO=hO("aggregate"),pO=hO("axisticks"),gO=hO("bound"),mO=hO("collect"),yO=hO("compare"),vO=hO("datajoin"),_O=hO("encode"),xO=hO("expression"),bO=hO("facet"),wO=hO("field"),kO=hO("key"),AO=hO("legendentries"),MO=hO("load"),EO=hO("mark"),DO=hO("multiextent"),CO=hO("multivalues"),FO=hO("overlap"),SO=hO("params"),$O=hO("prefacet"),TO=hO("projection"),BO=hO("proxy"),NO=hO("relay"),zO=hO("render"),OO=hO("scale"),RO=hO("sieve"),UO=hO("sortitems"),LO=hO("viewlayout"),qO=hO("values");let PO=0;const jO={min:"min",max:"max",count:"sum"};function IO(t,e){const n=e.getScale(t.name).params;let r;for(r in n.domain=GO(t.domain,t,e),null!=t.range&&(n.range=eR(t,e,n)),null!=t.interpolate&&function(t,e){e.interpolate=WO(t.type||t),null!=t.gamma&&(e.interpolateGamma=WO(t.gamma))}(t.interpolate,n),null!=t.nice&&(n.nice=function(t){return A(t)?{interval:WO(t.interval),step:WO(t.step)}:WO(t)}(t.nice)),null!=t.bins&&(n.bins=function(t,e){return t.signal||k(t)?HO(t,e):e.objectProperty(t)}(t.bins,e)),t)lt(n,r)||"name"===r||(n[r]=WO(t[r],e))}function WO(t,e){return A(t)?t.signal?e.signalRef(t.signal):u("Unsupported object: "+Ft(t)):t}function HO(t,e){return t.signal?e.signalRef(t.signal):t.map((t=>WO(t,e)))}function YO(t){u("Can not find data set: "+Ft(t))}function GO(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(k(t)?VO:t.fields?JO:XO)(t,e,n);null==e.domainMin&&null==e.domainMax||u("No scale domain defined for domainMin/domainMax to override.")}function VO(t,e,n){return t.map((t=>WO(t,n)))}function XO(t,e,n){const r=n.getData(t.data);return r||YO(t.data),op(e.type)?r.valuesRef(n,t.field,QO(t.sort,!1)):lp(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function JO(t,e,n){const r=t.data,i=t.fields.reduce(((t,e)=>(e=xt(e)?{data:r,field:e}:k(e)||e.signal?function(t,e){const n="_:vega:_"+PO++,r=mO({});if(k(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Ft(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,RO({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t)),[]);return(op(e.type)?ZO:lp(e.type)?KO:tR)(t,n,i)}function ZO(t,e,n){const r=QO(t.sort,!0);let i,o;const a=n.map((t=>{const n=e.getData(t.data);return n||YO(t.data),n.countsRef(e,t.field,r)})),u={groupby:Gz,pulse:a};r&&(i=r.op||"count",o=r.field?Jz(i,r.field):"count",u.ops=[jO[i]],u.fields=[e.fieldRef(o)],u.as=[o]),i=e.add(dO(u));const s=e.add(mO({pulse:Hz(i)}));return o=e.add(qO({field:Gz,sort:e.sortRef(r),pulse:Hz(s)})),Hz(o)}function QO(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!jO[t.op]&&u("Multiple domain scales can not be sorted using "+t.op):u("No field provided for sort aggregate op: "+t.op):A(t)?t.field="key":t={field:"key"}),t}function KO(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||YO(t.data),n.domainRef(e,t.field)}));return Hz(e.add(CO({values:r})))}function tR(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||YO(t.data),n.extentRef(e,t.field)}));return Hz(e.add(DO({extents:r})))}function eR(t,e,n){const r=e.config.range;let i=t.range;if(i.signal)return e.signalRef(i.signal);if(xt(i)){if(r&<(r,i))return eR(t=ot({},t,{range:r[i]}),e,n);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=op(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:u("Unrecognized scale range value: "+Ft(i))}else{if(i.scheme)return n.scheme=k(i.scheme)?HO(i.scheme,e):WO(i.scheme,e),i.extent&&(n.schemeExtent=HO(i.extent,e)),void(i.count&&(n.schemeCount=WO(i.count,e)));if(i.step)return void(n.rangeStep=WO(i.step,e));if(op(t.type)&&!k(i))return GO(i,t,e);k(i)||u("Unsupported range type: "+Ft(i))}return i.map((t=>(k(t)?HO:WO)(t,e)))}function nR(t,e,n){return k(t)?t.map((t=>nR(t,e,n))):A(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:u("Unsupported parameter object: "+Ft(t)):t}const rR="top",iR="left",oR="right",aR="bottom",uR="center",sR="vertical",lR="start",cR="end",fR="index",hR="label",dR="offset",pR="perc",gR="perc2",mR="value",yR="guide-label",vR="guide-title",_R="group-title",xR="group-subtitle",bR="symbol",wR="gradient",kR="discrete",AR="size",MR=[AR,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],ER={name:1,style:1,interactive:1},DR={value:0},CR={value:1},FR="group",SR="rect",$R="rule",TR="symbol",BR="text";function NR(t){return t.type=FR,t.interactive=t.interactive||!1,t}function zR(t,e){const n=(n,r)=>eO(t[n],eO(e[n],r));return n.isVertical=n=>sR===eO(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>eO(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>eO(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>eO(t.columns,eO(e.columns,+n.isVertical(!0))),n}function OR(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function RR(t,e,n){return`item.anchor === '${lR}' ? ${t} : item.anchor === '${cR}' ? ${e} : ${n}`}const UR=RR(Ft(iR),Ft(oR),Ft(uR));function LR(t,e){return e?t?A(t)?Object.assign({},t,{offset:LR(t.offset,e)}):{value:t,offset:e}:e:t}function qR(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=uz(t.encode,e,ER)):t.interactive=!1,t}function PR(t,e,n,r){const i=zR(t,n),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,l,c,f,h;o?(l=[0,1],c=[0,0],f=a,h=u):(l=[0,0],c=[1,0],f=u,h=a);const d={enter:s={opacity:DR,x:DR,y:DR,width:iz(f),height:iz(h)},update:ot({},s,{opacity:CR,fill:{gradient:e,start:l,stop:c}}),exit:{opacity:DR}};return az(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),qR({type:SR,role:bz,encode:d},r)}function jR(t,e,n,r,i){const o=zR(t,n),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let l,c,f,h,d="";a?(l="y",f="y2",c="x",h="width",d="1-"):(l="x",f="x2",c="y",h="height");const p={opacity:DR,fill:{scale:e,field:mR}};p[l]={signal:d+"datum."+pR,mult:s},p[c]=DR,p[f]={signal:d+"datum."+gR,mult:s},p[h]=iz(u);const g={enter:p,update:ot({},p,{opacity:CR}),exit:{opacity:DR}};return az(g,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),qR({type:SR,role:_z,key:mR,from:i,encode:g},r)}const IR=`datum.${pR}<=0?"${iR}":datum.${pR}>=1?"${oR}":"${uR}"`,WR=`datum.${pR}<=0?"${aR}":datum.${pR}>=1?"${rR}":"middle"`;function HR(t,e,n,r){const i=zR(t,e),o=i.isVertical(),a=iz(i.gradientThickness()),u=i.gradientLength();let s,l,c,f,h=i("labelOverlap"),d="";const p={enter:s={opacity:DR},update:l={opacity:CR,text:{field:hR}},exit:{opacity:DR}};return az(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:eO(t.labelLimit,e.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=l.baseline={signal:WR},c="y",f="x",d="1-"):(s.align=l.align={signal:IR},s.baseline={value:"top"},c="x",f="y"),s[c]=l[c]={signal:d+"datum."+pR,mult:u},s[f]=l[f]=a,a.offset=eO(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum."+fR}:void 0,qR({type:BR,role:wz,style:yR,key:mR,from:r,encode:p,overlap:h},n)}function YR(t,e,n,r,i){const o=zR(t,e),a=n.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},h=`(${i}) ? datum.${dR} : datum.${AR}`,d=l?iz(l):{field:AR},p=`datum.${fR}`,g=`max(1, ${i})`;let m,y,v,_,x;d.mult=.5,m={enter:y={opacity:DR,x:{signal:h,mult:.5,offset:c},y:d},update:v={opacity:CR,x:y.x,y:y.y},exit:{opacity:DR}};let b=null,w=null;t.fill||(b=e.symbolBaseFillColor,w=e.symbolBaseStrokeColor),az(m,{fill:o("symbolFillColor",b),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),MR.forEach((e=>{t[e]&&(v[e]=y[e]={scale:t[e],field:mR})}));const k=qR({type:TR,role:kz,key:mR,from:f,clip:!!l||void 0,encode:m},n.symbols),A=iz(c);A.offset=o("labelOffset"),m={enter:y={opacity:DR,x:{signal:h,offset:A},y:d},update:v={opacity:CR,text:{field:hR},x:y.x,y:y.y},exit:{opacity:DR}},az(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const M=qR({type:BR,role:wz,style:yR,key:mR,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:DR,height:l?iz(l):DR,opacity:DR},exit:{opacity:DR},update:v={opacity:CR,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(_=`ceil(item.mark.items.length / ${g})`,v.row.signal=`${p}%${_}`,v.column.signal=`floor(${p} / ${_})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${g})`,v.column.signal=`${p} % ${g}`,x={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,NR({role:fz,from:r={facet:{data:r,name:"value",groupby:fR}},encode:uz(m,a,ER),marks:[k,M],name:s,interactive:u,sort:x})}const GR='item.orient === "left"',VR='item.orient === "right"',XR=`(${GR} || ${VR})`,JR=`datum.vgrad && ${XR}`,ZR=RR('"top"','"bottom"','"middle"'),QR=`datum.vgrad && ${VR} ? (${RR('"right"','"left"','"center"')}) : (${XR} && !(datum.vgrad && ${GR})) ? "left" : ${UR}`,KR=`item._anchor || (${XR} ? "middle" : "start")`,tU=`${JR} ? (${GR} ? -90 : 90) : 0`,eU=`${XR} ? (datum.vgrad ? (${VR} ? "bottom" : "top") : ${ZR}) : "top"`;function nU(t,e){let n;return A(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+rU(t.path)+")":t.sphere&&(n="geoShape("+rU(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function rU(t){return A(t)&&t.signal?t.signal:Ft(t)}function iU(t){const e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?t.type===FR?fz:e||lz:e}function oU(t){return{marktype:t.type,name:t.name||void 0,role:t.role||iU(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function aU(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function uU(t,e){const n=tu(t.type);n||u("Unrecognized transform type: "+Ft(t.type));const r=Iz(n.type.toLowerCase(),null,sU(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function sU(t,e,n){const r={},i=t.params.length;for(let o=0;ofU(t,e,n)))):fU(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!Kz(i)?i.map((e=>cU(t,e,n))):cU(t,i,n):void(t.required&&u("Missing required "+Ft(e.type)+" parameter: "+Ft(t.name)))}function cU(t,e,n){const r=t.type;if(Kz(e))return gU(r)?u("Expression references can not be signals."):mU(r)?n.fieldRef(e):yU(r)?n.compareRef(e):n.signalRef(e.signal);{const i=t.expr||mU(r);return i&&hU(e)?n.exprRef(e.expr,e.as):i&&dU(e)?Yz(e.field,e.as):gU(r)?EB(e,n):pU(r)?Hz(n.getData(e).values):mU(r)?Yz(e):yU(r)?n.compareRef(e):e}}function fU(t,e,n){const r=t.params.length;let i;for(let n=0;nt&&t.expr,dU=t=>t&&t.field,pU=t=>"data"===t,gU=t=>"expr"===t,mU=t=>"field"===t,yU=t=>"compare"===t;function vU(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:Hz(e.getData(t.data).output)}function _U(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}function xU(t){return xt(t)?t:null}function bU(t,e,n){const r=Jz(n.op,n.field);let i;if(e.ops){for(let t=0,n=e.as.length;tnull==t?"null":t)).join(",")+"),0)",e);s.update=l.$expr,s.params=l.$params}function AU(t,e){const n=iU(t),r=t.type===FR,i=t.from&&t.from.facet,o=t.overlap;let a,s,l,c,f,h,d,p=t.layout||n===fz||n===cz;const g=n===lz||p||i,m=function(t,e,n){let r,i,o,a,s;return t?(r=t.facet)&&(e||u("Only group marks can be faceted."),null!=r.field?a=s=vU(r,n):(t.data?s=Hz(n.getData(t.data).aggregate):(o=uU(ot({type:"aggregate",groupby:V(r.groupby)},r.aggregate),n),o.params.key=n.keyRef(r.groupby),o.params.pulse=vU(r,n),a=s=Hz(n.add(o))),i=n.keyRef(r.groupby,!0))):a=Hz(n.add(mO(null,[{}]))),a||(a=vU(t,n)),{key:i,pulse:a,parent:s}}(t.from,r,e);s=e.add(vO({key:m.key||(t.key?Yz(t.key):void 0),pulse:m.pulse,clean:!r}));const y=Hz(s);s=l=e.add(mO({pulse:y})),s=e.add(EO({markdef:oU(t),interactive:aU(t.interactive,e),clip:nU(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:Hz(s)}));const v=Hz(s);s=c=e.add(_O(zz(t.encode,t.type,n,t.style,e,{mod:!1,pulse:v}))),s.params.parent=e.encode(),t.transform&&t.transform.forEach((t=>{const n=uU(t,e),r=n.metadata;(r.generates||r.changes)&&u("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),n.params.pulse=Hz(s),e.add(s=n)})),t.sort&&(s=e.add(UO({sort:e.compareRef(t.sort),pulse:Hz(s)})));const _=Hz(s);(i||p)&&(p=e.add(LO({layout:e.objectProperty(t.layout),legends:e.legends,mark:v,pulse:_})),h=Hz(p));const x=e.add(gO({mark:v,pulse:h||_}));d=Hz(x),r&&(g&&(a=e.operators,a.pop(),p&&a.pop()),e.pushState(_,h||d,y),i?function(t,e,n){const r=t.from.facet,i=r.name,o=vU(r,e);let a;r.name||u("Facet must have a name: "+Ft(r)),r.data||u("Facet must reference a data set: "+Ft(r)),r.field?a=e.add($O({field:e.fieldRef(r.field),pulse:o})):r.groupby?a=e.add(bO({key:e.keyRef(r.groupby),group:Hz(e.proxy(n.parent)),pulse:o})):u("Facet must specify groupby or field: "+Ft(r));const s=e.fork(),l=s.add(mO()),c=s.add(RO({pulse:Hz(l)}));s.addData(i,new _U(s,l,l,c)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(t).toRuntime()}}(t,e,m):g?function(t,e,n){const r=e.add($O({pulse:n.pulse})),i=e.fork();i.add(RO()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,e,m):e.parse(t),e.popState(),g&&(p&&a.push(p),a.push(x))),o&&(d=function(t,e,n){const r=t.method,i=t.bound,o=t.separation,a={separation:Kz(o)?n.signalRef(o.signal):o,method:Kz(r)?n.signalRef(r.signal):r,pulse:e};t.order&&(a.sort=n.compareRef({field:t.order}));if(i){const t=i.tolerance;a.boundTolerance=Kz(t)?n.signalRef(t.signal):+t,a.boundScale=n.scaleRef(i.scale),a.boundOrient=i.orient}return Hz(n.add(FO(a)))}(o,d,e));const b=e.add(zO({pulse:d})),w=e.add(RO({pulse:Hz(b)},void 0,e.parent()));null!=t.name&&(f=t.name,e.addData(f,new _U(e,l,b,w)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&u("Marks only support modify triggers."),kU(t,e,f)})))}function MU(t,e){const n=e.config.legend,r=t.encode||{},i=zR(t,n),o=r.legend||{},a=o.name||void 0,s=o.interactive,l=o.style,c={};let f,h,d,p=0;MR.forEach((e=>t[e]?(c[e]=t[e],p=p||t[e]):0)),p||u("Missing valid scale for legend.");const g=function(t,e){let n=t.type||bR;t.type||1!==function(t){return MR.reduce(((e,n)=>e+(t[n]?1:0)),0)}(t)||!t.fill&&!t.stroke||(n=ip(e)?wR:ap(e)?kR:bR);return n!==wR?n:ap(e)?kR:wR}(t,e.scaleType(p)),m={title:null!=t.title,scales:c,type:g,vgrad:"symbol"!==g&&i.isVertical()},y=Hz(e.add(mO(null,[m]))),v=Hz(e.add(AO(h={type:g,scale:e.scaleRef(p),count:e.objectProperty(i("tickCount")),limit:e.property(i("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return g===wR?(d=[PR(t,p,n,r.gradient),HR(t,n,r.labels,v)],h.count=h.count||e.signalRef(`max(2,2*floor((${nO(i.gradientLength())})/100))`)):g===kR?d=[jR(t,p,n,r.gradient,v),HR(t,n,r.labels,v)]:(f=function(t,e){const n=zR(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,n),d=[YR(t,n,r,v,nO(f.columns))],h.size=function(t,e,n){const r=nO(DU("size",t,n)),i=nO(DU("strokeWidth",t,n)),o=nO(function(t,e,n){return OR("fontSize",t)||function(t,e,n){const r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,yR));return EB(`max(ceil(sqrt(${r})+${i}),${o})`,e)}(t,e,d[0].marks)),d=[NR({role:xz,from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:f,interactive:s})],m.title&&d.push(function(t,e,n,r){const i=zR(t,e),o={enter:{opacity:DR},update:{opacity:CR,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:DR}};return az(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:KR},angle:{signal:tU},align:{signal:QR},baseline:{signal:eU},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),qR({type:BR,role:Az,style:vR,from:r,encode:o},n)}(t,n,r.title,y)),AU(NR({role:vz,from:y,encode:uz(EU(i,t,n),o,ER),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:s,style:l}),e)}function EU(t,e,n){const r={enter:{},update:{}};return az(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}function DU(t,e,n){return e[t]?`scale("${e[t]}",datum)`:OR(t,n[0].encode)}_U.fromEntries=function(t,e){const n=e.length,r=e[n-1],i=e[n-2];let o=e[0],a=null,u=1;for(o&&"load"===o.type&&(o=e[1]),t.add(e[0]);u{n.push(uU(t,e))})),t.on&&t.on.forEach((n=>{kU(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){const r=[];let i,o,a,u,s,l=null,c=!1,f=!1;t.values?Kz(t.values)||tO(t.format)?(r.push(BU(e,t)),r.push(l=TU())):r.push(l=TU({$ingest:t.values,$format:t.format})):t.url?tO(t.url)||tO(t.format)?(r.push(BU(e,t)),r.push(l=TU())):r.push(l=TU({$request:t.url,$format:t.format})):t.source&&(l=i=V(t.source).map((t=>Hz(e.getData(t).output))),r.push(null));for(o=0,a=n.length;ot===aR||t===rR,zU=(t,e,n)=>Kz(t)?jU(t.signal,e,n):t===iR||t===rR?e:n,OU=(t,e,n)=>Kz(t)?qU(t.signal,e,n):NU(t)?e:n,RU=(t,e,n)=>Kz(t)?PU(t.signal,e,n):NU(t)?n:e,UU=(t,e,n)=>Kz(t)?IU(t.signal,e,n):t===rR?{value:e}:{value:n},LU=(t,e,n)=>Kz(t)?WU(t.signal,e,n):t===oR?{value:e}:{value:n},qU=(t,e,n)=>HU(`${t} === '${rR}' || ${t} === '${aR}'`,e,n),PU=(t,e,n)=>HU(`${t} !== '${rR}' && ${t} !== '${aR}'`,e,n),jU=(t,e,n)=>GU(`${t} === '${iR}' || ${t} === '${rR}'`,e,n),IU=(t,e,n)=>GU(`${t} === '${rR}'`,e,n),WU=(t,e,n)=>GU(`${t} === '${oR}'`,e,n),HU=(t,e,n)=>(e=null!=e?iz(e):e,n=null!=n?iz(n):n,YU(e)&&YU(n)?{signal:`${t} ? (${e=e?e.signal||Ft(e.value):null}) : (${n=n?n.signal||Ft(n.value):null})`}:[ot({test:t},e)].concat(n||[])),YU=t=>null==t||1===Object.keys(t).length,GU=(t,e,n)=>({signal:`${t} ? (${XU(e)}) : (${XU(n)})`}),VU=(t,e,n,r,i)=>({signal:(null!=r?`${t} === '${iR}' ? (${XU(r)}) : `:"")+(null!=n?`${t} === '${aR}' ? (${XU(n)}) : `:"")+(null!=i?`${t} === '${oR}' ? (${XU(i)}) : `:"")+(null!=e?`${t} === '${rR}' ? (${XU(e)}) : `:"")+"(null)"}),XU=t=>Kz(t)?t.signal:null==t?null:Ft(t),JU=(t,e)=>0===e?0:Kz(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e},ZU=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function QU(t,e,n,r){let i;if(e&<(e,t))return e[t];if(lt(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[vR][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[yR][i]}return null}function KU(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function tL(t,e){return{scale:t.scale,range:e}}function eL(t,e,n,r,i){const o=zR(t,e),a=t.orient,u=t.gridScale,s=zU(a,1,-1),l=function(t,e){if(1===e);else if(A(t)){let n=t=ot({},t);for(;null!=n.mult;){if(!A(n.mult))return n.mult=Kz(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=ot({},n.mult)}n.mult=e}else t=Kz(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,s);let c,f,h;const d={enter:c={opacity:DR},update:h={opacity:CR},exit:f={opacity:DR}};az(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:t.scale,field:mR,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},g=OU(a,{signal:"height"},{signal:"width"}),m=u?{scale:u,range:0,mult:s,offset:l}:{value:0,offset:l},y=u?{scale:u,range:1,mult:s,offset:l}:ot(g,{mult:s,offset:l});return c.x=h.x=OU(a,p,m),c.y=h.y=RU(a,p,m),c.x2=h.x2=RU(a,y),c.y2=h.y2=OU(a,y),f.x=OU(a,p),f.y=RU(a,p),qR({type:$R,role:pz,key:mR,from:r,encode:d},n)}function nL(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function rL(t,e,n,r){const i=zR(t,e),o=t.orient,a=zU(o,-1,1);let u,s;const l={enter:u={opacity:DR,anchor:iz(i("titleAnchor",null)),align:{signal:UR}},update:s=ot({},u,{opacity:CR,text:iz(t.title)}),exit:{opacity:DR}},c={signal:`lerp(range("${t.scale}"), ${RR(0,1,.5)})`};return s.x=OU(o,c),s.y=RU(o,c),u.angle=OU(o,DR,JU(a,90)),u.baseline=OU(o,UU(o,aR,rR),{value:aR}),s.angle=u.angle,s.baseline=u.baseline,az(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=ZU(iz(t),n.update[e]),!1):!sz(e,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");n.enter.auto=a===o?iz(a):OU(e,iz(a),iz(o))}(i,o,l,n),l.update.align=ZU(l.update.align,u.align),l.update.angle=ZU(l.update.angle,u.angle),l.update.baseline=ZU(l.update.baseline,u.baseline),qR({type:BR,role:yz,style:vR,from:r,encode:l},n)}function iL(t,e){const n=function(t,e){var n,r,i,o=e.config,a=o.style,u=o.axis,s="band"===e.scaleType(t.scale)&&o.axisBand,l=t.orient;if(Kz(l)){const t=KU([o.axisX,o.axisY]),e=KU([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(n={},t))n[i]=OU(l,QU(i,o.axisX,u,a),QU(i,o.axisY,u,a));for(i of(r={},e))r[i]=VU(l.signal,QU(i,o.axisTop,u,a),QU(i,o.axisBottom,u,a),QU(i,o.axisLeft,u,a),QU(i,o.axisRight,u,a))}else n=l===rR||l===aR?o.axisX:o.axisY,r=o["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||s?ot({},u,n,r,s):u}(t,e),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=zR(t,n),l=function(t){const e=t("tickBand");let n,r,i=t("tickOffset");return e?e.signal?(n={signal:`(${e.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${e.signal}) === 'extent'`},A(i)||(i={signal:`(${e.signal}) === 'extent' ? 0 : ${i}`})):"extent"===e?(n=1,r=!0,i=0):(n=.5,r=!1):(n=t("bandPosition"),r=t("tickExtra")),{extra:r,band:n,offset:i}}(s),c={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},f=Hz(e.add(mO({},[c]))),h=Hz(e.add(pO({scale:e.scaleRef(t.scale),extra:e.property(l.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),d=[];let p;return c.grid&&d.push(eL(t,n,r.grid,h,l)),c.ticks&&(p=s("tickSize"),d.push(function(t,e,n,r,i,o){const a=zR(t,e),u=t.orient,s=zU(u,-1,1);let l,c,f;const h={enter:l={opacity:DR},update:f={opacity:CR},exit:c={opacity:DR}};az(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=iz(i);d.mult=s;const p={scale:t.scale,field:mR,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=OU(u,DR,p),f.y2=l.y2=OU(u,d),c.x=OU(u,p),f.x=l.x=RU(u,DR,p),f.x2=l.x2=RU(u,d),c.y=RU(u,p),qR({type:$R,role:mz,key:mR,from:r,encode:h},n)}(t,n,r.ticks,h,p,l))),c.labels&&(p=c.ticks?p:0,d.push(function(t,e,n,r,i,o){const a=zR(t,e),u=t.orient,s=t.scale,l=zU(u,-1,1),c=nO(a("labelFlush")),f=nO(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let p,g=0===c||!!c;const m=iz(i);m.mult=l,m.offset=iz(a("labelPadding")||0),m.offset.mult=l;const y={scale:s,field:mR,band:.5,offset:LR(o.offset,a("labelOffset"))},v=OU(u,g?nL(s,c,'"left"','"right"','"center"'):{value:"center"},LU(u,"left","right")),_=OU(u,UU(u,"bottom","top"),g?nL(s,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=nL(s,c,`-(${f})`,f,0);g=g&&f;const b={opacity:DR,x:OU(u,y,m),y:RU(u,y,m)},w={enter:b,update:p={opacity:CR,text:{field:hR},x:b.x,y:b.y,align:v,baseline:_},exit:{opacity:DR,x:b.x,y:b.y}};az(w,{dx:!h&&g?OU(u,x):null,dy:!d&&g?RU(u,x):null}),az(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let A=a("labelOverlap");return A=A||k?{separation:a("labelSeparation"),method:A,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,p.align!==v&&(p.align=ZU(p.align,v)),p.baseline!==_&&(p.baseline=ZU(p.baseline,_)),qR({type:BR,role:gz,style:yR,key:mR,from:r,encode:w,overlap:A},n)}(t,n,r.labels,h,p,l))),c.domain&&d.push(function(t,e,n,r){const i=zR(t,e),o=t.orient;let a,u;const s={enter:a={opacity:DR},update:u={opacity:CR},exit:{opacity:DR}};az(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=tL(t,0),c=tL(t,1);return a.x=u.x=OU(o,l,DR),a.x2=u.x2=OU(o,c),a.y=u.y=RU(o,l,DR),a.y2=u.y2=RU(o,c),qR({type:$R,role:dz,from:r,encode:s},n)}(t,n,r.domain,f)),c.title&&d.push(rL(t,n,r.title,f)),AU(NR({role:hz,from:f,encode:uz(oL(s,t),i,ER),marks:d,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),e)}function oL(t,e){const n={enter:{},update:{}};return az(n,{orient:t("orient"),offset:t("offset")||0,position:eO(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function aL(t,e,n){const r=V(t.signals),i=V(t.scales);return n||r.forEach((t=>Pz(t,e))),V(t.projections).forEach((t=>function(t,e){const n=e.config.projection||{},r={};for(const n in t)"name"!==n&&(r[n]=nR(t[n],n,e));for(const t in n)null==r[t]&&(r[t]=nR(n[t],t,e));e.addProjection(t.name,r)}(t,e))),i.forEach((t=>function(t,e){const n=t.type||"linear";np(n)||u("Unrecognized scale type: "+Ft(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e))),V(t.data).forEach((t=>$U(t,e))),i.forEach((t=>IO(t,e))),(n||r).forEach((t=>function(t,e){const n=e.getSignal(t.name);let r=t.update;t.init&&(r?u("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=EB(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((t=>cO(t,e,n.id)))}(t,e))),V(t.axes).forEach((t=>iL(t,e))),V(t.marks).forEach((t=>AU(t,e))),V(t.legends).forEach((t=>MU(t,e))),t.title&&FU(t.title,e),e.parseLambdas(),e}const uL=t=>uz({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t);function sL(t,e){const n=e.config,r=Hz(e.root=e.add(Wz())),i=function(t,e){const n=n=>eO(t[n],e[n]),r=[lL("background",n("background")),lL("autosize",tz(n("autosize"))),lL("padding",rz(n("padding"))),lL("width",n("width")||0),lL("height",n("height")||0)],i=r.reduce(((t,e)=>(t[e.name]=e,t)),{}),o={};return V(t.signals).forEach((t=>{lt(i,t.name)?t=ot(i[t.name],t):r.push(t),o[t.name]=t})),V(e.signals).forEach((t=>{lt(o,t.name)||lt(i,t.name)||r.push(t)})),r}(t,n);i.forEach((t=>Pz(t,e))),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const o=e.add(mO()),a=e.add(_O(zz(uL(t.encode),FR,cz,t.style,e,{pulse:Hz(o)}))),u=e.add(LO({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:Hz(a)}));e.operators.pop(),e.pushState(Hz(a),Hz(u),null),aL(t,e,i),e.operators.push(u);let s=e.add(gO({mark:r,pulse:Hz(u)}));return s=e.add(zO({pulse:Hz(s)})),s=e.add(RO({pulse:Hz(s)})),e.addData("root",new _U(e,o,o,s)),e}function lL(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function cL(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function fL(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function hL(t){return(k(t)?dL:pL)(t)}function dL(t){const e=t.length;let n="[";for(let r=0;r0?",":"")+(A(e)?e.signal||hL(e):Ft(e))}return n+"]"}function pL(t){let e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+Ft(e)+":"+(A(n)?n.signal||hL(n):Ft(n));return r+"}"}cL.prototype=fL.prototype={parse(t){return aL(t,this)},fork(){return new fL(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((e=>{e.$ref=t.id})),t.refs=null),t},proxy(t){const e=t instanceof jz?Hz(t):t;return this.add(BO({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){let r,i;t&&(r=t.data||(t.data={}),i=r[e]||(r[e]=[]),i.push(n))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const r in e.index)n(e.index[r],t,"index:"+r)}return this},pushState(t,e,n){this._encode.push(Hz(this.add(RO({pulse:t})))),this._parent.push(e),this._lookup.push(n?Hz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return F(this._parent)},encode(){return F(this._encode)},lookup(){return F(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(xt(t))return Yz(t,e);t.signal||u("Unsupported field reference: "+Ft(t));const n=t.signal;let r=this.field[n];if(!r){const t={name:this.signalRef(n)};e&&(t.as=e),this.field[n]=r=Hz(this.add(wO(t)))}return r},compareRef(t){let e=!1;const n=t=>Kz(t)?(e=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(e=!0,this.exprRef(t.expr)):t,r=V(t.field).map(n),i=V(t.order).map(n);return e?Hz(this.add(yO({fields:r,orders:i}))):Vz(r,i)},keyRef(t,e){let n=!1;const r=this.signals;return t=V(t).map((t=>Kz(t)?(n=!0,Hz(r[t.signal])):t)),n?Hz(this.add(kO({fields:t,flat:e}))):function(t,e){const n={$key:t};return e&&(n.$flat=!0),n}(t,e)},sortRef(t){if(!t)return t;const e=Jz(t.op,t.field),n=t.order||"ascending";return n.signal?Hz(this.add(yO({fields:e,orders:this.signalRef(n.signal)}))):Vz(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hasOwnSignal(t){return lt(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&u("Duplicate signal name: "+Ft(t));const n=e instanceof jz?e:this.add(Wz(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||u("Unrecognized signal name: "+Ft(t)),this.signals[t]},signalRef(t){return this.signals[t]?Hz(this.signals[t]):(lt(this.lambdas,t)||(this.lambdas[t]=this.add(Wz(null))),Hz(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;er+Math.floor(o*t.random()),pdf:t=>t===Math.floor(t)&&t>=r&&t=i?1:(e-r+1)/o},icdf:t=>t>=0&&t<=1?r-1+Math.floor(t*o):NaN};return a.min(e).max(n)},t.randomKDE=yu,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=wu,t.randomMixture=ku,t.randomNormal=mu,t.randomUniform=Cu,t.read=ha,t.regressionExp=zu,t.regressionLinear=Bu,t.regressionLoess=ju,t.regressionLog=Nu,t.regressionPoly=Uu,t.regressionPow=Ou,t.regressionQuad=Ru,t.renderModule=x_,t.repeat=Et,t.resetDefaultLocale=function(){return So(),zo(),qo()},t.resetSVGClipId=jg,t.resetSVGDefIds=function(){jg(),jp=0},t.responseType=fa,t.runtimeContext=zB,t.sampleCurve=Yu,t.sampleLogNormal=vu,t.sampleNormal=hu,t.sampleUniform=Au,t.scale=ep,t.sceneEqual=C_,t.sceneFromJSON=Gy,t.scenePickVisit=Om,t.sceneToJSON=Yy,t.sceneVisit=zm,t.sceneZOrder=Nm,t.scheme=_p,t.serializeXML=Vv,t.setRandom=function(e){t.random=e},t.span=Ct,t.splitAccessPath=s,t.stringValue=Ft,t.textMetrics=by,t.timeBin=Qr,t.timeFloor=Ar,t.timeFormatLocale=Ro,t.timeInterval=Sr,t.timeOffset=Br,t.timeSequence=Or,t.timeUnitSpecifier=or,t.timeUnits=rr,t.toBoolean=St,t.toDate=Tt,t.toNumber=S,t.toSet=Nt,t.toString=Bt,t.transform=eu,t.transforms=Ka,t.truncate=zt,t.truthy=p,t.tupleid=_a,t.typeParsers=Ko,t.utcFloor=Dr,t.utcInterval=$r,t.utcOffset=Nr,t.utcSequence=Rr,t.utcdayofyear=pr,t.utcquarter=G,t.utcweek=gr,t.version="5.24.0",t.visitArray=Ot,t.week=lr,t.writeConfig=D,t.zero=h,t.zoomLinear=j,t.zoomLog=I,t.zoomPow=W,t.zoomSymlog=H}));
//# sourceMappingURL=vega.min.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy