[email protected] Maven / Gradle / Ivy
Show all versions of hbase-server Show documentation
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={})}(this,(function(t){"use strict";var e="5.19.1";function n(t,e,n){return t.fields=e||[],t.fname=n,t}function r(t){return null==t?null:t.fname}function i(t){return null==t?null:t.fields}function o(t){return 1===t.length?a(t[0]):u(t)}const a=t=>function(e){return e[t]},u=t=>{const e=t.length;return function(n){for(let r=0;rr&&c(),u=r=i+1):"]"===o&&(u||s("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&s("Access path missing closing bracket: "+t),a&&s("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function c(t,e,r){const i=l(t);return t=1===i.length?i[0]:t,n((r&&r.get||o)(i),[t],e||t)}const f=c("id"),h=n((t=>t),[],"identity"),d=n((()=>0),[],"zero"),p=n((()=>1),[],"one"),g=n((()=>!0),[],"true"),m=n((()=>!1),[],"false");function y(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}function v(t,e){let n=t||0;return{level(t){return arguments.length?(n=+t,this):n},error(){return n>=1&&y(e||"error","ERROR",arguments),this},warn(){return n>=2&&y(e||"warn","WARN",arguments),this},info(){return n>=3&&y(e||"log","INFO",arguments),this},debug(){return n>=4&&y(e||"log","DEBUG",arguments),this}}}var _=Array.isArray;function x(t){return t===Object(t)}const b=t=>"__proto__"!==t;function w(...t){return t.reduce(((t,e)=>{for(const n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;k(t,n,e[n],r)}return t}),{})}function k(t,e,n,r){if(!b(e))return;let i,o;if(x(n)&&!_(n))for(i in o=x(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?k(o,i,n[i]):b(i)&&(o[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function M(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}const D=t=>e=>t*Math.exp(e),C=t=>e=>Math.log(t*e),F=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),S=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,B=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function T(t,e,n,r){const i=n(t[0]),o=n(M(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function z(t,e){return T(t,e,E,h)}function N(t,e){var n=Math.sign(t[0]);return T(t,e,C(n),D(n))}function O(t,e,n){return T(t,e,B(n),B(1/n))}function R(t,e,n){return T(t,e,F(n),S(n))}function L(t,e,n,r,i){const o=r(t[0]),a=r(M(t)),u=null!=e?r(e):(o+a)/2;return[i(u+(o-u)*n),i(u+(a-u)*n)]}function U(t,e,n){return L(t,e,n,E,h)}function q(t,e,n){const r=Math.sign(t[0]);return L(t,e,n,C(r),D(r))}function P(t,e,n,r){return L(t,e,n,B(r),B(1/r))}function j(t,e,n,r){return L(t,e,n,F(r),S(r))}function I(t){return 1+~~(new Date(t).getMonth()/3)}function $(t){return 1+~~(new Date(t).getUTCMonth()/3)}function W(t){return null!=t?_(t)?t:[t]:[]}function H(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 Y(t){return"function"==typeof t}function V(t,e,r){r=r||{},e=W(e)||[];const o=[],a=[],u={},s=r.comparator||X;return W(t).forEach(((t,n)=>{null!=t&&(o.push("descending"===e[n]?-1:1),a.push(t=Y(t)?t:c(t,null,r)),(i(t)||[]).forEach((t=>u[t]=1)))})),0===a.length?null:n(s(a,o),Object.keys(u))}const G=(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),X=(t,e)=>1===t.length?J(t[0],e[0]):Z(t,e,t.length),J=(t,e)=>function(n,r){return G(t(n),t(r))*e},Z=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++ut}function K(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function tt(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 nt(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]===ot&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=ot),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===ot||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 ut(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let u,s=t[0],l=M(t);la&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:ot.replace(/\\(.)/g,"$1"))):W(t));const i=t&&t.length,a=r&&r.get||o,u=t=>a(e?[t]:l(t));let s;if(i)if(1===i){const e=u(t[0]);s=function(t){return""+e(t)}}else{const e=t.map(u);s=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=>it(e,t)||it(n,t),get:t=>it(e,t)?e[t]:it(n,t)?o(t,n[t]):void 0,set:(t,n)=>it(e,t)?e[t]=n:o(t,n)}}function _t(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 bt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?xt(i,a)+o:"center"===r?xt(i,~~(a/2))+o+xt(i,Math.ceil(a/2)):o+xt(i,a)}function wt(t){return t&&M(t)-t[0]||0}function kt(t){return _(t)?"["+t.map(kt)+"]":x(t)||gt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function At(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const Mt=t=>dt(t)||ft(t)?t:Date.parse(t);function Et(t,e){return e=e||Mt,null==t||""===t?null:e(t)}function Dt(t){return null==t||""===t?null:t+""}function Ct(t){const e={},n=t.length;for(let r=0;rnew Promise(((n,r)=>{t.readFile(e,((t,e)=>{t?r(t):n(e)}))})):Ut}async function Ut(){s("No file system access.")}function qt(t){return t?async function(e,n){const r=tt({},this.options.http,n),i=n&&n.response,o=await t(e,r);return o.ok?Y(o[i])?o[i]():o.text():s(o.status+""+o.statusText)}:Pt}async function Pt(){s("No HTTP fetch method available.")}const jt=t=>!(Number.isNaN(+t)||t instanceof Date),It={boolean:At,integer:E,number:E,date:Et,string:Dt,unknown:h},$t=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>jt(t)&&Number.isInteger(+t),jt,t=>!Number.isNaN(Date.parse(t))],Wt=["boolean","integer","number","date"];function Ht(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=$t.length,i=$t.map(((t,e)=>e+1));for(let a,u,s=0,l=0;s0===t?e:t),0)-1]}function Yt(t,e){return e.reduce(((e,n)=>(e[n]=Ht(t,n),e)),{})}var Vt={},Gt={};function Xt(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jt(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Zt(t,e){var n=t+"",r=n.length;return r9999?"+"+Zt(t,6):Zt(t,4)}(t.getUTCFullYear())+"-"+Zt(t.getUTCMonth()+1,2)+"-"+Zt(t.getUTCDate(),2)+(i?"T"+Zt(e,2)+":"+Zt(n,2)+":"+Zt(r,2)+"."+Zt(i,3)+"Z":r?"T"+Zt(e,2)+":"+Zt(n,2)+":"+Zt(r,2)+"Z":n||e?"T"+Zt(e,2)+":"+Zt(n,2)+"Z":"")}function Kt(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 Gt;if(l)return l=!1,Vt;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++=o?s=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a1)r=ce(t,e,n);else for(i=0,r=new Array(o=t.arcs.length);it!==e,exterior:(t,e)=>t===e};function he(t,e){let n,r,i,o;return t=ne(t,e),e&&e.feature?(n=ie,i=e.feature):e&&e.mesh?(n=se,i=e.mesh,o=fe[e.filter]):s("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):s("Invalid TopoJSON object: "+i),r&&r.features||[r]}he.responseType="json";const de={dsv:ee,csv:te(","),tsv:te("\t"),json:ne,topojson:he};function pe(t,e){return arguments.length>1?(de[t]=e,this):it(de,t)?de[t]:null}function ge(t){const e=pe(t);return e&&e.responseType||"text"}function me(t,e){return te?1:t>=e?0:NaN}function ye(t){let e=t,n=t;function r(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=function(t){return(e,n)=>me(t(e),n)}(t)),{left:r,center:function(t,n,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,n,i,o-1);return a>i&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function ve(t){return null===t?NaN:+t}const _e=ye(me),xe=_e.right,be=_e.left;ye(ve).center;class we{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r0){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}}var ke=Math.sqrt(50),Ae=Math.sqrt(10),Me=Math.sqrt(2);function Ee(t,e,n){var r,i,o,a,u=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++u=0?(o>=ke?10:o>=Ae?5:o>=Me?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ke?10:o>=Ae?5:o>=Me?2:1)}function Ce(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ke?i*=10:o>=Ae?i*=5:o>=Me&&(i*=2),e=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 Se(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 Be(t,e,n=0,r=t.length-1,i=me){for(;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);Be(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(Te(t,n,e),i(t[r],o)>0&&Te(t,n,r);a0;)--u}0===i(t[n],o)?Te(t,n,u):(++u,Te(t,u,r)),u<=e&&(n=u+1),e<=u&&(r=u-1)}return t}function Te(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ze(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return Se(t);if(e>=1)return Fe(t);var r,i=(r-1)*e,o=Math.floor(i),a=Fe(Be(t,o).subarray(0,o+1));return a+(Se(t.subarray(o+1))-a)*(i-o)}}function Ne(t,e,n=ve){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function Oe(t,e){return ze(t,.5,e)}function Re(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function Le(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 Pe(t){return(t=qe(Math.abs(t)))?t[1]:NaN}var je,Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $e(t){if(!(e=Ie.exec(t)))throw new Error("invalid format: "+t);var e;return new We({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 We(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 He(t,e){var n=qe(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")}$e.prototype=We.prototype,We.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 Ye={"%":(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)=>He(100*t,e),r:He,s:function(t,e){var n=qe(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(je=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")+qe(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ve(t){return t}var Ge,Xe,Je,Ze=Array.prototype.map,Qe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ke(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ve:(e=Ze.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?Ve:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ze.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=$e(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"):Ye[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=Ye[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?Qe[8+je/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=$e(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Pe(e)/3))),i=Math.pow(10,-r),o=Qe[8+r/3];return function(t){return n(i*t)+o}}}}function tn(t){return Math.max(0,-Pe(Math.abs(t)))}function en(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pe(e)/3)))-Pe(Math.abs(t)))}function nn(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Pe(e)-Pe(t))+1}!function(t){Ge=Ke(t),Xe=Ge.format,Je=Ge.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});var rn=new Date,on=new Date;function an(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return rn.setTime(+e),on.setTime(+r),t(rn),t(on),Math.floor(n(rn,on))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var un=an((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));un.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?an((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):un:null};var sn=1e3,ln=6e4,cn=36e5,fn=864e5,hn=6048e5,dn=an((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*sn)}),(function(t,e){return(e-t)/sn}),(function(t){return t.getUTCSeconds()})),pn=an((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*sn)}),(function(t,e){t.setTime(+t+e*ln)}),(function(t,e){return(e-t)/ln}),(function(t){return t.getMinutes()})),gn=an((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*sn-t.getMinutes()*ln)}),(function(t,e){t.setTime(+t+e*cn)}),(function(t,e){return(e-t)/cn}),(function(t){return t.getHours()})),mn=an((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ln)/fn),(t=>t.getDate()-1));function yn(t){return an((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ln)/hn}))}var vn=yn(0),_n=yn(1),xn=(yn(2),yn(3),yn(4)),bn=(yn(5),yn(6),an((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),wn=an((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));wn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var kn=an((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*ln)}),(function(t,e){return(e-t)/ln}),(function(t){return t.getUTCMinutes()})),An=an((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*cn)}),(function(t,e){return(e-t)/cn}),(function(t){return t.getUTCHours()})),Mn=an((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/fn}),(function(t){return t.getUTCDate()-1}));function En(t){return an((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/hn}))}var Dn=En(0),Cn=En(1),Fn=(En(2),En(3),En(4)),Sn=(En(5),En(6),an((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),Bn=an((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const Tn="year",zn="quarter",Nn="month",On="week",Rn="date",Ln="day",Un="dayofyear",qn="hours",Pn="minutes",jn="seconds",In="milliseconds",$n=[Tn,zn,Nn,On,Rn,Ln,Un,qn,Pn,jn,In],Wn=$n.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function Hn(t){const e=W(t).slice(),n={};e.length||s("Missing time unit."),e.forEach((t=>{it(Wn,t)?n[t]=1:s("Invalid time unit: ".concat(t,"."))}));return(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+(n.dayofyear?1:0)>1&&s("Incompatible time units: ".concat(t)),e.sort(((t,e)=>Wn[t]-Wn[e])),e}const Yn={[Tn]:"%Y ",[zn]:"Q%q ",[Nn]:"%b ",[Rn]:"%d ",[On]:"W%U ",[Ln]:"%a ",[Un]:"%j ",[qn]:"%H:00",[Pn]:"00:%M",[jn]:":%S",[In]:".%L",["".concat(Tn,"-").concat(Nn)]:"%Y-%m ",["".concat(Tn,"-").concat(Nn,"-").concat(Rn)]:"%Y-%m-%d ",["".concat(qn,"-").concat(Pn)]:"%H:%M"};function Vn(t,e){const n=tt({},Yn,e),r=Hn(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 Gn=new Date;function Xn(t){return Gn.setFullYear(t),Gn.setMonth(0),Gn.setDate(1),Gn.setHours(0,0,0,0),Gn}function Jn(t){return Qn(new Date(t))}function Zn(t){return Kn(new Date(t))}function Qn(t){return mn.count(Xn(t.getFullYear())-1,t)}function Kn(t){return vn.count(Xn(t.getFullYear())-1,t)}function tr(t){return Xn(t).getDay()}function er(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 nr(t){return ir(new Date(t))}function rr(t){return or(new Date(t))}function ir(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Mn.count(e-1,t)}function or(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Dn.count(e-1,t)}function ar(t){return Gn.setTime(Date.UTC(t,0,1)),Gn.getUTCDay()}function ur(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 sr(t,e,n,r,i){const o=e||1,a=M(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=Ct(t),c=l.year?u(Tn):Q(2012),f=l.month?u(Nn):l.quarter?u(zn):d,h=l.week&&l.day?u(Ln,1,On+Ln):l.week?u(On,1):l.day?u(Ln,1):l.date?u(Rn,1):l.dayofyear?u(Un,1):p,g=l.hours?u(qn):d,m=l.minutes?u(Pn):d,y=l.seconds?u(jn):d,v=l.milliseconds?u(In):d;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),g(s),m(s),y(s),v(s))}}function lr(t,e,n){return e+7*t-(n+6)%7}const cr={[Tn]:t=>t.getFullYear(),[zn]:t=>Math.floor(t.getMonth()/3),[Nn]:t=>t.getMonth(),[Rn]:t=>t.getDate(),[qn]:t=>t.getHours(),[Pn]:t=>t.getMinutes(),[jn]:t=>t.getSeconds(),[In]:t=>t.getMilliseconds(),[Un]:t=>Qn(t),[On]:t=>Kn(t),[On+Ln]:(t,e)=>lr(Kn(t),t.getDay(),tr(e)),[Ln]:(t,e)=>lr(1,t.getDay(),tr(e))},fr={[zn]:t=>3*t,[On]:(t,e)=>lr(t,0,tr(e))};function hr(t,e){return sr(t,e||1,cr,fr,er)}const dr={[Tn]:t=>t.getUTCFullYear(),[zn]:t=>Math.floor(t.getUTCMonth()/3),[Nn]:t=>t.getUTCMonth(),[Rn]:t=>t.getUTCDate(),[qn]:t=>t.getUTCHours(),[Pn]:t=>t.getUTCMinutes(),[jn]:t=>t.getUTCSeconds(),[In]:t=>t.getUTCMilliseconds(),[Un]:t=>ir(t),[On]:t=>or(t),[Ln]:(t,e)=>lr(1,t.getUTCDay(),ar(e)),[On+Ln]:(t,e)=>lr(or(t),t.getUTCDay(),ar(e))},pr={[zn]:t=>3*t,[On]:(t,e)=>lr(t,0,ar(e))};function gr(t,e){return sr(t,e||1,dr,pr,ur)}const mr={[Tn]:wn,[zn]:bn.every(3),[Nn]:bn,[On]:vn,[Rn]:mn,[Ln]:mn,[Un]:mn,[qn]:gn,[Pn]:pn,[jn]:dn,[In]:un},yr={[Tn]:Bn,[zn]:Sn.every(3),[Nn]:Sn,[On]:Dn,[Rn]:Mn,[Ln]:Mn,[Un]:Mn,[qn]:An,[Pn]:kn,[jn]:dn,[In]:un};function vr(t){return mr[t]}function _r(t){return yr[t]}function xr(t,e,n){return t?t.offset(e,n):void 0}function br(t,e,n){return xr(vr(t),e,n)}function wr(t,e,n){return xr(_r(t),e,n)}function kr(t,e,n,r){return t?t.range(e,n,r):void 0}function Ar(t,e,n,r){return kr(vr(t),e,n,r)}function Mr(t,e,n,r){return kr(_r(t),e,n,r)}const Er=1e3,Dr=6e4,Cr=36e5,Fr=864e5,Sr=2592e6,Br=31536e6,Tr=[Tn,Nn,Rn,qn,Pn,jn,In],zr=Tr.slice(0,-1),Nr=zr.slice(0,-1),Or=Nr.slice(0,-1),Rr=Or.slice(0,-1),Lr=[Tn,Nn],Ur=[Tn],qr=[[zr,1,Er],[zr,5,5e3],[zr,15,15e3],[zr,30,3e4],[Nr,1,Dr],[Nr,5,3e5],[Nr,15,9e5],[Nr,30,18e5],[Or,1,Cr],[Or,3,108e5],[Or,6,216e5],[Or,12,432e5],[Rr,1,Fr],[[Tn,On],1,6048e5],[Lr,1,Sr],[Lr,3,7776e6],[Ur,1,Br]];function Pr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(wt(e))/n;let i,o,a=ye((t=>t[2])).right(qr,r);return a===qr.length?(i=Ur,o=Ce(e[0]/Br,e[1]/Br,n)):a?(a=qr[r/qr[a-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:fo,s:ho,S:Ti,u:zi,U:Ni,V:Ri,w:Li,W:Ui,x:null,X:null,y:qi,Y:ji,Z:$i,"%":co},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:Wi,e:Wi,f:Xi,g:ao,G:so,H:Hi,I:Yi,j:Vi,L:Gi,m:Ji,M:Zi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:fo,s:ho,S:Qi,u:Ki,U:to,V:no,w:ro,W:io,x:null,X:null,y:oo,Y:uo,Z:lo,"%":co},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:pi,e:pi,f:xi,g:ci,G:li,H:mi,I:mi,j:gi,L:_i,m:di,M:yi,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:hi,Q:wi,s:ki,S:vi,u:oi,U:ai,V:ui,w:ii,W:si,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:ci,Y:li,Z:fi,"%":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=Ir($r(o.y,0,1))).getUTCDay(),r=i>4||0===i?Cn.ceil(r):Cn(r),r=Mn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=jr($r(o.y,0,1))).getDay(),r=i>4||0===i?_n.ceil(r):_n(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?Ir($r(o.y,0,1)).getUTCDay():jr($r(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,Ir(o)):jr(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 Jr?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 Hr,Yr,Vr,Gr,Xr,Jr={"-":"",_:" ",0:"0"},Zr=/^\s*\d+/,Qr=/^%/,Kr=/[\\^$*+?|[\]().{}]/g;function ti(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function ii(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function oi(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ai(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ui(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function si(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function li(t,e,n){var r=Zr.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ci(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function fi(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 hi(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function di(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function pi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function gi(t,e,n){var r=Zr.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function mi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function yi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function vi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function _i(t,e,n){var r=Zr.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function xi(t,e,n){var r=Zr.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=Qr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function wi(t,e,n){var r=Zr.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function ki(t,e,n){var r=Zr.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ai(t,e){return ti(t.getDate(),e,2)}function Mi(t,e){return ti(t.getHours(),e,2)}function Ei(t,e){return ti(t.getHours()%12||12,e,2)}function Di(t,e){return ti(1+mn.count(wn(t),t),e,3)}function Ci(t,e){return ti(t.getMilliseconds(),e,3)}function Fi(t,e){return Ci(t,e)+"000"}function Si(t,e){return ti(t.getMonth()+1,e,2)}function Bi(t,e){return ti(t.getMinutes(),e,2)}function Ti(t,e){return ti(t.getSeconds(),e,2)}function zi(t){var e=t.getDay();return 0===e?7:e}function Ni(t,e){return ti(vn.count(wn(t)-1,t),e,2)}function Oi(t){var e=t.getDay();return e>=4||0===e?xn(t):xn.ceil(t)}function Ri(t,e){return t=Oi(t),ti(xn.count(wn(t),t)+(4===wn(t).getDay()),e,2)}function Li(t){return t.getDay()}function Ui(t,e){return ti(_n.count(wn(t)-1,t),e,2)}function qi(t,e){return ti(t.getFullYear()%100,e,2)}function Pi(t,e){return ti((t=Oi(t)).getFullYear()%100,e,2)}function ji(t,e){return ti(t.getFullYear()%1e4,e,4)}function Ii(t,e){var n=t.getDay();return ti((t=n>=4||0===n?xn(t):xn.ceil(t)).getFullYear()%1e4,e,4)}function $i(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ti(e/60|0,"0",2)+ti(e%60,"0",2)}function Wi(t,e){return ti(t.getUTCDate(),e,2)}function Hi(t,e){return ti(t.getUTCHours(),e,2)}function Yi(t,e){return ti(t.getUTCHours()%12||12,e,2)}function Vi(t,e){return ti(1+Mn.count(Bn(t),t),e,3)}function Gi(t,e){return ti(t.getUTCMilliseconds(),e,3)}function Xi(t,e){return Gi(t,e)+"000"}function Ji(t,e){return ti(t.getUTCMonth()+1,e,2)}function Zi(t,e){return ti(t.getUTCMinutes(),e,2)}function Qi(t,e){return ti(t.getUTCSeconds(),e,2)}function Ki(t){var e=t.getUTCDay();return 0===e?7:e}function to(t,e){return ti(Dn.count(Bn(t)-1,t),e,2)}function eo(t){var e=t.getUTCDay();return e>=4||0===e?Fn(t):Fn.ceil(t)}function no(t,e){return t=eo(t),ti(Fn.count(Bn(t),t)+(4===Bn(t).getUTCDay()),e,2)}function ro(t){return t.getUTCDay()}function io(t,e){return ti(Cn.count(Bn(t)-1,t),e,2)}function oo(t,e){return ti(t.getUTCFullYear()%100,e,2)}function ao(t,e){return ti((t=eo(t)).getUTCFullYear()%100,e,2)}function uo(t,e){return ti(t.getUTCFullYear()%1e4,e,4)}function so(t,e){var n=t.getUTCDay();return ti((t=n>=4||0===n?Fn(t):Fn.ceil(t)).getUTCFullYear()%1e4,e,4)}function lo(){return"+0000"}function co(){return"%"}function fo(t){return+t}function ho(t){return Math.floor(+t/1e3)}function po(t){const e={};return n=>e[n]||(e[n]=t(n))}function go(t){const e=po(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=$e(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=$e(null==o?",f":o);const a=Ce(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=en(a,u))||(o.precision=s),n(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=nn(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=tn(a))||(o.precision=s-2*("%"===o.type))}return e(o)}}}let mo,yo;function vo(){return mo=go({format:Xe,formatPrefix:Je})}function _o(t){return go(Ke(t))}function xo(t){return arguments.length?mo=_o(t):mo}function bo(t,e,n){x(n=n||{})||s("Invalid time multi-format specifier: ".concat(n));const r=e(jn),i=e(Pn),o=e(qn),a=e(Rn),u=e(On),l=e(Nn),c=e(zn),f=e(Tn),h=t(n.milliseconds||".%L"),d=t(n.seconds||":%S"),p=t(n.minutes||"%I:%M"),g=t(n.hours||"%I %p"),m=t(n.date||n.day||"%a %d"),y=t(n.week||"%b %d"),v=t(n.month||"%B"),_=t(n.quarter||"%B"),b=t(n.year||"%Y");return t=>(r(t)gt(t)?e(t):bo(e,vr,t),utcFormat:t=>gt(t)?n(t):bo(n,_r,t),timeParse:po(t.parse),utcParse:po(t.utcParse)}}function ko(){return yo=wo({format:Yr,parse:Vr,utcFormat:Gr,utcParse:Xr})}function Ao(t){return wo(Wr(t))}function Mo(t){return arguments.length?yo=Ao(t):yo}!function(t){Hr=Wr(t),Yr=Hr.format,Vr=Hr.parse,Gr=Hr.utcFormat,Xr=Hr.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"]}),vo(),ko();const Eo=(t,e)=>tt({},t,e);function Do(t,e){const n=t?_o(t):xo(),r=e?Ao(e):Mo();return Eo(n,r)}function Co(t,e){const n=arguments.length;return n&&2!==n&&s("defaultLocale expects either zero or two arguments."),n?Eo(xo(t),Mo(e)):Eo(xo(),Mo())}function Fo(t,e,n,r){const i=pe((e=e||{}).type||"json");return i||s("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=Mo();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=Yt(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(!It[i])throw Error("Illegal format pattern: "+t+":"+i);return It[i]}));for(u=0,l=t.length,c=f.length;u({options:n||{},sanitize:Rt,load:Ot,fileAccess:!!e,file:Lt(e),http:qt(t)})}("undefined"!=typeof fetch&&fetch,null);function Bo(t){const e=t||h,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 To(t,e){try{await e(t)}catch(e){t.error(e)}}const zo=Symbol("vega_id");let No=1;function Oo(t){return!(!t||!Ro(t))}function Ro(t){return t[zo]}function Lo(t,e){return t[zo]=e,t}function Uo(t){const e=t===Object(t)?t:{data:t};return Ro(e)?e:Lo(e,No++)}function qo(t){return Po(t,Uo({}))}function Po(t,e){for(const n in t)e[n]=t[n];return e}function jo(t,e){return Lo(e,Ro(t))}function Io(t,e){return t?e?(n,r)=>t(n,r)||Ro(e(n))-Ro(e(r)):(e,n)=>t(e,n)||Ro(e)-Ro(n):null}function $o(t){return t&&t.constructor===Wo}function Wo(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:Wo,insert(e){const n=W(e),r=n.length;for(let e=0;e{p(t)&&(l[Ro(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[Ro(t)]>0&&y(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=e.length||r.length?s.filter((t=>l[Ro(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 Ho="_:mod:_";function Yo(){Object.defineProperty(this,Ho,{writable:!0,value:{}})}Yo.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[Ho];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]=_(n)?1+n.length:-1),i},modified(t,e){const n=this[Ho];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(_(t)){for(let e=0;e=0?e+1{a instanceof Xo?(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(u=t[a],"pulse"===a)W(u).forEach((t=>{t instanceof Xo?t!==this&&(t.targets().add(this),o.push(t)):s("Pulse parameters must be operator instances.")})),this.source=u;else if(_(u))for(r.set(a,-1,Array(l=u.length)),c=0;c{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=Ko();return this.targets().add(Ko(null,null,K(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(Ko(null,null,(()=>n=!0))),e.targets().add(Ko(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){}};const ta={skip:!0};function ea(t,e,n,r,i,o){const a=tt({},o,ta);let u,s;Y(n)||(n=Q(n)),void 0===r?u=e=>t.touch(n(e)):Y(r)?(s=new Xo(null,r,i,!1),u=e=>{s.evaluate(e);const r=n(e),i=s.value;$o(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=e=>t.update(n(e),r,a),e.apply(u)}function na(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},u=new Xo(null,function(t,e){return e=Y(e)?e:Q(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 ra={};function ia(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 oa(t,e){const n=[];return St(t,e,(t=>n.push(t))),n}function aa(t,e){const n={};return t.visit(e,(t=>{n[Ro(t)]=1})),t=>n[Ro(t)]?null:t}function ua(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function sa(t,e,n,r){const i=this,o=n.length;let a=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(let t=0;te[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?_(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=ua(n.addF,e)),2&t&&(n.remF=ua(n.remF,e)),4&t&&(n.modF=ua(n.modF,e)),16&t&&(n.srcF=ua(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=oa(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=oa(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=oa(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 St(n.source,n.srcF,r),n;1&t&&St(n.add,n.addF,r),2&t&&St(n.rem,n.remF,r),4&t&&St(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||St(i,t?aa(n,5):n.srcF,r)}return n}},st(sa,ia,{fork(t){const e=new ia(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?_(t)?t.some((t=>n[t])):n[t]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("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),ha(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,ha(t,r,e,n)}(e,0,t)):r=n,r}}}function ha(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 da(){this.logger(v()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Co();try{this._loader=So()}catch(t){}this._touched=Bo(f),this._input={},this._pulse=null,this._heap=fa(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function pa(t){return function(){return this._log[t].apply(this,arguments)}}function ga(t,e){Xo.call(this,t,null,e)}da.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:pa("error"),warn:pa("warn"),info:pa("info"),debug:pa("debug"),logLevel:pa("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof Xo?i=t:t&&t.prototype instanceof Xo?i=new t:Y(t)?i=new Xo(null,t):(o=0,i=new Xo(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&&s("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||ca);const r=new ia(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||ca;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||ca;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:Wo,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 Fo(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(g).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:ge(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=Ko(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):W(t);const s=u.length;for(let t=0;tr._enqueue(t,!0))),r._touched=Bo(f);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=ra),u!==ra&&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 ".concat(o,": ").concat(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?la(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!==ra&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},st(ga,Xo,{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 ma={};function ya(t){const e=va(t);return e&&e.Definition||null}function va(t){return t=t&&t.toLowerCase(),it(ma,t)?ma[t]:null}function*_a(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 xa(t,e,n){const r=Float64Array.from(_a(t,n));return r.sort(me),e.map((t=>Ne(r,t)))}function ba(t,e){return xa(t,[.25,.5,.75],e)}function wa(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=ba(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 ka(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 Ea=Math.sqrt(2*Math.PI),Da=Math.SQRT2;let Ca=NaN;function Fa(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(Ca==Ca)o=Ca,Ca=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,Ca=a*i}return e+o*n}function Sa(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Ea)}function Ba(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 Ta(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*Da*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 za(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:()=>Fa(n,r),pdf:t=>Sa(t,n,r),cdf:t=>Ba(t,n,r),icdf:t=>Ta(t,n,r)};return i.mean(t).stdev(e)}function Na(e,n){const r=za();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=wa(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;aOa(n,r),pdf:t=>Ra(t,n,r),cdf:t=>La(t,n,r),icdf:t=>Ua(t,n,r)};return i.mean(t).stdev(e)}function Pa(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 $a(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Wa(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Ha(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:()=>ja(n,r),pdf:t=>Ia(t,n,r),cdf:t=>$a(t,n,r),icdf:t=>Wa(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Ya(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 Va(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 Xa(t,e,n,r,i){let o=0,a=0;return Ga(t,e,n,((t,e)=>{const n=e-i(t),u=e-r;o+=n*n,a+=u*u})),1-o/a}function Ja(t,e,n){let r=0,i=0,o=0,a=0,u=0;Ga(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=Ya(r,i,o,a),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Xa(t,e,n,i,l)}}function Za(t,e,n){let r=0,i=0,o=0,a=0,u=0;Ga(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=Ya(r,i,o,a),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Xa(t,e,n,i,l)}}function Qa(t,e,n){const[r,i,o,a]=Va(t,e,n);let u,s,l,c=0,f=0,h=0,d=0,p=0;Ga(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]=Ya(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:Xa(t,e,n,a,y)}}function Ka(t,e,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ga(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=Ya(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:Xa(t,e,n,u,c)}}function tu(t,e,n){const[r,i,o,a]=Va(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:Xa(t,e,n,a,w)}}function eu(t,e,n,r){if(1===r)return Ja(t,e,n);if(2===r)return tu(t,e,n);const[i,o,a,u]=Va(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}function ru(t,e,n,r){const[i,o,a,u]=Va(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;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]=Ya(l/s,d/s,p/s,g/s);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),ou(i,t+1,e)}if(2===t)break;const n=Oe(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(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 au=.1*Math.PI/180;function uu(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];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&su(f,t,h)>au?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function su(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function lu(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{},hu={init:fu,add:fu,rem:fu,idx:0},du={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}},pu=Object.keys(du);function gu(t,e){return du[t](e)}function mu(t,e){return t.idx-e.idx}function yu(){this.valid=0,this.missing=0,this._ops.forEach((t=>t.init(this)))}function vu(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function _u(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function xu(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function bu(t,e){const n=e||h,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]=du[t]())}))};return t.forEach(n),Object.values(e).sort(mu)}(t),i=t.slice().sort(mu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=yu,o.prototype.add=vu,o.prototype.rem=_u,o.prototype.set=xu,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function wu(t){this._key=t?c(t):Ro,this.reset()}pu.forEach((t=>{du[t]=function(t,e){return n=>tt({name:t,out:n||t},hu,e)}(t,du[t])}));const ku=wu.prototype;function Au(t){ga.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}ku.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},ku.add=function(t){this._add.push(t)},ku.rem=function(t){this._rem.push(t)},ku.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])+"",it(n,r)||(n[r]=1,++o);return o},ku.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=nt(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},ku.argmin=function(t){return this.extent(t)[0]||{}},ku.argmax=function(t){return this.extent(t)[1]||{}},ku.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},ku.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},ku.quartile=function(t){return this._get===t&&this._q||(this._q=ba(this.values(),t),this._get=t),this._q},ku.q1=function(t){return this.quartile(t)[0]},ku.q2=function(t){return this.quartile(t)[1]},ku.q3=function(t){return this.quartile(t)[2]},ku.ci=function(t){return this._get===t&&this._ci||(this._ci=Aa(this.values(),1e3,.05,t),this._get=t),this._ci},ku.ci0=function(t){return this.ci(t)[0]},ku.ci1=function(t){return this.ci(t)[1]},Au.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:pu},{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"}]},st(Au,ga,{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=r(t);return a(t),n.push(e),e})),this.cellkey=t.key?t.key:lu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const u=t.fields||[null],l=t.ops||["count"],c=t.as||[],f=u.length,h={};let d,p,g,m,y,v;for(f!==l.length&&s("Unmatched number of fields and aggregate ops."),v=0;vbu(t,t.field))),{}},cellkey:lu(),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?_t(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Du(t){ga.call(this,[],t)}function Cu(t){Xo.call(this,null,Fu,t)}function Fu(t){return this.value&&!t.modified()?this.value:V(t.fields,t.orders)}function Su(t){ga.call(this,null,t)}function Bu(t){ga.call(this,null,t)}Mu.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"]}]},st(Mu,ga,{transform(t,e){const n=!1!==t.interval,r=this._bins(t),o=r.start,a=r.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(i(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=r(t);t[s]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[s]=r(t)),e.modifies(n?u:s)},_bins(t){if(this.value&&!t.modified())return this.value;const e=t.field,o=ka(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 n=E(e(t));return null==n?null:nc?1/0:(n=Math.max(l,Math.min(n,c-a)),l+a*Math.floor(1e-14+(n-l)/a))};return f.start=l,f.stop=o.stop,f.step=a,this.value=n(f,i(e),t.name||"bin_"+r(e))}}),Du.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},st(Du,ga,{transform(t,e){const n=e.fork(e.ALL),r=Eu(Ro,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(Io(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),st(Cu,Xo),Su.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"]}]},st(Su,ga,{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=Uo({}),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)}}),Bu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},st(Bu,ga,{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;lNu(t,e)))):typeof r[n]===zu&&r[n](t[n]);return r}function Ou(t){ga.call(this,null,t)}const Ru=[{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}]}],Lu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Ru},{name:"weights",type:"number",array:!0}]};function Uu(t,e){return t?t.map(((t,n)=>e[n]||r(t))):null}function qu(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&&s("Invalid density method: "+a),t.extent||r.data||s("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],l=uu(a,t.extent||et(r.data()),i,o).map((t=>{const e={};return e[u[0]]=t[0],e[u[1]]=t[1],Uo(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function Pu(t){ga.call(this,null,t)}Pu.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 ju(t){Xo.call(this,null,Iu,t),this.modified(!0)}function Iu(t){const e=t.expr;return this.value&&!t.modified("expr")?this.value:n((n=>e(n,t)),i(e),r(e))}function $u(t){ga.call(this,[void 0,void 0],t)}function Wu(t,e){Xo.call(this,t),this.parent=e,this.count=0}function Hu(t){ga.call(this,{},t),this._keys=at();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nc(t))):c(t.name,t.as)}function Gu(t){ga.call(this,at(),t)}function Xu(t){ga.call(this,[],t)}function Ju(t){ga.call(this,[],t)}function Zu(t){ga.call(this,null,t)}function Qu(t){ga.call(this,[],t)}st(Pu,ga,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=qu(e.source,t.groupby,h),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>wt(et(t,e))/30)(n,o),u=Io(((t,e)=>o(t)-o(e))),s=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,p=0;for(;pd&&(d=e),t[++c][s]=e}return this.value={start:f,stop:d,step:a},e.reflow(!0).modifies(s)}}),st(ju,Xo),$u.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},st($u,ga,{transform(t,e){const n=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=n[0],u=n[1];if((o||null==a)&&(a=1/0,u=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=E(i(t));null!=e&&(eu&&(u=e))})),!Number.isFinite(a)||!Number.isFinite(u)){let t=r(i);t&&(t=' for field "'.concat(t,'"')),e.dataflow.warn("Infinite extent".concat(t,": [").concat(a,", ").concat(u,"]")),a=u=void 0}this.value=[a,u]}}),st(Wu,Xo,{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}}),st(Hu,ga,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,u=it(i,t)&&i[t];return u?u.value.stampthis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=Ro(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(Ro(t),e),u(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=Ro(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(Ro(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=Ro(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}}),st(Yu,Xo),Gu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},st(Gu,ga,{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=Ro(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=Ro(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{s(e,t)?o.push(e):r.set(Ro(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}}),Xu.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}]},st(Xu,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Uu(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,r=0;re[r]=n(e,t)))}}),st(Qu,ga,{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=Uo(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 Ku={value:"value",median:Oe,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:Se,max:Fe},ts=[];function es(t){ga.call(this,[],t)}function ns(t){Au.call(this,t)}function rs(t){ga.call(this,null,t)}function is(t){Xo.call(this,null,os,t)}function os(t){return this.value&&!t.modified()?this.value:mt(t.fields,t.flat)}function as(t){ga.call(this,[],t),this._pending=null}function us(t,e,n){n.forEach(Uo);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 ss(t){ga.call(this,{},t)}function ls(t){Xo.call(this,null,cs,t)}function cs(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 fs(t){Xo.call(this,null,hs,t)}function hs(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function ds(t){ga.call(this,null,t)}function ps(t){Au.call(this,t)}function gs(t){Hu.call(this,t)}function ms(t){ga.call(this,null,t)}function ys(t){ga.call(this,null,t)}function vs(t){ga.call(this,null,t)}es.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}]},st(es,ga,{transform(t,e){var n,i,o,a,u,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Ku.value;if(null!=Ku[n])return n===Ku.value?(e=void 0!==t.value?t.value:0,()=>e):Ku[n];s("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=r(t.field),v=r(t.key),_=(t.groupby||[]).map(r),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=>{tt(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=Na(e,u)[l],r=t.counts?e.length:1;uu(n,h||et(e),d,p).forEach((t=>{const n={};for(let t=0;t(this._pending=W(t.data),t=>t.touch(this))))}}return n.request(t.url,t.format).then((t=>us(this,e,W(t.data))))}}),ss.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},st(ss,ga,{transform(t,e){const n=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,u=t.modified(),l=n.length;let c,f,h,d=u?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&s('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&s('The "as" parameter has too few output field names.'),g=g||o.map(r),c=function(t){for(var e,r,u=0,s=0;ue.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),st(ls,Xo),st(fs,Xo),st(ds,ga,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),ps.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:pu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},st(ps,Au,{_transform:Au.prototype.transform,transform(t,e){return this._transform(function(t,e){const r=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",u=i(r).concat(i(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(G),e?i.slice(0,e):i}(r,t.limit||0,e);e.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((()=>a)),fields:s.map((t=>function(t,e,r,i){return n((n=>e(n)===t?r(n):NaN),i,t+"")}(t,r,o,u))),as:s.map((t=>t+"")),modified:t.modified.bind(t)}}(t,e),e)}}),st(gs,Hu,{transform(t,e){const n=t.subflow,r=t.field,o=t=>this.subflow(Ro(t),n,e,t);return(t.modified("field")||r&&e.modified(i(r)))&&s("PreFacet does not support field modification."),this.initTargets(),r?(e.visit(e.MOD,(t=>{const e=o(t);r(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);r(t).forEach((t=>e.add(Uo(t))))})),e.visit(e.REM,(t=>{const e=o(t);r(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}}),ms.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},st(ms,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Uu(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i{const e=Ro(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,Uo({}));a[Ro(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[Ro(t)]))})),n}}),st(ys,ga,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),vs.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 _s(t){ga.call(this,null,t)}function xs(t){ga.call(this,[],t),this.count=0}function bs(t){ga.call(this,null,t)}function ws(t){ga.call(this,null,t),this.modified(!0)}function ks(t){ga.call(this,null,t)}st(vs,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return n.source=this.value,n;const o=qu(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(r),u=[],s=t.step||.01,l=t.probs||Le(s/2,1-1e-14,s),c=l.length;return o.forEach((t=>{const e=xa(t,l);for(let n=0;n{const e=Ro(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=qo(t);r[Ro(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[Ro(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),xs.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},st(xs,ga,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[Ro(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[Ro(n)]&&r.rem.push(n),u[i]=e)),++s}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=Ro(t);a[e]&&(a[e]=-1,r.rem.push(t)),--s})),u=u.filter((t=>-1!==a[Ro(t)]))),(n.rem.length||i)&&u.length{a[Ro(t)]||c(t)})),l=-1),i&&u.length>o){const t=u.length-o;for(let e=0;e{a[Ro(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=u.filter((t=>!a[Ro(t)]))),this.count=s,this.value=r.source=u,r}}),bs.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"}]},st(bs,ga,{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=Le(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,Uo(e)})),n.add=e.add.concat(this.value),n}}),st(ws,ga,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const As=["unit0","unit1"];function Ms(t){ga.call(this,at(),t)}function Es(t){ga.call(this,null,t)}ks.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:$n,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:As}]},st(ks,ga,{transform(t,e){const n=t.field,r=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),u=(o?_r:vr)(a.unit).offset,s=t.as||As,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.modified(i(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let i,o;null==e?(t[l]=null,r&&(t[c]=null)):(t[l]=i=o=a(e),r&&(t[c]=o=u(i,f)),id&&(d=o))})),a.start=h,a.stop=d,e.modifies(r?s:l)},_floor(t,e){const n="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Pr({extent:t.extent||et(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=Hn(r),a=this.value||{},u=(n?gr:hr)(o,i);return u.unit=M(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),st(Ms,ga,{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()}}),st(Es,ga,{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(Io(t.sort)):e.source).map(t.field))}});const Ds={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=Ds.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||s("ntile num must be greater than zero.");const n=Ds.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||s("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 i=n[e],c=r(i),y=cu(t,c,a[e]);if(m(i),u.push(y),it(Ds,t))l.push(function(t,e,n,r){const i=Ds[t](e,n);return{init:i.init||d,update:function(t,e){e[r]=i.next(t)}}}(t,n[e],o[e],y));else{if(null==i&&"count"!==t&&s("Null aggregate field specified."),"count"===t)return void h.push(y);g=!1;let e=f[c];e||(e=f[c]=[],e.field=i,p.push(e)),e.push(gu(t,y))}})),(h.length||p.length)&&(this.cell=function(t,e,n){t=t.map((t=>bu(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()},Ss.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 Fs(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;eUs)if(Math.abs(c*u-s*l)>Us&&i){var 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((Rs-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>Us&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*u)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=t+a,l=e+u,c=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>Us||Math.abs(this._y1-l)>Us)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%Ls+Ls),f>qs?this._+="A"+n+","+n+",0,1,"+c+","+(t-a)+","+(e-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>Us&&(this._+="A"+n+","+n+",0,"+ +(f>=Rs)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var $s=Math.abs,Ws=Math.atan2,Hs=Math.cos,Ys=Math.max,Vs=Math.min,Gs=Math.sin,Xs=Math.sqrt,Js=1e-12,Zs=Math.PI,Qs=Zs/2,Ks=2*Zs;function tl(t){return t>1?0:t<-1?Zs:Math.acos(t)}function el(t){return t>=1?Qs:t<=-1?-Qs:Math.asin(t)}function nl(t){return t.innerRadius}function rl(t){return t.outerRadius}function il(t){return t.startAngle}function ol(t){return t.endAngle}function al(t){return t&&t.padAngle}function ul(t,e,n,r,i,o,a,u){var s=n-t,l=r-e,c=a-i,f=u-o,h=f*s-c*l;if(!(h*hS*S+B*B&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function ll(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function cl(t){this._context=t}function fl(t){return new cl(t)}function hl(t){return t[0]}function dl(t){return t[1]}function pl(t,e){var n=Is(!0),r=null,i=fl,o=null;function a(a){var u,s,l,c=(a=ll(a)).length,f=!1;for(null==r&&(o=i(l=js())),u=0;u<=c;++u)!(u=c;--f)u.point(m[f],y[f]);u.lineEnd(),u.areaEnd()}g&&(m[l]=+t(h,l,s),y[l]=+e(h,l,s),u.point(r?+r(h,l,s):m[l],n?+n(h,l,s):y[l]))}if(d)return u=null,d+""||null}function l(){return pl().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?hl:Is(+t),e="function"==typeof e?e:Is(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?dl:Is(+n),s.x=function(e){return arguments.length?(t="function"==typeof e?e:Is(+e),r=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:Is(+e),s):t},s.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Is(+t),s):r},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),n=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),s):e},s.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Is(+t),s):n},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(n)},s.lineX1=function(){return l().x(r).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:Is(!!t),s):i},s.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),s):a},s.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),s):o},s}cl.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 ml={draw:function(t,e){var n=Math.sqrt(e/Zs);t.moveTo(n,0),t.arc(0,0,n,0,Ks)}};function yl(){}function vl(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 _l(t){this._context=t}function xl(t){this._context=t}function bl(t){this._context=t}function wl(t,e){this._basis=new _l(t),this._beta=e}_l.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:vl(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:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},xl.prototype={areaStart:yl,areaEnd:yl,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:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},bl.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:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},wl.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 kl=function t(e){function n(t){return 1===e?new _l(t):new wl(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Al(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 Ml(t,e){this._context=t,this._k=(1-e)/6}Ml.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:Al(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:Al(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 El=function t(e){function n(t){return new Ml(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Dl(t,e){this._context=t,this._k=(1-e)/6}Dl.prototype={areaStart:yl,areaEnd:yl,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:Al(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 Cl=function t(e){function n(t){return new Dl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Fl(t,e){this._context=t,this._k=(1-e)/6}Fl.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:Al(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 Sl=function t(e){function n(t){return new Fl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Bl(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Js){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>Js){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 Tl(t,e){this._context=t,this._alpha=e}Tl.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:Bl(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 zl=function t(e){function n(t){return e?new Tl(t,e):new Ml(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Nl(t,e){this._context=t,this._alpha=e}Nl.prototype={areaStart:yl,areaEnd:yl,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:Bl(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 Ol=function t(e){function n(t){return e?new Nl(t,e):new Dl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Rl(t,e){this._context=t,this._alpha=e}Rl.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:Bl(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 Ll=function t(e){function n(t){return e?new Rl(t,e):new Fl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ul(t){this._context=t}function ql(t){return t<0?-1:1}function Pl(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(ql(o)+ql(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function jl(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Il(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 $l(t){this._context=t}function Wl(t){this._context=new Hl(t)}function Hl(t){this._context=t}function Yl(t){this._context=t}function Vl(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 Jl=()=>"undefined"!=typeof Image?Image:null;function Zl(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ql(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 Kl=Symbol("implicit");function tc(){var t=new Map,e=[],n=[],r=Kl;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Kl)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return tc(e,n).unknown(r)},Zl.apply(i,arguments),i}function ec(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function nc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function rc(){}var ic=.7,oc=1/ic,ac="\\s*([+-]?\\d+)\\s*",uc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",sc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lc=/^#([0-9a-f]{3,8})$/,cc=new RegExp("^rgb\\("+[ac,ac,ac]+"\\)$"),fc=new RegExp("^rgb\\("+[sc,sc,sc]+"\\)$"),hc=new RegExp("^rgba\\("+[ac,ac,ac,uc]+"\\)$"),dc=new RegExp("^rgba\\("+[sc,sc,sc,uc]+"\\)$"),pc=new RegExp("^hsl\\("+[uc,sc,sc]+"\\)$"),gc=new RegExp("^hsla\\("+[uc,sc,sc,uc]+"\\)$"),mc={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 yc(){return this.rgb().formatHex()}function vc(){return this.rgb().formatRgb()}function _c(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=lc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?xc(e):3===n?new Ac(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?bc(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?bc(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=cc.exec(t))?new Ac(e[1],e[2],e[3],1):(e=fc.exec(t))?new Ac(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=hc.exec(t))?bc(e[1],e[2],e[3],e[4]):(e=dc.exec(t))?bc(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=pc.exec(t))?Cc(e[1],e[2]/100,e[3]/100,1):(e=gc.exec(t))?Cc(e[1],e[2]/100,e[3]/100,e[4]):mc.hasOwnProperty(t)?xc(mc[t]):"transparent"===t?new Ac(NaN,NaN,NaN,0):null}function xc(t){return new Ac(t>>16&255,t>>8&255,255&t,1)}function bc(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ac(t,e,n,r)}function wc(t){return t instanceof rc||(t=_c(t)),t?new Ac((t=t.rgb()).r,t.g,t.b,t.opacity):new Ac}function kc(t,e,n,r){return 1===arguments.length?wc(t):new Ac(t,e,n,null==r?1:r)}function Ac(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Mc(){return"#"+Dc(this.r)+Dc(this.g)+Dc(this.b)}function Ec(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Dc(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Cc(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Bc(t,e,n,r)}function Fc(t){if(t instanceof Bc)return new Bc(t.h,t.s,t.l,t.opacity);if(t instanceof rc||(t=_c(t)),!t)return new Bc;if(t instanceof Bc)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 Bc(a,u,s,t.opacity)}function Sc(t,e,n,r){return 1===arguments.length?Fc(t):new Bc(t,e,n,null==r?1:r)}function Bc(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Tc(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}ec(rc,_c,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:yc,formatHex:yc,formatHsl:function(){return Fc(this).formatHsl()},formatRgb:vc,toString:vc}),ec(Ac,kc,nc(rc,{brighter:function(t){return t=null==t?oc:Math.pow(oc,t),new Ac(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ic:Math.pow(ic,t),new Ac(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mc,formatHex:Mc,formatRgb:Ec,toString:Ec})),ec(Bc,Sc,nc(rc,{brighter:function(t){return t=null==t?oc:Math.pow(oc,t),new Bc(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ic:Math.pow(ic,t),new Bc(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ac(Tc(t>=240?t-240:t+120,i,r),Tc(t,i,r),Tc(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const zc=Math.PI/180,Nc=180/Math.PI,Oc=.96422,Rc=.82521,Lc=4/29,Uc=6/29,qc=3*Uc*Uc;function Pc(t){if(t instanceof Ic)return new Ic(t.l,t.a,t.b,t.opacity);if(t instanceof Xc)return Jc(t);t instanceof Ac||(t=wc(t));var e,n,r=Yc(t.r),i=Yc(t.g),o=Yc(t.b),a=$c((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=$c((.4360747*r+.3850649*i+.1430804*o)/Oc),n=$c((.0139322*r+.0971045*i+.7141733*o)/Rc)),new Ic(116*a-16,500*(e-a),200*(a-n),t.opacity)}function jc(t,e,n,r){return 1===arguments.length?Pc(t):new Ic(t,e,n,null==r?1:r)}function Ic(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function $c(t){return t>.008856451679035631?Math.pow(t,1/3):t/qc+Lc}function Wc(t){return t>Uc?t*t*t:qc*(t-Lc)}function Hc(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Yc(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Vc(t){if(t instanceof Xc)return new Xc(t.h,t.c,t.l,t.opacity);if(t instanceof Ic||(t=Pc(t)),0===t.a&&0===t.b)return new Xc(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 df(t,e){return function(n){return t+n*e}}function pf(t,e){var n=e-t;return n?df(t,n>180||n<-180?n-360*Math.round(n/360):n):hf(isNaN(t)?e:t)}function gf(t){return 1==(t=+t)?mf: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):hf(isNaN(e)?n:e)}}function mf(t,e){var n=e-t;return n?df(t,n):hf(isNaN(t)?e:t)}var yf=function t(e){var n=gf(e);function r(t,e){var r=n((t=kc(t)).r,(e=kc(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=mf(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 vf(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:Mf(n,r)})),o=Cf.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Mf(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:Mf(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:Mf(t,n)},{i:u-2,x:Mf(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?rh:nh,i=o=null,f}function f(e){return 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),Mf)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Qf),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=Bf,c()},f.clamp=function(t){return arguments.length?(l=!!t||th,c()):l!==th},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 ah(){return oh()(th,th)}function uh(t,e,n,r){var i,o=Ce(t,e,n);switch((r=$e(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=en(o,a))||(r.precision=i),Je(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=nn(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=tn(o))||(r.precision=i-2*("%"===r.type))}return Xe(r)}function sh(t){var e=t.domain;return t.ticks=function(t){var n=e();return Ee(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return uh(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=De(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 lh(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;h<=d;++h)for(c=1,l=n(h);cs)break;g.push(f)}}else for(;h<=d;++h)for(c=o-1,l=n(h);c>=1;--c)if(!((f=l*c)s)break;g.push(f)}2*g.length0?r:1:0}const jh="linear",Ih="log",$h="pow",Wh="sqrt",Hh="symlog",Yh="time",Vh="utc",Gh="sequential",Xh="diverging",Jh="quantile",Zh="quantize",Qh="threshold",Kh="ordinal",td="point",ed="band",nd="bin-ordinal",rd="continuous",id="discrete",od="discretizing",ad="interpolating",ud="temporal";function sd(){const t=tc().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,xe(a,f)-1),l=f===h?s:xe(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 sd().domain(e()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}function ld(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return ld(e())},t}var cd=Array.prototype.map;function fd(t){return cd.call(t,E)}const hd=Array.prototype.slice;const dd={};function pd(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,n};return r.metadata=Ct(W(n)),r}function gd(t,e,n){return arguments.length>1?(dd[t]=pd(t,e,n),this):md(t)?dd[t]:void 0}function md(t){return it(dd,t)}function yd(t,e){const n=dd[t];return n&&n.metadata[e]}function vd(t){return yd(t,rd)}function _d(t){return yd(t,id)}function xd(t){return yd(t,od)}function bd(t){return yd(t,Ih)}function wd(t){return yd(t,ad)}function kd(t){return yd(t,Jh)}gd("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Qf),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,Qf):[0,1],sh(r)})),gd(jh,(function t(){var e=ah();return e.copy=function(){return ih(e,t())},Zl.apply(e,arguments),sh(e)}),rd),gd(Ih,(function t(){var e=mh(oh()).domain([1,10]);return e.copy=function(){return ih(e,t()).base(e.base())},Zl.apply(e,arguments),e}),[rd,Ih]),gd($h,Ah,rd),gd(Wh,(function(){return Ah.apply(null,arguments).exponent(.5)}),rd),gd(Hh,(function t(){var e=_h(oh());return e.copy=function(){return ih(e,t()).constant(e.constant())},Zl.apply(e,arguments)}),rd),gd(Yh,(function(){return Zl.apply(zh(wn,bn,vn,mn,gn,pn,dn,un,Yr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[rd,ud]),gd(Vh,(function(){return Zl.apply(zh(Bn,Sn,Dn,Mn,An,kn,dn,un,Gr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[rd,ud]),gd(Gh,Rh,[rd,ad]),gd("".concat(Gh,"-").concat(jh),Rh,[rd,ad]),gd("".concat(Gh,"-").concat(Ih),(function t(){var e=mh(Nh()).domain([1,10]);return e.copy=function(){return Oh(e,t()).base(e.base())},Ql.apply(e,arguments)}),[rd,ad,Ih]),gd("".concat(Gh,"-").concat($h),Lh,[rd,ad]),gd("".concat(Gh,"-").concat(Wh),(function(){return Lh.apply(null,arguments).exponent(.5)}),[rd,ad]),gd("".concat(Gh,"-").concat(Hh),(function t(){var e=_h(Nh());return e.copy=function(){return Oh(e,t()).constant(e.constant())},Ql.apply(e,arguments)}),[rd,ad]),gd("".concat(Xh,"-").concat(jh),(function t(){var e=sh(Uh()(th));return e.copy=function(){return Oh(e,t())},Ql.apply(e,arguments)}),[rd,ad]),gd("".concat(Xh,"-").concat(Ih),(function t(){var e=mh(Uh()).domain([.1,1,10]);return e.copy=function(){return Oh(e,t()).base(e.base())},Ql.apply(e,arguments)}),[rd,ad,Ih]),gd("".concat(Xh,"-").concat($h),qh,[rd,ad]),gd("".concat(Xh,"-").concat(Wh),(function(){return qh.apply(null,arguments).exponent(.5)}),[rd,ad]),gd("".concat(Xh,"-").concat(Hh),(function t(){var e=_h(Uh());return e.copy=function(){return Oh(e,t()).constant(e.constant())},Ql.apply(e,arguments)}),[rd,ad]),gd(Jh,(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)},Zl.apply(sh(u),arguments)}),od),gd(Qh,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return t<=t?r[xe(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)},Zl.apply(o,arguments)}),od),gd(nd,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(xe(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=fd(t),r):e.slice()},r.range=function(t){return arguments.length?(n=hd.call(t),r):n.slice()},r.tickFormat=function(t,n){return uh(e[0],M(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[id,od]),gd(Kh,tc,id),gd(ed,sd,id),gd(td,(function(){return ld(sd().paddingInner(1))}),id);const Ad=["clamp","base","constant","exponent"];function Md(t,e){const n=e[0],r=M(e)-n;return function(e){return t(n+e*r)}}function Ed(t,e,n){return Jf(Fd(e||"rgb",n),t)}function Dd(t,e){const n=new Array(e),r=e+1;for(let i=0;it[e]?a[e](t[e]()):0)),a):Q(.5)}function Fd(t,e){const n=Zf[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 Sd(t){const e=t.length/6|0,n=new Array(e);for(let r=0;r1?(Td[t]=e,this):Td[t]}Bd({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"},Sd),Bd({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=>Ed(Sd(t))));const Nd="symbol",Od=t=>_(t)?t.map((t=>String(t))):String(t),Rd=(t,e)=>t[1]-e[1],Ld=(t,e)=>e[1]-t[1];function Ud(t,e,n){let r;return dt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(wt(t.domain())/n||1)))),x(e)&&(r=e.step,e=e.interval),gt(e)&&(e=t.type===Yh?vr(e):t.type==Vh?_r(e):s("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function qd(t,e,n){let r=t.range(),i=r[0],o=M(r),a=Rd;if(i>o&&(r=o,o=i,i=r,a=Ld),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],M(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Pd(t,e){return t.bins?qd(t,t.bins):t.ticks?t.ticks(e):t.domain()}function jd(t,e,n,r,i,o){const a=e.type;let u=Od;if(a===Yh||i===Yh)u=t.timeFormat(r);else if(a===Vh||i===Vh)u=t.utcFormat(r);else if(bd(a)){const i=t.formatFloat(r);if(o||e.bins)u=i;else{const t=Id(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 Id(t,e,n){const r=Pd(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*i1?r[1]-r[0]:r[0];for(o=1;o$d[t.type]||t.bins)(e)?Vd(u):"discrete"===r?Xd(u):Jd(u)}const Vd=t=>(e,n,r)=>{const i=Gd(r[n+1],Gd(r.max,1/0)),o=Zd(e,t),a=Zd(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Gd=(t,e)=>null!=t?t:e,Xd=t=>(e,n)=>n?t(e):null,Jd=t=>e=>t(e),Zd=(t,e)=>Number.isFinite(t)?e(t):null;function Qd(t,e,n,r){const i=r||e.type;return gt(n)&&function(t){return yd(t,ud)}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Yh?n||i!==Vh?Yd(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Kd(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=Qd(t,e,n.format,n.formatType);if(xd(e.type)){const t=Hd(e).slice(1).map(i),n=t.length;return"".concat(n," boundar").concat(1===n?"y":"ies",": ").concat(t.join(", "))}if(_d(e.type)){const t=e.domain(),n=t.length,o=n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ");return"".concat(n," value").concat(1===n?"":"s",": ").concat(o)}{const t=e.domain();return"values from ".concat(i(t[0])," to ").concat(i(M(t)))}}let tp=0;const ep="p_";function np(t){return t&&t.gradient}function rp(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?ep:"";return i||(i=t.id="gradient_"+tp++,"radial"===r?(t.x1=ip(t.x1,.5),t.y1=ip(t.y1,.5),t.r1=ip(t.r1,0),t.x2=ip(t.x2,.5),t.y2=ip(t.y2,.5),t.r2=ip(t.r2,.5),o=ep):(t.x1=ip(t.x1,0),t.y1=ip(t.y1,0),t.x2=ip(t.x2,1),t.y2=ip(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function ip(t,e){return null!=t?t:e}function op(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 ap={basis:{curve:function(t){return new _l(t)}},"basis-closed":{curve:function(t){return new xl(t)}},"basis-open":{curve:function(t){return new bl(t)}},bundle:{curve:kl,tension:"beta",value:.85},cardinal:{curve:El,tension:"tension",value:0},"cardinal-open":{curve:Sl,tension:"tension",value:0},"cardinal-closed":{curve:Cl,tension:"tension",value:0},"catmull-rom":{curve:zl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ol,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ll,tension:"alpha",value:.5},linear:{curve:fl},"linear-closed":{curve:function(t){return new Ul(t)}},monotone:{horizontal:function(t){return new Wl(t)},vertical:function(t){return new $l(t)}},natural:{curve:function(t){return new Yl(t)}},step:{curve:function(t){return new Gl(t,.5)}},"step-after":{curve:function(t){return new Gl(t,1)}},"step-before":{curve:function(t){return new Gl(t,0)}}};function up(t,e,n){var r=it(ap,t)&&ap[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const sp={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},lp=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\.\d+)(\.\d)/g,/(\d)([-+])/g,/\s|,|###/];function cp(t){const e=[];let n,r,i,o,a,u,s,l,c,f;const h=t.slice().replace(lp[0],"###$1").split(lp[1]).slice(1);for(s=0,c=h.length;su){const t=i.length;for(l=1,e.push([a].concat(i.slice(l,l+=u))),a="M"===a?"L":"m"===a?"l":a;l1&&(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+=dp:F>0&&0===o&&(F-=dp);const S=Math.ceil(Math.abs(F/(hp+.001))),B=[];for(let t=0;t+t}function zp(t,e,n){return Math.max(e,Math.min(t,n))}function Np(){var t=Cp,e=Fp,n=Sp,r=Bp,i=Tp(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=zp(+i.call(this,l),0,y),_=zp(+o.call(this,l),0,y),x=zp(+a.call(this,l),0,y),b=zp(+u.call(this,l),0,y);if(s||(s=h=js()),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-Dp*_,p,w,p+Dp*_,w,p+_),s.lineTo(w,k-b),s.bezierCurveTo(w,k-Dp*b,w-Dp*b,k,w-b,k),s.lineTo(d+x,k),s.bezierCurveTo(d+Dp*x,k,d,k-Dp*x,d,k-x),s.lineTo(d,p+v),s.bezierCurveTo(d,p+Dp*v,d+Dp*v,p,d+v,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Tp(e),l):t},l.y=function(t){return arguments.length?(e=Tp(t),l):e},l.width=function(t){return arguments.length?(n=Tp(t),l):n},l.height=function(t){return arguments.length?(r=Tp(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Tp(t),o=null!=e?Tp(e):i,u=null!=n?Tp(n):i,a=null!=r?Tp(r):o,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Op(){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,dp);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=js()),a=0;a<=f;++a)!(at.x||0,Up=t=>t.y||0,qp=t=>!(!1===t.defined),Pp=function(){var t=nl,e=rl,n=Is(0),r=null,i=il,o=ol,a=al,u=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-Qs,d=o.apply(this,arguments)-Qs,p=$s(d-h),g=d>h;if(u||(u=s=js()),fJs)if(p>Ks-Js)u.moveTo(f*Hs(h),f*Gs(h)),u.arc(0,0,f,h,d,!g),c>Js&&(u.moveTo(c*Hs(d),c*Gs(d)),u.arc(0,0,c,d,h,g));else{var m,y,v=h,_=d,x=h,b=d,w=p,k=p,A=a.apply(this,arguments)/2,M=A>Js&&(r?+r.apply(this,arguments):Xs(c*c+f*f)),E=Vs($s(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>Js){var F=el(M/c*Gs(A)),S=el(M/f*Gs(A));(w-=2*F)>Js?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(k-=2*S)>Js?(v+=S*=g?1:-1,_-=S):(k=0,v=_=(h+d)/2)}var B=f*Hs(v),T=f*Gs(v),z=c*Hs(b),N=c*Gs(b);if(E>Js){var O,R=f*Hs(_),L=f*Gs(_),U=c*Hs(x),q=c*Gs(x);if(pJs?C>Js?(m=sl(U,q,B,T,f,C,g),y=sl(R,L,z,N,f,C,g),u.moveTo(m.cx+m.x01,m.cy+m.y01),CJs&&w>Js?D>Js?(m=sl(z,N,R,L,c,-D,g),y=sl(B,T,U,q,c,-D,g),u.lineTo(m.cx+m.x01,m.cy+m.y01),Dt.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)),jp=gl().x(Lp).y1(Up).y0((t=>(t.y||0)+(t.height||0))).defined(qp),Ip=gl().y(Up).x1(Lp).x0((t=>(t.x||0)+(t.width||0))).defined(qp),$p=pl().x(Lp).y(Up).defined(qp),Wp=Np().x(Lp).y(Up).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Rp(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),Hp=function(t,e){var n=null;function r(){var r;if(n||(n=r=js()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return t="function"==typeof t?t:Is(t||ml),e="function"==typeof e?e:Is(void 0===e?64:+e),r.type=function(e){return arguments.length?(t="function"==typeof e?e:Is(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type((t=>Mp(t.shape||"circle"))).size((t=>Rp(t.size,64))),Yp=Op().x(Lp).y(Up).defined(qp).size((t=>t.size||1));function Vp(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Gp(t,e,n,r){return Wp.context(t)(e,n,r)}var Xp=1;function Jp(){Xp=1}function Zp(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+Xp++),a=i.clipping[o]||(i.clipping[o]={id:o});return Y(r)?a.path=r(null):Vp(n)?a.path=Gp(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Qp(t){this.clear(),t&&this.union(t)}function Kp(t){this.mark=t,this.bounds=this.bounds||new Qp}function tg(t){Kp.call(this,t),this.items=this.items||[]}function eg(t){this._pending=0,this._loader=t||So()}function ng(t){t._pending+=1}function rg(t){t._pending-=1}function ig(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}Qp.prototype={clone(){return new Qp(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}},st(tg,Kp),eg.prototype={pending(){return this._pending},sanitizeURL(t){const e=this;return ng(e),e._loader.sanitize(t,{context:"href"}).then((t=>(rg(e),t))).catch((()=>(rg(e),null)))},loadImage(t){const e=this,n=Jl();return ng(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=it(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>rg(e),i.onerror=()=>rg(e),i.src=r,i})).catch((t=>(rg(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 og=dp-1e-8;let ag,ug,sg,lg,cg,fg,hg,dg;const pg=(t,e)=>ag.add(t,e),gg=(t,e)=>pg(ug=t,sg=e),mg=t=>pg(t,ag.y1),yg=t=>pg(ag.x1,t),vg=(t,e)=>cg*t+hg*e,_g=(t,e)=>fg*t+dg*e,xg=(t,e)=>pg(vg(t,e),_g(t,e)),bg=(t,e)=>gg(vg(t,e),_g(t,e));function wg(t,e){return ag=t,e?(lg=e*fp,cg=dg=Math.cos(lg),fg=Math.sin(lg),hg=-fg):(cg=dg=1,lg=fg=hg=0),kg}const kg={beginPath(){},closePath(){},moveTo:bg,lineTo:bg,rect(t,e,n,r){lg?(xg(t+n,e),xg(t+n,e+r),xg(t,e+r),bg(t,e)):(pg(t+n,e+r),gg(t,e))},quadraticCurveTo(t,e,n,r){const i=vg(t,e),o=_g(t,e),a=vg(n,r),u=_g(n,r);Ag(ug,i,a,mg),Ag(sg,o,u,yg),gg(a,u)},bezierCurveTo(t,e,n,r,i,o){const a=vg(t,e),u=_g(t,e),s=vg(n,r),l=_g(n,r),c=vg(i,o),f=_g(i,o);Mg(ug,a,s,c,mg),Mg(sg,u,l,f,yg),gg(c,f)},arc(t,e,n,r,i,o){if(r+=lg,i+=lg,ug=n*Math.cos(i)+t,sg=n*Math.sin(i)+e,Math.abs(i-r)>og)pg(t-n,e-n),pg(t+n,e+n);else{const a=r=>pg(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(a(r),a(i),i!==r)if((r%=dp)<0&&(r+=dp),(i%=dp)<0&&(i+=dp),ii;++s,u-=hp)a(u);else for(u=r-r%hp+hp,s=0;s<4&&u1e-14?(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=Lg(t,e,e.fill),!0)}var qg=[];function Pg(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=Lg(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||qg),t.lineDashOffset=e.strokeDashOffset||0),!0))}function jg(t,e){return t.zindex-e.zindex||t.index-e.index}function Ig(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 Hg(t){return function(e,n,r){$g(n,(n=>{r&&!r.intersects(n.bounds)||Vg(t,e,n,n)}))}}function Yg(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Vg(t,e,n.items[0],n.items)}}function Vg(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Ng(e,n),n.fill&&Ug(e,n,i)&&e.fill(),n.stroke&&Pg(e,n,i)&&e.stroke()))}function Gg(t){return t=t||g,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,Wg(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 Xg(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 Jg(t){return Gg(Xg(t))}function Zg(t,e){return"translate("+t+","+e+")"}function Qg(t){return"rotate("+t+")"}function Kg(t){return Zg(t.x||0,t.y||0)}function tm(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*=fp),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 Zg(t.x||0,t.y||0)+(t.angle?" "+Qg(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(wg(t,n.angle),n),ig(t,n).translate(n.x||0,n.y||0)},draw:Hg(r),pick:Jg(r),isect:n||Fg(r)}}var em=tm("arc",(function(t,e){return Pp.context(t)(e)}));function nm(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=Xg(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(wg(t),r),ig(t,r[0]))},draw:Yg(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:Sg,tip:n}}var rm=nm("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Ip:jp).curve(up(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 am(t,e){const n=om(e);t("d",Gp(null,e,n,n))}function um(t,e,n,r){const i=om(e);t.beginPath(),Gp(t,e,(n||0)+i,(r||0)+i)}const sm=Xg(um),lm=Xg(um,!1),cm=Xg(um,!0);var fm={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Kg(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&&(um(t,e,r,i),Ng(t,e),e.fill&&Ug(t,e,a)&&t.fill(),e.stroke&&!o&&Pg(t,e,a)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&im(t,e),n&&n.translate(-r,-i),$g(e,(e=>{this.draw(t,e,n)})),n&&n.translate(r,i),t.restore(),o&&e.stroke&&a&&(um(t,e,r,i),Ng(t,e),Pg(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 Wg(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&&Vp(s)&&!cm(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,y=!1!==e.interactive;return y&&m&&s.stroke&&lm(t,s,a,u)?(t.restore(),s):(l=Wg(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)&&sm(t,s,a,u)&&(l=s),t.restore(),l||null)}))},isect:Bg,content:function(t,e,n){t("clip-path",e.clip?Zp(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),am(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?am(t,e):t("d","")}},hm={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function dm(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 pm(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 gm(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 mm(t,e){return"center"===t?e/2:"right"===t?e:0}function ym(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var vm={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=dm(e,n),i=pm(e,r),o=gm(e,r),a=(e.x||0)-mm(e.align,i),u=(e.y||0)-ym(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",hm["xmlns:xlink"],"xlink:href"),t("transform",Zg(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=pm(e,n),i=gm(e,n),o=(e.x||0)-mm(e.align,r),a=(e.y||0)-ym(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){$g(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=dm(e,this);let i,o,a,u,s=pm(e,r),l=gm(e,r),c=(e.x||0)-mm(e.align,s),f=(e.y||0)-ym(e.baseline,l);!1!==e.aspect&&(o=r.width/r.height,a=e.width/e.height,o==o&&a==a&&o!==a&&(a=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&&Am(t,e,r)&&(Ng(t,e),t.stroke())}}))},pick:Gg((function(t,e,n,r){return!!t.isPointInStroke&&(Am(t,e,1)&&t.isPointInStroke(n,r))})),isect:Tg},Em=tm("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),Dm=tm("symbol",(function(t,e){return Hp.context(t)(e)}),Sg);const Cm=vt();var Fm={height:Om,measureWidth:zm,estimateWidth:Bm,width:Bm,canvas:Sm};function Sm(t){Fm.width=t&&Dg?zm:Bm}function Bm(t,e){return Tm(qm(t,e),Om(t))}function Tm(t,e){return~~(.8*t.length*e)}function zm(t,e){return Om(t)<=0||!(e=qm(t,e))?0:Nm(e,jm(t))}function Nm(t,e){const n="(".concat(e,") ").concat(t);let r=Cm.get(n);return void 0===r&&(Dg.font=e,r=Dg.measureText(t).width,Cm.set(n,r)),r}function Om(t){return null!=t.fontSize?+t.fontSize||0:11}function Rm(t){return null!=t.lineHeight?t.lineHeight:Om(t)+2}function Lm(t){return e=t.lineBreak&&t.text&&!_(t.text)?t.text.split(t.lineBreak):t.text,_(e)?e.length>1?e:e[0]:e;var e}function Um(t){const e=Lm(t);return(_(e)?e.length-1:0)*Rm(t)}function qm(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(Fm.width===zm){const e=jm(t);return t=>Nm(t,e)}{const e=Om(t);return t=>Tm(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,Fm.width(e,n))),0)):r=Fm.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*fp,u,s);else if(2===n)return t.rotatedPoints(e.angle*fp,u,s);return t}var Vm={arc:em,area:rm,group:fm,image:vm,line:_m,path:bm,rect:km,rule:Mm,shape:Em,symbol:Dm,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Im(e),o=Hm(e),a=o.x1,u=o.y1,s=e.angle||0;t("text-anchor",$m[e.align]||"start"),s?(n=Zg(a,u)+" "+Qg(s),(r||i)&&(n+=" "+Zg(r,i))):n=Zg(a+r,u+i),t("transform",n)},bound:Ym,draw:function(t,e,n){$g(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=jm(e),t.textAlign=e.align||"left",i=(r=Hm(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*fp),i=o=0),i+=e.dx||0,o+=(e.dy||0)+Im(e),s=Lm(e),Ng(t,e),_(s))for(u=Rm(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}))};function Gm(t,e,n){var r=Vm[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Qp),t,n)}var Xm={mark:null};function Jm(t,e,n){var r,i,o,a,u=Vm[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(Xm.mark=t,o=Xm),a=Gm(o,s,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new Qp,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function uy(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function sy(t,e){const n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function ly(t,e){this._active=null,this._handlers={},this._loader=t||So(),this._tooltip=e||cy}function cy(t,e,n,r){t.element().setAttribute("title",r||"")}function fy(t){this._el=null,this._bgcolor=null,this._loader=new eg(t)}ey.prototype={toJSON(t){return Qm(this.root,t||0)},mark(t,e,n){const r=ny(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r}},ly.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=ry(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=Vm[a.marktype]).tip){for((o=sy(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}}},fy.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 hy="dragenter",dy="dragleave",py="dragover",gy="mousedown",my="mousemove",yy="mouseout",vy="mouseover",_y="click",xy="mousewheel",by="touchstart",wy="touchmove",ky="touchend",Ay=my,My=yy,Ey=_y;function Dy(t,e){ly.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}function Cy(t,e){(t=>t===by||t===wy||t===ky?[by,wy,ky]:[t])(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 Fy(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 Sy(t){return function(e){this.fire(t,e),this._active=null}}st(Dy,ly,{initialize(t,e,n){return this._canvas=t&&iy(t,"canvas"),[_y,gy,my,yy,dy].forEach((t=>Cy(this,t))),ly.prototype.initialize.call(this,t,e,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",hy,dy,py,gy,"mouseup",my,yy,vy,_y,"dblclick","wheel",xy,by,wy,ky],DOMMouseScroll(t){this.fire(xy,t)},mousemove:Fy(my,vy,yy),dragover:Fy(py,hy,dy),mouseout:Sy(yy),dragleave:Sy(dy),mousedown(t){this._down=this._active,this.fire(gy,t)},click(t){this._down===this._active&&(this.fire(_y,t),this._down=null)},touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(by,t,!0)},touchmove(t){this.fire(wy,t,!0)},touchend(t){this.fire(ky,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===Ey&&r&&r.href?this.handleHref(e,r,r.href):t!==Ay&&t!==My||this.handleTooltip(e,r,t!==My),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this},pickEvent(t){const e=sy(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 Vm[t.marktype].pick.call(this,o,t,e,n,r,i)}});var By="undefined"!=typeof window&&window.devicePixelRatio||1;function Ty(t){fy.call(this,t),this._options={},this._redraw=!1,this._dirty=new Qp,this._tempb=new Qp}const zy=fy.prototype;function Ny(t,e){ly.call(this,t,e);const n=this;n._hrefHandler=Oy(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=Oy(n,((t,e)=>{n.handleTooltip(t,e,t.type!==My)}))}st(Ty,fy,{initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Xl(1,1,this._options.type),t&&this._canvas&&(ay(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),zy.initialize.call(this,t,e,n,r,i)},resize(t,e,n,r){if(zy.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?By: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||s("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 Qp).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=Vm[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),Y(n)?(t.beginPath(),n(t),t.clip()):im(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 Oy=(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)};st(Ny,ly,{initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Ey,this._hrefHandler),r.removeEventListener(Ay,this._tooltipHandler),r.removeEventListener(My,this._tooltipHandler)),this._svg=r=t&&iy(t,"svg"),r&&(r.addEventListener(Ey,this._hrefHandler),r.addEventListener(Ay,this._tooltipHandler),r.addEventListener(My,this._tooltipHandler)),ly.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:Oy(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 Ry="aria-hidden",Ly="aria-label",Uy="role",qy="aria-roledescription",Py="graphics-object",jy="graphics-symbol",Iy=(t,e,n)=>({[Uy]:t,[qy]:e,[Ly]:n||void 0}),$y=Ct(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Wy={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?Xy(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),u=o.type;return"".concat("left"===n||"right"===n?"Y":"X","-axis")+(r?" titled '".concat(r,"'"):"")+" for a ".concat(_d(u)?"discrete":u," scale")+" with ".concat(Kd(a,o,t))}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?Xy(t):null,r="".concat(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 '".concat(n,"'"):"")+" for ".concat(function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+M(t)}(o))+" with ".concat(Kd(s,u,t));var l}},"title-text":{desc:"title",caption:t=>"Title text '".concat(Gy(t),"'")},"title-subtitle":{desc:"subtitle",caption:t=>"Subtitle text '".concat(Gy(t),"'")}},Hy={ariaRole:Uy,ariaRoleDescription:qy,description:Ly};function Yy(t,e){const n=!1===e.aria;if(t(Ry,n||void 0),n||null==e.description)for(const e in Hy)t(Hy[e],void 0);else{const n=e.mark.marktype;t(Ly,e.description),t(Uy,e.ariaRole||("group"===n?Py:jy)),t(qy,e.ariaRoleDescription||"".concat(n," mark"))}}function Vy(t){return!1===t.aria?{[Ry]:!0}:$y[t.role]?null:Wy[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return Iy(e.role||jy,e.desc,n.description||r(n))}catch(t){return null}}(t,Wy[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return Iy(n?Py:jy,"".concat(e," mark container"),t.description)}(t)}function Gy(t){return W(t.text).join(" ")}function Xy(t){try{return W(M(t.items).items[0].text).join(" ")}catch(t){return null}}const Jy=t=>(t+"").replace(/&/g,"&").replace(/ /g,">");function Zy(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>(null!=n&&(e+=" ".concat(t,'="').concat(Jy(n).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g,"
").replace(/\r/g,"
"),'"')),a),a={open(u,...s){(o=>{e&&(t+="".concat(e,">").concat(n),i()),r.push(o)})(u),e="<"+u;for(const t of s)for(const e in t)o(e,t[e]);return a},close(){const o=r.pop();return t+=e?e+(n?">".concat(n,"").concat(o,">"):"/>"):"".concat(o,">"),i(),a},attr:o,text:t=>(n+=Jy(t),a),toString:()=>t};return a}const Qy=t=>Ky(Zy(),t)+"";function Ky(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}st(iv,fy,{initialize(t,e,n,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=oy(t,0,"svg",rv),this._svg.setAttributeNS(nv,"xmlns",rv),this._svg.setAttributeNS(nv,"xmlns:xlink",hm["xmlns:xlink"]),this._svg.setAttribute("version",hm.version),this._svg.setAttribute("class","marks"),ay(t,1),this._root=oy(this._svg,0,"g",rv),gv(this._root,ev),ay(this._svg,1)),this.background(this._bgcolor),ov.initialize.call(this,t,e,n,r,i)},background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),ov.background.apply(this,arguments)},resize(t,e,n,r){return ov.resize.call(this,t,e,n,r),this._svg&&(gv(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)}),this._root.setAttribute("transform","translate(".concat(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=oy(t,0,"rect",rv),gv(n,{width:this._width,height:this._height,fill:e}));const r=Qy(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),ay(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.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,av(n,e)),n._update=e)));return!this._dirtyAll},mark(t,e,n){if(!this.isDirty(e))return e._svg;const r=this._svg,i=Vm[e.marktype],o=!1===e.interactive?"none":null,a="g"===i.tag;let u=null,s=0;const l=lv(e,t,n,"g",r);l.setAttribute("class",uy(e));const c=Vy(e);for(const t in c)mv(l,t,c[t]);a||mv(l,"pointer-events",o),mv(l,"clip-path",e.clip?Zp(this,e,e.group):null);const f=t=>{const e=this.isDirty(t),n=lv(t,l,u,i.tag,r);e&&(this._update(i,n,t),a&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;$g(n,(n=>{r=t.mark(e,n,r),++i})),ay(e,1+i)}(this,n,t)),u=n,++s};return i.nested?e.items.length&&f(e.items[0]):$g(e,f),ay(l,s),l},_update(t,e,n){cv=e,fv=e.__values__,Yy(dv,n),t.attr(dv,n,this);const r=hv[t.type];r&&r.call(this,t,e,n),cv&&this.style(cv,n)},style(t,e){if(null!=e)for(const n in tv){let r="font"===n?Pm(e):e[n];if(r===fv[n])continue;const i=tv[n];null==r?t.removeAttribute(i):(np(r)&&(r=rp(r,this._defs.gradient,yv())),t.setAttribute(i,r+"")),fv[n]=r}},defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=oy(t,1,"defs",rv)),r=uv(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=oy(t,1,"defs",rv)),r=sv(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):ay(n,r))},_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}});let cv=null,fv=null;const hv={group(t,e,n){const r=cv=e.childNodes[2];fv=r.__values__,t.foreground(dv,n,this),fv=e.__values__,cv=e.childNodes[1],t.content(dv,n,this);const i=cv=e.childNodes[0];t.background(dv,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==fv.events&&(mv(r,"pointer-events",o),mv(i,"pointer-events",o),fv.events=o),n.strokeForeground&&n.stroke){const t=n.fill;mv(r,"display",null),this.style(i,n),mv(i,"stroke",null),t&&(n.fill=null),fv=r.__values__,this.style(r,n),t&&(n.fill=t),cv=null}else mv(r,"display","none")},image(t,e,n){!1===n.smooth?(pv(e,"image-rendering","optimizeSpeed"),pv(e,"image-rendering","pixelated")):pv(e,"image-rendering",null)},text(t,e,n){const r=Lm(n);let i,o,a,u;_(r)?(o=r.map((t=>qm(n,t))),i=o.join("\n"),i!==fv.text&&(ay(e,0),a=e.ownerDocument,u=Rm(n),o.forEach(((t,r)=>{const i=ry(a,"tspan",rv);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),e.appendChild(i)})),fv.text=i)):(o=qm(n,r),o!==fv.text&&(e.textContent=o,fv.text=o)),mv(e,"font-family",Pm(n)),mv(e,"font-size",Om(n)+"px"),mv(e,"font-style",n.fontStyle),mv(e,"font-variant",n.fontVariant),mv(e,"font-weight",n.fontWeight)}};function dv(t,e,n){e!==fv[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(cv,t,e,n):mv(cv,t,e),fv[t]=e)}function pv(t,e,n){n!==fv[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),fv[e]=n)}function gv(t,e){for(const n in e)mv(t,n,e[n])}function mv(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function yv(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function vv(t){fy.call(this,t),this._text=null,this._defs={gradient:{},clipping:{}}}st(vv,fy,{svg(){return this._text},_render(t){const e=Zy();e.open("svg",tt({},hm,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(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",ev,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this},mark(t,e){const n=Vm[e.marktype],r=n.tag,i=[Yy,n.attr];t.open("g",{class:uy(e),"clip-path":e.clip?Zp(this,e,e.group):null},Vy(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=Lm(o);if(_(e)){const n={x:0,dy:Rm(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]):$g(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){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&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===r&&(t["font-family"]=Pm(e),t["font-size"]=Om(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in tv){let r=e[n];const o=tv[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(np(r)&&(r=rp(r,i.gradient,"")),t[o]=r)}}(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:ep+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?(wv[t]=e,this):wv[t]}function Av(t,e,n){const r=[],i=(new Qp).union(e),o=t.marktype;return o?Mv(t,i,n,r):"group"===o?Ev(t,i,n,r):s("Intersect scene must be mark node or group item.")}function Mv(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(!Sv(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Bv(t,e){return Sv(cp(t),cp(e))}const Tv="top",zv="left",Nv="right",Ov="bottom",Rv="start",Lv="middle",Uv="end",qv="group",Pv="axis",jv="title",Iv="frame",$v="scope",Wv="legend",Hv="row-header",Yv="row-footer",Vv="row-title",Gv="column-header",Xv="column-footer",Jv="column-title",Zv="padding",Qv="fit",Kv="fit-x",t_="fit-y",e_="none",n_="all",r_="each",i_="flush",o_="column",a_="row";function u_(t){ga.call(this,null,t)}function s_(t,e,n){return e(t.bounds.clear(),t,n)}st(u_,ga,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=Vm[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),s=s_(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===qv||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),s.clear(),r.items.forEach((t=>s.union(s_(t,a)))),r.role){case Pv:case Wv:case jv:e.reflow()}else u=e.changed(e.REM),e.visit(e.ADD,(t=>{s.union(s_(t,a))})),e.visit(e.MOD,(t=>{u=u||s.alignsWith(t.bounds),n.dirty(t),s.union(s_(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Fv(r),e.modifies("bounds")}});const l_=":vega_identifier:";function c_(t){ga.call(this,0,t)}function f_(t){ga.call(this,null,t)}function h_(t){ga.call(this,null,t)}c_.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},st(c_,ga,{transform(t,e){const n=(i=e.dataflow)._signals[l_]||(i._signals[l_]=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}}),st(f_,ga,{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===qv?tg:Kp;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 d_={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&p_(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},p_=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),g_=(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},y_=t=>(t.forEach((t=>t.opacity=1)),t),v_=(t,e)=>t.reflow(e.modified()).modifies("opacity");function __(t){ga.call(this,null,t)}st(h_,ga,{transform(t,e){const n=d_[t.method]||d_.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")&&(y_(a),e=v_(e,t)),e;if(a=a.filter(m_),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=y_(a),e=v_(e,t),i.length>=3&&g_(i,r)){do{i=n(i,r)}while(i.length>=3&&g_(i,r));i.length<3&&!M(a).opacity&&(i.length>1&&(M(i).opacity=0),M(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new Qp;return e===Tv||e===Ov?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}}),st(__,ga,{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 x_=new Qp;function b_(t,e,n){return t[e]===n?0:(t[e]=n,1)}function w_(t){var e=t.items[0].orient;return e===zv||e===Nv}function k_(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&&Um(m),x=0,b=0;switch(x_.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 Tv:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&A_(t,m,o,y,_,0,-1,v);break;case zv:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&A_(t,m,o,y,_,1,-1,v);break;case Nv:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&A_(t,m,o,y,_,1,1,v);break;case Ov:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&A_(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return ig(v.translate(x,b),a),b_(a,"x",x+s)|b_(a,"y",b+s)&&(a.bounds=x_,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function A_(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 M_=(t,e)=>Math.floor(Math.min(t,e)),E_=(t,e)=>Math.ceil(Math.max(t,e));function D_(t){return(new Qp).set(0,0,t.width||0,t.height||0)}function C_(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function F_(t,e,n){const r=x(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function S_(t){return t<0?Math.ceil(-t):0}function B_(t,e,n){var r,i,o,a,u,s,l,c,f,h,d,p=!n.nodirty,g=n.bounds===i_?D_:C_,m=x_.set(0,0,0,0),y=F_(n.align,o_),v=F_(n.align,a_),_=F_(n.padding,o_),x=F_(n.padding,a_),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),B=Array(k),T=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(v&&F_(n.center,a_)&&1!==b)for(i=0;i0&&(B[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 R_(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 L_(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",Rv),c=l===Uv?1:l===Lv?.5:0,f={align:r_,bounds:u("bounds",i_),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case zv:f.anchor={x:Math.floor(r.x1)-s,column:Uv,y:c*(a||r.height()+2*r.y1),row:l};break;case Nv:f.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case Tv:f.anchor={y:Math.floor(i.y1)-s,row:Uv,x:c*(o||i.width()+2*i.x1),column:l};break;case Ov:f.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:o-s,y:s,column:Uv};break;case"bottom-left":f.anchor={x:s,y:a-s,row:Uv};break;case"bottom-right":f.anchor={x:o-s,y:a-s,column:Uv,row:Uv}}return f}function U_(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 zv:i+=Math.ceil(a.bounds.width())+s;break;case Nv:case Ov:break;default:o+=a.bounds.height()+s}switch((i||o)&&P_(t,n,i,o),a.orient){case zv:c+=q_(e,n,a,u,1,1);break;case Nv:l+=q_(e,n,a,Uv,0,0)+s,c+=q_(e,n,a,u,1,1);break;case Ov:l+=q_(e,n,a,u,0,0),c+=q_(e,n,a,Uv,-1,0,1)+s;break;default:l+=q_(e,n,a,u,0,0)}(l||c)&&P_(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(P_(t,n,-l,0),P_(t,a,-l,0))}else(i||o)&&P_(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)),"symbol"===o.type&&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!==e_&&(i.x=s=0,i.y=l=0),i.width=n,i.height=r,ig(u.set(s,l,s+n,l+r),i),i.mark.bounds.clear().union(u),i}function q_(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:Um(n);return Math.round(r===Rv?c:r===Uv?f-h:.5*(l-h))}function P_(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 j_(t){ga.call(this,null,t)}st(j_,ga,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&T_(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 Qp).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,u=s.length;a{(o=t.orient||Nv)!==e_&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];B_(t,i,L_(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===Qv)switch(e.orient){case zv:case Nv:f.add(r.x1,0).add(r.x2,0);break;case Tv:case Ov:f.add(0,r.y1).add(0,r.y2)}else f.union(r)}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var 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===zv||s===Nv?r:n,g=0,m=0,y=0,v=0,_=0;if(u!==qv?s===zv?(g=i.y2,p=i.y1):s===Nv?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===zv&&(g=r,p=0),o=l===Rv?g:l===Uv?p:(g+p)/2,d&&d.text){switch(s){case Tv:case Ov:_=h.bounds.height()+f;break;case zv:v=h.bounds.width()+f;break;case Nv:v=-h.bounds.width()-f}x_.clear().union(d.bounds),x_.translate(v-(d.x||0),_-(d.y||0)),b_(d,"x",v)|b_(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(x_),d.mark.bounds.clear().union(x_),t.dirty(d)),x_.clear().union(d.bounds)}else x_.clear();switch(x_.union(h.bounds),s){case Tv:m=o,y=i.y1-x_.height()-c;break;case zv:m=i.x1-x_.width()-c,y=o;break;case Nv:m=i.x2+x_.width()+c,y=o;break;case Ov:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return b_(a,"x",m)|b_(a,"y",y)&&(x_.translate(m,y),t.dirty(a),a.bounds.clear().union(x_),e.bounds.clear().union(x_),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===Zv){const e=t.padding();a-=e.left+e.right,u-=e.top+e.bottom}o===e_?(l=0,f=0,s=a,c=u):o===Qv?(s=Math.max(0,a-l-h),c=Math.max(0,u-f-d)):o===Kv?(s=Math.max(0,a-l-h),u=c+f+d):o===t_?(a=s+l+h,c=Math.max(0,u-f-d)):"pad"===o&&(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 I_=Object.freeze({__proto__:null,bound:u_,identifier:c_,mark:f_,overlap:h_,render:__,viewlayout:j_});function $_(t){ga.call(this,null,t)}function W_(t){ga.call(this,null,t)}function H_(){return Uo({})}function Y_(t){ga.call(this,null,t)}function V_(t){ga.call(this,[],t)}st($_,ga,{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=Ud(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||jd(n,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?qd(o,t.values,a):Pd(o,a);return i&&(r.rem=i),i=s.map(((t,e)=>Uo({index:e/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(Uo({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),st(W_,ga,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||H_,o=t.key||Ro,a=this.value;return _(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&s("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=at().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}}),st(Y_,ga,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(_(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||m,s=i.enter||m,l=i.exit||m,c=(o&&!a?i[o]:u)||m;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!==m&&c!==u&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==m&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==m){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}}),st(V_,ga,{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||Nd,f=t.scale,h=+t.limit,d=Ud(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===Nd,g=t.format||Yd(u,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Hd(f,d);return l&&(s.rem=l),c===Nd?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,Y(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=Q(o=i||8),l=l.map(((e,n)=>Uo({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(Uo({index:l.length,label:"…".concat(m.length-l.length," entries"),value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=Cd(f,n[0],M(n)),m.length<3&&!t.values&&n[0]!==M(n)&&(m=[n[0],M(n)]),l=m.map(((t,e)=>Uo({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=+M(e),o=i-r;if(t.type===Qh){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>Uo({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 G_=t=>t.source.x,X_=t=>t.source.y,J_=t=>t.target.x,Z_=t=>t.target.y;function Q_(t){ga.call(this,{},t)}Q_.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"}]},st(Q_,ga,{transform(t,e){var n=t.sourceX||G_,r=t.sourceY||X_,i=t.targetX||J_,o=t.targetY||Z_,a=t.as||"path",u=t.orient||"vertical",l=t.shape||"line",c=nx.get(l+"-"+u)||nx.get(l);return c||s("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 K_=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,tx=(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},ex=(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},nx=at({line:K_,"line-radial":(t,e,n,r)=>K_(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:tx,"arc-radial":(t,e,n,r)=>tx(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:ex,"curve-radial":(t,e,n,r)=>ex(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 rx(t){ga.call(this,null,t)}rx.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"]}]},st(rx,ga,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.field||p,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,g=l,m=(c-l)/Ue(h),y=Le(d);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: "+kt(e)));return e}function sx(t,e,n){return Y(t)&&(e||n)?Md(t,lx(e||[0,1],n)):t}function lx(t,e){return e?t.slice().reverse():t}function cx(t){ga.call(this,null,t)}st(ax,ga,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===Gh)return"sequential-linear";(function(t){const e=t.type;return vd(e)&&e!==Yh&&e!==Vh&&(t.scheme||t.range&&t.range.length&&t.range.every(gt))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?"sequential-":3===e?"diverging-":"");return(r+n||jh).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=gd(i)()),t)if(!ox[i]){if("padding"===i&&ix(r.type))continue;Y(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!==ed&&t!==td&&s("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===td?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Ph(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;_(e.scheme)?r=Ed(e.scheme,e.interpolate,e.interpolateGamma):(r=zd(e.scheme.toLowerCase()))||s("Unrecognized scheme name: ".concat(e.scheme));return n=t===Qh?n+1:t===nd?n-1:t===Jh||t===Zh?+e.schemeCount||5:n,wd(t)?sx(r,i,e.reverse):Y(r)?Dd(sx(r,i),n):t===Kh?r:r.slice(0,n)}(r,e,n),Y(o))){if(t.interpolator)return t.interpolator(o);s("Scale type ".concat(r," does not support interpolating color schemes."))}if(o&&wd(r))return t.interpolator(Ed(lx(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(Fd(e.interpolate,e.interpolateGamma)):Y(t.round)?t.round(i):Y(t.rangeRound)&&t.interpolate(i?Bf:Sf);o&&t.range(lx(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!_(r)){const e=t.domain(),n=e[0],i=M(e),o=r.step;let a=null==r.start?n:r.start,u=null==r.stop?i:r.stop;o||s("Scale bins parameter missing step property."),ai&&(u=o*Math.floor(i/o)),r=Le(a,u+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===nd&&(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(ux(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===jh||e===$h||e===Wh)}(t);if(!a)return 0;ix(u)&&e.padding&&a[0]!==M(a)&&(a=function(t,e,n,r,i,o){var a=Math.abs(M(n)-n[0]),u=a/(a-2*r),s=t===Ih?q(e,null,u):t===Wh?P(e,null,u,.5):t===$h?P(e,null,u,i||1):t===Hh?j(e,null,u,o||1):U(e,null,u);return(e=e.slice())[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},qx=Math.sqrt,Px=Math.tan;function jx(t){return t>1?0:t<-1?wx:Math.acos(t)}function Ix(t){return t>1?kx:t<-1?-kx:Math.asin(t)}function $x(){}function Wx(t,e){t&&Yx.hasOwnProperty(t.type)&&Yx[t.type](t,e)}var Hx={Feature:function(t,e){Wx(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=Bx(e=(e*=Dx)/2+Ax),a=Lx(e),u=tb*a,s=Kx*o+u*Bx(i),l=u*r*Lx(i);hb.add(Sx(l,s)),Qx=t,Kx=o,tb=a}function _b(t){return[Sx(t[1],t[0]),Ix(t[2])]}function xb(t){var e=t[0],n=t[1],r=Bx(n);return[r*Bx(e),r*Lx(e),Lx(n)]}function bb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function wb(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 kb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ab(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Mb(t){var e=qx(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Eb,Db,Cb,Fb,Sb,Bb,Tb,zb,Nb,Ob,Rb,Lb,Ub,qb,Pb,jb,Ib={point:$b,lineStart:Hb,lineEnd:Yb,polygonStart:function(){Ib.point=Vb,Ib.lineStart=Gb,Ib.lineEnd=Xb,lb=new we,pb.polygonStart()},polygonEnd:function(){pb.polygonEnd(),Ib.point=$b,Ib.lineStart=Hb,Ib.lineEnd=Yb,hb<0?(eb=-(rb=180),nb=-(ib=90)):lb>xx?ib=90:lb<-1e-6&&(nb=-90),fb[0]=eb,fb[1]=rb},sphere:function(){eb=-(rb=180),nb=-(ib=90)}};function $b(t,e){cb.push(fb=[eb=t,rb=t]),eib&&(ib=e)}function Wb(t,e){var n=xb([t*Dx,e*Dx]);if(sb){var r=wb(sb,n),i=wb([r[1],-r[0],0],r);Mb(i),i=_b(i);var o,a=t-ob,u=a>0?1:-1,s=i[0]*Ex*u,l=Cx(a)>180;l^(u*obib&&(ib=o):l^(u*ob<(s=(s+360)%360-180)&&sib&&(ib=e)),l?tJb(eb,rb)&&(rb=t):Jb(t,rb)>Jb(eb,rb)&&(eb=t):rb>=eb?(trb&&(rb=t)):t>ob?Jb(eb,t)>Jb(eb,rb)&&(rb=t):Jb(t,rb)>Jb(eb,rb)&&(eb=t)}else cb.push(fb=[eb=t,rb=t]);eib&&(ib=e),sb=n,ob=t}function Hb(){Ib.point=Wb}function Yb(){fb[0]=eb,fb[1]=rb,Ib.point=$b,sb=null}function Vb(t,e){if(sb){var n=t-ob;lb.add(Cx(n)>180?n+(n>0?360:-360):n)}else ab=t,ub=e;pb.point(t,e),Wb(t,e)}function Gb(){pb.lineStart()}function Xb(){Vb(ab,ub),pb.lineEnd(),Cx(lb)>xx&&(eb=-(rb=180)),fb[0]=eb,fb[1]=rb,sb=null}function Jb(t,e){return(e-=t)<0?e+360:e}function Zb(t,e){return t[0]-e[0]}function Qb(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ewx?t+Math.round(-t/Mx)*Mx:t,e]}function hw(t,e,n){return(t%=Mx)?e||n?cw(pw(t),gw(e,n)):pw(t):e||n?gw(e,n):fw}function dw(t){return function(e,n){return[(e+=t)>wx?e-Mx:e<-wx?e+Mx:e,n]}}function pw(t){var e=dw(t);return e.invert=dw(-t),e}function gw(t,e){var n=Bx(t),r=Lx(t),i=Bx(e),o=Lx(e);function a(t,e){var a=Bx(e),u=Bx(t)*a,s=Lx(t)*a,l=Lx(e),c=l*n+u*r;return[Sx(s*i-c*o,u*n-l*r),Ix(c*i+s*o)]}return a.invert=function(t,e){var a=Bx(e),u=Bx(t)*a,s=Lx(t)*a,l=Lx(e),c=l*i-s*o;return[Sx(s*i+l*o,u*n+c*r),Ix(c*n-u*r)]},a}function mw(t,e){(e=xb(e))[0]-=t,Mb(e);var n=jx(-e[1]);return((-e[2]<0?-n:n)+Mx-xx)%Mx}function yw(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:$x,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vw(t,e){return Cx(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 bw(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,E=M*A,D=E>wx,C=m*w;if(s.add(Sx(C*M*Lx(E),y*k+C*Bx(E))),a+=D?A+M*Mx:A,D^p>=n^x>=n){var F=wb(xb(d),xb(_));Mb(F);var S=wb(o,F);Mb(S);var B=(D^A>=0?-1:1)*Ix(S[2]);(r>B||r===B&&(F[0]||F[1]))&&(u+=D^A>=0?1:-1)}}return(a<-1e-6||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(Aw))}return h}}function Aw(t){return t.length>1}function Mw(t,e){return((t=t.x)[0]<0?t[1]-kx-xx:kx-t[1])-((e=e.x)[0]<0?e[1]-kx-xx:kx-e[1])}fw.invert=fw;var Ew=kw((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?wx:-wx,s=Cx(o-n);Cx(s-wx)0?kx:-kx),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),e=0):i!==u&&s>=wx&&(Cx(n-i)xx?Fx((Lx(e)*(o=Bx(r))*Lx(n)-Lx(r)*(i=Bx(e))*Lx(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*kx,r.point(-wx,i),r.point(0,i),r.point(wx,i),r.point(wx,0),r.point(wx,-i),r.point(0,-i),r.point(-wx,-i),r.point(-wx,0),r.point(-wx,i);else if(Cx(t[0]-e[0])>xx){var o=t[0]0,i=Cx(e)>xx;function o(t,n){return Bx(t)*Bx(n)>e}function a(t,n,r){var i=[1,0,0],o=wb(xb(t),xb(n)),a=bb(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var l=e*a/s,c=-e*u/s,f=wb(i,o),h=Ab(i,l);kb(h,Ab(o,c));var d=f,p=bb(h,d),g=bb(d,d),m=p*p-g*(bb(h,h)-1);if(!(m<0)){var y=qx(m),v=Ab(d,(-p-y)/g);if(kb(v,h),v=_b(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],k=n[1];b0^v[1]<(Cx(v[0]-x)wx^(x<=v[0]&&v[0]<=b)){var E=Ab(d,(-p+y)/g);return kb(E,h),[v,_b(E)]}}}function u(e,n){var i=r?t:wx-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return kw(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?wx:-wx),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=a(e,p))||vw(e,d)||vw(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&&vw(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=Bx(e),u=Lx(e),s=r*n;null==i?(i=e+r*Mx,o=e-s/2):(i=mw(a,i),o=mw(a,o),(r>0?io)&&(i+=r*Mx));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 Cx(r[0]-t)0?0:3:Cx(r[0]-n)0?2:1:Cx(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=yw(),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=Re(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&xw(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(Fw,Math.min(Cw,p)),g=Math.max(Fw,Math.min(Cw,g))],x=[o=Math.max(Fw,Math.min(Cw,o)),a=Math.max(Fw,Math.min(Cw,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 Bw(t,e,n){var r=Le(t,e-xx,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Tw(t,e,n){var r=Le(t,e-xx,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var zw,Nw,Ow,Rw,Lw=t=>t,Uw=new we,qw=new we,Pw={point:$x,lineStart:$x,lineEnd:$x,polygonStart:function(){Pw.lineStart=jw,Pw.lineEnd=Ww},polygonEnd:function(){Pw.lineStart=Pw.lineEnd=Pw.point=$x,Uw.add(Cx(qw)),qw=new we},result:function(){var t=Uw/2;return Uw=new we,t}};function jw(){Pw.point=Iw}function Iw(t,e){Pw.point=$w,zw=Ow=t,Nw=Rw=e}function $w(t,e){qw.add(Rw*t-Ow*e),Ow=t,Rw=e}function Ww(){$w(zw,Nw)}var Hw=1/0,Yw=Hw,Vw=-Hw,Gw=Vw,Xw={point:function(t,e){tVw&&(Vw=t);eGw&&(Gw=e)},lineStart:$x,lineEnd:$x,polygonStart:$x,polygonEnd:$x,result:function(){var t=[[Hw,Yw],[Vw,Gw]];return Vw=Gw=-(Yw=Hw=1/0),t}};var Jw,Zw,Qw,Kw,tk=0,ek=0,nk=0,rk=0,ik=0,ok=0,ak=0,uk=0,sk=0,lk={point:ck,lineStart:fk,lineEnd:pk,polygonStart:function(){lk.lineStart=gk,lk.lineEnd=mk},polygonEnd:function(){lk.point=ck,lk.lineStart=fk,lk.lineEnd=pk},result:function(){var t=sk?[ak/sk,uk/sk]:ok?[rk/ok,ik/ok]:nk?[tk/nk,ek/nk]:[NaN,NaN];return tk=ek=nk=rk=ik=ok=ak=uk=sk=0,t}};function ck(t,e){tk+=t,ek+=e,++nk}function fk(){lk.point=hk}function hk(t,e){lk.point=dk,ck(Qw=t,Kw=e)}function dk(t,e){var n=t-Qw,r=e-Kw,i=qx(n*n+r*r);rk+=i*(Qw+t)/2,ik+=i*(Kw+e)/2,ok+=i,ck(Qw=t,Kw=e)}function pk(){lk.point=ck}function gk(){lk.point=yk}function mk(){vk(Jw,Zw)}function yk(t,e){lk.point=vk,ck(Jw=Qw=t,Zw=Kw=e)}function vk(t,e){var n=t-Qw,r=e-Kw,i=qx(n*n+r*r);rk+=i*(Qw+t)/2,ik+=i*(Kw+e)/2,ok+=i,ak+=(i=Kw*t-Qw*e)*(Qw+t),uk+=i*(Kw+e),sk+=3*i,ck(Qw=t,Kw=e)}function _k(t){this._context=t}_k.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,Mx)}},result:$x};var xk,bk,wk,kk,Ak,Mk=new we,Ek={point:$x,lineStart:function(){Ek.point=Dk},lineEnd:function(){xk&&Ck(bk,wk),Ek.point=$x},polygonStart:function(){xk=!0},polygonEnd:function(){xk=null},result:function(){var t=+Mk;return Mk=new we,t}};function Dk(t,e){Ek.point=Ck,bk=kk=t,wk=Ak=e}function Ck(t,e){kk-=t,Ak-=e,Mk.add(qx(kk*kk+Ak*Ak)),kk=t,Ak=e}function Fk(){this._string=[]}function Sk(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Bk(t,e){var n,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Xx(t,n(r))),r.result()}return o.area=function(t){return Xx(t,n(Pw)),Pw.result()},o.measure=function(t){return Xx(t,n(Ek)),Ek.result()},o.bounds=function(t){return Xx(t,n(Xw)),Xw.result()},o.centroid=function(t){return Xx(t,n(lk)),lk.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Lw):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new Fk):new _k(e=t),"function"!=typeof i&&r.pointRadius(i),o):e},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(e)}function Tk(t){return function(e){var n=new zk;for(var r in t)n[r]=t[r];return n.stream=e,n}}function zk(){}function Nk(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Xx(n,t.stream(Xw)),e(Xw.result()),null!=r&&t.clipExtent(r),t}function Ok(t,e,n){return Nk(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 Rk(t,e,n){return Ok(t,[[0,0],e],n)}function Lk(t,e,n){return Nk(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 Uk(t,e,n){return Nk(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)}Fk.prototype={_radius:4.5,_circle:Sk(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sk(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},zk.prototype={constructor:zk,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 qk=Bx(30*Dx);function Pk(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=qx(x*x+b*b+w*w),A=Ix(w/=k),M=Cx(Cx(w)-1)e||Cx((y*F+v*S)/_-.5)>.3||a*h+u*d+s*p2?t[2]%360*Dx:0,F()):[m*Ex,y*Ex,v*Ex]},D.angle=function(t){return arguments.length?(_=t%360*Dx,F()):_*Ex},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=Pk(u,E=t*t),S()):qx(E)},D.fitExtent=function(t,e){return Ok(D,t,e)},D.fitSize=function(t,e){return Rk(D,t,e)},D.fitWidth=function(t,e){return Lk(D,t,e)},D.fitHeight=function(t,e){return Uk(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function Hk(t){var e=0,n=wx/3,r=Wk(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Dx,n=t[1]*Dx):[e*Ex,n*Ex]},i}function Yk(t,e){var n=Lx(t),r=(n+Lx(e))/2;if(Cx(r)2?t[2]*Dx:0),e.invert=function(e){return(e=t.invert(e[0]*Dx,e[1]*Dx))[0]*=Ex,e[1]*=Ex,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Kk?[[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 eA(t){return Px((kx+t)/2)}function nA(t,e){var n=Bx(t),r=t===e?Lx(t):Ox(n/Bx(e))/Ox(eA(e)/eA(t)),i=n*Rx(eA(t),r)/r;if(!r)return Kk;function o(t,e){i>0?e<-kx+xx&&(e=-kx+xx):e>kx-xx&&(e=kx-xx);var n=i/Rx(eA(e),r);return[n*Lx(r*t),i-n*Bx(r*t)]}return o.invert=function(t,e){var n=i-e,o=Ux(r)*qx(t*t+n*n),a=Sx(t,Cx(n))*Ux(n);return n*r<0&&(a-=wx*Ux(t)*Ux(n)),[a/r,2*Fx(Rx(i/o,1/r))-kx]},o}function rA(t,e){return[t,e]}function iA(t,e){var n=Bx(t),r=t===e?Lx(t):(n-Bx(e))/(e-t),i=n/r+t;if(Cx(r)xx&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},dA.invert=Jk(Ix),pA.invert=Jk((function(t){return 2*Fx(t)})),gA.invert=function(t,e){return[-e,2*Fx(zx(t))-kx]};var mA=Math.abs,yA=Math.cos,vA=Math.sin,_A=Math.PI,xA=_A/2,bA=function(t){return t>0?Math.sqrt(t):0}(2);function wA(t){return t>1?xA:t<-1?-xA:Math.asin(t)}function kA(t,e){var n,r=t*vA(e),i=30;do{e-=n=(e+vA(e)-r)/(1+yA(e))}while(mA(n)>1e-6&&--i>0);return e/2}var AA=function(t,e,n){function r(r,i){return[t*r*yA(i=kA(n,i)),e*vA(i)]}return r.invert=function(r,i){return i=wA(i/e),[r/(t*yA(i)),wA((2*i+vA(2*i))/n)]},r}(bA/xA,bA,_A);const MA=Bk(),EA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function DA(t,e){return function n(){const r=e();return r.type=t,r.path=Bk().projection(r),r.copy=r.copy||function(){const t=n();return EA.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function CA(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(SA[t]=DA(t,e),this):SA[t]||null}function FA(t){return t&&t.path||MA}const SA={albers:Gk,albersusa:function(){var t,e,n,r,i,o,a=Gk(),u=Vk().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Vk().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 SA)CA(t,SA[t]);function BA(){}const TA=[[],[[[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 zA(){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,TA[l<<1].forEach(p);for(;++a=r,TA[s|l<<1].forEach(p);TA[l<<0].forEach(p);for(;++u=r,c=n[u*t]>=r,TA[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[u*t+a+1]>=r,TA[s|l<<1|c<<2|f<<3].forEach(p);TA[l|c<<3].forEach(p)}a=-1,c=n[u*t]>=r,TA[c<<2].forEach(p);for(;++a=r,TA[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]}}TA[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||s("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:BA,r):n===a},r}function NA(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 RA(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 LA(t,e,n){return function(r){var i=et(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=e?Ce(o,a,t):u/(t+1);return Le(o+s,a,s)}}function UA(t){ga.call(this,null,t)}function qA(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 PA(t,e,n){const r=t>=0?t:wa(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function jA(t){return Y(t)?t:Q(+t)}function IA(){var t=t=>t[0],e=t=>t[1],n=p,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const l=PA(r[0],u,t)>>a,c=PA(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?($A(d,p,g,m,l),WA(d,p,m,g,c),$A(d,p,g,m,l),WA(d,p,m,g,c),$A(d,p,g,m,l),WA(d,p,m,g,c)):l>0?($A(d,p,g,m,l),$A(d,p,m,g,l),$A(d,p,g,m,l),y=m):c>0&&(WA(d,p,g,m,c),WA(d,p,m,g,c),WA(d,p,g,m,c),y=m);const v=s?Math.pow(2,-2*a):1/Ue(y);for(let t=0,e=d*p;t>a),y2:h+(o>>a)}}return u.x=function(e){return arguments.length?(t=jA(e),u):t},u.y=function(t){return arguments.length?(e=jA(t),u):e},u.weight=function(t){return arguments.length?(n=jA(t),u):n},u.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||s("invalid size"),i=e,o=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||s("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):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 WA(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 HA(t){ga.call(this,null,t)}UA.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"}]},st(UA,ga,{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||h,o=zA().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=LA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>Fe(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,_(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;Y(i)&&(i=i(n,r));Y(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(dt(i)?i:i[0])||1,u=(dt(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;t.forEach(qA(e,a,u,s,l))}(r,n,e,t),r.forEach((t=>{s.push(Po(e,Uo(null!=u?{[u]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n}}),HA.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 YA=["x","y","weight","size","cellSize","bandwidth"];function VA(t,e){return YA.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function GA(t){ga.call(this,null,t)}st(HA,ga,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,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;rUo(function(t,e){for(let n=0;nxx})).map(s)).concat(Le(Tx(o/d)*d,i,d).filter((function(t){return Cx(t%g)>xx})).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=Bw(o,i,90),l=Tw(e,t,m),c=Bw(u,a,90),f=Tw(r,n,m),y):m},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function nM(t){ga.call(this,null,t)}function rM(t){if(!Y(t))return!1;const e=Ct(i(t));return e.$x||e.$y||e.$value||e.$max}function iM(t){ga.call(this,null,t),this.modified(!0)}function oM(t,e,n){Y(t[e])&&t[e](n)}ZA.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},st(ZA,ga,{transform(t,e){var n,r=this._features,o=this._points,a=t.fields,u=a&&a[0],s=a&&a[1],l=t.geojson||!a&&h,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(i(l))||u&&e.modified(i(u))||s&&e.modified(i(s)),this.value&&!n||(c=e.SOURCE,this._features=r=[],this._points=o=[]),l&&e.visit(c,(t=>r.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])})),r=r.concat({type:XA,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:JA,features:r}}}),QA.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"}]},st(QA,ga,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||h,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=FA(t.projection),n.materialize().reflow()):a=i===h||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)}}),KA.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"]}]},st(KA,ga,{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)}}),tM.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"}]},st(tM,ga,{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}(FA(t.projection),t.field||c("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),eM.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}]},st(eM,ga,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)Y(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push(jo(r[0],n)):e.add.push(Uo(n)),r[0]=n,e}}),nM.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"}]},st(nM,ga,{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||h,o=function(t,e){let n;Y(t)?(n=n=>t(n,e),n.dep=rM(t)):t?n=Q(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;Y(t)?(n=n=>kc(t(n,e)),n.dep=rM(t)):n=Q(kc(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?Fe(n.map((t=>Fe(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=tt({},t,s);r||(n.$max=Fe(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]:d,h=Xl(s-a,l-u),p=h.getContext("2d"),g=p.getImageData(0,0,s-a,l-u),m=g.data;for(let t=u,o=0;t{null!=t[e]&&oM(n,e,t[e])}))):EA.forEach((e=>{t.modified(e)&&oM(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return 1===(t=W(t)).length?t[0]:{type:JA,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===JA?t.features:W(t).filter((t=>null!=t)).map((t=>t.type===XA?t:{type:XA,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 aM=Object.freeze({__proto__:null,contour:GA,geojson:ZA,geopath:QA,geopoint:KA,geoshape:tM,graticule:eM,heatmap:nM,isocontour:UA,kde2d:HA,projection:iM});function uM(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 sM(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function lM(t){return t[0]}function cM(t){return t[1]}function fM(t,e,n){var r=new hM(null==e?lM:e,null==n?cM:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function hM(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 dM(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var pM=fM.prototype=hM.prototype;function gM(t){return function(){return t}}function mM(t){return 1e-6*(t()-.5)}function yM(t){return t.x+t.vx}function vM(t){return t.y+t.vy}function _M(t){return t.index}function xM(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}pM.copy=function(){var t,e,n=new hM(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=dM(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]=dM(e));return n},pM.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return uM(this.cover(e,n),e,n,t)},pM.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)},pM.removeAll=function(t){for(var e=0,n=t.length;e{}};function wM(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function MM(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(null,t),e=e._next;--FM}()}finally{FM=0,function(){var t,e,n=DM,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:DM=e);CM=t,$M(r)}(),zM=0}}function IM(){var t=OM.now(),e=t-TM;e>1e3&&(NM-=e,TM=t)}function $M(t){FM||(SM&&(SM=clearTimeout(SM)),t-zM>24?(t<1/0&&(SM=setTimeout(jM,t-OM.now()-NM)),BM&&(BM=clearInterval(BM))):(BM||(TM=OM.now(),BM=setInterval(IM,1e3)),FM=1,RM(jM)))}qM.prototype=PM.prototype={constructor:qM,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?LM():+n)+(null==e?0:+e),this._next||CM===this||(CM?CM._next=this:DM=this,CM=this),this._call=t,this._time=n,$M()},stop:function(){this._call&&(this._call=null,this._time=1/0,$M())}};const WM=4294967296;function HM(t){return t.x}function YM(t){return t.y}var VM=Math.PI*(3-Math.sqrt(5));function GM(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=PM(f),l=wM("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%WM)/WM}();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 XM={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;y