1 line
No EOL
62 KiB
JavaScript
1 line
No EOL
62 KiB
JavaScript
var d3=function(T){"use strict";var o={value:function(){}};function q(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new i(r)}function i(t){this._=t}function s(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function h(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=o,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}i.prototype=q.prototype={constructor:i,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(0<=e&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),u=-1,a=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u<a;)if(e=(t=o[u]).type)i[e]=h(i[e],t.name,n);else if(null==n)for(e in i)i[e]=h(i[e],t.name,null);return this}for(;++u<a;)if((e=(t=o[u]).type)&&(e=s(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new i(t)},call:function(t,n){if(0<(e=arguments.length-2))for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var r="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},a=function(t){var n=t+="",e=n.indexOf(":");return 0<=e&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),u.hasOwnProperty(n)?{space:u[n],local:t}:t};var c=function(t){var n=a(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===r&&t.documentElement.namespaceURI===r?t.createElement(e):t.createElementNS(n,e)}})(n)};function n(){}var p=function(t){return null==t?n:function(){return this.querySelector(t)}};function e(){return[]}var g=function(t){return null==t?e:function(){return this.querySelectorAll(t)}},t=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var l=document.documentElement;if(!l.matches){var f=l.webkitMatchesSelector||l.msMatchesSelector||l.mozMatchesSelector||l.oMatchesSelector;t=function(t){return function(){return f.call(this,t)}}}}var v=t,y=function(t){return new Array(t.length)};function d(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}d.prototype={constructor:d,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function b(t,n,e,r,i,o){for(var u,a=0,s=n.length,h=o.length;a<h;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new d(t,o[a]);for(;a<s;++a)(u=n[a])&&(i[a]=u)}function N(t,n,e,r,i,o,u){var a,s,h,c={},l=n.length,f=o.length,p=new Array(l);for(a=0;a<l;++a)(s=n[a])&&(p[a]=h="$"+u.call(s,s.__data__,a,n),h in c?i[a]=s:c[h]=s);for(a=0;a<f;++a)(s=c[h="$"+u.call(t,o[a],a,o)])?((r[a]=s).__data__=o[a],c[h]=null):e[a]=new d(t,o[a]);for(a=0;a<l;++a)(s=n[a])&&c[p[a]]===s&&(i[a]=s)}function m(t,n){return t<n?-1:n<t?1:n<=t?0:NaN}var _=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function x(t,n){return t.style.getPropertyValue(n)||_(t).getComputedStyle(t,null).getPropertyValue(n)}function w(t){return t.trim().split(/^|\s+/)}function M(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=w(t.getAttribute("class")||"")}function A(t,n){for(var e=M(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function z(t,n){for(var e=M(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}k.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);0<=n&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};function E(){this.textContent=""}function S(){this.innerHTML=""}function P(){this.nextSibling&&this.parentNode.appendChild(this)}function X(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function C(){return null}function Y(){var t=this.parentNode;t&&t.removeChild(this)}function I(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function D(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var V={};(T.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(V={mouseenter:"mouseover",mouseleave:"mouseout"}));function L(e,t,n){return e=O(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function O(e,r,i){return function(t){var n=T.event;T.event=t;try{e.call(this,this.__data__,r,i)}finally{T.event=n}}}function R(o){return function(){var t=this.__on;if(t){for(var n,e=0,r=-1,i=t.length;e<i;++e)n=t[e],o.type&&n.type!==o.type||n.name!==o.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?t.length=r:delete this.__on}}}function j(s,h,c){var l=V.hasOwnProperty(s.type)?L:O;return function(t,n,e){var r,i=this.__on,o=l(h,n,e);if(i)for(var u=0,a=i.length;u<a;++u)if((r=i[u]).type===s.type&&r.name===s.name)return this.removeEventListener(r.type,r.listener,r.capture),this.addEventListener(r.type,r.listener=o,r.capture=c),void(r.value=h);this.addEventListener(s.type,o,c),r={type:s.type,name:s.name,value:h,listener:o,capture:c},i?i.push(r):this.__on=[r]}}function B(t,n,e,r){var i=T.event;t.sourceEvent=T.event,T.event=t;try{return n.apply(e,r)}finally{T.event=i}}function $(t,n,e){var r=_(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var U=[null];function G(t,n){this._groups=t,this._parents=n}function H(){return new G([[document.documentElement]],U)}G.prototype=H.prototype={constructor:G,select:function(t){"function"!=typeof t&&(t=p(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],s=a.length,h=r[i]=new Array(s),c=0;c<s;++c)(o=a[c])&&(u=t.call(o,o.__data__,c,a))&&("__data__"in o&&(u.__data__=o.__data__),h[c]=u);return new G(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=g(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],s=a.length,h=0;h<s;++h)(u=a[h])&&(r.push(t.call(u,u.__data__,h,a)),i.push(u));return new G(r,i)},filter:function(t){"function"!=typeof t&&(t=v(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],h=0;h<a;++h)(o=u[h])&&t.call(o,o.__data__,h,u)&&s.push(o);return new G(r,this._parents)},data:function(t,n){if(!t)return v=new Array(this.size()),c=-1,this.each(function(t){v[++c]=t}),v;var e,r=n?N:b,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var u=o.length,a=new Array(u),s=new Array(u),h=new Array(u),c=0;c<u;++c){var l=i[c],f=o[c],p=f.length,v=t.call(l,l&&l.__data__,c,i),y=v.length,d=s[c]=new Array(y),g=a[c]=new Array(y);r(l,f,d,g,h[c]=new Array(p),v,n);for(var m,_,w=0,x=0;w<y;++w)if(m=d[w]){for(x<=w&&(x=w+1);!(_=g[x])&&++x<y;);m._next=_||null}}return(a=new G(a,i))._enter=s,a._exit=h,a},enter:function(){return new G(this._enter||this._groups.map(y),this._parents)},exit:function(){return new G(this._exit||this._groups.map(y),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,h=n[a],c=e[a],l=h.length,f=u[a]=new Array(l),p=0;p<l;++p)(s=h[p]||c[p])&&(f[p]=s);for(;a<r;++a)u[a]=n[a];return new G(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];0<=--o;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=m);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var u,a=n[o],s=a.length,h=i[o]=new Array(s),c=0;c<s;++c)(u=a[c])&&(h[c]=u);h.sort(t)}return new G(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=a(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(n,e){return function(){var t=e.apply(this,arguments);null==t?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,t)}}:function(n,e){return function(){var t=e.apply(this,arguments);null==t?this.removeAttribute(n):this.setAttribute(n,t)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return 1<arguments.length?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(n,e,r){return function(){var t=e.apply(this,arguments);null==t?this.style.removeProperty(n):this.style.setProperty(n,t,r)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):x(this.node(),t)},property:function(t,n){return 1<arguments.length?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(n,e){return function(){var t=e.apply(this,arguments);null==t?delete this[n]:this[n]=t}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=w(t+"");if(arguments.length<2){for(var r=M(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?A:z)(this,t)}}:n?function(t){return function(){A(this,t)}}:function(t){return function(){z(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?E:("function"==typeof t?function(n){return function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?S:("function"==typeof t?function(n){return function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(P)},lower:function(){return this.each(X)},append:function(t){var n="function"==typeof t?t:c(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:c(t),r=null==n?C:"function"==typeof n?n:p(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Y)},clone:function(t){return this.select(t?D:I)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return 0<=e&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}),u=o.length;if(!(arguments.length<2)){for(a=n?j:R,null==e&&(e=!1),r=0;r<u;++r)this.each(a(o[r],n,e));return this}var a=this.node().__on;if(a)for(var s,h=0,c=a.length;h<c;++h)for(r=0,s=a[h];r<u;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return $(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return $(this,t,n)}})(t,n))}};var F=function(t){return"string"==typeof t?new G([[document.querySelector(t)]],[document.documentElement]):new G([[t]],U)},K=0;function Q(){return new W}function W(){this._="@"+(++K).toString(36)}W.prototype=Q.prototype={constructor:W,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var J=function(){for(var t,n=T.event;t=n.sourceEvent;)n=t;return n},Z=function(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]},tt=function(t){var n=J();return n.changedTouches&&(n=n.changedTouches[0]),Z(t,n)},nt=function(t,n,e){arguments.length<3&&(e=n,n=J().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return Z(t,r);return null};function et(){T.event.stopImmediatePropagation()}var rt=function(){T.event.preventDefault(),T.event.stopImmediatePropagation()},it=function(t){var n=t.document.documentElement,e=F(t).on("dragstart.drag",rt,!0);"onselectstart"in n?e.on("selectstart.drag",rt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")};function ot(t,n){var e=t.document.documentElement,r=F(t).on("dragstart.drag",null);n&&(r.on("click.drag",rt,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var ut=function(t){return function(){return t}};function at(t,n,e,r,i,o,u,a,s,h){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=u,this.dx=a,this.dy=s,this._=h}function st(){return!T.event.button}function ht(){return this.parentNode}function ct(t){return null==t?{x:T.event.x,y:T.event.y}:t}function lt(){return"ontouchstart"in this}at.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var ft=function(t,n,e){t.prototype=n.prototype=e,e.constructor=t};function pt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function vt(){}var yt=1/.7,dt="\\s*([+-]?\\d+)\\s*",gt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",mt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_t=/^#([0-9a-f]{3})$/,wt=/^#([0-9a-f]{6})$/,xt=new RegExp("^rgb\\("+[dt,dt,dt]+"\\)$"),bt=new RegExp("^rgb\\("+[mt,mt,mt]+"\\)$"),Nt=new RegExp("^rgba\\("+[dt,dt,dt,gt]+"\\)$"),Mt=new RegExp("^rgba\\("+[mt,mt,mt,gt]+"\\)$"),kt=new RegExp("^hsl\\("+[gt,mt,mt]+"\\)$"),At=new RegExp("^hsla\\("+[gt,mt,mt,gt]+"\\)$"),zt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Et(t){var n;return t=(t+"").trim().toLowerCase(),(n=_t.exec(t))?new Xt((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=wt.exec(t))?St(parseInt(n[1],16)):(n=xt.exec(t))?new Xt(n[1],n[2],n[3],1):(n=bt.exec(t))?new Xt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Nt.exec(t))?Tt(n[1],n[2],n[3],n[4]):(n=Mt.exec(t))?Tt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=kt.exec(t))?Yt(n[1],n[2]/100,n[3]/100,1):(n=At.exec(t))?Yt(n[1],n[2]/100,n[3]/100,n[4]):zt.hasOwnProperty(t)?St(zt[t]):"transparent"===t?new Xt(NaN,NaN,NaN,0):null}function St(t){return new Xt(t>>16&255,t>>8&255,255&t,1)}function Tt(t,n,e,r){return r<=0&&(t=n=e=NaN),new Xt(t,n,e,r)}function qt(t){return t instanceof vt||(t=Et(t)),t?new Xt((t=t.rgb()).r,t.g,t.b,t.opacity):new Xt}function Pt(t,n,e,r){return 1===arguments.length?qt(t):new Xt(t,n,e,null==r?1:r)}function Xt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ct(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Yt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||1<=e?t=n=NaN:n<=0&&(t=NaN),new It(t,n,e,r)}function It(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Dt(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}ft(vt,Et,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),ft(Xt,Pt,pt(vt,{brighter:function(t){return t=null==t?yt:Math.pow(yt,t),new Xt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Xt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Ct(this.r)+Ct(this.g)+Ct(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),ft(It,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof It)return new It(t.h,t.s,t.l,t.opacity);if(t instanceof vt||(t=Et(t)),!t)return new It;if(t instanceof It)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e<r):e===o?(r-n)/a+2:(n-e)/a+4,a/=s<.5?o+i:2-o-i,u*=60):a=0<s&&s<1?0:u,new It(u,a,s,t.opacity)}(t):new It(t,n,e,null==r?1:r)},pt(vt,{brighter:function(t){return t=null==t?yt:Math.pow(yt,t),new It(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new It(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Xt(Dt(240<=t?t-240:t+120,i,r),Dt(t,i,r),Dt(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Vt=Math.PI/180,Lt=180/Math.PI,Ot=.96422,Rt=1,jt=.82521,Bt=4/29,$t=6/29,Ut=3*$t*$t,Gt=$t*$t*$t;function Ht(t){if(t instanceof Ft)return new Ft(t.l,t.a,t.b,t.opacity);if(t instanceof Zt){if(isNaN(t.h))return new Ft(t.l,0,0,t.opacity);var n=t.h*Vt;return new Ft(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Xt||(t=qt(t));var e,r,i=Jt(t.r),o=Jt(t.g),u=Jt(t.b),a=Kt((.2225045*i+.7168786*o+.0606169*u)/Rt);return i===o&&o===u?e=r=a:(e=Kt((.4360747*i+.3850649*o+.1430804*u)/Ot),r=Kt((.0139322*i+.0971045*o+.7141733*u)/jt)),new Ft(116*a-16,500*(e-a),200*(a-r),t.opacity)}function Ft(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Kt(t){return Gt<t?Math.pow(t,1/3):t/Ut+Bt}function Qt(t){return $t<t?t*t*t:Ut*(t-Bt)}function Wt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Jt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Zt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}ft(Ft,function(t,n,e,r){return 1===arguments.length?Ht(t):new Ft(t,n,e,null==r?1:r)},pt(vt,{brighter:function(t){return new Ft(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Ft(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Xt(Wt(3.1338561*(n=Ot*Qt(n))-1.6168667*(t=Rt*Qt(t))-.4906146*(e=jt*Qt(e))),Wt(-.9787684*n+1.9161415*t+.033454*e),Wt(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),ft(Zt,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Zt)return new Zt(t.h,t.c,t.l,t.opacity);if(t instanceof Ft||(t=Ht(t)),0===t.a&&0===t.b)return new Zt(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Lt;return new Zt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Zt(t,n,e,null==r?1:r)},pt(vt,{brighter:function(t){return new Zt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Zt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Ht(this).rgb()}}));var tn=1.78277,nn=-.29227,en=-.90649,rn=1.97294,on=rn*en,un=rn*tn,an=tn*nn- -.14861*en;function sn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}ft(sn,function(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof sn)return new sn(t.h,t.s,t.l,t.opacity);t instanceof Xt||(t=qt(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(an*r+on*n-un*e)/(an+on-un),o=r-i,u=(rn*(e-i)-nn*o)/en,a=Math.sqrt(u*u+o*o)/(rn*i*(1-i)),s=a?Math.atan2(u,o)*Lt-120:NaN;return new sn(s<0?s+360:s,a,i,t.opacity)}(t):new sn(t,n,e,null==r?1:r)},pt(vt,{brighter:function(t){return t=null==t?yt:Math.pow(yt,t),new sn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new sn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Vt,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Xt(255*(n+e*(-.14861*r+tn*i)),255*(n+e*(nn*r+en*i)),255*(n+e*(rn*r)),this.opacity)}}));var hn=function(t){return function(){return t}};function cn(o){return 1==(o=+o)?ln:function(t,n){return n-t?(e=t,r=n,i=o,e=Math.pow(e,i),r=Math.pow(r,i)-e,i=1/i,function(t){return Math.pow(e+t*r,i)}):hn(isNaN(t)?n:t);var e,r,i}}function ln(t,n){var e,r,i=n-t;return i?(e=t,r=i,function(t){return e+t*r}):hn(isNaN(t)?n:t)}var fn=function t(n){var u=cn(n);function e(n,t){var e=u((n=Pt(n)).r,(t=Pt(t)).r),r=u(n.g,t.g),i=u(n.b,t.b),o=ln(n.opacity,t.opacity);return function(t){return n.r=e(t),n.g=r(t),n.b=i(t),n.opacity=o(t),n+""}}return e.gamma=t,e}(1),pn=function(n,e){return e-=n=+n,function(t){return n+e*t}},vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(vn.source,"g");var dn,gn,mn,_n,wn=180/Math.PI,xn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},bn=function(t,n,e,r,i,o){var u,a,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,s/=a),t*r<n*e&&(t=-t,n=-n,s=-s,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*wn,skewX:Math.atan(s)*wn,scaleX:u,scaleY:a}};function Nn(f,p,v,y){function d(t){return t.length?t.pop()+" ":""}return function(t,n){var e,r,i,o,u,a,s,h,c=[],l=[];return t=f(t),n=f(n),function(t,n,e,r,i,o){if(t!==e||n!==r){var u=i.push("translate(",null,p,null,v);o.push({i:u-4,x:pn(t,e)},{i:u-2,x:pn(n,r)})}else(e||r)&&i.push("translate("+e+p+r+v)}(t.translateX,t.translateY,n.translateX,n.translateY,c,l),e=t.rotate,r=n.rotate,i=c,o=l,e!==r?(180<e-r?r+=360:180<r-e&&(e+=360),o.push({i:i.push(d(i)+"rotate(",null,y)-2,x:pn(e,r)})):r&&i.push(d(i)+"rotate("+r+y),u=t.skewX,a=n.skewX,s=c,h=l,u!==a?h.push({i:s.push(d(s)+"skewX(",null,y)-2,x:pn(u,a)}):a&&s.push(d(s)+"skewX("+a+y),function(t,n,e,r,i,o){if(t!==e||n!==r){var u=i.push(d(i)+"scale(",null,",",null,")");o.push({i:u-4,x:pn(t,e)},{i:u-2,x:pn(n,r)})}else 1===e&&1===r||i.push(d(i)+"scale("+e+","+r+")")}(t.scaleX,t.scaleY,n.scaleX,n.scaleY,c,l),t=n=null,function(t){for(var n,e=-1,r=l.length;++e<r;)c[(n=l[e]).i]=n.x(t);return c.join("")}}}var Mn=Nn(function(t){return"none"===t?xn:(dn||(dn=document.createElement("DIV"),gn=document.documentElement,mn=document.defaultView),dn.style.transform=t,t=mn.getComputedStyle(gn.appendChild(dn),null).getPropertyValue("transform"),gn.removeChild(dn),t=t.slice(7,-1).split(","),bn(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),kn=Nn(function(t){return null==t?xn:(_n||(_n=document.createElementNS("http://www.w3.org/2000/svg","g")),_n.setAttribute("transform",t),(t=_n.transform.baseVal.consolidate())?(t=t.matrix,bn(t.a,t.b,t.c,t.d,t.e,t.f)):xn)},", ",")",")"),An=Math.SQRT2;function zn(t){return((t=Math.exp(t))+1/t)/2}var En,Sn,Tn=function(t,n){var e,u,a=t[0],s=t[1],h=t[2],r=n[0],i=n[1],o=n[2],c=r-a,l=i-s,f=c*c+l*l;if(f<1e-12)u=Math.log(o/h)/An,e=function(t){return[a+t*c,s+t*l,h*Math.exp(An*t*u)]};else{var p=Math.sqrt(f),v=(o*o-h*h+4*f)/(2*h*2*p),y=(o*o-h*h-4*f)/(2*o*2*p),d=Math.log(Math.sqrt(v*v+1)-v),g=Math.log(Math.sqrt(y*y+1)-y);u=(g-d)/An,e=function(t){var n,e,r=t*u,i=zn(d),o=h/(2*p)*(i*(e=An*r+d,((e=Math.exp(2*e))-1)/(e+1))-(n=d,((n=Math.exp(n))-1/n)/2));return[a+o*c,s+o*l,h*i/zn(An*r+d)]}}return e.duration=1e3*u,e},qn=0,Pn=0,Xn=0,Cn=1e3,Yn=0,In=0,Dn=0,Vn="object"==typeof performance&&performance.now?performance:Date,Ln="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function On(){return In||(Ln(Rn),In=Vn.now()+Dn)}function Rn(){In=0}function jn(){this._call=this._time=this._next=null}function Bn(t,n,e){var r=new jn;return r.restart(t,n,e),r}function $n(){In=(Yn=Vn.now())+Dn,qn=Pn=0;try{!function(){On(),++qn;for(var t,n=En;n;)0<=(t=In-n._time)&&n._call.call(null,t),n=n._next;--qn}()}finally{qn=0,function(){var t,n,e=En,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),e=(t=e)._next):(n=e._next,e._next=null,e=t?t._next=n:En=n);Sn=t,Gn(r)}(),In=0}}function Un(){var t=Vn.now(),n=t-Yn;Cn<n&&(Dn-=n,Yn=t)}function Gn(t){qn||(Pn&&(Pn=clearTimeout(Pn)),24<t-In?(t<1/0&&(Pn=setTimeout($n,t-Vn.now()-Dn)),Xn&&(Xn=clearInterval(Xn))):(Xn||(Yn=Vn.now(),Xn=setInterval(Un,Cn)),qn=1,Ln($n)))}jn.prototype=Bn.prototype={constructor:jn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?On():+e)+(null==n?0:+n),this._next||Sn===this||(Sn?Sn._next=this:En=this,Sn=this),this._call=t,this._time=e,Gn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gn())}};var Hn=function(n,e,t){var r=new jn;return e=null==e?0:+e,r.restart(function(t){r.stop(),n(t+e)},e,t),r},Fn=q("start","end","interrupt"),Kn=[],Qn=0,Wn=2,Jn=function(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};!function(o,u,a){var s,h=o.__transition;function c(t){var n,e,r,i;if(1!==a.state)return f();for(n in h)if((i=h[n]).name===a.name){if(3===i.state)return Hn(c);4===i.state?(i.state=6,i.timer.stop(),i.on.call("interrupt",o,o.__data__,i.index,i.group),delete h[n]):+n<u&&(i.state=6,i.timer.stop(),delete h[n])}if(Hn(function(){3===a.state&&(a.state=4,a.timer.restart(l,a.delay,a.time),l(t))}),a.state=Wn,a.on.call("start",o,o.__data__,a.index,a.group),a.state===Wn){for(a.state=3,s=new Array(r=a.tween.length),n=0,e=-1;n<r;++n)(i=a.tween[n].value.call(o,o.__data__,a.index,a.group))&&(s[++e]=i);s.length=e+1}}function l(t){for(var n=t<a.duration?a.ease.call(null,t/a.duration):(a.timer.restart(f),a.state=5,1),e=-1,r=s.length;++e<r;)s[e].call(null,n);5===a.state&&(a.on.call("end",o,o.__data__,a.index,a.group),f())}function f(){for(var t in a.state=6,a.timer.stop(),delete h[u],h)return;delete o.__transition}(h[u]=a).timer=Bn(function(t){a.state=1,a.timer.restart(c,a.delay,a.time),a.delay<=t&&c(t-a.delay)},0,a.time)}(t,e,{name:n,index:r,group:i,on:Fn,tween:Kn,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Qn})};function Zn(t,n){var e=ne(t,n);if(e.state>Qn)throw new Error("too late; already scheduled");return e}function te(t,n){var e=ne(t,n);if(e.state>Wn)throw new Error("too late; already started");return e}function ne(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var ee=function(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Wn&&e.state<5,e.state=6,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}};function re(t,n,e){var r=t._id;return t.each(function(){var t=te(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return ne(t,r).value[n]}}var ie=function(t,n){var e;return("number"==typeof n?pn:n instanceof Et?fn:(e=Et(n))?(n=e,fn):function(t,r){var n,e,i,o,u,a=vn.lastIndex=yn.lastIndex=0,s=-1,h=[],c=[];for(t+="",r+="";(n=vn.exec(t))&&(e=yn.exec(r));)(i=e.index)>a&&(i=r.slice(a,i),h[s]?h[s]+=i:h[++s]=i),(n=n[0])===(e=e[0])?h[s]?h[s]+=e:h[++s]=e:(h[++s]=null,c.push({i:s,x:pn(n,e)})),a=yn.lastIndex;return a<r.length&&(i=r.slice(a),h[s]?h[s]+=i:h[++s]=i),h.length<2?c[0]?(u=c[0].x,function(t){return u(t)+""}):(o=r,function(){return o}):(r=c.length,function(t){for(var n,e=0;e<r;++e)h[(n=c[e]).i]=n.x(t);return h.join("")})})(t,n)};var oe=H.prototype.constructor;var ue=0;function ae(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function se(t){return H().transition(t)}function he(){return++ue}var ce=H.prototype;ae.prototype=se.prototype={constructor:ae,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=p(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,s,h=r[u],c=h.length,l=o[u]=new Array(c),f=0;f<c;++f)(a=h[f])&&(s=t.call(a,a.__data__,f,h))&&("__data__"in a&&(s.__data__=a.__data__),l[f]=s,Jn(l[f],n,e,f,l,ne(a,e)));return new ae(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var s,h=r[a],c=h.length,l=0;l<c;++l)if(s=h[l]){for(var f,p=t.call(s,s.__data__,l,h),v=ne(s,e),y=0,d=p.length;y<d;++y)(f=p[y])&&Jn(f,n,e,y,p,v);o.push(p),u.push(s)}return new ae(o,u,n,e)},filter:function(t){"function"!=typeof t&&(t=v(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],h=0;h<a;++h)(o=u[h])&&t.call(o,o.__data__,h,u)&&s.push(o);return new ae(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,h=n[a],c=e[a],l=h.length,f=u[a]=new Array(l),p=0;p<l;++p)(s=h[p]||c[p])&&(f[p]=s);for(;a<r;++a)u[a]=n[a];return new ae(u,this._parents,this._name,this._id)},selection:function(){return new oe(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=he(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,h=0;h<s;++h)if(u=a[h]){var c=ne(u,n);Jn(u,t,e,h,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ae(r,this._parents,t,e)},call:ce.call,nodes:ce.nodes,node:ce.node,size:ce.size,empty:ce.empty,each:ce.each,on:function(t,n){var e,r,i,o,u,a,s=this._id;return arguments.length<2?ne(this.node(),s).on.on(t):this.each((e=s,i=n,a=((r=t)+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return 0<=n&&(t=t.slice(0,n)),!t||"start"===t})?Zn:te,function(){var t=a(this,e),n=t.on;n!==o&&(u=(o=n).copy()).on(r,i),t.on=u}))},attr:function(t,n){var e=a(t),r="transform"===e?kn:ie;return this.attrTween(t,"function"==typeof n?(e.local?function(e,r,i){var o,u,a;return function(){var t,n=i(this);if(null!=n)return(t=this.getAttributeNS(e.space,e.local))===n?null:t===o&&n===u?a:a=r(o=t,u=n);this.removeAttributeNS(e.space,e.local)}}:function(e,r,i){var o,u,a;return function(){var t,n=i(this);if(null!=n)return(t=this.getAttribute(e))===n?null:t===o&&n===u?a:a=r(o=t,u=n);this.removeAttribute(e)}})(e,r,re(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(n,e,r){var i,o;return function(){var t=this.getAttributeNS(n.space,n.local);return t===r?null:t===i?o:o=e(i=t,r)}}:function(n,e,r){var i,o;return function(){var t=this.getAttribute(n);return t===r?null:t===i?o:o=e(i=t,r)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=a(t);return this.tween(e,(r.local?function(r,t){function n(){var n=this,e=t.apply(n,arguments);return e&&function(t){n.setAttributeNS(r.space,r.local,e(t))}}return n._value=t,n}:function(r,t){function n(){var n=this,e=t.apply(n,arguments);return e&&function(t){n.setAttribute(r,e(t))}}return n._value=t,n})(r,n))},style:function(t,n,e){var r,i,o,u,a,s,h,c,l,f,p,v,y,d,g,m,_,w="transform"==(t+="")?Mn:ie;return null==n?this.styleTween(t,(y=t,d=w,function(){var t=x(this,y),n=(this.style.removeProperty(y),x(this,y));return t===n?null:t===g&&n===m?_:_=d(g=t,m=n)})).on("end.style."+t,(v=t,function(){this.style.removeProperty(v)})):this.styleTween(t,"function"==typeof n?(h=w,c=re(this,"style."+(s=t),n),function(){var t=x(this,s),n=c(this);return null==n&&(this.style.removeProperty(s),n=x(this,s)),t===n?null:t===l&&n===f?p:p=h(l=t,f=n)}):(r=t,i=w,o=n+"",function(){var t=x(this,r);return t===o?null:t===u?a:a=i(u=t,o)}),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(r,t,i){function n(){var n=this,e=t.apply(n,arguments);return e&&function(t){n.style.setProperty(r,e(t),i)}}return n._value=t,n}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?(e=re(this,"text",t),function(){var t=e(this);this.textContent=null==t?"":t}):(n=null==t?"":t+"",function(){this.textContent=n}));var n,e},remove:function(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=ne(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?function(i,o){var u,a;return function(){var t=te(this,i),n=t.tween;if(n!==u)for(var e=0,r=(a=u=n).length;e<r;++e)if(a[e].name===o){(a=a.slice()).splice(e,1);break}t.tween=a}}:function(o,u,a){var s,h;if("function"!=typeof a)throw new Error;return function(){var t=te(this,o),n=t.tween;if(n!==s){h=(s=n).slice();for(var e={name:u,value:a},r=0,i=h.length;r<i;++r)if(h[r].name===u){h[r]=e;break}r===i&&h.push(e)}t.tween=h}})(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){Zn(this,t).delay=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){Zn(this,t).delay=n}})(n,t)):ne(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?function(t,n){return function(){te(this,t).duration=+n.apply(this,arguments)}}:function(t,n){return n=+n,function(){te(this,t).duration=n}})(n,t)):ne(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){te(this,t).ease=n}}(n,t)):ne(this.node(),n).ease}};var le={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function fe(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return le.time=On(),le;return e}H.prototype.interrupt=function(t){return this.each(function(){ee(this,t)})},H.prototype.transition=function(t){var n,e;t instanceof ae?(n=t._id,t=t._name):(n=he(),(e=le).time=On(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,h=0;h<s;++h)(u=a[h])&&Jn(u,t,n,h,a,e||fe(u,n));return new ae(r,this._parents,t,n)};var pe=[null],ve=function(t){return function(){return t}};function ye(t,n,e){this.target=t,this.type=n,this.transform=e}function de(t,n,e){this.k=t,this.x=n,this.y=e}de.prototype={constructor:de,scale:function(t){return 1===t?this:new de(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new de(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ge=new de(1,0,0);function me(t){return t.__zoom||ge}function _e(){T.event.stopImmediatePropagation()}me.prototype=de.prototype;var we=function(){T.event.preventDefault(),T.event.stopImmediatePropagation()};function xe(){return!T.event.button}function be(){var t,n,e=this;return e instanceof SVGElement?(t=(e=e.ownerSVGElement||e).width.baseVal.value,n=e.height.baseVal.value):(t=e.clientWidth,n=e.clientHeight),[[0,0],[t,n]]}function Ne(){return this.__zoom||ge}function Me(){return-T.event.deltaY*(T.event.deltaMode?120:1)/500}function ke(){return"ontouchstart"in this}function Ae(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],u=t.invertY(n[1][1])-e[1][1];return t.translate(r<i?(r+i)/2:Math.min(0,r)||Math.max(0,i),o<u?(o+u)/2:Math.min(0,o)||Math.max(0,u))}var ze=function(t){return function(){return t}},Ee=function(){return 1e-6*(Math.random()-.5)};function Se(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,u,a,s,h,c,l,f,p=t._root,v={data:r},y=t._x0,d=t._y0,g=t._x1,m=t._y1;if(!p)return t._root=v,t;for(;p.length;)if((h=n>=(o=(y+g)/2))?y=o:g=o,(c=e>=(u=(d+m)/2))?d=u:m=u,!(p=(i=p)[l=c<<1|h]))return i[l]=v,t;if(a=+t._x.call(null,p.data),s=+t._y.call(null,p.data),n===a&&e===s)return v.next=p,i?i[l]=v:t._root=v,t;for(;i=i?i[l]=new Array(4):t._root=new Array(4),(h=n>=(o=(y+g)/2))?y=o:g=o,(c=e>=(u=(d+m)/2))?d=u:m=u,(l=c<<1|h)==(f=(u<=s)<<1|o<=a););return i[f]=p,i[l]=v,t}var Te=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i};function qe(t){return t[0]}function Pe(t){return t[1]}function Xe(t,n,e){var r=new Ce(null==n?qe:n,null==e?Pe:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Ce(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Ye(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var Ie=Xe.prototype=Ce.prototype;function De(t){return t.x+t.vx}function Ve(t){return t.y+t.vy}Ie.copy=function(){var t,n,e=new Ce(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=Ye(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=Ye(n));return e},Ie.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return Se(this.cover(n,e),n,e,t)},Ie.addAll=function(t){var n,e,r,i,o=t.length,u=new Array(o),a=new Array(o),s=1/0,h=1/0,c=-1/0,l=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||((u[e]=r)<s&&(s=r),c<r&&(c=r),(a[e]=i)<h&&(h=i),l<i&&(l=i));for(c<s&&(s=this._x0,c=this._x1),l<h&&(h=this._y0,l=this._y1),this.cover(s,h).cover(c,l),e=0;e<o;++e)Se(this,u[e],a[e],t[e]);return this},Ie.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(t<e||i<t||n<r||o<n))return this;var u,a,s=i-e,h=this._root;switch(a=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:for(;(u=new Array(4))[a]=h,h=u,o=r+(s*=2),(i=e+s)<t||o<n;);break;case 1:for(;(u=new Array(4))[a]=h,h=u,o=r+(s*=2),t<(e=i-s)||o<n;);break;case 2:for(;(u=new Array(4))[a]=h,h=u,r=o-(s*=2),(i=e+s)<t||n<r;);break;case 3:for(;(u=new Array(4))[a]=h,h=u,r=o-(s*=2),t<(e=i-s)||n<r;);}this._root&&this._root.length&&(this._root=h)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},Ie.data=function(){var n=[];return this.visit(function(t){if(!t.length)for(;n.push(t.data),t=t.next;);}),n},Ie.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Ie.find=function(t,n,e){var r,i,o,u,a,s,h,c=this._x0,l=this._y0,f=this._x1,p=this._y1,v=[],y=this._root;for(y&&v.push(new Te(y,c,l,f,p)),null==e?e=1/0:(c=t-e,l=n-e,f=t+e,p=n+e,e*=e);s=v.pop();)if(!(!(y=s.node)||(i=s.x0)>f||(o=s.y0)>p||(u=s.x1)<c||(a=s.y1)<l))if(y.length){var d=(i+u)/2,g=(o+a)/2;v.push(new Te(y[3],d,g,u,a),new Te(y[2],i,g,d,a),new Te(y[1],d,o,u,g),new Te(y[0],i,o,d,g)),(h=(g<=n)<<1|d<=t)&&(s=v[v.length-1],v[v.length-1]=v[v.length-1-h],v[v.length-1-h]=s)}else{var m=t-+this._x.call(null,y.data),_=n-+this._y.call(null,y.data),w=m*m+_*_;if(w<e){var x=Math.sqrt(e=w);c=t-x,l=n-x,f=t+x,p=n+x,r=y.data}}return r},Ie.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var n,e,r,i,o,u,a,s,h,c,l,f,p=this._root,v=this._x0,y=this._y0,d=this._x1,g=this._y1;if(!p)return this;if(p.length)for(;;){if((h=o>=(a=(v+d)/2))?v=a:d=a,(c=u>=(s=(y+g)/2))?y=s:g=s,!(p=(n=p)[l=c<<1|h]))return this;if(!p.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,f=l)}for(;p.data!==t;)if(!(p=(r=p).next))return this;return(i=p.next)&&delete p.next,r?i?r.next=i:delete r.next:n?(i?n[l]=i:delete n[l],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[f]=p:this._root=p)):this._root=i,this},Ie.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},Ie.root=function(){return this._root},Ie.size=function(){var n=0;return this.visit(function(t){if(!t.length)for(;++n,t=t.next;);}),n},Ie.visit=function(t){var n,e,r,i,o,u,a=[],s=this._root;for(s&&a.push(new Te(s,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,u=n.y1)&&s.length){var h=(r+o)/2,c=(i+u)/2;(e=s[3])&&a.push(new Te(e,h,c,o,u)),(e=s[2])&&a.push(new Te(e,r,c,h,u)),(e=s[1])&&a.push(new Te(e,h,i,o,c)),(e=s[0])&&a.push(new Te(e,r,i,h,c))}return this},Ie.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new Te(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,u=n.x0,a=n.y0,s=n.x1,h=n.y1,c=(u+s)/2,l=(a+h)/2;(o=i[0])&&e.push(new Te(o,u,a,c,l)),(o=i[1])&&e.push(new Te(o,c,a,s,l)),(o=i[2])&&e.push(new Te(o,u,l,c,h)),(o=i[3])&&e.push(new Te(o,c,l,s,h))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},Ie.x=function(t){return arguments.length?(this._x=t,this):this._x},Ie.y=function(t){return arguments.length?(this._y=t,this):this._y};var Le="$";function Oe(){}function Re(t,n){var e=new Oe;if(t instanceof Oe)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var u in t)e.set(u,t[u]);return e}function je(t){return t.index}function Be(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}Oe.prototype=Re.prototype={constructor:Oe,has:function(t){return Le+t in this},get:function(t){return this[Le+t]},set:function(t,n){return this[Le+t]=n,this},remove:function(t){var n=Le+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===Le&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===Le&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===Le&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===Le&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===Le&&++t;return t},empty:function(){for(var t in this)if(t[0]===Le)return!1;return!0},each:function(t){for(var n in this)n[0]===Le&&t(this[n],n.slice(1),this)}};function $e(t){return t.x}function Ue(t){return t.y}var Ge=Math.PI*(3-Math.sqrt(5));return T.drag=function(){var e,r,i,o,u=st,a=ht,n=ct,s=lt,v={},y=q("start","drag","end"),d=0,h=0;function g(t){t.on("mousedown.drag",c).filter(s).on("touchstart.drag",p).on("touchmove.drag",m).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){if(!o&&u.apply(this,arguments)){var t=w("mouse",a.apply(this,arguments),tt,this,arguments);t&&(F(T.event.view).on("mousemove.drag",l,!0).on("mouseup.drag",f,!0),it(T.event.view),et(),i=!1,e=T.event.clientX,r=T.event.clientY,t("start"))}}function l(){if(rt(),!i){var t=T.event.clientX-e,n=T.event.clientY-r;i=h<t*t+n*n}v.mouse("drag")}function f(){F(T.event.view).on("mousemove.drag mouseup.drag",null),ot(T.event.view,i),rt(),v.mouse("end")}function p(){if(u.apply(this,arguments)){var t,n,e=T.event.changedTouches,r=a.apply(this,arguments),i=e.length;for(t=0;t<i;++t)(n=w(e[t].identifier,r,nt,this,arguments))&&(et(),n("start"))}}function m(){var t,n,e=T.event.changedTouches,r=e.length;for(t=0;t<r;++t)(n=v[e[t].identifier])&&(rt(),n("drag"))}function _(){var t,n,e=T.event.changedTouches,r=e.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<r;++t)(n=v[e[t].identifier])&&(et(),n("end"))}function w(i,o,u,a,s){var h,c,l,f=u(o,i),p=y.copy();if(B(new at(g,"beforestart",h,i,d,f[0],f[1],0,0,p),function(){return null!=(T.event.subject=h=n.apply(a,s))&&(c=h.x-f[0]||0,l=h.y-f[1]||0,!0)}))return function t(n){var e,r=f;switch(n){case"start":v[i]=t,e=d++;break;case"end":delete v[i],--d;case"drag":f=u(o,i),e=d}B(new at(g,n,h,i,e,f[0]+c,f[1]+l,f[0]-r[0],f[1]-r[1],p),p.apply,p,[n,a,s])}}return g.filter=function(t){return arguments.length?(u="function"==typeof t?t:ut(!!t),g):u},g.container=function(t){return arguments.length?(a="function"==typeof t?t:ut(t),g):a},g.subject=function(t){return arguments.length?(n="function"==typeof t?t:ut(t),g):n},g.touchable=function(t){return arguments.length?(s="function"==typeof t?t:ut(!!t),g):s},g.on=function(){var t=y.on.apply(y,arguments);return t===y?g:t},g.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,g):Math.sqrt(h)},g},T.easeLinear=function(t){return+t},T.create=function(t){return F(c(t).call(document.documentElement))},T.creator=c,T.local=Q,T.matcher=v,T.mouse=tt,T.namespace=a,T.namespaces=u,T.clientPoint=Z,T.select=F,T.selectAll=function(t){return"string"==typeof t?new G([document.querySelectorAll(t)],[document.documentElement]):new G([null==t?[]:t],U)},T.selection=H,T.selector=p,T.selectorAll=g,T.style=x,T.touch=nt,T.touches=function(t,n){null==n&&(n=J().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=Z(t,n[e]);return i},T.window=_,T.customEvent=B,T.zoom=function(){var p,o,a=xe,c=be,v=Ae,i=Me,n=ke,u=[0,1/0],y=[[-1/0,-1/0],[1/0,1/0]],s=250,l=Tn,h=[],e=q("start","zoom","end"),f=500,d=150,g=0;function m(t){t.property("__zoom",Ne).on("wheel.zoom",r).on("mousedown.zoom",k).on("dblclick.zoom",A).filter(n).on("touchstart.zoom",z).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,n){return(n=Math.max(u[0],Math.min(u[1],n)))===t.k?t:new de(n,t.x,t.y)}function w(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new de(t.k,r,i)}function x(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,s,h){t.on("start.zoom",function(){N(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=N(this,t),n=c.apply(this,t),i=h||x(n),o=Math.max(n[1][0]-n[0][0],n[1][1]-n[0][1]),e=this.__zoom,u="function"==typeof s?s.apply(this,t):s,a=l(e.invert(i).concat(o/e.k),u.invert(i).concat(o/u.k));return function(t){if(1===t)t=u;else{var n=a(t),e=o/n[2];t=new de(e,i[0]-n[0]*e,i[1]-n[1]*e)}r.zoom(null,t)}})}function N(t,n){for(var e,r=0,i=h.length;r<i;++r)if((e=h[r]).that===t)return e;return new M(t,n)}function M(t,n){this.that=t,this.args=n,this.index=-1,this.active=0,this.extent=c.apply(t,n)}function r(){if(a.apply(this,arguments)){var t=N(this,arguments),n=this.__zoom,e=Math.max(u[0],Math.min(u[1],n.k*Math.pow(2,i.apply(this,arguments)))),r=tt(this);if(t.wheel)t.mouse[0][0]===r[0]&&t.mouse[0][1]===r[1]||(t.mouse[1]=n.invert(t.mouse[0]=r)),clearTimeout(t.wheel);else{if(n.k===e)return;t.mouse=[r,n.invert(r)],ee(this),t.start()}we(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},d),t.zoom("mouse",v(w(_(n,e),t.mouse[0],t.mouse[1]),t.extent,y))}}function k(){if(!o&&a.apply(this,arguments)){var e=N(this,arguments),t=F(T.event.view).on("mousemove.zoom",function(){if(we(),!e.moved){var t=T.event.clientX-r,n=T.event.clientY-i;e.moved=g<t*t+n*n}e.zoom("mouse",v(w(e.that.__zoom,e.mouse[0]=tt(e.that),e.mouse[1]),e.extent,y))},!0).on("mouseup.zoom",function(){t.on("mousemove.zoom mouseup.zoom",null),ot(T.event.view,e.moved),we(),e.end()},!0),n=tt(this),r=T.event.clientX,i=T.event.clientY;it(T.event.view),_e(),e.mouse=[n,this.__zoom.invert(n)],ee(this),e.start()}}function A(){if(a.apply(this,arguments)){var t=this.__zoom,n=tt(this),e=t.invert(n),r=t.k*(T.event.shiftKey?.5:2),i=v(w(_(t,r),n,e),c.apply(this,arguments),y);we(),0<s?F(this).transition().duration(s).call(b,i,n):F(this).call(m.transform,i)}}function z(){if(a.apply(this,arguments)){var t,n,e,r,i=N(this,arguments),o=T.event.changedTouches,u=o.length;for(_e(),n=0;n<u;++n)e=o[n],r=[r=nt(this,o,e.identifier),this.__zoom.invert(r),e.identifier],i.touch0?i.touch1||(i.touch1=r):(i.touch0=r,t=!0);if(p&&(p=clearTimeout(p),!i.touch1))return i.end(),void((r=F(this).on("dblclick.zoom"))&&r.apply(this,arguments));t&&(p=setTimeout(function(){p=null},f),ee(this),i.start())}}function E(){var t,n,e,r,i=N(this,arguments),o=T.event.changedTouches,u=o.length;for(we(),p&&(p=clearTimeout(p)),t=0;t<u;++t)n=o[t],e=nt(this,o,n.identifier),i.touch0&&i.touch0[2]===n.identifier?i.touch0[0]=e:i.touch1&&i.touch1[2]===n.identifier&&(i.touch1[0]=e);if(n=i.that.__zoom,i.touch1){var a=i.touch0[0],s=i.touch0[1],h=i.touch1[0],c=i.touch1[1],l=(l=h[0]-a[0])*l+(l=h[1]-a[1])*l,f=(f=c[0]-s[0])*f+(f=c[1]-s[1])*f;n=_(n,Math.sqrt(l/f)),e=[(a[0]+h[0])/2,(a[1]+h[1])/2],r=[(s[0]+c[0])/2,(s[1]+c[1])/2]}else{if(!i.touch0)return;e=i.touch0[0],r=i.touch0[1]}i.zoom("touch",v(w(n,e,r),i.extent,y))}function S(){var t,n,e=N(this,arguments),r=T.event.changedTouches,i=r.length;for(_e(),o&&clearTimeout(o),o=setTimeout(function(){o=null},f),t=0;t<i;++t)n=r[t],e.touch0&&e.touch0[2]===n.identifier?delete e.touch0:e.touch1&&e.touch1[2]===n.identifier&&delete e.touch1;e.touch1&&!e.touch0&&(e.touch0=e.touch1,delete e.touch1),e.touch0?e.touch0[1]=this.__zoom.invert(e.touch0[0]):e.end()}return m.transform=function(t,n){var e=t.selection?t.selection():t;e.property("__zoom",Ne),t!==e?b(t,n):e.interrupt().each(function(){N(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()})},m.scaleBy=function(t,n){m.scaleTo(t,function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)})},m.scaleTo=function(t,o){m.transform(t,function(){var t=c.apply(this,arguments),n=this.__zoom,e=x(t),r=n.invert(e),i="function"==typeof o?o.apply(this,arguments):o;return v(w(_(n,i),e,r),t,y)})},m.translateBy=function(t,n,e){m.transform(t,function(){return v(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),c.apply(this,arguments),y)})},m.translateTo=function(t,r,i){m.transform(t,function(){var t=c.apply(this,arguments),n=this.__zoom,e=x(t);return v(ge.translate(e[0],e[1]).scale(n.k).translate("function"==typeof r?-r.apply(this,arguments):-r,"function"==typeof i?-i.apply(this,arguments):-i),t,y)})},M.prototype={start:function(){return 1==++this.active&&(this.index=h.push(this)-1,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(h.splice(this.index,1),this.index=-1,this.emit("end")),this},emit:function(t){B(new ye(m,t,this.that.__zoom),e.apply,e,[t,this.that,this.args])}},m.wheelDelta=function(t){return arguments.length?(i="function"==typeof t?t:ve(+t),m):i},m.filter=function(t){return arguments.length?(a="function"==typeof t?t:ve(!!t),m):a},m.touchable=function(t){return arguments.length?(n="function"==typeof t?t:ve(!!t),m):n},m.extent=function(t){return arguments.length?(c="function"==typeof t?t:ve([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),m):c},m.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],m):[u[0],u[1]]},m.translateExtent=function(t){return arguments.length?(y[0][0]=+t[0][0],y[1][0]=+t[1][0],y[0][1]=+t[0][1],y[1][1]=+t[1][1],m):[[y[0][0],y[0][1]],[y[1][0],y[1][1]]]},m.constrain=function(t){return arguments.length?(v=t,m):v},m.duration=function(t){return arguments.length?(s=+t,m):s},m.interpolate=function(t){return arguments.length?(l=t,m):l},m.on=function(){var t=e.on.apply(e,arguments);return t===e?m:t},m.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,m):Math.sqrt(g)},m},T.zoomTransform=me,T.zoomIdentity=ge,T.forceCenter=function(o,u){var a;function n(){var t,n,e=a.length,r=0,i=0;for(t=0;t<e;++t)r+=(n=a[t]).x,i+=n.y;for(r=r/e-o,i=i/e-u,t=0;t<e;++t)(n=a[t]).x-=r,n.y-=i}return null==o&&(o=0),null==u&&(u=0),n.initialize=function(t){a=t},n.x=function(t){return arguments.length?(o=+t,n):o},n.y=function(t){return arguments.length?(u=+t,n):u},n},T.forceCollide=function(r){var o,u,d=1,a=1;function n(){for(var t,n,l,f,p,v,y,e=o.length,r=0;r<a;++r)for(n=Xe(o,De,Ve).visitAfter(s),t=0;t<e;++t)l=o[t],v=u[l.index],y=v*v,f=l.x+l.vx,p=l.y+l.vy,n.visit(i);function i(t,n,e,r,i){var o=t.data,u=t.r,a=v+u;if(!o)return f+a<n||r<f-a||p+a<e||i<p-a;if(o.index>l.index){var s=f-o.x-o.vx,h=p-o.y-o.vy,c=s*s+h*h;c<a*a&&(0===s&&(c+=(s=Ee())*s),0===h&&(c+=(h=Ee())*h),c=(a-(c=Math.sqrt(c)))/c*d,l.vx+=(s*=c)*(a=(u*=u)/(y+u)),l.vy+=(h*=c)*a,o.vx-=s*(a=1-a),o.vy-=h*a)}}}function s(t){if(t.data)return t.r=u[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function e(){if(o){var t,n,e=o.length;for(u=new Array(e),t=0;t<e;++t)n=o[t],u[n.index]=+r(n,t,o)}}return"function"!=typeof r&&(r=ze(null==r?1:+r)),n.initialize=function(t){o=t,e()},n.iterations=function(t){return arguments.length?(a=+t,n):a},n.strength=function(t){return arguments.length?(d=+t,n):d},n.radius=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),e(),n):r},n},T.forceLink=function(l){var f,p,o,u,v,a=je,e=function(t){return 1/Math.min(u[t.source.index],u[t.target.index])},r=ze(30),y=1;function n(t){for(var n=0,e=l.length;n<y;++n)for(var r,i,o,u,a,s,h,c=0;c<e;++c)i=(r=l[c]).source,u=(o=r.target).x+o.vx-i.x-i.vx||Ee(),a=o.y+o.vy-i.y-i.vy||Ee(),u*=s=((s=Math.sqrt(u*u+a*a))-p[c])/s*t*f[c],a*=s,o.vx-=u*(h=v[c]),o.vy-=a*h,i.vx+=u*(h=1-h),i.vy+=a*h}function i(){if(o){var t,n,e=o.length,r=l.length,i=Re(o,a);for(t=0,u=new Array(e);t<r;++t)(n=l[t]).index=t,"object"!=typeof n.source&&(n.source=Be(i,n.source)),"object"!=typeof n.target&&(n.target=Be(i,n.target)),u[n.source.index]=(u[n.source.index]||0)+1,u[n.target.index]=(u[n.target.index]||0)+1;for(t=0,v=new Array(r);t<r;++t)n=l[t],v[t]=u[n.source.index]/(u[n.source.index]+u[n.target.index]);f=new Array(r),s(),p=new Array(r),h()}}function s(){if(o)for(var t=0,n=l.length;t<n;++t)f[t]=+e(l[t],t,l)}function h(){if(o)for(var t=0,n=l.length;t<n;++t)p[t]=+r(l[t],t,l)}return null==l&&(l=[]),n.initialize=function(t){o=t,i()},n.links=function(t){return arguments.length?(l=t,i(),n):l},n.id=function(t){return arguments.length?(a=t,n):a},n.iterations=function(t){return arguments.length?(y=+t,n):y},n.strength=function(t){return arguments.length?(e="function"==typeof t?t:ze(+t),s(),n):e},n.distance=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),h(),n):r},n},T.forceManyBody=function(){var i,s,h,c,r=ze(-30),l=1,f=1/0,p=.81;function n(t){var n,e=i.length,r=Xe(i,$e,Ue).visitAfter(o);for(h=t,n=0;n<e;++n)s=i[n],r.visit(u)}function e(){if(i){var t,n,e=i.length;for(c=new Array(e),t=0;t<e;++t)n=i[t],c[n.index]=+r(n,t,i)}}function o(t){var n,e,r,i,o,u=0,a=0;if(t.length){for(r=i=o=0;o<4;++o)(n=t[o])&&(e=Math.abs(n.value))&&(u+=n.value,a+=e,r+=e*n.x,i+=e*n.y);t.x=r/a,t.y=i/a}else for((n=t).x=n.data.x,n.y=n.data.y;u+=c[n.data.index],n=n.next;);t.value=u}function u(t,n,e,r){if(!t.value)return!0;var i=t.x-s.x,o=t.y-s.y,u=r-n,a=i*i+o*o;if(u*u/p<a)return a<f&&(0===i&&(a+=(i=Ee())*i),0===o&&(a+=(o=Ee())*o),a<l&&(a=Math.sqrt(l*a)),s.vx+=i*t.value*h/a,s.vy+=o*t.value*h/a),!0;if(!(t.length||f<=a))for((t.data!==s||t.next)&&(0===i&&(a+=(i=Ee())*i),0===o&&(a+=(o=Ee())*o),a<l&&(a=Math.sqrt(l*a)));t.data!==s&&(u=c[t.data.index]*h/a,s.vx+=i*u,s.vy+=o*u),t=t.next;);}return n.initialize=function(t){i=t,e()},n.strength=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),e(),n):r},n.distanceMin=function(t){return arguments.length?(l=t*t,n):Math.sqrt(l)},n.distanceMax=function(t){return arguments.length?(f=t*t,n):Math.sqrt(f)},n.theta=function(t){return arguments.length?(p=t*t,n):Math.sqrt(p)},n},T.forceRadial=function(e,s,h){var c,l,f,r=ze(.1);function n(t){for(var n=0,e=c.length;n<e;++n){var r=c[n],i=r.x-s||1e-6,o=r.y-h||1e-6,u=Math.sqrt(i*i+o*o),a=(f[n]-u)*l[n]*t/u;r.vx+=i*a,r.vy+=o*a}}function i(){if(c){var t,n=c.length;for(l=new Array(n),f=new Array(n),t=0;t<n;++t)f[t]=+e(c[t],t,c),l[t]=isNaN(f[t])?0:+r(c[t],t,c)}}return"function"!=typeof e&&(e=ze(+e)),null==s&&(s=0),null==h&&(h=0),n.initialize=function(t){c=t,i()},n.strength=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),i(),n):r},n.radius=function(t){return arguments.length?(e="function"==typeof t?t:ze(+t),i(),n):e},n.x=function(t){return arguments.length?(s=+t,n):s},n.y=function(t){return arguments.length?(h=+t,n):h},n},T.forceSimulation=function(c){var e,r=1,n=.001,i=1-Math.pow(n,1/300),o=0,u=.6,a=Re(),t=Bn(h),s=q("tick","end");function h(){l(),s.call("tick",e),r<n&&(t.stop(),s.call("end",e))}function l(){var t,n,e=c.length;for(r+=(o-r)*i,a.each(function(t){t(r)}),t=0;t<e;++t)null==(n=c[t]).fx?n.x+=n.vx*=u:(n.x=n.fx,n.vx=0),null==n.fy?n.y+=n.vy*=u:(n.y=n.fy,n.vy=0)}function f(){for(var t,n=0,e=c.length;n<e;++n){if((t=c[n]).index=n,isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(n),i=n*Ge;t.x=r*Math.cos(i),t.y=r*Math.sin(i)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(c),t}return null==c&&(c=[]),f(),e={tick:l,restart:function(){return t.restart(h),e},stop:function(){return t.stop(),e},nodes:function(t){return arguments.length?(c=t,f(),a.each(p),e):c},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(u=1-t,e):1-u},force:function(t,n){return 1<arguments.length?(null==n?a.remove(t):a.set(t,p(n)),e):a.get(t)},find:function(t,n,e){var r,i,o,u,a,s=0,h=c.length;for(null==e?e=1/0:e*=e,s=0;s<h;++s)(o=(r=t-(u=c[s]).x)*r+(i=n-u.y)*i)<e&&(a=u,e=o);return a},on:function(t,n){return 1<arguments.length?(s.on(t,n),e):s.on(t)}}},T.forceX=function(e){var i,o,u,r=ze(.1);function n(t){for(var n,e=0,r=i.length;e<r;++e)(n=i[e]).vx+=(u[e]-n.x)*o[e]*t}function a(){if(i){var t,n=i.length;for(o=new Array(n),u=new Array(n),t=0;t<n;++t)o[t]=isNaN(u[t]=+e(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof e&&(e=ze(null==e?0:+e)),n.initialize=function(t){i=t,a()},n.strength=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),a(),n):r},n.x=function(t){return arguments.length?(e="function"==typeof t?t:ze(+t),a(),n):e},n},T.forceY=function(e){var i,o,u,r=ze(.1);function n(t){for(var n,e=0,r=i.length;e<r;++e)(n=i[e]).vy+=(u[e]-n.y)*o[e]*t}function a(){if(i){var t,n=i.length;for(o=new Array(n),u=new Array(n),t=0;t<n;++t)o[t]=isNaN(u[t]=+e(i[t],t,i))?0:+r(i[t],t,i)}}return"function"!=typeof e&&(e=ze(null==e?0:+e)),n.initialize=function(t){i=t,a()},n.strength=function(t){return arguments.length?(r="function"==typeof t?t:ze(+t),a(),n):r},n.y=function(t){return arguments.length?(e="function"==typeof t?t:ze(+t),a(),n):e},n},T.transition=se,T.active=function(t,n){var e,r,i=t.__transition;if(i)for(r in n=null==n?null:n+"",i)if(1<(e=i[r]).state&&e.name===n)return new ae([[t]],pe,n,+r);return null},T.interrupt=ee,T}({}); |