Skip to content

Instantly share code, notes, and snippets.

@john-guerra
Created September 13, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-guerra/63a207310f2eb1b3ad0b986db6b8ef85 to your computer and use it in GitHub Desktop.
Save john-guerra/63a207310f2eb1b3ad0b986db6b8ef85 to your computer and use it in GitHub Desktop.
// https://github.com/john-guerra/Navio#readme v0.0.2 Copyright 2018 John Alexis Guerra Gómez
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.navio=e()}(this,function(){"use strict";function t(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var e,n,r=(1===(e=t).length&&(n=e,e=function(e,r){return t(n(e),r)}),{left:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){var a=r+i>>>1;e(t[a],n)<0?r=a+1:i=a}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){var a=r+i>>>1;e(t[a],n)>0?i=a:r=a+1}return r}}).right;function i(t,e){var n,r,i,a=t.length,o=-1;if(null==e){for(;++o<a;)if(null!=(n=t[o])&&n>=n)for(r=i=n;++o<a;)null!=(n=t[o])&&(r>n&&(r=n),i<n&&(i=n))}else for(;++o<a;)if(null!=(n=e(t[o],o,t))&&n>=n)for(r=i=n;++o<a;)null!=(n=e(t[o],o,t))&&(r>n&&(r=n),i<n&&(i=n));return[r,i]}var a=Math.sqrt(50),o=Math.sqrt(10),u=Math.sqrt(2);function c(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),c=r/Math.pow(10,i);return i>=0?(c>=a?10:c>=o?5:c>=u?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(c>=a?10:c>=o?5:c>=u?2:1)}var s={value:function(){}};function f(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new l(r)}function l(t){this._=t}function h(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function d(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=s,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}l.prototype=f.prototype={constructor:l,on:function(t,e){var n,r,i=this._,a=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,u=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<u;)if(n=(t=a[o]).type)i[n]=d(i[n],t.name,e);else if(null==e)for(n in i)i[n]=d(i[n],t.name,null);return this}for(;++o<u;)if((n=(t=a[o]).type)&&(n=h(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new l(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var p="http://www.w3.org/1999/xhtml",g={svg:"http://www.w3.org/2000/svg",xhtml:p,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function v(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),g.hasOwnProperty(e)?{space:g[e],local:t}:t}function y(t){var e=v(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===p&&e.documentElement.namespaceURI===p?e.createElement(t):e.createElementNS(n,t)}})(e)}function b(){}function m(t){return null==t?b:function(){return this.querySelector(t)}}function _(){return[]}function w(t){return null==t?_:function(){return this.querySelectorAll(t)}}var x=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var M=document.documentElement;if(!M.matches){var T=M.webkitMatchesSelector||M.msMatchesSelector||M.mozMatchesSelector||M.oMatchesSelector;x=function(t){return function(){return T.call(this,t)}}}}var A=x;function C(t){return new Array(t.length)}function N(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}N.prototype={constructor:N,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var k="$";function S(t,e,n,r,i,a){for(var o,u=0,c=e.length,s=a.length;u<s;++u)(o=e[u])?(o.__data__=a[u],r[u]=o):n[u]=new N(t,a[u]);for(;u<c;++u)(o=e[u])&&(i[u]=o)}function D(t,e,n,r,i,a,o){var u,c,s,f={},l=e.length,h=a.length,d=new Array(l);for(u=0;u<l;++u)(c=e[u])&&(d[u]=s=k+o.call(c,c.__data__,u,e),s in f?i[u]=c:f[s]=c);for(u=0;u<h;++u)(c=f[s=k+o.call(t,a[u],u,a)])?(r[u]=c,c.__data__=a[u],f[s]=null):n[u]=new N(t,a[u]);for(u=0;u<l;++u)(c=e[u])&&f[d[u]]===c&&(i[u]=c)}function U(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function E(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function P(t,e){return t.style.getPropertyValue(e)||E(t).getComputedStyle(t,null).getPropertyValue(e)}function F(t){return t.trim().split(/^|\s+/)}function z(t){return t.classList||new Y(t)}function Y(t){this._node=t,this._names=F(t.getAttribute("class")||"")}function I(t,e){for(var n=z(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function O(t,e){for(var n=z(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function q(){this.textContent=""}function L(){this.innerHTML=""}function H(){this.nextSibling&&this.parentNode.appendChild(this)}function j(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function V(){return null}function $(){var t=this.parentNode;t&&t.removeChild(this)}function X(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function R(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}Y.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var W={},B=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(W={mouseenter:"mouseover",mouseleave:"mouseout"}));function Z(t,e,n){return t=Q(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function Q(t,e,n){return function(r){var i=B;B=r;try{t.call(this,this.__data__,e,n)}finally{B=i}}}function J(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r<a;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.capture);++i?e.length=i:delete this.__on}}}function G(t,e,n){var r=W.hasOwnProperty(t.type)?Z:Q;return function(i,a,o){var u,c=this.__on,s=r(e,a,o);if(c)for(var f=0,l=c.length;f<l;++f)if((u=c[f]).type===t.type&&u.name===t.name)return this.removeEventListener(u.type,u.listener,u.capture),this.addEventListener(u.type,u.listener=s,u.capture=n),void(u.value=e);this.addEventListener(t.type,s,n),u={type:t.type,name:t.name,value:e,listener:s,capture:n},c?c.push(u):this.__on=[u]}}function K(t,e,n,r){var i=B;t.sourceEvent=B,B=t;try{return e.apply(n,r)}finally{B=i}}function tt(t,e,n){var r=E(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}var et=[null];function nt(t,e){this._groups=t,this._parents=e}function rt(){return new nt([[document.documentElement]],et)}function it(t){return"string"==typeof t?new nt([[document.querySelector(t)]],[document.documentElement]):new nt([[t]],et)}function at(){for(var t,e=B;t=e.sourceEvent;)e=t;return e}function ot(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}function ut(t){var e=at();return e.changedTouches&&(e=e.changedTouches[0]),ot(t,e)}function ct(t,e,n){arguments.length<3&&(n=e,e=at().changedTouches);for(var r,i=0,a=e?e.length:0;i<a;++i)if((r=e[i]).identifier===n)return ot(t,r);return null}function st(){B.stopImmediatePropagation()}function ft(){B.preventDefault(),B.stopImmediatePropagation()}function lt(t){var e=t.document.documentElement,n=it(t).on("dragstart.drag",ft,!0);"onselectstart"in e?n.on("selectstart.drag",ft,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ht(t,e){var n=t.document.documentElement,r=it(t).on("dragstart.drag",null);e&&(r.on("click.drag",ft,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function dt(t){return function(){return t}}function pt(t,e,n,r,i,a,o,u,c,s){this.target=t,this.type=e,this.subject=n,this.identifier=r,this.active=i,this.x=a,this.y=o,this.dx=u,this.dy=c,this._=s}function gt(){return!B.button}function vt(){return this.parentNode}function yt(t){return null==t?{x:B.x,y:B.y}:t}function bt(){return"ontouchstart"in this}function mt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function _t(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function wt(){}nt.prototype=rt.prototype={constructor:nt,select:function(t){"function"!=typeof t&&(t=m(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o,u=e[i],c=u.length,s=r[i]=new Array(c),f=0;f<c;++f)(a=u[f])&&(o=t.call(a,a.__data__,f,u))&&("__data__"in a&&(o.__data__=a.__data__),s[f]=o);return new nt(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=w(t));for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o,u=e[a],c=u.length,s=0;s<c;++s)(o=u[s])&&(r.push(t.call(o,o.__data__,s,u)),i.push(o));return new nt(r,i)},filter:function(t){"function"!=typeof t&&(t=A(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],u=o.length,c=r[i]=[],s=0;s<u;++s)(a=o[s])&&t.call(a,a.__data__,s,o)&&c.push(a);return new nt(r,this._parents)},data:function(t,e){if(!t)return p=new Array(this.size()),f=-1,this.each(function(t){p[++f]=t}),p;var n,r=e?D:S,i=this._parents,a=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var o=a.length,u=new Array(o),c=new Array(o),s=new Array(o),f=0;f<o;++f){var l=i[f],h=a[f],d=h.length,p=t.call(l,l&&l.__data__,f,i),g=p.length,v=c[f]=new Array(g),y=u[f]=new Array(g);r(l,h,v,y,s[f]=new Array(d),p,e);for(var b,m,_=0,w=0;_<g;++_)if(b=v[_]){for(_>=w&&(w=_+1);!(m=y[w])&&++w<g;);b._next=m||null}}return(u=new nt(u,i))._enter=c,u._exit=s,u},enter:function(){return new nt(this._enter||this._groups.map(C),this._parents)},exit:function(){return new nt(this._exit||this._groups.map(C),this._parents)},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),u=0;u<a;++u)for(var c,s=e[u],f=n[u],l=s.length,h=o[u]=new Array(l),d=0;d<l;++d)(c=s[d]||f[d])&&(h[d]=c);for(;u<r;++u)o[u]=e[u];return new nt(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=U);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,u=n[a],c=u.length,s=i[a]=new Array(c),f=0;f<c;++f)(o=u[f])&&(s[f]=o);s.sort(e)}return new nt(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()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,a=e[n],o=0,u=a.length;o<u;++o)(i=a[o])&&t.call(i,i.__data__,o,a);return this},attr:function(t,e){var n=v(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):P(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=F(t+"");if(arguments.length<2){for(var r=z(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?I:O)(this,t)}}:e?function(t){return function(){I(this,t)}}:function(t){return function(){O(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?q:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?L:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(H)},lower:function(){return this.each(j)},append:function(t){var e="function"==typeof t?t:y(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:y(t),r=null==e?V:"function"==typeof e?e:m(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each($)},clone:function(t){return this.select(t?R:X)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=a.length;if(!(arguments.length<2)){for(u=e?G:J,null==n&&(n=!1),r=0;r<o;++r)this.each(u(a[r],e,n));return this}var u=this.node().__on;if(u)for(var c,s=0,f=u.length;s<f;++s)for(r=0,c=u[s];r<o;++r)if((i=a[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return tt(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return tt(this,t,e)}})(t,e))}},pt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var xt="\\s*([+-]?\\d+)\\s*",Mt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",At=/^#([0-9a-f]{3})$/,Ct=/^#([0-9a-f]{6})$/,Nt=new RegExp("^rgb\\("+[xt,xt,xt]+"\\)$"),kt=new RegExp("^rgb\\("+[Tt,Tt,Tt]+"\\)$"),St=new RegExp("^rgba\\("+[xt,xt,xt,Mt]+"\\)$"),Dt=new RegExp("^rgba\\("+[Tt,Tt,Tt,Mt]+"\\)$"),Ut=new RegExp("^hsl\\("+[Mt,Tt,Tt]+"\\)$"),Et=new RegExp("^hsla\\("+[Mt,Tt,Tt,Mt]+"\\)$"),Pt={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 Ft(t){var e;return t=(t+"").trim().toLowerCase(),(e=At.exec(t))?new qt((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=Ct.exec(t))?zt(parseInt(e[1],16)):(e=Nt.exec(t))?new qt(e[1],e[2],e[3],1):(e=kt.exec(t))?new qt(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=St.exec(t))?Yt(e[1],e[2],e[3],e[4]):(e=Dt.exec(t))?Yt(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ut.exec(t))?Lt(e[1],e[2]/100,e[3]/100,1):(e=Et.exec(t))?Lt(e[1],e[2]/100,e[3]/100,e[4]):Pt.hasOwnProperty(t)?zt(Pt[t]):"transparent"===t?new qt(NaN,NaN,NaN,0):null}function zt(t){return new qt(t>>16&255,t>>8&255,255&t,1)}function Yt(t,e,n,r){return r<=0&&(t=e=n=NaN),new qt(t,e,n,r)}function It(t){return t instanceof wt||(t=Ft(t)),t?new qt((t=t.rgb()).r,t.g,t.b,t.opacity):new qt}function Ot(t,e,n,r){return 1===arguments.length?It(t):new qt(t,e,n,null==r?1:r)}function qt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Lt(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ht(t,e,n,r)}function Ht(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function jt(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}mt(wt,Ft,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),mt(qt,Ot,_t(wt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new qt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new qt(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},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+")")}})),mt(Ht,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Ht)return new Ht(t.h,t.s,t.l,t.opacity);if(t instanceof wt||(t=Ft(t)),!t)return new Ht;if(t instanceof Ht)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,u=a-i,c=(a+i)/2;return u?(o=e===a?(n-r)/u+6*(n<r):n===a?(r-e)/u+2:(e-n)/u+4,u/=c<.5?a+i:2-a-i,o*=60):u=c>0&&c<1?0:o,new Ht(o,u,c,t.opacity)}(t):new Ht(t,e,n,null==r?1:r)},_t(wt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ht(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ht(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qt(jt(t>=240?t-240:t+120,i,r),jt(t,i,r),jt(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,$t=180/Math.PI,Xt=.95047,Rt=1,Wt=1.08883,Bt=4/29,Zt=6/29,Qt=3*Zt*Zt,Jt=Zt*Zt*Zt;function Gt(t){if(t instanceof Kt)return new Kt(t.l,t.a,t.b,t.opacity);if(t instanceof ie){var e=t.h*Vt;return new Kt(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof qt||(t=It(t));var n=re(t.r),r=re(t.g),i=re(t.b),a=te((.4124564*n+.3575761*r+.1804375*i)/Xt),o=te((.2126729*n+.7151522*r+.072175*i)/Rt);return new Kt(116*o-16,500*(a-o),200*(o-te((.0193339*n+.119192*r+.9503041*i)/Wt)),t.opacity)}function Kt(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function te(t){return t>Jt?Math.pow(t,1/3):t/Qt+Bt}function ee(t){return t>Zt?t*t*t:Qt*(t-Bt)}function ne(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function re(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ie(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}mt(Kt,function(t,e,n,r){return 1===arguments.length?Gt(t):new Kt(t,e,n,null==r?1:r)},_t(wt,{brighter:function(t){return new Kt(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Kt(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=Rt*ee(t),new qt(ne(3.2404542*(e=Xt*ee(e))-1.5371385*t-.4985314*(n=Wt*ee(n))),ne(-.969266*e+1.8760108*t+.041556*n),ne(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),mt(ie,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof ie)return new ie(t.h,t.c,t.l,t.opacity);t instanceof Kt||(t=Gt(t));var e=Math.atan2(t.b,t.a)*$t;return new ie(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new ie(t,e,n,null==r?1:r)},_t(wt,{brighter:function(t){return new ie(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new ie(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Gt(this).rgb()}}));var ae=-.14861,oe=1.78277,ue=-.29227,ce=-.90649,se=1.97294,fe=se*ce,le=se*oe,he=oe*ue-ce*ae;function de(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof pe)return new pe(t.h,t.s,t.l,t.opacity);t instanceof qt||(t=It(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(he*r+fe*e-le*n)/(he+fe-le),a=r-i,o=(se*(n-i)-ue*a)/ce,u=Math.sqrt(o*o+a*a)/(se*i*(1-i)),c=u?Math.atan2(o,a)*$t-120:NaN;return new pe(c<0?c+360:c,u,i,t.opacity)}(t):new pe(t,e,n,null==r?1:r)}function pe(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function ge(t){return function(){return t}}function ve(t,e){return function(n){return t+n*e}}function ye(t){return 1==(t=+t)?be:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):ge(isNaN(e)?n:e)}}function be(t,e){var n=e-t;return n?ve(t,n):ge(isNaN(t)?e:t)}mt(pe,de,_t(wt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new pe(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new pe(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Vt,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new qt(255*(e+n*(ae*r+oe*i)),255*(e+n*(ue*r+ce*i)),255*(e+n*(se*r)),this.opacity)}}));var me=function t(e){var n=ye(e);function r(t,e){var r=n((t=Ot(t)).r,(e=Ot(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=be(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function _e(t,e){return e-=t=+t,function(n){return t+e*n}}var we=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xe=new RegExp(we.source,"g");function Me(t,e){var n,r,i,a=we.lastIndex=xe.lastIndex=0,o=-1,u=[],c=[];for(t+="",e+="";(n=we.exec(t))&&(r=xe.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),u[o]?u[o]+=i:u[++o]=i),(n=n[0])===(r=r[0])?u[o]?u[o]+=r:u[++o]=r:(u[++o]=null,c.push({i:o,x:_e(n,r)})),a=xe.lastIndex;return a<e.length&&(i=e.slice(a),u[o]?u[o]+=i:u[++o]=i),u.length<2?c[0]?function(t){return function(e){return t(e)+""}}(c[0].x):function(t){return function(){return t}}(e):(e=c.length,function(t){for(var n,r=0;r<e;++r)u[(n=c[r]).i]=n.x(t);return u.join("")})}function Te(t,e){var n,r=typeof e;return null==e||"boolean"===r?ge(e):("number"===r?_e:"string"===r?(n=Ft(e))?(e=n,me):Me:e instanceof Ft?me:e instanceof Date?function(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}}:Array.isArray(e)?function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=Te(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<i;++n)o[n]=a[n](t);return o}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Te(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}:_e)(t,e)}function Ae(t,e){return e-=t=+t,function(n){return Math.round(t+e*n)}}var Ce,Ne,ke,Se,De=180/Math.PI,Ue={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ee(t,e,n,r,i,a){var o,u,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,c/=u),t*r<e*n&&(t=-t,e=-e,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*De,skewX:Math.atan(c)*De,scaleX:o,scaleY:u}}function Pe(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var u=[],c=[];return a=t(a),o=t(o),function(t,r,i,a,o,u){if(t!==i||r!==a){var c=o.push("translate(",null,e,null,n);u.push({i:c-4,x:_e(t,i)},{i:c-2,x:_e(r,a)})}else(i||a)&&o.push("translate("+i+e+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,u,c),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:_e(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,o.rotate,u,c),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:_e(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,o.skewX,u,c),function(t,e,n,r,a,o){if(t!==n||e!==r){var u=a.push(i(a)+"scale(",null,",",null,")");o.push({i:u-4,x:_e(t,n)},{i:u-2,x:_e(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,u,c),a=o=null,function(t){for(var e,n=-1,r=c.length;++n<r;)u[(e=c[n]).i]=e.x(t);return u.join("")}}}var Fe=Pe(function(t){return"none"===t?Ue:(Ce||(Ce=document.createElement("DIV"),Ne=document.documentElement,ke=document.defaultView),Ce.style.transform=t,t=ke.getComputedStyle(Ne.appendChild(Ce),null).getPropertyValue("transform"),Ne.removeChild(Ce),Ee(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),ze=Pe(function(t){return null==t?Ue:(Se||(Se=document.createElementNS("http://www.w3.org/2000/svg","g")),Se.setAttribute("transform",t),(t=Se.transform.baseVal.consolidate())?Ee((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Ue)},", ",")",")");Math.SQRT2;function Ye(t){return function e(n){function r(e,r){var i=t((e=de(e)).h,(r=de(r)).h),a=be(e.s,r.s),o=be(e.l,r.l),u=be(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=a(t),e.l=o(Math.pow(t,n)),e.opacity=u(t),e+""}}return n=+n,r.gamma=e,r}(1)}Ye(function(t,e){var n=e-t;return n?ve(t,n>180||n<-180?n-360*Math.round(n/360):n):ge(isNaN(t)?e:t)});var Ie,Oe,qe=Ye(be),Le=0,He=0,je=0,Ve=1e3,$e=0,Xe=0,Re=0,We="object"==typeof performance&&performance.now?performance:Date,Be="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ze(){return Xe||(Be(Qe),Xe=We.now()+Re)}function Qe(){Xe=0}function Je(){this._call=this._time=this._next=null}function Ge(t,e,n){var r=new Je;return r.restart(t,e,n),r}function Ke(){Xe=($e=We.now())+Re,Le=He=0;try{!function(){Ze(),++Le;for(var t,e=Ie;e;)(t=Xe-e._time)>=0&&e._call.call(null,t),e=e._next;--Le}()}finally{Le=0,function(){var t,e,n=Ie,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Ie=e);Oe=t,en(r)}(),Xe=0}}function tn(){var t=We.now(),e=t-$e;e>Ve&&(Re-=e,$e=t)}function en(t){Le||(He&&(He=clearTimeout(He)),t-Xe>24?(t<1/0&&(He=setTimeout(Ke,t-We.now()-Re)),je&&(je=clearInterval(je))):(je||($e=We.now(),je=setInterval(tn,Ve)),Le=1,Be(Ke)))}function nn(t,e,n){var r=new Je;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r}Je.prototype=Ge.prototype={constructor:Je,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Ze():+n)+(null==e?0:+e),this._next||Oe===this||(Oe?Oe._next=this:Ie=this,Oe=this),this._call=t,this._time=n,en()},stop:function(){this._call&&(this._call=null,this._time=1/0,en())}};var rn=f("start","end","interrupt"),an=[],on=0,un=1,cn=2,sn=3,fn=4,ln=5,hn=6;function dn(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(c){var s,f,l,h;if(n.state!==un)return u();for(s in i)if((h=i[s]).name===n.name){if(h.state===sn)return nn(a);h.state===fn?(h.state=hn,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[s]):+s<e&&(h.state=hn,h.timer.stop(),delete i[s])}if(nn(function(){n.state===sn&&(n.state=fn,n.timer.restart(o,n.delay,n.time),o(c))}),n.state=cn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===cn){for(n.state=sn,r=new Array(l=n.tween.length),s=0,f=-1;s<l;++s)(h=n.tween[s].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function o(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=ln,1),a=-1,o=r.length;++a<o;)r[a].call(null,i);n.state===ln&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var r in n.state=hn,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Ge(function(t){n.state=un,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)},0,n.time)}(t,n,{name:e,index:r,group:i,on:rn,tween:an,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:on})}function pn(t,e){var n=vn(t,e);if(n.state>on)throw new Error("too late; already scheduled");return n}function gn(t,e){var n=vn(t,e);if(n.state>cn)throw new Error("too late; already started");return n}function vn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function yn(t,e){var n,r,i,a=t.__transition,o=!0;if(a){for(i in e=null==e?null:e+"",a)(n=a[i]).name===e?(r=n.state>cn&&n.state<ln,n.state=hn,n.timer.stop(),r&&n.on.call("interrupt",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}}function bn(t,e,n){var r=t._id;return t.each(function(){var t=gn(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return vn(t,r).value[e]}}function mn(t,e){var n;return("number"==typeof e?_e:e instanceof Ft?me:(n=Ft(e))?(e=n,me):Me)(t,e)}var _n=rt.prototype.constructor;var wn=0;function xn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Mn(){return++wn}var Tn=rt.prototype;xn.prototype=function(t){return rt().transition(t)}.prototype={constructor:xn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=m(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var u,c,s=r[o],f=s.length,l=a[o]=new Array(f),h=0;h<f;++h)(u=s[h])&&(c=t.call(u,u.__data__,h,s))&&("__data__"in u&&(c.__data__=u.__data__),l[h]=c,dn(l[h],e,n,h,l,vn(u,n)));return new xn(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=w(t));for(var r=this._groups,i=r.length,a=[],o=[],u=0;u<i;++u)for(var c,s=r[u],f=s.length,l=0;l<f;++l)if(c=s[l]){for(var h,d=t.call(c,c.__data__,l,s),p=vn(c,n),g=0,v=d.length;g<v;++g)(h=d[g])&&dn(h,e,n,g,d,p);a.push(d),o.push(c)}return new xn(a,o,e,n)},filter:function(t){"function"!=typeof t&&(t=A(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],u=o.length,c=r[i]=[],s=0;s<u;++s)(a=o[s])&&t.call(a,a.__data__,s,o)&&c.push(a);return new xn(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),u=0;u<a;++u)for(var c,s=e[u],f=n[u],l=s.length,h=o[u]=new Array(l),d=0;d<l;++d)(c=s[d]||f[d])&&(h[d]=c);for(;u<r;++u)o[u]=e[u];return new xn(o,this._parents,this._name,this._id)},selection:function(){return new _n(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Mn(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,u=r[a],c=u.length,s=0;s<c;++s)if(o=u[s]){var f=vn(o,e);dn(o,t,n,s,u,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new xn(r,this._parents,t,n)},call:Tn.call,nodes:Tn.nodes,node:Tn.node,size:Tn.size,empty:Tn.empty,each:Tn.each,on:function(t,e){var n=this._id;return arguments.length<2?vn(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?pn:gn;return function(){var o=a(this,t),u=o.on;u!==r&&(i=(r=u).copy()).on(e,n),o.on=i}}(n,t,e))},attr:function(t,e){var n=v(t),r="transform"===n?ze:mn;return this.attrTween(t,"function"==typeof e?(n.local?function(t,e,n){var r,i,a;return function(){var o,u=n(this);if(null!=u)return(o=this.getAttributeNS(t.space,t.local))===u?null:o===r&&u===i?a:a=e(r=o,i=u);this.removeAttributeNS(t.space,t.local)}}:function(t,e,n){var r,i,a;return function(){var o,u=n(this);if(null!=u)return(o=this.getAttribute(t))===u?null:o===r&&u===i?a:a=e(r=o,i=u);this.removeAttribute(t)}})(n,r,bn(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(t,e,n){var r,i;return function(){var a=this.getAttributeNS(t.space,t.local);return a===n?null:a===r?i:i=e(r=a,n)}}:function(t,e,n){var r,i;return function(){var a=this.getAttribute(t);return a===n?null:a===r?i:i=e(r=a,n)}})(n,r,e+""))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=v(t);return this.tween(n,(r.local?function(t,e){function n(){var n=this,r=e.apply(n,arguments);return r&&function(e){n.setAttributeNS(t.space,t.local,r(e))}}return n._value=e,n}:function(t,e){function n(){var n=this,r=e.apply(n,arguments);return r&&function(e){n.setAttribute(t,r(e))}}return n._value=e,n})(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Fe:mn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=P(this,t),o=(this.style.removeProperty(t),P(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof e?function(t,e,n){var r,i,a;return function(){var o=P(this,t),u=n(this);return null==u&&(this.style.removeProperty(t),u=P(this,t)),o===u?null:o===r&&u===i?a:a=e(r=o,i=u)}}(t,r,bn(this,"style."+t,e)):function(t,e,n){var r,i;return function(){var a=P(this,t);return a===n?null:a===r?i:i=e(r=a,n)}}(t,r,e+""),n)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){function r(){var r=this,i=e.apply(r,arguments);return i&&function(e){r.style.setProperty(t,i(e),n)}}return r._value=e,r}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(bn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=vn(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===t)return r.value;return null}return this.each((null==e?function(t,e){var n,r;return function(){var i=gn(this,t),a=i.tween;if(a!==n)for(var o=0,u=(r=n=a).length;o<u;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}i.tween=r}}:function(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=gn(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var u={name:e,value:n},c=0,s=i.length;c<s;++c)if(i[c].name===e){i[c]=u;break}c===s&&i.push(u)}a.tween=i}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){pn(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){pn(this,t).delay=e}})(e,t)):vn(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){gn(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){gn(this,t).duration=e}})(e,t)):vn(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){gn(this,t).ease=e}}(e,t)):vn(this.node(),e).ease}};Math.PI,Math.PI;var An={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Cn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))return An.time=Ze(),An;return n}function Nn(t){return function(){return t}}function kn(t,e,n){this.target=t,this.type=e,this.selection=n}function Sn(){B.stopImmediatePropagation()}function Dn(){B.preventDefault(),B.stopImmediatePropagation()}rt.prototype.interrupt=function(t){return this.each(function(){yn(this,t)})},rt.prototype.transition=function(t){var e,n;t instanceof xn?(e=t._id,t=t._name):(e=Mn(),(n=An).time=Ze(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,u=r[a],c=u.length,s=0;s<c;++s)(o=u[s])&&dn(o,t,e,s,u,n||Cn(o,e));return new xn(r,this._parents,t,e)};var Un={name:"drag"},En={name:"space"},Pn={name:"handle"},Fn={name:"center"},zn={name:"x",handles:["e","w"].map(jn),input:function(t,e){return t&&[[t[0],e[0][1]],[t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Yn={name:"y",handles:["n","s"].map(jn),input:function(t,e){return t&&[[e[0][0],t[0]],[e[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},In={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},On={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},qn={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ln={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Hn={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function jn(t){return{type:t}}function Vn(){return!B.button}function $n(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function Xn(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function Rn(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Wn(){return function(t){var e,n=$n,r=Vn,i=f(o,"start","brush","end"),a=6;function o(e){var n=e.property("__brush",h).selectAll(".overlay").data([jn("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",In.overlay).merge(n).each(function(){var t=Xn(this).extent;it(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([jn("selection")]).enter().append("rect").attr("class","selection").attr("cursor",In.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return In[t.type]}),e.each(u).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",l)}function u(){var t=it(this),e=Xn(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-a/2:e[0][0]-a/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-a/2:e[0][1]-a/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+a:a}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+a:a})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function c(t,e){return t.__brush.emitter||new s(t,e)}function s(t,e){this.that=t,this.args=e,this.state=t.__brush,this.active=0}function l(){if(B.touches){if(B.changedTouches.length<B.touches.length)return Dn()}else if(e)return;if(r.apply(this,arguments)){var n,i,a,o,s,f,l,h,d,p,g,v,y,b=this,m=B.target.__data__.type,_="selection"===(B.metaKey?m="overlay":m)?Un:B.altKey?Fn:Pn,w=t===Yn?null:Ln[m],x=t===zn?null:Hn[m],M=Xn(b),T=M.extent,A=M.selection,C=T[0][0],N=T[0][1],k=T[1][0],S=T[1][1],D=w&&x&&B.shiftKey,U=ut(b),E=U,P=c(b,arguments).beforestart();"overlay"===m?M.selection=A=[[n=t===Yn?C:U[0],a=t===zn?N:U[1]],[s=t===Yn?k:n,l=t===zn?S:a]]:(n=A[0][0],a=A[0][1],s=A[1][0],l=A[1][1]),i=n,o=a,f=s,h=l;var F=it(b).attr("pointer-events","none"),z=F.selectAll(".overlay").attr("cursor",In[m]);if(B.touches)F.on("touchmove.brush",I,!0).on("touchend.brush touchcancel.brush",q,!0);else{var Y=it(B.view).on("keydown.brush",function(){switch(B.keyCode){case 16:D=w&&x;break;case 18:_===Pn&&(w&&(s=f-d*w,n=i+d*w),x&&(l=h-p*x,a=o+p*x),_=Fn,O());break;case 32:_!==Pn&&_!==Fn||(w<0?s=f-d:w>0&&(n=i-d),x<0?l=h-p:x>0&&(a=o-p),_=En,z.attr("cursor",In.selection),O());break;default:return}Dn()},!0).on("keyup.brush",function(){switch(B.keyCode){case 16:D&&(v=y=D=!1,O());break;case 18:_===Fn&&(w<0?s=f:w>0&&(n=i),x<0?l=h:x>0&&(a=o),_=Pn,O());break;case 32:_===En&&(B.altKey?(w&&(s=f-d*w,n=i+d*w),x&&(l=h-p*x,a=o+p*x),_=Fn):(w<0?s=f:w>0&&(n=i),x<0?l=h:x>0&&(a=o),_=Pn),z.attr("cursor",In[m]),O());break;default:return}Dn()},!0).on("mousemove.brush",I,!0).on("mouseup.brush",q,!0);lt(B.view)}Sn(),yn(b),u.call(b),P.start()}function I(){var t=ut(b);!D||v||y||(Math.abs(t[0]-E[0])>Math.abs(t[1]-E[1])?y=!0:v=!0),E=t,g=!0,Dn(),O()}function O(){var t;switch(d=E[0]-U[0],p=E[1]-U[1],_){case En:case Un:w&&(d=Math.max(C-n,Math.min(k-s,d)),i=n+d,f=s+d),x&&(p=Math.max(N-a,Math.min(S-l,p)),o=a+p,h=l+p);break;case Pn:w<0?(d=Math.max(C-n,Math.min(k-n,d)),i=n+d,f=s):w>0&&(d=Math.max(C-s,Math.min(k-s,d)),i=n,f=s+d),x<0?(p=Math.max(N-a,Math.min(S-a,p)),o=a+p,h=l):x>0&&(p=Math.max(N-l,Math.min(S-l,p)),o=a,h=l+p);break;case Fn:w&&(i=Math.max(C,Math.min(k,n-d*w)),f=Math.max(C,Math.min(k,s+d*w))),x&&(o=Math.max(N,Math.min(S,a-p*x)),h=Math.max(N,Math.min(S,l+p*x)))}f<i&&(w*=-1,t=n,n=s,s=t,t=i,i=f,f=t,m in On&&z.attr("cursor",In[m=On[m]])),h<o&&(x*=-1,t=a,a=l,l=t,t=o,o=h,h=t,m in qn&&z.attr("cursor",In[m=qn[m]])),M.selection&&(A=M.selection),v&&(i=A[0][0],f=A[1][0]),y&&(o=A[0][1],h=A[1][1]),A[0][0]===i&&A[0][1]===o&&A[1][0]===f&&A[1][1]===h||(M.selection=[[i,o],[f,h]],u.call(b),P.brush())}function q(){if(Sn(),B.touches){if(B.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500),F.on("touchmove.brush touchend.brush touchcancel.brush",null)}else ht(B.view,g),Y.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);F.attr("pointer-events","all"),z.attr("cursor",In.overlay),M.selection&&(A=M.selection),Rn(A)&&(M.selection=null,u.call(b)),P.end()}}function h(){var e=this.__brush||{selection:null};return e.extent=n.apply(this,arguments),e.dim=t,e}return o.move=function(e,n){e.selection?e.on("start.brush",function(){c(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){c(this,arguments).end()}).tween("brush",function(){var e=this,r=e.__brush,i=c(e,arguments),a=r.selection,o=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=Te(a,o);function f(t){r.selection=1===t&&Rn(o)?null:s(t),u.call(e),i.brush()}return a&&o?f:f(1)}):e.each(function(){var e=arguments,r=this.__brush,i=t.input("function"==typeof n?n.apply(this,e):n,r.extent),a=c(this,e).beforestart();yn(this),r.selection=null==i||Rn(i)?null:i,u.call(this),a.start().brush().end()})},s.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(e){K(new kn(o,e,t.output(this.state.selection)),i.apply,i,[e,this.that,this.args])}},o.extent=function(t){return arguments.length?(n="function"==typeof t?t:Nn([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),o):n},o.filter=function(t){return arguments.length?(r="function"==typeof t?t:Nn(!!t),o):r},o.handleSize=function(t){return arguments.length?(a=+t,o):a},o.on=function(){var t=i.on.apply(i,arguments);return t===i?o:t},o}(Yn)}Math.PI;var Bn=Math.PI,Zn=2*Bn,Qn=Zn-1e-6;function Jn(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Gn(){return new Jn}Jn.prototype=Gn.prototype={constructor:Jn,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,u=n-t,c=r-e,s=a-t,f=o-e,l=s*s+f*f;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(l>1e-6)if(Math.abs(f*u-c*s)>1e-6&&i){var h=n-a,d=r-o,p=u*u+c*c,g=h*h+d*d,v=Math.sqrt(p),y=Math.sqrt(l),b=i*Math.tan((Bn-Math.acos((p+l-g)/(2*v*y)))/2),m=b/y,_=b/v;Math.abs(m-1)>1e-6&&(this._+="L"+(t+m*s)+","+(e+m*f)),this._+="A"+i+","+i+",0,0,"+ +(f*h>s*d)+","+(this._x1=t+_*u)+","+(this._y1=e+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e;var o=(n=+n)*Math.cos(r),u=n*Math.sin(r),c=t+o,s=e+u,f=1^a,l=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+c+","+s),n&&(l<0&&(l=l%Zn+Zn),l>Qn?this._+="A"+n+","+n+",0,1,"+f+","+(t-o)+","+(e-u)+"A"+n+","+n+",0,1,"+f+","+(this._x1=c)+","+(this._y1=s):l>1e-6&&(this._+="A"+n+","+n+",0,"+ +(l>=Bn)+","+f+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};function Kn(){}function tr(t,e){var n=new Kn;if(t instanceof Kn)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}function er(){}Kn.prototype=tr.prototype={constructor:Kn,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var nr=tr.prototype;er.prototype=function(t,e){var n=new er;if(t instanceof er)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}.prototype={constructor:er,has:nr.has,add:function(t){return this["$"+(t+="")]=t,this},remove:nr.remove,clear:nr.clear,values:nr.keys,size:nr.size,empty:nr.empty,each:nr.each};var rr={},ir={},ar=34,or=10,ur=13;function cr(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function sr(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,o=0,u=0,c=a<=0,s=!1;function f(){if(c)return ir;if(s)return s=!1,rr;var e,r,i=o;if(t.charCodeAt(i)===ar){for(;o++<a&&t.charCodeAt(o)!==ar||t.charCodeAt(++o)===ar;);return(e=o)>=a?c=!0:(r=t.charCodeAt(o++))===or?s=!0:r===ur&&(s=!0,t.charCodeAt(o)===or&&++o),t.slice(i+1,e-1).replace(/""/g,'"')}for(;o<a;){if((r=t.charCodeAt(e=o++))===or)s=!0;else if(r===ur)s=!0,t.charCodeAt(o)===or&&++o;else if(r!==n)continue;return t.slice(i,e)}return c=!0,t.slice(i,a)}for(t.charCodeAt(a-1)===or&&--a,t.charCodeAt(a-1)===ur&&--a;(r=f())!==ir;){for(var l=[];r!==rr&&r!==ir;)l.push(r),r=f();e&&null==(l=e(l,u++))||i.push(l)}return i}function i(e){return e.map(a).join(t)}function a(t){return null==t?"":e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,a=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=cr(t);return function(r,i){return e(n(r),i,t)}}(t,e):cr(t)});return a.columns=i||[],a},parseRows:r,format:function(e,n){return null==n&&(n=function(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}(e)),[n.map(a).join(t)].concat(e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})).join("\n")},formatRows:function(t){return t.map(i).join("\n")}}}sr(","),sr("\t");function fr(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,o,u,c,s,f,l,h,d=t._root,p={data:r},g=t._x0,v=t._y0,y=t._x1,b=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((s=e>=(a=(g+y)/2))?g=a:y=a,(f=n>=(o=(v+b)/2))?v=o:b=o,i=d,!(d=d[l=f<<1|s]))return i[l]=p,t;if(u=+t._x.call(null,d.data),c=+t._y.call(null,d.data),e===u&&n===c)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(s=e>=(a=(g+y)/2))?g=a:y=a,(f=n>=(o=(v+b)/2))?v=o:b=o}while((l=f<<1|s)==(h=(c>=o)<<1|u>=a));return i[h]=d,i[l]=p,t}function lr(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function hr(t){return t[0]}function dr(t){return t[1]}function pr(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function gr(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var vr=function(t,e,n){var r=new pr(null==e?hr:e,null==n?dr:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}.prototype=pr.prototype;vr.copy=function(){var t,e,n=new pr(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=gr(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=gr(e));return n},vr.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return fr(this.cover(e,n),e,n,t)},vr.addAll=function(t){var e,n,r,i,a=t.length,o=new Array(a),u=new Array(a),c=1/0,s=1/0,f=-1/0,l=-1/0;for(n=0;n<a;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(o[n]=r,u[n]=i,r<c&&(c=r),r>f&&(f=r),i<s&&(s=i),i>l&&(l=i));for(f<c&&(c=this._x0,f=this._x1),l<s&&(s=this._y0,l=this._y1),this.cover(c,s).cover(f,l),n=0;n<a;++n)fr(this,o[n],u[n],t[n]);return this},vr.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,a=(r=Math.floor(e))+1;else{if(!(n>t||t>i||r>e||e>a))return this;var o,u,c=i-n,s=this._root;switch(u=(e<(r+a)/2)<<1|t<(n+i)/2){case 0:do{(o=new Array(4))[u]=s,s=o}while(a=r+(c*=2),t>(i=n+c)||e>a);break;case 1:do{(o=new Array(4))[u]=s,s=o}while(a=r+(c*=2),(n=i-c)>t||e>a);break;case 2:do{(o=new Array(4))[u]=s,s=o}while(r=a-(c*=2),t>(i=n+c)||r>e);break;case 3:do{(o=new Array(4))[u]=s,s=o}while(r=a-(c*=2),(n=i-c)>t||r>e)}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this},vr.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},vr.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]]},vr.find=function(t,e,n){var r,i,a,o,u,c,s,f=this._x0,l=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new lr(g,f,l,h,d)),null==n?n=1/0:(f=t-n,l=e-n,h=t+n,d=e+n,n*=n);c=p.pop();)if(!(!(g=c.node)||(i=c.x0)>h||(a=c.y0)>d||(o=c.x1)<f||(u=c.y1)<l))if(g.length){var v=(i+o)/2,y=(a+u)/2;p.push(new lr(g[3],v,y,o,u),new lr(g[2],i,y,v,u),new lr(g[1],v,a,o,y),new lr(g[0],i,a,v,y)),(s=(e>=y)<<1|t>=v)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-s],p[p.length-1-s]=c)}else{var b=t-+this._x.call(null,g.data),m=e-+this._y.call(null,g.data),_=b*b+m*m;if(_<n){var w=Math.sqrt(n=_);f=t-w,l=e-w,h=t+w,d=e+w,r=g.data}}return r},vr.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,n,r,i,a,o,u,c,s,f,l,h,d=this._root,p=this._x0,g=this._y0,v=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((s=a>=(u=(p+v)/2))?p=u:v=u,(f=o>=(c=(g+y)/2))?g=c:y=c,e=d,!(d=d[l=f<<1|s]))return this;if(!d.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[l]=i:delete e[l],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},vr.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},vr.root=function(){return this._root},vr.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},vr.visit=function(t){var e,n,r,i,a,o,u=[],c=this._root;for(c&&u.push(new lr(c,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(c=e.node,r=e.x0,i=e.y0,a=e.x1,o=e.y1)&&c.length){var s=(r+a)/2,f=(i+o)/2;(n=c[3])&&u.push(new lr(n,s,f,a,o)),(n=c[2])&&u.push(new lr(n,r,f,s,o)),(n=c[1])&&u.push(new lr(n,s,i,a,f)),(n=c[0])&&u.push(new lr(n,r,i,s,f))}return this},vr.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new lr(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var a,o=e.x0,u=e.y0,c=e.x1,s=e.y1,f=(o+c)/2,l=(u+s)/2;(a=i[0])&&n.push(new lr(a,o,u,f,l)),(a=i[1])&&n.push(new lr(a,f,u,c,l)),(a=i[2])&&n.push(new lr(a,o,l,f,s)),(a=i[3])&&n.push(new lr(a,f,l,c,s))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},vr.x=function(t){return arguments.length?(this._x=t,this):this._x},vr.y=function(t){return arguments.length?(this._y=t,this):this._y};var yr;Math.PI,Math.sqrt(5);function br(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function mr(t){return(t=br(Math.abs(t)))?t[1]:NaN}function _r(t,e){var n=br(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var wr={"":function(t,e){t:for(var n,r=(t=t.toPrecision(e)).length,i=1,a=-1;i<r;++i)switch(t[i]){case".":a=n=i;break;case"0":0===a&&(a=i),n=i;break;case"e":break t;default:a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(n+1):t},"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return _r(100*t,e)},r:_r,s:function(t,e){var n=br(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(yr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+br(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},xr=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function Mr(t){return new Tr(t)}function Tr(t){if(!(e=xr.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",r=e[2]||">",i=e[3]||"-",a=e[4]||"",o=!!e[5],u=e[6]&&+e[6],c=!!e[7],s=e[8]&&+e[8].slice(1),f=e[9]||"";"n"===f?(c=!0,f="g"):wr[f]||(f=""),(o||"0"===n&&"="===r)&&(o=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=a,this.zero=o,this.width=u,this.comma=c,this.precision=s,this.type=f}function Ar(t){return t}Mr.prototype=Tr.prototype,Tr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Cr,Nr,kr,Sr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Dr(t){var e,n,r=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,r){for(var i=t.length,a=[],o=0,u=e[0],c=0;i>0&&u>0&&(c+u+1>r&&(u=Math.max(1,r-c)),a.push(t.substring(i-=u,i+u)),!((c+=u+1)>r));)u=e[o=(o+1)%e.length];return a.reverse().join(n)}):Ar,i=t.currency,a=t.decimal,o=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):Ar,u=t.percent||"%";function c(t){var e=(t=Mr(t)).fill,n=t.align,c=t.sign,s=t.symbol,f=t.zero,l=t.width,h=t.comma,d=t.precision,p=t.type,g="$"===s?i[0]:"#"===s&&/[boxX]/.test(p)?"0"+p.toLowerCase():"",v="$"===s?i[1]:/[%p]/.test(p)?u:"",y=wr[p],b=!p||/[defgprs%]/.test(p);function m(t){var i,u,s,m=g,_=v;if("c"===p)_=y(t)+_,t="";else{var w=(t=+t)<0;if(t=y(Math.abs(t),d),w&&0==+t&&(w=!1),m=(w?"("===c?c:"-":"-"===c||"("===c?"":c)+m,_=("s"===p?Sr[8+yr/3]:"")+_+(w&&"("===c?")":""),b)for(i=-1,u=t.length;++i<u;)if(48>(s=t.charCodeAt(i))||s>57){_=(46===s?a+t.slice(i+1):t.slice(i))+_,t=t.slice(0,i);break}}h&&!f&&(t=r(t,1/0));var x=m.length+t.length+_.length,M=x<l?new Array(l-x+1).join(e):"";switch(h&&f&&(t=r(M+t,M.length?l-_.length:1/0),M=""),n){case"<":t=m+t+_+M;break;case"=":t=m+M+t+_;break;case"^":t=M.slice(0,x=M.length>>1)+m+t+_+M.slice(x);break;default:t=M+m+t+_}return o(t)}return d=null==d?p?6:12:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),m.toString=function(){return t+""},m}return{format:c,formatPrefix:function(t,e){var n=c(((t=Mr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(mr(e)/3))),i=Math.pow(10,-r),a=Sr[8+r/3];return function(t){return n(i*t)+a}}}}function Ur(){return new Er}function Er(){this.reset()}Cr=Dr({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),Nr=Cr.format,kr=Cr.formatPrefix,Er.prototype={constructor:Er,reset:function(){this.s=this.t=0},add:function(t){Fr(Pr,t,this.t),Fr(this,Pr.s,this.s),this.s?this.t+=Pr.t:this.s=Pr.t},valueOf:function(){return this.s}};var Pr=new Er;function Fr(t,e,n){var r=t.s=e+n,i=r-e,a=r-i;t.t=e-a+(n-i)}Math.PI,Ur(),Ur(),Ur(),Ur(),Ur(),Ur(),Ur(),Ur();var zr=Array.prototype,Yr=zr.map,Ir=zr.slice,Or={name:"implicit"};function qr(t){var e=tr(),n=[],r=Or;function i(i){var a=i+"",o=e.get(a);if(!o){if(r!==Or)return r;e.set(a,o=n.push(i))}return t[(o-1)%t.length]}return t=null==t?[]:Ir.call(t),i.domain=function(t){if(!arguments.length)return n.slice();n=[],e=tr();for(var r,a,o=-1,u=t.length;++o<u;)e.has(a=(r=t[o])+"")||e.set(a,n.push(r));return i},i.range=function(e){return arguments.length?(t=Ir.call(e),i):t.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return qr().domain(n).range(t).unknown(r)},i}function Lr(){var t,e,n=qr().unknown(void 0),r=n.domain,i=n.range,a=[0,1],o=!1,u=0,c=0,s=.5;function f(){var n=r().length,f=a[1]<a[0],l=a[f-0],h=a[1-f];t=(h-l)/Math.max(1,n-u+2*c),o&&(t=Math.floor(t)),l+=(h-l-t*(n-u))*s,e=t*(1-u),o&&(l=Math.round(l),e=Math.round(e));var d=function(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r<i;)a[r]=t+r*n;return a}(n).map(function(e){return l+t*e});return i(f?d.reverse():d)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),f()):r()},n.range=function(t){return arguments.length?(a=[+t[0],+t[1]],f()):a.slice()},n.rangeRound=function(t){return a=[+t[0],+t[1]],o=!0,f()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(o=!!t,f()):o},n.padding=function(t){return arguments.length?(u=c=Math.max(0,Math.min(1,t)),f()):u},n.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),f()):u},n.paddingOuter=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),f()):c},n.align=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),f()):s},n.copy=function(){return Lr().domain(r()).range(a).round(o).paddingInner(u).paddingOuter(c).align(s)},f()}function Hr(t){return+t}var jr=[0,1];function Vr(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=e,function(){return n});var n}function $r(t,e,n,r){var i=t[0],a=t[1],o=e[0],u=e[1];return a<i?(i=n(a,i),o=r(u,o)):(i=n(i,a),o=r(o,u)),function(t){return o(i(t))}}function Xr(t,e,n,i){var a=Math.min(t.length,e.length)-1,o=new Array(a),u=new Array(a),c=-1;for(t[a]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++c<a;)o[c]=n(t[c],t[c+1]),u[c]=i(e[c],e[c+1]);return function(e){var n=r(t,e,1,a)-1;return u[n](o[n](e))}}function Rr(t,e,n){var r,i=t[0],c=t[t.length-1],s=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),c=r/i;return c>=a?i*=10:c>=o?i*=5:c>=u&&(i*=2),e<t?-i:i}(i,c,null==e?10:e);switch((n=Mr(null==n?",f":n)).type){case"s":var f=Math.max(Math.abs(i),Math.abs(c));return null!=n.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(mr(e)/3)))-mr(Math.abs(t)))}(s,f))||(n.precision=r),kr(n,f);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,mr(e)-mr(t))+1}(s,Math.max(Math.abs(i),Math.abs(c))))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(r=function(t){return Math.max(0,-mr(Math.abs(t)))}(s))||(n.precision=r-2*("%"===n.type))}return Nr(n)}function Wr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,a,o,u=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(o=c(t,e,n))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++u<i;)a[u]=(t+u)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++u<i;)a[u]=(t-u)/o;return r&&a.reverse(),a}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){return Rr(e(),t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),a=0,o=i.length-1,u=i[a],s=i[o];return s<u&&(r=u,u=s,s=r,r=a,a=o,o=r),(r=c(u,s,n))>0?r=c(u=Math.floor(u/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=c(u=Math.ceil(u*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(u/r)*r,i[o]=Math.ceil(s/r)*r,e(i)):r<0&&(i[a]=Math.ceil(u*r)/r,i[o]=Math.floor(s*r)/r,e(i)),t},t}function Br(){var t=function(t,e){var n,r,i,a=jr,o=jr,u=Te,c=!1;function s(){return n=Math.min(a.length,o.length)>2?Xr:$r,r=i=null,f}function f(e){return(r||(r=n(a,o,c?function(t){return function(e,n){var r=t(e=+e,n=+n);return function(t){return t<=e?0:t>=n?1:r(t)}}}(t):t,u)))(+e)}return f.invert=function(t){return(i||(i=n(o,a,Vr,c?function(t){return function(e,n){var r=t(e=+e,n=+n);return function(t){return t<=0?e:t>=1?n:r(t)}}}(e):e)))(+t)},f.domain=function(t){return arguments.length?(a=Yr.call(t,Hr),s()):a.slice()},f.range=function(t){return arguments.length?(o=Ir.call(t),s()):o.slice()},f.rangeRound=function(t){return o=Ir.call(t),u=Ae,s()},f.clamp=function(t){return arguments.length?(c=!!t,s()):c},f.interpolate=function(t){return arguments.length?(u=t,s()):u},s()}(Vr,_e);return t.copy=function(){return e=t,Br().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp());var e},Wr(t)}var Zr=new Date,Qr=new Date;function Jr(t,e,n,r){function i(e){return t(e=new Date(+e)),e}return i.floor=i,i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,a){var o,u=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r&&a>0))return u;do{u.push(o=new Date(+n)),e(n,a),t(n)}while(o<n&&n<r);return u},i.filter=function(n){return Jr(function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})},n&&(i.count=function(e,r){return Zr.setTime(+e),Qr.setTime(+r),t(Zr),t(Qr),Math.floor(n(Zr,Qr))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Gr=Jr(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});Gr.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Jr(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):Gr:null};Gr.range;var Kr=6e4,ti=6048e5,ei=(Jr(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}).range,Jr(function(t){t.setTime(Math.floor(t/Kr)*Kr)},function(t,e){t.setTime(+t+e*Kr)},function(t,e){return(e-t)/Kr},function(t){return t.getMinutes()}).range,Jr(function(t){var e=t.getTimezoneOffset()*Kr%36e5;e<0&&(e+=36e5),t.setTime(36e5*Math.floor((+t-e)/36e5)+e)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()}).range,Jr(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Kr)/864e5},function(t){return t.getDate()-1}));ei.range;function ni(t){return Jr(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Kr)/ti})}var ri=ni(0),ii=ni(1),ai=(ni(2),ni(3),ni(4)),oi=(ni(5),ni(6),ri.range,Jr(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}).range,Jr(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));oi.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Jr(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)}):null};oi.range,Jr(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*Kr)},function(t,e){return(e-t)/Kr},function(t){return t.getUTCMinutes()}).range,Jr(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()}).range;var ui=Jr(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1});ui.range;function ci(t){return Jr(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/ti})}var si=ci(0),fi=ci(1),li=(ci(2),ci(3),ci(4)),hi=(ci(5),ci(6),si.range,Jr(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}).range,Jr(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));hi.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Jr(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null};hi.range;function di(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function pi(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function gi(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}var vi,yi,bi,mi={"-":"",_:" ",0:"0"},_i=/^\s*\d+/,wi=/^%/,xi=/[\\^$*+?|[\]().{}]/g;function Mi(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(e)+i:i)}function Ti(t){return t.replace(xi,"\\$&")}function Ai(t){return new RegExp("^(?:"+t.map(Ti).join("|")+")","i")}function Ci(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Ni(t,e,n){var r=_i.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ki(t,e,n){var r=_i.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Si(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Di(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Ui(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Ei(t,e,n){var r=_i.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Pi(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Fi(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function zi(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Yi(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ii(t,e,n){var r=_i.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Oi(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function qi(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Li(t,e,n){var r=_i.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Hi(t,e,n){var r=_i.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ji(t,e,n){var r=_i.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Vi(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $i(t,e,n){var r=_i.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Xi(t,e,n){var r=_i.exec(e.slice(n));return r?(t.Q=1e3*+r[0],n+r[0].length):-1}function Ri(t,e){return Mi(t.getDate(),e,2)}function Wi(t,e){return Mi(t.getHours(),e,2)}function Bi(t,e){return Mi(t.getHours()%12||12,e,2)}function Zi(t,e){return Mi(1+ei.count(oi(t),t),e,3)}function Qi(t,e){return Mi(t.getMilliseconds(),e,3)}function Ji(t,e){return Qi(t,e)+"000"}function Gi(t,e){return Mi(t.getMonth()+1,e,2)}function Ki(t,e){return Mi(t.getMinutes(),e,2)}function ta(t,e){return Mi(t.getSeconds(),e,2)}function ea(t){var e=t.getDay();return 0===e?7:e}function na(t,e){return Mi(ri.count(oi(t),t),e,2)}function ra(t,e){var n=t.getDay();return t=n>=4||0===n?ai(t):ai.ceil(t),Mi(ai.count(oi(t),t)+(4===oi(t).getDay()),e,2)}function ia(t){return t.getDay()}function aa(t,e){return Mi(ii.count(oi(t),t),e,2)}function oa(t,e){return Mi(t.getFullYear()%100,e,2)}function ua(t,e){return Mi(t.getFullYear()%1e4,e,4)}function ca(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Mi(e/60|0,"0",2)+Mi(e%60,"0",2)}function sa(t,e){return Mi(t.getUTCDate(),e,2)}function fa(t,e){return Mi(t.getUTCHours(),e,2)}function la(t,e){return Mi(t.getUTCHours()%12||12,e,2)}function ha(t,e){return Mi(1+ui.count(hi(t),t),e,3)}function da(t,e){return Mi(t.getUTCMilliseconds(),e,3)}function pa(t,e){return da(t,e)+"000"}function ga(t,e){return Mi(t.getUTCMonth()+1,e,2)}function va(t,e){return Mi(t.getUTCMinutes(),e,2)}function ya(t,e){return Mi(t.getUTCSeconds(),e,2)}function ba(t){var e=t.getUTCDay();return 0===e?7:e}function ma(t,e){return Mi(si.count(hi(t),t),e,2)}function _a(t,e){var n=t.getUTCDay();return t=n>=4||0===n?li(t):li.ceil(t),Mi(li.count(hi(t),t)+(4===hi(t).getUTCDay()),e,2)}function wa(t){return t.getUTCDay()}function xa(t,e){return Mi(fi.count(hi(t),t),e,2)}function Ma(t,e){return Mi(t.getUTCFullYear()%100,e,2)}function Ta(t,e){return Mi(t.getUTCFullYear()%1e4,e,4)}function Aa(){return"+0000"}function Ca(){return"%"}function Na(t){return+t}function ka(t){return Math.floor(+t/1e3)}!function(t){vi=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,o=t.shortDays,u=t.months,c=t.shortMonths,s=Ai(i),f=Ci(i),l=Ai(a),h=Ci(a),d=Ai(o),p=Ci(o),g=Ai(u),v=Ci(u),y=Ai(c),b=Ci(c),m={a:function(t){return o[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:Ri,e:Ri,f:Ji,H:Wi,I:Bi,j:Zi,L:Qi,m:Gi,M:Ki,p:function(t){return i[+(t.getHours()>=12)]},Q:Na,s:ka,S:ta,u:ea,U:na,V:ra,w:ia,W:aa,x:null,X:null,y:oa,Y:ua,Z:ca,"%":Ca},_={a:function(t){return o[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:sa,e:sa,f:pa,H:fa,I:la,j:ha,L:da,m:ga,M:va,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:Na,s:ka,S:ya,u:ba,U:ma,V:_a,w:wa,W:xa,x:null,X:null,y:Ma,Y:Ta,Z:Aa,"%":Ca},w={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=b[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=v[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return T(t,e,n,r)},d:Yi,e:Yi,f:ji,H:Oi,I:Oi,j:Ii,L:Hi,m:zi,M:qi,p:function(t,e,n){var r=s.exec(e.slice(n));return r?(t.p=f[r[0].toLowerCase()],n+r[0].length):-1},Q:$i,s:Xi,S:Li,u:ki,U:Si,V:Di,w:Ni,W:Ui,x:function(t,e,r){return T(t,n,e,r)},X:function(t,e,n){return T(t,r,e,n)},y:Pi,Y:Ei,Z:Fi,"%":Vi};function x(t,e){return function(n){var r,i,a,o=[],u=-1,c=0,s=t.length;for(n instanceof Date||(n=new Date(+n));++u<s;)37===t.charCodeAt(u)&&(o.push(t.slice(c,u)),null!=(i=mi[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(a=e[r])&&(r=a(n,i)),o.push(r),c=u+1);return o.push(t.slice(c,u)),o.join("")}}function M(t,e){return function(n){var r,i,a=gi(1900);if(T(a,t,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("p"in a&&(a.H=a.H%12+12*a.p),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=pi(gi(a.y))).getUTCDay(),r=i>4||0===i?fi.ceil(r):fi(r),r=ui.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=e(gi(a.y))).getDay(),r=i>4||0===i?ii.ceil(r):ii(r),r=ei.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?pi(gi(a.y)).getUTCDay():e(gi(a.y)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,pi(a)):e(a)}}function T(t,e,n,r){for(var i,a,o=0,u=e.length,c=n.length;o<u;){if(r>=c)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(a=w[i in mi?e.charAt(o++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return m.x=x(n,m),m.X=x(r,m),m.c=x(e,m),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",m);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",di);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t,pi);return e.toString=function(){return t},e}}}(t),vi.format,vi.parse,yi=vi.utcFormat,bi=vi.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||yi("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||bi("%Y-%m-%dT%H:%M:%S.%LZ");function Sa(t){return t.match(/.{6}/g).map(function(t){return"#"+t})}var Da=Sa("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");Sa("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),Sa("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),Sa("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),qe(de(300,.5,0),de(-240,.5,1));qe(de(-100,.75,.35),de(80,1.5,.8)),qe(de(260,.75,.35),de(80,1.5,.8)),de();function Ua(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}Ua(Sa("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));Ua(Sa("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Ua(Sa("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Ua(Sa("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),Math.PI;function Ea(t){return t<0?-1:1}function Pa(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),u=(a*i+o*r)/(r+i);return(Ea(a)+Ea(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Fa(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function za(t,e,n){var r=t._x0,i=t._y0,a=t._x1,o=t._y1,u=(a-r)/3;t._context.bezierCurveTo(r+u,i+u*e,a-u,o-u*n,a,o)}function Ya(t){this._context=t}function Ia(t){this._context=t}return Ya.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:za(this,this._t0,Fa(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,za(this,Fa(this,n=Pa(this,t,e)),n);break;default:za(this,this._t0,n=Pa(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(function(t){this._context=new Ia(t)}.prototype=Object.create(Ya.prototype)).point=function(t,e){Ya.prototype.point.call(this,e,t)},Ia.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,a){this._context.bezierCurveTo(e,t,r,n,a,i)}},function(e,n){var a,o,u,c,s,l={},h=[],d=[],p=tr(),g=tr(),v=[],y=tr(),b=tr(),m=[],_=void 0!==n?n:600,w=tr(),x=["#deebf7","#2171b5"],M=["white","#b5cf6b"],T=Nr(",.0d"),A=0,C=100,N="__seqId",k=function(){};function S(){console.log("nozoom"),B.preventDefault()}l.margin=10,l.attribWidth=15,l.levelsSeparation=40,l.divisionsColor="white",l.levelConnectionsColor="rgba(205, 220, 163, 0.5)",l.divisionsThreshold=3,l.attribFontSize=13,l.attribFontSizeSelected=32,l.startColor="white",l.endColor="red",l.legendFont="14px Arial",l.linkColor="#2171b5",e.on("touchstart",S).on("touchmove",S).style("height",_+"px").style("float","left").attr("class","Navio").append("div").style("float","left").attr("id","Navio").style("position","relative"),e.select("#Navio").append("canvas");var D=e.select("#Navio").append("svg").style("overflow","visible").style("position","absolute").style("z-index",99).style("top",0).style("left",0);function U(t,e){var n=t.domain(),i=t.range();return function t(){var e=0,n=1,i=1,a=[.5],o=[0,1];function u(t){if(t<=t)return o[r(a,t,0,i)]}function c(){var t=-1;for(a=new Array(i);++t<i;)a[t]=((t+1)*n-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?(e=+t[0],n=+t[1],c()):[e,n]},u.range=function(t){return arguments.length?(i=(o=Ir.call(t)).length-1,c()):o.slice()},u.invertExtent=function(t){var r=o.indexOf(t);return r<0?[NaN,NaN]:r<1?[e,a[0]]:r>=i?[a[i-1],n]:[a[r-1],a[r]]},u.copy=function(){return t().domain([e,n]).range(o)},Wr(u)}().domain(i).range(n)(e)}function E(e){if(!B.defaultPrevented){console.log("click "+e);var n=performance.now();d[e.level]=d[e.level].sort(function(n,r){return t(h[n][e.attrib],h[r][e.attrib])}),d[e.level].forEach(function(t,n){h[t].__i[e.level]=n});var r=performance.now();console.log("Click sorting "+(r-n)+"ms"),y.set(e.level,e.attrib),l.updateData(d,w,e.level)}}function P(t){it("#level"+t).selectAll(".brush").call(b.get(t).move,null)}function F(t){for(var e=0;e<d.length;e+=1)e!==t&&P(e)}function z(t,e){b.set(e,Wn().extent([[o(a.domain()[0],e),m[e].range()[0]],[o(a.domain()[a.domain().length-1],e)+1.1*a.bandwidth(),m[e].range()[1]]]).on("end",function(){if(console.log("brushended",B),B.sourceEvent)if(B.selection){F(e);var t=performance.now(),n=B.selection,r=p.get(U(m[e],n[0])),i=p.get(U(m[e],n[1]));console.log("first and last"),console.log(r),console.log(i),console.log("first id "+r.__i[e]+" last id "+i.__i[e]);for(var a=d[e].filter(function(t){return h[t].visible=h[t].__i[e]>=r.__i[e]&&h[t].__i[e]<=i.__i[e],h[t].visible}),o=0;o<a.length;o++)h[a[o]].__i[e+1]=o;var u=performance.now();console.log("Brushend filtering "+(u-t)+"ms"),console.log("Computing new data");var c=d;0!==a.length?((c=d.slice(0,e+1)).push(a),l.updateData(c,w),console.log("out of updateData"),console.log("Selected "+a.length+" calling updateCallback"),k(l.getVisible())):console.log("Empty selection!")}else console.log("Empty selection",B.selection,B.type,B.sourceEvent)}));var n=it(this).selectAll(".brush").data([{data:h[t],level:e}]);n.enter().merge(n).append("g").on("mousemove",Y).on("click",function(){console.log("click");var t=ut(B.target)[1];!function(t,n){console.log("onSelectByValueFromCoords",t,n),F(-1);var r=performance.now(),i=U(m[e],n),o=performance.now();console.log("invertOrdinalScale "+(o-r)+"ms");var c=U(a,t-u(e));if(void 0!==c){var s=p.get(i);r=performance.now();var f=d[e].filter(function(t){return h[t].visible=h[t][c]===s[c],h[t].visible});f.forEach(function(t,n){h[t].__i[e+1]=n}),o=performance.now(),console.log("Click filtering "+(o-r)+"ms");var g=d.slice(0,e+1);g.push(f),l.updateData(g,w),console.log("Selected "+l.getVisible().length+" calling updateCallback"),k(l.getVisible())}}(ut(B.target)[0],t)}).on("mouseout",I).attr("class","brush").call(b.get(e)).selectAll("rect").attr("width",o(a.domain()[a.domain().length-1],e)+1.1*a.bandwidth()),n.exit().remove()}function Y(t){var e=ut(B.target)[1],n=ut(B.target)[0],r=U(m[t.level],e),i=U(a,n-u(t.level)),o=p.get(r);D.select(".tooltip").attr("transform","translate("+n+","+(e+20)+")").call(function(t){t.select(".tool_id").text(r),t.select(".tool_value_name").text(i+" : "),t.select(".tool_value_val").text(o[i])})}function I(){D.select(".tooltip").attr("transform","translate(-200,-200)").call(function(t){t.select(".tool_id").text(""),t.select(".tool_value_name").text(""),t.select(".tool_value_val").text("")})}function O(){var t=a.domain(),e=D.select(".attribs").selectAll(".levelOverlay").data(d),n=e.enter().append("g").attr("class","levelOverlay").attr("id",function(t,e){return"level"+e}).each(z),r=n.merge(e).selectAll(".attribOverlay").data(function(e,n){return t.map(function(t){return{attrib:t,level:n}})}),i=r.enter().append("g").attr("class","attribOverlay").style("cursor","pointer");i.merge(r).attr("transform",function(t){return"translate("+o(t.attrib,t.level)+","+m[t.level].range()[0]+")"}),i.append("rect").merge(r.select("rect")).attr("fill","none").attr("x",0).attr("y",0).attr("width",function(){return 1.1*a.bandwidth()}).attr("height",function(t){return m[t.level].range()[1]-m[t.level].range()[0]}),i.append("text").merge(r.select("text")).style("cursor","grab").style("-webkit-user-select","none").style("-moz-user-select","none").style("-ms-user-select","none").style("user-select","none").text(function(t){return"__seqId"===t.attrib?"sequential Index":t.attrib}).attr("x",a.bandwidth()/2).attr("y",0).style("font-weight",function(t){return y.has(t.level)&&y.get(t.level)===t.attrib?"bolder":"normal"}).style("font-family","sans-serif").style("font-size",l.attribFontSize+"px").on("click",E).call(function(){var t,e,n,r,i=gt,a=vt,o=yt,u=bt,c={},s=f("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",p).filter(u).on("touchstart.drag",y).on("touchmove.drag",b).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!r&&i.apply(this,arguments)){var o=_("mouse",a.apply(this,arguments),ut,this,arguments);o&&(it(B.view).on("mousemove.drag",g,!0).on("mouseup.drag",v,!0),lt(B.view),st(),n=!1,t=B.clientX,e=B.clientY,o("start"))}}function g(){if(ft(),!n){var r=B.clientX-t,i=B.clientY-e;n=r*r+i*i>h}c.mouse("drag")}function v(){it(B.view).on("mousemove.drag mouseup.drag",null),ht(B.view,n),ft(),c.mouse("end")}function y(){if(i.apply(this,arguments)){var t,e,n=B.changedTouches,r=a.apply(this,arguments),o=n.length;for(t=0;t<o;++t)(e=_(n[t].identifier,r,ct,this,arguments))&&(st(),e("start"))}}function b(){var t,e,n=B.changedTouches,r=n.length;for(t=0;t<r;++t)(e=c[n[t].identifier])&&(ft(),e("drag"))}function m(){var t,e,n=B.changedTouches,i=n.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<i;++t)(e=c[n[t].identifier])&&(st(),e("end"))}function _(t,e,n,r,i){var a,u,f,h=n(e,t),p=s.copy();if(K(new pt(d,"beforestart",a,t,l,h[0],h[1],0,0,p),function(){return null!=(B.subject=a=o.apply(r,i))&&(u=a.x-h[0]||0,f=a.y-h[1]||0,!0)}))return function o(s){var g,v=h;switch(s){case"start":c[t]=o,g=l++;break;case"end":delete c[t],--l;case"drag":h=n(e,t),g=l}K(new pt(d,s,a,t,g,h[0]+u,h[1]+f,h[0]-v[0],h[1]-v[1],p),p.apply,p,[s,r,i])}}return d.filter=function(t){return arguments.length?(i="function"==typeof t?t:dt(!!t),d):i},d.container=function(t){return arguments.length?(a="function"==typeof t?t:dt(t),d):a},d.subject=function(t){return arguments.length?(o="function"==typeof t?t:dt(t),d):o},d.touchable=function(t){return arguments.length?(u="function"==typeof t?t:dt(!!t),d):u},d.on=function(){var t=s.on.apply(s,arguments);return t===s?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d}().container(i.merge(r).node()).on("start",q).on("drag",L).on("end",H)).on("mousemove",function(){var t=it(B.target);(t=void 0!==t.transition?t.transition().duration(150):t).style("font-size",l.attribFontSizeSelected+"px")}).on("mouseout",function(){var t=it(B.target);(t=void 0!==t.transition?t.transition().duration(150):t).style("font-size",l.attribFontSize+"px")}).attr("transform","rotate(-45)"),r.exit().remove(),e.exit().remove(),n.append("text").attr("class","numNodesLabel").style("font-family","sans-serif").style("pointer-events","none").merge(e.select(".numNodesLabel")).attr("y",function(t,e){return m[e].range()[1]+15}).attr("x",function(t,e){return u(e)}).text(function(t){return T(t.length)}),e.exit().remove()}function q(t){console.log("start",t),it(this.parentNode).attr("transform",function(t){return"translate("+(B.x+l.attribFontSize/2)+","+m[t.level].range()[0]+")"})}function L(t){var e=U(a,B.x+l.attribFontSize/2-u(t.level));console.log(B.x,B.y,e),it(this.parentNode).attr("transform",function(t){return"translate("+(B.x+l.attribFontSize/2)+","+m[t.level].range()[0]+")"})}function H(t){console.log("end",t);var e,n=U(a,B.x+l.attribFontSize/2-u(t.level));it(this.parentNode).attr("transform",function(t){return"translate("+o(t.attrib,t.level)+","+m[t.level].range()[0]+")"}),n!==t.attrib&&(e=v.indexOf(n),V(t.attrib,e),l.updateData(d))}function j(t,e,n,r){s.beginPath(),t.forEach(function(t,e){0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)}),s.lineWidth=e,r?(s.fillStyle=n,s.closePath(),s.fill()):(s.strokeStyle=n,s.stroke())}function V(t,e){var n=v.indexOf(t);-1!==n?e>v.length||e<0?console.err("moveAttrToPos pos out of bounds",e,v.length):(v.splice(n,1),v.splice(e,0,t)):console.err("moveAttrToPos attr not found",t)}return D.append("g").attr("class","attribs"),D.append("g").attr("class","tooltip").style("text-shadow","0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff").attr("transform","translate(-100,-10)").append("text").attr("x",0).attr("y",0).style("pointer-events","none").style("font-family","sans-serif").style("font-size","16pt").style("text-anchor","middle"),D.select(".tooltip > text").append("tspan").attr("class","tool_id").attr("x",0).attr("dy","1.2em"),D.select(".tooltip > text").append("tspan").attr("class","tool_value_name").style("font-weight","bold").attr("x",0).attr("dy","1.2em"),D.select(".tooltip > text").append("tspan").attr("class","tool_value_val").style("font-weight","bold").attr("x",0).attr("dy","1.2em"),D.append("g").attr("id","closeButton").style("fill","white").style("stroke","black").style("display","none").append("path").call(function(t){var e=Gn();e.moveTo(0,0),e.lineTo(7,7),e.moveTo(7,0),e.lineTo(0,7),e.moveTo(11.9,3.5),e.arc(3.5,3.5,8.4,0,2*Math.PI),t.attr("d",e.toString())}).on("click",function(){d.length<=1||(console.log("Delete one level"),P(d.length-2),d[d.length-2].forEach(function(t){h[t].visible=!0}),d=d.slice(0,d.length-1),l.updateData(d,w),k(l.getVisible()))}),a=Lr().range([0,l.attribWidth]).round(!0).paddingInner(.1).paddingOuter(0),u=Lr().round(!0),w=tr(),o=function(t,e){return u(e)+a(t)},(c=e.select("canvas").node()).style.top=c.offsetTop+"px",c.style.left=c.offsetLeft+"px",c.style.height=_+"px",(s=c.getContext("2d")).scale(2,2),l.initData=function(t,e){var n=performance.now();(w=e).keys().forEach(function(t){g.set(t,!0)}),p=tr();for(var r=0;r<h.length;r++){var i=h[r];i.__seqId=r,p.set(i[N],i),i.__i={},i.__i[0]=r}var a=performance.now();console.log("Init data "+(a-n)+"ms")},l.updateData=function(t,e,n){console.log("updateData");var r,o=performance.now();if(typeof t==typeof[]){w=void 0!==e?e:w,d=t,function(t){console.log("Update scales");var e=performance.now(),n=d.length-1;console.log("Delete unnecessary scales"),m.splice(n+1,m.length),m[t=void 0!==t?t:n]=Lr().range([C,_-l.margin-30]).paddingInner(0).paddingOuter(0),console.log("Compute representatives");var r=[];if(d[t].length>_){var o=Math.max(Math.floor(d[t].length/(2*_)),1);console.log("itemsPerpixel",o),d[t].itemsPerpixel=o;for(var c=0;c<d[t].length;c+=o)r.push(d[t][c])}else d[t].itemsPerpixel=1,r=d[t];d[t].representatives=r,m[t].domain(r.map(function(t){return h[t][N]})),console.log("Update color scale domains"),g.keys().forEach(function(t){if("visible"!==t){var e=w.get(t);e.domain(i(d[0].representatives.map(function(e){return h[e][t]}))),w.set(t,e)}}),a.domain(v).range([0,l.attribWidth*g.keys().length]).paddingInner(.1).paddingOuter(0),u.domain(d.map(function(t,e){return e})).range([A+l.margin,(a.range()[1]+l.levelsSeparation)*d.length+A]).paddingInner(0).paddingOuter(0);var s=performance.now();console.log("Updating Scales "+(s-e)+"ms")}(n),r=u.range()[1]+l.margin+A,it(c).attr("width",r).attr("height",_).style("width",r).style("height",_+"px"),c.style.width=r+"px",c.style.height=_+"px",D.attr("width",r).attr("height",_),l.update();var s=performance.now();console.log("Updating data "+(s-o)+"ms")}else console.error("Navio updateData didn't receive an array")},l.update=function(){var t,e=performance.now(),n=u.range()[1]+l.margin+A;s.clearRect(0,0,n+1,_+1),d.forEach(function(t,e){var n;t.representatives.forEach(function(t){!function(t,e){var n,r,i;for(r=0;r<v.length;r++)if(n=v[r],i=Math.round(m[e](t[N])+m[e].bandwidth()/2),s.beginPath(),s.moveTo(Math.round(o(n,e)),i),s.lineTo(Math.round(o(n,e)+a.bandwidth()),i),s.lineWidth=Math.round(m[e].bandwidth()),s.strokeStyle=void 0===t[n]||null===t[n]||"none"===t[n]?"white":w.get(n)(t[n]),s.stroke(),m[e].bandwidth()>l.divisionsThreshold){var u=Math.round(m[e](t[N]));s.beginPath(),s.moveTo(o(n,e),u),s.lineTo(o(n,e)+a.bandwidth(),u),s.lineWidth=1,s.strokeStyle=l.divisionsColor,s.stroke()}}(h[t],e)}),function(t){s.beginPath(),s.rect(u(t),m[t].range()[0],a.range()[1],m[t].range()[1]-100),s.strokeStyle="black",s.lineWidth=1,s.stroke()}(e),(n=e)<=0||d[n].representatives.forEach(function(t){var e=p.get(h[t][N]).__i[n-1],r=Math.floor(e-e%d[n-1].itemsPerpixel),i={x:u(n-1)+a.range()[1],y:m[n-1](h[d[n-1][r]][N])},o={x:u(n),y:m[n](h[t][N])},c=[i,{x:i.x+.3*l.levelsSeparation,y:i.y},{x:o.x-.3*l.levelsSeparation,y:o.y},o,{x:o.x,y:o.y+m[n].bandwidth()},{x:o.x-.3*l.levelsSeparation,y:o.y+m[n].bandwidth()},{x:i.x+.3*l.levelsSeparation,y:i.y+m[n-1].bandwidth()},{x:i.x,y:i.y+m[n-1].bandwidth()},i];j(c,1,l.levelConnectionsColor),j(c,1,l.levelConnectionsColor,!0)})}),O(),t=d.length-1,D.select("#closeButton").style("display",1===d.length?"none":"block").attr("transform","translate("+(u(t)+u.bandwidth()-l.levelsSeparation+15)+","+m[t].range()[0]+")");var r=performance.now();console.log("Redrawing "+(r-e)+"ms")},l.addAttrib=function(t,e){return v.push(t),w.set(t,e),l},l.addSequentialAttrib=function(t,e){return l.addAttrib(t,e||Br().domain(void 0!==h&&h.length>0?i(h[0],function(e){return e[t]}):[0,1]).range(x)),l},l.addCategoricalAttrib=function(t,e){return l.addAttrib(t,e||qr(Da)),l},l.data=function(t){return w.has("visible")||(l.addAttrib("visible",qr().domain([!1,!0]).range(M)),V("visible",0)),w.has("__seqId")||(l.addSequentialAttrib("__seqId"),V("__seqId",1)),arguments.length?(t.forEach(function(t){t.visible=!0}),d=[(h=t).map(function(t,e){return e})],l.initData(d,w),l.updateData(d,w),l):h[0]},l.getVisible=function(){return d[d.length-1].filter(function(t){return h[t].visible}).map(function(t){return h[t]})},l.updateCallback=function(t){return arguments.length?(k=t,l):k},l.visibleColorRange=function(t){return arguments.length?(M=t,l):M},l.defaultColorRange=function(t){return arguments.length?(x=t,l):x},l.id=function(t){return arguments.length?(N=t,l):N},l}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment