d3=function(){function o(e){return e!=null&&!isNaN(e)}function a(e){return e.length}function f(e){var t=1;while(e*t%1)t*=10;return t}function l(e,t){try{for(var n in t){Object.defineProperty(e.prototype,n,{value:t[n],enumerable:false})}}catch(r){e.prototype=t}}function c(){}function d(){}function v(e,t,n){return function(){var r=n.apply(t,arguments);return r===t?e:r}}function m(){}function g(e){function r(){var n=t,r=-1,i=n.length,s;while(++r0)t=t.substring(0,s);var u=Z.get(t);if(u)t=u,o=tt;return s?n?f:a:n?G:l}function et(t,n){return function(r){var i=e.event;e.event=r;n[0]=this.__data__;try{t.apply(this,n)}finally{e.event=i}}}function tt(e,t){var n=et(e,t);return function(e){var t=this,r=e.relatedTarget;if(!r||r!==t&&!(r.compareDocumentPosition(t)&8)){n.call(t,e)}}}function nt(e,t){for(var n=0,r=e.length;n360)e-=360;else if(e<0)e+=360;if(e<60)return r+(i-r)*e/60;if(e<180)return i;if(e<240)return r+(i-r)*(240-e)/60;return r}function o(e){return Math.round(s(e)*255)}var r,i;e=e%360;if(e<0)e+=360;t=t<0?0:t>1?1:t;n=n<0?0:n>1?1:n;i=n<=.5?n*(1+t):n+t-n*t;r=2*n-i;return qt(o(e+120),o(e),o(e-120))}function yt(e){return e>0?1:e<0?-1:0}function bt(e){return Math.acos(Math.max(-1,Math.min(1,e)))}function wt(e){return e>1?dt/2:e<-1?-dt/2:Math.asin(e)}function Et(e){return(Math.exp(e)-Math.exp(-e))/2}function St(e){return(Math.exp(e)+Math.exp(-e))/2}function xt(e){return(e=Math.sin(e/2))*e}function Tt(e,t,n){return new Nt(e,t,n)}function Nt(e,t,n){this.h=e;this.c=t;this.l=n}function kt(e,t,n){return Lt(n,Math.cos(e*=mt)*t,Math.sin(e)*t)}function Lt(e,t,n){return new At(e,t,n)}function At(e,t,n){this.l=e;this.a=t;this.b=n}function Ht(e,t,n){var r=(e+16)/116,i=r+t/500,s=r-n/200;i=jt(i)*Mt;r=jt(r)*_t;s=jt(s)*Dt;return qt(It(3.2404542*i-1.5371385*r-.4985314*s),It(-.969266*i+1.8760108*r+.041556*s),It(.0556434*i-.2040259*r+1.0572252*s))}function Bt(e,t,n){return Tt(Math.atan2(n,t)*gt,Math.sqrt(t*t+n*n),e)}function jt(e){return e>.206893034?e*e*e:(e-4/29)/7.787037}function Ft(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29}function It(e){return Math.round(255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055))}function qt(e,t,n){return new Rt(e,t,n)}function Rt(e,t,n){this.r=e;this.g=t;this.b=n}function zt(e){return e<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16)}function Wt(e,t,n){var r=0,i=0,s=0,o,u,a;o=/([a-z]+)\((.*)\)/i.exec(e);if(o){u=o[2].split(",");switch(o[1]){case"hsl":{return n(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100)};case"rgb":{return t(Jt(u[0]),Jt(u[1]),Jt(u[2]))}}}if(a=Kt.get(e))return t(a.r,a.g,a.b);if(e!=null&&e.charAt(0)==="#"){if(e.length===4){r=e.charAt(1);r+=r;i=e.charAt(2);i+=i;s=e.charAt(3);s+=s}else if(e.length===7){r=e.substring(1,3);i=e.substring(3,5);s=e.substring(5,7)}r=parseInt(r,16);i=parseInt(i,16);s=parseInt(s,16)}return t(r,i,s)}function Xt(e,t,n){var r=Math.min(e/=255,t/=255,n/=255),i=Math.max(e,t,n),s=i-r,o,u,a=(i+r)/2;if(s){u=a<.5?s/(i+r):s/(2-i-r);if(e==i)o=(t-n)/s+(t=o)return r;if(l)return l=false,n;var t=u;if(e.charCodeAt(t)===34){var s=t;while(s++=n.delay)n.flush=n.callback(e);n=n.next}var r=un()-t;if(r>24){if(isFinite(r)){clearTimeout(sn);sn=setTimeout(on,r)}rn=0}else{rn=1;an(on)}}function un(){var e=null,t=nn,n=Infinity;while(t){if(t.flush){delete tn[t.callback.id];t=e?e.next=t.next:nn=t.next}else{n=Math.min(n,t.then+t.delay);t=(e=t).next}}return n}function pn(e,t){var n=Math.pow(10,Math.abs(8-t)*3);return{scale:t>8?function(e){return e/n}:function(e){return e*n},symbol:e}}function mn(e,t){return t-(e?Math.ceil(Math.log(e)/Math.LN10):1)}function gn(e){return e+""}function wn(e,t){if(e&&Sn.hasOwnProperty(e.type)){Sn[e.type](e,t)}}function xn(e,t,n){var r=-1,i=e.length-n,s;t.lineStart();while(++ri)i=e;if(ts)s=t}function a(){o.point=o.lineEnd=G}var n,r,i,s;var o={point:u,lineStart:G,lineEnd:G,polygonStart:function(){o.lineEnd=a},polygonEnd:function(){o.point=u}};return function(u){s=i=-(n=r=Infinity);e.geo.stream(u,t(o));return[[n,r],[i,s]]}}function jn(e,t){if(Mn)return;++_n;e*=mt;var n=Math.cos(t*=mt);Dn+=(n*Math.cos(e)-Dn)/_n;Pn+=(n*Math.sin(e)-Pn)/_n;Hn+=(Math.sin(t)-Hn)/_n}function Fn(){var e,t;Mn=1;In();Mn=2;var n=Bn.point;Bn.point=function(r,i){n(e=r,t=i)};Bn.lineEnd=function(){Bn.point(e,t);qn();Bn.lineEnd=qn}}function In(){function r(r,i){r*=mt;var s=Math.cos(i*=mt),o=s*Math.cos(r),u=s*Math.sin(r),a=Math.sin(i),f=Math.atan2(Math.sqrt((f=t*a-n*u)*f+(f=n*o-e*a)*f+(f=e*u-t*o)*f),e*o+t*u+n*a);_n+=f;Dn+=f*(e+(e=o));Pn+=f*(t+(t=u));Hn+=f*(n+(n=a))}var e,t,n;if(Mn>1)return;if(Mn<1){Mn=1;_n=Dn=Pn=Hn=0}Bn.point=function(i,s){i*=mt;var o=Math.cos(s*=mt);e=o*Math.cos(i);t=o*Math.sin(i);n=Math.sin(s);Bn.point=r}}function qn(){Bn.point=jn}function Rn(e){var t=e[0],n=e[1],r=Math.cos(n);return[r*Math.cos(t),r*Math.sin(t),Math.sin(n)]}function Un(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zn(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Wn(e,t){e[0]+=t[0];e[1]+=t[1];e[2]+=t[2]}function Xn(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Vn(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t;e[1]/=t;e[2]/=t}function $n(){return true}function Jn(e){return[Math.atan2(e[1],e[0]),Math.asin(Math.max(-1,Math.min(1,e[2])))]}function Kn(e,t){return Math.abs(e[0]-t[0])=0;)i.point((p=h[u])[0],p[1])}else{r(c.point,c.prev.point,-1,i)}c=c.prev}c=c.other;h=c.points}while(!c.visited);i.lineEnd()}}function Gn(e){if(!(t=e.length))return;var t,n=0,r=e[0],i;while(++n1&&e&2)t.push(t.pop().concat(t.shift()));c.push(t.filter(Zn))}var s=n(i);var o={point:u,lineStart:f,lineEnd:l,polygonStart:function(){o.point=y;o.lineStart=b;o.lineEnd=w;d=false;p=h=0;c=[];i.polygonStart()},polygonEnd:function(){o.point=u;o.lineStart=f;o.lineEnd=l;c=e.merge(c);if(c.length){Qn(c,nr,null,r,i)}else if(h<-vt||d&&p<-vt){i.lineStart();r(null,null,1,i);i.lineEnd()}i.polygonEnd();c=null},sphere:function(){i.polygonStart();i.lineStart();r(null,null,1,i);i.lineEnd();i.polygonEnd()}};var c,h,p,d;var v=er(),m=n(v),g;return o}}function Zn(e){return e.length>1}function er(){var e=[],t;return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:G,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){if(e.length>1)e.push(e.pop().concat(e.shift()))}}}function tr(e,t){if(!(n=e.length))return 0;var n,r=0,i=0,s=e[0],o=s[0],u=s[1],a=Math.cos(u),f=Math.atan2(t*Math.sin(o)*a,Math.sin(u)),l=1-t*Math.cos(o)*a,c=f,h,p;while(++r2)i+=4*(h-f)}else if(Math.abs(l-2)0?dt:-dt,a=Math.abs(s-t);if(Math.abs(a-dt)0?dt/2:-dt/2);e.point(r,n);e.lineEnd();e.lineStart();e.point(u,n);e.point(s,n);i=0}else if(r!==u&&a>=dt){if(Math.abs(t-r)vt?Math.atan((Math.sin(t)*(s=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(t))*Math.sin(e))/(i*s*o)):(t+r)/2}function or(e,t,n,r){var i;if(e==null){i=n*dt/2;r.point(-dt,i);r.point(0,i);r.point(dt,i);r.point(dt,0);r.point(dt,-i);r.point(0,-i);r.point(-dt,-i);r.point(-dt,0);r.point(-dt,i)}else if(Math.abs(e[0]-t[0])>vt){var s=(e[0]t}function o(e){var t,i,o,f,l;return{lineStart:function(){f=o=false;l=1},point:function(c,h){var p=[c,h],d,v=s(c,h),m=n?v?0:a(c,h):v?a(c+(c<0?dt:-dt),h):0;if(!t&&(f=o=v))e.lineStart();if(v!==o){d=u(t,p);if(Kn(t,d)||Kn(p,d)){p[0]+=vt;p[1]+=vt;v=s(p[0],p[1])}}if(v!==o){l=0;if(v){e.lineStart();d=u(p,t);e.point(d[0],d[1])}else{d=u(t,p);e.point(d[0],d[1]);e.lineEnd()}t=d}else if(r&&t&&n^v){var g;if(!(m&i)&&(g=u(p,t,true))){l=0;if(n){e.lineStart();e.point(g[0][0],g[0][1]);e.point(g[1][0],g[1][1]);e.lineEnd()}else{e.point(g[1][0],g[1][1]);e.lineEnd();e.lineStart();e.point(g[0][0],g[0][1])}}}if(v&&(!t||!Kn(t,p))){e.point(p[0],p[1])}t=p,o=v,i=m},lineEnd:function(){if(o)e.lineEnd();t=null},clean:function(){return l|(f&&o)<<1}}}function u(e,n,r){var i=Rn(e),s=Rn(n);var o=[1,0,0],u=zn(i,s),a=Un(u,u),f=u[0],l=a-f*f;if(!l)return!r&&e;var c=t*a/l,h=-t*f/l,p=zn(o,u),d=Xn(o,c),v=Xn(u,h);Wn(d,v);var m=p,g=Un(d,m),y=Un(m,m),b=g*g-y*(Un(d,d)-1);if(b<0)return;var w=Math.sqrt(b),E=Xn(m,(-g-w)/y);Wn(E,d);E=Jn(E);if(!r)return E;var S=e[0],x=n[0],T=e[1],N=n[1],C;if(x0^E[1]<(Math.abs(E[0]-S)dt^(S<=E[0]&&E[0]<=x)){var O=Xn(m,(-g+w)/y);Wn(O,d);return[E,Jn(O)]}}function a(t,r){var i=n?e:dt-e,s=0;if(t<-i)s|=1;else if(t>i)s|=2;if(r<-i)s|=4;else if(r>i)s|=8;return s}var t=Math.cos(e),n=t>0,r=Math.abs(t)>vt,i=Er(e,6*mt);return Yn(s,o,i)}function fr(t,n,r,i){function s(e,i){return Math.abs(e[0]-t)0?0:3:Math.abs(e[0]-r)0?2:1:Math.abs(e[1]-n)0?1:0:i>0?3:2}function o(e,t){return u(e.point,t.point)}function u(e,t){var n=s(e,1),r=s(t,1);return n!==r?n-r:n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]}function a(e,s){var o=s[0]-e[0],u=s[1]-e[1],a=[0,1];if(Math.abs(o)0){e[0]+=a[0]*o;e[1]+=a[0]*u}return true}return false}return function(f){function m(e){var o=s(e,-1),u=g([o===0||o===3?t:r,o>1?i:n]);return u}function g(e){var t=0,n=p.length,r=e[1];for(var i=0;ir&&y(a,b,e)>0)++t}else{if(b[1]<=r&&y(a,b,e)<0)--t}a=b}}return t!==0}function y(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}function w(e,o,a,f){var l=0,c=0;if(e==null||(l=s(e,a))!==(c=s(o,a))||u(e,o)<0^a>0){do{f.point(l===0||l===3?t:r,l>1?i:n)}while((l=(l+a+4)%4)!==c)}else{f.point(o[0],o[1])}}function E(e,s){return t<=e&&e<=r&&n<=s&&s<=i}function S(e,t){if(E(e,t))f.point(e,t)}function O(){v.point=_;if(p)p.push(d=[]);A=true;L=false;C=k=NaN}function M(){if(h){_(x,T);if(N&&L)c.rejoin();h.push(c.buffer())}v.point=S;if(L)f.lineEnd()}function _(e,t){e=Math.max(-ar,Math.min(ar,e));t=Math.max(-ar,Math.min(ar,t));var n=E(e,t);if(p)d.push([e,t]);if(A){x=e,T=t,N=n;A=false;if(n){f.lineStart();f.point(e,t)}}else{if(n&&L)f.point(e,t);else{var r=[C,k],i=[e,t];if(a(r,i)){if(!L){f.lineStart();f.point(r[0],r[1])}f.point(i[0],i[1]);if(!n)f.lineEnd()}else{f.lineStart();f.point(e,t)}}}C=e,k=t,L=n}var l=f,c=er(),h,p,d;var v={point:S,lineStart:O,lineEnd:M,polygonStart:function(){f=c;h=[];p=[]},polygonEnd:function(){f=l;if((h=e.merge(h)).length){f.polygonStart();Qn(h,o,m,w,f);f.polygonEnd()}else if(g([t,n])){f.polygonStart(),f.lineStart();w(null,null,1,f);f.lineEnd(),f.polygonEnd()}h=p=d=null}};var x,T,N,C,k,L,A;return v}}function lr(e,t,n){if(Math.abs(t)0){if(r>n[1])return false;if(r>n[0])n[0]=r}else{if(r4*t&&v--){var w=o+h,E=u+p,S=a+d,x=Math.sqrt(w*w+E*E+S*S),T=Math.asin(S/=x),N=Math.abs(Math.abs(S)-1)t||Math.abs((g*A+y*O)/b-.5)>.3){i(n,r,s,o,u,a,k,L,N,w/=x,E/=x,S,v,m);m.point(k,L);i(k,L,N,w,E,S,f,l,c,h,p,d,v,m)}}}var t=.5,n=16;r.precision=function(e){if(!arguments.length)return Math.sqrt(t);n=(t=e*e)>0&&16;return r};return r}function pr(e){return dr(function(){return e})()}function dr(t){function w(e){e=i(e[0]*mt,e[1]*mt);return[e[0]*o+d,v-e[1]*o]}function E(e){e=i.invert((e[0]-d)/o,(v-e[1])/o);return e&&[e[0]*gt,e[1]*gt]}function S(){i=cr(r=gr(c,h,p),n);var e=n(f,l);d=u-e[0]*o;v=a+e[1]*o;return w}var n,r,i,s=hr(function(e,t){e=n(e,t);return[e[0]*o+d,v-e[1]*o]}),o=150,u=480,a=250,f=0,l=0,c=0,h=0,p=0,d,v,m=rr,g=Gt,y=null,b=null;w.stream=function(e){return vr(r,m(s(g(e))))};w.clipAngle=function(e){if(!arguments.length)return y;m=e==null?(y=e,rr):ur((y=+e)*mt);return w};w.clipExtent=function(e){if(!arguments.length)return b;b=e;g=e==null?Gt:fr(e[0][0],e[0][1],e[1][0],e[1][1]);return w};w.scale=function(e){if(!arguments.length)return o;o=+e;return S()};w.translate=function(e){if(!arguments.length)return[u,a];u=+e[0];a=+e[1];return S()};w.center=function(e){if(!arguments.length)return[f*gt,l*gt];f=e[0]%360*mt;l=e[1]%360*mt;return S()};w.rotate=function(e){if(!arguments.length)return[c*gt,h*gt,p*gt];c=e[0]%360*mt;h=e[1]%360*mt;p=e.length>2?e[2]%360*mt:0;return S()};e.rebind(w,s,"precision");return function(){n=t.apply(this,arguments);w.invert=n.invert&&E;return S()}}function vr(e,t){return{point:function(n,r){r=e(n*mt,r*mt),n=r[0];t.point(n>dt?n-2*dt:n<-dt?n+2*dt:n,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function mr(e,t){return[e,t]}function gr(e,t,n){return e?t||n?cr(br(e),wr(t,n)):br(e):t||n?wr(t,n):mr}function yr(e){return function(t,n){return t+=e,[t>dt?t-2*dt:t<-dt?t+2*dt:t,n]}}function br(e){var t=yr(e);t.invert=yr(-e);return t}function wr(e,t){function o(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*n+u*r;return[Math.atan2(a*i-l*s,u*n-f*r),Math.asin(Math.max(-1,Math.min(1,l*i+a*s)))]}var n=Math.cos(e),r=Math.sin(e),i=Math.cos(t),s=Math.sin(t);o.invert=function(e,t){var o=Math.cos(t),u=Math.cos(e)*o,a=Math.sin(e)*o,f=Math.sin(t),l=f*i-a*s;return[Math.atan2(a*i+f*s,u*n+l*r),Math.asin(Math.max(-1,Math.min(1,l*n-u*r)))]};return o}function Er(e,t){var n=Math.cos(e),r=Math.sin(e);return function(i,s,o,u){if(i!=null){i=Sr(n,i);s=Sr(n,s);if(o>0?is)i+=o*2*dt}else{i=e+o*2*dt;s=e}var a;for(var f=o*t,l=i;o>0?l>s:l1){u=t[1];s=e[a];a++;r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(s[0]-u[0])+","+(s[1]-u[1])+","+s[0]+","+s[1];for(var f=2;f9){s=n*3/Math.sqrt(s);o[u]=s*r;o[u+1]=s*i}}}u=-1;while(++u<=a){s=(e[Math.min(a,u+1)][0]-e[Math.max(0,u-1)][0])/(6*(1+o[u]*o[u]));t.push([s||0,o[u]*s||0])}return t}function Ai(e){return e.length<3?ai(e):e[0]+vi(e,Li(e))}function Oi(e,t,n,r){var i,s,o,u,a,f,l;i=r[e];s=i[0];o=i[1];i=r[t];u=i[0];a=i[1];i=r[n];f=i[0];l=i[1];return(l-o)*(u-s)-(a-o)*(f-s)>0}function Mi(e,t,n){return(n[0]-t[0])*(e[1]-t[1])<(n[1]-t[1])*(e[0]-t[0])}function _i(e,t,n,r){var i=e[0],s=n[0],o=t[0]-i,u=r[0]-s,a=e[1],f=n[1],l=t[1]-a,c=r[1]-f,h=(u*(a-f)-c*(i-s))/(c*o-u*l);return[i+h*o,a+h*l]}function Pi(e,t){var n={list:e.map(function(e,t){return{index:t,x:e[0],y:e[1]}}).sort(function(e,t){return e.yt.y?1:e.xt.x?1:0}),bottomSite:null};var r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l");r.rightEnd=r.createHalfEdge(null,"l");r.leftEnd.r=r.rightEnd;r.rightEnd.l=r.leftEnd;r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(e,t){return{edge:e,side:t,vertex:null,l:null,r:null}},insert:function(e,t){t.l=e;t.r=e.r;e.r.l=t;e.r=t},leftBound:function(e){var t=r.leftEnd;do{t=t.r}while(t!=r.rightEnd&&i.rightOf(t,e));t=t.l;return t},del:function(e){e.l.r=e.r;e.r.l=e.l;e.edge=null},right:function(e){return e.r},left:function(e){return e.l},leftRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[e.side]},rightRegion:function(e){return e.edge==null?n.bottomSite:e.edge.region[Di[e.side]]}};var i={bisect:function(e,t){var n={region:{l:e,r:t},ep:{l:null,r:null}};var r=t.x-e.x,i=t.y-e.y,s=r>0?r:-r,o=i>0?i:-i;n.c=e.x*r+e.y*i+(r*r+i*i)*.5;if(s>o){n.a=1;n.b=i/r;n.c/=r}else{n.b=1;n.a=r/i;n.c/=i}return n},intersect:function(e,t){var n=e.edge,r=t.edge;if(!n||!r||n.region.r==r.region.r){return null}var i=n.a*r.b-n.b*r.a;if(Math.abs(i)<1e-10){return null}var s=(n.c*r.b-r.c*n.b)/i,o=(r.c*n.a-n.c*r.a)/i,u=n.region.r,a=r.region.r,f,l;if(u.y=l.region.r.x;if(c&&f.side==="l"||!c&&f.side==="r"){return null}return{x:s,y:o}},rightOf:function(e,t){var n=e.edge,r=n.region.r,i=t.x>r.x;if(i&&e.side==="l"){return 1}if(!i&&e.side==="r"){return 0}if(n.a===1){var s=t.y-r.y,o=t.x-r.x,u=0,a=0;if(!i&&n.b<0||i&&n.b>=0){a=u=s>=n.b*o}else{a=t.x+t.y*n.b>n.c;if(n.b<0){a=!a}if(!a){u=1}}if(!u){var f=r.x-n.region.l.x;a=n.b*(o*o-s*s)h*h+p*p}return e.side==="l"?a:!a},endPoint:function(e,n,r){e.ep[n]=r;if(!e.ep[Di[n]])return;t(e)},distance:function(e,t){var n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}};var s={list:[],insert:function(e,t,n){e.vertex=t;e.ystar=t.y+n;for(var r=0,i=s.list,o=i.length;ru.ystar||e.ystar==u.ystar&&t.x>u.vertex.x){continue}else{break}}i.splice(r,0,e)},del:function(e){for(var t=0,n=s.list,r=n.length;td.y){v=p;p=d;d=v;b="r"}y=i.bisect(p,d);h=r.createHalfEdge(y,b);r.insert(l,h);i.endPoint(y,Di[b],g);m=i.intersect(l,h);if(m){s.del(l);s.insert(l,m,i.distance(m,p))}m=i.intersect(h,c);if(m){s.insert(h,m,i.distance(m,p))}}else{break}}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a)){t(a.edge)}}function Hi(e){return e.x}function Bi(e){return e.y}function ji(){return{leaf:true,nodes:[],point:null,x:null,y:null}}function Fi(e,t,n,r,i,s){if(!e(t,n,r,i,s)){var o=(n+i)*.5,u=(r+s)*.5,a=t.nodes;if(a[0])Fi(e,a[0],n,r,o,u);if(a[1])Fi(e,a[1],o,r,i,u);if(a[2])Fi(e,a[2],n,u,o,s);if(a[3])Fi(e,a[3],o,u,i,s)}}function Ii(t,n){t=e.rgb(t);n=e.rgb(n);var r=t.r,i=t.g,s=t.b,o=n.r-r,u=n.g-i,a=n.b-s;return function(e){return"#"+zt(Math.round(r+o*e))+zt(Math.round(i+u*e))+zt(Math.round(s+a*e))}}function qi(e){var t=[e.a,e.b],n=[e.c,e.d],r=Ui(t),i=Ri(t,n),s=Ui(zi(n,t,-i))||0;if(t[0]*n[1]180)c+=360;else if(c-l>180)l+=360;i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Xi(l,c)})}else if(c){r.push(r.pop()+"rotate("+c+")")}if(h!=p){i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Xi(h,p)})}else if(p){r.push(r.pop()+"skewX("+p+")")}if(d[0]!=v[0]||d[1]!=v[1]){s=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:s-4,x:Xi(d[0],v[0])},{i:s-2,x:Xi(d[1],v[1])})}else if(v[0]!=1||v[1]!=1){r.push(r.pop()+"scale("+v+")")}s=i.length;return function(e){var t=-1,n;while(++t=0&&!(i=e.interpolators[r](t,n)));return i}function Gi(e){return e=="transform"?Vi:Qi}function Yi(e,t){var n=[],r=[],i=e.length,s=t.length,o=Math.min(e.length,t.length),u;for(u=0;u=1?1:e(t)}}function rs(e){return function(t){return 1-e(1-t)}}function is(e){return function(t){return.5*(t<.5?e(2*t):2-e(2-2*t))}}function ss(e){return e*e}function os(e){return e*e*e}function us(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function as(e){return function(t){return Math.pow(t,e)}}function fs(e){return 1-Math.cos(e*dt/2)}function ls(e){return Math.pow(2,10*(e-1))}function cs(e){return 1-Math.sqrt(1-e*e)}function hs(e,t){var n;if(arguments.length<2)t=.45;if(arguments.length)n=t/(2*dt)*Math.asin(1/e);else e=1,n=t/4;return function(r){return 1+e*Math.pow(2,10*-r)*Math.sin((r-n)*2*dt/t)}}function ps(e){if(!e)e=1.70158;return function(t){return t*t*((e+1)*t-e)}}function ds(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function vs(t,n){t=e.hcl(t);n=e.hcl(n);var r=t.h,i=t.c,s=t.l,o=n.h-r,u=n.c-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return kt(r+o*e,i+u*e,s+a*e)+""}}function ms(t,n){t=e.hsl(t);n=e.hsl(n);var r=t.h,i=t.s,s=t.l,o=n.h-r,u=n.s-i,a=n.l-s;if(o>180)o-=360;else if(o<-180)o+=360;return function(e){return pt(r+o*e,i+u*e,s+a*e)+""}}function gs(t,n){t=e.lab(t);n=e.lab(n);var r=t.l,i=t.a,s=t.b,o=n.l-r,u=n.a-i,a=n.b-s;return function(e){return Ht(r+o*e,i+u*e,s+a*e)+""}}function ys(e,t){t-=e;return function(n){return Math.round(e+t*n)}}function bs(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return(n-e)*t}}function ws(e,t){t=t-(e=+e)?1/(t-e):0;return function(n){return Math.max(0,Math.min(1,(n-e)*t))}}function Es(e){var t=e.source,n=e.target,r=xs(t,n),i=[t];while(t!==r){t=t.parent;i.push(t)}var s=i.length;while(n!==r){i.splice(s,0,n);n=n.parent}return i}function Ss(e){var t=[],n=e.parent;while(n!=null){t.push(e);e=n;n=n.parent}t.push(e);return t}function xs(e,t){if(e===t)return e;var n=Ss(e),r=Ss(t),i=n.pop(),s=r.pop(),o=null;while(i===s){o=i;i=n.pop();s=r.pop()}return o}function Ts(e){e.fixed|=2}function Ns(e){e.fixed&=~6}function Cs(e){e.fixed|=4;e.px=e.x,e.py=e.y}function ks(e){e.fixed&=~4}function Ls(e,t,n){var r=0,i=0;e.charge=0;if(!e.leaf){var s=e.nodes,o=s.length,u=-1,a;while(++ur){n=t;r=i}}return n}function Xs(e){return e.reduce(Vs,0)}function Vs(e,t){return e+t[1]}function $s(e,t){return Js(e,Math.ceil(Math.log(t.length)/Math.LN2+1))}function Js(e,t){var n=-1,r=+e[0],i=(e[1]-r)/t,s=[];while(++n<=t)s[n]=i*n+r;return s}function Ks(t){return[e.min(t),e.max(t)]}function Qs(e,t){return e.parent==t.parent?1:2}function Gs(e){var t=e.children;return t&&t.length?t[0]:e._tree.thread}function Ys(e){var t=e.children,n;return t&&(n=t.length)?t[n-1]:e._tree.thread}function Zs(e,t){var n=e.children;if(n&&(i=n.length)){var r,i,s=-1;while(++s0){e=r}}}return e}function eo(e,t){return e.x-t.x}function to(e,t){return t.x-e.x}function no(e,t){return e.depth-t.depth}function ro(e,t){function n(e,r){var i=e.children;if(i&&(a=i.length)){var s,o=null,u=-1,a;while(++u=0){s=r[i]._tree;s.prelim+=t;s.mod+=t;t+=s.shift+(n+=s.change)}}function so(e,t,n){e=e._tree;t=t._tree;var r=n/(t.number-e.number);e.change+=r;t.change-=r;t.shift+=n;t.prelim+=n;t.mod+=n}function oo(e,t,n){return e._tree.ancestor.parent==t.parent?e._tree.ancestor:n}function uo(e,t){return e.value-t.value}function ao(e,t){var n=e._pack_next;e._pack_next=t;t._pack_prev=e;t._pack_next=n;n._pack_prev=t}function fo(e,t){e._pack_next=t;t._pack_prev=e}function lo(e,t){var n=t.x-e.x,r=t.y-e.y,i=e.r+t.r;return i*i-n*n-r*r>.001}function co(e){function p(e){n=Math.min(e.x-e.r,n);r=Math.max(e.x+e.r,r);i=Math.min(e.y-e.r,i);s=Math.max(e.y+e.r,s)}if(!(t=e.children)||!(h=t.length))return;var t,n=Infinity,r=-Infinity,i=Infinity,s=-Infinity,o,u,a,f,l,c,h;t.forEach(ho);o=t[0];o.x=-o.r;o.y=0;p(o);if(h>1){u=t[1];u.x=u.r;u.y=0;p(u);if(h>2){a=t[2];mo(o,u,a);p(a);ao(o,a);o._pack_prev=a;ao(a,u);u=o._pack_next;for(f=3;f2?ko:No,a=r?ws:bs;i=o(e,t,a,n);s=o(t,e,a,Qi);return u}function u(e){return i(e)}var i,s;u.invert=function(e){return s(e)};u.domain=function(t){if(!arguments.length)return e;e=t.map(Number);return o()};u.range=function(e){if(!arguments.length)return t;t=e;return o()};u.rangeRound=function(e){return u.range(e).interpolate(ys)};u.clamp=function(e){if(!arguments.length)return r;r=e;return o()};u.interpolate=function(e){if(!arguments.length)return n;n=e;return o()};u.ticks=function(t){return _o(e,t)};u.tickFormat=function(t,n){return Do(e,t,n)};u.nice=function(){Co(e,Oo);return o()};u.copy=function(){return Lo(e,t,n,r)};return o()}function Ao(t,n){return e.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Oo(e){e=Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1);return e&&{floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}}}function Mo(e,t){var n=xo(e),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),s=t/r*i;if(s<=.15)i*=10;else if(s<=.35)i*=5;else if(s<=.75)i*=2;n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+i*.5;n[2]=i;return n}function _o(t,n){return e.range.apply(e,Mo(t,n))}function Do(t,n,r){var i=-Math.floor(Math.log(Mo(t,n)[2])/Math.LN10+.01);return e.format(r?r.replace(dn,function(e,t,n,r,s,o,u,a,f,l){return[t,n,r,s,o,u,a,f||"."+(i-(l==="%")*2),l].join("")}):",."+i+"f")}function Po(e,t,n,r){function i(t){return e(n(t))}i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);if(t[0]<0)n=Fo,r=Io;else n=Bo,r=jo;e.domain(t.map(n));return i};i.base=function(e){if(!arguments.length)return t;t=+e;return i};i.nice=function(){e.domain(Co(e.domain(),qo(t)));return i};i.ticks=function(){var i=xo(e.domain()),s=[];if(i.every(isFinite)){var o=Math.log(t),u=Math.floor(i[0]/o),a=Math.ceil(i[1]/o),f=r(i[0]),l=r(i[1]),c=t%1?2:t;if(n===Fo){s.push(-Math.pow(t,-u));for(;u++0;h--)s.push(-Math.pow(t,-u)*h)}else{for(;ul;a--){}s=s.slice(u,a)}return s};i.tickFormat=function(e,s){if(arguments.length<2)s=Ho;if(!arguments.length)return s;var o=Math.log(t),u=Math.max(.1,e/i.ticks().length),a=n===Fo?(f=-1e-12,Math.floor):(f=1e-12,Math.ceil),f;return function(e){return e/r(o*a(n(e)/o+f))<=u?s(e):""}};i.copy=function(){return Po(e.copy(),t,n,r)};return Ao(i,e)}function Bo(e){return Math.log(e<0?0:e)}function jo(e){return Math.exp(e)}function Fo(e){return-Math.log(e>0?0:-e)}function Io(e){return-Math.exp(-e)}function qo(e){e=Math.log(e);var t={floor:function(t){return Math.floor(t/e)*e},ceil:function(t){return Math.ceil(t/e)*e}};return function(){return t}}function Ro(e,t){function i(t){return e(n(t))}var n=Uo(t),r=Uo(1/t);i.invert=function(t){return r(e.invert(t))};i.domain=function(t){if(!arguments.length)return e.domain().map(r);e.domain(t.map(n));return i};i.ticks=function(e){return _o(i.domain(),e)};i.tickFormat=function(e,t){return Do(i.domain(),e,t)};i.nice=function(){return i.domain(Co(i.domain(),Oo))};i.exponent=function(e){if(!arguments.length)return t;var s=i.domain();n=Uo(t=e);r=Uo(1/t);return i.domain(s)};i.copy=function(){return Ro(e.copy(),t)};return Ao(i,e)}function Uo(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function zo(t,n){function o(e){return i[((r.get(e)||r.set(e,t.push(e)))-1)%i.length]}function u(n,r){return e.range(t.length).map(function(e){return n+r*e})}var r,i,s;o.domain=function(e){if(!arguments.length)return t;t=[];r=new c;var i=-1,s=e.length,u;while(++ir)return m();s.active=r;l.start.call(t,a,n);o.tween.forEach(function(e,r){if(r=r.call(t,a,n)){p.push(r)}});if(!v(i))e.timer(v,0,u);return 1}function v(e){if(s.active!==r)return m();var i=(e-c)/h,o=f(i),u=p.length;while(u>0){p[--u].call(t,o)}if(i>=1){m();l.end.call(t,a,n);return 1}}function m(){if(--s.count)delete s[r];else delete t.__transition__;return 1}var a=t.__data__,f=o.ease,l=o.event,c=o.delay,h=o.duration,p=[];return c<=i?d(i):e.timer(d,c,u),1},0,u);return o}}function Cu(e,t){e.attr("transform",function(e){return"translate("+t(e)+",0)"})}function ku(e,t){e.attr("transform",function(e){return"translate(0,"+t(e)+")"})}function Lu(e,t,n){i=[];if(n&&t.length>1){var r=xo(e.domain()),i,s=-1,o=t.length,u=(t[1]-t[0])/++n,a,f;while(++s0;){if((f=+t[s]-a*u)>=r[0]){i.push(f)}}}for(--s,a=0;++a1?Date.UTC.apply(this,arguments):arguments[0])}function Uu(e,t,n){function r(t){var n=e(t),r=s(n,1);return t-n1){while(o=a)return-1;i=t.charCodeAt(o++);if(i===37){s=na[t.charAt(o++)];if(!s||(r=s(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++)){return-1}}return r}function Xu(t){return new RegExp("^(?:"+t.map(e.requote).join("|")+")","i")}function Vu(e){var t=new c,n=-1,r=e.length;while(++n68?1900:2e3)}function pa(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.m=r[0]-1,n+=r[0].length):-1}function da(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.d=+r[0],n+=r[0].length):-1}function va(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.H=+r[0],n+=r[0].length):-1}function ma(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.M=+r[0],n+=r[0].length):-1}function ga(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+2));return r?(e.S=+r[0],n+=r[0].length):-1}function ya(e,t,n){ba.lastIndex=0;var r=ba.exec(t.substring(n,n+3));return r?(e.L=+r[0],n+=r[0].length):-1}function wa(e,t,n){var r=Ea.get(t.substring(n,n+=2).toLowerCase());return r==null?-1:(e.p=r,n)}function Sa(e){var t=e.getTimezoneOffset(),n=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return n+$u(r,"0",2)+$u(i,"0",2)}function Ta(e){return e.toISOString()}function Na(t,n,r){function i(e){return t(e)}i.invert=function(e){return ka(t.invert(e))};i.domain=function(e){if(!arguments.length)return t.domain().map(ka);t.domain(e);return i};i.nice=function(e){return i.domain(Co(i.domain(),function(){return e}))};i.ticks=function(r,s){var o=Ca(i.domain());if(typeof r!=="function"){var u=o[1]-o[0],a=u/r,f=e.bisect(Ma,a);if(f==Ma.length)return n.year(o,r);if(!f)return t.ticks(r).map(ka);if(Math.log(a/Ma[f-1])t?1:e>=t?0:NaN};e.descending=function(e,t){return te?1:t>=e?0:NaN};e.min=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ns)i=s}else{while(++ns)i=s}return i};e.max=function(e,t){var n=-1,r=e.length,i,s;if(arguments.length===1){while(++ni)i=s}else{while(++ni)i=s}return i};e.extent=function(e,t){var n=-1,r=e.length,i,s,o;if(arguments.length===1){while(++ns)i=s;if(os)i=s;if(o1)t=t.map(n);t=t.filter(o);return t.length?e.quantile(t.sort(e.ascending),.5):undefined};e.bisector=function(e){return{left:function(t,n,r,i){if(arguments.length<3)r=0;if(arguments.length<4)i=t.length;while(r>>1;if(e.call(t,t[s],s)>>1;if(nt)r.push(o/i);else while((o=e+n*++s)=n.length)return s?s.call(t,r):i?r.sort(i):r;var a=-1,f=r.length,l=n[u++],h,p,d,v=new c,m;while(++a=n.length)return e;var i=[],s=r[t++];e.forEach(function(e,n){i.push({key:e,values:u(n,t)})});return s?i.sort(function(e,t){return s(e.key,t.key)}):i}var t={},n=[],r=[],i,s;t.map=function(e,t){return o(t,e,0)};t.entries=function(t){return u(o(e.map,t,0),0)};t.key=function(e){n.push(e);return t};t.sortKeys=function(e){r[n.length-1]=e;return t};t.sortValues=function(e){i=e;return t};t.rollup=function(e){s=e;return t};return t};e.set=function(e){var t=new d;if(e)for(var n=0;n=0){r=e.substring(n+1);e=e.substring(0,n)}if(e)return arguments.length<2?this[e].on(r):this[e].on(r,t);if(arguments.length===2){if(t==null)for(e in this){if(this.hasOwnProperty(e))this[e].on(r,null)}return this}};e.event=null;e.mouse=function(e){return T(e,w())};var x=/WebKit/.test(n.navigator.userAgent)?-1:0;var N=k;try{N(t.documentElement.childNodes)[0].nodeType}catch(L){N=C}var A=[].__proto__?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)e[n]=t[n]};e.touches=function(e,t){if(arguments.length<2)t=w().touches;return t?N(t).map(function(t){var n=T(e,t);n.identifier=t.identifier;return n}):[]};e.behavior.drag=function(){function i(){this.on("mousedown.drag",s).on("touchstart.drag",s)}function s(){function h(){var t=i.parentNode;return u!=null?e.touches(t).filter(function(e){return e.identifier===u})[0]:e.mouse(t)}function p(){if(!i.parentNode)return d();var e=h(),t=e[0]-f[0],n=e[1]-f[1];l|=t|n;f=e;y();s({type:"drag",x:e[0]+a[0],y:e[1]+a[1],dx:t,dy:n})}function d(){s({type:"dragend"});if(l){y();if(e.event.target===o)E(c,"click")}c.on(u!=null?"touchmove.drag-"+u:"mousemove.drag",null).on(u!=null?"touchend.drag-"+u:"mouseup.drag",null)}var i=this,s=t.of(i,arguments),o=e.event.target,u=e.event.touches?e.event.changedTouches[0].identifier:null,a,f=h(),l=0;var c=e.select(n).on(u!=null?"touchmove.drag-"+u:"mousemove.drag",p).on(u!=null?"touchend.drag-"+u:"mouseup.drag",d,true);if(r){a=r.apply(i,arguments);a=[a.x-f[0],a.y-f[1]]}else{a=[0,0]}if(u==null)y();s({type:"dragstart"})}var t=S(i,"drag","dragstart","dragend"),r=null;i.origin=function(e){if(!arguments.length)return r;r=e;return i};return e.rebind(i,t,"on")};var M=function(e,t){return t.querySelector(e)},_=function(e,t){return t.querySelectorAll(e)},D=t.documentElement,P=D.matchesSelector||D.webkitMatchesSelector||D.mozMatchesSelector||D.msMatchesSelector||D.oMatchesSelector,H=function(e,t){return P.call(e,t)};if(typeof Sizzle==="function"){M=function(e,t){return Sizzle(e,t)[0]||null};_=function(e,t){return Sizzle.uniqueSort(Sizzle(e,t))};H=Sizzle.matchesSelector}var B=[];e.selection=function(){return st};e.selection.prototype=B;B.select=function(e){var t=[],n,r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o=0){n=e.substring(0,t);e=e.substring(t+1)}return I.hasOwnProperty(n)?{space:I[n],local:e}:e}};B.attr=function(t,n){if(arguments.length<2){if(typeof t==="string"){var r=this.node();t=e.ns.qualify(t);return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))};e.requote=function(e){return e.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;B.classed=function(e,t){if(arguments.length<2){if(typeof e==="string"){var n=this.node(),r=(e=e.trim().split(/^|\s+/g)).length,i=-1;if(t=n.classList){while(++i=0;){if(s=n[r]){if(i&&i!==s.nextSibling)i.parentNode.insertBefore(s,i);i=s}}}return this};B.sort=function(e){e=Q.apply(this,arguments);for(var t=-1,n=this.length;++t=200&&e<300||e===304?o.load.call(s,a.call(s,f)):o.error.call(s,f)}var s={},o=e.dispatch("progress","load","error"),u={},a=Gt,f=new(n.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);"onload"in f?f.onload=f.onerror=l:f.onreadystatechange=function(){f.readyState>3&&l()};f.onprogress=function(t){var n=e.event;e.event=t;try{o.progress.call(s,f)}finally{e.event=n}};s.header=function(e,t){e=(e+"").toLowerCase();if(arguments.length<2)return u[e];if(t==null)delete u[e];else u[e]=t+"";return s};s.mimeType=function(e){if(!arguments.length)return r;r=e==null?null:e+"";return s};s.response=function(e){a=e;return s};["get","post"].forEach(function(e){s[e]=function(){return s.send.apply(s,[e].concat(N(arguments)))}});s.send=function(e,n,i){if(arguments.length===2&&typeof n==="function")i=n,n=null;f.open(e,t,true);if(r!=null&&!("accept"in u))u["accept"]=r+",*/*";if(f.setRequestHeader)for(var o in u)f.setRequestHeader(o,u[o]);if(r!=null&&f.overrideMimeType)f.overrideMimeType(r);if(i!=null)s.on("error",i).on("load",function(e){i(null,e)});f.send(n==null?null:n);return s};s.abort=function(){f.abort();return s};e.rebind(s,o,"on");if(arguments.length===2&&typeof r==="function")i=r,r=null;return i==null?s:s.get(Yt(i))};e.csv=Zt(",","text/csv");e.tsv=Zt(" ","text/tab-separated-values");var en=0,tn={},nn=null,rn,sn;e.timer=function(e,t,n){if(arguments.length<3){if(arguments.length<2)t=0;else if(!isFinite(t))return;n=Date.now()}var r=tn[e.id];if(r&&r.callback===e){r.then=n;r.delay=t}else tn[e.id=++en]=nn={callback:e,then:n,delay:t,next:nn};if(!rn){sn=clearTimeout(sn);rn=1;an(on)}};e.timer.flush=function(){var e,t=Date.now(),n=nn;while(n){e=t-n.then;if(!n.delay)n.flush=n.callback(e);n=n.next}un()};var an=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,17)};var fn=".",ln=",",cn=[3,3];var hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(pn);e.formatPrefix=function(t,n){var r=0;if(t){if(t<0)t*=-1;if(n)t=e.round(t,mn(t,n));r=1+Math.floor(1e-12+Math.log(t)/Math.LN10);r=Math.max(-24,Math.min(24,Math.floor((r<=0?r+1:r-1)/3)*3))}return hn[8+r/3]};e.round=function(e,t){return t?Math.round(e*(t=Math.pow(10,t)))/t:Math.round(e)};e.format=function(t){var n=dn.exec(t),r=n[1]||" ",i=n[2]||">",s=n[3]||"",o=n[4]||"",u=n[5],a=+n[6],f=n[7],l=n[8],c=n[9],h=1,p="",d=false;if(l)l=+l.substring(1);if(u||r==="0"&&i==="="){u=r="0";i="=";if(f)a-=Math.floor((a-1)/4)}switch(c){case"n":f=true;c="g";break;case"%":h=100;p="%";c="f";break;case"p":h=100;p="%";c="r";break;case"b":case"o":case"x":case"X":if(o)o="0"+c.toLowerCase();case"c":case"d":d=true;l=0;break;case"s":h=-1;c="r";break}if(o==="#")o="";if(c=="r"&&!l)c="g";if(l!=null){if(c=="g")l=Math.max(1,Math.min(21,l));else if(c=="e"||c=="f")l=Math.max(0,Math.min(20,l))}c=vn.get(c)||gn;var v=u&&f;return function(t){if(d&&t%1)return"";var n=t<0||t===0&&1/t<0?(t=-t,"-"):s;if(h<0){var m=e.formatPrefix(t,l);t=m.scale(t);p=m.symbol}else{t*=h}t=c(t,l);if(!u&&f)t=yn(t);var g=o.length+t.length+(v?0:n.length),y=g"?y+n+t:i==="^"?y.substring(0,g>>=1)+n+t+y.substring(g):n+(v?t:y+t))+p}};var dn=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var vn=e.map({b:function(e){return e.toString(2)},c:function(e){return String.fromCharCode(e)},o:function(e){return e.toString(8)},x:function(e){return e.toString(16)},X:function(e){return e.toString(16).toUpperCase()},g:function(e,t){return e.toPrecision(t)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},r:function(t,n){return(t=e.round(t,mn(t,n))).toFixed(Math.max(0,Math.min(20,mn(t*(1+1e-15),n))))}});var yn=Gt;if(cn){var bn=cn.length;yn=function(e){var t=e.lastIndexOf("."),n=t>=0?"."+e.substring(t+1):(t=e.length,""),r=[],i=0,s=cn[0];while(t>0&&s>0){r.push(e.substring(t-=s,t+s));s=cn[i=(i+1)%bn]}return r.reverse().join(ln||"")+n}}e.geo={};e.geo.stream=function(e,t){if(e&&En.hasOwnProperty(e.type)){En[e.type](e,t)}else{wn(e,t)}};var En={Feature:function(e,t){wn(e.geometry,t)},FeatureCollection:function(e,t){var n=e.features,r=-1,i=n.length;while(++rvt){return[Math.atan2(Pn,Dn)*gt,Math.asin(Math.max(-1,Math.min(1,Hn/n)))*gt]}};var Mn,_n,Dn,Pn,Hn;var Bn={sphere:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}},point:jn,lineStart:In,lineEnd:qn,polygonStart:function(){if(Mn<2){Mn=2;_n=Dn=Pn=Hn=0}Bn.lineStart=Fn},polygonEnd:function(){Bn.lineStart=In}};var rr=Yn($n,ir,or);var ar=1e9;e.geo.projection=pr;e.geo.projectionMutator=dr;(e.geo.equirectangular=function(){return pr(mr)}).raw=mr.invert=mr;e.geo.rotation=function(e){function t(t){t=e(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t}e=gr(e[0]%360*mt,e[1]*mt,e.length>2?e[2]*mt:0);t.invert=function(t){t=e.invert(t[0]*mt,t[1]*mt);return t[0]*=gt,t[1]*=gt,t};return t};e.geo.circle=function(){function i(){var t=typeof e==="function"?e.apply(this,arguments):e,n=gr(-t[0]*mt,-t[1]*mt,0).invert,i=[];r(null,null,1,{point:function(e,t){i.push(e=n(e,t));e[0]*=gt,e[1]*=gt}});return{type:"Polygon",coordinates:[i]}}var e=[0,0],t,n=6,r;i.origin=function(t){if(!arguments.length)return e;e=t;return i};i.angle=function(e){if(!arguments.length)return t;r=Er((t=+e)*mt,n*mt);return i};i.precision=function(e){if(!arguments.length)return n;r=Er(t*mt,(n=+e)*mt);return i};return i.angle(90)};e.geo.distance=function(e,t){var n=(t[0]-e[0])*mt,r=e[1]*mt,i=t[1]*mt,s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),a=Math.cos(r),f=Math.sin(i),l=Math.cos(i),c;return Math.atan2(Math.sqrt((c=l*s)*c+(c=a*f-u*l*o)*c),u*f+a*l*o)};e.geo.graticule=function(){function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return e.range(Math.ceil(i/c)*c,r,c).map(v).concat(e.range(Math.ceil(a/h)*h,u,h).map(m)).concat(e.range(Math.ceil(n/f)*f,t,f).filter(function(e){return Math.abs(e%c)>vt}).map(p)).concat(e.range(Math.ceil(o/l)*l,s,l).filter(function(e){return Math.abs(e%h)>vt}).map(d))}var t,n,r,i,s,o,u,a,f=10,l=f,c=90,h=360,p,d,v,m,g=2.5;y.lines=function(){return b().map(function(e){return{type:"LineString",coordinates:e}})};y.outline=function(){return{type:"Polygon",coordinates:[v(i).concat(m(u).slice(1),v(r).reverse().slice(1),m(a).reverse().slice(1))]}};y.extent=function(e){if(!arguments.length)return y.minorExtent();return y.majorExtent(e).minorExtent(e)};y.majorExtent=function(e){if(!arguments.length)return[[i,a],[r,u]];i=+e[0][0],r=+e[1][0];a=+e[0][1],u=+e[1][1];if(i>r)e=i,i=r,r=e;if(a>u)e=a,a=u,u=e;return y.precision(g)};y.minorExtent=function(e){if(!arguments.length)return[[n,o],[t,s]];n=+e[0][0],t=+e[1][0];o=+e[0][1],s=+e[1][1];if(n>t)e=n,n=t,t=e;if(o>s)e=o,o=s,s=e;return y.precision(g)};y.step=function(e){if(!arguments.length)return y.minorStep();return y.majorStep(e).minorStep(e)};y.majorStep=function(e){if(!arguments.length)return[c,h];c=+e[0],h=+e[1];return y};y.minorStep=function(e){if(!arguments.length)return[f,l];f=+e[0],l=+e[1];return y};y.precision=function(e){if(!arguments.length)return g;g=+e;p=xr(o,s,90);d=Tr(n,t,g);v=xr(a,u,90);m=Tr(i,r,g);return y};return y.majorExtent([[-180,-90+vt],[180,90-vt]]).minorExtent([[-180,-80-vt],[180,80+vt]])};e.geo.greatArc=function(){function s(){return{type:"LineString",coordinates:[n||t.apply(this,arguments),i||r.apply(this,arguments)]}}var t=Nr,n,r=Cr,i;s.distance=function(){return e.geo.distance(n||t.apply(this,arguments),i||r.apply(this,arguments))};s.source=function(e){if(!arguments.length)return t;t=e,n=typeof e==="function"?null:e;return s};s.target=function(e){if(!arguments.length)return r;r=e,i=typeof e==="function"?null:e;return s};s.precision=function(){return arguments.length?s:0};return s};e.geo.interpolate=function(e,t){return kr(e[0]*mt,e[1]*mt,t[0]*mt,t[1]*mt)};e.geo.length=function(t){Lr=0;e.geo.stream(t,Ar);return Lr};var Lr;var Ar={sphere:G,point:G,lineStart:Or,lineEnd:G,polygonStart:G,polygonEnd:G};(e.geo.conicEqualArea=function(){return Mr(_r)}).raw=_r;e.geo.albersUsa=function(){function a(e){return f(e)(e)}function f(e){var s=e[0],o=e[1];return o>50?n:s<-140?r:o<21?i:t}var t=e.geo.conicEqualArea().rotate([98,0]).center([0,38]).parallels([29.5,45.5]);var n=e.geo.conicEqualArea().rotate([160,0]).center([0,60]).parallels([55,65]);var r=e.geo.conicEqualArea().rotate([160,0]).center([0,20]).parallels([8,18]);var i=e.geo.conicEqualArea().rotate([60,0]).center([0,10]).parallels([8,18]);var s,o,u;a.invert=function(e){return s(e)||o(e)||u(e)||t.invert(e)};a.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);n.scale(e*.6);r.scale(e);i.scale(e*1.5);return a.translate(t.translate())};a.translate=function(e){if(!arguments.length)return t.translate();var f=t.scale(),l=e[0],c=e[1];t.translate(e);n.translate([l-.4*f,c+.17*f]);r.translate([l-.19*f,c+.2*f]);i.translate([l+.58*f,c+.43*f]);s=Dr(n,[[-180,50],[-130,72]]);o=Dr(r,[[-164,18],[-154,24]]);u=Dr(i,[[-67.5,17.5],[-65,19]]);return a};return a.scale(1e3)};var Pr,Hr,Br={point:G,lineStart:G,lineEnd:G,polygonStart:function(){Hr=0;Br.lineStart=jr},polygonEnd:function(){Br.lineStart=Br.lineEnd=Br.point=G;Pr+=Math.abs(Hr/2)}};var Ir={point:qr,lineStart:Rr,lineEnd:Ur,polygonStart:function(){Ir.lineStart=zr},polygonEnd:function(){Ir.point=qr;Ir.lineStart=Rr;Ir.lineEnd=Ur}};e.geo.path=function(){function o(n){if(n)e.geo.stream(n,i(s.pointRadius(typeof t==="function"?+t.apply(this,arguments):t)));return s.result()}var t=4.5,n,r,i,s;o.area=function(t){Pr=0;e.geo.stream(t,i(Br));return Pr};o.centroid=function(t){Mn=Dn=Pn=Hn=0;e.geo.stream(t,i(Ir));return Hn?[Dn/Hn,Pn/Hn]:undefined};o.bounds=function(e){return On(i)(e)};o.projection=function(e){if(!arguments.length)return n;i=(n=e)?e.stream||Vr(e):Gt;return o};o.context=function(e){if(!arguments.length)return r;s=(r=e)==null?new Fr:new Wr(e);return o};o.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:+e;return o};return o.projection(e.geo.albersUsa()).context(null)};e.geo.albers=function(){return e.geo.conicEqualArea().parallels([29.5,45.5]).rotate([98,0]).center([0,38]).scale(1e3)};var Jr=$r(function(e){return Math.sqrt(2/(1+e))},function(e){return 2*Math.asin(e/2)});(e.geo.azimuthalEqualArea=function(){return pr(Jr)}).raw=Jr;var Kr=$r(function(e){var t=Math.acos(e);return t&&t/Math.sin(t)},Gt);(e.geo.azimuthalEquidistant=function(){return pr(Kr)}).raw=Kr;(e.geo.conicConformal=function(){return Mr(Qr)}).raw=Qr;(e.geo.conicEquidistant=function(){return Mr(Gr)}).raw=Gr;var Yr=$r(function(e){return 1/e},Math.atan);(e.geo.gnomonic=function(){return pr(Yr)}).raw=Yr;Zr.invert=function(e,t){return[e,2*Math.atan(Math.exp(t))-dt/2]};(e.geo.mercator=function(){return ei(Zr)}).raw=Zr;var ti=$r(function(){return 1},Math.asin);(e.geo.orthographic=function(){return pr(ti)}).raw=ti;var ni=$r(function(e){return 1/(1+e)},function(e){return 2*Math.atan(e)});(e.geo.stereographic=function(){return pr(ni)}).raw=ni;ri.invert=function(e,t){return[Math.atan2(Et(e),Math.cos(t)),wt(Math.sin(t)/St(e))]};(e.geo.transverseMercator=function(){return ei(ri)}).raw=ri;e.geom={};e.svg={};e.svg.line=function(){return ii(Gt)};var ui=e.map({linear:ai,"linear-closed":fi,"step-before":li,"step-after":ci,basis:gi,"basis-open":yi,"basis-closed":bi,bundle:wi,cardinal:di,"cardinal-open":hi,"cardinal-closed":pi,monotone:Ai});ui.forEach(function(e,t){t.key=e;t.closed=/-closed$/.test(e)});var Si=[0,2/3,1/3,0],xi=[0,1/3,2/3,0],Ti=[0,1/6,2/3,1/6];e.geom.hull=function(e){function r(e){if(e.length<3)return[];var r=Qt(t),i=Qt(n),s=e.length,o,u=s-1,a=[],f=[],l,c,h,p=0,d,v,m,g,y,b,w,E;if(r===si&&n===oi)o=e;else for(c=0,o=[];c=m*m+g*g){a[c].index=-1}else{a[y].index=-1;w=a[c].angle;y=c;b=h}}else{w=a[c].angle;y=c;b=h}}f.push(p);for(c=0,h=0;c<2;++h){if(a[h].index!==-1){f.push(a[h].index);c++}}E=f.length;for(;h=0){t=e.ep.r;n=e.ep.l}else{t=e.ep.l;n=e.ep.r}if(e.a===1){s=t?t.y:-h;r=e.c-e.b*s;u=n?n.y:h;i=e.c-e.b*u}else{r=t?t.x:-h;s=e.c-e.a*r;i=n?n.x:h;u=e.c-e.a*i}var a=[r,s],f=[i,u];o[e.region.l.index].push(a,f);o[e.region.r.index].push(a,f)});o=o.map(function(t,r){var i=n[r][0],s=n[r][1],o=t.map(function(e){return Math.atan2(e[0]-i,e[1]-s)}),u=e.range(t.length).sort(function(e,t){return o[e]-o[t]});return u.filter(function(e,t){return!t||o[e]-o[u[t-1]]>vt}).map(function(e){return t[e]})});o.forEach(function(e,t){var r=e.length;if(!r)return e.push([-h,-h],[-h,h],[h,h],[h,-h]);if(r>2)return;var i=n[t],s=e[0],o=e[1],u=i[0],a=i[1],f=s[0],l=s[1],c=o[0],p=o[1],d=Math.abs(c-f),v=p-l;if(Math.abs(v)0)m*=-1;e.push([-h,m],[h,m])}}});if(s)for(l=0;l=a,c=r>=f,h=(c<<1)+l;e.leaf=false;e=e.nodes[h]||(e.nodes[h]=ji());if(l)i=a;else o=a;if(c)s=f;else u=f;x(e,t,n,r,i,s,o,u)}var a,f=Qt(s),l=Qt(o),c,h,p,d,v,m,g,y;if(t!=null){v=t,m=n,g=r,y=i}else{g=y=-(v=m=Infinity);c=[],h=[];d=e.length;if(u)for(p=0;pg)g=a.x;if(a.y>y)y=a.y;c.push(a.x);h.push(a.y)}else for(p=0;pg)g=b;if(w>y)y=w;c.push(b);h.push(w)}}var E=g-v,S=y-m;if(E>S)y=m+E;else g=v+S;var N=ji();N.add=function(e){x(N,e,+f(e,++p),+l(e,p),v,m,g,y)};N.visit=function(e){Fi(e,N,v,m,g,y)};p=-1;if(t==null){while(++p=0?e.substring(0,t):e,r=t>=0?e.substring(t+1):"in";n=es.get(n)||Zi;r=ts.get(r)||Gt;return ns(r(n.apply(null,Array.prototype.slice.call(arguments,1))))};e.interpolateHcl=vs;e.interpolateHsl=ms;e.interpolateLab=gs;e.interpolateRound=ys;e.layout={};e.layout.bundle=function(){return function(e){var t=[],n=-1,r=e.length;while(++n0)s=r;else s=0}else if(r>0){n.start({type:"start",alpha:s=r});e.timer(t.tick)}return t};t.start=function(){function y(t,n){var r=b(e),i=-1,s=r.length,o;while(++ii)i=u;r.push(u)}for(o=0;o0){o=-1;while(++o=f[0]&&v<=f[1]){c=u[e.bisect(l,v,1,p)-1];c.y+=d;c.push(s[o])}}}return u}var t=true,n=Number,r=Ks,i=$s;s.value=function(e){if(!arguments.length)return n;n=e;return s};s.range=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.bins=function(e){if(!arguments.length)return i;i=typeof e==="number"?function(t){return Js(t,e)}:Qt(e);return s};s.frequency=function(e){if(!arguments.length)return t;t=!!e;return s};return s};e.layout.tree=function(){function i(e,i){function u(e,t){var r=e.children,i=e._tree;if(r&&(s=r.length)){var s,o=r[0],a,l=o,c,h=-1;while(++h0){so(oo(o,e,r),e,h);a+=h;f+=h}l+=o._tree.mod;a+=i._tree.mod;c+=u._tree.mod;f+=s._tree.mod}if(o&&!Ys(s)){s._tree.thread=o;s._tree.mod+=l-f}if(i&&!Gs(u)){u._tree.thread=i;u._tree.mod+=a-c;r=e}}return r}var s=t.call(this,e,i),o=s[0];ro(o,function(e,t){e._tree={ancestor:e,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}});u(o);a(o,-o._tree.prelim);var l=Zs(o,to),c=Zs(o,eo),h=Zs(o,no),p=l.x-n(l,c)/2,d=c.x+n(c,l)/2,v=h.depth||1;ro(o,function(e){e.x=(e.x-p)/(d-p)*r[0];e.y=e.depth/v*r[1];delete e._tree});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.pack=function(){function i(e,i){var s=t.call(this,e,i),o=s[0];o.x=0;o.y=0;ro(o,function(e){e.r=Math.sqrt(e.value)});ro(o,co);var u=r[0],a=r[1],f=Math.max(2*o.r/u,2*o.r/a);if(n>0){var l=n*f/2;ro(o,function(e){e.r+=l});ro(o,co);ro(o,function(e){e.r-=l});f=Math.max(2*o.r/u,2*o.r/a)}vo(o,u/2,a/2,1/f);return s}var t=e.layout.hierarchy().sort(uo),n=0,r=[1,1];i.size=function(e){if(!arguments.length)return r;r=e;return i};i.padding=function(e){if(!arguments.length)return n;n=+e;return i};return Ms(i,t)};e.layout.cluster=function(){function i(e,i){var s=t.call(this,e,i),o=s[0],u,a=0;ro(o,function(e){var t=e.children;if(t&&t.length){e.x=yo(t);e.y=go(t)}else{e.x=u?a+=n(e,u):0;e.y=0;u=e}});var f=bo(o),l=wo(o),c=f.x-n(f,l)/2,h=l.x+n(l,f)/2;ro(o,function(e){e.x=(e.x-c)/(h-c)*r[0];e.y=(1-(o.y?e.y/o.y:1))*r[1]});return s}var t=e.layout.hierarchy().sort(null).value(null),n=Qs,r=[1,1];i.separation=function(e){if(!arguments.length)return n;n=e;return i};i.size=function(e){if(!arguments.length)return r;r=e;return i};return Ms(i,t)};e.layout.treemap=function(){function l(e,t){var n=-1,r=e.length,i,s;while(++n0){r.push(o=i[v-1]);r.area+=o.area;if(a!=="squarify"||(f=p(r,h))<=u){i.pop();u=f}else{r.area-=r.pop().area;d(r,h,n,false);h=Math.min(n.dx,n.dy);r.length=r.area=0;u=Infinity}}if(r.length){d(r,h,n,true);r.length=r.area=0}t.forEach(c)}}function h(e){var t=e.children;if(t&&t.length){var n=s(e),r=t.slice(),i,o=[];l(r,n.dx*n.dy/e.value);o.area=0;while(i=r.pop()){o.push(i);o.area+=i.area;if(i.z!=null){d(o,i.z?n.dx:n.dy,n,!r.length);o.length=o.area=0}}t.forEach(h)}}function p(e,t){var n=e.area,r,i=0,s=Infinity,o=-1,u=e.length;while(++oi)i=r}n*=n;t*=t;return n?Math.max(t*i*f/n,n/(t*s*f)):Infinity}function d(e,t,r,i){var s=-1,o=e.length,u=r.x,a=r.y,f=t?n(e.area/t):0,l;if(t==r.dx){if(i||f>r.dy)f=r.dy;while(++sr.dx)f=r.dx;while(++s1);return e+t*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},irwinHall:function(e){return function(){for(var t=0,n=0;n=eu?i?"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"M0,"+i+"A"+i+","+i+" 0 1,0 0,"+ -i+"A"+i+","+i+" 0 1,0 0,"+i+"Z":"M0,"+s+"A"+s+","+s+" 0 1,1 0,"+ -s+"A"+s+","+s+" 0 1,1 0,"+s+"Z":i?"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L"+i*h+","+i*p+"A"+i+","+i+" 0 "+f+",0 "+i*l+","+i*c+"Z":"M"+s*l+","+s*c+"A"+s+","+s+" 0 "+f+",1 "+s*h+","+s*p+"L0,0"+"Z"}var e=tu,t=nu,n=ru,r=iu;i.innerRadius=function(t){if(!arguments.length)return e;e=Qt(t);return i};i.outerRadius=function(e){if(!arguments.length)return t;t=Qt(e);return i};i.startAngle=function(e){if(!arguments.length)return n;n=Qt(e);return i};i.endAngle=function(e){if(!arguments.length)return r;r=Qt(e);return i};i.centroid=function(){var i=(e.apply(this,arguments)+t.apply(this,arguments))/2,s=(n.apply(this,arguments)+r.apply(this,arguments))/2+Zo;return[Math.cos(s)*i,Math.sin(s)*i]};return i};var Zo=-dt/2,eu=2*dt-1e-6;e.svg.line.radial=function(){var e=ii(su);e.radius=e.x,delete e.x;e.angle=e.y,delete e.y;return e};li.reverse=ci;ci.reverse=li;e.svg.area=function(){return ou(Gt)};e.svg.area.radial=function(){var e=ou(su);e.radius=e.x,delete e.x;e.innerRadius=e.x0,delete e.x0;e.outerRadius=e.x1,delete e.x1;e.angle=e.y,delete e.y;e.startAngle=e.y0,delete e.y0;e.endAngle=e.y1,delete e.y1;return e};e.svg.chord=function(){function s(n,r){var i=o(this,e,n,r),s=o(this,t,n,r);return"M"+i.p0+a(i.r,i.p1,i.a1-i.a0)+(u(i,s)?f(i.r,i.p1,i.r,i.p0):f(i.r,i.p1,s.r,s.p0)+a(s.r,s.p1,s.a1-s.a0)+f(s.r,s.p1,i.r,i.p0))+"Z"}function o(e,t,s,o){var u=t.call(e,s,o),a=n.call(e,u,o),f=r.call(e,u,o)+Zo,l=i.call(e,u,o)+Zo;return{r:a,a0:f,a1:l,p0:[a*Math.cos(f),a*Math.sin(f)],p1:[a*Math.cos(l),a*Math.sin(l)]}}function u(e,t){return e.a0==t.a0&&e.a1==t.a1}function a(e,t,n){return"A"+e+","+e+" 0 "+ +(n>dt)+",1 "+t}function f(e,t,n,r){return"Q 0,0 "+r}var e=Nr,t=Cr,n=uu,r=ru,i=iu;s.radius=function(e){if(!arguments.length)return n;n=Qt(e);return s};s.source=function(t){if(!arguments.length)return e;e=Qt(t);return s};s.target=function(e){if(!arguments.length)return t;t=Qt(e);return s};s.startAngle=function(e){if(!arguments.length)return r;r=Qt(e);return s};s.endAngle=function(e){if(!arguments.length)return i;i=Qt(e);return s};return s};e.svg.diagonal=function(){function r(r,i){var s=e.call(this,r,i),o=t.call(this,r,i),u=(s.y+o.y)/2,a=[s,{x:s.x,y:u},{x:o.x,y:u},o];a=a.map(n);return"M"+a[0]+"C"+a[1]+" "+a[2]+" "+a[3]}var e=Nr,t=Cr,n=au;r.source=function(t){if(!arguments.length)return e;e=Qt(t);return r};r.target=function(e){if(!arguments.length)return t;t=Qt(e);return r};r.projection=function(e){if(!arguments.length)return n;n=e;return r};return r};e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),n=au,r=t.projection;t.projection=function(e){return arguments.length?r(fu(n=e)):n};return t};e.svg.symbol=function(){function n(n,r){return(pu.get(e.call(this,n,r))||hu)(t.call(this,n,r))}var e=cu,t=lu;n.type=function(t){if(!arguments.length)return e;e=Qt(t);return n};n.size=function(e){if(!arguments.length)return t;t=Qt(e);return n};return n};var pu=e.map({circle:hu,cross:function(e){var t=Math.sqrt(e/5)/2;return"M"+ -3*t+","+ -t+"H"+ -t+"V"+ -3*t+"H"+t+"V"+ -t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+ -t+"V"+t+"H"+ -3*t+"Z"},diamond:function(e){var t=Math.sqrt(e/(2*vu)),n=t*vu;return"M0,"+ -t+"L"+n+",0"+" 0,"+t+" "+ -n+",0"+"Z"},square:function(e){var t=Math.sqrt(e)/2;return"M"+ -t+","+ -t+"L"+t+","+ -t+" "+t+","+t+" "+ -t+","+t+"Z"},"triangle-down":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+n+"L"+t+","+ -n+" "+ -t+","+ -n+"Z"},"triangle-up":function(e){var t=Math.sqrt(e/du),n=t*du/2;return"M0,"+ -n+"L"+t+","+n+" "+ -t+","+n+"Z"}});e.svg.symbolTypes=pu.keys();var du=Math.sqrt(3),vu=Math.tan(30*mt);var gu=[],yu=0,bu,wu={ease:us,delay:0,duration:250};gu.call=B.call;gu.empty=B.empty;gu.node=B.node;e.transition=function(e){return arguments.length?bu?e.transition():e:st.transition()};e.transition.prototype=gu;gu.select=function(e){var t=this.id,n=[],r,i,s;if(typeof e!=="function")e=j(e);for(var o=-1,u=this.length;++o1?+t:r;s=n>0?+arguments[n]:r;return c};c.tickPadding=function(e){if(!arguments.length)return o;o=+e;return c};c.tickSubdivide=function(e){if(!arguments.length)return l;l=+e;return c};return c};var Tu="bottom",Nu={top:1,right:1,bottom:1,left:1};e.svg.brush=function(){function a(t){t.each(function(){var t=e.select(this),n=t.selectAll(".background").data([0]),o=t.selectAll(".extent").data([0]),u=t.selectAll(".resize").data(s,String),p;t.style("pointer-events","all").on("mousedown.brush",h).on("touchstart.brush",h);n.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.enter().append("rect").attr("class","extent").style("cursor","move");u.enter().append("g").attr("class",function(e){return"resize "+e}).style("cursor",function(e){return Au[e]}).append("rect").attr("x",function(e){return/[ew]$/.test(e)?-3:null}).attr("y",function(e){return/^[ns]/.test(e)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");u.style("display",a.empty()?"none":null);u.exit().remove();if(r){p=To(r);n.attr("x",p[0]).attr("width",p[1]-p[0]);l(t)}if(i){p=To(i);n.attr("y",p[0]).attr("height",p[1]-p[0]);c(t)}f(t)})}function f(e){e.selectAll(".resize").attr("transform",function(e){return"translate("+o[+/e$/.test(e)][0]+","+o[+/^s/.test(e)][1]+")"})}function l(e){e.select(".extent").attr("x",o[0][0]);e.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1][0]-o[0][0])}function c(e){e.select(".extent").attr("y",o[0][1]);e.selectAll(".extent,.e>rect,.w>rect").attr("height",o[1][1]-o[0][1])}function h(){function C(){var t=e.event.changedTouches;return t?e.touches(s,t)[0]:e.mouse(s)}function k(){if(e.event.keyCode==32){if(!b){w=null;E[0]-=o[1][0];E[1]-=o[1][1];b=2}y()}}function L(){if(e.event.keyCode==32&&b==2){E[0]+=o[1][0];E[1]+=o[1][1];b=0;y()}}function A(){var t=C(),n=false;if(S){t[0]+=S[0];t[1]+=S[1]}if(!b){if(e.event.altKey){if(!w)w=[(o[0][0]+o[1][0])/2,(o[0][1]+o[1][1])/2];E[0]=o[+(t[0]=12?"PM":"AM"},S:function(e,t){return $u(e.getSeconds(),t,2)},U:function(t,n){return $u(e.time.sundayOfYear(t),n,2)},w:function(e){return e.getDay()},W:function(t,n){return $u(e.time.mondayOfYear(t),n,2)},x:e.time.format(Bu),X:e.time.format(ju),y:function(e,t){return $u(e.getFullYear()%100,t,2)},Y:function(e,t){return $u(e.getFullYear()%1e4,t,4)},Z:Sa,"%":function(){return"%"}};var na={a:ra,A:ia,b:sa,B:oa,c:ua,d:da,e:da,H:va,I:va,L:ya,m:pa,M:ma,p:wa,S:ga,x:aa,X:fa,y:ca,Y:la};var ba=/^\s*\d+/;var Ea=e.map({am:0,pm:1});e.time.format.utc=function(t){function r(e){try{Mu=Du;var t=new Mu;t._=e;return n(t)}finally{Mu=Date}}var n=e.time.format(t);r.parse=function(e){try{Mu=Du;var t=n.parse(e);return t&&t._}finally{Mu=Date}};r.toString=n.toString;return r};var xa=e.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");e.time.format.iso=Date.prototype.toISOString&&+(new Date("2000-01-01T00:00:00.000Z"))?Ta:xa;Ta.parse=function(e){var t=new Date(e);return isNaN(t)?null:t};Ta.toString=xa.toString;e.time.second=Uu(function(e){return new Mu(Math.floor(e/1e3)*1e3)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*1e3)},function(e){return e.getSeconds()});e.time.seconds=e.time.second.range;e.time.seconds.utc=e.time.second.utc.range;e.time.minute=Uu(function(e){return new Mu(Math.floor(e/6e4)*6e4)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*6e4)},function(e){return e.getMinutes()});e.time.minutes=e.time.minute.range;e.time.minutes.utc=e.time.minute.utc.range;e.time.hour=Uu(function(e){var t=e.getTimezoneOffset()/60;return new Mu((Math.floor(e/36e5-t)+t)*36e5)},function(e,t){e.setTime(e.getTime()+Math.floor(t)*36e5)},function(e){return e.getHours()});e.time.hours=e.time.hour.range;e.time.hours.utc=e.time.hour.utc.range;e.time.month=Uu(function(t){t=e.time.day(t);t.setDate(1);return t},function(e,t){e.setMonth(e.getMonth()+t)},function(e){return e.getMonth()});e.time.months=e.time.month.range;e.time.months.utc=e.time.month.utc.range;var Ma=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var _a=[[e.time.second,1],[e.time.second,5],[e.time.second,15],[e.time.second,30],[e.time.minute,1],[e.time.minute,5],[e.time.minute,15],[e.time.minute,30],[e.time.hour,1],[e.time.hour,3],[e.time.hour,6],[e.time.hour,12],[e.time.day,1],[e.time.day,2],[e.time.week,1],[e.time.month,1],[e.time.month,3],[e.time.year,1]];var Da=[[e.time.format("%Y"),$n],[e.time.format("%B"),function(e){return e.getMonth()}],[e.time.format("%b %d"),function(e){return e.getDate()!=1}],[e.time.format("%a %d"),function(e){return e.getDay()&&e.getDate()!=1}],[e.time.format("%I %p"),function(e){return e.getHours()}],[e.time.format("%I:%M"),function(e){return e.getMinutes()}],[e.time.format(":%S"),function(e){return e.getSeconds()}],[e.time.format(".%L"),function(e){return e.getMilliseconds()}]];var Pa=e.scale.linear(),Ha=La(Da);_a.year=function(e,t){return Pa.domain(e.map(Oa)).ticks(t).map(Aa)};e.time.scale=function(){return Na(e.scale.linear(),_a,Ha)};var Ba=_a.map(function(e){return[e[0].utc,e[1]]});var ja=[[e.time.format.utc("%Y"),$n],[e.time.format.utc("%B"),function(e){return e.getUTCMonth()}],[e.time.format.utc("%b %d"),function(e){return e.getUTCDate()!=1}],[e.time.format.utc("%a %d"),function(e){return e.getUTCDay()&&e.getUTCDate()!=1}],[e.time.format.utc("%I %p"),function(e){return e.getUTCHours()}],[e.time.format.utc("%I:%M"),function(e){return e.getUTCMinutes()}],[e.time.format.utc(":%S"),function(e){return e.getUTCSeconds()}],[e.time.format.utc(".%L"),function(e){return e.getUTCMilliseconds()}]];var Fa=La(ja);Ba.year=function(e,t){return Pa.domain(e.map(qa)).ticks(t).map(Ia)};e.time.scale.utc=function(){return Na(e.scale.linear(),Ba,Fa)};e.text=function(){return e.xhr.apply(e,arguments).response(Ra)};e.json=function(t,n){return e.xhr(t,"application/json",n).response(Ua)};e.html=function(t,n){return e.xhr(t,"text/html",n).response(za)};e.xml=function(){return e.xhr.apply(e,arguments).response(Wa)};return e}()