@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
29 lines • 58.7 kB
JavaScript
// Copyright 2010-2015 Mike Bostock
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of contributors may be used to
// endorse or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
function ascending(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function bisector(e){return 1===e.length&&(e=ascendingComparator(e)),{left:function(t,n,r,a){for(null==r&&(r=0),null==a&&(a=t.length);r<a;){var o=r+a>>>1;e(t[o],n)<0?r=o+1:a=o}return r},right:function(t,n,r,a){for(null==r&&(r=0),null==a&&(a=t.length);r<a;){var o=r+a>>>1;e(t[o],n)>0?a=o:r=o+1}return r}}}function ascendingComparator(e){return function(t,n){return ascending(e(t),n)}}var ascendingBisect=bisector(ascending),bisectRight=ascendingBisect.right;function number(e){return null===e?NaN:+e}function sequence(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),o=new Array(a);++r<a;)o[r]=e+r*n;return o}var e10=Math.sqrt(50),e5=Math.sqrt(10),e2=Math.sqrt(2);function ticks(e,t,n){var r,a,o,i,u=-1;if(n=+n,(e=+e)===(t=+t)&&n>0)return[e];if((r=t<e)&&(a=e,e=t,t=a),0===(i=tickIncrement(e,t,n))||!isFinite(i))return[];if(i>0)for(e=Math.ceil(e/i),t=Math.floor(t/i),o=new Array(a=Math.ceil(t-e+1));++u<a;)o[u]=(e+u)*i;else for(e=Math.floor(e*i),t=Math.ceil(t*i),o=new Array(a=Math.ceil(e-t+1));++u<a;)o[u]=(e-u)/i;return r&&o.reverse(),o}function tickIncrement(e,t,n){var r=(t-e)/Math.max(0,n),a=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,a);return a>=0?(o>=e10?10:o>=e5?5:o>=e2?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(o>=e10?10:o>=e5?5:o>=e2?2:1)}function tickStep(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),a=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/a;return o>=e10?a*=10:o>=e5?a*=5:o>=e2&&(a*=2),t<e?-a:a}function threshold(e,t,n){if(null==n&&(n=number),r=e.length){if((t=+t)<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,a=(r-1)*t,o=Math.floor(a),i=+n(e[o],o,e);return i+(+n(e[o+1],o+1,e)-i)*(a-o)}}var prefix="$";function Map(){}function map(e,t){var n=new Map;if(e instanceof Map)e.each((function(e,t){n.set(t,e)}));else if(Array.isArray(e)){var r,a=-1,o=e.length;if(null==t)for(;++a<o;)n.set(a,e[a]);else for(;++a<o;)n.set(t(r=e[a],a,e),r)}else if(e)for(var i in e)n.set(i,e[i]);return n}function Set(){}Map.prototype=map.prototype={constructor:Map,has:function(e){return prefix+e in this},get:function(e){return this[prefix+e]},set:function(e,t){return this[prefix+e]=t,this},remove:function(e){var t=prefix+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===prefix&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===prefix&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===prefix&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===prefix&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===prefix&&++e;return e},empty:function(){for(var e in this)if(e[0]===prefix)return!1;return!0},each:function(e){for(var t in this)t[0]===prefix&&e(this[t],t.slice(1),this)}};var proto=map.prototype;function set(e,t){var n=new Set;if(e instanceof Set)e.each((function(e){n.add(e)}));else if(e){var r=-1,a=e.length;if(null==t)for(;++r<a;)n.add(e[r]);else for(;++r<a;)n.add(t(e[r],r,e))}return n}Set.prototype=set.prototype={constructor:Set,has:proto.has,add:function(e){return this[prefix+(e+="")]=e,this},remove:proto.remove,clear:proto.clear,values:proto.keys,size:proto.size,empty:proto.empty,each:proto.each};var array=Array.prototype,map$1=array.map,slice=array.slice,implicit={name:"implicit"};function ordinal(e){var t=map(),n=[],r=implicit;function a(a){var o=a+"",i=t.get(o);if(!i){if(r!==implicit)return r;t.set(o,i=n.push(a))}return e[(i-1)%e.length]}return e=null==e?[]:slice.call(e),a.domain=function(e){if(!arguments.length)return n.slice();n=[],t=map();for(var r,o,i=-1,u=e.length;++i<u;)t.has(o=(r=e[i])+"")||t.set(o,n.push(r));return a},a.range=function(t){return arguments.length?(e=slice.call(t),a):e.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.copy=function(){return ordinal().domain(n).range(e).unknown(r)},a}function band(){var e,t,n=ordinal().unknown(void 0),r=n.domain,a=n.range,o=[0,1],i=!1,u=0,c=0,f=.5;function l(){var n=r().length,l=o[1]<o[0],d=o[l-0],s=o[1-l];e=(s-d)/Math.max(1,n-u+2*c),i&&(e=Math.floor(e)),d+=(s-d-e*(n-u))*f,t=e*(1-u),i&&(d=Math.round(d),t=Math.round(t));var h=sequence(n).map((function(t){return d+e*t}));return a(l?h.reverse():h)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),l()):r()},n.range=function(e){return arguments.length?(o=[+e[0],+e[1]],l()):o.slice()},n.rangeRound=function(e){return o=[+e[0],+e[1]],i=!0,l()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(i=!!e,l()):i},n.padding=function(e){return arguments.length?(u=c=Math.max(0,Math.min(1,e)),l()):u},n.paddingInner=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),l()):u},n.paddingOuter=function(e){return arguments.length?(c=Math.max(0,Math.min(1,e)),l()):c},n.align=function(e){return arguments.length?(f=Math.max(0,Math.min(1,e)),l()):f},n.copy=function(){return band().domain(r()).range(o).round(i).paddingInner(u).paddingOuter(c).align(f)},l()}function pointish(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return pointish(t())},e}function point(){return pointish(band().paddingInner(1))}function define(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function extend(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Color(){}var darker=.7,brighter=1/darker,reI="\\s*([+-]?\\d+)\\s*",reN="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",reP="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",reHex=/^#([0-9a-f]{3,8})$/,reRgbInteger=new RegExp("^rgb\\("+[reI,reI,reI]+"\\)$"),reRgbPercent=new RegExp("^rgb\\("+[reP,reP,reP]+"\\)$"),reRgbaInteger=new RegExp("^rgba\\("+[reI,reI,reI,reN]+"\\)$"),reRgbaPercent=new RegExp("^rgba\\("+[reP,reP,reP,reN]+"\\)$"),reHslPercent=new RegExp("^hsl\\("+[reN,reP,reP]+"\\)$"),reHslaPercent=new RegExp("^hsla\\("+[reN,reP,reP,reN]+"\\)$"),named={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 color_formatHex(){return this.rgb().formatHex()}function color_formatHsl(){return hslConvert(this).formatHsl()}function color_formatRgb(){return this.rgb().formatRgb()}function color(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=reHex.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?rgbn(t):3===n?new Rgb(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?rgba(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?rgba(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=reRgbInteger.exec(e))?new Rgb(t[1],t[2],t[3],1):(t=reRgbPercent.exec(e))?new Rgb(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=reRgbaInteger.exec(e))?rgba(t[1],t[2],t[3],t[4]):(t=reRgbaPercent.exec(e))?rgba(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=reHslPercent.exec(e))?hsla(t[1],t[2]/100,t[3]/100,1):(t=reHslaPercent.exec(e))?hsla(t[1],t[2]/100,t[3]/100,t[4]):named.hasOwnProperty(e)?rgbn(named[e]):"transparent"===e?new Rgb(NaN,NaN,NaN,0):null}function rgbn(e){return new Rgb(e>>16&255,e>>8&255,255&e,1)}function rgba(e,t,n,r){return r<=0&&(e=t=n=NaN),new Rgb(e,t,n,r)}function rgbConvert(e){return e instanceof Color||(e=color(e)),e?new Rgb((e=e.rgb()).r,e.g,e.b,e.opacity):new Rgb}function rgb(e,t,n,r){return 1===arguments.length?rgbConvert(e):new Rgb(e,t,n,null==r?1:r)}function Rgb(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function rgb_formatHex(){return"#"+hex(this.r)+hex(this.g)+hex(this.b)}function rgb_formatRgb(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"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===e?")":", "+e+")")}function hex(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function hsla(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hsl(e,t,n,r)}function hslConvert(e){if(e instanceof Hsl)return new Hsl(e.h,e.s,e.l,e.opacity);if(e instanceof Color||(e=color(e)),!e)return new Hsl;if(e instanceof Hsl)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),o=Math.max(t,n,r),i=NaN,u=o-a,c=(o+a)/2;return u?(i=t===o?(n-r)/u+6*(n<r):n===o?(r-t)/u+2:(t-n)/u+4,u/=c<.5?o+a:2-o-a,i*=60):u=c>0&&c<1?0:i,new Hsl(i,u,c,e.opacity)}function hsl(e,t,n,r){return 1===arguments.length?hslConvert(e):new Hsl(e,t,n,null==r?1:r)}function Hsl(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function hsl2rgb(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}define(Color,color,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHsl:color_formatHsl,formatRgb:color_formatRgb,toString:color_formatRgb}),define(Rgb,rgb,extend(Color,{brighter:function(e){return e=null==e?brighter:Math.pow(brighter,e),new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?darker:Math.pow(darker,e),new Rgb(this.r*e,this.g*e,this.b*e,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:rgb_formatHex,formatHex:rgb_formatHex,formatRgb:rgb_formatRgb,toString:rgb_formatRgb})),define(Hsl,hsl,extend(Color,{brighter:function(e){return e=null==e?brighter:Math.pow(brighter,e),new Hsl(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?darker:Math.pow(darker,e),new Hsl(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Rgb(hsl2rgb(e>=240?e-240:e+120,a,r),hsl2rgb(e,a,r),hsl2rgb(e<120?e+240:e-120,a,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 e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var deg2rad=Math.PI/180,rad2deg=180/Math.PI,A=-.14861,B=1.78277,C=-.29227,D=-.90649,E=1.97294,ED=E*D,EB=E*B,BC_DA=B*C-D*A;function cubehelixConvert(e){if(e instanceof Cubehelix)return new Cubehelix(e.h,e.s,e.l,e.opacity);e instanceof Rgb||(e=rgbConvert(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=(BC_DA*r+ED*t-EB*n)/(BC_DA+ED-EB),o=r-a,i=(E*(n-a)-C*o)/D,u=Math.sqrt(i*i+o*o)/(E*a*(1-a)),c=u?Math.atan2(i,o)*rad2deg-120:NaN;return new Cubehelix(c<0?c+360:c,u,a,e.opacity)}function cubehelix(e,t,n,r){return 1===arguments.length?cubehelixConvert(e):new Cubehelix(e,t,n,null==r?1:r)}function Cubehelix(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function constant(e){return function(){return e}}function linear(e,t){return function(n){return e+n*t}}function exponential(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hue(e,t){var n=t-e;return n?linear(e,n>180||n<-180?n-360*Math.round(n/360):n):constant(isNaN(e)?t:e)}function gamma(e){return 1==(e=+e)?nogamma:function(t,n){return n-t?exponential(t,n,e):constant(isNaN(t)?n:t)}}function nogamma(e,t){var n=t-e;return n?linear(e,n):constant(isNaN(e)?t:e)}define(Cubehelix,cubehelix,extend(Color,{brighter:function(e){return e=null==e?brighter:Math.pow(brighter,e),new Cubehelix(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?darker:Math.pow(darker,e),new Cubehelix(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*deg2rad,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new Rgb(255*(t+n*(A*r+B*a)),255*(t+n*(C*r+D*a)),255*(t+n*(E*r)),this.opacity)}}));var rgb$1=function e(t){var n=gamma(t);function r(e,t){var r=n((e=rgb(e)).r,(t=rgb(t)).r),a=n(e.g,t.g),o=n(e.b,t.b),i=nogamma(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=o(t),e.opacity=i(t),e+""}}return r.gamma=e,r}(1);function numberArray(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,a=t.slice();return function(o){for(n=0;n<r;++n)a[n]=e[n]*(1-o)+t[n]*o;return a}}function isNumberArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function genericArray(e,t){var n,r=t?t.length:0,a=e?Math.min(r,e.length):0,o=new Array(a),i=new Array(r);for(n=0;n<a;++n)o[n]=interpolateValue(e[n],t[n]);for(;n<r;++n)i[n]=t[n];return function(e){for(n=0;n<a;++n)i[n]=o[n](e);return i}}function date(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function reinterpolate(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function object(e,t){var n,r={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=interpolateValue(e[n],t[n]):a[n]=t[n];return function(e){for(n in r)a[n]=r[n](e);return a}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function zero(e){return function(){return e}}function one(e){return function(t){return e(t)+""}}function string(e,t){var n,r,a,o=reA.lastIndex=reB.lastIndex=0,i=-1,u=[],c=[];for(e+="",t+="";(n=reA.exec(e))&&(r=reB.exec(t));)(a=r.index)>o&&(a=t.slice(o,a),u[i]?u[i]+=a:u[++i]=a),(n=n[0])===(r=r[0])?u[i]?u[i]+=r:u[++i]=r:(u[++i]=null,c.push({i:i,x:reinterpolate(n,r)})),o=reB.lastIndex;return o<t.length&&(a=t.slice(o),u[i]?u[i]+=a:u[++i]=a),u.length<2?c[0]?one(c[0].x):zero(t):(t=c.length,function(e){for(var n,r=0;r<t;++r)u[(n=c[r]).i]=n.x(e);return u.join("")})}function interpolateValue(e,t){var n,r=typeof t;return null==t||"boolean"===r?constant(t):("number"===r?reinterpolate:"string"===r?(n=color(t))?(t=n,rgb$1):string:t instanceof color?rgb$1:t instanceof Date?date:isNumberArray(t)?numberArray:Array.isArray(t)?genericArray:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?object:reinterpolate)(e,t)}function interpolateRound(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function cubehelix$1(e){return function t(n){function r(t,r){var a=e((t=cubehelix(t)).h,(r=cubehelix(r)).h),o=nogamma(t.s,r.s),i=nogamma(t.l,r.l),u=nogamma(t.opacity,r.opacity);return function(e){return t.h=a(e),t.s=o(e),t.l=i(Math.pow(e,n)),t.opacity=u(e),t+""}}return n=+n,r.gamma=t,r}(1)}cubehelix$1(hue);var cubehelixLong=cubehelix$1(nogamma);function constant$1(e){return function(){return e}}function number$1(e){return+e}var unit=[0,1];function deinterpolateLinear(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:constant$1(t)}function deinterpolateClamp(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=t?0:e>=n?1:r(e)}}}function reinterpolateClamp(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=0?t:e>=1?n:r(e)}}}function bimap(e,t,n,r){var a=e[0],o=e[1],i=t[0],u=t[1];return o<a?(a=n(o,a),i=r(u,i)):(a=n(a,o),i=r(i,u)),function(e){return i(a(e))}}function polymap(e,t,n,r){var a=Math.min(e.length,t.length)-1,o=new Array(a),i=new Array(a),u=-1;for(e[a]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++u<a;)o[u]=n(e[u],e[u+1]),i[u]=r(t[u],t[u+1]);return function(t){var n=bisectRight(e,t,1,a)-1;return i[n](o[n](t))}}function copy(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp())}function continuous(e,t){var n,r,a,o=unit,i=unit,u=interpolateValue,c=!1;function f(){return n=Math.min(o.length,i.length)>2?polymap:bimap,r=a=null,l}function l(t){return(r||(r=n(o,i,c?deinterpolateClamp(e):e,u)))(+t)}return l.invert=function(e){return(a||(a=n(i,o,deinterpolateLinear,c?reinterpolateClamp(t):t)))(+e)},l.domain=function(e){return arguments.length?(o=map$1.call(e,number$1),f()):o.slice()},l.range=function(e){return arguments.length?(i=slice.call(e),f()):i.slice()},l.rangeRound=function(e){return i=slice.call(e),u=interpolateRound,f()},l.clamp=function(e){return arguments.length?(c=!!e,f()):c},l.interpolate=function(e){return arguments.length?(u=e,f()):u},f()}function formatDecimal(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function formatDecimalParts(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function exponent(e){return(e=formatDecimalParts(Math.abs(e)))?e[1]:NaN}function formatGroup(e,t){return function(n,r){for(var a=n.length,o=[],i=0,u=e[0],c=0;a>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),o.push(n.substring(a-=u,a+u)),!((c+=u+1)>r));)u=e[i=(i+1)%e.length];return o.reverse().join(t)}}function formatNumerals(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}var prefixExponent,re=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(e){if(!(t=re.exec(e)))throw new Error("invalid format: "+e);var t;return new FormatSpecifier({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function FormatSpecifier(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function formatTrim(e){e:for(var t,n=e.length,r=1,a=-1;r<n;++r)switch(e[r]){case".":a=t=r;break;case"0":0===a&&(a=r),t=r;break;default:if(!+e[r])break e;a>0&&(a=0)}return a>0?e.slice(0,a)+e.slice(t+1):e}function formatPrefixAuto(e,t){var n=formatDecimalParts(e,t);if(!n)return e+"";var r=n[0],a=n[1],o=a-(prefixExponent=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,i=r.length;return o===i?r:o>i?r+new Array(o-i+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+formatDecimalParts(e,Math.max(0,t+o-1))[0]}function formatRounded(e,t){var n=formatDecimalParts(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}formatSpecifier.prototype=FormatSpecifier.prototype,FormatSpecifier.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 formatTypes={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:formatDecimal,e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return formatRounded(100*e,t)},r:formatRounded,s:formatPrefixAuto,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function identity(e){return e}var locale,format,formatPrefix,map$2=Array.prototype.map,prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function formatLocale(e){var t=void 0===e.grouping||void 0===e.thousands?identity:formatGroup(map$2.call(e.grouping,Number),e.thousands+""),n=void 0===e.currency?"":e.currency[0]+"",r=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?identity:formatNumerals(map$2.call(e.numerals,String)),i=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"-":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function f(e){var f=(e=formatSpecifier(e)).fill,l=e.align,d=e.sign,s=e.symbol,h=e.zero,b=e.width,m=e.comma,g=e.precision,p=e.trim,y=e.type;"n"===y?(m=!0,y="g"):formatTypes[y]||(void 0===g&&(g=12),p=!0,y="g"),(h||"0"===f&&"="===l)&&(h=!0,f="0",l="=");var M="$"===s?n:"#"===s&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",v="$"===s?r:/[%p]/.test(y)?i:"",w=formatTypes[y],x=/[defgprs%]/.test(y);function C(e){var n,r,i,s=M,C=v;if("c"===y)C=w(e)+C,e="";else{var T=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:w(Math.abs(e),g),p&&(e=formatTrim(e)),T&&0==+e&&"+"!==d&&(T=!1),s=(T?"("===d?d:u:"-"===d||"("===d?"":d)+s,C=("s"===y?prefixes[8+prefixExponent/3]:"")+C+(T&&"("===d?")":""),x)for(n=-1,r=e.length;++n<r;)if(48>(i=e.charCodeAt(n))||i>57){C=(46===i?a+e.slice(n+1):e.slice(n))+C,e=e.slice(0,n);break}}m&&!h&&(e=t(e,1/0));var k=s.length+e.length+C.length,D=k<b?new Array(b-k+1).join(f):"";switch(m&&h&&(e=t(D+e,D.length?b-C.length:1/0),D=""),l){case"<":e=s+e+C+D;break;case"=":e=s+D+e+C;break;case"^":e=D.slice(0,k=D.length>>1)+s+e+C+D.slice(k);break;default:e=D+s+e+C}return o(e)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return e+""},C}return{format:f,formatPrefix:function(e,t){var n=f(((e=formatSpecifier(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(exponent(t)/3))),a=Math.pow(10,-r),o=prefixes[8+r/3];return function(e){return n(a*e)+o}}}}function defaultLocale(e){return locale=formatLocale(e),format=locale.format,formatPrefix=locale.formatPrefix,locale}function precisionFixed(e){return Math.max(0,-exponent(Math.abs(e)))}function precisionPrefix(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(exponent(t)/3)))-exponent(Math.abs(e)))}function precisionRound(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,exponent(t)-exponent(e))+1}function tickFormat(e,t,n){var r,a=e[0],o=e[e.length-1],i=tickStep(a,o,null==t?10:t);switch((n=formatSpecifier(null==n?",f":n)).type){case"s":var u=Math.max(Math.abs(a),Math.abs(o));return null!=n.precision||isNaN(r=precisionPrefix(i,u))||(n.precision=r),formatPrefix(n,u);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(r=precisionRound(i,Math.max(Math.abs(a),Math.abs(o))))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(r=precisionFixed(i))||(n.precision=r-2*("%"===n.type))}return format(n)}function linearish(e){var t=e.domain;return e.ticks=function(e){var n=t();return ticks(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){return tickFormat(t(),e,n)},e.nice=function(n){null==n&&(n=10);var r,a=t(),o=0,i=a.length-1,u=a[o],c=a[i];return c<u&&(r=u,u=c,c=r,r=o,o=i,i=r),(r=tickIncrement(u,c,n))>0?r=tickIncrement(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,n):r<0&&(r=tickIncrement(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,n)),r>0?(a[o]=Math.floor(u/r)*r,a[i]=Math.ceil(c/r)*r,t(a)):r<0&&(a[o]=Math.ceil(u*r)/r,a[i]=Math.floor(c*r)/r,t(a)),e},e}function linear$1(){var e=continuous(deinterpolateLinear,reinterpolate);return e.copy=function(){return copy(e,linear$1())},linearish(e)}function identity$1(){var e=[0,1];function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=map$1.call(n,number$1),t):e.slice()},t.copy=function(){return identity$1().domain(e)},linearish(t)}function nice(e,t){var n,r=0,a=(e=e.slice()).length-1,o=e[r],i=e[a];return i<o&&(n=r,r=a,a=n,n=o,o=i,i=n),e[r]=t.floor(o),e[a]=t.ceil(i),e}function deinterpolate(e,t){return(t=Math.log(t/e))?function(n){return Math.log(n/e)/t}:constant$1(t)}function reinterpolate$1(e,t){return e<0?function(n){return-Math.pow(-t,n)*Math.pow(-e,1-n)}:function(n){return Math.pow(t,n)*Math.pow(e,1-n)}}function pow10(e){return isFinite(e)?+("1e"+e):e<0?0:e}function powp(e){return 10===e?pow10:e===Math.E?Math.exp:function(t){return Math.pow(e,t)}}function logp(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),function(t){return Math.log(t)/e})}function reflect(e){return function(t){return-e(-t)}}function log(){var e=continuous(deinterpolate,reinterpolate$1).domain([1,10]),t=e.domain,n=10,r=logp(10),a=powp(10);function o(){return r=logp(n),a=powp(n),t()[0]<0&&(r=reflect(r),a=reflect(a)),e}return e.base=function(e){return arguments.length?(n=+e,o()):n},e.domain=function(e){return arguments.length?(t(e),o()):t()},e.ticks=function(e){var o,i=t(),u=i[0],c=i[i.length-1];(o=c<u)&&(s=u,u=c,c=s);var f,l,d,s=r(u),h=r(c),b=null==e?10:+e,m=[];if(!(n%1)&&h-s<b){if(s=Math.round(s)-1,h=Math.round(h)+1,u>0){for(;s<h;++s)for(l=1,f=a(s);l<n;++l)if(!((d=f*l)<u)){if(d>c)break;m.push(d)}}else for(;s<h;++s)for(l=n-1,f=a(s);l>=1;--l)if(!((d=f*l)<u)){if(d>c)break;m.push(d)}}else m=ticks(s,h,Math.min(h-s,b)).map(a);return o?m.reverse():m},e.tickFormat=function(t,o){if(null==o&&(o=10===n?".0e":","),"function"!=typeof o&&(o=format(o)),t===1/0)return o;null==t&&(t=10);var i=Math.max(1,n*t/e.ticks().length);return function(e){var t=e/a(Math.round(r(e)));return t*n<n-.5&&(t*=n),t<=i?o(e):""}},e.nice=function(){return t(nice(t(),{floor:function(e){return a(Math.floor(r(e)))},ceil:function(e){return a(Math.ceil(r(e)))}}))},e.copy=function(){return copy(e,log().base(n))},e}function raise(e,t){return e<0?-Math.pow(-e,t):Math.pow(e,t)}function pow(){var e=1,t=continuous((function(t,n){return(n=raise(n,e)-(t=raise(t,e)))?function(r){return(raise(r,e)-t)/n}:constant$1(n)}),(function(t,n){return n=raise(n,e)-(t=raise(t,e)),function(r){return raise(t+n*r,1/e)}})),n=t.domain;return t.exponent=function(t){return arguments.length?(e=+t,n(n())):e},t.copy=function(){return copy(t,pow().exponent(e))},linearish(t)}function sqrt(){return pow().exponent(.5)}function quantile(){var e=[],t=[],n=[];function r(){var r=0,o=Math.max(1,t.length);for(n=new Array(o-1);++r<o;)n[r-1]=threshold(e,r/o);return a}function a(e){if(!isNaN(e=+e))return t[bisectRight(n,e)]}return a.invertExtent=function(r){var a=t.indexOf(r);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var n,a=0,o=t.length;a<o;++a)null==(n=t[a])||isNaN(n=+n)||e.push(n);return e.sort(ascending),r()},a.range=function(e){return arguments.length?(t=slice.call(e),r()):t.slice()},a.quantiles=function(){return n.slice()},a.copy=function(){return quantile().domain(e).range(t)},a}function quantize(){var e=0,t=1,n=1,r=[.5],a=[0,1];function o(e){if(e<=e)return a[bisectRight(r,e,0,n)]}function i(){var a=-1;for(r=new Array(n);++a<n;)r[a]=((a+1)*t-(a-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?(e=+n[0],t=+n[1],i()):[e,t]},o.range=function(e){return arguments.length?(n=(a=slice.call(e)).length-1,i()):a.slice()},o.invertExtent=function(o){var i=a.indexOf(o);return i<0?[NaN,NaN]:i<1?[e,r[0]]:i>=n?[r[n-1],t]:[r[i-1],r[i]]},o.copy=function(){return quantize().domain([e,t]).range(a)},linearish(o)}function threshold$1(){var e=[.5],t=[0,1],n=1;function r(r){if(r<=r)return t[bisectRight(e,r,0,n)]}return r.domain=function(a){return arguments.length?(e=slice.call(a),n=Math.min(e.length,t.length-1),r):e.slice()},r.range=function(a){return arguments.length?(t=slice.call(a),n=Math.min(e.length,t.length-1),r):t.slice()},r.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},r.copy=function(){return threshold$1().domain(e).range(t)},r}defaultLocale({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var t0=new Date,t1=new Date;function newInterval(e,t,n,r){function a(t){return e(t=0===arguments.length?new Date:new Date(+t)),t}return a.floor=function(t){return e(t=new Date(+t)),t},a.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},a.round=function(e){var t=a(e),n=a.ceil(e);return e-t<n-e?t:n},a.offset=function(e,n){return t(e=new Date(+e),null==n?1:Math.floor(n)),e},a.range=function(n,r,o){var i,u=[];if(n=a.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return u;do{u.push(i=new Date(+n)),t(n,o),e(n)}while(i<n&&n<r);return u},a.filter=function(n){return newInterval((function(t){if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}))},n&&(a.count=function(t,r){return t0.setTime(+t),t1.setTime(+r),e(t0),e(t1),Math.floor(n(t0,t1))},a.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?a.filter(r?function(t){return r(t)%e==0}:function(t){return a.count(0,t)%e==0}):a:null}),a}var millisecond=newInterval((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));millisecond.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?newInterval((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):millisecond:null};var durationSecond=1e3,durationMinute=6e4,durationHour=36e5,durationDay=864e5,durationWeek=6048e5,second=newInterval((function(e){e.setTime(e-e.getMilliseconds())}),(function(e,t){e.setTime(+e+t*durationSecond)}),(function(e,t){return(t-e)/durationSecond}),(function(e){return e.getUTCSeconds()})),minute=newInterval((function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*durationSecond)}),(function(e,t){e.setTime(+e+t*durationMinute)}),(function(e,t){return(t-e)/durationMinute}),(function(e){return e.getMinutes()})),hour=newInterval((function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*durationSecond-e.getMinutes()*durationMinute)}),(function(e,t){e.setTime(+e+t*durationHour)}),(function(e,t){return(t-e)/durationHour}),(function(e){return e.getHours()})),day=newInterval((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*durationMinute)/durationDay}),(function(e){return e.getDate()-1}));function weekday(e){return newInterval((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*durationMinute)/durationWeek}))}var sunday=weekday(0),monday=weekday(1),tuesday=weekday(2),wednesday=weekday(3),thursday=weekday(4),friday=weekday(5),saturday=weekday(6),month=newInterval((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),year=newInterval((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));year.every=function(e){return isFinite(e=Math.floor(e))&&e>0?newInterval((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var utcMinute=newInterval((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+t*durationMinute)}),(function(e,t){return(t-e)/durationMinute}),(function(e){return e.getUTCMinutes()})),utcHour=newInterval((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+t*durationHour)}),(function(e,t){return(t-e)/durationHour}),(function(e){return e.getUTCHours()})),utcDay=newInterval((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/durationDay}),(function(e){return e.getUTCDate()-1}));function utcWeekday(e){return newInterval((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/durationWeek}))}var utcSunday=utcWeekday(0),utcMonday=utcWeekday(1),utcTuesday=utcWeekday(2),utcWednesday=utcWeekday(3),utcThursday=utcWeekday(4),utcFriday=utcWeekday(5),utcSaturday=utcWeekday(6),utcMonth=newInterval((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),utcYear=newInterval((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));function localDate(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function utcDate(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function formatLocale$1(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,o=e.days,i=e.shortDays,u=e.months,c=e.shortMonths,f=formatRe(a),l=formatLookup(a),d=formatRe(o),s=formatLookup(o),h=formatRe(i),b=formatLookup(i),m=formatRe(u),g=formatLookup(u),p=formatRe(c),y=formatLookup(c),M={a:function(e){return i[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return c[e.getMonth()]},B:function(e){return u[e.getMonth()]},c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,g:formatYearISO,G:formatFullYearISO,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:function(e){return a[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},v={a:function(e){return i[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return c[e.getUTCMonth()]},B:function(e){return u[e.getUTCMonth()]},c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,g:formatUTCYearISO,G:formatUTCFullYearISO,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:function(e){return a[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},w={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=b[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=s[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=p.exec(t.slice(n));return r?(e.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=m.exec(t.slice(n));return r?(e.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return T(e,t,n,r)},d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,g:parseYear,G:parseFullYear,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.p=l[r[0].toLowerCase()],n+r[0].length):-1},q:parseQuarter,Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:function(e,t,r){return T(e,n,t,r)},X:function(e,t,n){return T(e,r,t,n)},y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};function x(e,t){return function(n){var r,a,o,i=[],u=-1,c=0,f=e.length;for(n instanceof Date||(n=new Date(+n));++u<f;)37===e.charCodeAt(u)&&(i.push(e.slice(c,u)),null!=(a=pads[r=e.charAt(++u)])?r=e.charAt(++u):a="e"===r?" ":"0",(o=t[r])&&(r=o(n,a)),i.push(r),c=u+1);return i.push(e.slice(c,u)),i.join("")}}function C(e,t){return function(n){var r,a,o=newDate(1900,void 0,1);if(T(o,e,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(t&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(a=(r=utcDate(newDate(o.y,0,1))).getUTCDay(),r=a>4||0===a?utcMonday.ceil(r):utcMonday(r),r=utcDay.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(a=(r=localDate(newDate(o.y,0,1))).getDay(),r=a>4||0===a?monday.ceil(r):monday(r),r=day.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),a="Z"in o?utcDate(newDate(o.y,0,1)).getUTCDay():localDate(newDate(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(a+5)%7:o.w+7*o.U-(a+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,utcDate(o)):localDate(o)}}function T(e,t,n,r){for(var a,o,i=0,u=t.length,c=n.length;i<u;){if(r>=c)return-1;if(37===(a=t.charCodeAt(i++))){if(a=t.charAt(i++),!(o=w[a in pads?t.charAt(i++):a])||(r=o(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}return M.x=x(n,M),M.X=x(r,M),M.c=x(t,M),v.x=x(n,v),v.X=x(r,v),v.c=x(t,v),{format:function(e){var t=x(e+="",M);return t.toString=function(){return e},t},parse:function(e){var t=C(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=x(e+="",v);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+="",!0);return t.toString=function(){return e},t}}}utcYear.every=function(e){return isFinite(e=Math.floor(e))&&e>0?newInterval((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var locale$1,timeFormat,timeParse,utcFormat,utcParse,pads={"-":"",_:" ",0:"0"},numberRe=/^\s*\d+/,percentRe=/^%/,requoteRe=/[\\^$*+?|[\]().{}]/g;function pad(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",o=a.length;return r+(o<n?new Array(n-o+1).join(t)+a:a)}function requote(e){return e.replace(requoteRe,"\\$&")}function formatRe(e){return new RegExp("^(?:"+e.map(requote).join("|")+")","i")}function formatLookup(e){for(var t={},n=-1,r=e.length;++n<r;)t[e[n].toLowerCase()]=n;return t}function parseWeekdayNumberSunday(e,t,n){var r=numberRe.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function parseWeekdayNumberMonday(e,t,n){var r=numberRe.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function parseWeekNumberSunday(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function parseWeekNumberISO(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function parseWeekNumberMonday(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function parseFullYear(e,t,n){var r=numberRe.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function parseYear(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function parseZone(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function parseQuarter(e,t,n){var r=numberRe.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function parseMonthNumber(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function parseDayOfMonth(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function parseDayOfYear(e,t,n){var r=numberRe.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function parseHour24(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function parseMinutes(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function parseSeconds(e,t,n){var r=numberRe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function parseMilliseconds(e,t,n){var r=numberRe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function parseMicroseconds(e,t,n){var r=numberRe.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function parseLiteralPercent(e,t,n){var r=percentRe.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function parseUnixTimestamp(e,t,n){var r=numberRe.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function parseUnixTimestampSeconds(e,t,n){var r=numberRe.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function formatDayOfMonth(e,t){return pad(e.getDate(),t,2)}function formatHour24(e,t){return pad(e.getHours(),t,2)}function formatHour12(e,t){return pad(e.getHours()%12||12,t,2)}function formatDayOfYear(e,t){return pad(1+day.count(year(e),e),t,3)}function formatMilliseconds(e,t){return pad(e.getMilliseconds(),t,3)}function formatMicroseconds(e,t){return formatMilliseconds(e,t)+"000"}function formatMonthNumber(e,t){return pad(e.getMonth()+1,t,2)}function formatMinutes(e,t){return pad(e.getMinutes(),t,2)}function formatSeconds(e,t){return pad(e.getSeconds(),t,2)}function formatWeekdayNumberMonday(e){var t=e.getDay();return 0===t?7:t}function formatWeekNumberSunday(e,t){return pad(sunday.count(year(e)-1,e),t,2)}function dISO(e){var t=e.getDay();return t>=4||0===t?thursday(e):thursday.ceil(e)}function formatWeekNumberISO(e,t){return e=dISO(e),pad(thursday.count(year(e),e)+(4===year(e).getDay()),t,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,t){return pad(monday.count(year(e)-1,e),t,2)}function formatYear(e,t){return pad(e.getFullYear()%100,t,2)}function formatYearISO(e,t){return pad((e=dISO(e)).getFullYear()%100,t,2)}function formatFullYear(e,t){return pad(e.getFullYear()%1e4,t,4)}function formatFullYearISO(e,t){var n=e.getDay();return pad((e=n>=4||0===n?thursday(e):thursday.ceil(e)).getFullYear()%1e4,t,4)}function formatZone(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+pad(t/60|0,"0",2)+pad(t%60,"0",2)}function formatUTCDayOfMonth(e,t){return pad(e.getUTCDate(),t,2)}function formatUTCHour24(e,t){return pad(e.getUTCHours(),t,2)}function formatUTCHour12(e,t){return pad(e.getUTCHours()%12||12,t,2)}function formatUTCDayOfYear(e,t){return pad(1+utcDay.count(utcYear(e),e),t,3)}function formatUTCMilliseconds(e,t){return pad(e.getUTCMilliseconds(),t,3)}function formatUTCMicroseconds(e,t){return formatUTCMilliseconds(e,t)+"000"}function formatUTCMonthNumber(e,t){return pad(e.getUTCMonth()+1,t,2)}function formatUTCMinutes(e,t){return pad(e.getUTCMinutes(),t,2)}function formatUTCSeconds(e,t){return pad(e.getUTCSeconds(),t,2)}function formatUTCWeekdayNumberMonday(e){var t=e.getUTCDay();return 0===t?7:t}function formatUTCWeekNumberSunday(e,t){return pad(utcSunday.count(utcYear(e)-1,e),t,2)}function UTCdISO(e){var t=e.getUTCDay();return t>=4||0===t?utcThursday(e):utcThursday.ceil(e)}function formatUTCWeekNumberISO(e,t){return e=UTCdISO(e),pad(utcThursday.count(utcYear(e),e)+(4===utcYear(e).getUTCDay()),t,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(e,t){return pad(utcMonday.count(utcYear(e)-1,e),t,2)}function formatUTCYear(e,t){return pad(e.getUTCFullYear()%100,t,2)}function formatUTCYearISO(e,t){return pad((e=UTCdISO(e)).getUTCFullYear()%100,t,2)}function formatUTCFullYear(e,t){return pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCFullYearISO(e,t){var n=e.getUTCDay();return pad((e=n>=4||0===n?utcThursday(e):utcThursday.ceil(e)).getUTCFullYear()%1e4,t,4)}function formatUTCZone(){return"+0000"}function formatLiteralPercent(){return"%"}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(+e/1e3)}function defaultLocale$1(e){return locale$1=formatLocale$1(e),timeFormat=locale$1.format,timeParse=locale$1.parse,utcFormat=locale$1.utcFormat,utcParse=locale$1.utcParse,locale$1}defaultLocale$1({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var durationSecond$1=1e3,durationMinute$1=60*durationSecond$1,durationHour$1=60*durationMinute$1,durationDay$1=24*durationHour$1,durationWeek$1=7*durationDay$1,durationMonth=30*durationDay$1,durationYear=365*durationDay$1;function date$1(e){return new Date(e)}function number$2(e){return e instanceof Date?+e:+new Date(+e)}function calendar(e,t,n,r,a,o,i,u,c){var f=continuous(deinterpolateLinear,reinterpolate),l=f.invert,d=f.domain,s=c(".%L"),h=c(":%S"),b=c("%I:%M"),m=c("%I %p"),g=c("%a %d"),p=c("%b %d"),y=c("%B"),M=c("%Y"),v=[[i,1,durationSecond$1],[i,5,5*durationSecond$1],[i,15,15*durationSecond$1],[i,30,30*durationSecond$1],[o,1,durationMinute$1],[o,5,5*durationMinute$1],[o,15,15*durationMinute$1],[o,30,30*durationMinute$1],[a,1,durationHour$1],[a,3,3*durationHour$1],[a,6,6*durationHour$1],[a,12,12*durationHour$1],[r,1,durationDay$1],[r,2,2*durationDay$1],[n,1,durationWeek$1],[t,1,durationMonth],[t,3,3*durationMonth],[e,1,durationYear]];function w(u){return(i(u)<u?s:o(u)<u?h:a(u)<u?b:r(u)<u?m:t(u)<u?n(u)<u?g:p:e(u)<u?y:M)(u)}function x(t,n,r,a){if(null==t&&(t=10),"number"==typeof t){var o=Math.abs(r-n)/t,i=bisector((function(e){return e[2]})).right(v,o);i===v.length?(a=tickStep(n/durationYear,r/durationYear,t),t=e):i?(a=(i=v[o/v[i-1][2]<v[i][2]/o?i-1:i])[1],t=i[0]):(a=Math.max(tickStep(n,r,t),1),t=u)}return null==a?t:t.every(a)}return f.invert=function(e){return new Date(l(e))},f.domain=function(e){return arguments.length?d(map$1.call(e,number$2)):d().map(date$1)},f.ticks=function(e,t){var n,r=d(),a=r[0],o=r[r.length-1],i=o<a;return i&&(n=a,a=o,o=n),n=(n=x(e,a,o,t))?n.range(a,o+1):[],i?n.reverse():n},f.tickFormat=function(e,t){return null==t?w:c(t)},f.nice=function(e,t){var n=d();return(e=x(e,n[0],n[n.length-1],t))?d(nice(n,e)):f},f.copy=function(){return copy(f,calendar(e,t,n,r,a,o,i,u,c))},f}function time(){return calendar(year,month,sunday,day,hour,m