From 700b6dbff66aa102e17389fc5d7d3adc2f6b8e84 Mon Sep 17 00:00:00 2001 From: Rares Golea Date: Tue, 4 Apr 2017 15:56:15 +0300 Subject: [PATCH 1/5] Allowing a default size on the graph --- README.md | 6 +++++- index.js | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ea92c23..008d487 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,16 @@ graph.connect('peer1', 'peer2') > In graph theory, a directed graph (or digraph) is a graph that is a set of vertices connected by edges, where the edges have a direction associated with them. -### graph = new Graph(rootElem) +### graph = new Graph(rootElem, size) Create a new P2P graph at the root DOM element `rootElem`. In addition to an `Element`, a query selector string (like `'.my-cool-element'`) can also be passed in. +Also, you can pass in an object containing the desired width and height. The possible values for both are `auto`, `default` or a number (which represents the number of pixels). +- auto: Adjusts to the maximum existing space inside the `rootElem` +- default: Height adjusts to 400 px on widescreens and 250 px on small screens + ### graph.add(peer) Add a peer to the graph. The `peer` object should contain: diff --git a/index.js b/index.js index c241f7e..4febc9a 100644 --- a/index.js +++ b/index.js @@ -31,13 +31,18 @@ var COLORS = { } } -function TorrentGraph (root) { +function TorrentGraph (root, size) { if (typeof root === 'string') root = document.querySelector(root) var model = { nodes: [], links: [] } + if (size) { + if (size.height && size.height !== 'default' && size.height !== 'auto' && isNaN(size.height)) throw 'Height should be a Number' + if (size.width && size.width !== 'default' && size.width !== 'auto' && isNaN(size.width)) throw 'Width should be a Number' + } + function scale () { var len = model.nodes.length return len < 10 @@ -56,8 +61,22 @@ function TorrentGraph (root) { } } - var width = root.offsetWidth - var height = (window.innerWidth >= 900) ? 400 : 250 + function getSize () { + var height = (window.innerWidth >= 900) ? 400 : 250 + var width = root.offsetWidth + + if (size) { + if (!isNaN(size.width)) width = size.width + if (!isNan(size.height)) height = size.height + if (size.height === 'auto') height = root.offsetHeight + } + + + return { + width: width, + height: height + } + } var focus @@ -72,12 +91,13 @@ function TorrentGraph (root) { target.parents.push(link.source) }) + var _size = getSize() var svg = d3.select(root).append('svg') - .attr('width', width) - .attr('height', height) + .attr('width', _size.width) + .attr('height', _size.height) var force = d3.layout.force() - .size([width, height]) + .size([_size.width, _size.height]) .nodes(model.nodes) .links(model.links) .on('tick', function () { @@ -239,16 +259,15 @@ function TorrentGraph (root) { } function refresh (e) { - width = root.offsetWidth - height = (window.innerWidth >= 900) ? 400 : 250 + _size = getSize() force - .size([width, height]) + .size([_size.width, _size.height]) .resume() svg - .attr('width', root.offsetWidth) - .attr('height', height) + .attr('width', _size.width) + .attr('height', _size.width) } function childNodes (d) { From 02c1225bb39a6131d1e182c3cffdd6329d88f1df Mon Sep 17 00:00:00 2001 From: Rares Golea Date: Tue, 4 Apr 2017 16:05:20 +0300 Subject: [PATCH 2/5] Pass in a function as well --- README.md | 14 +++++++++++++- index.js | 6 ++++-- p2p-graph.min.js | 12 ++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 008d487..01ad577 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,21 @@ Create a new P2P graph at the root DOM element `rootElem`. In addition to an `Element`, a query selector string (like `'.my-cool-element'`) can also be passed in. -Also, you can pass in an object containing the desired width and height. The possible values for both are `auto`, `default` or a number (which represents the number of pixels). +Also, you can pass in an object containing the desired width and height. The possible values for both are `auto`, `default` or a number (which represents the number of pixels). Aditionally you can pass in a function that evaluates on resize. - auto: Adjusts to the maximum existing space inside the `rootElem` - default: Height adjusts to 400 px on widescreens and 250 px on small screens +Example: +``` +var Graph = require('p2p-graph') +//default +var graph = new Graph('.root', {height: 'default', width: 'default'}) +//auto +var graph = new Graph('.root', {height: 'auto', width: 'auto'}) +//fixed +var graph = new Graph('.root', {height: 200, width: 400}) +//function +var graph = new Graph('.root', {height: function () { ... }, width: function () { ... }}) +``` ### graph.add(peer) diff --git a/index.js b/index.js index 4febc9a..8fb38b9 100644 --- a/index.js +++ b/index.js @@ -39,8 +39,8 @@ function TorrentGraph (root, size) { } if (size) { - if (size.height && size.height !== 'default' && size.height !== 'auto' && isNaN(size.height)) throw 'Height should be a Number' - if (size.width && size.width !== 'default' && size.width !== 'auto' && isNaN(size.width)) throw 'Width should be a Number' + if (size.height && typeof size.height !== 'function' && size.height !== 'default' && size.height !== 'auto' && isNaN(size.height)) throw 'Height should be a Number or a Function' + if (size.width && size.width !== 'default' && typeof size.width !== 'function' && size.width !== 'auto' && isNaN(size.width)) throw 'Width should be a Number of a Function' } function scale () { @@ -67,7 +67,9 @@ function TorrentGraph (root, size) { if (size) { if (!isNaN(size.width)) width = size.width + if (typeof size.width === 'function') width = size.width() if (!isNan(size.height)) height = size.height + if (typeof size.height === 'function') height = size.height() if (size.height === 'auto') height = root.offsetHeight } diff --git a/p2p-graph.min.js b/p2p-graph.min.js index 34837b0..9a0f8f3 100644 --- a/p2p-graph.min.js +++ b/p2p-graph.min.js @@ -1,6 +1,6 @@ -!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.P2PGraph=n()}}(function(){var n;return function n(t,e,r){function i(u,a){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var s=e[u]={exports:{}};t[u][0].call(s.exports,function(n){var e=t[u][1][n];return i(e?e:n)},s,s.exports,n,t,e,r)}return e[u].exports}for(var o="function"==typeof require&&require,u=0;ut?1:n>=t?0:NaN}function o(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function a(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function c(n){return n.length}function l(n){for(var t=1;n*t%1;)t*=10;return t}function s(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function f(){this._=Object.create(null)}function h(n){return(n+="")===wu||n[0]===bu?bu+n:n}function p(n){return(n+="")[0]===bu?n.slice(1):n}function g(n){return h(n)in this._}function d(n){return(n=h(n))in this._&&delete this._[n]}function v(){var n=[];for(var t in this._)n.push(p(t));return n}function y(){var n=0;for(var t in this._)++n;return n}function m(){for(var n in this._)return!1;return!0}function x(){this._=Object.create(null)}function M(n){return n}function w(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function b(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_u.length;e=t&&(t=i+1);!(u=a[t])&&++t0&&(n=n.slice(0,a));var l=qu.get(n);return l&&(n=l,c=J),a?t?i:r:t?_:o}function X(n,t){return function(e){var r=su.event;su.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{su.event=r}}}function J(n,t){var e=X(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function G(n){var e=".dragsuppress-"+ ++Ru,i="click"+e,o=su.select(r(n)).on("touchmove"+e,S).on("dragstart"+e,S).on("selectstart"+e,S);if(null==Du&&(Du=!("onselectstart"in n)&&b(n.style,"userSelect")),Du){var u=t(n).style,a=u[Du];u[Du]="none"}return function(n){if(o.on(e,null),Du&&(u[Du]=a),n){var t=function(){o.on(i,null)};o.on(i,function(){S(),t()},!0),setTimeout(t,0)}}}function K(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();if(Pu<0){var o=r(n);if(o.scrollX||o.scrollY){e=su.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();Pu=!(u.f||u.e),e.remove()}}return Pu?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[t.clientX-a.left-n.clientLeft,t.clientY-a.top-n.clientTop]}function Q(){return su.event.changedTouches[0].identifier}function nn(n){return n>0?1:n<0?-1:0}function tn(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function en(n){return n>1?0:n<-1?Ou:Math.acos(n)}function rn(n){return n>1?Iu:n<-1?-Iu:Math.asin(n)}function on(n){return((n=Math.exp(n))-1/n)/2}function un(n){return((n=Math.exp(n))+1/n)/2}function an(n){return((n=Math.exp(2*n))-1)/(n+1)}function cn(n){return(n=Math.sin(n/2))*n}function ln(){}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.s,n.l):kn(""+n,En,sn):new sn(n,t,e)}function fn(n,t,e){function r(n){return n>360?n-=360:n<0&&(n+=360),n<60?o+(u-o)*n/60:n<180?u:n<240?o+(u-o)*(240-n)/60:o}function i(n){return Math.round(255*r(n))}var o,u;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:t<0?0:t>1?1:t,e=e<0?0:e>1?1:e,u=e<=.5?e*(1+t):e+t-e*t,o=2*e-u,new Mn(i(n+120),i(n),i(n-120))}function hn(n,t,e){return this instanceof hn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof hn?new hn(n.h,n.c,n.l):n instanceof gn?vn(n.l,n.a,n.b):vn((n=Sn((n=su.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new hn(n,t,e)}function pn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new gn(e,Math.cos(n*=Yu)*t,Math.sin(n)*t)}function gn(n,t,e){return this instanceof gn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof gn?new gn(n.l,n.a,n.b):n instanceof hn?pn(n.h,n.c,n.l):Sn((n=Mn(n)).r,n.g,n.b):new gn(n,t,e)}function dn(n,t,e){var r=(n+16)/116,i=r+t/500,o=r-e/200;return i=yn(i)*Ku,r=yn(r)*Qu,o=yn(o)*na,new Mn(xn(3.2404542*i-1.5371385*r-.4985314*o),xn(-.969266*i+1.8760108*r+.041556*o),xn(.0556434*i-.2040259*r+1.0572252*o))}function vn(n,t,e){return n>0?new hn(Math.atan2(e,t)*Bu,Math.sqrt(t*t+e*e),n):new hn(NaN,NaN,n)}function yn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function mn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function xn(n){return Math.round(255*(n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function Mn(n,t,e){return this instanceof Mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof Mn?new Mn(n.r,n.g,n.b):kn(""+n,Mn,fn):new Mn(n,t,e)}function wn(n){return new Mn(n>>16,n>>8&255,255&n)}function bn(n){return wn(n)+""}function _n(n){return n<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function kn(n,t,e){var r,i,o,u=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(An(i[0]),An(i[1]),An(i[2]))}return(o=ra.get(n))?t(o.r,o.g,o.b):(null==n||"#"!==n.charAt(0)||isNaN(o=parseInt(n.slice(1),16))||(4===n.length?(u=(3840&o)>>4,u|=u>>4,a=240&o,a|=a>>4,c=15&o,c|=c<<4):7===n.length&&(u=(16711680&o)>>16,a=(65280&o)>>8,c=255&o)),t(u,a,c))}function En(n,t,e){var r,i,o=Math.min(n/=255,t/=255,e/=255),u=Math.max(n,t,e),a=u-o,c=(u+o)/2;return a?(i=c<.5?a/(u+o):a/(2-u-o),r=n==u?(t-e)/a+(t0&&c<1?0:r),new sn(r,i,c)}function Sn(n,t,e){n=Nn(n),t=Nn(t),e=Nn(e);var r=mn((.4124564*n+.3575761*t+.1804375*e)/Ku),i=mn((.2126729*n+.7151522*t+.072175*e)/Qu);return gn(116*i-16,500*(r-i),200*(i-mn((.0193339*n+.119192*t+.9503041*e)/na)))}function Nn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function An(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Cn(n){return"function"==typeof n?n:function(){return n}}function Tn(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),zn(t,e,n,r)}}function zn(n,t,e,r){function i(){var n,t=c.status;if(!t&&qn(c)||t>=200&&t<300||304===t){try{n=e.call(o,c)}catch(n){return void u.error.call(o,n)}u.load.call(o,n)}else u.error.call(o,c)}var o={},u=su.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=su.event;su.event=n;try{u.progress.call(o,c)}finally{su.event=t}},o.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",o)},o.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",o):t},o.responseType=function(n){return arguments.length?(l=n,o):l},o.response=function(n){return e=n,o},["get","post"].forEach(function(n){o[n]=function(){return o.send.apply(o,[n].concat(hu(arguments)))}}),o.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&o.on("error",i).on("load",function(n){i(null,n)}),u.beforesend.call(o,c),c.send(null==r?null:r),o},o.abort=function(){return c.abort(),o},su.rebind(o,u,"on"),null==r?o:o.get(Ln(r))}function Ln(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qn(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Dn(n,t,e){var r=arguments.length;r<2&&(t=0),r<3&&(e=Date.now());var i=e+t,o={c:n,t:i,n:null};return oa?oa.n=o:ia=o,oa=o,ua||(aa=clearTimeout(aa),ua=1,ca(Rn)),o}function Rn(){var n=Pn(),t=Un()-n;t>24?(isFinite(t)&&(clearTimeout(aa),aa=setTimeout(Rn,t)),ua=0):(ua=1,ca(Rn))}function Pn(){for(var n=Date.now(),t=ia;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Un(){for(var n,t=ia,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Fn(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,o=r&&e?function(n,t){for(var i=n.length,o=[],u=0,a=r[0],c=0;i>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>t));)a=r[u=(u+1)%r.length];return o.reverse().join(e)}:M;return function(n){var e=sa.exec(n),r=e[1]||" ",u=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],p=e[9],g=1,d="",v="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===u)&&(l=r="0",u="="),p){case"n":f=!0,p="g";break;case"%":g=100,v="%",p="f";break;case"p":g=100,v="%",p="r";break;case"b":case"o":case"x":case"X":"#"===c&&(d="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===c&&(d=i[0],v=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=fa.get(p)||Hn;var x=l&&f;return function(n){var e=v;if(y&&n%1)return"";var i=n<0||0===n&&1/n<0?(n=-n,"-"):"-"===a?"":a;if(g<0){var c=su.formatPrefix(n,h);n=c.scale(n),e=c.symbol+v}else n*=g;n=p(n,h);var M,w,b=n.lastIndexOf(".");if(b<0){var _=m?n.lastIndexOf("e"):-1;_<0?(M=n,w=""):(M=n.substring(0,_),w=n.substring(_))}else M=n.substring(0,b),w=t+n.substring(b+1);!l&&f&&(M=o(M,1/0));var k=d.length+M.length+w.length+(x?0:i.length),E=k"===u?E+i+n:"^"===u?E.substring(0,k>>=1)+i+n+E.substring(k):i+(x?n:E+n))+e}}}function Hn(n){return n+""}function In(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Yn(n,t,e){function r(t){var e=n(t),r=o(e,1);return t-e1)for(;u=l)return-1;if(37===(i=t.charCodeAt(a++))){if(u=t.charAt(a++),!(o=C[u in da?t.charAt(a++):u])||(r=o(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.slice(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){M.lastIndex=0;var r=M.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=N.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){k.lastIndex=0;var r=k.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function c(n,t,r){return e(n,A.x.toString(),t,r)}function l(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=x.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,p=n.time,g=n.periods,d=n.days,v=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{pa=In;var t=new pa;return t._=n,r(t)}finally{pa=Date}}var r=t(n);return e.parse=function(n){try{pa=In;var t=r.parse(n);return t&&t._}finally{pa=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ft;var x=su.map(),M=$n(d),w=Wn(d),b=$n(v),_=Wn(v),k=$n(y),E=Wn(y),S=$n(m),N=Wn(m);g.forEach(function(n,t){x.set(n.toLowerCase(),t)});var A={a:function(n){return v[n.getDay()]},A:function(n){return d[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(f),d:function(n,t){return Vn(n.getDate(),t,2)},e:function(n,t){return Vn(n.getDate(),t,2)},H:function(n,t){return Vn(n.getHours(),t,2)},I:function(n,t){return Vn(n.getHours()%12||12,t,2)},j:function(n,t){return Vn(1+ha.dayOfYear(n),t,3)},L:function(n,t){return Vn(n.getMilliseconds(),t,3)},m:function(n,t){return Vn(n.getMonth()+1,t,2)},M:function(n,t){return Vn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Vn(n.getSeconds(),t,2)},U:function(n,t){return Vn(ha.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Vn(ha.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Vn(n.getFullYear()%100,t,2)},Y:function(n,t){return Vn(n.getFullYear()%1e4,t,4)},Z:lt,"%":function(){return"%"}},C={a:r,A:i,b:o,B:u,c:a,d:rt,e:rt,H:ot,I:ot,j:it,L:ct,m:et,M:ut,p:s,S:at,U:Jn,w:Xn,W:Gn,x:c,X:l,y:Qn,Y:Kn,Z:nt,"%":st};return t}function Vn(n,t,e){var r=n<0?"-":"",i=(r?-n:n)+"",o=i.length;return r+(o68?1900:2e3)}function et(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function rt(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function it(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ot(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function at(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ct(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function lt(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=Mu(t)/60|0,i=Mu(t)%60;return e+Vn(r,"0",2)+Vn(i,"0",2)}function st(n,t,e){ya.lastIndex=0;var r=ya.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ft(n){for(var t=n.length,e=-1;++e=0?1:-1,a=u*e,c=Math.cos(t),l=Math.sin(t),s=o*l,f=i*c+s*Math.cos(a),h=s*u*Math.sin(a);_a.add(Math.atan2(h,f)),r=n,i=c,o=l}var t,e,r,i,o;ka.point=function(u,a){ka.point=n,r=(t=u)*Yu,i=Math.cos(a=(e=a)*Yu/2+Ou/4),o=Math.sin(a)},ka.lineEnd=function(){n(t,e)}}function mt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function xt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function wt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function bt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function _t(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function kt(n){return[Math.atan2(n[1],n[0]),rn(n[2])]}function Et(n,t){return Mu(n[0]-t[0])=0;--a)i.point((f=s[a])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,s=p.z,g=!g}while(!p.v);i.lineEnd()}}}function Dt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++u1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Ut))}var p,g,d,v=t(o),y=i.invert(r[0],r[1]),m={point:u,lineStart:c,lineEnd:l,polygonStart:function(){m.point=s,m.lineStart=f,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=u,m.lineStart=c,m.lineEnd=l,p=su.merge(p);var n=Yt(y,g);p.length?(w||(o.polygonStart(),w=!0),qt(p,Ot,n,e,o)):n&&(w||(o.polygonStart(),w=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=g=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=jt(),M=t(x),w=!1;return m}}function Ut(n){return n.length>1}function jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:_,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ot(n,t){return((n=n.x)[0]<0?n[1]-Iu-Uu:Iu-n[1])-((t=t.x)[0]<0?t[1]-Iu-Uu:Iu-t[1])}function Ft(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var a=o>0?Ou:-Ou,c=Mu(o-e);Mu(c-Ou)0?Iu:-Iu),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(o,r),t=0):i!==a&&c>=Ou&&(Mu(e-i)Uu?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*o*u)):(t+r)/2}function It(n,t,e,r){var i;if(null==n)i=e*Iu,r.point(-Ou,i),r.point(0,i),r.point(Ou,i),r.point(Ou,0),r.point(Ou,-i),r.point(0,-i),r.point(-Ou,-i),r.point(-Ou,0),r.point(-Ou,i);else if(Mu(n[0]-t[0])>Uu){var o=n[0]=0?1:-1,_=b*w,k=_>Ou,E=g*x;if(_a.add(Math.atan2(E*b*Math.sin(_),d*M+E*Math.cos(_))),o+=k?w+b*Fu:w,k^h>=e^y>=e){var S=Mt(mt(f),mt(n));_t(S);var N=Mt(i,S);_t(N);var A=(k^w>=0?-1:1)*rn(N[2]);(r>A||r===A&&(S[0]||S[1]))&&(u+=k^w>=0?1:-1)}if(!v++)break;h=y,g=x,d=M,f=n}}return(o<-Uu||oo}function e(n){var e,o,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var p,g=[f,h],d=t(f,h),v=u?d?0:i(f,h):d?i(f+(f<0?Ou:-Ou),h):0;if(!e&&(l=c=d)&&n.lineStart(),d!==c&&(p=r(e,g),(Et(e,p)||Et(g,p))&&(g[0]+=Uu,g[1]+=Uu,d=t(g[0],g[1]))),d!==c)s=0,d?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&u^d){var y;v&o||!(y=r(g,e,!0))||(s=0,u?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!d||e&&Et(e,g)||n.point(g[0],g[1]),e=g,c=d,o=v},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=mt(n),i=mt(t),u=[1,0,0],a=Mt(r,i),c=xt(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=o*c/s,h=-o*l/s,p=Mt(u,a),g=bt(u,f);wt(g,bt(a,h));var d=p,v=xt(g,d),y=xt(d,d),m=v*v-y*(xt(g,g)-1);if(!(m<0)){var x=Math.sqrt(m),M=bt(d,(-v-x)/y);if(wt(M,g),M=kt(M),!e)return M;var w,b=n[0],_=t[0],k=n[1],E=t[1];_0^M[1]<(Mu(M[0]-b)Ou^(b<=M[0]&&M[0]<=_)){var C=bt(d,(-v+x)/y);return wt(C,g),[M,kt(C)]}}}function i(t,e){var r=u?n:Ou-n,i=0;return t<-r?i|=1:t>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var o=Math.cos(n),u=o>0,a=Mu(o)>Uu;return Pt(t,e,ye(n,6*Yu),u?[0,-n]:[-Ou,n-Ou])}function Zt(n,t,e,r){return function(i){var o,u=i.a,a=i.b,c=u.x,l=u.y,s=a.x,f=a.y,h=0,p=1,g=s-c,d=f-l;if(o=n-c,g||!(o>0)){if(o/=g,g<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=e-c,g||!(o<0)){if(o/=g,g<0){if(o>p)return;o>h&&(h=o)}else if(g>0){if(o0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-l,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0&&(i.a={x:c+h*g,y:l+h*d}),p<1&&(i.b={x:c+p*g,y:l+p*d}),i}}}}}}function Vt(n,t,e,r){function i(r,i){return Mu(r[0]-n)0?0:3:Mu(r[0]-e)0?2:1:Mu(r[1]-t)0?1:0:i>0?3:2}function o(n,t){return u(n.x,t.x)}function u(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=v.length,r=n[1],i=0;ir&&tn(l,o,n)>0&&++t:o[1]<=r&&tn(l,o,n)<0&&--t,l=o;return 0!==t}function l(o,a,c,l){var s=0,f=0;if(null==o||(s=i(o,c))!==(f=i(a,c))||u(o,a)<0^c>0)do{l.point(0===s||3===s?n:e,s>1?r:t)}while((s=(s+c+4)%4)!==f);else l.point(a[0],a[1])}function s(i,o){return n<=i&&i<=e&&t<=o&&o<=r}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=g,v&&v.push(y=[]),k=!0,_=!1,w=b=NaN}function p(){d&&(g(m,x),M&&_&&N.rejoin(),d.push(N.buffer())),C.point=f,_&&a.lineEnd()}function g(n,t){n=Math.max(-ja,Math.min(ja,n)),t=Math.max(-ja,Math.min(ja,t));var e=s(n,t);if(v&&y.push([n,t]),k)m=n,x=t,M=e,k=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&_)a.point(n,t);else{var r={a:{x:w,y:b},b:{x:n,y:t}};A(r)?(_||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),E=!1):e&&(a.lineStart(),a.point(n,t),E=!1)}w=n,b=t,_=e}var d,v,y,m,x,M,w,b,_,k,E,S=a,N=jt(),A=Zt(n,t,e,r),C={point:f,lineStart:h,lineEnd:p,polygonStart:function(){a=N,d=[],v=[],E=!0},polygonEnd:function(){a=S,d=su.merge(d);var t=c([n,r]),e=E&&t,i=d.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),i&&qt(d,o,t,l,a),a.polygonEnd()),d=v=y=null}};return C}}function $t(n){var t=0,e=Ou/3,r=le(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Ou/180,e=n[1]*Ou/180):[t/Ou*180,e/Ou*180]},i}function Wt(n,t){function e(n,t){var e=Math.sqrt(o-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),u-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),u=Math.sqrt(o)/i;return e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,rn((o-(n*n+e*e)*i*i)/(2*i))]},e}function Xt(){function n(n,t){Fa+=i*n-r*t,r=n,i=t}var t,e,r,i;Za.point=function(o,u){Za.point=n,t=r=o,e=i=u},Za.lineEnd=function(){n(t,e)}}function Jt(n,t){nYa&&(Ya=n),tBa&&(Ba=t)}function Gt(){function n(n,t){u.push("M",n,",",t,o)}function t(n,t){u.push("M",n,",",t),a.point=e}function e(n,t){u.push("L",n,",",t)}function r(){a.point=n}function i(){u.push("Z")}var o=Kt(4.5),u=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return o=Kt(n),a},result:function(){if(u.length){var n=u.join("");return u=[],n}}};return a}function Kt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qt(n,t){Na+=n,Aa+=t,++Ca}function ne(){function n(n,r){var i=n-t,o=r-e,u=Math.sqrt(i*i+o*o);Ta+=u*(t+n)/2,za+=u*(e+r)/2,La+=u,Qt(t=n,e=r)}var t,e;$a.point=function(r,i){$a.point=n,Qt(t=r,e=i)}}function te(){$a.point=Qt}function ee(){function n(n,t){var e=n-r,o=t-i,u=Math.sqrt(e*e+o*o);Ta+=u*(r+n)/2,za+=u*(i+t)/2,La+=u,u=i*n-r*t,qa+=u*(r+n),Da+=u*(i+t),Ra+=3*u,Qt(r=n,i=t)}var t,e,r,i;$a.point=function(o,u){$a.point=n,Qt(t=r=o,e=i=u)},$a.lineEnd=function(){n(t,e)}} -function re(n){function t(t,e){n.moveTo(t+u,e),n.arc(t,e,u,0,Fu)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function o(){n.closePath()}var u=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return u=n,a},result:_};return a}function ie(n){function t(n){return(a?r:e)(n)}function e(t){return ae(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=NaN,k.point=o,t.lineStart()}function o(e,r){var o=mt([e,r]),u=n(e,r);i(x,M,m,w,b,_,x=u[0],M=u[1],m=e,w=o[0],b=o[1],_=o[2],a,t),t.point(x,M)}function u(){k.point=e,t.lineEnd()}function c(){r(),k.point=l,k.lineEnd=s}function l(n,t){o(f=n,h=t),p=x,g=M,d=w,v=b,y=_,k.point=o}function s(){i(x,M,m,w,b,_,p,g,f,d,v,y,a,t),k.lineEnd=u,u()}var f,h,p,g,d,v,y,m,x,M,w,b,_,k={point:e,lineStart:r,lineEnd:u,polygonStart:function(){t.polygonStart(),k.lineStart=c},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function i(t,e,r,a,c,l,s,f,h,p,g,d,v,y){var m=s-t,x=f-e,M=m*m+x*x;if(M>4*o&&v--){var w=a+p,b=c+g,_=l+d,k=Math.sqrt(w*w+b*b+_*_),E=Math.asin(_/=k),S=Mu(Mu(_)-1)o||Mu((m*T+x*z)/M-.5)>.3||a*p+c*g+l*d0&&16,t):Math.sqrt(o)},t}function oe(n){var t=ie(function(t,e){return n([t*Bu,e*Bu])});return function(n){return se(t(n))}}function ue(n){this.stream=n}function ae(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ce(n){return le(function(){return n})()}function le(n){function t(n){return n=a(n[0]*Yu,n[1]*Yu),[n[0]*h+c,l-n[1]*h]}function e(n){return(n=a.invert((n[0]-c)/h,(l-n[1])/h))&&[n[0]*Bu,n[1]*Bu]}function r(){a=zt(u=pe(y,m,x),o);var n=o(d,v);return c=p-n[0]*h,l=g+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var o,u,a,c,l,s,f=ie(function(n,t){return n=o(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,p=480,g=250,d=0,v=0,y=0,m=0,x=0,w=Ua,b=M,_=null,k=null;return t.stream=function(n){return s&&(s.valid=!1),s=se(w(u,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(w=null==n?(_=n,Ua):Bt((_=+n)*Yu),i()):_},t.clipExtent=function(n){return arguments.length?(k=n,b=n?Vt(n[0][0],n[0][1],n[1][0],n[1][1]):M,i()):k},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(d=n[0]%360*Yu,v=n[1]%360*Yu,r()):[d*Bu,v*Bu]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yu,m=n[1]%360*Yu,x=n.length>2?n[2]%360*Yu:0,r()):[y*Bu,m*Bu,x*Bu]},su.rebind(t,f,"precision"),function(){return o=n.apply(this,arguments),t.invert=o.invert&&e,r()}}function se(n){return ae(n,function(t,e){n.point(t*Yu,e*Yu)})}function fe(n,t){return[n,t]}function he(n,t){return[n>Ou?n-Fu:n<-Ou?n+Fu:n,t]}function pe(n,t,e){return n?t||e?zt(de(n),ve(t,e)):de(n):t||e?ve(t,e):he}function ge(n){return function(t,e){return t+=n,[t>Ou?t-Fu:t<-Ou?t+Fu:t,e]}}function de(n){var t=ge(n);return t.invert=ge(-n),t}function ve(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*i;return[Math.atan2(c*o-s*u,a*r-l*i),rn(s*o+c*u)]}var r=Math.cos(n),i=Math.sin(n),o=Math.cos(t),u=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*o-c*u;return[Math.atan2(c*o+l*u,a*r+s*i),rn(s*r-a*i)]},e}function ye(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,o,u,a){var c=u*t;null!=i?(i=me(e,i),o=me(e,o),(u>0?io)&&(i+=u*Fu)):(i=n+u*Fu,o=n-.5*c);for(var l,s=i;u>0?s>o:s0?t<-Iu+Uu&&(t=-Iu+Uu):t>Iu-Uu&&(t=Iu-Uu);var e=u/Math.pow(i(t),o);return[e*Math.sin(o*n),u-e*Math.cos(o*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Ou/4+n/2)},o=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),u=r*Math.pow(i(n),o)/o;return o?(e.invert=function(n,t){var e=u-t,r=nn(o)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/o,2*Math.atan(Math.pow(u/r,1/o))-Iu]},e):Ae}function Ne(n,t){function e(n,t){var e=o-t;return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),o=r/i+n;return Mu(i)1&&tn(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function De(n,t){return n[0]-t[0]||n[1]-t[1]}function Re(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Pe(n,t,e,r){var i=n[0],o=e[0],u=t[0]-i,a=r[0]-o,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-o))/(f*u-a*s);return[i+h*u,c+h*s]}function Ue(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function je(){or(this),this.edge=this.site=this.circle=null}function Oe(n){var t=ac.pop()||new je;return t.site=n,t}function Fe(n){Je(n),ic.remove(n),ac.push(n),or(n)}function He(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},o=n.P,u=n.N,a=[n];Fe(n);for(var c=o;c.circle&&Mu(e-c.circle.x)Uu)a=a.L;else{if(!((i=o-Be(a,u))>Uu)){r>-Uu?(t=a.P,e=a):i>-Uu?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Oe(n);if(ic.insert(t,c),t||e){if(t===e)return Je(t),e=Oe(t.site),ic.insert(c,e),c.edge=e.edge=nr(t.site,c.site),Xe(t),void Xe(e);if(!e)return void(c.edge=nr(t.site,c.site));Je(t),Je(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,p=n.y-f,g=e.site,d=g.x-s,v=g.y-f,y=2*(h*v-p*d),m=h*h+p*p,x=d*d+v*v,M={x:(v*m-p*x)/y+s,y:(h*x-d*m)/y+f};er(e.edge,l,g,M),c.edge=nr(l,n,null,M),e.edge=nr(n,g,null,M),Xe(t),Xe(e)}}function Ye(n,t){var e=n.site,r=e.x,i=e.y,o=i-t;if(!o)return r;var u=n.P;if(!u)return-(1/0);e=u.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/o-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+i-o/2)))/f+r:(r+a)/2}function Be(n,t){var e=n.N;if(e)return Ye(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ze(n){this.site=n,this.edges=[]}function Ve(n){for(var t,e,r,i,o,u,a,c,l,s,f=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],d=rc,v=d.length;v--;)if((o=d[v])&&o.prepare())for(a=o.edges,c=a.length,u=0;uUu||Mu(i-e)>Uu)&&(a.splice(u,0,new rr(tr(o.site,s,Mu(r-f)Uu?{x:f,y:Mu(t-f)Uu?{x:Mu(e-g)Uu?{x:h,y:Mu(t-h)Uu?{x:Mu(e-p)=-ju)){var p=c*c+l*l,g=s*s+f*f,d=(f*p-l*g)/h,v=(c*g-s*p)/h,f=v+a,y=cc.pop()||new We;y.arc=n,y.site=i,y.x=d+u,y.y=f+Math.sqrt(d*d+v*v),y.cy=f,n.circle=y;for(var m=null,x=uc._;x;)if(y.y=a)return;if(h>g){if(o){if(o.y>=l)return}else o={x:v,y:c};e={x:v,y:l}}else{if(o){if(o.y1)if(h>g){if(o){if(o.y>=l)return}else o={x:(c-i)/r,y:c};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=a)return}else o={x:u,y:r*u+i};e={x:a,y:r*a+i}}else{if(o){if(o.xo||f>u||h=M,_=e>=w,k=_<<1|b,E=k+4;ko&&(i=t.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:xr(e,r)})),o=fc.lastIndex;return o=0&&!(e=su.interpolators[r](n,t)););return e}function br(n,t){var e,r=[],i=[],o=n.length,u=t.length,a=Math.min(n.length,t.length);for(e=0;e=1?1:n(t)}}function kr(n){return function(t){return 1-n(1-t)}}function Er(n){return function(t){return.5*(t<.5?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function Nr(n){return n*n*n}function Ar(n){if(n<=0)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}function Cr(n){return function(t){return Math.pow(t,n)}}function Tr(n){return 1-Math.cos(n*Iu)}function zr(n){return Math.pow(2,10*(n-1))}function Lr(n){return 1-Math.sqrt(1-n*n)}function qr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Fu*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Fu/t)}}function Dr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Rr(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Pr(n,t){n=su.hcl(n),t=su.hcl(t);var e=n.h,r=n.c,i=n.l,o=t.h-e,u=t.c-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return pn(e+o*n,r+u*n,i+a*n)+""}}function Ur(n,t){n=su.hsl(n),t=su.hsl(t);var e=n.h,r=n.s,i=n.l,o=t.h-e,u=t.s-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return fn(e+o*n,r+u*n,i+a*n)+""}}function jr(n,t){n=su.lab(n),t=su.lab(t);var e=n.l,r=n.a,i=n.b,o=t.l-e,u=t.a-r,a=t.b-i;return function(n){return dn(e+o*n,r+u*n,i+a*n)+""}}function Or(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Fr(n){var t=[n.a,n.b],e=[n.c,n.d],r=Ir(t),i=Hr(t,e),o=Ir(Yr(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Br(e)+"rotate(",null,")")-2,x:xr(n,t)})):t&&e.push(Br(e)+"rotate("+t+")")}function $r(n,t,e,r){n!==t?r.push({i:e.push(Br(e)+"skewX(",null,")")-2,x:xr(n,t)}):t&&e.push(Br(e)+"skewX("+t+")")}function Wr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Br(e)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(n[0],t[0])},{i:i-2,x:xr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Br(e)+"scale("+t+")")}function Xr(n,t){var e=[],r=[];return n=su.transform(n),t=su.transform(t),Zr(n.translate,t.translate,e,r),Vr(n.rotate,t.rotate,e,r),$r(n.skew,t.skew,e,r),Wr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,o=r.length;++i=0;)e.push(i[r])}function ci(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(o=n.children)&&(i=o.length))for(var i,o,u=-1;++ui&&(r=e,i=t);return r}function xi(n){return n.reduce(Mi,0)}function Mi(n,t){return n+t[1]}function wi(n,t){return bi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function bi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,o=[];++e<=t;)o[e]=i*e+r;return o}function _i(n){return[su.min(n),su.max(n)]}function ki(n,t){return n.value-t.value}function Ei(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Si(n,t){n._pack_next=t,t._pack_prev=n}function Ni(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ai(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(l=e.length)){var e,r,i,o,u,a,c,l,s=1/0,f=-(1/0),h=1/0,p=-(1/0);if(e.forEach(Ci),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(o=e[2],Li(r,i,o),t(o),Ei(r,o),r._pack_prev=o,Ei(o,i),i=r._pack_next,u=3;u=0;)t=i[o],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function ji(n,t,e){return n.a.parent===t.parent?n.a:e}function Oi(n){return 1+su.max(n,function(n){return n.y})}function Fi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Hi(n){var t=n.children;return t&&t.length?Hi(t[0]):n}function Ii(n){var t,e=n.children;return e&&(t=e.length)?Ii(e[t-1]):n}function Yi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Bi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],o=n.dy-t[0]-t[2];return i<0&&(e+=i/2,i=0),o<0&&(r+=o/2,o=0),{x:e,y:r,dx:i,dy:o}}function Zi(n){var t=n[0],e=n[n.length-1];return t2?Ji:$i,c=r?Gr:Jr;return u=i(n,t,c,e),a=i(t,n,c,wr),o}function o(n){return u(n)}var u,a;return o.invert=function(n){return a(n)},o.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},o.range=function(n){return arguments.length?(t=n,i()):t},o.rangeRound=function(n){return o.range(n).interpolate(Or)},o.clamp=function(n){return arguments.length?(r=n,i()):r},o.interpolate=function(n){return arguments.length?(e=n,i()):e},o.ticks=function(t){return to(n,t)},o.tickFormat=function(t,e){return eo(n,t,e)},o.nice=function(t){return Qi(n,t),i()},o.copy=function(){return Gi(n,t,e,r)},i()}function Ki(n,t){return su.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Qi(n,t){return Wi(n,Xi(no(n,t)[2])),Wi(n,Xi(no(n,t)[2])),n}function no(n,t){null==t&&(t=10);var e=Zi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return o<=.15?i*=10:o<=.35?i*=5:o<=.75&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function to(n,t){return su.range.apply(su,no(n,t))}function eo(n,t,e){var r=no(n,t);if(e){var i=sa.exec(e);if(i.shift(),"s"===i[8]){var o=su.formatPrefix(Math.max(Mu(r[0]),Mu(r[1])));return i[7]||(i[7]="."+ro(o.scale(r[2]))),i[8]="f",e=su.format(i.join("")),function(n){return e(o.scale(n))+o.symbol}}i[7]||(i[7]="."+io(i[8],r)),e=i.join("")}else e=",."+ro(r[2])+"f";return su.format(e)}function ro(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function io(n,t){var e=ro(t[2]);return n in _c?Math.abs(e-ro(Math.max(Mu(t[0]),Mu(t[1]))))+ +("e"!==n):e-2*("%"===n)}function oo(n,t,e,r){function i(n){return(e?Math.log(n<0?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function o(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function u(t){return n(i(t))}return u.invert=function(t){return o(n.invert(t))},u.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),u):r},u.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),u):t},u.nice=function(){var t=Wi(r.map(i),e?Math:Ec);return n.domain(t),r=t.map(o),u},u.ticks=function(){var n=Zi(r),u=[],a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;l0;h--)u.push(o(l)*h);for(l=0;u[l]c;s--);u=u.slice(l,s)}return u},u.tickFormat=function(n,e){if(!arguments.length)return kc;arguments.length<2?e=kc:"function"!=typeof e&&(e=su.format(e));var r=Math.max(1,t*n/u.ticks().length);return function(n){var u=n/o(Math.round(i(n)));return u*t0?a[e-1]:n[0],e0?0:1}function wo(n,t,e,r,i){var o=n[0]-t[0],u=n[1]-t[1],a=(i?r:-r)/Math.sqrt(o*o+u*u),c=a*u,l=-a*o,s=n[0]+c,f=n[1]+l,h=t[0]+c,p=t[1]+l,g=(s+h)/2,d=(f+p)/2,v=h-s,y=p-f,m=v*v+y*y,x=e-r,M=s*p-h*f,w=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-M*M)),b=(M*y-v*w)/m,_=(-M*v-y*w)/m,k=(M*y+v*w)/m,E=(-M*v+y*w)/m,S=b-g,N=_-d,A=k-g,C=E-d;return S*S+N*N>A*A+C*C&&(b=k,_=E),[[b-c,_-l],[b*e/x,_*e/x]]}function bo(n){function t(t){function u(){l.push("M",o(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,p=Cn(e),g=Cn(r);++f1?n.join("L"):n+"Z"}function ko(n){return n.join("L")+"Z"}function Eo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function So(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],o=n[c],c++,r+="C"+(i[0]+u[0])+","+(i[1]+u[1])+","+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1];for(var l=2;l9&&(i=3*t/Math.sqrt(i),u[a]=i*e,u[a+1]=i*r));for(a=-1;++a<=c;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+u[a]*u[a])),o.push([i||0,u[a]*i||0]);return o}function Io(n){return n.length<3?_o(n):n[0]+zo(n,Ho(n))}function Yo(n){for(var t,e,r,i=-1,o=n.length;++i0;)p[--a].call(n,u);if(o>=1)return d.event&&d.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1}var c,l,s,h,p,g=n[e]||(n[e]={active:0,count:0}),d=g[r];d||(c=i.time,l=Dn(o,0,c),d=g[r]={tween:new f,time:c,timer:l,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function ru(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function iu(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function ou(n){return n.toISOString()}function uu(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,o=su.bisect(Jc,i);return o==Jc.length?[t.year,no(n.map(function(n){return n/31536e6}),e)[2]]:o?t[i/Jc[o-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=au(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=au(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Zi(r.domain()),o=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return o&&(n=o[0],t=o[1]),n.range(e[0],au(+e[1]+1),t<1?1:t)},r.tickFormat=function(){return e},r.copy=function(){return uu(n.copy(),t,e)},Ki(r,n)}function au(n){return new Date(n)}function cu(n){return JSON.parse(n.responseText)}function lu(n){var t=pu.createRange();return t.selectNode(pu.body),t.createContextualFragment(n.responseText)}var su={version:"3.5.17"},fu=[].slice,hu=function(n){return fu.call(n)},pu=this.document;if(pu)try{hu(pu.documentElement.childNodes)[0].nodeType}catch(n){hu=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),pu)try{pu.createElement("DIV").style.setProperty("opacity",0,"")}catch(n){var gu=this.Element.prototype,du=gu.setAttribute,vu=gu.setAttributeNS,yu=this.CSSStyleDeclaration.prototype,mu=yu.setProperty;gu.setAttribute=function(n,t){du.call(this,n,t+"")},gu.setAttributeNS=function(n,t,e){vu.call(this,n,t,e+"")},yu.setProperty=function(n,t,e){mu.call(this,n,t+"",e)}}su.ascending=i,su.descending=function(n,t){return tn?1:t>=n?0:NaN},su.min=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},su.max=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},su.extent=function(n,t){var e,r,i,o=-1,u=n.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return c/(s-1)},su.deviation=function(){var n=su.variance.apply(this,arguments);return n?Math.sqrt(n):n};var xu=a(i);su.bisectLeft=xu.left,su.bisect=su.bisectRight=xu.right,su.bisector=function(n){return a(1===n.length?function(t,e){return i(n(t),e)}:n)},su.shuffle=function(n,t,e){(o=arguments.length)<3&&(e=n.length,o<2&&(t=0));for(var r,i,o=e-t;o;)i=Math.random()*o--|0,r=n[o+t],n[o+t]=n[i+t],n[i+t]=r;return n},su.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},su.pairs=function(n){for(var t=0,e=n.length-1,r=n[0],i=new Array(e<0?0:e);t=0;)for(r=n[i],t=r.length;--t>=0;)e[--u]=r[t];return e};var Mu=Math.abs;su.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e==1/0)throw new Error("infinite range");var r,i=[],o=l(Mu(e)),u=-1;if(n*=o,t*=o,e*=o,e<0)for(;(r=n+e*++u)>t;)i.push(r/o);else for(;(r=n+e*++u)=o.length)return r?r.call(i,u):e?u.sort(e):u;for(var c,l,s,h,p=-1,g=u.length,d=o[a++],v=new f;++p=o.length)return n;var r=[],i=u[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},o=[],u=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(su.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return u[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},su.set=function(n){var t=new x;if(n)for(var e=0,r=n.length;e=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},su.event=null,su.requote=function(n){return n.replace(ku,"\\$&")};var ku=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Eu={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Su=function(n,t){return t.querySelector(n)},Nu=function(n,t){return t.querySelectorAll(n)},Au=function(n,t){var e=n.matches||n[b(n,"matchesSelector")];return(Au=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Su=function(n,t){return Sizzle(n,t)[0]||null},Nu=Sizzle,Au=Sizzle.matchesSelector),su.selection=function(){return su.select(pu.documentElement)};var Cu=su.selection.prototype=[];Cu.select=function(n){var t,e,r,i,o=[];n=T(n);for(var u=-1,a=this.length;++u=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),zu.hasOwnProperty(e)?{space:zu[e],local:n}:n}},Cu.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=su.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},Cu.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=R(n)).length,i=-1;if(t=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Cu.sort=function(n){n=B.apply(this,arguments);for(var t=-1,e=this.length;++t0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){w&&w.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),_&&_.domain(b.range().map(function(n){return(n-k.y)/k.k}).map(b.invert))}function c(n){T++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--T||(n({type:"zoomend"}),v=null)}function f(){function n(){a=1,o(su.mouse(i),h),l(u)}function e(){f.on(L,null).on(q,null),p(a),s(u)}var i=this,u=R.of(i,arguments),a=0,f=su.select(r(i)).on(L,n).on(q,e),h=t(su.mouse(i)),p=G(i);Fc.call(i),c(u)}function h(){function n(){var n=su.touches(g);return p=k.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=su.event.target;su.select(t).on(M,r).on(w,a),b.push(t);for(var e=su.event.changedTouches,i=0,o=e.length;i1){var s=c[0],f=c[1],h=s[0]-f[0],p=s[1]-f[1];y=h*h+p*p}}function r(){var n,t,e,r,u=su.touches(g);Fc.call(g);for(var a=0,c=u.length;a=l)return u;if(i)return i=!1,o;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fa=su.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=su.round(n,jn(n,t))).toFixed(Math.max(0,Math.min(20,jn(n*(1+1e-15),t))))}}),ha=su.time={},pa=Date;In.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ga.setUTCDate.apply(this._,arguments)},setDay:function(){ga.setUTCDay.apply(this._,arguments)},setFullYear:function(){ga.setUTCFullYear.apply(this._,arguments)},setHours:function(){ga.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ga.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ga.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ga.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ga.setUTCSeconds.apply(this._,arguments)},setTime:function(){ga.setTime.apply(this._,arguments)}};var ga=Date.prototype;ha.year=Yn(function(n){return n=ha.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ha.years=ha.year.range,ha.years.utc=ha.year.utc.range,ha.day=Yn(function(n){var t=new pa(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ha.days=ha.day.range,ha.days.utc=ha.day.utc.range,ha.dayOfYear=function(n){var t=ha.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t -;var e=ha[n]=Yn(function(n){return(n=ha.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ha[n+"s"]=e.range,ha[n+"s"].utc=e.utc.range,ha[n+"OfYear"]=function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)}}),ha.week=ha.sunday,ha.weeks=ha.sunday.range,ha.weeks.utc=ha.sunday.utc.range,ha.weekOfYear=ha.sundayOfYear;var da={"-":"",_:" ",0:"0"},va=/^\s*\d+/,ya=/^%/;su.locale=function(n){return{numberFormat:Fn(n),timeFormat:Zn(n)}};var ma=su.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});su.format=ma.numberFormat,su.geo={},ht.prototype={s:0,t:0,add:function(n){pt(n,this.t,xa),pt(xa.s,this.s,this),this.s?this.t+=xa.t:this.s=xa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xa=new ht;su.geo.stream=function(n,t){n&&Ma.hasOwnProperty(n.type)?Ma[n.type](n,t):gt(n,t)};var Ma={Feature:function(n,t){gt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rp&&(p=t)}function t(t,e){var r=mt([t*Yu,e*Yu]);if(y){var i=Mt(y,r),o=[i[1],-i[0],0],u=Mt(o,i);_t(u),u=kt(u);var c=t-g,l=c>0?1:-1,d=u[0]*Bu*l,v=Mu(c)>180;if(v^(l*gp&&(p=m)}else if(d=(d+360)%360-180,v^(l*gp&&(p=e);v?ta(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(th&&(h=t)):t>g?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);y=r,g=t}function e(){w.point=t}function r(){M[0]=s,M[1]=h,w.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=Mu(r)>180?r+(r>0?360:-360):r}else d=n,v=e;ka.point(n,e),t(n,e)}function o(){ka.lineStart()}function u(){i(d,v),ka.lineEnd(),Mu(m)>Uu&&(s=-(h=180)),M[0]=s,M[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nUu?p=90:m<-Uu&&(f=-90),M[0]=s,M[1]=h}};return function(n){p=h=-(s=f=1/0),x=[],su.geo.stream(n,w);var t=x.length;if(t){x.sort(c);for(var e,r=1,i=x[0],o=[i];ra(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(var u,e,g=-(1/0),t=o.length-1,r=0,i=o[t];r<=t;i=e,++r)e=o[r],(u=a(i[1],e[0]))>g&&(g=u,s=e[0],h=i[1])}return x=M=null,s===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[s,f],[h,p]]}}(),su.geo.centroid=function(n){Ea=Sa=Na=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,Pa);var t=qa,e=Da,r=Ra,i=t*t+e*e+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?a:o).invert(n)},n.stream=function(n){var t=o.stream(n),e=u.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(o.precision(t),u.precision(t),a.precision(t),n):o.precision()},n.scale=function(t){return arguments.length?(o.scale(t),u.scale(.35*t),a.scale(t),n.translate(o.translate())):o.scale()},n.translate=function(t){if(!arguments.length)return o.translate();var l=o.scale(),s=+t[0],f=+t[1];return e=o.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=u.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Uu,f+.12*l+Uu],[s-.214*l-Uu,f+.234*l-Uu]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Uu,f+.166*l+Uu],[s-.115*l-Uu,f+.234*l-Uu]]).stream(c).point,n},n.scale(1070)};var Oa,Fa,Ha,Ia,Ya,Ba,Za={point:_,lineStart:_,lineEnd:_,polygonStart:function(){Fa=0,Za.lineStart=Xt},polygonEnd:function(){Za.lineStart=Za.lineEnd=Za.point=_,Oa+=Mu(Fa/2)}},Va={point:Jt,lineStart:_,lineEnd:_,polygonStart:_,polygonEnd:_},$a={point:Qt,lineStart:ne,lineEnd:te,polygonStart:function(){$a.lineStart=ee},polygonEnd:function(){$a.point=Qt,$a.lineStart=ne,$a.lineEnd=te}};su.geo.path=function(){function n(n){return n&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),u&&u.valid||(u=i(o)),su.geo.stream(n,u)),o.result()}function t(){return u=null,n}var e,r,i,o,u,a=4.5;return n.area=function(n){return Oa=0,su.geo.stream(n,i(Za)),Oa},n.centroid=function(n){return Na=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,i($a)),Ra?[qa/Ra,Da/Ra]:La?[Ta/La,za/La]:Ca?[Na/Ca,Aa/Ca]:[NaN,NaN]},n.bounds=function(n){return Ya=Ba=-(Ha=Ia=1/0),su.geo.stream(n,i(Va)),[[Ha,Ia],[Ya,Ba]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||oe(n):M,t()):e},n.context=function(n){return arguments.length?(o=null==(r=n)?new Gt:new re(n),"function"!=typeof a&&o.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(o.pointRadius(+t),+t),n):a},n.projection(su.geo.albersUsa()).context(null)},su.geo.transform=function(n){return{stream:function(t){var e=new ue(t);for(var r in n)e[r]=n[r];return e}}},ue.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},su.geo.projection=ce,su.geo.projectionMutator=le,(su.geo.equirectangular=function(){return ce(fe)}).raw=fe.invert=fe,su.geo.rotation=function(n){function t(t){return t=n(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t}return n=pe(n[0]%360*Yu,n[1]*Yu,n.length>2?n[2]*Yu:0),t.invert=function(t){return t=n.invert(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t},t},he.invert=fe,su.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=pe(-n[0]*Yu,-n[1]*Yu,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Bu,n[1]*=Bu}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ye((t=+r)*Yu,i*Yu),n):t},n.precision=function(r){return arguments.length?(e=ye(t*Yu,(i=+r)*Yu),n):i},n.angle(90)},su.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yu,i=n[1]*Yu,o=t[1]*Yu,u=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*u)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},su.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return su.range(Math.ceil(o/v)*v,i,v).map(h).concat(su.range(Math.ceil(l/y)*y,c,y).map(p)).concat(su.range(Math.ceil(r/g)*g,e,g).filter(function(n){return Mu(n%v)>Uu}).map(s)).concat(su.range(Math.ceil(a/d)*d,u,d).filter(function(n){return Mu(n%y)>Uu}).map(f))}var e,r,i,o,u,a,c,l,s,f,h,p,g=10,d=g,v=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],o>i&&(t=o,o=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(m)):[[o,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),a>u&&(t=a,a=u,u=t),n.precision(m)):[[r,a],[e,u]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(v=+t[0],y=+t[1],n):[v,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],d=+t[1],n):[g,d]},n.precision=function(t){return arguments.length?(m=+t,s=xe(a,u,90),f=Me(r,e,m),h=xe(l,c,90),p=Me(o,i,m),n):m},n.majorExtent([[-180,-90+Uu],[180,90-Uu]]).minorExtent([[-180,-80-Uu],[180,80+Uu]])},su.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=we,i=be;return n.distance=function(){return su.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},su.geo.interpolate=function(n,t){return _e(n[0]*Yu,n[1]*Yu,t[0]*Yu,t[1]*Yu)},su.geo.length=function(n){return Wa=0,su.geo.stream(n,Xa),Wa};var Wa,Xa={sphere:_,point:_,lineStart:ke,lineEnd:_,polygonStart:_,polygonEnd:_},Ja=Ee(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(su.geo.azimuthalEqualArea=function(){return ce(Ja)}).raw=Ja;var Ga=Ee(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},M);(su.geo.azimuthalEquidistant=function(){return ce(Ga)}).raw=Ga,(su.geo.conicConformal=function(){return $t(Se)}).raw=Se,(su.geo.conicEquidistant=function(){return $t(Ne)}).raw=Ne;var Ka=Ee(function(n){return 1/n},Math.atan);(su.geo.gnomonic=function(){return ce(Ka)}).raw=Ka,Ae.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Iu]},(su.geo.mercator=function(){return Ce(Ae)}).raw=Ae;var Qa=Ee(function(){return 1},Math.asin);(su.geo.orthographic=function(){return ce(Qa)}).raw=Qa;var nc=Ee(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(su.geo.stereographic=function(){return ce(nc)}).raw=nc,Te.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Iu]},(su.geo.transverseMercator=function(){var n=Ce(Te),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Te,su.geom={},su.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=Cn(e),o=Cn(r),u=n.length,a=[],c=[];for(t=0;t=0;--t)p.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=o&&l.y>=i&&l.y<=u?[[r,u],[o,u],[o,i],[r,i]]:[]).point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(o(n,t)/Uu)*Uu,y:Math.round(u(n,t)/Uu)*Uu,i:t}})}var r=ze,i=Le,o=r,u=i,a=lc;return n?t(n):(t.links=function(n){return lr(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return lr(e(n)).cells.forEach(function(e,r){for(var i,o=e.site,u=e.edges.sort($e),a=-1,c=u.length,l=u[c-1].edge,s=l.l===o?l.r:l.l;++a=l,h=r>=s,p=h<<1|f;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=gr()),f?i=l:a=l,h?u=s:c=s,o(n,t,e,r,i,u,a,c)}var s,f,h,p,g,d,v,y,m,x=Cn(a),M=Cn(c);if(null!=t)d=t,v=e,y=r,m=i;else if(y=m=-(d=v=1/0),f=[],h=[],g=n.length,u)for(p=0;py&&(y=s.x),s.y>m&&(m=s.y),f.push(s.x),h.push(s.y);else for(p=0;py&&(y=w),b>m&&(m=b),f.push(w),h.push(b)}var _=y-d,k=m-v;_>k?m=v+_:y=d+k;var E=gr();if(E.add=function(n){o(E,n,+x(n,++p),+M(n,p),d,v,y,m)},E.visit=function(n){dr(n,E,d,v,y,m)},E.find=function(n){return vr(E,n[0],n[1],d,v,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=pc.get(e)||hc,r=gc.get(r)||M,_r(r(e.apply(null,fu.call(arguments,1))))},su.interpolateHcl=Pr,su.interpolateHsl=Ur,su.interpolateLab=jr,su.interpolateRound=Or,su.transform=function(n){var t=pu.createElementNS(su.ns.prefix.svg,"g");return(su.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Fr(e?e.matrix:dc)})(n)},Fr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var dc={a:1,b:0,c:0,d:1,e:0,f:0};su.interpolateTransform=Xr,su.layout={},su.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e0?i=n:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:i=0})):n>0&&(l.start({type:"start",alpha:i=n}),e=Dn(c.tick)),c):i},c.start=function(){function n(n,r){if(!e){for(e=new Array(i),c=0;c=0;)u.push(s=l[c]),s.parent=o,s.depth=o.depth+1;r&&(o.value=0),o.children=l}else r&&(o.value=+r.call(n,o,o.depth)||0),delete o.children;return ci(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=fi,e=li,r=si;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ai(t,function(n){n.children&&(n.value=0)}),ci(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},su.layout.partition=function(){function n(t,e,r,i){var o=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(u=o.length)){var u,a,c,l=-1;for(r=t.value?r/t.value:0;++la&&(a=r),u.push(r)}for(e=0;e0)for(o=-1;++o=s[0]&&a<=s[1]&&(u=c[su.bisect(f,a,1,p)-1],u.y+=g,u.push(n[o]));return c}var t=!0,e=Number,r=_i,i=wi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Cn(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return bi(n,t)}:Cn(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},su.layout.pack=function(){function n(n,o){var u=e.call(this,n,o),a=u[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ci(a,function(n){n.r=+s(n.value)}),ci(a,Ai),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ci(a,function(n){n.r+=f}),ci(a,Ai),ci(a,function(n){n.r-=f})}return zi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),u}var t,e=su.layout.hierarchy().sort(ki),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ui(n,e)},su.layout.tree=function(){function n(n,i){var s=u.call(this,n,i),f=s[0],h=t(f);if(ci(h,e),h.parent.m=-h.z,ai(h,r),l)ai(f,o);else{var p=f,g=f,d=f;ai(f,function(n){n.xg.x&&(g=n),n.depth>d.depth&&(d=n)});var v=a(p,g)/2-p.x,y=c[0]/(g.x+a(g,p)/2+v),m=c[1]/(d.depth||1);ai(f,function(n){n.x=(n.x+v)*y,n.y=n.depth*m})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,o=t.children,u=0,a=o.length;u0&&(Pi(ji(u,n,e),n,r),l+=r,s+=r),f+=u.m,l+=i.m,h+=c.m,s+=o.m;u&&!Ri(o)&&(o.t=u,o.m+=f-s),i&&!Di(c)&&(c.t=i,c.m+=l-h,e=n)}return e}function o(n){n.x*=c[0],n.y=n.depth*c[1]}var u=su.layout.hierarchy().sort(null).value(null),a=qi,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?o:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:o,n):l?c:null},ui(n,u)},su.layout.cluster=function(){function n(n,o){var u,a=t.call(this,n,o),c=a[0],l=0;ci(c,function(n){var t=n.children;t&&t.length?(n.x=Fi(t),n.y=Oi(t)):(n.x=u?l+=e(n,u):0,n.y=0,u=n)});var s=Hi(c),f=Ii(c),h=s.x-e(s,f)/2,p=f.x+e(f,s)/2;return ci(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=su.layout.hierarchy().sort(null).value(null),e=qi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},su.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,o=n.length;++i0;)s.push(u=h[c-1]),s.area+=u.area,"squarify"!==p||(a=r(s,d))<=g?(h.pop(),g=a):(s.area-=s.pop().area,i(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,g=1/0);s.length&&(i(s,d,l,!0),s.length=s.area=0),o.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var o,u=f(t),a=r.slice(),c=[];for(n(a,u.dx*u.dy/t.value),c.area=0;o=a.pop();)c.push(o),c.area+=o.area,null!=o.z&&(i(c,o.z?u.dx:u.dy,u,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,o=1/0,u=-1,a=n.length;++ui&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*o*g)):1/0}function i(n,t,e,r){var i,o=-1,u=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++oe.dx)&&(s=e.dx);++o1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=su.random.normal.apply(su,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=su.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;ef?0:1;if(l=Hu)return t(l,p)+(n?t(n,1-p):"")+"Z";var g,d,v,y,m,x,M,w,b,_,k,E,S=0,N=0,A=[];if((y=(+c.apply(this,arguments)||0)/2)&&(v=o===Tc?Math.sqrt(n*n+l*l):+o.apply(this,arguments),p||(N*=-1),l&&(N=rn(v/l*Math.sin(y))),n&&(S=rn(v/n*Math.sin(y)))),l){m=l*Math.cos(s+N),x=l*Math.sin(s+N),M=l*Math.cos(f-N),w=l*Math.sin(f-N);var C=Math.abs(f-s-2*N)<=Ou?0:1;if(N&&Mo(m,x,M,w)===p^C){var T=(s+f)/2;m=l*Math.cos(T),x=l*Math.sin(T),M=w=null}}else m=x=0;if(n){b=n*Math.cos(f-S),_=n*Math.sin(f-S),k=n*Math.cos(s+S),E=n*Math.sin(s+S);var z=Math.abs(s-f+2*S)<=Ou?0:1;if(S&&Mo(b,_,k,E)===1-p^z){var L=(s+f)/2;b=n*Math.cos(L),_=n*Math.sin(L),k=E=null}}else b=_=0;if(h>Uu&&(g=Math.min(Math.abs(l-n)/2,+i.apply(this,arguments)))>.001){d=nOu)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var o=we,u=be,a=Zo,c=yo,l=mo;return n.radius=function(t){return arguments.length?(a=Cn(t),n):a},n.source=function(t){return arguments.length?(o=Cn(t),n):o},n.target=function(t){return arguments.length?(u=Cn(t),n):u},n.startAngle=function(t){return arguments.length?(c=Cn(t),n):c},n.endAngle=function(t){return arguments.length?(l=Cn(t),n):l},n},su.svg.diagonal=function(){function n(n,i){var o=t.call(this,n,i),u=e.call(this,n,i),a=(o.y+u.y)/2,c=[o,{x:o.x,y:a},{x:u.x,y:a},u];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=we,e=be,r=Vo;return n.source=function(e){return arguments.length?(t=Cn(e),n):t},n.target=function(t){return arguments.length?(e=Cn(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},su.svg.diagonal.radial=function(){var n=su.svg.diagonal(),t=Vo,e=n.projection;return n.projection=function(n){return arguments.length?e($o(t=n)):t},n},su.svg.symbol=function(){function n(n,r){return(Rc.get(t.call(this,n,r))||Jo)(e.call(this,n,r))}var t=Xo,e=Wo;return n.type=function(e){return arguments.length?(t=Cn(e),n):t},n.size=function(t){return arguments.length?(e=Cn(t),n):e},n};var Rc=su.map({circle:Jo,cross:function(n){var t=Math.sqrt(n/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(n){var t=Math.sqrt(n/(2*Uc)),e=t*Uc;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});su.svg.symbolTypes=Rc.keys();var Pc=Math.sqrt(3),Uc=Math.tan(30*Yu);Cu.transition=function(n){for(var t,e,r=jc||++Ic,i=tu(n),o=[],u=Oc||{time:Date.now(),ease:Ar,delay:0,duration:250},a=-1,c=this.length;++arect,.s>rect").attr("width",f[1]-f[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function o(){function o(){32==su.event.keyCode&&(C||(x=null,z[0]-=f[1],z[1]-=h[1],C=2),S())}function d(){32==su.event.keyCode&&2==C&&(z[0]+=f[1],z[1]+=h[1],C=0,S())}function v(){var n=su.mouse(w),r=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(su.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),z[0]=f[+(n[0]0?o=setTimeout(i,t-s):(o=null,e||(l=n.apply(a,u),o||(a=u=null)))}var o,u,a,c,l;return null==t&&(t=100),function(){a=this,u=arguments,c=r();var s=e&&!o;return o||(o=setTimeout(i,t)),s&&(l=n.apply(a,u),a=u=null),l}}},{"date-now":2}],4:[function(n,t,e){(function(r){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(n){var t=this.useColors;if(n[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+n[0]+(t?"%c ":" ")+"+"+e.humanize(this.diff),t){var r="color: "+this.color;n.splice(1,0,r,"color: inherit");var i=0,o=0;n[0].replace(/%[a-zA-Z%]/g,function(n){"%%"!==n&&(i++,"%c"===n&&(o=i))}),n.splice(o,0,r)}}function u(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(n){try{null==n?e.storage.removeItem("debug"):e.storage.debug=n}catch(n){}}function c(){try{return e.storage.debug}catch(n){}if(void 0!==r&&"env"in r)return r.env.DEBUG}e=t.exports=n("./debug"),e.log=u,e.formatArgs=o,e.save=a,e.load=c,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(n){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(n){try{return JSON.stringify(n)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}},e.enable(c())}).call(this,n("_process"))},{"./debug":5,_process:8}],5:[function(n,t,e){function r(n){var t,r=0;for(t in n)r=(r<<5)-r+n.charCodeAt(t),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function i(n){function t(){if(t.enabled){var n=t,r=+new Date,i=r-(l||r);n.diff=i,n.prev=l,n.curr=r,l=r;for(var o=new Array(arguments.length),u=0;u1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(t){var e=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*f;case"days":case"day":case"d":return e*s;case"hours":case"hour":case"hrs":case"hr":case"h":return e*l;case"minutes":case"minute":case"mins":case"min":case"m":return e*c;case"seconds":case"second":case"secs":case"sec":case"s":return e*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function i(n){return n>=s?Math.round(n/s)+"d":n>=l?Math.round(n/l)+"h":n>=c?Math.round(n/c)+"m":n>=a?Math.round(n/a)+"s":n+"ms"}function o(n){return u(n,s,"day")||u(n,l,"hour")||u(n,c,"minute")||u(n,a,"second")||n+" ms"}function u(n,t,e){if(!(n0)return r(n);if("number"===e&&isNaN(n)===!1)return t.long?o(n):i(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],7:[function(n,t,e){function r(n){if("number"!=typeof n||Number.isNaN(n))throw new TypeError("Expected a number, got "+typeof n);var t=n<0,e=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(n=-n),n<1)return(t?"-":"")+n+" B";var r=Math.min(Math.floor(Math.log(n)/Math.log(1e3)),e.length-1);n=Number(n/Math.pow(1e3,r));var i=e[r];return n>=10||n%1==0?(t?"-":"")+n.toFixed(0)+" "+i:(t?"-":"")+n.toFixed(1)+" "+i}t.exports=r},{}],8:[function(n,t,e){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(n){if(f===setTimeout)return setTimeout(n,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(n,0);try{return f(n,0)}catch(t){try{return f.call(null,n,0)}catch(t){return f.call(this,n,0)}}}function u(n){if(h===clearTimeout)return clearTimeout(n);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(n);try{return h(n)}catch(t){try{return h.call(null,n)}catch(t){return h.call(this,n)}}}function a(){v&&g&&(v=!1,g.length?d=g.concat(d):y=-1,d.length&&c())}function c(){if(!v){var n=o(a);v=!0;for(var t=d.length;t;){for(g=d,d=[];++y1)for(var e=1;e=c.links.maxBytes?c.links.maxBytes:n,{width:n*c.links.maxWidth/c.links.maxBytes,unit:e}}function r(){U=U.data(z.links),P=P.data(z.nodes,function(n){return n.id}),U.enter().insert("line",".node").attr("class","link").style("stroke",l.links.color).style("opacity",.5),U.exit().remove(),U.style("stroke-width",function(n){return n.rate?n.rate.width=900?400:250,R.size([L,q]).resume(),D.attr("width",n.offsetWidth).attr("height",q)}function f(n){return n.children?n.children.map(function(n){return P[0][n]}).filter(function(n){return n}):[]}function h(n){return n.parents?n.parents.map(function(n){return P[0][n]}).filter(function(n){return n}):[]}function p(n,t){return t.id===n.id||n.children&&n.children.indexOf(t.id)!==-1||t.children&&t.children.indexOf(n.id)!==-1||t.parents&&t.parents.indexOf(n.id)!==-1||n.parents&&n.parents.indexOf(t.id)!==-1}function g(n){for(var t=0,e=z.nodes.length;t"+t,"at",a(i)),"number"!=typeof i||i<0)throw new Error("rate: 3th param must be a positive number");var u=g(n);if(!u)throw new Error("rate: invalid source id");var c=g(t);if(!c)throw new Error("rate: invalid target id");var l=y(u.index,c.index);if(l===-1)throw new Error("rate: connection does not exist");z.links[l].rate=e(i),o("rate:",z.links[l].rate),r()}"string"==typeof n&&(n=document.querySelector(n));var T,z={nodes:[],links:[]},L=n.offsetWidth,q=window.innerWidth>=900?400:250;z.links.forEach(function(n){var t=z.nodes[n.source],e=z.nodes[n.target];t.children=t.children||[],t.children.push(n.target),e.parents=e.parents||[],e.parents.push(n.source)});var D=i.select(n).append("svg").attr("width",L).attr("height",q),R=i.layout.force().size([L,q]).nodes(z.nodes).links(z.links).on("tick",function(){U.attr("x1",function(n){return n.source.x}).attr("y1",function(n){return n.source.y}).attr("x2",function(n){return n.target.x}).attr("y2",function(n){return n.target.y}),P.attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y}),P.attr("transform",function(n){return"translate("+n.x+","+n.y+")"})}),P=D.selectAll(".node"),U=D.selectAll(".link");return r(),window.addEventListener("resize",u(s,500)),s(),{list:m,add:x,hasPeer:_,hasLink:k,remove:M,connect:w,disconnect:b,getLink:v,areConnected:E,unchoke:S,choke:N,seed:A,rate:C}}t.exports=r;var i=n("d3"),o=n("debug")("p2p-graph"),u=n("debounce"),a=n("prettier-bytes"),c={links:{width:.7,maxWidth:5,maxBytes:2097152}},l={links:{color:"#C8C8C8"},text:{subtitle:"#C8C8C8"},nodes:{method:function(n,t){return n.me?i.hsl(210,.7,.725):n.seeder?i.hsl(120,.7,.725):i.hsl(55,.7,.725)},hover:"#A9A9A9",dep:"#252929"}}},{d3:1,debounce:3,debug:4,"prettier-bytes":7}]},{},[9])(9)}); +!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.P2PGraph=n()}}(function(){var n;return function n(t,e,r){function i(u,a){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var s=e[u]={exports:{}};t[u][0].call(s.exports,function(n){var e=t[u][1][n];return i(e||n)},s,s.exports,n,t,e,r)}return e[u].exports}for(var o="function"==typeof require&&require,u=0;ut?1:n>=t?0:NaN}function o(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function a(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function c(n){return n.length}function l(n){for(var t=1;n*t%1;)t*=10;return t}function s(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function f(){this._=Object.create(null)}function h(n){return(n+="")===wu||n[0]===bu?bu+n:n}function p(n){return(n+="")[0]===bu?n.slice(1):n}function g(n){return h(n)in this._}function d(n){return(n=h(n))in this._&&delete this._[n]}function v(){var n=[];for(var t in this._)n.push(p(t));return n}function y(){var n=0;for(var t in this._)++n;return n}function m(){for(var n in this._)return!1;return!0}function x(){this._=Object.create(null)}function M(n){return n}function w(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function b(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_u.length;e=t&&(t=i+1);!(u=a[t])&&++t0&&(n=n.slice(0,a));var l=qu.get(n);return l&&(n=l,c=J),a?t?i:r:t?_:o}function W(n,t){return function(e){var r=su.event;su.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{su.event=r}}}function J(n,t){var e=W(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function G(n){var e=".dragsuppress-"+ ++Ru,i="click"+e,o=su.select(r(n)).on("touchmove"+e,N).on("dragstart"+e,N).on("selectstart"+e,N);if(null==Du&&(Du=!("onselectstart"in n)&&b(n.style,"userSelect")),Du){var u=t(n).style,a=u[Du];u[Du]="none"}return function(n){if(o.on(e,null),Du&&(u[Du]=a),n){var t=function(){o.on(i,null)};o.on(i,function(){N(),t()},!0),setTimeout(t,0)}}}function K(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();if(Pu<0){var o=r(n);if(o.scrollX||o.scrollY){e=su.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();Pu=!(u.f||u.e),e.remove()}}return Pu?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[t.clientX-a.left-n.clientLeft,t.clientY-a.top-n.clientTop]}function Q(){return su.event.changedTouches[0].identifier}function nn(n){return n>0?1:n<0?-1:0}function tn(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function en(n){return n>1?0:n<-1?Fu:Math.acos(n)}function rn(n){return n>1?Iu:n<-1?-Iu:Math.asin(n)}function on(n){return((n=Math.exp(n))-1/n)/2}function un(n){return((n=Math.exp(n))+1/n)/2}function an(n){return((n=Math.exp(2*n))-1)/(n+1)}function cn(n){return(n=Math.sin(n/2))*n}function ln(){}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.s,n.l):kn(""+n,En,sn):new sn(n,t,e)}function fn(n,t,e){function r(n){return n>360?n-=360:n<0&&(n+=360),n<60?o+(u-o)*n/60:n<180?u:n<240?o+(u-o)*(240-n)/60:o}function i(n){return Math.round(255*r(n))}var o,u;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:t<0?0:t>1?1:t,e=e<0?0:e>1?1:e,u=e<=.5?e*(1+t):e+t-e*t,o=2*e-u,new Mn(i(n+120),i(n),i(n-120))}function hn(n,t,e){return this instanceof hn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof hn?new hn(n.h,n.c,n.l):n instanceof gn?vn(n.l,n.a,n.b):vn((n=Nn((n=su.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new hn(n,t,e)}function pn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new gn(e,Math.cos(n*=Yu)*t,Math.sin(n)*t)}function gn(n,t,e){return this instanceof gn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof gn?new gn(n.l,n.a,n.b):n instanceof hn?pn(n.h,n.c,n.l):Nn((n=Mn(n)).r,n.g,n.b):new gn(n,t,e)}function dn(n,t,e){var r=(n+16)/116,i=r+t/500,o=r-e/200;return i=yn(i)*Ku,r=yn(r)*Qu,o=yn(o)*na,new Mn(xn(3.2404542*i-1.5371385*r-.4985314*o),xn(-.969266*i+1.8760108*r+.041556*o),xn(.0556434*i-.2040259*r+1.0572252*o))}function vn(n,t,e){return n>0?new hn(Math.atan2(e,t)*Bu,Math.sqrt(t*t+e*e),n):new hn(NaN,NaN,n)}function yn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function mn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function xn(n){return Math.round(255*(n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function Mn(n,t,e){return this instanceof Mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof Mn?new Mn(n.r,n.g,n.b):kn(""+n,Mn,fn):new Mn(n,t,e)}function wn(n){return new Mn(n>>16,n>>8&255,255&n)}function bn(n){return wn(n)+""}function _n(n){return n<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function kn(n,t,e){var r,i,o,u=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(An(i[0]),An(i[1]),An(i[2]))}return(o=ra.get(n))?t(o.r,o.g,o.b):(null==n||"#"!==n.charAt(0)||isNaN(o=parseInt(n.slice(1),16))||(4===n.length?(u=(3840&o)>>4,u|=u>>4,a=240&o,a|=a>>4,c=15&o,c|=c<<4):7===n.length&&(u=(16711680&o)>>16,a=(65280&o)>>8,c=255&o)),t(u,a,c))}function En(n,t,e){var r,i,o=Math.min(n/=255,t/=255,e/=255),u=Math.max(n,t,e),a=u-o,c=(u+o)/2;return a?(i=c<.5?a/(u+o):a/(2-u-o),r=n==u?(t-e)/a+(t0&&c<1?0:r),new sn(r,i,c)}function Nn(n,t,e){n=Sn(n),t=Sn(t),e=Sn(e);var r=mn((.4124564*n+.3575761*t+.1804375*e)/Ku),i=mn((.2126729*n+.7151522*t+.072175*e)/Qu);return gn(116*i-16,500*(r-i),200*(i-mn((.0193339*n+.119192*t+.9503041*e)/na)))}function Sn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function An(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Cn(n){return"function"==typeof n?n:function(){return n}}function Tn(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),zn(t,e,n,r)}}function zn(n,t,e,r){function i(){var n,t=c.status;if(!t&&qn(c)||t>=200&&t<300||304===t){try{n=e.call(o,c)}catch(n){return void u.error.call(o,n)}u.load.call(o,n)}else u.error.call(o,c)}var o={},u=su.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=su.event;su.event=n;try{u.progress.call(o,c)}finally{su.event=t}},o.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",o)},o.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",o):t},o.responseType=function(n){return arguments.length?(l=n,o):l},o.response=function(n){return e=n,o},["get","post"].forEach(function(n){o[n]=function(){return o.send.apply(o,[n].concat(hu(arguments)))}}),o.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&o.on("error",i).on("load",function(n){i(null,n)}),u.beforesend.call(o,c),c.send(null==r?null:r),o},o.abort=function(){return c.abort(),o},su.rebind(o,u,"on"),null==r?o:o.get(Ln(r))}function Ln(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qn(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Dn(n,t,e){var r=arguments.length;r<2&&(t=0),r<3&&(e=Date.now());var i=e+t,o={c:n,t:i,n:null};return oa?oa.n=o:ia=o,oa=o,ua||(aa=clearTimeout(aa),ua=1,ca(Rn)),o}function Rn(){var n=Pn(),t=Un()-n;t>24?(isFinite(t)&&(clearTimeout(aa),aa=setTimeout(Rn,t)),ua=0):(ua=1,ca(Rn))}function Pn(){for(var n=Date.now(),t=ia;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Un(){for(var n,t=ia,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function On(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,o=r&&e?function(n,t){for(var i=n.length,o=[],u=0,a=r[0],c=0;i>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>t));)a=r[u=(u+1)%r.length];return o.reverse().join(e)}:M;return function(n){var e=sa.exec(n),r=e[1]||" ",u=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],p=e[9],g=1,d="",v="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===u)&&(l=r="0",u="="),p){case"n":f=!0,p="g";break;case"%":g=100,v="%",p="f";break;case"p":g=100,v="%",p="r";break;case"b":case"o":case"x":case"X":"#"===c&&(d="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===c&&(d=i[0],v=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=fa.get(p)||Hn;var x=l&&f;return function(n){var e=v;if(y&&n%1)return"";var i=n<0||0===n&&1/n<0?(n=-n,"-"):"-"===a?"":a;if(g<0){var c=su.formatPrefix(n,h);n=c.scale(n),e=c.symbol+v}else n*=g;n=p(n,h);var M,w,b=n.lastIndexOf(".");if(b<0){var _=m?n.lastIndexOf("e"):-1;_<0?(M=n,w=""):(M=n.substring(0,_),w=n.substring(_))}else M=n.substring(0,b),w=t+n.substring(b+1);!l&&f&&(M=o(M,1/0));var k=d.length+M.length+w.length+(x?0:i.length),E=k"===u?E+i+n:"^"===u?E.substring(0,k>>=1)+i+n+E.substring(k):i+(x?n:E+n))+e}}}function Hn(n){return n+""}function In(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Yn(n,t,e){function r(t){var e=n(t),r=o(e,1);return t-e1)for(;u=l)return-1;if(37===(i=t.charCodeAt(a++))){if(u=t.charAt(a++),!(o=C[u in da?t.charAt(a++):u])||(r=o(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.slice(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){M.lastIndex=0;var r=M.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=S.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){k.lastIndex=0;var r=k.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function c(n,t,r){return e(n,A.x.toString(),t,r)}function l(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=x.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,p=n.time,g=n.periods,d=n.days,v=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{pa=In;var t=new pa;return t._=n,r(t)}finally{pa=Date}}var r=t(n);return e.parse=function(n){try{pa=In;var t=r.parse(n);return t&&t._}finally{pa=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ft;var x=su.map(),M=$n(d),w=Xn(d),b=$n(v),_=Xn(v),k=$n(y),E=Xn(y),N=$n(m),S=Xn(m);g.forEach(function(n,t){x.set(n.toLowerCase(),t)});var A={a:function(n){return v[n.getDay()]},A:function(n){return d[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(f),d:function(n,t){return Vn(n.getDate(),t,2)},e:function(n,t){return Vn(n.getDate(),t,2)},H:function(n,t){return Vn(n.getHours(),t,2)},I:function(n,t){return Vn(n.getHours()%12||12,t,2)},j:function(n,t){return Vn(1+ha.dayOfYear(n),t,3)},L:function(n,t){return Vn(n.getMilliseconds(),t,3)},m:function(n,t){return Vn(n.getMonth()+1,t,2)},M:function(n,t){return Vn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Vn(n.getSeconds(),t,2)},U:function(n,t){return Vn(ha.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Vn(ha.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Vn(n.getFullYear()%100,t,2)},Y:function(n,t){return Vn(n.getFullYear()%1e4,t,4)},Z:lt,"%":function(){return"%"}},C={a:r,A:i,b:o,B:u,c:a,d:rt,e:rt,H:ot,I:ot,j:it,L:ct,m:et,M:ut,p:s,S:at,U:Jn,w:Wn,W:Gn,x:c,X:l,y:Qn,Y:Kn,Z:nt,"%":st};return t}function Vn(n,t,e){var r=n<0?"-":"",i=(r?-n:n)+"",o=i.length;return r+(o68?1900:2e3)}function et(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function rt(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function it(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ot(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function at(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ct(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function lt(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=Mu(t)/60|0,i=Mu(t)%60;return e+Vn(r,"0",2)+Vn(i,"0",2)}function st(n,t,e){ya.lastIndex=0;var r=ya.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ft(n){for(var t=n.length,e=-1;++e=0?1:-1,a=u*e,c=Math.cos(t),l=Math.sin(t),s=o*l,f=i*c+s*Math.cos(a),h=s*u*Math.sin(a);_a.add(Math.atan2(h,f)),r=n,i=c,o=l}var t,e,r,i,o;ka.point=function(u,a){ka.point=n,r=(t=u)*Yu,i=Math.cos(a=(e=a)*Yu/2+Fu/4),o=Math.sin(a)},ka.lineEnd=function(){n(t,e)}}function mt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function xt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function wt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function bt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function _t(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function kt(n){return[Math.atan2(n[1],n[0]),rn(n[2])]}function Et(n,t){return Mu(n[0]-t[0])=0;--a)i.point((f=s[a])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,s=p.z,g=!g}while(!p.v);i.lineEnd()}}}function Dt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++u1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Ut))}var p,g,d,v=t(o),y=i.invert(r[0],r[1]),m={point:u,lineStart:c,lineEnd:l,polygonStart:function(){m.point=s,m.lineStart=f,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=u,m.lineStart=c,m.lineEnd=l,p=su.merge(p);var n=Yt(y,g);p.length?(w||(o.polygonStart(),w=!0),qt(p,Ft,n,e,o)):n&&(w||(o.polygonStart(),w=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=g=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=jt(),M=t(x),w=!1;return m}}function Ut(n){return n.length>1}function jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:_,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ft(n,t){return((n=n.x)[0]<0?n[1]-Iu-Uu:Iu-n[1])-((t=t.x)[0]<0?t[1]-Iu-Uu:Iu-t[1])}function Ot(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var a=o>0?Fu:-Fu,c=Mu(o-e);Mu(c-Fu)0?Iu:-Iu),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(o,r),t=0):i!==a&&c>=Fu&&(Mu(e-i)Uu?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*o*u)):(t+r)/2}function It(n,t,e,r){var i;if(null==n)i=e*Iu,r.point(-Fu,i),r.point(0,i),r.point(Fu,i),r.point(Fu,0),r.point(Fu,-i),r.point(0,-i),r.point(-Fu,-i),r.point(-Fu,0),r.point(-Fu,i);else if(Mu(n[0]-t[0])>Uu){var o=n[0]=0?1:-1,_=b*w,k=_>Fu,E=g*x;if(_a.add(Math.atan2(E*b*Math.sin(_),d*M+E*Math.cos(_))),o+=k?w+b*Ou:w,k^h>=e^y>=e){var N=Mt(mt(f),mt(n));_t(N);var S=Mt(i,N);_t(S);var A=(k^w>=0?-1:1)*rn(S[2]);(r>A||r===A&&(N[0]||N[1]))&&(u+=k^w>=0?1:-1)}if(!v++)break;h=y,g=x,d=M,f=n}}return(o<-Uu||oo}function e(n){var e,o,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var p,g=[f,h],d=t(f,h),v=u?d?0:i(f,h):d?i(f+(f<0?Fu:-Fu),h):0;if(!e&&(l=c=d)&&n.lineStart(),d!==c&&(p=r(e,g),(Et(e,p)||Et(g,p))&&(g[0]+=Uu,g[1]+=Uu,d=t(g[0],g[1]))),d!==c)s=0,d?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&u^d){var y;v&o||!(y=r(g,e,!0))||(s=0,u?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!d||e&&Et(e,g)||n.point(g[0],g[1]),e=g,c=d,o=v},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=mt(n),i=mt(t),u=[1,0,0],a=Mt(r,i),c=xt(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=o*c/s,h=-o*l/s,p=Mt(u,a),g=bt(u,f);wt(g,bt(a,h));var d=p,v=xt(g,d),y=xt(d,d),m=v*v-y*(xt(g,g)-1);if(!(m<0)){var x=Math.sqrt(m),M=bt(d,(-v-x)/y);if(wt(M,g),M=kt(M),!e)return M;var w,b=n[0],_=t[0],k=n[1],E=t[1];_0^M[1]<(Mu(M[0]-b)Fu^(b<=M[0]&&M[0]<=_)){var C=bt(d,(-v+x)/y);return wt(C,g),[M,kt(C)]}}}function i(t,e){var r=u?n:Fu-n,i=0;return t<-r?i|=1:t>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var o=Math.cos(n),u=o>0,a=Mu(o)>Uu;return Pt(t,e,ye(n,6*Yu),u?[0,-n]:[-Fu,n-Fu])}function Zt(n,t,e,r){return function(i){var o,u=i.a,a=i.b,c=u.x,l=u.y,s=a.x,f=a.y,h=0,p=1,g=s-c,d=f-l;if(o=n-c,g||!(o>0)){if(o/=g,g<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=e-c,g||!(o<0)){if(o/=g,g<0){if(o>p)return;o>h&&(h=o)}else if(g>0){if(o0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-l,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0&&(i.a={x:c+h*g,y:l+h*d}),p<1&&(i.b={x:c+p*g,y:l+p*d}),i}}}}}}function Vt(n,t,e,r){function i(r,i){return Mu(r[0]-n)0?0:3:Mu(r[0]-e)0?2:1:Mu(r[1]-t)0?1:0:i>0?3:2}function o(n,t){return u(n.x,t.x)}function u(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=v.length,r=n[1],i=0;ir&&tn(l,o,n)>0&&++t:o[1]<=r&&tn(l,o,n)<0&&--t,l=o;return 0!==t}function l(o,a,c,l){var s=0,f=0;if(null==o||(s=i(o,c))!==(f=i(a,c))||u(o,a)<0^c>0)do{l.point(0===s||3===s?n:e,s>1?r:t)}while((s=(s+c+4)%4)!==f);else l.point(a[0],a[1])}function s(i,o){return n<=i&&i<=e&&t<=o&&o<=r}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=g,v&&v.push(y=[]),k=!0,_=!1,w=b=NaN}function p(){d&&(g(m,x),M&&_&&S.rejoin(),d.push(S.buffer())),C.point=f,_&&a.lineEnd()}function g(n,t){n=Math.max(-ja,Math.min(ja,n)),t=Math.max(-ja,Math.min(ja,t));var e=s(n,t);if(v&&y.push([n,t]),k)m=n,x=t,M=e,k=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&_)a.point(n,t);else{var r={a:{x:w,y:b},b:{x:n,y:t}};A(r)?(_||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),E=!1):e&&(a.lineStart(),a.point(n,t),E=!1)}w=n,b=t,_=e}var d,v,y,m,x,M,w,b,_,k,E,N=a,S=jt(),A=Zt(n,t,e,r),C={point:f,lineStart:h,lineEnd:p,polygonStart:function(){a=S,d=[],v=[],E=!0},polygonEnd:function(){a=N,d=su.merge(d);var t=c([n,r]),e=E&&t,i=d.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),i&&qt(d,o,t,l,a),a.polygonEnd()),d=v=y=null}};return C}}function $t(n){var t=0,e=Fu/3,r=le(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fu/180,e=n[1]*Fu/180):[t/Fu*180,e/Fu*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(o-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),u-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),u=Math.sqrt(o)/i;return e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,rn((o-(n*n+e*e)*i*i)/(2*i))]},e}function Wt(){function n(n,t){Oa+=i*n-r*t,r=n,i=t}var t,e,r,i;Za.point=function(o,u){Za.point=n,t=r=o,e=i=u},Za.lineEnd=function(){n(t,e)}}function Jt(n,t){nYa&&(Ya=n),tBa&&(Ba=t)}function Gt(){function n(n,t){u.push("M",n,",",t,o)}function t(n,t){u.push("M",n,",",t),a.point=e}function e(n,t){u.push("L",n,",",t)}function r(){a.point=n}function i(){u.push("Z")}var o=Kt(4.5),u=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return o=Kt(n),a},result:function(){if(u.length){var n=u.join("");return u=[],n}}};return a}function Kt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qt(n,t){Sa+=n,Aa+=t,++Ca}function ne(){function n(n,r){var i=n-t,o=r-e,u=Math.sqrt(i*i+o*o);Ta+=u*(t+n)/2,za+=u*(e+r)/2,La+=u,Qt(t=n,e=r)}var t,e;$a.point=function(r,i){$a.point=n,Qt(t=r,e=i)}}function te(){$a.point=Qt}function ee(){function n(n,t){var e=n-r,o=t-i,u=Math.sqrt(e*e+o*o);Ta+=u*(r+n)/2,za+=u*(i+t)/2,La+=u,u=i*n-r*t,qa+=u*(r+n),Da+=u*(i+t),Ra+=3*u,Qt(r=n,i=t)}var t,e,r,i;$a.point=function(o,u){$a.point=n,Qt(t=r=o,e=i=u)},$a.lineEnd=function(){n(t,e)}} +function re(n){function t(t,e){n.moveTo(t+u,e),n.arc(t,e,u,0,Ou)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function o(){n.closePath()}var u=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return u=n,a},result:_};return a}function ie(n){function t(n){return(a?r:e)(n)}function e(t){return ae(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=NaN,k.point=o,t.lineStart()}function o(e,r){var o=mt([e,r]),u=n(e,r);i(x,M,m,w,b,_,x=u[0],M=u[1],m=e,w=o[0],b=o[1],_=o[2],a,t),t.point(x,M)}function u(){k.point=e,t.lineEnd()}function c(){r(),k.point=l,k.lineEnd=s}function l(n,t){o(f=n,h=t),p=x,g=M,d=w,v=b,y=_,k.point=o}function s(){i(x,M,m,w,b,_,p,g,f,d,v,y,a,t),k.lineEnd=u,u()}var f,h,p,g,d,v,y,m,x,M,w,b,_,k={point:e,lineStart:r,lineEnd:u,polygonStart:function(){t.polygonStart(),k.lineStart=c},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function i(t,e,r,a,c,l,s,f,h,p,g,d,v,y){var m=s-t,x=f-e,M=m*m+x*x;if(M>4*o&&v--){var w=a+p,b=c+g,_=l+d,k=Math.sqrt(w*w+b*b+_*_),E=Math.asin(_/=k),N=Mu(Mu(_)-1)o||Mu((m*T+x*z)/M-.5)>.3||a*p+c*g+l*d0&&16,t):Math.sqrt(o)},t}function oe(n){var t=ie(function(t,e){return n([t*Bu,e*Bu])});return function(n){return se(t(n))}}function ue(n){this.stream=n}function ae(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ce(n){return le(function(){return n})()}function le(n){function t(n){return n=a(n[0]*Yu,n[1]*Yu),[n[0]*h+c,l-n[1]*h]}function e(n){return(n=a.invert((n[0]-c)/h,(l-n[1])/h))&&[n[0]*Bu,n[1]*Bu]}function r(){a=zt(u=pe(y,m,x),o);var n=o(d,v);return c=p-n[0]*h,l=g+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var o,u,a,c,l,s,f=ie(function(n,t){return n=o(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,p=480,g=250,d=0,v=0,y=0,m=0,x=0,w=Ua,b=M,_=null,k=null;return t.stream=function(n){return s&&(s.valid=!1),s=se(w(u,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(w=null==n?(_=n,Ua):Bt((_=+n)*Yu),i()):_},t.clipExtent=function(n){return arguments.length?(k=n,b=n?Vt(n[0][0],n[0][1],n[1][0],n[1][1]):M,i()):k},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(d=n[0]%360*Yu,v=n[1]%360*Yu,r()):[d*Bu,v*Bu]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yu,m=n[1]%360*Yu,x=n.length>2?n[2]%360*Yu:0,r()):[y*Bu,m*Bu,x*Bu]},su.rebind(t,f,"precision"),function(){return o=n.apply(this,arguments),t.invert=o.invert&&e,r()}}function se(n){return ae(n,function(t,e){n.point(t*Yu,e*Yu)})}function fe(n,t){return[n,t]}function he(n,t){return[n>Fu?n-Ou:n<-Fu?n+Ou:n,t]}function pe(n,t,e){return n?t||e?zt(de(n),ve(t,e)):de(n):t||e?ve(t,e):he}function ge(n){return function(t,e){return t+=n,[t>Fu?t-Ou:t<-Fu?t+Ou:t,e]}}function de(n){var t=ge(n);return t.invert=ge(-n),t}function ve(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*i;return[Math.atan2(c*o-s*u,a*r-l*i),rn(s*o+c*u)]}var r=Math.cos(n),i=Math.sin(n),o=Math.cos(t),u=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*o-c*u;return[Math.atan2(c*o+l*u,a*r+s*i),rn(s*r-a*i)]},e}function ye(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,o,u,a){var c=u*t;null!=i?(i=me(e,i),o=me(e,o),(u>0?io)&&(i+=u*Ou)):(i=n+u*Ou,o=n-.5*c);for(var l,s=i;u>0?s>o:s0?t<-Iu+Uu&&(t=-Iu+Uu):t>Iu-Uu&&(t=Iu-Uu);var e=u/Math.pow(i(t),o);return[e*Math.sin(o*n),u-e*Math.cos(o*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fu/4+n/2)},o=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),u=r*Math.pow(i(n),o)/o;return o?(e.invert=function(n,t){var e=u-t,r=nn(o)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/o,2*Math.atan(Math.pow(u/r,1/o))-Iu]},e):Ae}function Se(n,t){function e(n,t){var e=o-t;return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),o=r/i+n;return Mu(i)1&&tn(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function De(n,t){return n[0]-t[0]||n[1]-t[1]}function Re(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Pe(n,t,e,r){var i=n[0],o=e[0],u=t[0]-i,a=r[0]-o,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-o))/(f*u-a*s);return[i+h*u,c+h*s]}function Ue(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function je(){or(this),this.edge=this.site=this.circle=null}function Fe(n){var t=ac.pop()||new je;return t.site=n,t}function Oe(n){Je(n),ic.remove(n),ac.push(n),or(n)}function He(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},o=n.P,u=n.N,a=[n];Oe(n);for(var c=o;c.circle&&Mu(e-c.circle.x)Uu)a=a.L;else{if(!((i=o-Be(a,u))>Uu)){r>-Uu?(t=a.P,e=a):i>-Uu?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Fe(n);if(ic.insert(t,c),t||e){if(t===e)return Je(t),e=Fe(t.site),ic.insert(c,e),c.edge=e.edge=nr(t.site,c.site),We(t),void We(e);if(!e)return void(c.edge=nr(t.site,c.site));Je(t),Je(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,p=n.y-f,g=e.site,d=g.x-s,v=g.y-f,y=2*(h*v-p*d),m=h*h+p*p,x=d*d+v*v,M={x:(v*m-p*x)/y+s,y:(h*x-d*m)/y+f};er(e.edge,l,g,M),c.edge=nr(l,n,null,M),e.edge=nr(n,g,null,M),We(t),We(e)}}function Ye(n,t){var e=n.site,r=e.x,i=e.y,o=i-t;if(!o)return r;var u=n.P;if(!u)return-1/0;e=u.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/o-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+i-o/2)))/f+r:(r+a)/2}function Be(n,t){var e=n.N;if(e)return Ye(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ze(n){this.site=n,this.edges=[]}function Ve(n){for(var t,e,r,i,o,u,a,c,l,s,f=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],d=rc,v=d.length;v--;)if((o=d[v])&&o.prepare())for(a=o.edges,c=a.length,u=0;uUu||Mu(i-e)>Uu)&&(a.splice(u,0,new rr(tr(o.site,s,Mu(r-f)Uu?{x:f,y:Mu(t-f)Uu?{x:Mu(e-g)Uu?{x:h,y:Mu(t-h)Uu?{x:Mu(e-p)=-ju)){var p=c*c+l*l,g=s*s+f*f,d=(f*p-l*g)/h,v=(c*g-s*p)/h,f=v+a,y=cc.pop()||new Xe;y.arc=n,y.site=i,y.x=d+u,y.y=f+Math.sqrt(d*d+v*v),y.cy=f,n.circle=y;for(var m=null,x=uc._;x;)if(y.y=a)return;if(h>g){if(o){if(o.y>=l)return}else o={x:v,y:c};e={x:v,y:l}}else{if(o){if(o.y1)if(h>g){if(o){if(o.y>=l)return}else o={x:(c-i)/r,y:c};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=a)return}else o={x:u,y:r*u+i};e={x:a,y:r*a+i}}else{if(o){if(o.xo||f>u||h=M,_=e>=w,k=_<<1|b,E=k+4;ko&&(i=t.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:xr(e,r)})),o=fc.lastIndex;return o=0&&!(e=su.interpolators[r](n,t)););return e}function br(n,t){var e,r=[],i=[],o=n.length,u=t.length,a=Math.min(n.length,t.length);for(e=0;e=1?1:n(t)}}function kr(n){return function(t){return 1-n(1-t)}}function Er(n){return function(t){return.5*(t<.5?n(2*t):2-n(2-2*t))}}function Nr(n){return n*n}function Sr(n){return n*n*n}function Ar(n){if(n<=0)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}function Cr(n){return function(t){return Math.pow(t,n)}}function Tr(n){return 1-Math.cos(n*Iu)}function zr(n){return Math.pow(2,10*(n-1))}function Lr(n){return 1-Math.sqrt(1-n*n)}function qr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ou*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ou/t)}}function Dr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Rr(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Pr(n,t){n=su.hcl(n),t=su.hcl(t);var e=n.h,r=n.c,i=n.l,o=t.h-e,u=t.c-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return pn(e+o*n,r+u*n,i+a*n)+""}}function Ur(n,t){n=su.hsl(n),t=su.hsl(t);var e=n.h,r=n.s,i=n.l,o=t.h-e,u=t.s-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return fn(e+o*n,r+u*n,i+a*n)+""}}function jr(n,t){n=su.lab(n),t=su.lab(t);var e=n.l,r=n.a,i=n.b,o=t.l-e,u=t.a-r,a=t.b-i;return function(n){return dn(e+o*n,r+u*n,i+a*n)+""}}function Fr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Or(n){var t=[n.a,n.b],e=[n.c,n.d],r=Ir(t),i=Hr(t,e),o=Ir(Yr(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Br(e)+"rotate(",null,")")-2,x:xr(n,t)})):t&&e.push(Br(e)+"rotate("+t+")")}function $r(n,t,e,r){n!==t?r.push({i:e.push(Br(e)+"skewX(",null,")")-2,x:xr(n,t)}):t&&e.push(Br(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Br(e)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(n[0],t[0])},{i:i-2,x:xr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Br(e)+"scale("+t+")")}function Wr(n,t){var e=[],r=[];return n=su.transform(n),t=su.transform(t),Zr(n.translate,t.translate,e,r),Vr(n.rotate,t.rotate,e,r),$r(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,o=r.length;++i=0;)e.push(i[r])}function ci(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(o=n.children)&&(i=o.length))for(var i,o,u=-1;++ui&&(r=e,i=t);return r}function xi(n){return n.reduce(Mi,0)}function Mi(n,t){return n+t[1]}function wi(n,t){return bi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function bi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,o=[];++e<=t;)o[e]=i*e+r;return o}function _i(n){return[su.min(n),su.max(n)]}function ki(n,t){return n.value-t.value}function Ei(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Ni(n,t){n._pack_next=t,t._pack_prev=n}function Si(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ai(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(l=e.length)){var e,r,i,o,u,a,c,l,s=1/0,f=-1/0,h=1/0,p=-1/0;if(e.forEach(Ci),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(o=e[2],Li(r,i,o),t(o),Ei(r,o),r._pack_prev=o,Ei(o,i),i=r._pack_next,u=3;u=0;)t=i[o],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function ji(n,t,e){return n.a.parent===t.parent?n.a:e}function Fi(n){return 1+su.max(n,function(n){return n.y})}function Oi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Hi(n){var t=n.children;return t&&t.length?Hi(t[0]):n}function Ii(n){var t,e=n.children;return e&&(t=e.length)?Ii(e[t-1]):n}function Yi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Bi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],o=n.dy-t[0]-t[2];return i<0&&(e+=i/2,i=0),o<0&&(r+=o/2,o=0),{x:e,y:r,dx:i,dy:o}}function Zi(n){var t=n[0],e=n[n.length-1];return t2?Ji:$i,c=r?Gr:Jr;return u=i(n,t,c,e),a=i(t,n,c,wr),o}function o(n){return u(n)}var u,a;return o.invert=function(n){return a(n)},o.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},o.range=function(n){return arguments.length?(t=n,i()):t},o.rangeRound=function(n){return o.range(n).interpolate(Fr)},o.clamp=function(n){return arguments.length?(r=n,i()):r},o.interpolate=function(n){return arguments.length?(e=n,i()):e},o.ticks=function(t){return to(n,t)},o.tickFormat=function(t,e){return eo(n,t,e)},o.nice=function(t){return Qi(n,t),i()},o.copy=function(){return Gi(n,t,e,r)},i()}function Ki(n,t){return su.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Qi(n,t){return Xi(n,Wi(no(n,t)[2])),Xi(n,Wi(no(n,t)[2])),n}function no(n,t){null==t&&(t=10);var e=Zi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return o<=.15?i*=10:o<=.35?i*=5:o<=.75&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function to(n,t){return su.range.apply(su,no(n,t))}function eo(n,t,e){var r=no(n,t);if(e){var i=sa.exec(e);if(i.shift(),"s"===i[8]){var o=su.formatPrefix(Math.max(Mu(r[0]),Mu(r[1])));return i[7]||(i[7]="."+ro(o.scale(r[2]))),i[8]="f",e=su.format(i.join("")),function(n){return e(o.scale(n))+o.symbol}}i[7]||(i[7]="."+io(i[8],r)),e=i.join("")}else e=",."+ro(r[2])+"f";return su.format(e)}function ro(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function io(n,t){var e=ro(t[2]);return n in _c?Math.abs(e-ro(Math.max(Mu(t[0]),Mu(t[1]))))+ +("e"!==n):e-2*("%"===n)}function oo(n,t,e,r){function i(n){return(e?Math.log(n<0?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function o(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function u(t){return n(i(t))}return u.invert=function(t){return o(n.invert(t))},u.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),u):r},u.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),u):t},u.nice=function(){var t=Xi(r.map(i),e?Math:Ec);return n.domain(t),r=t.map(o),u},u.ticks=function(){var n=Zi(r),u=[],a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;l0;h--)u.push(o(l)*h);for(l=0;u[l]c;s--);u=u.slice(l,s)}return u},u.tickFormat=function(n,e){if(!arguments.length)return kc;arguments.length<2?e=kc:"function"!=typeof e&&(e=su.format(e));var r=Math.max(1,t*n/u.ticks().length);return function(n){var u=n/o(Math.round(i(n)));return u*t0?a[e-1]:n[0],e0?0:1}function wo(n,t,e,r,i){var o=n[0]-t[0],u=n[1]-t[1],a=(i?r:-r)/Math.sqrt(o*o+u*u),c=a*u,l=-a*o,s=n[0]+c,f=n[1]+l,h=t[0]+c,p=t[1]+l,g=(s+h)/2,d=(f+p)/2,v=h-s,y=p-f,m=v*v+y*y,x=e-r,M=s*p-h*f,w=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-M*M)),b=(M*y-v*w)/m,_=(-M*v-y*w)/m,k=(M*y+v*w)/m,E=(-M*v+y*w)/m,N=b-g,S=_-d,A=k-g,C=E-d;return N*N+S*S>A*A+C*C&&(b=k,_=E),[[b-c,_-l],[b*e/x,_*e/x]]}function bo(n){function t(t){function u(){l.push("M",o(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,p=Cn(e),g=Cn(r);++f1?n.join("L"):n+"Z"}function ko(n){return n.join("L")+"Z"}function Eo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function No(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],o=n[c],c++,r+="C"+(i[0]+u[0])+","+(i[1]+u[1])+","+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1];for(var l=2;l9&&(i=3*t/Math.sqrt(i),u[a]=i*e,u[a+1]=i*r));for(a=-1;++a<=c;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+u[a]*u[a])),o.push([i||0,u[a]*i||0]);return o}function Io(n){return n.length<3?_o(n):n[0]+zo(n,Ho(n))}function Yo(n){for(var t,e,r,i=-1,o=n.length;++i0;)p[--a].call(n,u);if(o>=1)return d.event&&d.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1}var c,l,s,h,p,g=n[e]||(n[e]={active:0,count:0}),d=g[r];d||(c=i.time,l=Dn(o,0,c),d=g[r]={tween:new f,time:c,timer:l,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function ru(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function iu(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function ou(n){return n.toISOString()}function uu(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,o=su.bisect(Jc,i);return o==Jc.length?[t.year,no(n.map(function(n){return n/31536e6}),e)[2]]:o?t[i/Jc[o-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=au(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=au(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Zi(r.domain()),o=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return o&&(n=o[0],t=o[1]),n.range(e[0],au(+e[1]+1),t<1?1:t)},r.tickFormat=function(){return e},r.copy=function(){return uu(n.copy(),t,e)},Ki(r,n)}function au(n){return new Date(n)}function cu(n){return JSON.parse(n.responseText)}function lu(n){var t=pu.createRange();return t.selectNode(pu.body),t.createContextualFragment(n.responseText)}var su={version:"3.5.17"},fu=[].slice,hu=function(n){return fu.call(n)},pu=this.document;if(pu)try{hu(pu.documentElement.childNodes)[0].nodeType}catch(n){hu=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),pu)try{pu.createElement("DIV").style.setProperty("opacity",0,"")}catch(n){var gu=this.Element.prototype,du=gu.setAttribute,vu=gu.setAttributeNS,yu=this.CSSStyleDeclaration.prototype,mu=yu.setProperty;gu.setAttribute=function(n,t){du.call(this,n,t+"")},gu.setAttributeNS=function(n,t,e){vu.call(this,n,t,e+"")},yu.setProperty=function(n,t,e){mu.call(this,n,t+"",e)}}su.ascending=i,su.descending=function(n,t){return tn?1:t>=n?0:NaN},su.min=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},su.max=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},su.extent=function(n,t){var e,r,i,o=-1,u=n.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return c/(s-1)},su.deviation=function(){var n=su.variance.apply(this,arguments);return n?Math.sqrt(n):n};var xu=a(i);su.bisectLeft=xu.left,su.bisect=su.bisectRight=xu.right,su.bisector=function(n){return a(1===n.length?function(t,e){return i(n(t),e)}:n)},su.shuffle=function(n,t,e){(o=arguments.length)<3&&(e=n.length,o<2&&(t=0));for(var r,i,o=e-t;o;)i=Math.random()*o--|0,r=n[o+t],n[o+t]=n[i+t],n[i+t]=r;return n},su.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},su.pairs=function(n){for(var t=0,e=n.length-1,r=n[0],i=new Array(e<0?0:e);t=0;)for(r=n[i],t=r.length;--t>=0;)e[--u]=r[t];return e};var Mu=Math.abs;su.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e==1/0)throw new Error("infinite range");var r,i=[],o=l(Mu(e)),u=-1;if(n*=o,t*=o,e*=o,e<0)for(;(r=n+e*++u)>t;)i.push(r/o);else for(;(r=n+e*++u)=o.length)return r?r.call(i,u):e?u.sort(e):u;for(var c,l,s,h,p=-1,g=u.length,d=o[a++],v=new f;++p=o.length)return n;var r=[],i=u[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},o=[],u=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(su.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return u[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},su.set=function(n){var t=new x;if(n)for(var e=0,r=n.length;e=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},su.event=null,su.requote=function(n){return n.replace(ku,"\\$&")};var ku=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Eu={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Nu=function(n,t){return t.querySelector(n)},Su=function(n,t){return t.querySelectorAll(n)},Au=function(n,t){var e=n.matches||n[b(n,"matchesSelector")];return(Au=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Nu=function(n,t){return Sizzle(n,t)[0]||null},Su=Sizzle,Au=Sizzle.matchesSelector),su.selection=function(){return su.select(pu.documentElement)};var Cu=su.selection.prototype=[];Cu.select=function(n){var t,e,r,i,o=[];n=T(n);for(var u=-1,a=this.length;++u=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),zu.hasOwnProperty(e)?{space:zu[e],local:n}:n}},Cu.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=su.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},Cu.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=R(n)).length,i=-1;if(t=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Cu.sort=function(n){n=B.apply(this,arguments);for(var t=-1,e=this.length;++t0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){w&&w.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),_&&_.domain(b.range().map(function(n){return(n-k.y)/k.k}).map(b.invert))}function c(n){T++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--T||(n({type:"zoomend"}),v=null)}function f(){function n(){a=1,o(su.mouse(i),h),l(u)}function e(){f.on(L,null).on(q,null),p(a),s(u)}var i=this,u=R.of(i,arguments),a=0,f=su.select(r(i)).on(L,n).on(q,e),h=t(su.mouse(i)),p=G(i);Oc.call(i),c(u)}function h(){function n(){var n=su.touches(g);return p=k.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=su.event.target;su.select(t).on(M,r).on(w,a),b.push(t);for(var e=su.event.changedTouches,i=0,o=e.length;i1){var s=c[0],f=c[1],h=s[0]-f[0],p=s[1]-f[1];y=h*h+p*p}}function r(){var n,t,e,r,u=su.touches(g);Oc.call(g);for(var a=0,c=u.length;a=l)return u;if(i)return i=!1,o;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fa=su.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=su.round(n,jn(n,t))).toFixed(Math.max(0,Math.min(20,jn(n*(1+1e-15),t))))}}),ha=su.time={},pa=Date;In.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ga.setUTCDate.apply(this._,arguments)},setDay:function(){ga.setUTCDay.apply(this._,arguments)},setFullYear:function(){ga.setUTCFullYear.apply(this._,arguments)},setHours:function(){ga.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ga.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ga.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ga.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ga.setUTCSeconds.apply(this._,arguments)},setTime:function(){ga.setTime.apply(this._,arguments)}};var ga=Date.prototype;ha.year=Yn(function(n){return n=ha.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ha.years=ha.year.range,ha.years.utc=ha.year.utc.range,ha.day=Yn(function(n){var t=new pa(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ha.days=ha.day.range,ha.days.utc=ha.day.utc.range,ha.dayOfYear=function(n){var t=ha.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){ +t=7-t;var e=ha[n]=Yn(function(n){return(n=ha.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ha[n+"s"]=e.range,ha[n+"s"].utc=e.utc.range,ha[n+"OfYear"]=function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)}}),ha.week=ha.sunday,ha.weeks=ha.sunday.range,ha.weeks.utc=ha.sunday.utc.range,ha.weekOfYear=ha.sundayOfYear;var da={"-":"",_:" ",0:"0"},va=/^\s*\d+/,ya=/^%/;su.locale=function(n){return{numberFormat:On(n),timeFormat:Zn(n)}};var ma=su.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});su.format=ma.numberFormat,su.geo={},ht.prototype={s:0,t:0,add:function(n){pt(n,this.t,xa),pt(xa.s,this.s,this),this.s?this.t+=xa.t:this.s=xa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xa=new ht;su.geo.stream=function(n,t){n&&Ma.hasOwnProperty(n.type)?Ma[n.type](n,t):gt(n,t)};var Ma={Feature:function(n,t){gt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rp&&(p=t)}function t(t,e){var r=mt([t*Yu,e*Yu]);if(y){var i=Mt(y,r),o=[i[1],-i[0],0],u=Mt(o,i);_t(u),u=kt(u);var c=t-g,l=c>0?1:-1,d=u[0]*Bu*l,v=Mu(c)>180;if(v^(l*gp&&(p=m)}else if(d=(d+360)%360-180,v^(l*gp&&(p=e);v?ta(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(th&&(h=t)):t>g?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);y=r,g=t}function e(){w.point=t}function r(){M[0]=s,M[1]=h,w.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=Mu(r)>180?r+(r>0?360:-360):r}else d=n,v=e;ka.point(n,e),t(n,e)}function o(){ka.lineStart()}function u(){i(d,v),ka.lineEnd(),Mu(m)>Uu&&(s=-(h=180)),M[0]=s,M[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nUu?p=90:m<-Uu&&(f=-90),M[0]=s,M[1]=h}};return function(n){p=h=-(s=f=1/0),x=[],su.geo.stream(n,w);var t=x.length;if(t){x.sort(c);for(var e,r=1,i=x[0],o=[i];ra(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(var u,e,g=-1/0,t=o.length-1,r=0,i=o[t];r<=t;i=e,++r)e=o[r],(u=a(i[1],e[0]))>g&&(g=u,s=e[0],h=i[1])}return x=M=null,s===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[s,f],[h,p]]}}(),su.geo.centroid=function(n){Ea=Na=Sa=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,Pa);var t=qa,e=Da,r=Ra,i=t*t+e*e+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?a:o).invert(n)},n.stream=function(n){var t=o.stream(n),e=u.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(o.precision(t),u.precision(t),a.precision(t),n):o.precision()},n.scale=function(t){return arguments.length?(o.scale(t),u.scale(.35*t),a.scale(t),n.translate(o.translate())):o.scale()},n.translate=function(t){if(!arguments.length)return o.translate();var l=o.scale(),s=+t[0],f=+t[1];return e=o.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=u.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Uu,f+.12*l+Uu],[s-.214*l-Uu,f+.234*l-Uu]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Uu,f+.166*l+Uu],[s-.115*l-Uu,f+.234*l-Uu]]).stream(c).point,n},n.scale(1070)};var Fa,Oa,Ha,Ia,Ya,Ba,Za={point:_,lineStart:_,lineEnd:_,polygonStart:function(){Oa=0,Za.lineStart=Wt},polygonEnd:function(){Za.lineStart=Za.lineEnd=Za.point=_,Fa+=Mu(Oa/2)}},Va={point:Jt,lineStart:_,lineEnd:_,polygonStart:_,polygonEnd:_},$a={point:Qt,lineStart:ne,lineEnd:te,polygonStart:function(){$a.lineStart=ee},polygonEnd:function(){$a.point=Qt,$a.lineStart=ne,$a.lineEnd=te}};su.geo.path=function(){function n(n){return n&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),u&&u.valid||(u=i(o)),su.geo.stream(n,u)),o.result()}function t(){return u=null,n}var e,r,i,o,u,a=4.5;return n.area=function(n){return Fa=0,su.geo.stream(n,i(Za)),Fa},n.centroid=function(n){return Sa=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,i($a)),Ra?[qa/Ra,Da/Ra]:La?[Ta/La,za/La]:Ca?[Sa/Ca,Aa/Ca]:[NaN,NaN]},n.bounds=function(n){return Ya=Ba=-(Ha=Ia=1/0),su.geo.stream(n,i(Va)),[[Ha,Ia],[Ya,Ba]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||oe(n):M,t()):e},n.context=function(n){return arguments.length?(o=null==(r=n)?new Gt:new re(n),"function"!=typeof a&&o.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(o.pointRadius(+t),+t),n):a},n.projection(su.geo.albersUsa()).context(null)},su.geo.transform=function(n){return{stream:function(t){var e=new ue(t);for(var r in n)e[r]=n[r];return e}}},ue.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},su.geo.projection=ce,su.geo.projectionMutator=le,(su.geo.equirectangular=function(){return ce(fe)}).raw=fe.invert=fe,su.geo.rotation=function(n){function t(t){return t=n(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t}return n=pe(n[0]%360*Yu,n[1]*Yu,n.length>2?n[2]*Yu:0),t.invert=function(t){return t=n.invert(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t},t},he.invert=fe,su.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=pe(-n[0]*Yu,-n[1]*Yu,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Bu,n[1]*=Bu}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ye((t=+r)*Yu,i*Yu),n):t},n.precision=function(r){return arguments.length?(e=ye(t*Yu,(i=+r)*Yu),n):i},n.angle(90)},su.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yu,i=n[1]*Yu,o=t[1]*Yu,u=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*u)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},su.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return su.range(Math.ceil(o/v)*v,i,v).map(h).concat(su.range(Math.ceil(l/y)*y,c,y).map(p)).concat(su.range(Math.ceil(r/g)*g,e,g).filter(function(n){return Mu(n%v)>Uu}).map(s)).concat(su.range(Math.ceil(a/d)*d,u,d).filter(function(n){return Mu(n%y)>Uu}).map(f))}var e,r,i,o,u,a,c,l,s,f,h,p,g=10,d=g,v=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],o>i&&(t=o,o=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(m)):[[o,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),a>u&&(t=a,a=u,u=t),n.precision(m)):[[r,a],[e,u]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(v=+t[0],y=+t[1],n):[v,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],d=+t[1],n):[g,d]},n.precision=function(t){return arguments.length?(m=+t,s=xe(a,u,90),f=Me(r,e,m),h=xe(l,c,90),p=Me(o,i,m),n):m},n.majorExtent([[-180,-90+Uu],[180,90-Uu]]).minorExtent([[-180,-80-Uu],[180,80+Uu]])},su.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=we,i=be;return n.distance=function(){return su.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},su.geo.interpolate=function(n,t){return _e(n[0]*Yu,n[1]*Yu,t[0]*Yu,t[1]*Yu)},su.geo.length=function(n){return Xa=0,su.geo.stream(n,Wa),Xa};var Xa,Wa={sphere:_,point:_,lineStart:ke,lineEnd:_,polygonStart:_,polygonEnd:_},Ja=Ee(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(su.geo.azimuthalEqualArea=function(){return ce(Ja)}).raw=Ja;var Ga=Ee(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},M);(su.geo.azimuthalEquidistant=function(){return ce(Ga)}).raw=Ga,(su.geo.conicConformal=function(){return $t(Ne)}).raw=Ne,(su.geo.conicEquidistant=function(){return $t(Se)}).raw=Se;var Ka=Ee(function(n){return 1/n},Math.atan);(su.geo.gnomonic=function(){return ce(Ka)}).raw=Ka,Ae.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Iu]},(su.geo.mercator=function(){return Ce(Ae)}).raw=Ae;var Qa=Ee(function(){return 1},Math.asin);(su.geo.orthographic=function(){return ce(Qa)}).raw=Qa;var nc=Ee(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(su.geo.stereographic=function(){return ce(nc)}).raw=nc,Te.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Iu]},(su.geo.transverseMercator=function(){var n=Ce(Te),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Te,su.geom={},su.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=Cn(e),o=Cn(r),u=n.length,a=[],c=[];for(t=0;t=0;--t)p.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=o&&l.y>=i&&l.y<=u?[[r,u],[o,u],[o,i],[r,i]]:[]).point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(o(n,t)/Uu)*Uu,y:Math.round(u(n,t)/Uu)*Uu,i:t}})}var r=ze,i=Le,o=r,u=i,a=lc;return n?t(n):(t.links=function(n){return lr(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return lr(e(n)).cells.forEach(function(e,r){for(var i,o=e.site,u=e.edges.sort($e),a=-1,c=u.length,l=u[c-1].edge,s=l.l===o?l.r:l.l;++a=l,h=r>=s,p=h<<1|f;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=gr()),f?i=l:a=l,h?u=s:c=s,o(n,t,e,r,i,u,a,c)}var s,f,h,p,g,d,v,y,m,x=Cn(a),M=Cn(c);if(null!=t)d=t,v=e,y=r,m=i;else if(y=m=-(d=v=1/0),f=[],h=[],g=n.length,u)for(p=0;py&&(y=s.x),s.y>m&&(m=s.y),f.push(s.x),h.push(s.y);else for(p=0;py&&(y=w),b>m&&(m=b),f.push(w),h.push(b)}var _=y-d,k=m-v;_>k?m=v+_:y=d+k;var E=gr();if(E.add=function(n){o(E,n,+x(n,++p),+M(n,p),d,v,y,m)},E.visit=function(n){dr(n,E,d,v,y,m)},E.find=function(n){return vr(E,n[0],n[1],d,v,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=pc.get(e)||hc,r=gc.get(r)||M,_r(r(e.apply(null,fu.call(arguments,1))))},su.interpolateHcl=Pr,su.interpolateHsl=Ur,su.interpolateLab=jr,su.interpolateRound=Fr,su.transform=function(n){var t=pu.createElementNS(su.ns.prefix.svg,"g");return(su.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Or(e?e.matrix:dc)})(n)},Or.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var dc={a:1,b:0,c:0,d:1,e:0,f:0};su.interpolateTransform=Wr,su.layout={},su.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e0?i=n:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:i=0})):n>0&&(l.start({type:"start",alpha:i=n}),e=Dn(c.tick)),c):i},c.start=function(){function n(n,r){if(!e){for(e=new Array(i),c=0;c=0;)u.push(s=l[c]),s.parent=o,s.depth=o.depth+1;r&&(o.value=0),o.children=l}else r&&(o.value=+r.call(n,o,o.depth)||0),delete o.children;return ci(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=fi,e=li,r=si;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ai(t,function(n){n.children&&(n.value=0)}),ci(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},su.layout.partition=function(){function n(t,e,r,i){var o=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(u=o.length)){var u,a,c,l=-1;for(r=t.value?r/t.value:0;++la&&(a=r),u.push(r)}for(e=0;e0)for(o=-1;++o=s[0]&&a<=s[1]&&(u=c[su.bisect(f,a,1,p)-1],u.y+=g,u.push(n[o]));return c}var t=!0,e=Number,r=_i,i=wi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Cn(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return bi(n,t)}:Cn(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},su.layout.pack=function(){function n(n,o){var u=e.call(this,n,o),a=u[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ci(a,function(n){n.r=+s(n.value)}),ci(a,Ai),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ci(a,function(n){n.r+=f}),ci(a,Ai),ci(a,function(n){n.r-=f})}return zi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),u}var t,e=su.layout.hierarchy().sort(ki),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ui(n,e)},su.layout.tree=function(){function n(n,i){var s=u.call(this,n,i),f=s[0],h=t(f);if(ci(h,e),h.parent.m=-h.z,ai(h,r),l)ai(f,o);else{var p=f,g=f,d=f;ai(f,function(n){n.xg.x&&(g=n),n.depth>d.depth&&(d=n)});var v=a(p,g)/2-p.x,y=c[0]/(g.x+a(g,p)/2+v),m=c[1]/(d.depth||1);ai(f,function(n){n.x=(n.x+v)*y,n.y=n.depth*m})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,o=t.children,u=0,a=o.length;u0&&(Pi(ji(u,n,e),n,r),l+=r,s+=r),f+=u.m,l+=i.m,h+=c.m,s+=o.m;u&&!Ri(o)&&(o.t=u,o.m+=f-s),i&&!Di(c)&&(c.t=i,c.m+=l-h,e=n)}return e}function o(n){n.x*=c[0],n.y=n.depth*c[1]}var u=su.layout.hierarchy().sort(null).value(null),a=qi,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?o:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:o,n):l?c:null},ui(n,u)},su.layout.cluster=function(){function n(n,o){var u,a=t.call(this,n,o),c=a[0],l=0;ci(c,function(n){var t=n.children;t&&t.length?(n.x=Oi(t),n.y=Fi(t)):(n.x=u?l+=e(n,u):0,n.y=0,u=n)});var s=Hi(c),f=Ii(c),h=s.x-e(s,f)/2,p=f.x+e(f,s)/2;return ci(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=su.layout.hierarchy().sort(null).value(null),e=qi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},su.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,o=n.length;++i0;)s.push(u=h[c-1]),s.area+=u.area,"squarify"!==p||(a=r(s,d))<=g?(h.pop(),g=a):(s.area-=s.pop().area,i(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,g=1/0);s.length&&(i(s,d,l,!0),s.length=s.area=0),o.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var o,u=f(t),a=r.slice(),c=[];for(n(a,u.dx*u.dy/t.value),c.area=0;o=a.pop();)c.push(o),c.area+=o.area,null!=o.z&&(i(c,o.z?u.dx:u.dy,u,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,o=1/0,u=-1,a=n.length;++ui&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*o*g)):1/0}function i(n,t,e,r){var i,o=-1,u=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++oe.dx)&&(s=e.dx);++o1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=su.random.normal.apply(su,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=su.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;ef?0:1;if(l=Hu)return t(l,p)+(n?t(n,1-p):"")+"Z";var g,d,v,y,m,x,M,w,b,_,k,E,N=0,S=0,A=[];if((y=(+c.apply(this,arguments)||0)/2)&&(v=o===Tc?Math.sqrt(n*n+l*l):+o.apply(this,arguments),p||(S*=-1),l&&(S=rn(v/l*Math.sin(y))),n&&(N=rn(v/n*Math.sin(y)))),l){m=l*Math.cos(s+S),x=l*Math.sin(s+S),M=l*Math.cos(f-S),w=l*Math.sin(f-S);var C=Math.abs(f-s-2*S)<=Fu?0:1;if(S&&Mo(m,x,M,w)===p^C){var T=(s+f)/2;m=l*Math.cos(T),x=l*Math.sin(T),M=w=null}}else m=x=0;if(n){b=n*Math.cos(f-N),_=n*Math.sin(f-N),k=n*Math.cos(s+N),E=n*Math.sin(s+N);var z=Math.abs(s-f+2*N)<=Fu?0:1;if(N&&Mo(b,_,k,E)===1-p^z){var L=(s+f)/2;b=n*Math.cos(L),_=n*Math.sin(L),k=E=null}}else b=_=0;if(h>Uu&&(g=Math.min(Math.abs(l-n)/2,+i.apply(this,arguments)))>.001){d=nFu)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var o=we,u=be,a=Zo,c=yo,l=mo;return n.radius=function(t){return arguments.length?(a=Cn(t),n):a},n.source=function(t){return arguments.length?(o=Cn(t),n):o},n.target=function(t){return arguments.length?(u=Cn(t),n):u},n.startAngle=function(t){return arguments.length?(c=Cn(t),n):c},n.endAngle=function(t){return arguments.length?(l=Cn(t),n):l},n},su.svg.diagonal=function(){function n(n,i){var o=t.call(this,n,i),u=e.call(this,n,i),a=(o.y+u.y)/2,c=[o,{x:o.x,y:a},{x:u.x,y:a},u];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=we,e=be,r=Vo;return n.source=function(e){return arguments.length?(t=Cn(e),n):t},n.target=function(t){return arguments.length?(e=Cn(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},su.svg.diagonal.radial=function(){var n=su.svg.diagonal(),t=Vo,e=n.projection;return n.projection=function(n){return arguments.length?e($o(t=n)):t},n},su.svg.symbol=function(){function n(n,r){return(Rc.get(t.call(this,n,r))||Jo)(e.call(this,n,r))}var t=Wo,e=Xo;return n.type=function(e){return arguments.length?(t=Cn(e),n):t},n.size=function(t){return arguments.length?(e=Cn(t),n):e},n};var Rc=su.map({circle:Jo,cross:function(n){var t=Math.sqrt(n/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(n){var t=Math.sqrt(n/(2*Uc)),e=t*Uc;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});su.svg.symbolTypes=Rc.keys();var Pc=Math.sqrt(3),Uc=Math.tan(30*Yu);Cu.transition=function(n){for(var t,e,r=jc||++Ic,i=tu(n),o=[],u=Fc||{time:Date.now(),ease:Ar,delay:0,duration:250},a=-1,c=this.length;++arect,.s>rect").attr("width",f[1]-f[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function o(){function o(){32==su.event.keyCode&&(C||(x=null,z[0]-=f[1],z[1]-=h[1],C=2),N())}function d(){32==su.event.keyCode&&2==C&&(z[0]+=f[1],z[1]+=h[1],C=0,N())}function v(){var n=su.mouse(w),r=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(su.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),z[0]=f[+(n[0]0?o=setTimeout(i,t-s):(o=null,e||(l=n.apply(a,u),o||(a=u=null)))}var o,u,a,c,l;return null==t&&(t=100),function(){a=this,u=arguments,c=r();var s=e&&!o;return o||(o=setTimeout(i,t)),s&&(l=n.apply(a,u),a=u=null),l}}},{"date-now":2}],4:[function(n,t,e){(function(r){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(n){var t=this.useColors;if(n[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+n[0]+(t?"%c ":" ")+"+"+e.humanize(this.diff),t){var r="color: "+this.color;n.splice(1,0,r,"color: inherit");var i=0,o=0;n[0].replace(/%[a-zA-Z%]/g,function(n){"%%"!==n&&(i++,"%c"===n&&(o=i))}),n.splice(o,0,r)}}function u(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(n){try{null==n?e.storage.removeItem("debug"):e.storage.debug=n}catch(n){}}function c(){var n;try{n=e.storage.debug}catch(n){}return!n&&void 0!==r&&"env"in r&&(n=r.env.DEBUG),n}e=t.exports=n("./debug"),e.log=u,e.formatArgs=o,e.save=a,e.load=c,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(n){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(n){try{return JSON.stringify(n)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}},e.enable(c())}).call(this,n("_process"))},{"./debug":5,_process:8}],5:[function(n,t,e){function r(n){var t,r=0;for(t in n)r=(r<<5)-r+n.charCodeAt(t),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function i(n){function t(){if(t.enabled){var n=t,r=+new Date,i=r-(l||r);n.diff=i,n.prev=l,n.curr=r,l=r;for(var o=new Array(arguments.length),u=0;u1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(t){var e=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*f;case"days":case"day":case"d":return e*s;case"hours":case"hour":case"hrs":case"hr":case"h":return e*l;case"minutes":case"minute":case"mins":case"min":case"m":return e*c;case"seconds":case"second":case"secs":case"sec":case"s":return e*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function i(n){return n>=s?Math.round(n/s)+"d":n>=l?Math.round(n/l)+"h":n>=c?Math.round(n/c)+"m":n>=a?Math.round(n/a)+"s":n+"ms"}function o(n){return u(n,s,"day")||u(n,l,"hour")||u(n,c,"minute")||u(n,a,"second")||n+" ms"}function u(n,t,e){if(!(n0)return r(n);if("number"===e&&!1===isNaN(n))return t.long?o(n):i(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],7:[function(n,t,e){function r(n){if("number"!=typeof n||Number.isNaN(n))throw new TypeError("Expected a number, got "+typeof n);var t=n<0,e=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(n=-n),n<1)return(t?"-":"")+n+" B";var r=Math.min(Math.floor(Math.log(n)/Math.log(1e3)),e.length-1);n=Number(n/Math.pow(1e3,r));var i=e[r];return n>=10||n%1==0?(t?"-":"")+n.toFixed(0)+" "+i:(t?"-":"")+n.toFixed(1)+" "+i}t.exports=r},{}],8:[function(n,t,e){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(n){if(f===setTimeout)return setTimeout(n,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(n,0);try{return f(n,0)}catch(t){try{return f.call(null,n,0)}catch(t){return f.call(this,n,0)}}}function u(n){if(h===clearTimeout)return clearTimeout(n);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(n);try{return h(n)}catch(t){try{return h.call(null,n)}catch(t){return h.call(this,n)}}}function a(){v&&g&&(v=!1,g.length?d=g.concat(d):y=-1,d.length&&c())}function c(){if(!v){var n=o(a);v=!0;for(var t=d.length;t;){for(g=d,d=[];++y1)for(var e=1;e=c.links.maxBytes?c.links.maxBytes:n,{width:n*c.links.maxWidth/c.links.maxBytes,unit:e}}function s(){var e=window.innerWidth>=900?400:250,r=n.offsetWidth;return t&&(isNaN(t.width)||(r=t.width),"function"==typeof t.width&&(r=t.width()),isNan(t.height)||(e=t.height),"function"==typeof t.height&&(e=t.height()),"auto"===t.height&&(e=n.offsetHeight)),{width:r,height:e}}function f(){j=j.data(L.links),U=U.data(L.nodes,function(n){return n.id}),j.enter().insert("line",".node").attr("class","link").style("stroke",l.links.color).style("opacity",.5),j.exit().remove(),j.style("stroke-width",function(n){ +return n.rate?n.rate.width"+t,"at",a(e)),"number"!=typeof e||e<0)throw new Error("rate: 3th param must be a positive number");var i=v(n);if(!i)throw new Error("rate: invalid source id");var u=v(t);if(!u)throw new Error("rate: invalid target id");var c=x(i.index,u.index);if(-1===c)throw new Error("rate: connection does not exist");L.links[c].rate=r(e),o("rate:",L.links[c].rate),f()}"string"==typeof n&&(n=document.querySelector(n));var L={nodes:[],links:[]};if(t){if(t.height&&"function"!=typeof t.height&&"default"!==t.height&&"auto"!==t.height&&isNaN(t.height))throw"Height should be a Number or a Function";if(t.width&&"default"!==t.width&&"function"!=typeof t.width&&"auto"!==t.width&&isNaN(t.width))throw"Width should be a Number of a Function"}var q;L.links.forEach(function(n){var t=L.nodes[n.source],e=L.nodes[n.target];t.children=t.children||[],t.children.push(n.target),e.parents=e.parents||[],e.parents.push(n.source)});var D=s(),R=i.select(n).append("svg").attr("width",D.width).attr("height",D.height),P=i.layout.force().size([D.width,D.height]).nodes(L.nodes).links(L.links).on("tick",function(){j.attr("x1",function(n){return n.source.x}).attr("y1",function(n){return n.source.y}).attr("x2",function(n){return n.target.x}).attr("y2",function(n){return n.target.y}),U.attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y}),U.attr("transform",function(n){return"translate("+n.x+","+n.y+")"})}),U=R.selectAll(".node"),j=R.selectAll(".link");return f(),window.addEventListener("resize",u(h,500)),h(),{list:M,add:w,hasPeer:E,hasLink:N,remove:b,connect:_,disconnect:k,getLink:m,areConnected:S,unchoke:A,choke:C,seed:T,rate:z}}t.exports=r;var i=n("d3"),o=n("debug")("p2p-graph"),u=n("debounce"),a=n("prettier-bytes"),c={links:{width:.7,maxWidth:5,maxBytes:2097152}},l={links:{color:"#C8C8C8"},text:{subtitle:"#C8C8C8"},nodes:{method:function(n,t){return n.me?i.hsl(210,.7,.725):n.seeder?i.hsl(120,.7,.725):i.hsl(55,.7,.725)},hover:"#A9A9A9",dep:"#252929"}}},{d3:1,debounce:3,debug:4,"prettier-bytes":7}]},{},[9])(9)}); From 5a48976607dfcd8b8e0d5241b86b60bbf6670fdf Mon Sep 17 00:00:00 2001 From: Rares Golea Date: Tue, 4 Apr 2017 16:09:11 +0300 Subject: [PATCH 3/5] Fixes --- index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 8fb38b9..504ae7b 100644 --- a/index.js +++ b/index.js @@ -39,8 +39,8 @@ function TorrentGraph (root, size) { } if (size) { - if (size.height && typeof size.height !== 'function' && size.height !== 'default' && size.height !== 'auto' && isNaN(size.height)) throw 'Height should be a Number or a Function' - if (size.width && size.width !== 'default' && typeof size.width !== 'function' && size.width !== 'auto' && isNaN(size.width)) throw 'Width should be a Number of a Function' + if (size.height && typeof size.height !== 'function' && size.height !== 'default' && size.height !== 'auto' && Number.isNaN(size.height)) throw new Error('Height should be a Number or a Function') + if (size.width && size.width !== 'default' && typeof size.width !== 'function' && size.width !== 'auto' && Number.isNaN(size.width)) throw new Error('Width should be a Number of a Function') } function scale () { @@ -66,14 +66,13 @@ function TorrentGraph (root, size) { var width = root.offsetWidth if (size) { - if (!isNaN(size.width)) width = size.width + if (!Number.isNaN(size.width)) width = size.width if (typeof size.width === 'function') width = size.width() - if (!isNan(size.height)) height = size.height + if (!Number.isNan(size.height)) height = size.height if (typeof size.height === 'function') height = size.height() if (size.height === 'auto') height = root.offsetHeight } - return { width: width, height: height From cf90589db53d0bc8c9e8b7725984fe97bfe877e9 Mon Sep 17 00:00:00 2001 From: Rares Golea Date: Wed, 5 Apr 2017 12:23:26 +0300 Subject: [PATCH 4/5] Typo fix --- index.js | 2 +- p2p-graph.min.js | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/index.js b/index.js index 504ae7b..431615f 100644 --- a/index.js +++ b/index.js @@ -68,7 +68,7 @@ function TorrentGraph (root, size) { if (size) { if (!Number.isNaN(size.width)) width = size.width if (typeof size.width === 'function') width = size.width() - if (!Number.isNan(size.height)) height = size.height + if (!Number.isNaN(size.height)) height = size.height if (typeof size.height === 'function') height = size.height() if (size.height === 'auto') height = root.offsetHeight } diff --git a/p2p-graph.min.js b/p2p-graph.min.js index 9a0f8f3..e69de29 100644 --- a/p2p-graph.min.js +++ b/p2p-graph.min.js @@ -1,6 +0,0 @@ -!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.P2PGraph=n()}}(function(){var n;return function n(t,e,r){function i(u,a){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var s=e[u]={exports:{}};t[u][0].call(s.exports,function(n){var e=t[u][1][n];return i(e||n)},s,s.exports,n,t,e,r)}return e[u].exports}for(var o="function"==typeof require&&require,u=0;ut?1:n>=t?0:NaN}function o(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function a(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function c(n){return n.length}function l(n){for(var t=1;n*t%1;)t*=10;return t}function s(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function f(){this._=Object.create(null)}function h(n){return(n+="")===wu||n[0]===bu?bu+n:n}function p(n){return(n+="")[0]===bu?n.slice(1):n}function g(n){return h(n)in this._}function d(n){return(n=h(n))in this._&&delete this._[n]}function v(){var n=[];for(var t in this._)n.push(p(t));return n}function y(){var n=0;for(var t in this._)++n;return n}function m(){for(var n in this._)return!1;return!0}function x(){this._=Object.create(null)}function M(n){return n}function w(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function b(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_u.length;e=t&&(t=i+1);!(u=a[t])&&++t0&&(n=n.slice(0,a));var l=qu.get(n);return l&&(n=l,c=J),a?t?i:r:t?_:o}function W(n,t){return function(e){var r=su.event;su.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{su.event=r}}}function J(n,t){var e=W(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function G(n){var e=".dragsuppress-"+ ++Ru,i="click"+e,o=su.select(r(n)).on("touchmove"+e,N).on("dragstart"+e,N).on("selectstart"+e,N);if(null==Du&&(Du=!("onselectstart"in n)&&b(n.style,"userSelect")),Du){var u=t(n).style,a=u[Du];u[Du]="none"}return function(n){if(o.on(e,null),Du&&(u[Du]=a),n){var t=function(){o.on(i,null)};o.on(i,function(){N(),t()},!0),setTimeout(t,0)}}}function K(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();if(Pu<0){var o=r(n);if(o.scrollX||o.scrollY){e=su.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();Pu=!(u.f||u.e),e.remove()}}return Pu?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[t.clientX-a.left-n.clientLeft,t.clientY-a.top-n.clientTop]}function Q(){return su.event.changedTouches[0].identifier}function nn(n){return n>0?1:n<0?-1:0}function tn(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function en(n){return n>1?0:n<-1?Fu:Math.acos(n)}function rn(n){return n>1?Iu:n<-1?-Iu:Math.asin(n)}function on(n){return((n=Math.exp(n))-1/n)/2}function un(n){return((n=Math.exp(n))+1/n)/2}function an(n){return((n=Math.exp(2*n))-1)/(n+1)}function cn(n){return(n=Math.sin(n/2))*n}function ln(){}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.s,n.l):kn(""+n,En,sn):new sn(n,t,e)}function fn(n,t,e){function r(n){return n>360?n-=360:n<0&&(n+=360),n<60?o+(u-o)*n/60:n<180?u:n<240?o+(u-o)*(240-n)/60:o}function i(n){return Math.round(255*r(n))}var o,u;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:t<0?0:t>1?1:t,e=e<0?0:e>1?1:e,u=e<=.5?e*(1+t):e+t-e*t,o=2*e-u,new Mn(i(n+120),i(n),i(n-120))}function hn(n,t,e){return this instanceof hn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof hn?new hn(n.h,n.c,n.l):n instanceof gn?vn(n.l,n.a,n.b):vn((n=Nn((n=su.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new hn(n,t,e)}function pn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new gn(e,Math.cos(n*=Yu)*t,Math.sin(n)*t)}function gn(n,t,e){return this instanceof gn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof gn?new gn(n.l,n.a,n.b):n instanceof hn?pn(n.h,n.c,n.l):Nn((n=Mn(n)).r,n.g,n.b):new gn(n,t,e)}function dn(n,t,e){var r=(n+16)/116,i=r+t/500,o=r-e/200;return i=yn(i)*Ku,r=yn(r)*Qu,o=yn(o)*na,new Mn(xn(3.2404542*i-1.5371385*r-.4985314*o),xn(-.969266*i+1.8760108*r+.041556*o),xn(.0556434*i-.2040259*r+1.0572252*o))}function vn(n,t,e){return n>0?new hn(Math.atan2(e,t)*Bu,Math.sqrt(t*t+e*e),n):new hn(NaN,NaN,n)}function yn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function mn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function xn(n){return Math.round(255*(n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function Mn(n,t,e){return this instanceof Mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof Mn?new Mn(n.r,n.g,n.b):kn(""+n,Mn,fn):new Mn(n,t,e)}function wn(n){return new Mn(n>>16,n>>8&255,255&n)}function bn(n){return wn(n)+""}function _n(n){return n<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function kn(n,t,e){var r,i,o,u=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(An(i[0]),An(i[1]),An(i[2]))}return(o=ra.get(n))?t(o.r,o.g,o.b):(null==n||"#"!==n.charAt(0)||isNaN(o=parseInt(n.slice(1),16))||(4===n.length?(u=(3840&o)>>4,u|=u>>4,a=240&o,a|=a>>4,c=15&o,c|=c<<4):7===n.length&&(u=(16711680&o)>>16,a=(65280&o)>>8,c=255&o)),t(u,a,c))}function En(n,t,e){var r,i,o=Math.min(n/=255,t/=255,e/=255),u=Math.max(n,t,e),a=u-o,c=(u+o)/2;return a?(i=c<.5?a/(u+o):a/(2-u-o),r=n==u?(t-e)/a+(t0&&c<1?0:r),new sn(r,i,c)}function Nn(n,t,e){n=Sn(n),t=Sn(t),e=Sn(e);var r=mn((.4124564*n+.3575761*t+.1804375*e)/Ku),i=mn((.2126729*n+.7151522*t+.072175*e)/Qu);return gn(116*i-16,500*(r-i),200*(i-mn((.0193339*n+.119192*t+.9503041*e)/na)))}function Sn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function An(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Cn(n){return"function"==typeof n?n:function(){return n}}function Tn(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),zn(t,e,n,r)}}function zn(n,t,e,r){function i(){var n,t=c.status;if(!t&&qn(c)||t>=200&&t<300||304===t){try{n=e.call(o,c)}catch(n){return void u.error.call(o,n)}u.load.call(o,n)}else u.error.call(o,c)}var o={},u=su.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=su.event;su.event=n;try{u.progress.call(o,c)}finally{su.event=t}},o.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",o)},o.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",o):t},o.responseType=function(n){return arguments.length?(l=n,o):l},o.response=function(n){return e=n,o},["get","post"].forEach(function(n){o[n]=function(){return o.send.apply(o,[n].concat(hu(arguments)))}}),o.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&o.on("error",i).on("load",function(n){i(null,n)}),u.beforesend.call(o,c),c.send(null==r?null:r),o},o.abort=function(){return c.abort(),o},su.rebind(o,u,"on"),null==r?o:o.get(Ln(r))}function Ln(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qn(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Dn(n,t,e){var r=arguments.length;r<2&&(t=0),r<3&&(e=Date.now());var i=e+t,o={c:n,t:i,n:null};return oa?oa.n=o:ia=o,oa=o,ua||(aa=clearTimeout(aa),ua=1,ca(Rn)),o}function Rn(){var n=Pn(),t=Un()-n;t>24?(isFinite(t)&&(clearTimeout(aa),aa=setTimeout(Rn,t)),ua=0):(ua=1,ca(Rn))}function Pn(){for(var n=Date.now(),t=ia;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Un(){for(var n,t=ia,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function On(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,o=r&&e?function(n,t){for(var i=n.length,o=[],u=0,a=r[0],c=0;i>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>t));)a=r[u=(u+1)%r.length];return o.reverse().join(e)}:M;return function(n){var e=sa.exec(n),r=e[1]||" ",u=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],p=e[9],g=1,d="",v="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===u)&&(l=r="0",u="="),p){case"n":f=!0,p="g";break;case"%":g=100,v="%",p="f";break;case"p":g=100,v="%",p="r";break;case"b":case"o":case"x":case"X":"#"===c&&(d="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===c&&(d=i[0],v=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=fa.get(p)||Hn;var x=l&&f;return function(n){var e=v;if(y&&n%1)return"";var i=n<0||0===n&&1/n<0?(n=-n,"-"):"-"===a?"":a;if(g<0){var c=su.formatPrefix(n,h);n=c.scale(n),e=c.symbol+v}else n*=g;n=p(n,h);var M,w,b=n.lastIndexOf(".");if(b<0){var _=m?n.lastIndexOf("e"):-1;_<0?(M=n,w=""):(M=n.substring(0,_),w=n.substring(_))}else M=n.substring(0,b),w=t+n.substring(b+1);!l&&f&&(M=o(M,1/0));var k=d.length+M.length+w.length+(x?0:i.length),E=k"===u?E+i+n:"^"===u?E.substring(0,k>>=1)+i+n+E.substring(k):i+(x?n:E+n))+e}}}function Hn(n){return n+""}function In(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Yn(n,t,e){function r(t){var e=n(t),r=o(e,1);return t-e1)for(;u=l)return-1;if(37===(i=t.charCodeAt(a++))){if(u=t.charAt(a++),!(o=C[u in da?t.charAt(a++):u])||(r=o(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.slice(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){M.lastIndex=0;var r=M.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=S.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){k.lastIndex=0;var r=k.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function c(n,t,r){return e(n,A.x.toString(),t,r)}function l(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=x.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,p=n.time,g=n.periods,d=n.days,v=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{pa=In;var t=new pa;return t._=n,r(t)}finally{pa=Date}}var r=t(n);return e.parse=function(n){try{pa=In;var t=r.parse(n);return t&&t._}finally{pa=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ft;var x=su.map(),M=$n(d),w=Xn(d),b=$n(v),_=Xn(v),k=$n(y),E=Xn(y),N=$n(m),S=Xn(m);g.forEach(function(n,t){x.set(n.toLowerCase(),t)});var A={a:function(n){return v[n.getDay()]},A:function(n){return d[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(f),d:function(n,t){return Vn(n.getDate(),t,2)},e:function(n,t){return Vn(n.getDate(),t,2)},H:function(n,t){return Vn(n.getHours(),t,2)},I:function(n,t){return Vn(n.getHours()%12||12,t,2)},j:function(n,t){return Vn(1+ha.dayOfYear(n),t,3)},L:function(n,t){return Vn(n.getMilliseconds(),t,3)},m:function(n,t){return Vn(n.getMonth()+1,t,2)},M:function(n,t){return Vn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Vn(n.getSeconds(),t,2)},U:function(n,t){return Vn(ha.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Vn(ha.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Vn(n.getFullYear()%100,t,2)},Y:function(n,t){return Vn(n.getFullYear()%1e4,t,4)},Z:lt,"%":function(){return"%"}},C={a:r,A:i,b:o,B:u,c:a,d:rt,e:rt,H:ot,I:ot,j:it,L:ct,m:et,M:ut,p:s,S:at,U:Jn,w:Wn,W:Gn,x:c,X:l,y:Qn,Y:Kn,Z:nt,"%":st};return t}function Vn(n,t,e){var r=n<0?"-":"",i=(r?-n:n)+"",o=i.length;return r+(o68?1900:2e3)}function et(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function rt(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function it(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ot(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function at(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ct(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function lt(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=Mu(t)/60|0,i=Mu(t)%60;return e+Vn(r,"0",2)+Vn(i,"0",2)}function st(n,t,e){ya.lastIndex=0;var r=ya.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ft(n){for(var t=n.length,e=-1;++e=0?1:-1,a=u*e,c=Math.cos(t),l=Math.sin(t),s=o*l,f=i*c+s*Math.cos(a),h=s*u*Math.sin(a);_a.add(Math.atan2(h,f)),r=n,i=c,o=l}var t,e,r,i,o;ka.point=function(u,a){ka.point=n,r=(t=u)*Yu,i=Math.cos(a=(e=a)*Yu/2+Fu/4),o=Math.sin(a)},ka.lineEnd=function(){n(t,e)}}function mt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function xt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function wt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function bt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function _t(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function kt(n){return[Math.atan2(n[1],n[0]),rn(n[2])]}function Et(n,t){return Mu(n[0]-t[0])=0;--a)i.point((f=s[a])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,s=p.z,g=!g}while(!p.v);i.lineEnd()}}}function Dt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++u1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Ut))}var p,g,d,v=t(o),y=i.invert(r[0],r[1]),m={point:u,lineStart:c,lineEnd:l,polygonStart:function(){m.point=s,m.lineStart=f,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=u,m.lineStart=c,m.lineEnd=l,p=su.merge(p);var n=Yt(y,g);p.length?(w||(o.polygonStart(),w=!0),qt(p,Ft,n,e,o)):n&&(w||(o.polygonStart(),w=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=g=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=jt(),M=t(x),w=!1;return m}}function Ut(n){return n.length>1}function jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:_,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ft(n,t){return((n=n.x)[0]<0?n[1]-Iu-Uu:Iu-n[1])-((t=t.x)[0]<0?t[1]-Iu-Uu:Iu-t[1])}function Ot(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var a=o>0?Fu:-Fu,c=Mu(o-e);Mu(c-Fu)0?Iu:-Iu),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(o,r),t=0):i!==a&&c>=Fu&&(Mu(e-i)Uu?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*o*u)):(t+r)/2}function It(n,t,e,r){var i;if(null==n)i=e*Iu,r.point(-Fu,i),r.point(0,i),r.point(Fu,i),r.point(Fu,0),r.point(Fu,-i),r.point(0,-i),r.point(-Fu,-i),r.point(-Fu,0),r.point(-Fu,i);else if(Mu(n[0]-t[0])>Uu){var o=n[0]=0?1:-1,_=b*w,k=_>Fu,E=g*x;if(_a.add(Math.atan2(E*b*Math.sin(_),d*M+E*Math.cos(_))),o+=k?w+b*Ou:w,k^h>=e^y>=e){var N=Mt(mt(f),mt(n));_t(N);var S=Mt(i,N);_t(S);var A=(k^w>=0?-1:1)*rn(S[2]);(r>A||r===A&&(N[0]||N[1]))&&(u+=k^w>=0?1:-1)}if(!v++)break;h=y,g=x,d=M,f=n}}return(o<-Uu||oo}function e(n){var e,o,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var p,g=[f,h],d=t(f,h),v=u?d?0:i(f,h):d?i(f+(f<0?Fu:-Fu),h):0;if(!e&&(l=c=d)&&n.lineStart(),d!==c&&(p=r(e,g),(Et(e,p)||Et(g,p))&&(g[0]+=Uu,g[1]+=Uu,d=t(g[0],g[1]))),d!==c)s=0,d?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&u^d){var y;v&o||!(y=r(g,e,!0))||(s=0,u?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!d||e&&Et(e,g)||n.point(g[0],g[1]),e=g,c=d,o=v},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=mt(n),i=mt(t),u=[1,0,0],a=Mt(r,i),c=xt(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=o*c/s,h=-o*l/s,p=Mt(u,a),g=bt(u,f);wt(g,bt(a,h));var d=p,v=xt(g,d),y=xt(d,d),m=v*v-y*(xt(g,g)-1);if(!(m<0)){var x=Math.sqrt(m),M=bt(d,(-v-x)/y);if(wt(M,g),M=kt(M),!e)return M;var w,b=n[0],_=t[0],k=n[1],E=t[1];_0^M[1]<(Mu(M[0]-b)Fu^(b<=M[0]&&M[0]<=_)){var C=bt(d,(-v+x)/y);return wt(C,g),[M,kt(C)]}}}function i(t,e){var r=u?n:Fu-n,i=0;return t<-r?i|=1:t>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var o=Math.cos(n),u=o>0,a=Mu(o)>Uu;return Pt(t,e,ye(n,6*Yu),u?[0,-n]:[-Fu,n-Fu])}function Zt(n,t,e,r){return function(i){var o,u=i.a,a=i.b,c=u.x,l=u.y,s=a.x,f=a.y,h=0,p=1,g=s-c,d=f-l;if(o=n-c,g||!(o>0)){if(o/=g,g<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=e-c,g||!(o<0)){if(o/=g,g<0){if(o>p)return;o>h&&(h=o)}else if(g>0){if(o0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-l,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0&&(i.a={x:c+h*g,y:l+h*d}),p<1&&(i.b={x:c+p*g,y:l+p*d}),i}}}}}}function Vt(n,t,e,r){function i(r,i){return Mu(r[0]-n)0?0:3:Mu(r[0]-e)0?2:1:Mu(r[1]-t)0?1:0:i>0?3:2}function o(n,t){return u(n.x,t.x)}function u(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=v.length,r=n[1],i=0;ir&&tn(l,o,n)>0&&++t:o[1]<=r&&tn(l,o,n)<0&&--t,l=o;return 0!==t}function l(o,a,c,l){var s=0,f=0;if(null==o||(s=i(o,c))!==(f=i(a,c))||u(o,a)<0^c>0)do{l.point(0===s||3===s?n:e,s>1?r:t)}while((s=(s+c+4)%4)!==f);else l.point(a[0],a[1])}function s(i,o){return n<=i&&i<=e&&t<=o&&o<=r}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=g,v&&v.push(y=[]),k=!0,_=!1,w=b=NaN}function p(){d&&(g(m,x),M&&_&&S.rejoin(),d.push(S.buffer())),C.point=f,_&&a.lineEnd()}function g(n,t){n=Math.max(-ja,Math.min(ja,n)),t=Math.max(-ja,Math.min(ja,t));var e=s(n,t);if(v&&y.push([n,t]),k)m=n,x=t,M=e,k=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&_)a.point(n,t);else{var r={a:{x:w,y:b},b:{x:n,y:t}};A(r)?(_||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),E=!1):e&&(a.lineStart(),a.point(n,t),E=!1)}w=n,b=t,_=e}var d,v,y,m,x,M,w,b,_,k,E,N=a,S=jt(),A=Zt(n,t,e,r),C={point:f,lineStart:h,lineEnd:p,polygonStart:function(){a=S,d=[],v=[],E=!0},polygonEnd:function(){a=N,d=su.merge(d);var t=c([n,r]),e=E&&t,i=d.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),i&&qt(d,o,t,l,a),a.polygonEnd()),d=v=y=null}};return C}}function $t(n){var t=0,e=Fu/3,r=le(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fu/180,e=n[1]*Fu/180):[t/Fu*180,e/Fu*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(o-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),u-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),u=Math.sqrt(o)/i;return e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,rn((o-(n*n+e*e)*i*i)/(2*i))]},e}function Wt(){function n(n,t){Oa+=i*n-r*t,r=n,i=t}var t,e,r,i;Za.point=function(o,u){Za.point=n,t=r=o,e=i=u},Za.lineEnd=function(){n(t,e)}}function Jt(n,t){nYa&&(Ya=n),tBa&&(Ba=t)}function Gt(){function n(n,t){u.push("M",n,",",t,o)}function t(n,t){u.push("M",n,",",t),a.point=e}function e(n,t){u.push("L",n,",",t)}function r(){a.point=n}function i(){u.push("Z")}var o=Kt(4.5),u=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return o=Kt(n),a},result:function(){if(u.length){var n=u.join("");return u=[],n}}};return a}function Kt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qt(n,t){Sa+=n,Aa+=t,++Ca}function ne(){function n(n,r){var i=n-t,o=r-e,u=Math.sqrt(i*i+o*o);Ta+=u*(t+n)/2,za+=u*(e+r)/2,La+=u,Qt(t=n,e=r)}var t,e;$a.point=function(r,i){$a.point=n,Qt(t=r,e=i)}}function te(){$a.point=Qt}function ee(){function n(n,t){var e=n-r,o=t-i,u=Math.sqrt(e*e+o*o);Ta+=u*(r+n)/2,za+=u*(i+t)/2,La+=u,u=i*n-r*t,qa+=u*(r+n),Da+=u*(i+t),Ra+=3*u,Qt(r=n,i=t)}var t,e,r,i;$a.point=function(o,u){$a.point=n,Qt(t=r=o,e=i=u)},$a.lineEnd=function(){n(t,e)}} -function re(n){function t(t,e){n.moveTo(t+u,e),n.arc(t,e,u,0,Ou)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function o(){n.closePath()}var u=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return u=n,a},result:_};return a}function ie(n){function t(n){return(a?r:e)(n)}function e(t){return ae(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=NaN,k.point=o,t.lineStart()}function o(e,r){var o=mt([e,r]),u=n(e,r);i(x,M,m,w,b,_,x=u[0],M=u[1],m=e,w=o[0],b=o[1],_=o[2],a,t),t.point(x,M)}function u(){k.point=e,t.lineEnd()}function c(){r(),k.point=l,k.lineEnd=s}function l(n,t){o(f=n,h=t),p=x,g=M,d=w,v=b,y=_,k.point=o}function s(){i(x,M,m,w,b,_,p,g,f,d,v,y,a,t),k.lineEnd=u,u()}var f,h,p,g,d,v,y,m,x,M,w,b,_,k={point:e,lineStart:r,lineEnd:u,polygonStart:function(){t.polygonStart(),k.lineStart=c},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function i(t,e,r,a,c,l,s,f,h,p,g,d,v,y){var m=s-t,x=f-e,M=m*m+x*x;if(M>4*o&&v--){var w=a+p,b=c+g,_=l+d,k=Math.sqrt(w*w+b*b+_*_),E=Math.asin(_/=k),N=Mu(Mu(_)-1)o||Mu((m*T+x*z)/M-.5)>.3||a*p+c*g+l*d0&&16,t):Math.sqrt(o)},t}function oe(n){var t=ie(function(t,e){return n([t*Bu,e*Bu])});return function(n){return se(t(n))}}function ue(n){this.stream=n}function ae(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ce(n){return le(function(){return n})()}function le(n){function t(n){return n=a(n[0]*Yu,n[1]*Yu),[n[0]*h+c,l-n[1]*h]}function e(n){return(n=a.invert((n[0]-c)/h,(l-n[1])/h))&&[n[0]*Bu,n[1]*Bu]}function r(){a=zt(u=pe(y,m,x),o);var n=o(d,v);return c=p-n[0]*h,l=g+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var o,u,a,c,l,s,f=ie(function(n,t){return n=o(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,p=480,g=250,d=0,v=0,y=0,m=0,x=0,w=Ua,b=M,_=null,k=null;return t.stream=function(n){return s&&(s.valid=!1),s=se(w(u,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(w=null==n?(_=n,Ua):Bt((_=+n)*Yu),i()):_},t.clipExtent=function(n){return arguments.length?(k=n,b=n?Vt(n[0][0],n[0][1],n[1][0],n[1][1]):M,i()):k},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(d=n[0]%360*Yu,v=n[1]%360*Yu,r()):[d*Bu,v*Bu]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yu,m=n[1]%360*Yu,x=n.length>2?n[2]%360*Yu:0,r()):[y*Bu,m*Bu,x*Bu]},su.rebind(t,f,"precision"),function(){return o=n.apply(this,arguments),t.invert=o.invert&&e,r()}}function se(n){return ae(n,function(t,e){n.point(t*Yu,e*Yu)})}function fe(n,t){return[n,t]}function he(n,t){return[n>Fu?n-Ou:n<-Fu?n+Ou:n,t]}function pe(n,t,e){return n?t||e?zt(de(n),ve(t,e)):de(n):t||e?ve(t,e):he}function ge(n){return function(t,e){return t+=n,[t>Fu?t-Ou:t<-Fu?t+Ou:t,e]}}function de(n){var t=ge(n);return t.invert=ge(-n),t}function ve(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*i;return[Math.atan2(c*o-s*u,a*r-l*i),rn(s*o+c*u)]}var r=Math.cos(n),i=Math.sin(n),o=Math.cos(t),u=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*o-c*u;return[Math.atan2(c*o+l*u,a*r+s*i),rn(s*r-a*i)]},e}function ye(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,o,u,a){var c=u*t;null!=i?(i=me(e,i),o=me(e,o),(u>0?io)&&(i+=u*Ou)):(i=n+u*Ou,o=n-.5*c);for(var l,s=i;u>0?s>o:s0?t<-Iu+Uu&&(t=-Iu+Uu):t>Iu-Uu&&(t=Iu-Uu);var e=u/Math.pow(i(t),o);return[e*Math.sin(o*n),u-e*Math.cos(o*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fu/4+n/2)},o=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),u=r*Math.pow(i(n),o)/o;return o?(e.invert=function(n,t){var e=u-t,r=nn(o)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/o,2*Math.atan(Math.pow(u/r,1/o))-Iu]},e):Ae}function Se(n,t){function e(n,t){var e=o-t;return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),o=r/i+n;return Mu(i)1&&tn(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function De(n,t){return n[0]-t[0]||n[1]-t[1]}function Re(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Pe(n,t,e,r){var i=n[0],o=e[0],u=t[0]-i,a=r[0]-o,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-o))/(f*u-a*s);return[i+h*u,c+h*s]}function Ue(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function je(){or(this),this.edge=this.site=this.circle=null}function Fe(n){var t=ac.pop()||new je;return t.site=n,t}function Oe(n){Je(n),ic.remove(n),ac.push(n),or(n)}function He(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},o=n.P,u=n.N,a=[n];Oe(n);for(var c=o;c.circle&&Mu(e-c.circle.x)Uu)a=a.L;else{if(!((i=o-Be(a,u))>Uu)){r>-Uu?(t=a.P,e=a):i>-Uu?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Fe(n);if(ic.insert(t,c),t||e){if(t===e)return Je(t),e=Fe(t.site),ic.insert(c,e),c.edge=e.edge=nr(t.site,c.site),We(t),void We(e);if(!e)return void(c.edge=nr(t.site,c.site));Je(t),Je(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,p=n.y-f,g=e.site,d=g.x-s,v=g.y-f,y=2*(h*v-p*d),m=h*h+p*p,x=d*d+v*v,M={x:(v*m-p*x)/y+s,y:(h*x-d*m)/y+f};er(e.edge,l,g,M),c.edge=nr(l,n,null,M),e.edge=nr(n,g,null,M),We(t),We(e)}}function Ye(n,t){var e=n.site,r=e.x,i=e.y,o=i-t;if(!o)return r;var u=n.P;if(!u)return-1/0;e=u.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/o-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+i-o/2)))/f+r:(r+a)/2}function Be(n,t){var e=n.N;if(e)return Ye(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ze(n){this.site=n,this.edges=[]}function Ve(n){for(var t,e,r,i,o,u,a,c,l,s,f=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],d=rc,v=d.length;v--;)if((o=d[v])&&o.prepare())for(a=o.edges,c=a.length,u=0;uUu||Mu(i-e)>Uu)&&(a.splice(u,0,new rr(tr(o.site,s,Mu(r-f)Uu?{x:f,y:Mu(t-f)Uu?{x:Mu(e-g)Uu?{x:h,y:Mu(t-h)Uu?{x:Mu(e-p)=-ju)){var p=c*c+l*l,g=s*s+f*f,d=(f*p-l*g)/h,v=(c*g-s*p)/h,f=v+a,y=cc.pop()||new Xe;y.arc=n,y.site=i,y.x=d+u,y.y=f+Math.sqrt(d*d+v*v),y.cy=f,n.circle=y;for(var m=null,x=uc._;x;)if(y.y=a)return;if(h>g){if(o){if(o.y>=l)return}else o={x:v,y:c};e={x:v,y:l}}else{if(o){if(o.y1)if(h>g){if(o){if(o.y>=l)return}else o={x:(c-i)/r,y:c};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=a)return}else o={x:u,y:r*u+i};e={x:a,y:r*a+i}}else{if(o){if(o.xo||f>u||h=M,_=e>=w,k=_<<1|b,E=k+4;ko&&(i=t.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:xr(e,r)})),o=fc.lastIndex;return o=0&&!(e=su.interpolators[r](n,t)););return e}function br(n,t){var e,r=[],i=[],o=n.length,u=t.length,a=Math.min(n.length,t.length);for(e=0;e=1?1:n(t)}}function kr(n){return function(t){return 1-n(1-t)}}function Er(n){return function(t){return.5*(t<.5?n(2*t):2-n(2-2*t))}}function Nr(n){return n*n}function Sr(n){return n*n*n}function Ar(n){if(n<=0)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}function Cr(n){return function(t){return Math.pow(t,n)}}function Tr(n){return 1-Math.cos(n*Iu)}function zr(n){return Math.pow(2,10*(n-1))}function Lr(n){return 1-Math.sqrt(1-n*n)}function qr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ou*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ou/t)}}function Dr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Rr(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Pr(n,t){n=su.hcl(n),t=su.hcl(t);var e=n.h,r=n.c,i=n.l,o=t.h-e,u=t.c-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return pn(e+o*n,r+u*n,i+a*n)+""}}function Ur(n,t){n=su.hsl(n),t=su.hsl(t);var e=n.h,r=n.s,i=n.l,o=t.h-e,u=t.s-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return fn(e+o*n,r+u*n,i+a*n)+""}}function jr(n,t){n=su.lab(n),t=su.lab(t);var e=n.l,r=n.a,i=n.b,o=t.l-e,u=t.a-r,a=t.b-i;return function(n){return dn(e+o*n,r+u*n,i+a*n)+""}}function Fr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Or(n){var t=[n.a,n.b],e=[n.c,n.d],r=Ir(t),i=Hr(t,e),o=Ir(Yr(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Br(e)+"rotate(",null,")")-2,x:xr(n,t)})):t&&e.push(Br(e)+"rotate("+t+")")}function $r(n,t,e,r){n!==t?r.push({i:e.push(Br(e)+"skewX(",null,")")-2,x:xr(n,t)}):t&&e.push(Br(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Br(e)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(n[0],t[0])},{i:i-2,x:xr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Br(e)+"scale("+t+")")}function Wr(n,t){var e=[],r=[];return n=su.transform(n),t=su.transform(t),Zr(n.translate,t.translate,e,r),Vr(n.rotate,t.rotate,e,r),$r(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,o=r.length;++i=0;)e.push(i[r])}function ci(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(o=n.children)&&(i=o.length))for(var i,o,u=-1;++ui&&(r=e,i=t);return r}function xi(n){return n.reduce(Mi,0)}function Mi(n,t){return n+t[1]}function wi(n,t){return bi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function bi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,o=[];++e<=t;)o[e]=i*e+r;return o}function _i(n){return[su.min(n),su.max(n)]}function ki(n,t){return n.value-t.value}function Ei(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Ni(n,t){n._pack_next=t,t._pack_prev=n}function Si(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ai(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(l=e.length)){var e,r,i,o,u,a,c,l,s=1/0,f=-1/0,h=1/0,p=-1/0;if(e.forEach(Ci),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(o=e[2],Li(r,i,o),t(o),Ei(r,o),r._pack_prev=o,Ei(o,i),i=r._pack_next,u=3;u=0;)t=i[o],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function ji(n,t,e){return n.a.parent===t.parent?n.a:e}function Fi(n){return 1+su.max(n,function(n){return n.y})}function Oi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Hi(n){var t=n.children;return t&&t.length?Hi(t[0]):n}function Ii(n){var t,e=n.children;return e&&(t=e.length)?Ii(e[t-1]):n}function Yi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Bi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],o=n.dy-t[0]-t[2];return i<0&&(e+=i/2,i=0),o<0&&(r+=o/2,o=0),{x:e,y:r,dx:i,dy:o}}function Zi(n){var t=n[0],e=n[n.length-1];return t2?Ji:$i,c=r?Gr:Jr;return u=i(n,t,c,e),a=i(t,n,c,wr),o}function o(n){return u(n)}var u,a;return o.invert=function(n){return a(n)},o.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},o.range=function(n){return arguments.length?(t=n,i()):t},o.rangeRound=function(n){return o.range(n).interpolate(Fr)},o.clamp=function(n){return arguments.length?(r=n,i()):r},o.interpolate=function(n){return arguments.length?(e=n,i()):e},o.ticks=function(t){return to(n,t)},o.tickFormat=function(t,e){return eo(n,t,e)},o.nice=function(t){return Qi(n,t),i()},o.copy=function(){return Gi(n,t,e,r)},i()}function Ki(n,t){return su.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Qi(n,t){return Xi(n,Wi(no(n,t)[2])),Xi(n,Wi(no(n,t)[2])),n}function no(n,t){null==t&&(t=10);var e=Zi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return o<=.15?i*=10:o<=.35?i*=5:o<=.75&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function to(n,t){return su.range.apply(su,no(n,t))}function eo(n,t,e){var r=no(n,t);if(e){var i=sa.exec(e);if(i.shift(),"s"===i[8]){var o=su.formatPrefix(Math.max(Mu(r[0]),Mu(r[1])));return i[7]||(i[7]="."+ro(o.scale(r[2]))),i[8]="f",e=su.format(i.join("")),function(n){return e(o.scale(n))+o.symbol}}i[7]||(i[7]="."+io(i[8],r)),e=i.join("")}else e=",."+ro(r[2])+"f";return su.format(e)}function ro(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function io(n,t){var e=ro(t[2]);return n in _c?Math.abs(e-ro(Math.max(Mu(t[0]),Mu(t[1]))))+ +("e"!==n):e-2*("%"===n)}function oo(n,t,e,r){function i(n){return(e?Math.log(n<0?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function o(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function u(t){return n(i(t))}return u.invert=function(t){return o(n.invert(t))},u.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),u):r},u.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),u):t},u.nice=function(){var t=Xi(r.map(i),e?Math:Ec);return n.domain(t),r=t.map(o),u},u.ticks=function(){var n=Zi(r),u=[],a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;l0;h--)u.push(o(l)*h);for(l=0;u[l]c;s--);u=u.slice(l,s)}return u},u.tickFormat=function(n,e){if(!arguments.length)return kc;arguments.length<2?e=kc:"function"!=typeof e&&(e=su.format(e));var r=Math.max(1,t*n/u.ticks().length);return function(n){var u=n/o(Math.round(i(n)));return u*t0?a[e-1]:n[0],e0?0:1}function wo(n,t,e,r,i){var o=n[0]-t[0],u=n[1]-t[1],a=(i?r:-r)/Math.sqrt(o*o+u*u),c=a*u,l=-a*o,s=n[0]+c,f=n[1]+l,h=t[0]+c,p=t[1]+l,g=(s+h)/2,d=(f+p)/2,v=h-s,y=p-f,m=v*v+y*y,x=e-r,M=s*p-h*f,w=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-M*M)),b=(M*y-v*w)/m,_=(-M*v-y*w)/m,k=(M*y+v*w)/m,E=(-M*v+y*w)/m,N=b-g,S=_-d,A=k-g,C=E-d;return N*N+S*S>A*A+C*C&&(b=k,_=E),[[b-c,_-l],[b*e/x,_*e/x]]}function bo(n){function t(t){function u(){l.push("M",o(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,p=Cn(e),g=Cn(r);++f1?n.join("L"):n+"Z"}function ko(n){return n.join("L")+"Z"}function Eo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function No(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],o=n[c],c++,r+="C"+(i[0]+u[0])+","+(i[1]+u[1])+","+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1];for(var l=2;l9&&(i=3*t/Math.sqrt(i),u[a]=i*e,u[a+1]=i*r));for(a=-1;++a<=c;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+u[a]*u[a])),o.push([i||0,u[a]*i||0]);return o}function Io(n){return n.length<3?_o(n):n[0]+zo(n,Ho(n))}function Yo(n){for(var t,e,r,i=-1,o=n.length;++i0;)p[--a].call(n,u);if(o>=1)return d.event&&d.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1}var c,l,s,h,p,g=n[e]||(n[e]={active:0,count:0}),d=g[r];d||(c=i.time,l=Dn(o,0,c),d=g[r]={tween:new f,time:c,timer:l,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function ru(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function iu(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function ou(n){return n.toISOString()}function uu(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,o=su.bisect(Jc,i);return o==Jc.length?[t.year,no(n.map(function(n){return n/31536e6}),e)[2]]:o?t[i/Jc[o-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=au(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=au(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Zi(r.domain()),o=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return o&&(n=o[0],t=o[1]),n.range(e[0],au(+e[1]+1),t<1?1:t)},r.tickFormat=function(){return e},r.copy=function(){return uu(n.copy(),t,e)},Ki(r,n)}function au(n){return new Date(n)}function cu(n){return JSON.parse(n.responseText)}function lu(n){var t=pu.createRange();return t.selectNode(pu.body),t.createContextualFragment(n.responseText)}var su={version:"3.5.17"},fu=[].slice,hu=function(n){return fu.call(n)},pu=this.document;if(pu)try{hu(pu.documentElement.childNodes)[0].nodeType}catch(n){hu=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),pu)try{pu.createElement("DIV").style.setProperty("opacity",0,"")}catch(n){var gu=this.Element.prototype,du=gu.setAttribute,vu=gu.setAttributeNS,yu=this.CSSStyleDeclaration.prototype,mu=yu.setProperty;gu.setAttribute=function(n,t){du.call(this,n,t+"")},gu.setAttributeNS=function(n,t,e){vu.call(this,n,t,e+"")},yu.setProperty=function(n,t,e){mu.call(this,n,t+"",e)}}su.ascending=i,su.descending=function(n,t){return tn?1:t>=n?0:NaN},su.min=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},su.max=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},su.extent=function(n,t){var e,r,i,o=-1,u=n.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return c/(s-1)},su.deviation=function(){var n=su.variance.apply(this,arguments);return n?Math.sqrt(n):n};var xu=a(i);su.bisectLeft=xu.left,su.bisect=su.bisectRight=xu.right,su.bisector=function(n){return a(1===n.length?function(t,e){return i(n(t),e)}:n)},su.shuffle=function(n,t,e){(o=arguments.length)<3&&(e=n.length,o<2&&(t=0));for(var r,i,o=e-t;o;)i=Math.random()*o--|0,r=n[o+t],n[o+t]=n[i+t],n[i+t]=r;return n},su.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},su.pairs=function(n){for(var t=0,e=n.length-1,r=n[0],i=new Array(e<0?0:e);t=0;)for(r=n[i],t=r.length;--t>=0;)e[--u]=r[t];return e};var Mu=Math.abs;su.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e==1/0)throw new Error("infinite range");var r,i=[],o=l(Mu(e)),u=-1;if(n*=o,t*=o,e*=o,e<0)for(;(r=n+e*++u)>t;)i.push(r/o);else for(;(r=n+e*++u)=o.length)return r?r.call(i,u):e?u.sort(e):u;for(var c,l,s,h,p=-1,g=u.length,d=o[a++],v=new f;++p=o.length)return n;var r=[],i=u[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},o=[],u=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(su.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return u[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},su.set=function(n){var t=new x;if(n)for(var e=0,r=n.length;e=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},su.event=null,su.requote=function(n){return n.replace(ku,"\\$&")};var ku=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Eu={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Nu=function(n,t){return t.querySelector(n)},Su=function(n,t){return t.querySelectorAll(n)},Au=function(n,t){var e=n.matches||n[b(n,"matchesSelector")];return(Au=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Nu=function(n,t){return Sizzle(n,t)[0]||null},Su=Sizzle,Au=Sizzle.matchesSelector),su.selection=function(){return su.select(pu.documentElement)};var Cu=su.selection.prototype=[];Cu.select=function(n){var t,e,r,i,o=[];n=T(n);for(var u=-1,a=this.length;++u=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),zu.hasOwnProperty(e)?{space:zu[e],local:n}:n}},Cu.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=su.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},Cu.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=R(n)).length,i=-1;if(t=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Cu.sort=function(n){n=B.apply(this,arguments);for(var t=-1,e=this.length;++t0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){w&&w.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),_&&_.domain(b.range().map(function(n){return(n-k.y)/k.k}).map(b.invert))}function c(n){T++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--T||(n({type:"zoomend"}),v=null)}function f(){function n(){a=1,o(su.mouse(i),h),l(u)}function e(){f.on(L,null).on(q,null),p(a),s(u)}var i=this,u=R.of(i,arguments),a=0,f=su.select(r(i)).on(L,n).on(q,e),h=t(su.mouse(i)),p=G(i);Oc.call(i),c(u)}function h(){function n(){var n=su.touches(g);return p=k.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=su.event.target;su.select(t).on(M,r).on(w,a),b.push(t);for(var e=su.event.changedTouches,i=0,o=e.length;i1){var s=c[0],f=c[1],h=s[0]-f[0],p=s[1]-f[1];y=h*h+p*p}}function r(){var n,t,e,r,u=su.touches(g);Oc.call(g);for(var a=0,c=u.length;a=l)return u;if(i)return i=!1,o;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fa=su.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=su.round(n,jn(n,t))).toFixed(Math.max(0,Math.min(20,jn(n*(1+1e-15),t))))}}),ha=su.time={},pa=Date;In.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ga.setUTCDate.apply(this._,arguments)},setDay:function(){ga.setUTCDay.apply(this._,arguments)},setFullYear:function(){ga.setUTCFullYear.apply(this._,arguments)},setHours:function(){ga.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ga.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ga.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ga.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ga.setUTCSeconds.apply(this._,arguments)},setTime:function(){ga.setTime.apply(this._,arguments)}};var ga=Date.prototype;ha.year=Yn(function(n){return n=ha.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ha.years=ha.year.range,ha.years.utc=ha.year.utc.range,ha.day=Yn(function(n){var t=new pa(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ha.days=ha.day.range,ha.days.utc=ha.day.utc.range,ha.dayOfYear=function(n){var t=ha.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){ -t=7-t;var e=ha[n]=Yn(function(n){return(n=ha.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ha[n+"s"]=e.range,ha[n+"s"].utc=e.utc.range,ha[n+"OfYear"]=function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)}}),ha.week=ha.sunday,ha.weeks=ha.sunday.range,ha.weeks.utc=ha.sunday.utc.range,ha.weekOfYear=ha.sundayOfYear;var da={"-":"",_:" ",0:"0"},va=/^\s*\d+/,ya=/^%/;su.locale=function(n){return{numberFormat:On(n),timeFormat:Zn(n)}};var ma=su.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});su.format=ma.numberFormat,su.geo={},ht.prototype={s:0,t:0,add:function(n){pt(n,this.t,xa),pt(xa.s,this.s,this),this.s?this.t+=xa.t:this.s=xa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xa=new ht;su.geo.stream=function(n,t){n&&Ma.hasOwnProperty(n.type)?Ma[n.type](n,t):gt(n,t)};var Ma={Feature:function(n,t){gt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rp&&(p=t)}function t(t,e){var r=mt([t*Yu,e*Yu]);if(y){var i=Mt(y,r),o=[i[1],-i[0],0],u=Mt(o,i);_t(u),u=kt(u);var c=t-g,l=c>0?1:-1,d=u[0]*Bu*l,v=Mu(c)>180;if(v^(l*gp&&(p=m)}else if(d=(d+360)%360-180,v^(l*gp&&(p=e);v?ta(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(th&&(h=t)):t>g?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);y=r,g=t}function e(){w.point=t}function r(){M[0]=s,M[1]=h,w.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=Mu(r)>180?r+(r>0?360:-360):r}else d=n,v=e;ka.point(n,e),t(n,e)}function o(){ka.lineStart()}function u(){i(d,v),ka.lineEnd(),Mu(m)>Uu&&(s=-(h=180)),M[0]=s,M[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nUu?p=90:m<-Uu&&(f=-90),M[0]=s,M[1]=h}};return function(n){p=h=-(s=f=1/0),x=[],su.geo.stream(n,w);var t=x.length;if(t){x.sort(c);for(var e,r=1,i=x[0],o=[i];ra(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(var u,e,g=-1/0,t=o.length-1,r=0,i=o[t];r<=t;i=e,++r)e=o[r],(u=a(i[1],e[0]))>g&&(g=u,s=e[0],h=i[1])}return x=M=null,s===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[s,f],[h,p]]}}(),su.geo.centroid=function(n){Ea=Na=Sa=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,Pa);var t=qa,e=Da,r=Ra,i=t*t+e*e+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?a:o).invert(n)},n.stream=function(n){var t=o.stream(n),e=u.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(o.precision(t),u.precision(t),a.precision(t),n):o.precision()},n.scale=function(t){return arguments.length?(o.scale(t),u.scale(.35*t),a.scale(t),n.translate(o.translate())):o.scale()},n.translate=function(t){if(!arguments.length)return o.translate();var l=o.scale(),s=+t[0],f=+t[1];return e=o.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=u.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Uu,f+.12*l+Uu],[s-.214*l-Uu,f+.234*l-Uu]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Uu,f+.166*l+Uu],[s-.115*l-Uu,f+.234*l-Uu]]).stream(c).point,n},n.scale(1070)};var Fa,Oa,Ha,Ia,Ya,Ba,Za={point:_,lineStart:_,lineEnd:_,polygonStart:function(){Oa=0,Za.lineStart=Wt},polygonEnd:function(){Za.lineStart=Za.lineEnd=Za.point=_,Fa+=Mu(Oa/2)}},Va={point:Jt,lineStart:_,lineEnd:_,polygonStart:_,polygonEnd:_},$a={point:Qt,lineStart:ne,lineEnd:te,polygonStart:function(){$a.lineStart=ee},polygonEnd:function(){$a.point=Qt,$a.lineStart=ne,$a.lineEnd=te}};su.geo.path=function(){function n(n){return n&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),u&&u.valid||(u=i(o)),su.geo.stream(n,u)),o.result()}function t(){return u=null,n}var e,r,i,o,u,a=4.5;return n.area=function(n){return Fa=0,su.geo.stream(n,i(Za)),Fa},n.centroid=function(n){return Sa=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,i($a)),Ra?[qa/Ra,Da/Ra]:La?[Ta/La,za/La]:Ca?[Sa/Ca,Aa/Ca]:[NaN,NaN]},n.bounds=function(n){return Ya=Ba=-(Ha=Ia=1/0),su.geo.stream(n,i(Va)),[[Ha,Ia],[Ya,Ba]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||oe(n):M,t()):e},n.context=function(n){return arguments.length?(o=null==(r=n)?new Gt:new re(n),"function"!=typeof a&&o.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(o.pointRadius(+t),+t),n):a},n.projection(su.geo.albersUsa()).context(null)},su.geo.transform=function(n){return{stream:function(t){var e=new ue(t);for(var r in n)e[r]=n[r];return e}}},ue.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},su.geo.projection=ce,su.geo.projectionMutator=le,(su.geo.equirectangular=function(){return ce(fe)}).raw=fe.invert=fe,su.geo.rotation=function(n){function t(t){return t=n(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t}return n=pe(n[0]%360*Yu,n[1]*Yu,n.length>2?n[2]*Yu:0),t.invert=function(t){return t=n.invert(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t},t},he.invert=fe,su.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=pe(-n[0]*Yu,-n[1]*Yu,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Bu,n[1]*=Bu}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ye((t=+r)*Yu,i*Yu),n):t},n.precision=function(r){return arguments.length?(e=ye(t*Yu,(i=+r)*Yu),n):i},n.angle(90)},su.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yu,i=n[1]*Yu,o=t[1]*Yu,u=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*u)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},su.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return su.range(Math.ceil(o/v)*v,i,v).map(h).concat(su.range(Math.ceil(l/y)*y,c,y).map(p)).concat(su.range(Math.ceil(r/g)*g,e,g).filter(function(n){return Mu(n%v)>Uu}).map(s)).concat(su.range(Math.ceil(a/d)*d,u,d).filter(function(n){return Mu(n%y)>Uu}).map(f))}var e,r,i,o,u,a,c,l,s,f,h,p,g=10,d=g,v=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],o>i&&(t=o,o=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(m)):[[o,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),a>u&&(t=a,a=u,u=t),n.precision(m)):[[r,a],[e,u]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(v=+t[0],y=+t[1],n):[v,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],d=+t[1],n):[g,d]},n.precision=function(t){return arguments.length?(m=+t,s=xe(a,u,90),f=Me(r,e,m),h=xe(l,c,90),p=Me(o,i,m),n):m},n.majorExtent([[-180,-90+Uu],[180,90-Uu]]).minorExtent([[-180,-80-Uu],[180,80+Uu]])},su.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=we,i=be;return n.distance=function(){return su.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},su.geo.interpolate=function(n,t){return _e(n[0]*Yu,n[1]*Yu,t[0]*Yu,t[1]*Yu)},su.geo.length=function(n){return Xa=0,su.geo.stream(n,Wa),Xa};var Xa,Wa={sphere:_,point:_,lineStart:ke,lineEnd:_,polygonStart:_,polygonEnd:_},Ja=Ee(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(su.geo.azimuthalEqualArea=function(){return ce(Ja)}).raw=Ja;var Ga=Ee(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},M);(su.geo.azimuthalEquidistant=function(){return ce(Ga)}).raw=Ga,(su.geo.conicConformal=function(){return $t(Ne)}).raw=Ne,(su.geo.conicEquidistant=function(){return $t(Se)}).raw=Se;var Ka=Ee(function(n){return 1/n},Math.atan);(su.geo.gnomonic=function(){return ce(Ka)}).raw=Ka,Ae.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Iu]},(su.geo.mercator=function(){return Ce(Ae)}).raw=Ae;var Qa=Ee(function(){return 1},Math.asin);(su.geo.orthographic=function(){return ce(Qa)}).raw=Qa;var nc=Ee(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(su.geo.stereographic=function(){return ce(nc)}).raw=nc,Te.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Iu]},(su.geo.transverseMercator=function(){var n=Ce(Te),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Te,su.geom={},su.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=Cn(e),o=Cn(r),u=n.length,a=[],c=[];for(t=0;t=0;--t)p.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=o&&l.y>=i&&l.y<=u?[[r,u],[o,u],[o,i],[r,i]]:[]).point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(o(n,t)/Uu)*Uu,y:Math.round(u(n,t)/Uu)*Uu,i:t}})}var r=ze,i=Le,o=r,u=i,a=lc;return n?t(n):(t.links=function(n){return lr(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return lr(e(n)).cells.forEach(function(e,r){for(var i,o=e.site,u=e.edges.sort($e),a=-1,c=u.length,l=u[c-1].edge,s=l.l===o?l.r:l.l;++a=l,h=r>=s,p=h<<1|f;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=gr()),f?i=l:a=l,h?u=s:c=s,o(n,t,e,r,i,u,a,c)}var s,f,h,p,g,d,v,y,m,x=Cn(a),M=Cn(c);if(null!=t)d=t,v=e,y=r,m=i;else if(y=m=-(d=v=1/0),f=[],h=[],g=n.length,u)for(p=0;py&&(y=s.x),s.y>m&&(m=s.y),f.push(s.x),h.push(s.y);else for(p=0;py&&(y=w),b>m&&(m=b),f.push(w),h.push(b)}var _=y-d,k=m-v;_>k?m=v+_:y=d+k;var E=gr();if(E.add=function(n){o(E,n,+x(n,++p),+M(n,p),d,v,y,m)},E.visit=function(n){dr(n,E,d,v,y,m)},E.find=function(n){return vr(E,n[0],n[1],d,v,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=pc.get(e)||hc,r=gc.get(r)||M,_r(r(e.apply(null,fu.call(arguments,1))))},su.interpolateHcl=Pr,su.interpolateHsl=Ur,su.interpolateLab=jr,su.interpolateRound=Fr,su.transform=function(n){var t=pu.createElementNS(su.ns.prefix.svg,"g");return(su.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Or(e?e.matrix:dc)})(n)},Or.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var dc={a:1,b:0,c:0,d:1,e:0,f:0};su.interpolateTransform=Wr,su.layout={},su.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e0?i=n:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:i=0})):n>0&&(l.start({type:"start",alpha:i=n}),e=Dn(c.tick)),c):i},c.start=function(){function n(n,r){if(!e){for(e=new Array(i),c=0;c=0;)u.push(s=l[c]),s.parent=o,s.depth=o.depth+1;r&&(o.value=0),o.children=l}else r&&(o.value=+r.call(n,o,o.depth)||0),delete o.children;return ci(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=fi,e=li,r=si;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ai(t,function(n){n.children&&(n.value=0)}),ci(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},su.layout.partition=function(){function n(t,e,r,i){var o=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(u=o.length)){var u,a,c,l=-1;for(r=t.value?r/t.value:0;++la&&(a=r),u.push(r)}for(e=0;e0)for(o=-1;++o=s[0]&&a<=s[1]&&(u=c[su.bisect(f,a,1,p)-1],u.y+=g,u.push(n[o]));return c}var t=!0,e=Number,r=_i,i=wi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Cn(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return bi(n,t)}:Cn(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},su.layout.pack=function(){function n(n,o){var u=e.call(this,n,o),a=u[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ci(a,function(n){n.r=+s(n.value)}),ci(a,Ai),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ci(a,function(n){n.r+=f}),ci(a,Ai),ci(a,function(n){n.r-=f})}return zi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),u}var t,e=su.layout.hierarchy().sort(ki),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ui(n,e)},su.layout.tree=function(){function n(n,i){var s=u.call(this,n,i),f=s[0],h=t(f);if(ci(h,e),h.parent.m=-h.z,ai(h,r),l)ai(f,o);else{var p=f,g=f,d=f;ai(f,function(n){n.xg.x&&(g=n),n.depth>d.depth&&(d=n)});var v=a(p,g)/2-p.x,y=c[0]/(g.x+a(g,p)/2+v),m=c[1]/(d.depth||1);ai(f,function(n){n.x=(n.x+v)*y,n.y=n.depth*m})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,o=t.children,u=0,a=o.length;u0&&(Pi(ji(u,n,e),n,r),l+=r,s+=r),f+=u.m,l+=i.m,h+=c.m,s+=o.m;u&&!Ri(o)&&(o.t=u,o.m+=f-s),i&&!Di(c)&&(c.t=i,c.m+=l-h,e=n)}return e}function o(n){n.x*=c[0],n.y=n.depth*c[1]}var u=su.layout.hierarchy().sort(null).value(null),a=qi,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?o:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:o,n):l?c:null},ui(n,u)},su.layout.cluster=function(){function n(n,o){var u,a=t.call(this,n,o),c=a[0],l=0;ci(c,function(n){var t=n.children;t&&t.length?(n.x=Oi(t),n.y=Fi(t)):(n.x=u?l+=e(n,u):0,n.y=0,u=n)});var s=Hi(c),f=Ii(c),h=s.x-e(s,f)/2,p=f.x+e(f,s)/2;return ci(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=su.layout.hierarchy().sort(null).value(null),e=qi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},su.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,o=n.length;++i0;)s.push(u=h[c-1]),s.area+=u.area,"squarify"!==p||(a=r(s,d))<=g?(h.pop(),g=a):(s.area-=s.pop().area,i(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,g=1/0);s.length&&(i(s,d,l,!0),s.length=s.area=0),o.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var o,u=f(t),a=r.slice(),c=[];for(n(a,u.dx*u.dy/t.value),c.area=0;o=a.pop();)c.push(o),c.area+=o.area,null!=o.z&&(i(c,o.z?u.dx:u.dy,u,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,o=1/0,u=-1,a=n.length;++ui&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*o*g)):1/0}function i(n,t,e,r){var i,o=-1,u=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++oe.dx)&&(s=e.dx);++o1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=su.random.normal.apply(su,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=su.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;ef?0:1;if(l=Hu)return t(l,p)+(n?t(n,1-p):"")+"Z";var g,d,v,y,m,x,M,w,b,_,k,E,N=0,S=0,A=[];if((y=(+c.apply(this,arguments)||0)/2)&&(v=o===Tc?Math.sqrt(n*n+l*l):+o.apply(this,arguments),p||(S*=-1),l&&(S=rn(v/l*Math.sin(y))),n&&(N=rn(v/n*Math.sin(y)))),l){m=l*Math.cos(s+S),x=l*Math.sin(s+S),M=l*Math.cos(f-S),w=l*Math.sin(f-S);var C=Math.abs(f-s-2*S)<=Fu?0:1;if(S&&Mo(m,x,M,w)===p^C){var T=(s+f)/2;m=l*Math.cos(T),x=l*Math.sin(T),M=w=null}}else m=x=0;if(n){b=n*Math.cos(f-N),_=n*Math.sin(f-N),k=n*Math.cos(s+N),E=n*Math.sin(s+N);var z=Math.abs(s-f+2*N)<=Fu?0:1;if(N&&Mo(b,_,k,E)===1-p^z){var L=(s+f)/2;b=n*Math.cos(L),_=n*Math.sin(L),k=E=null}}else b=_=0;if(h>Uu&&(g=Math.min(Math.abs(l-n)/2,+i.apply(this,arguments)))>.001){d=nFu)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var o=we,u=be,a=Zo,c=yo,l=mo;return n.radius=function(t){return arguments.length?(a=Cn(t),n):a},n.source=function(t){return arguments.length?(o=Cn(t),n):o},n.target=function(t){return arguments.length?(u=Cn(t),n):u},n.startAngle=function(t){return arguments.length?(c=Cn(t),n):c},n.endAngle=function(t){return arguments.length?(l=Cn(t),n):l},n},su.svg.diagonal=function(){function n(n,i){var o=t.call(this,n,i),u=e.call(this,n,i),a=(o.y+u.y)/2,c=[o,{x:o.x,y:a},{x:u.x,y:a},u];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=we,e=be,r=Vo;return n.source=function(e){return arguments.length?(t=Cn(e),n):t},n.target=function(t){return arguments.length?(e=Cn(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},su.svg.diagonal.radial=function(){var n=su.svg.diagonal(),t=Vo,e=n.projection;return n.projection=function(n){return arguments.length?e($o(t=n)):t},n},su.svg.symbol=function(){function n(n,r){return(Rc.get(t.call(this,n,r))||Jo)(e.call(this,n,r))}var t=Wo,e=Xo;return n.type=function(e){return arguments.length?(t=Cn(e),n):t},n.size=function(t){return arguments.length?(e=Cn(t),n):e},n};var Rc=su.map({circle:Jo,cross:function(n){var t=Math.sqrt(n/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(n){var t=Math.sqrt(n/(2*Uc)),e=t*Uc;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});su.svg.symbolTypes=Rc.keys();var Pc=Math.sqrt(3),Uc=Math.tan(30*Yu);Cu.transition=function(n){for(var t,e,r=jc||++Ic,i=tu(n),o=[],u=Fc||{time:Date.now(),ease:Ar,delay:0,duration:250},a=-1,c=this.length;++arect,.s>rect").attr("width",f[1]-f[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function o(){function o(){32==su.event.keyCode&&(C||(x=null,z[0]-=f[1],z[1]-=h[1],C=2),N())}function d(){32==su.event.keyCode&&2==C&&(z[0]+=f[1],z[1]+=h[1],C=0,N())}function v(){var n=su.mouse(w),r=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(su.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),z[0]=f[+(n[0]0?o=setTimeout(i,t-s):(o=null,e||(l=n.apply(a,u),o||(a=u=null)))}var o,u,a,c,l;return null==t&&(t=100),function(){a=this,u=arguments,c=r();var s=e&&!o;return o||(o=setTimeout(i,t)),s&&(l=n.apply(a,u),a=u=null),l}}},{"date-now":2}],4:[function(n,t,e){(function(r){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(n){var t=this.useColors;if(n[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+n[0]+(t?"%c ":" ")+"+"+e.humanize(this.diff),t){var r="color: "+this.color;n.splice(1,0,r,"color: inherit");var i=0,o=0;n[0].replace(/%[a-zA-Z%]/g,function(n){"%%"!==n&&(i++,"%c"===n&&(o=i))}),n.splice(o,0,r)}}function u(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(n){try{null==n?e.storage.removeItem("debug"):e.storage.debug=n}catch(n){}}function c(){var n;try{n=e.storage.debug}catch(n){}return!n&&void 0!==r&&"env"in r&&(n=r.env.DEBUG),n}e=t.exports=n("./debug"),e.log=u,e.formatArgs=o,e.save=a,e.load=c,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(n){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(n){try{return JSON.stringify(n)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}},e.enable(c())}).call(this,n("_process"))},{"./debug":5,_process:8}],5:[function(n,t,e){function r(n){var t,r=0;for(t in n)r=(r<<5)-r+n.charCodeAt(t),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function i(n){function t(){if(t.enabled){var n=t,r=+new Date,i=r-(l||r);n.diff=i,n.prev=l,n.curr=r,l=r;for(var o=new Array(arguments.length),u=0;u1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(t){var e=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*f;case"days":case"day":case"d":return e*s;case"hours":case"hour":case"hrs":case"hr":case"h":return e*l;case"minutes":case"minute":case"mins":case"min":case"m":return e*c;case"seconds":case"second":case"secs":case"sec":case"s":return e*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function i(n){return n>=s?Math.round(n/s)+"d":n>=l?Math.round(n/l)+"h":n>=c?Math.round(n/c)+"m":n>=a?Math.round(n/a)+"s":n+"ms"}function o(n){return u(n,s,"day")||u(n,l,"hour")||u(n,c,"minute")||u(n,a,"second")||n+" ms"}function u(n,t,e){if(!(n0)return r(n);if("number"===e&&!1===isNaN(n))return t.long?o(n):i(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],7:[function(n,t,e){function r(n){if("number"!=typeof n||Number.isNaN(n))throw new TypeError("Expected a number, got "+typeof n);var t=n<0,e=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(n=-n),n<1)return(t?"-":"")+n+" B";var r=Math.min(Math.floor(Math.log(n)/Math.log(1e3)),e.length-1);n=Number(n/Math.pow(1e3,r));var i=e[r];return n>=10||n%1==0?(t?"-":"")+n.toFixed(0)+" "+i:(t?"-":"")+n.toFixed(1)+" "+i}t.exports=r},{}],8:[function(n,t,e){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(n){if(f===setTimeout)return setTimeout(n,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(n,0);try{return f(n,0)}catch(t){try{return f.call(null,n,0)}catch(t){return f.call(this,n,0)}}}function u(n){if(h===clearTimeout)return clearTimeout(n);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(n);try{return h(n)}catch(t){try{return h.call(null,n)}catch(t){return h.call(this,n)}}}function a(){v&&g&&(v=!1,g.length?d=g.concat(d):y=-1,d.length&&c())}function c(){if(!v){var n=o(a);v=!0;for(var t=d.length;t;){for(g=d,d=[];++y1)for(var e=1;e=c.links.maxBytes?c.links.maxBytes:n,{width:n*c.links.maxWidth/c.links.maxBytes,unit:e}}function s(){var e=window.innerWidth>=900?400:250,r=n.offsetWidth;return t&&(isNaN(t.width)||(r=t.width),"function"==typeof t.width&&(r=t.width()),isNan(t.height)||(e=t.height),"function"==typeof t.height&&(e=t.height()),"auto"===t.height&&(e=n.offsetHeight)),{width:r,height:e}}function f(){j=j.data(L.links),U=U.data(L.nodes,function(n){return n.id}),j.enter().insert("line",".node").attr("class","link").style("stroke",l.links.color).style("opacity",.5),j.exit().remove(),j.style("stroke-width",function(n){ -return n.rate?n.rate.width"+t,"at",a(e)),"number"!=typeof e||e<0)throw new Error("rate: 3th param must be a positive number");var i=v(n);if(!i)throw new Error("rate: invalid source id");var u=v(t);if(!u)throw new Error("rate: invalid target id");var c=x(i.index,u.index);if(-1===c)throw new Error("rate: connection does not exist");L.links[c].rate=r(e),o("rate:",L.links[c].rate),f()}"string"==typeof n&&(n=document.querySelector(n));var L={nodes:[],links:[]};if(t){if(t.height&&"function"!=typeof t.height&&"default"!==t.height&&"auto"!==t.height&&isNaN(t.height))throw"Height should be a Number or a Function";if(t.width&&"default"!==t.width&&"function"!=typeof t.width&&"auto"!==t.width&&isNaN(t.width))throw"Width should be a Number of a Function"}var q;L.links.forEach(function(n){var t=L.nodes[n.source],e=L.nodes[n.target];t.children=t.children||[],t.children.push(n.target),e.parents=e.parents||[],e.parents.push(n.source)});var D=s(),R=i.select(n).append("svg").attr("width",D.width).attr("height",D.height),P=i.layout.force().size([D.width,D.height]).nodes(L.nodes).links(L.links).on("tick",function(){j.attr("x1",function(n){return n.source.x}).attr("y1",function(n){return n.source.y}).attr("x2",function(n){return n.target.x}).attr("y2",function(n){return n.target.y}),U.attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y}),U.attr("transform",function(n){return"translate("+n.x+","+n.y+")"})}),U=R.selectAll(".node"),j=R.selectAll(".link");return f(),window.addEventListener("resize",u(h,500)),h(),{list:M,add:w,hasPeer:E,hasLink:N,remove:b,connect:_,disconnect:k,getLink:m,areConnected:S,unchoke:A,choke:C,seed:T,rate:z}}t.exports=r;var i=n("d3"),o=n("debug")("p2p-graph"),u=n("debounce"),a=n("prettier-bytes"),c={links:{width:.7,maxWidth:5,maxBytes:2097152}},l={links:{color:"#C8C8C8"},text:{subtitle:"#C8C8C8"},nodes:{method:function(n,t){return n.me?i.hsl(210,.7,.725):n.seeder?i.hsl(120,.7,.725):i.hsl(55,.7,.725)},hover:"#A9A9A9",dep:"#252929"}}},{d3:1,debounce:3,debug:4,"prettier-bytes":7}]},{},[9])(9)}); From 90e903e7b367fb24d398d17aad7545fb2d139638 Mon Sep 17 00:00:00 2001 From: Rares Golea Date: Wed, 5 Apr 2017 12:38:40 +0300 Subject: [PATCH 5/5] Change type validation --- index.js | 8 ++++---- p2p-graph.min.js | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 431615f..2fa5d67 100644 --- a/index.js +++ b/index.js @@ -39,8 +39,8 @@ function TorrentGraph (root, size) { } if (size) { - if (size.height && typeof size.height !== 'function' && size.height !== 'default' && size.height !== 'auto' && Number.isNaN(size.height)) throw new Error('Height should be a Number or a Function') - if (size.width && size.width !== 'default' && typeof size.width !== 'function' && size.width !== 'auto' && Number.isNaN(size.width)) throw new Error('Width should be a Number of a Function') + if (size.height && typeof size.height !== 'function' && size.height !== 'default' && size.height !== 'auto' && typeof size.height !== 'number') throw new Error('Height should be a Number or a Function') + if (size.width && size.width !== 'default' && typeof size.width !== 'function' && size.width !== 'auto' && typeof size.width !== 'number') throw new Error('Width should be a Number of a Function') } function scale () { @@ -66,9 +66,9 @@ function TorrentGraph (root, size) { var width = root.offsetWidth if (size) { - if (!Number.isNaN(size.width)) width = size.width + if (typeof size.width === 'number') width = size.width if (typeof size.width === 'function') width = size.width() - if (!Number.isNaN(size.height)) height = size.height + if (typeof size.height === 'number') height = size.height if (typeof size.height === 'function') height = size.height() if (size.height === 'auto') height = root.offsetHeight } diff --git a/p2p-graph.min.js b/p2p-graph.min.js index e69de29..91d31d1 100644 --- a/p2p-graph.min.js +++ b/p2p-graph.min.js @@ -0,0 +1,6 @@ +!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.P2PGraph=n()}}(function(){var n;return function n(t,e,r){function i(u,a){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var s=e[u]={exports:{}};t[u][0].call(s.exports,function(n){var e=t[u][1][n];return i(e||n)},s,s.exports,n,t,e,r)}return e[u].exports}for(var o="function"==typeof require&&require,u=0;ut?1:n>=t?0:NaN}function o(n){return null===n?NaN:+n}function u(n){return!isNaN(n)}function a(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function c(n){return n.length}function l(n){for(var t=1;n*t%1;)t*=10;return t}function s(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function f(){this._=Object.create(null)}function h(n){return(n+="")===wu||n[0]===bu?bu+n:n}function p(n){return(n+="")[0]===bu?n.slice(1):n}function g(n){return h(n)in this._}function d(n){return(n=h(n))in this._&&delete this._[n]}function v(){var n=[];for(var t in this._)n.push(p(t));return n}function y(){var n=0;for(var t in this._)++n;return n}function m(){for(var n in this._)return!1;return!0}function x(){this._=Object.create(null)}function M(n){return n}function w(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function b(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=_u.length;e=t&&(t=i+1);!(u=a[t])&&++t0&&(n=n.slice(0,a));var l=qu.get(n);return l&&(n=l,c=J),a?t?i:r:t?_:o}function W(n,t){return function(e){var r=su.event;su.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{su.event=r}}}function J(n,t){var e=W(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function G(n){var e=".dragsuppress-"+ ++Ru,i="click"+e,o=su.select(r(n)).on("touchmove"+e,S).on("dragstart"+e,S).on("selectstart"+e,S);if(null==Du&&(Du=!("onselectstart"in n)&&b(n.style,"userSelect")),Du){var u=t(n).style,a=u[Du];u[Du]="none"}return function(n){if(o.on(e,null),Du&&(u[Du]=a),n){var t=function(){o.on(i,null)};o.on(i,function(){S(),t()},!0),setTimeout(t,0)}}}function K(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();if(Pu<0){var o=r(n);if(o.scrollX||o.scrollY){e=su.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();Pu=!(u.f||u.e),e.remove()}}return Pu?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[t.clientX-a.left-n.clientLeft,t.clientY-a.top-n.clientTop]}function Q(){return su.event.changedTouches[0].identifier}function nn(n){return n>0?1:n<0?-1:0}function tn(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function en(n){return n>1?0:n<-1?Fu:Math.acos(n)}function rn(n){return n>1?Iu:n<-1?-Iu:Math.asin(n)}function on(n){return((n=Math.exp(n))-1/n)/2}function un(n){return((n=Math.exp(n))+1/n)/2}function an(n){return((n=Math.exp(2*n))-1)/(n+1)}function cn(n){return(n=Math.sin(n/2))*n}function ln(){}function sn(n,t,e){return this instanceof sn?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof sn?new sn(n.h,n.s,n.l):kn(""+n,En,sn):new sn(n,t,e)}function fn(n,t,e){function r(n){return n>360?n-=360:n<0&&(n+=360),n<60?o+(u-o)*n/60:n<180?u:n<240?o+(u-o)*(240-n)/60:o}function i(n){return Math.round(255*r(n))}var o,u;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:t<0?0:t>1?1:t,e=e<0?0:e>1?1:e,u=e<=.5?e*(1+t):e+t-e*t,o=2*e-u,new Mn(i(n+120),i(n),i(n-120))}function hn(n,t,e){return this instanceof hn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof hn?new hn(n.h,n.c,n.l):n instanceof gn?vn(n.l,n.a,n.b):vn((n=Sn((n=su.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new hn(n,t,e)}function pn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new gn(e,Math.cos(n*=Yu)*t,Math.sin(n)*t)}function gn(n,t,e){return this instanceof gn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof gn?new gn(n.l,n.a,n.b):n instanceof hn?pn(n.h,n.c,n.l):Sn((n=Mn(n)).r,n.g,n.b):new gn(n,t,e)}function dn(n,t,e){var r=(n+16)/116,i=r+t/500,o=r-e/200;return i=yn(i)*Ku,r=yn(r)*Qu,o=yn(o)*na,new Mn(xn(3.2404542*i-1.5371385*r-.4985314*o),xn(-.969266*i+1.8760108*r+.041556*o),xn(.0556434*i-.2040259*r+1.0572252*o))}function vn(n,t,e){return n>0?new hn(Math.atan2(e,t)*Bu,Math.sqrt(t*t+e*e),n):new hn(NaN,NaN,n)}function yn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function mn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function xn(n){return Math.round(255*(n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function Mn(n,t,e){return this instanceof Mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof Mn?new Mn(n.r,n.g,n.b):kn(""+n,Mn,fn):new Mn(n,t,e)}function wn(n){return new Mn(n>>16,n>>8&255,255&n)}function bn(n){return wn(n)+""}function _n(n){return n<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function kn(n,t,e){var r,i,o,u=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(An(i[0]),An(i[1]),An(i[2]))}return(o=ra.get(n))?t(o.r,o.g,o.b):(null==n||"#"!==n.charAt(0)||isNaN(o=parseInt(n.slice(1),16))||(4===n.length?(u=(3840&o)>>4,u|=u>>4,a=240&o,a|=a>>4,c=15&o,c|=c<<4):7===n.length&&(u=(16711680&o)>>16,a=(65280&o)>>8,c=255&o)),t(u,a,c))}function En(n,t,e){var r,i,o=Math.min(n/=255,t/=255,e/=255),u=Math.max(n,t,e),a=u-o,c=(u+o)/2;return a?(i=c<.5?a/(u+o):a/(2-u-o),r=n==u?(t-e)/a+(t0&&c<1?0:r),new sn(r,i,c)}function Sn(n,t,e){n=Nn(n),t=Nn(t),e=Nn(e);var r=mn((.4124564*n+.3575761*t+.1804375*e)/Ku),i=mn((.2126729*n+.7151522*t+.072175*e)/Qu);return gn(116*i-16,500*(r-i),200*(i-mn((.0193339*n+.119192*t+.9503041*e)/na)))}function Nn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function An(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Cn(n){return"function"==typeof n?n:function(){return n}}function Tn(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),zn(t,e,n,r)}}function zn(n,t,e,r){function i(){var n,t=c.status;if(!t&&qn(c)||t>=200&&t<300||304===t){try{n=e.call(o,c)}catch(n){return void u.error.call(o,n)}u.load.call(o,n)}else u.error.call(o,c)}var o={},u=su.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=su.event;su.event=n;try{u.progress.call(o,c)}finally{su.event=t}},o.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",o)},o.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",o):t},o.responseType=function(n){return arguments.length?(l=n,o):l},o.response=function(n){return e=n,o},["get","post"].forEach(function(n){o[n]=function(){return o.send.apply(o,[n].concat(hu(arguments)))}}),o.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&o.on("error",i).on("load",function(n){i(null,n)}),u.beforesend.call(o,c),c.send(null==r?null:r),o},o.abort=function(){return c.abort(),o},su.rebind(o,u,"on"),null==r?o:o.get(Ln(r))}function Ln(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function qn(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function Dn(n,t,e){var r=arguments.length;r<2&&(t=0),r<3&&(e=Date.now());var i=e+t,o={c:n,t:i,n:null};return oa?oa.n=o:ia=o,oa=o,ua||(aa=clearTimeout(aa),ua=1,ca(Rn)),o}function Rn(){var n=Pn(),t=Un()-n;t>24?(isFinite(t)&&(clearTimeout(aa),aa=setTimeout(Rn,t)),ua=0):(ua=1,ca(Rn))}function Pn(){for(var n=Date.now(),t=ia;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Un(){for(var n,t=ia,e=1/0;t;)t.c?(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function On(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,o=r&&e?function(n,t){for(var i=n.length,o=[],u=0,a=r[0],c=0;i>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>t));)a=r[u=(u+1)%r.length];return o.reverse().join(e)}:M;return function(n){var e=sa.exec(n),r=e[1]||" ",u=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],p=e[9],g=1,d="",v="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===u)&&(l=r="0",u="="),p){case"n":f=!0,p="g";break;case"%":g=100,v="%",p="f";break;case"p":g=100,v="%",p="r";break;case"b":case"o":case"x":case"X":"#"===c&&(d="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===c&&(d=i[0],v=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=fa.get(p)||Hn;var x=l&&f;return function(n){var e=v;if(y&&n%1)return"";var i=n<0||0===n&&1/n<0?(n=-n,"-"):"-"===a?"":a;if(g<0){var c=su.formatPrefix(n,h);n=c.scale(n),e=c.symbol+v}else n*=g;n=p(n,h);var M,w,b=n.lastIndexOf(".");if(b<0){var _=m?n.lastIndexOf("e"):-1;_<0?(M=n,w=""):(M=n.substring(0,_),w=n.substring(_))}else M=n.substring(0,b),w=t+n.substring(b+1);!l&&f&&(M=o(M,1/0));var k=d.length+M.length+w.length+(x?0:i.length),E=k"===u?E+i+n:"^"===u?E.substring(0,k>>=1)+i+n+E.substring(k):i+(x?n:E+n))+e}}}function Hn(n){return n+""}function In(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Yn(n,t,e){function r(t){var e=n(t),r=o(e,1);return t-e1)for(;u=l)return-1;if(37===(i=t.charCodeAt(a++))){if(u=t.charAt(a++),!(o=C[u in da?t.charAt(a++):u])||(r=o(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.slice(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){M.lastIndex=0;var r=M.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=N.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){k.lastIndex=0;var r=k.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function c(n,t,r){return e(n,A.x.toString(),t,r)}function l(n,t,r){return e(n,A.X.toString(),t,r)}function s(n,t,e){var r=x.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,p=n.time,g=n.periods,d=n.days,v=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{pa=In;var t=new pa;return t._=n,r(t)}finally{pa=Date}}var r=t(n);return e.parse=function(n){try{pa=In;var t=r.parse(n);return t&&t._}finally{pa=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ft;var x=su.map(),M=$n(d),w=Xn(d),b=$n(v),_=Xn(v),k=$n(y),E=Xn(y),S=$n(m),N=Xn(m);g.forEach(function(n,t){x.set(n.toLowerCase(),t)});var A={a:function(n){return v[n.getDay()]},A:function(n){return d[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(f),d:function(n,t){return Vn(n.getDate(),t,2)},e:function(n,t){return Vn(n.getDate(),t,2)},H:function(n,t){return Vn(n.getHours(),t,2)},I:function(n,t){return Vn(n.getHours()%12||12,t,2)},j:function(n,t){return Vn(1+ha.dayOfYear(n),t,3)},L:function(n,t){return Vn(n.getMilliseconds(),t,3)},m:function(n,t){return Vn(n.getMonth()+1,t,2)},M:function(n,t){return Vn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Vn(n.getSeconds(),t,2)},U:function(n,t){return Vn(ha.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Vn(ha.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Vn(n.getFullYear()%100,t,2)},Y:function(n,t){return Vn(n.getFullYear()%1e4,t,4)},Z:lt,"%":function(){return"%"}},C={a:r,A:i,b:o,B:u,c:a,d:rt,e:rt,H:ot,I:ot,j:it,L:ct,m:et,M:ut,p:s,S:at,U:Jn,w:Wn,W:Gn,x:c,X:l,y:Qn,Y:Kn,Z:nt,"%":st};return t}function Vn(n,t,e){var r=n<0?"-":"",i=(r?-n:n)+"",o=i.length;return r+(o68?1900:2e3)}function et(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function rt(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function it(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ot(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ut(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function at(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ct(n,t,e){va.lastIndex=0;var r=va.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function lt(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=Mu(t)/60|0,i=Mu(t)%60;return e+Vn(r,"0",2)+Vn(i,"0",2)}function st(n,t,e){ya.lastIndex=0;var r=ya.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ft(n){for(var t=n.length,e=-1;++e=0?1:-1,a=u*e,c=Math.cos(t),l=Math.sin(t),s=o*l,f=i*c+s*Math.cos(a),h=s*u*Math.sin(a);_a.add(Math.atan2(h,f)),r=n,i=c,o=l}var t,e,r,i,o;ka.point=function(u,a){ka.point=n,r=(t=u)*Yu,i=Math.cos(a=(e=a)*Yu/2+Fu/4),o=Math.sin(a)},ka.lineEnd=function(){n(t,e)}}function mt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function xt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function wt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function bt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function _t(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function kt(n){return[Math.atan2(n[1],n[0]),rn(n[2])]}function Et(n,t){return Mu(n[0]-t[0])=0;--a)i.point((f=s[a])[0],f[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,s=p.z,g=!g}while(!p.v);i.lineEnd()}}}function Dt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r0){for(w||(o.polygonStart(),w=!0),o.lineStart();++u1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Ut))}var p,g,d,v=t(o),y=i.invert(r[0],r[1]),m={point:u,lineStart:c,lineEnd:l,polygonStart:function(){m.point=s,m.lineStart=f,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=u,m.lineStart=c,m.lineEnd=l,p=su.merge(p);var n=Yt(y,g);p.length?(w||(o.polygonStart(),w=!0),qt(p,Ft,n,e,o)):n&&(w||(o.polygonStart(),w=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),p=g=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}},x=jt(),M=t(x),w=!1;return m}}function Ut(n){return n.length>1}function jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:_,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ft(n,t){return((n=n.x)[0]<0?n[1]-Iu-Uu:Iu-n[1])-((t=t.x)[0]<0?t[1]-Iu-Uu:Iu-t[1])}function Ot(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var a=o>0?Fu:-Fu,c=Mu(o-e);Mu(c-Fu)0?Iu:-Iu),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(o,r),t=0):i!==a&&c>=Fu&&(Mu(e-i)Uu?Math.atan((Math.sin(t)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*o*u)):(t+r)/2}function It(n,t,e,r){var i;if(null==n)i=e*Iu,r.point(-Fu,i),r.point(0,i),r.point(Fu,i),r.point(Fu,0),r.point(Fu,-i),r.point(0,-i),r.point(-Fu,-i),r.point(-Fu,0),r.point(-Fu,i);else if(Mu(n[0]-t[0])>Uu){var o=n[0]=0?1:-1,_=b*w,k=_>Fu,E=g*x;if(_a.add(Math.atan2(E*b*Math.sin(_),d*M+E*Math.cos(_))),o+=k?w+b*Ou:w,k^h>=e^y>=e){var S=Mt(mt(f),mt(n));_t(S);var N=Mt(i,S);_t(N);var A=(k^w>=0?-1:1)*rn(N[2]);(r>A||r===A&&(S[0]||S[1]))&&(u+=k^w>=0?1:-1)}if(!v++)break;h=y,g=x,d=M,f=n}}return(o<-Uu||oo}function e(n){var e,o,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var p,g=[f,h],d=t(f,h),v=u?d?0:i(f,h):d?i(f+(f<0?Fu:-Fu),h):0;if(!e&&(l=c=d)&&n.lineStart(),d!==c&&(p=r(e,g),(Et(e,p)||Et(g,p))&&(g[0]+=Uu,g[1]+=Uu,d=t(g[0],g[1]))),d!==c)s=0,d?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&u^d){var y;v&o||!(y=r(g,e,!0))||(s=0,u?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!d||e&&Et(e,g)||n.point(g[0],g[1]),e=g,c=d,o=v},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=mt(n),i=mt(t),u=[1,0,0],a=Mt(r,i),c=xt(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=o*c/s,h=-o*l/s,p=Mt(u,a),g=bt(u,f);wt(g,bt(a,h));var d=p,v=xt(g,d),y=xt(d,d),m=v*v-y*(xt(g,g)-1);if(!(m<0)){var x=Math.sqrt(m),M=bt(d,(-v-x)/y);if(wt(M,g),M=kt(M),!e)return M;var w,b=n[0],_=t[0],k=n[1],E=t[1];_0^M[1]<(Mu(M[0]-b)Fu^(b<=M[0]&&M[0]<=_)){var C=bt(d,(-v+x)/y);return wt(C,g),[M,kt(C)]}}}function i(t,e){var r=u?n:Fu-n,i=0;return t<-r?i|=1:t>r&&(i|=2),e<-r?i|=4:e>r&&(i|=8),i}var o=Math.cos(n),u=o>0,a=Mu(o)>Uu;return Pt(t,e,ye(n,6*Yu),u?[0,-n]:[-Fu,n-Fu])}function Zt(n,t,e,r){return function(i){var o,u=i.a,a=i.b,c=u.x,l=u.y,s=a.x,f=a.y,h=0,p=1,g=s-c,d=f-l;if(o=n-c,g||!(o>0)){if(o/=g,g<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=e-c,g||!(o<0)){if(o/=g,g<0){if(o>p)return;o>h&&(h=o)}else if(g>0){if(o0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-l,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0&&(i.a={x:c+h*g,y:l+h*d}),p<1&&(i.b={x:c+p*g,y:l+p*d}),i}}}}}}function Vt(n,t,e,r){function i(r,i){return Mu(r[0]-n)0?0:3:Mu(r[0]-e)0?2:1:Mu(r[1]-t)0?1:0:i>0?3:2}function o(n,t){return u(n.x,t.x)}function u(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=v.length,r=n[1],i=0;ir&&tn(l,o,n)>0&&++t:o[1]<=r&&tn(l,o,n)<0&&--t,l=o;return 0!==t}function l(o,a,c,l){var s=0,f=0;if(null==o||(s=i(o,c))!==(f=i(a,c))||u(o,a)<0^c>0)do{l.point(0===s||3===s?n:e,s>1?r:t)}while((s=(s+c+4)%4)!==f);else l.point(a[0],a[1])}function s(i,o){return n<=i&&i<=e&&t<=o&&o<=r}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=g,v&&v.push(y=[]),k=!0,_=!1,w=b=NaN}function p(){d&&(g(m,x),M&&_&&N.rejoin(),d.push(N.buffer())),C.point=f,_&&a.lineEnd()}function g(n,t){n=Math.max(-ja,Math.min(ja,n)),t=Math.max(-ja,Math.min(ja,t));var e=s(n,t);if(v&&y.push([n,t]),k)m=n,x=t,M=e,k=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&_)a.point(n,t);else{var r={a:{x:w,y:b},b:{x:n,y:t}};A(r)?(_||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),E=!1):e&&(a.lineStart(),a.point(n,t),E=!1)}w=n,b=t,_=e}var d,v,y,m,x,M,w,b,_,k,E,S=a,N=jt(),A=Zt(n,t,e,r),C={point:f,lineStart:h,lineEnd:p,polygonStart:function(){a=N,d=[],v=[],E=!0},polygonEnd:function(){a=S,d=su.merge(d);var t=c([n,r]),e=E&&t,i=d.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),i&&qt(d,o,t,l,a),a.polygonEnd()),d=v=y=null}};return C}}function $t(n){var t=0,e=Fu/3,r=le(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fu/180,e=n[1]*Fu/180):[t/Fu*180,e/Fu*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(o-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),u-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,o=1+r*(2*i-r),u=Math.sqrt(o)/i;return e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,rn((o-(n*n+e*e)*i*i)/(2*i))]},e}function Wt(){function n(n,t){Oa+=i*n-r*t,r=n,i=t}var t,e,r,i;Za.point=function(o,u){Za.point=n,t=r=o,e=i=u},Za.lineEnd=function(){n(t,e)}}function Jt(n,t){nYa&&(Ya=n),tBa&&(Ba=t)}function Gt(){function n(n,t){u.push("M",n,",",t,o)}function t(n,t){u.push("M",n,",",t),a.point=e}function e(n,t){u.push("L",n,",",t)}function r(){a.point=n}function i(){u.push("Z")}var o=Kt(4.5),u=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return o=Kt(n),a},result:function(){if(u.length){var n=u.join("");return u=[],n}}};return a}function Kt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Qt(n,t){Na+=n,Aa+=t,++Ca}function ne(){function n(n,r){var i=n-t,o=r-e,u=Math.sqrt(i*i+o*o);Ta+=u*(t+n)/2,za+=u*(e+r)/2,La+=u,Qt(t=n,e=r)}var t,e;$a.point=function(r,i){$a.point=n,Qt(t=r,e=i)}}function te(){$a.point=Qt}function ee(){function n(n,t){var e=n-r,o=t-i,u=Math.sqrt(e*e+o*o);Ta+=u*(r+n)/2,za+=u*(i+t)/2,La+=u,u=i*n-r*t,qa+=u*(r+n),Da+=u*(i+t),Ra+=3*u,Qt(r=n,i=t)}var t,e,r,i;$a.point=function(o,u){$a.point=n,Qt(t=r=o,e=i=u)},$a.lineEnd=function(){n(t,e)}} +function re(n){function t(t,e){n.moveTo(t+u,e),n.arc(t,e,u,0,Ou)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function o(){n.closePath()}var u=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return u=n,a},result:_};return a}function ie(n){function t(n){return(a?r:e)(n)}function e(t){return ae(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=NaN,k.point=o,t.lineStart()}function o(e,r){var o=mt([e,r]),u=n(e,r);i(x,M,m,w,b,_,x=u[0],M=u[1],m=e,w=o[0],b=o[1],_=o[2],a,t),t.point(x,M)}function u(){k.point=e,t.lineEnd()}function c(){r(),k.point=l,k.lineEnd=s}function l(n,t){o(f=n,h=t),p=x,g=M,d=w,v=b,y=_,k.point=o}function s(){i(x,M,m,w,b,_,p,g,f,d,v,y,a,t),k.lineEnd=u,u()}var f,h,p,g,d,v,y,m,x,M,w,b,_,k={point:e,lineStart:r,lineEnd:u,polygonStart:function(){t.polygonStart(),k.lineStart=c},polygonEnd:function(){t.polygonEnd(),k.lineStart=r}};return k}function i(t,e,r,a,c,l,s,f,h,p,g,d,v,y){var m=s-t,x=f-e,M=m*m+x*x;if(M>4*o&&v--){var w=a+p,b=c+g,_=l+d,k=Math.sqrt(w*w+b*b+_*_),E=Math.asin(_/=k),S=Mu(Mu(_)-1)o||Mu((m*T+x*z)/M-.5)>.3||a*p+c*g+l*d0&&16,t):Math.sqrt(o)},t}function oe(n){var t=ie(function(t,e){return n([t*Bu,e*Bu])});return function(n){return se(t(n))}}function ue(n){this.stream=n}function ae(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ce(n){return le(function(){return n})()}function le(n){function t(n){return n=a(n[0]*Yu,n[1]*Yu),[n[0]*h+c,l-n[1]*h]}function e(n){return(n=a.invert((n[0]-c)/h,(l-n[1])/h))&&[n[0]*Bu,n[1]*Bu]}function r(){a=zt(u=pe(y,m,x),o);var n=o(d,v);return c=p-n[0]*h,l=g+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var o,u,a,c,l,s,f=ie(function(n,t){return n=o(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,p=480,g=250,d=0,v=0,y=0,m=0,x=0,w=Ua,b=M,_=null,k=null;return t.stream=function(n){return s&&(s.valid=!1),s=se(w(u,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(w=null==n?(_=n,Ua):Bt((_=+n)*Yu),i()):_},t.clipExtent=function(n){return arguments.length?(k=n,b=n?Vt(n[0][0],n[0][1],n[1][0],n[1][1]):M,i()):k},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(d=n[0]%360*Yu,v=n[1]%360*Yu,r()):[d*Bu,v*Bu]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yu,m=n[1]%360*Yu,x=n.length>2?n[2]%360*Yu:0,r()):[y*Bu,m*Bu,x*Bu]},su.rebind(t,f,"precision"),function(){return o=n.apply(this,arguments),t.invert=o.invert&&e,r()}}function se(n){return ae(n,function(t,e){n.point(t*Yu,e*Yu)})}function fe(n,t){return[n,t]}function he(n,t){return[n>Fu?n-Ou:n<-Fu?n+Ou:n,t]}function pe(n,t,e){return n?t||e?zt(de(n),ve(t,e)):de(n):t||e?ve(t,e):he}function ge(n){return function(t,e){return t+=n,[t>Fu?t-Ou:t<-Fu?t+Ou:t,e]}}function de(n){var t=ge(n);return t.invert=ge(-n),t}function ve(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*i;return[Math.atan2(c*o-s*u,a*r-l*i),rn(s*o+c*u)]}var r=Math.cos(n),i=Math.sin(n),o=Math.cos(t),u=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*o-c*u;return[Math.atan2(c*o+l*u,a*r+s*i),rn(s*r-a*i)]},e}function ye(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,o,u,a){var c=u*t;null!=i?(i=me(e,i),o=me(e,o),(u>0?io)&&(i+=u*Ou)):(i=n+u*Ou,o=n-.5*c);for(var l,s=i;u>0?s>o:s0?t<-Iu+Uu&&(t=-Iu+Uu):t>Iu-Uu&&(t=Iu-Uu);var e=u/Math.pow(i(t),o);return[e*Math.sin(o*n),u-e*Math.cos(o*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fu/4+n/2)},o=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),u=r*Math.pow(i(n),o)/o;return o?(e.invert=function(n,t){var e=u-t,r=nn(o)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/o,2*Math.atan(Math.pow(u/r,1/o))-Iu]},e):Ae}function Ne(n,t){function e(n,t){var e=o-t;return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),o=r/i+n;return Mu(i)1&&tn(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function De(n,t){return n[0]-t[0]||n[1]-t[1]}function Re(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Pe(n,t,e,r){var i=n[0],o=e[0],u=t[0]-i,a=r[0]-o,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-o))/(f*u-a*s);return[i+h*u,c+h*s]}function Ue(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function je(){or(this),this.edge=this.site=this.circle=null}function Fe(n){var t=ac.pop()||new je;return t.site=n,t}function Oe(n){Je(n),ic.remove(n),ac.push(n),or(n)}function He(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},o=n.P,u=n.N,a=[n];Oe(n);for(var c=o;c.circle&&Mu(e-c.circle.x)Uu)a=a.L;else{if(!((i=o-Be(a,u))>Uu)){r>-Uu?(t=a.P,e=a):i>-Uu?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Fe(n);if(ic.insert(t,c),t||e){if(t===e)return Je(t),e=Fe(t.site),ic.insert(c,e),c.edge=e.edge=nr(t.site,c.site),We(t),void We(e);if(!e)return void(c.edge=nr(t.site,c.site));Je(t),Je(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,p=n.y-f,g=e.site,d=g.x-s,v=g.y-f,y=2*(h*v-p*d),m=h*h+p*p,x=d*d+v*v,M={x:(v*m-p*x)/y+s,y:(h*x-d*m)/y+f};er(e.edge,l,g,M),c.edge=nr(l,n,null,M),e.edge=nr(n,g,null,M),We(t),We(e)}}function Ye(n,t){var e=n.site,r=e.x,i=e.y,o=i-t;if(!o)return r;var u=n.P;if(!u)return-1/0;e=u.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/o-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+i-o/2)))/f+r:(r+a)/2}function Be(n,t){var e=n.N;if(e)return Ye(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ze(n){this.site=n,this.edges=[]}function Ve(n){for(var t,e,r,i,o,u,a,c,l,s,f=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],d=rc,v=d.length;v--;)if((o=d[v])&&o.prepare())for(a=o.edges,c=a.length,u=0;uUu||Mu(i-e)>Uu)&&(a.splice(u,0,new rr(tr(o.site,s,Mu(r-f)Uu?{x:f,y:Mu(t-f)Uu?{x:Mu(e-g)Uu?{x:h,y:Mu(t-h)Uu?{x:Mu(e-p)=-ju)){var p=c*c+l*l,g=s*s+f*f,d=(f*p-l*g)/h,v=(c*g-s*p)/h,f=v+a,y=cc.pop()||new Xe;y.arc=n,y.site=i,y.x=d+u,y.y=f+Math.sqrt(d*d+v*v),y.cy=f,n.circle=y;for(var m=null,x=uc._;x;)if(y.y=a)return;if(h>g){if(o){if(o.y>=l)return}else o={x:v,y:c};e={x:v,y:l}}else{if(o){if(o.y1)if(h>g){if(o){if(o.y>=l)return}else o={x:(c-i)/r,y:c};e={x:(l-i)/r,y:l}}else{if(o){if(o.y=a)return}else o={x:u,y:r*u+i};e={x:a,y:r*a+i}}else{if(o){if(o.xo||f>u||h=M,_=e>=w,k=_<<1|b,E=k+4;ko&&(i=t.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:xr(e,r)})),o=fc.lastIndex;return o=0&&!(e=su.interpolators[r](n,t)););return e}function br(n,t){var e,r=[],i=[],o=n.length,u=t.length,a=Math.min(n.length,t.length);for(e=0;e=1?1:n(t)}}function kr(n){return function(t){return 1-n(1-t)}}function Er(n){return function(t){return.5*(t<.5?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function Nr(n){return n*n*n}function Ar(n){if(n<=0)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}function Cr(n){return function(t){return Math.pow(t,n)}}function Tr(n){return 1-Math.cos(n*Iu)}function zr(n){return Math.pow(2,10*(n-1))}function Lr(n){return 1-Math.sqrt(1-n*n)}function qr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ou*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ou/t)}}function Dr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Rr(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Pr(n,t){n=su.hcl(n),t=su.hcl(t);var e=n.h,r=n.c,i=n.l,o=t.h-e,u=t.c-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.c:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return pn(e+o*n,r+u*n,i+a*n)+""}}function Ur(n,t){n=su.hsl(n),t=su.hsl(t);var e=n.h,r=n.s,i=n.l,o=t.h-e,u=t.s-r,a=t.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?t.s:r),isNaN(o)?(o=0,e=isNaN(e)?t.h:e):o>180?o-=360:o<-180&&(o+=360),function(n){return fn(e+o*n,r+u*n,i+a*n)+""}}function jr(n,t){n=su.lab(n),t=su.lab(t);var e=n.l,r=n.a,i=n.b,o=t.l-e,u=t.a-r,a=t.b-i;return function(n){return dn(e+o*n,r+u*n,i+a*n)+""}}function Fr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Or(n){var t=[n.a,n.b],e=[n.c,n.d],r=Ir(t),i=Hr(t,e),o=Ir(Yr(e,t,-i))||0;t[0]*e[1]180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Br(e)+"rotate(",null,")")-2,x:xr(n,t)})):t&&e.push(Br(e)+"rotate("+t+")")}function $r(n,t,e,r){n!==t?r.push({i:e.push(Br(e)+"skewX(",null,")")-2,x:xr(n,t)}):t&&e.push(Br(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Br(e)+"scale(",null,",",null,")");r.push({i:i-4,x:xr(n[0],t[0])},{i:i-2,x:xr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Br(e)+"scale("+t+")")}function Wr(n,t){var e=[],r=[];return n=su.transform(n),t=su.transform(t),Zr(n.translate,t.translate,e,r),Vr(n.rotate,t.rotate,e,r),$r(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,o=r.length;++i=0;)e.push(i[r])}function ci(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(o=n.children)&&(i=o.length))for(var i,o,u=-1;++ui&&(r=e,i=t);return r}function xi(n){return n.reduce(Mi,0)}function Mi(n,t){return n+t[1]}function wi(n,t){return bi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function bi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,o=[];++e<=t;)o[e]=i*e+r;return o}function _i(n){return[su.min(n),su.max(n)]}function ki(n,t){return n.value-t.value}function Ei(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Si(n,t){n._pack_next=t,t._pack_prev=n}function Ni(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ai(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(l=e.length)){var e,r,i,o,u,a,c,l,s=1/0,f=-1/0,h=1/0,p=-1/0;if(e.forEach(Ci),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(o=e[2],Li(r,i,o),t(o),Ei(r,o),r._pack_prev=o,Ei(o,i),i=r._pack_next,u=3;u=0;)t=i[o],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function ji(n,t,e){return n.a.parent===t.parent?n.a:e}function Fi(n){return 1+su.max(n,function(n){return n.y})}function Oi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Hi(n){var t=n.children;return t&&t.length?Hi(t[0]):n}function Ii(n){var t,e=n.children;return e&&(t=e.length)?Ii(e[t-1]):n}function Yi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Bi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],o=n.dy-t[0]-t[2];return i<0&&(e+=i/2,i=0),o<0&&(r+=o/2,o=0),{x:e,y:r,dx:i,dy:o}}function Zi(n){var t=n[0],e=n[n.length-1];return t2?Ji:$i,c=r?Gr:Jr;return u=i(n,t,c,e),a=i(t,n,c,wr),o}function o(n){return u(n)}var u,a;return o.invert=function(n){return a(n)},o.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},o.range=function(n){return arguments.length?(t=n,i()):t},o.rangeRound=function(n){return o.range(n).interpolate(Fr)},o.clamp=function(n){return arguments.length?(r=n,i()):r},o.interpolate=function(n){return arguments.length?(e=n,i()):e},o.ticks=function(t){return to(n,t)},o.tickFormat=function(t,e){return eo(n,t,e)},o.nice=function(t){return Qi(n,t),i()},o.copy=function(){return Gi(n,t,e,r)},i()}function Ki(n,t){return su.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Qi(n,t){return Xi(n,Wi(no(n,t)[2])),Xi(n,Wi(no(n,t)[2])),n}function no(n,t){null==t&&(t=10);var e=Zi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),o=t/r*i;return o<=.15?i*=10:o<=.35?i*=5:o<=.75&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function to(n,t){return su.range.apply(su,no(n,t))}function eo(n,t,e){var r=no(n,t);if(e){var i=sa.exec(e);if(i.shift(),"s"===i[8]){var o=su.formatPrefix(Math.max(Mu(r[0]),Mu(r[1])));return i[7]||(i[7]="."+ro(o.scale(r[2]))),i[8]="f",e=su.format(i.join("")),function(n){return e(o.scale(n))+o.symbol}}i[7]||(i[7]="."+io(i[8],r)),e=i.join("")}else e=",."+ro(r[2])+"f";return su.format(e)}function ro(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function io(n,t){var e=ro(t[2]);return n in _c?Math.abs(e-ro(Math.max(Mu(t[0]),Mu(t[1]))))+ +("e"!==n):e-2*("%"===n)}function oo(n,t,e,r){function i(n){return(e?Math.log(n<0?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function o(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function u(t){return n(i(t))}return u.invert=function(t){return o(n.invert(t))},u.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),u):r},u.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),u):t},u.nice=function(){var t=Xi(r.map(i),e?Math:Ec);return n.domain(t),r=t.map(o),u},u.ticks=function(){var n=Zi(r),u=[],a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;l0;h--)u.push(o(l)*h);for(l=0;u[l]c;s--);u=u.slice(l,s)}return u},u.tickFormat=function(n,e){if(!arguments.length)return kc;arguments.length<2?e=kc:"function"!=typeof e&&(e=su.format(e));var r=Math.max(1,t*n/u.ticks().length);return function(n){var u=n/o(Math.round(i(n)));return u*t0?a[e-1]:n[0],e0?0:1}function wo(n,t,e,r,i){var o=n[0]-t[0],u=n[1]-t[1],a=(i?r:-r)/Math.sqrt(o*o+u*u),c=a*u,l=-a*o,s=n[0]+c,f=n[1]+l,h=t[0]+c,p=t[1]+l,g=(s+h)/2,d=(f+p)/2,v=h-s,y=p-f,m=v*v+y*y,x=e-r,M=s*p-h*f,w=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*m-M*M)),b=(M*y-v*w)/m,_=(-M*v-y*w)/m,k=(M*y+v*w)/m,E=(-M*v+y*w)/m,S=b-g,N=_-d,A=k-g,C=E-d;return S*S+N*N>A*A+C*C&&(b=k,_=E),[[b-c,_-l],[b*e/x,_*e/x]]}function bo(n){function t(t){function u(){l.push("M",o(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,p=Cn(e),g=Cn(r);++f1?n.join("L"):n+"Z"}function ko(n){return n.join("L")+"Z"}function Eo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1&&i.push("H",r[0]),i.join("")}function So(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t1){a=t[1],o=n[c],c++,r+="C"+(i[0]+u[0])+","+(i[1]+u[1])+","+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1];for(var l=2;l9&&(i=3*t/Math.sqrt(i),u[a]=i*e,u[a+1]=i*r));for(a=-1;++a<=c;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+u[a]*u[a])),o.push([i||0,u[a]*i||0]);return o}function Io(n){return n.length<3?_o(n):n[0]+zo(n,Ho(n))}function Yo(n){for(var t,e,r,i=-1,o=n.length;++i0;)p[--a].call(n,u);if(o>=1)return d.event&&d.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1}var c,l,s,h,p,g=n[e]||(n[e]={active:0,count:0}),d=g[r];d||(c=i.time,l=Dn(o,0,c),d=g[r]={tween:new f,time:c,timer:l,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function ru(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function iu(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function ou(n){return n.toISOString()}function uu(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,o=su.bisect(Jc,i);return o==Jc.length?[t.year,no(n.map(function(n){return n/31536e6}),e)[2]]:o?t[i/Jc[o-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=au(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=au(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Zi(r.domain()),o=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return o&&(n=o[0],t=o[1]),n.range(e[0],au(+e[1]+1),t<1?1:t)},r.tickFormat=function(){return e},r.copy=function(){return uu(n.copy(),t,e)},Ki(r,n)}function au(n){return new Date(n)}function cu(n){return JSON.parse(n.responseText)}function lu(n){var t=pu.createRange();return t.selectNode(pu.body),t.createContextualFragment(n.responseText)}var su={version:"3.5.17"},fu=[].slice,hu=function(n){return fu.call(n)},pu=this.document;if(pu)try{hu(pu.documentElement.childNodes)[0].nodeType}catch(n){hu=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),pu)try{pu.createElement("DIV").style.setProperty("opacity",0,"")}catch(n){var gu=this.Element.prototype,du=gu.setAttribute,vu=gu.setAttributeNS,yu=this.CSSStyleDeclaration.prototype,mu=yu.setProperty;gu.setAttribute=function(n,t){du.call(this,n,t+"")},gu.setAttributeNS=function(n,t,e){vu.call(this,n,t,e+"")},yu.setProperty=function(n,t,e){mu.call(this,n,t+"",e)}}su.ascending=i,su.descending=function(n,t){return tn?1:t>=n?0:NaN},su.min=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ir&&(e=r)}else{for(;++i=r){e=r;break}for(;++ir&&(e=r)}return e},su.max=function(n,t){var e,r,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=r;break}for(;++ie&&(e=r)}else{for(;++i=r){e=r;break}for(;++ie&&(e=r)}return e},su.extent=function(n,t){var e,r,i,o=-1,u=n.length;if(1===arguments.length){for(;++o=r){e=i=r;break}for(;++or&&(e=r),i=r){e=i=r;break}for(;++or&&(e=r),i1)return c/(s-1)},su.deviation=function(){var n=su.variance.apply(this,arguments);return n?Math.sqrt(n):n};var xu=a(i);su.bisectLeft=xu.left,su.bisect=su.bisectRight=xu.right,su.bisector=function(n){return a(1===n.length?function(t,e){return i(n(t),e)}:n)},su.shuffle=function(n,t,e){(o=arguments.length)<3&&(e=n.length,o<2&&(t=0));for(var r,i,o=e-t;o;)i=Math.random()*o--|0,r=n[o+t],n[o+t]=n[i+t],n[i+t]=r;return n},su.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},su.pairs=function(n){for(var t=0,e=n.length-1,r=n[0],i=new Array(e<0?0:e);t=0;)for(r=n[i],t=r.length;--t>=0;)e[--u]=r[t];return e};var Mu=Math.abs;su.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e==1/0)throw new Error("infinite range");var r,i=[],o=l(Mu(e)),u=-1;if(n*=o,t*=o,e*=o,e<0)for(;(r=n+e*++u)>t;)i.push(r/o);else for(;(r=n+e*++u)=o.length)return r?r.call(i,u):e?u.sort(e):u;for(var c,l,s,h,p=-1,g=u.length,d=o[a++],v=new f;++p=o.length)return n;var r=[],i=u[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},o=[],u=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(su.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return u[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},su.set=function(n){var t=new x;if(n)for(var e=0,r=n.length;e=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},su.event=null,su.requote=function(n){return n.replace(ku,"\\$&")};var ku=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Eu={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Su=function(n,t){return t.querySelector(n)},Nu=function(n,t){return t.querySelectorAll(n)},Au=function(n,t){var e=n.matches||n[b(n,"matchesSelector")];return(Au=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Su=function(n,t){return Sizzle(n,t)[0]||null},Nu=Sizzle,Au=Sizzle.matchesSelector),su.selection=function(){return su.select(pu.documentElement)};var Cu=su.selection.prototype=[];Cu.select=function(n){var t,e,r,i,o=[];n=T(n);for(var u=-1,a=this.length;++u=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),zu.hasOwnProperty(e)?{space:zu[e],local:n}:n}},Cu.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=su.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},Cu.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=R(n)).length,i=-1;if(t=e.classList){for(;++i=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Cu.sort=function(n){n=B.apply(this,arguments);for(var t=-1,e=this.length;++t0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){w&&w.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),_&&_.domain(b.range().map(function(n){return(n-k.y)/k.k}).map(b.invert))}function c(n){T++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--T||(n({type:"zoomend"}),v=null)}function f(){function n(){a=1,o(su.mouse(i),h),l(u)}function e(){f.on(L,null).on(q,null),p(a),s(u)}var i=this,u=R.of(i,arguments),a=0,f=su.select(r(i)).on(L,n).on(q,e),h=t(su.mouse(i)),p=G(i);Oc.call(i),c(u)}function h(){function n(){var n=su.touches(g);return p=k.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=su.event.target;su.select(t).on(M,r).on(w,a),b.push(t);for(var e=su.event.changedTouches,i=0,o=e.length;i1){var s=c[0],f=c[1],h=s[0]-f[0],p=s[1]-f[1];y=h*h+p*p}}function r(){var n,t,e,r,u=su.touches(g);Oc.call(g);for(var a=0,c=u.length;a=l)return u;if(i)return i=!1,o;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fa=su.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=su.round(n,jn(n,t))).toFixed(Math.max(0,Math.min(20,jn(n*(1+1e-15),t))))}}),ha=su.time={},pa=Date;In.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ga.setUTCDate.apply(this._,arguments)},setDay:function(){ga.setUTCDay.apply(this._,arguments)},setFullYear:function(){ga.setUTCFullYear.apply(this._,arguments)},setHours:function(){ga.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ga.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ga.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ga.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ga.setUTCSeconds.apply(this._,arguments)},setTime:function(){ga.setTime.apply(this._,arguments)}};var ga=Date.prototype;ha.year=Yn(function(n){return n=ha.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ha.years=ha.year.range,ha.years.utc=ha.year.utc.range,ha.day=Yn(function(n){var t=new pa(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ha.days=ha.day.range,ha.days.utc=ha.day.utc.range,ha.dayOfYear=function(n){var t=ha.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){ +t=7-t;var e=ha[n]=Yn(function(n){return(n=ha.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ha[n+"s"]=e.range,ha[n+"s"].utc=e.utc.range,ha[n+"OfYear"]=function(n){var e=ha.year(n).getDay();return Math.floor((ha.dayOfYear(n)+(e+t)%7)/7)}}),ha.week=ha.sunday,ha.weeks=ha.sunday.range,ha.weeks.utc=ha.sunday.utc.range,ha.weekOfYear=ha.sundayOfYear;var da={"-":"",_:" ",0:"0"},va=/^\s*\d+/,ya=/^%/;su.locale=function(n){return{numberFormat:On(n),timeFormat:Zn(n)}};var ma=su.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});su.format=ma.numberFormat,su.geo={},ht.prototype={s:0,t:0,add:function(n){pt(n,this.t,xa),pt(xa.s,this.s,this),this.s?this.t+=xa.t:this.s=xa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xa=new ht;su.geo.stream=function(n,t){n&&Ma.hasOwnProperty(n.type)?Ma[n.type](n,t):gt(n,t)};var Ma={Feature:function(n,t){gt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++rp&&(p=t)}function t(t,e){var r=mt([t*Yu,e*Yu]);if(y){var i=Mt(y,r),o=[i[1],-i[0],0],u=Mt(o,i);_t(u),u=kt(u);var c=t-g,l=c>0?1:-1,d=u[0]*Bu*l,v=Mu(c)>180;if(v^(l*gp&&(p=m)}else if(d=(d+360)%360-180,v^(l*gp&&(p=e);v?ta(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(th&&(h=t)):t>g?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);y=r,g=t}function e(){w.point=t}function r(){M[0]=s,M[1]=h,w.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=Mu(r)>180?r+(r>0?360:-360):r}else d=n,v=e;ka.point(n,e),t(n,e)}function o(){ka.lineStart()}function u(){i(d,v),ka.lineEnd(),Mu(m)>Uu&&(s=-(h=180)),M[0]=s,M[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nUu?p=90:m<-Uu&&(f=-90),M[0]=s,M[1]=h}};return function(n){p=h=-(s=f=1/0),x=[],su.geo.stream(n,w);var t=x.length;if(t){x.sort(c);for(var e,r=1,i=x[0],o=[i];ra(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(var u,e,g=-1/0,t=o.length-1,r=0,i=o[t];r<=t;i=e,++r)e=o[r],(u=a(i[1],e[0]))>g&&(g=u,s=e[0],h=i[1])}return x=M=null,s===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[s,f],[h,p]]}}(),su.geo.centroid=function(n){Ea=Sa=Na=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,Pa);var t=qa,e=Da,r=Ra,i=t*t+e*e+r*r;return i=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?a:o).invert(n)},n.stream=function(n){var t=o.stream(n),e=u.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(o.precision(t),u.precision(t),a.precision(t),n):o.precision()},n.scale=function(t){return arguments.length?(o.scale(t),u.scale(.35*t),a.scale(t),n.translate(o.translate())):o.scale()},n.translate=function(t){if(!arguments.length)return o.translate();var l=o.scale(),s=+t[0],f=+t[1];return e=o.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=u.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Uu,f+.12*l+Uu],[s-.214*l-Uu,f+.234*l-Uu]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Uu,f+.166*l+Uu],[s-.115*l-Uu,f+.234*l-Uu]]).stream(c).point,n},n.scale(1070)};var Fa,Oa,Ha,Ia,Ya,Ba,Za={point:_,lineStart:_,lineEnd:_,polygonStart:function(){Oa=0,Za.lineStart=Wt},polygonEnd:function(){Za.lineStart=Za.lineEnd=Za.point=_,Fa+=Mu(Oa/2)}},Va={point:Jt,lineStart:_,lineEnd:_,polygonStart:_,polygonEnd:_},$a={point:Qt,lineStart:ne,lineEnd:te,polygonStart:function(){$a.lineStart=ee},polygonEnd:function(){$a.point=Qt,$a.lineStart=ne,$a.lineEnd=te}};su.geo.path=function(){function n(n){return n&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),u&&u.valid||(u=i(o)),su.geo.stream(n,u)),o.result()}function t(){return u=null,n}var e,r,i,o,u,a=4.5;return n.area=function(n){return Fa=0,su.geo.stream(n,i(Za)),Fa},n.centroid=function(n){return Na=Aa=Ca=Ta=za=La=qa=Da=Ra=0,su.geo.stream(n,i($a)),Ra?[qa/Ra,Da/Ra]:La?[Ta/La,za/La]:Ca?[Na/Ca,Aa/Ca]:[NaN,NaN]},n.bounds=function(n){return Ya=Ba=-(Ha=Ia=1/0),su.geo.stream(n,i(Va)),[[Ha,Ia],[Ya,Ba]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||oe(n):M,t()):e},n.context=function(n){return arguments.length?(o=null==(r=n)?new Gt:new re(n),"function"!=typeof a&&o.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(o.pointRadius(+t),+t),n):a},n.projection(su.geo.albersUsa()).context(null)},su.geo.transform=function(n){return{stream:function(t){var e=new ue(t);for(var r in n)e[r]=n[r];return e}}},ue.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},su.geo.projection=ce,su.geo.projectionMutator=le,(su.geo.equirectangular=function(){return ce(fe)}).raw=fe.invert=fe,su.geo.rotation=function(n){function t(t){return t=n(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t}return n=pe(n[0]%360*Yu,n[1]*Yu,n.length>2?n[2]*Yu:0),t.invert=function(t){return t=n.invert(t[0]*Yu,t[1]*Yu),t[0]*=Bu,t[1]*=Bu,t},t},he.invert=fe,su.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=pe(-n[0]*Yu,-n[1]*Yu,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Bu,n[1]*=Bu}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ye((t=+r)*Yu,i*Yu),n):t},n.precision=function(r){return arguments.length?(e=ye(t*Yu,(i=+r)*Yu),n):i},n.angle(90)},su.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yu,i=n[1]*Yu,o=t[1]*Yu,u=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*u)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},su.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return su.range(Math.ceil(o/v)*v,i,v).map(h).concat(su.range(Math.ceil(l/y)*y,c,y).map(p)).concat(su.range(Math.ceil(r/g)*g,e,g).filter(function(n){return Mu(n%v)>Uu}).map(s)).concat(su.range(Math.ceil(a/d)*d,u,d).filter(function(n){return Mu(n%y)>Uu}).map(f))}var e,r,i,o,u,a,c,l,s,f,h,p,g=10,d=g,v=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(p(c).slice(1),h(i).reverse().slice(1),p(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(o=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],o>i&&(t=o,o=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(m)):[[o,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),a>u&&(t=a,a=u,u=t),n.precision(m)):[[r,a],[e,u]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(v=+t[0],y=+t[1],n):[v,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],d=+t[1],n):[g,d]},n.precision=function(t){return arguments.length?(m=+t,s=xe(a,u,90),f=Me(r,e,m),h=xe(l,c,90),p=Me(o,i,m),n):m},n.majorExtent([[-180,-90+Uu],[180,90-Uu]]).minorExtent([[-180,-80-Uu],[180,80+Uu]])},su.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=we,i=be;return n.distance=function(){return su.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},su.geo.interpolate=function(n,t){return _e(n[0]*Yu,n[1]*Yu,t[0]*Yu,t[1]*Yu)},su.geo.length=function(n){return Xa=0,su.geo.stream(n,Wa),Xa};var Xa,Wa={sphere:_,point:_,lineStart:ke,lineEnd:_,polygonStart:_,polygonEnd:_},Ja=Ee(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(su.geo.azimuthalEqualArea=function(){return ce(Ja)}).raw=Ja;var Ga=Ee(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},M);(su.geo.azimuthalEquidistant=function(){return ce(Ga)}).raw=Ga,(su.geo.conicConformal=function(){return $t(Se)}).raw=Se,(su.geo.conicEquidistant=function(){return $t(Ne)}).raw=Ne;var Ka=Ee(function(n){return 1/n},Math.atan);(su.geo.gnomonic=function(){return ce(Ka)}).raw=Ka,Ae.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Iu]},(su.geo.mercator=function(){return Ce(Ae)}).raw=Ae;var Qa=Ee(function(){return 1},Math.asin);(su.geo.orthographic=function(){return ce(Qa)}).raw=Qa;var nc=Ee(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(su.geo.stereographic=function(){return ce(nc)}).raw=nc,Te.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Iu]},(su.geo.transverseMercator=function(){var n=Ce(Te),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Te,su.geom={},su.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=Cn(e),o=Cn(r),u=n.length,a=[],c=[];for(t=0;t=0;--t)p.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=o&&l.y>=i&&l.y<=u?[[r,u],[o,u],[o,i],[r,i]]:[]).point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(o(n,t)/Uu)*Uu,y:Math.round(u(n,t)/Uu)*Uu,i:t}})}var r=ze,i=Le,o=r,u=i,a=lc;return n?t(n):(t.links=function(n){return lr(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return lr(e(n)).cells.forEach(function(e,r){for(var i,o=e.site,u=e.edges.sort($e),a=-1,c=u.length,l=u[c-1].edge,s=l.l===o?l.r:l.l;++a=l,h=r>=s,p=h<<1|f;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=gr()),f?i=l:a=l,h?u=s:c=s,o(n,t,e,r,i,u,a,c)}var s,f,h,p,g,d,v,y,m,x=Cn(a),M=Cn(c);if(null!=t)d=t,v=e,y=r,m=i;else if(y=m=-(d=v=1/0),f=[],h=[],g=n.length,u)for(p=0;py&&(y=s.x),s.y>m&&(m=s.y),f.push(s.x),h.push(s.y);else for(p=0;py&&(y=w),b>m&&(m=b),f.push(w),h.push(b)}var _=y-d,k=m-v;_>k?m=v+_:y=d+k;var E=gr();if(E.add=function(n){o(E,n,+x(n,++p),+M(n,p),d,v,y,m)},E.visit=function(n){dr(n,E,d,v,y,m)},E.find=function(n){return vr(E,n[0],n[1],d,v,y,m)},p=-1,null==t){for(;++p=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=pc.get(e)||hc,r=gc.get(r)||M,_r(r(e.apply(null,fu.call(arguments,1))))},su.interpolateHcl=Pr,su.interpolateHsl=Ur,su.interpolateLab=jr,su.interpolateRound=Fr,su.transform=function(n){var t=pu.createElementNS(su.ns.prefix.svg,"g");return(su.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Or(e?e.matrix:dc)})(n)},Or.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var dc={a:1,b:0,c:0,d:1,e:0,f:0};su.interpolateTransform=Wr,su.layout={},su.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e0?i=n:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:i=0})):n>0&&(l.start({type:"start",alpha:i=n}),e=Dn(c.tick)),c):i},c.start=function(){function n(n,r){if(!e){for(e=new Array(i),c=0;c=0;)u.push(s=l[c]),s.parent=o,s.depth=o.depth+1;r&&(o.value=0),o.children=l}else r&&(o.value=+r.call(n,o,o.depth)||0),delete o.children;return ci(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=fi,e=li,r=si;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ai(t,function(n){n.children&&(n.value=0)}),ci(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},su.layout.partition=function(){function n(t,e,r,i){var o=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,o&&(u=o.length)){var u,a,c,l=-1;for(r=t.value?r/t.value:0;++la&&(a=r),u.push(r)}for(e=0;e0)for(o=-1;++o=s[0]&&a<=s[1]&&(u=c[su.bisect(f,a,1,p)-1],u.y+=g,u.push(n[o]));return c}var t=!0,e=Number,r=_i,i=wi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Cn(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return bi(n,t)}:Cn(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},su.layout.pack=function(){function n(n,o){var u=e.call(this,n,o),a=u[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,ci(a,function(n){n.r=+s(n.value)}),ci(a,Ai),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;ci(a,function(n){n.r+=f}),ci(a,Ai),ci(a,function(n){n.r-=f})}return zi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),u}var t,e=su.layout.hierarchy().sort(ki),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ui(n,e)},su.layout.tree=function(){function n(n,i){var s=u.call(this,n,i),f=s[0],h=t(f);if(ci(h,e),h.parent.m=-h.z,ai(h,r),l)ai(f,o);else{var p=f,g=f,d=f;ai(f,function(n){n.xg.x&&(g=n),n.depth>d.depth&&(d=n)});var v=a(p,g)/2-p.x,y=c[0]/(g.x+a(g,p)/2+v),m=c[1]/(d.depth||1);ai(f,function(n){n.x=(n.x+v)*y,n.y=n.depth*m})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,o=t.children,u=0,a=o.length;u0&&(Pi(ji(u,n,e),n,r),l+=r,s+=r),f+=u.m,l+=i.m,h+=c.m,s+=o.m;u&&!Ri(o)&&(o.t=u,o.m+=f-s),i&&!Di(c)&&(c.t=i,c.m+=l-h,e=n)}return e}function o(n){n.x*=c[0],n.y=n.depth*c[1]}var u=su.layout.hierarchy().sort(null).value(null),a=qi,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?o:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:o,n):l?c:null},ui(n,u)},su.layout.cluster=function(){function n(n,o){var u,a=t.call(this,n,o),c=a[0],l=0;ci(c,function(n){var t=n.children;t&&t.length?(n.x=Oi(t),n.y=Fi(t)):(n.x=u?l+=e(n,u):0,n.y=0,u=n)});var s=Hi(c),f=Ii(c),h=s.x-e(s,f)/2,p=f.x+e(f,s)/2;return ci(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=su.layout.hierarchy().sort(null).value(null),e=qi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ui(n,t)},su.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,o=n.length;++i0;)s.push(u=h[c-1]),s.area+=u.area,"squarify"!==p||(a=r(s,d))<=g?(h.pop(),g=a):(s.area-=s.pop().area,i(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,g=1/0);s.length&&(i(s,d,l,!0),s.length=s.area=0),o.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var o,u=f(t),a=r.slice(),c=[];for(n(a,u.dx*u.dy/t.value),c.area=0;o=a.pop();)c.push(o),c.area+=o.area,null!=o.z&&(i(c,o.z?u.dx:u.dy,u,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,o=1/0,u=-1,a=n.length;++ui&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*o*g)):1/0}function i(n,t,e,r){var i,o=-1,u=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++oe.dx)&&(s=e.dx);++o1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=su.random.normal.apply(su,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=su.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;ef?0:1;if(l=Hu)return t(l,p)+(n?t(n,1-p):"")+"Z";var g,d,v,y,m,x,M,w,b,_,k,E,S=0,N=0,A=[];if((y=(+c.apply(this,arguments)||0)/2)&&(v=o===Tc?Math.sqrt(n*n+l*l):+o.apply(this,arguments),p||(N*=-1),l&&(N=rn(v/l*Math.sin(y))),n&&(S=rn(v/n*Math.sin(y)))),l){m=l*Math.cos(s+N),x=l*Math.sin(s+N),M=l*Math.cos(f-N),w=l*Math.sin(f-N);var C=Math.abs(f-s-2*N)<=Fu?0:1;if(N&&Mo(m,x,M,w)===p^C){var T=(s+f)/2;m=l*Math.cos(T),x=l*Math.sin(T),M=w=null}}else m=x=0;if(n){b=n*Math.cos(f-S),_=n*Math.sin(f-S),k=n*Math.cos(s+S),E=n*Math.sin(s+S);var z=Math.abs(s-f+2*S)<=Fu?0:1;if(S&&Mo(b,_,k,E)===1-p^z){var L=(s+f)/2;b=n*Math.cos(L),_=n*Math.sin(L),k=E=null}}else b=_=0;if(h>Uu&&(g=Math.min(Math.abs(l-n)/2,+i.apply(this,arguments)))>.001){d=nFu)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var o=we,u=be,a=Zo,c=yo,l=mo;return n.radius=function(t){return arguments.length?(a=Cn(t),n):a},n.source=function(t){return arguments.length?(o=Cn(t),n):o},n.target=function(t){return arguments.length?(u=Cn(t),n):u},n.startAngle=function(t){return arguments.length?(c=Cn(t),n):c},n.endAngle=function(t){return arguments.length?(l=Cn(t),n):l},n},su.svg.diagonal=function(){function n(n,i){var o=t.call(this,n,i),u=e.call(this,n,i),a=(o.y+u.y)/2,c=[o,{x:o.x,y:a},{x:u.x,y:a},u];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=we,e=be,r=Vo;return n.source=function(e){return arguments.length?(t=Cn(e),n):t},n.target=function(t){return arguments.length?(e=Cn(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},su.svg.diagonal.radial=function(){var n=su.svg.diagonal(),t=Vo,e=n.projection;return n.projection=function(n){return arguments.length?e($o(t=n)):t},n},su.svg.symbol=function(){function n(n,r){return(Rc.get(t.call(this,n,r))||Jo)(e.call(this,n,r))}var t=Wo,e=Xo;return n.type=function(e){return arguments.length?(t=Cn(e),n):t},n.size=function(t){return arguments.length?(e=Cn(t),n):e},n};var Rc=su.map({circle:Jo,cross:function(n){var t=Math.sqrt(n/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(n){var t=Math.sqrt(n/(2*Uc)),e=t*Uc;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});su.svg.symbolTypes=Rc.keys();var Pc=Math.sqrt(3),Uc=Math.tan(30*Yu);Cu.transition=function(n){for(var t,e,r=jc||++Ic,i=tu(n),o=[],u=Fc||{time:Date.now(),ease:Ar,delay:0,duration:250},a=-1,c=this.length;++arect,.s>rect").attr("width",f[1]-f[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function o(){function o(){32==su.event.keyCode&&(C||(x=null,z[0]-=f[1],z[1]-=h[1],C=2),S())}function d(){32==su.event.keyCode&&2==C&&(z[0]+=f[1],z[1]+=h[1],C=0,S())}function v(){var n=su.mouse(w),r=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(su.event.altKey?(x||(x=[(f[0]+f[1])/2,(h[0]+h[1])/2]),z[0]=f[+(n[0]0?o=setTimeout(i,t-s):(o=null,e||(l=n.apply(a,u),o||(a=u=null)))}var o,u,a,c,l;return null==t&&(t=100),function(){a=this,u=arguments,c=r();var s=e&&!o;return o||(o=setTimeout(i,t)),s&&(l=n.apply(a,u),a=u=null),l}}},{"date-now":2}],4:[function(n,t,e){(function(r){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(n){var t=this.useColors;if(n[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+n[0]+(t?"%c ":" ")+"+"+e.humanize(this.diff),t){var r="color: "+this.color;n.splice(1,0,r,"color: inherit");var i=0,o=0;n[0].replace(/%[a-zA-Z%]/g,function(n){"%%"!==n&&(i++,"%c"===n&&(o=i))}),n.splice(o,0,r)}}function u(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(n){try{null==n?e.storage.removeItem("debug"):e.storage.debug=n}catch(n){}}function c(){var n;try{n=e.storage.debug}catch(n){}return!n&&void 0!==r&&"env"in r&&(n=r.env.DEBUG),n}e=t.exports=n("./debug"),e.log=u,e.formatArgs=o,e.save=a,e.load=c,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(n){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(n){try{return JSON.stringify(n)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}},e.enable(c())}).call(this,n("_process"))},{"./debug":5,_process:8}],5:[function(n,t,e){function r(n){var t,r=0;for(t in n)r=(r<<5)-r+n.charCodeAt(t),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function i(n){function t(){if(t.enabled){var n=t,r=+new Date,i=r-(l||r);n.diff=i,n.prev=l,n.curr=r,l=r;for(var o=new Array(arguments.length),u=0;u1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(n);if(t){var e=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return e*f;case"days":case"day":case"d":return e*s;case"hours":case"hour":case"hrs":case"hr":case"h":return e*l;case"minutes":case"minute":case"mins":case"min":case"m":return e*c;case"seconds":case"second":case"secs":case"sec":case"s":return e*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function i(n){return n>=s?Math.round(n/s)+"d":n>=l?Math.round(n/l)+"h":n>=c?Math.round(n/c)+"m":n>=a?Math.round(n/a)+"s":n+"ms"}function o(n){return u(n,s,"day")||u(n,l,"hour")||u(n,c,"minute")||u(n,a,"second")||n+" ms"}function u(n,t,e){if(!(n0)return r(n);if("number"===e&&!1===isNaN(n))return t.long?o(n):i(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))}},{}],7:[function(n,t,e){function r(n){if("number"!=typeof n||Number.isNaN(n))throw new TypeError("Expected a number, got "+typeof n);var t=n<0,e=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(n=-n),n<1)return(t?"-":"")+n+" B";var r=Math.min(Math.floor(Math.log(n)/Math.log(1e3)),e.length-1);n=Number(n/Math.pow(1e3,r));var i=e[r];return n>=10||n%1==0?(t?"-":"")+n.toFixed(0)+" "+i:(t?"-":"")+n.toFixed(1)+" "+i}t.exports=r},{}],8:[function(n,t,e){function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(n){if(f===setTimeout)return setTimeout(n,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(n,0);try{return f(n,0)}catch(t){try{return f.call(null,n,0)}catch(t){return f.call(this,n,0)}}}function u(n){if(h===clearTimeout)return clearTimeout(n);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(n);try{return h(n)}catch(t){try{return h.call(null,n)}catch(t){return h.call(this,n)}}}function a(){v&&g&&(v=!1,g.length?d=g.concat(d):y=-1,d.length&&c())}function c(){if(!v){var n=o(a);v=!0;for(var t=d.length;t;){for(g=d,d=[];++y1)for(var e=1;e=c.links.maxBytes?c.links.maxBytes:n,{width:n*c.links.maxWidth/c.links.maxBytes,unit:e}}function s(){var e=window.innerWidth>=900?400:250,r=n.offsetWidth;return t&&("number"==typeof t.width&&(r=t.width),"function"==typeof t.width&&(r=t.width()),"number"==typeof t.height&&(e=t.height),"function"==typeof t.height&&(e=t.height()),"auto"===t.height&&(e=n.offsetHeight)),{width:r,height:e}}function f(){j=j.data(L.links),U=U.data(L.nodes,function(n){return n.id}),j.enter().insert("line",".node").attr("class","link").style("stroke",l.links.color).style("opacity",.5),j.exit().remove(),j.style("stroke-width",function(n){ +return n.rate?n.rate.width"+t,"at",a(e)),"number"!=typeof e||e<0)throw new Error("rate: 3th param must be a positive number");var i=v(n);if(!i)throw new Error("rate: invalid source id");var u=v(t);if(!u)throw new Error("rate: invalid target id");var c=x(i.index,u.index);if(-1===c)throw new Error("rate: connection does not exist");L.links[c].rate=r(e),o("rate:",L.links[c].rate),f()}"string"==typeof n&&(n=document.querySelector(n));var L={nodes:[],links:[]};if(t){if(t.height&&"function"!=typeof t.height&&"default"!==t.height&&"auto"!==t.height&&"number"!=typeof t.height)throw new Error("Height should be a Number or a Function");if(t.width&&"default"!==t.width&&"function"!=typeof t.width&&"auto"!==t.width&&"number"!=typeof t.width)throw new Error("Width should be a Number of a Function")}var q;L.links.forEach(function(n){var t=L.nodes[n.source],e=L.nodes[n.target];t.children=t.children||[],t.children.push(n.target),e.parents=e.parents||[],e.parents.push(n.source)});var D=s(),R=i.select(n).append("svg").attr("width",D.width).attr("height",D.height),P=i.layout.force().size([D.width,D.height]).nodes(L.nodes).links(L.links).on("tick",function(){j.attr("x1",function(n){return n.source.x}).attr("y1",function(n){return n.source.y}).attr("x2",function(n){return n.target.x}).attr("y2",function(n){return n.target.y}),U.attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y}),U.attr("transform",function(n){return"translate("+n.x+","+n.y+")"})}),U=R.selectAll(".node"),j=R.selectAll(".link");return f(),window.addEventListener("resize",u(h,500)),h(),{list:M,add:w,hasPeer:E,hasLink:S,remove:b,connect:_,disconnect:k,getLink:m,areConnected:N,unchoke:A,choke:C,seed:T,rate:z}}t.exports=r;var i=n("d3"),o=n("debug")("p2p-graph"),u=n("debounce"),a=n("prettier-bytes"),c={links:{width:.7,maxWidth:5,maxBytes:2097152}},l={links:{color:"#C8C8C8"},text:{subtitle:"#C8C8C8"},nodes:{method:function(n,t){return n.me?i.hsl(210,.7,.725):n.seeder?i.hsl(120,.7,.725):i.hsl(55,.7,.725)},hover:"#A9A9A9",dep:"#252929"}}},{d3:1,debounce:3,debug:4,"prettier-bytes":7}]},{},[9])(9)});