mermaid
Version:
Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.
1 lines • 918 kB
JavaScript
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.mermaid=n():t.mermaid=n()}(window,function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=56)}([function(t,n,e){"use strict";e.r(n);var r=function(t,n){return t<n?-1:t>n?1:t>=n?0:NaN},i=function(t){var n;return 1===t.length&&(n=t,t=function(t,e){return r(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}};var o=i(r),u=o.right,a=o.left,c=u,s=function(t,n){null==n&&(n=l);for(var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);e<r;)o[e]=n(i,i=t[++e]);return o};function l(t,n){return[t,n]}var f=function(t,n,e){var r,i,o,u,a=t.length,c=n.length,s=new Array(a*c);for(null==e&&(e=l),r=o=0;r<a;++r)for(u=t[r],i=0;i<c;++i,++o)s[o]=e(u,n[i]);return s},h=function(t,n){return n<t?-1:n>t?1:n>=t?0:NaN},d=function(t){return null===t?NaN:+t},p=function(t,n){var e,r,i=t.length,o=0,u=-1,a=0,c=0;if(null==n)for(;++u<i;)isNaN(e=d(t[u]))||(c+=(r=e-a)*(e-(a+=r/++o)));else for(;++u<i;)isNaN(e=d(n(t[u],u,t)))||(c+=(r=e-a)*(e-(a+=r/++o)));if(o>1)return c/(o-1)},g=function(t,n){var e=p(t,n);return e?Math.sqrt(e):e},y=function(t,n){var e,r,i,o=t.length,u=-1;if(null==n){for(;++u<o;)if(null!=(e=t[u])&&e>=e)for(r=i=e;++u<o;)null!=(e=t[u])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++u<o;)if(null!=(e=n(t[u],u,t))&&e>=e)for(r=i=e;++u<o;)null!=(e=n(t[u],u,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]},v=Array.prototype,_=v.slice,m=v.map,b=function(t){return function(){return t}},w=function(t){return t},x=function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o},k=Math.sqrt(50),E=Math.sqrt(10),A=Math.sqrt(2),T=function(t,n,e){var r,i,o,u,a=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(u=S(t,n,e))||!isFinite(u))return[];if(u>0)for(t=Math.ceil(t/u),n=Math.floor(n/u),o=new Array(i=Math.ceil(n-t+1));++a<i;)o[a]=(t+a)*u;else for(t=Math.floor(t*u),n=Math.ceil(n*u),o=new Array(i=Math.ceil(t-n+1));++a<i;)o[a]=(t-a)/u;return r&&o.reverse(),o};function S(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=k?10:o>=E?5:o>=A?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=k?10:o>=E?5:o>=A?2:1)}function D(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=k?i*=10:o>=E?i*=5:o>=A&&(i*=2),n<t?-i:i}var M=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},C=function(){var t=w,n=y,e=M;function r(r){var i,o,u=r.length,a=new Array(u);for(i=0;i<u;++i)a[i]=t(r[i],i,r);var s=n(a),l=s[0],f=s[1],h=e(a,l,f);Array.isArray(h)||(h=D(l,f,h),h=x(Math.ceil(l/h)*h,f,h));for(var d=h.length;h[0]<=l;)h.shift(),--d;for(;h[d-1]>f;)h.pop(),--d;var p,g=new Array(d+1);for(i=0;i<=d;++i)(p=g[i]=[]).x0=i>0?h[i-1]:l,p.x1=i<d?h[i]:f;for(i=0;i<u;++i)l<=(o=a[i])&&o<=f&&g[c(h,o,0,d)].push(r[i]);return g}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:b(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:b([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?b(_.call(t)):b(t),r):e},r},O=function(t,n,e){if(null==e&&(e=d),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),u=+e(t[o],o,t);return u+(+e(t[o+1],o+1,t)-u)*(i-o)}},L=function(t,n,e){return t=m.call(t,d).sort(r),Math.ceil((e-n)/(2*(O(t,.75)-O(t,.25))*Math.pow(t.length,-1/3)))},N=function(t,n,e){return Math.ceil((e-n)/(3.5*g(t)*Math.pow(t.length,-1/3)))},F=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&e>r&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&e>r&&(r=e);return r},R=function(t,n){var e,r=t.length,i=r,o=-1,u=0;if(null==n)for(;++o<r;)isNaN(e=d(t[o]))?--i:u+=e;else for(;++o<r;)isNaN(e=d(n(t[o],o,t)))?--i:u+=e;if(i)return u/i},B=function(t,n){var e,i=t.length,o=-1,u=[];if(null==n)for(;++o<i;)isNaN(e=d(t[o]))||u.push(e);else for(;++o<i;)isNaN(e=d(n(t[o],o,t)))||u.push(e);return O(u.sort(r),.5)},I=function(t){for(var n,e,r,i=t.length,o=-1,u=0;++o<i;)u+=t[o].length;for(e=new Array(u);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e},P=function(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o<i;)if(null!=(e=t[o])&&e>=e)for(r=e;++o<i;)null!=(e=t[o])&&r>e&&(r=e)}else for(;++o<i;)if(null!=(e=n(t[o],o,t))&&e>=e)for(r=e;++o<i;)null!=(e=n(t[o],o,t))&&r>e&&(r=e);return r},j=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},q=function(t,n){if(e=t.length){var e,i,o=0,u=0,a=t[u];for(null==n&&(n=r);++o<e;)(n(i=t[o],a)<0||0!==n(a,a))&&(a=i,u=o);return 0===n(a,a)?u:void 0}},U=function(t,n,e){for(var r,i,o=(null==e?t.length:e)-(n=null==n?0:+n);o;)i=Math.random()*o--|0,r=t[o+n],t[o+n]=t[i+n],t[i+n]=r;return t},z=function(t,n){var e,r=t.length,i=-1,o=0;if(null==n)for(;++i<r;)(e=+t[i])&&(o+=e);else for(;++i<r;)(e=+n(t[i],i,t))&&(o+=e);return o},Y=function(t){if(!(i=t.length))return[];for(var n=-1,e=P(t,$),r=new Array(e);++n<e;)for(var i,o=-1,u=r[n]=new Array(i);++o<i;)u[o]=t[o][n];return r};function $(t){return t.length}var V=function(){return Y(arguments)},W=Array.prototype.slice,G=function(t){return t},H=1,Z=2,X=3,J=4,K=1e-6;function Q(t){return"translate("+(t+.5)+",0)"}function tt(t){return"translate(0,"+(t+.5)+")"}function nt(){return!this.__axis}function et(t,n){var e=[],r=null,i=null,o=6,u=6,a=3,c=t===H||t===J?-1:1,s=t===J||t===Z?"x":"y",l=t===H||t===X?Q:tt;function f(f){var h=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,d=null==i?n.tickFormat?n.tickFormat.apply(n,e):G:i,p=Math.max(o,0)+a,g=n.range(),y=+g[0]+.5,v=+g[g.length-1]+.5,_=(n.bandwidth?function(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}:function(t){return function(n){return+t(n)}})(n.copy()),m=f.selection?f.selection():f,b=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(h,n).order(),x=w.exit(),k=w.enter().append("g").attr("class","tick"),E=w.select("line"),A=w.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(k),E=E.merge(k.append("line").attr("stroke","currentColor").attr(s+"2",c*o)),A=A.merge(k.append("text").attr("fill","currentColor").attr(s,c*p).attr("dy",t===H?"0em":t===X?"0.71em":"0.32em")),f!==m&&(b=b.transition(f),w=w.transition(f),E=E.transition(f),A=A.transition(f),x=x.transition(f).attr("opacity",K).attr("transform",function(t){return isFinite(t=_(t))?l(t):this.getAttribute("transform")}),k.attr("opacity",K).attr("transform",function(t){var n=this.parentNode.__axis;return l(n&&isFinite(n=n(t))?n:_(t))})),x.remove(),b.attr("d",t===J||t==Z?u?"M"+c*u+","+y+"H0.5V"+v+"H"+c*u:"M0.5,"+y+"V"+v:u?"M"+y+","+c*u+"V0.5H"+v+"V"+c*u:"M"+y+",0.5H"+v),w.attr("opacity",1).attr("transform",function(t){return l(_(t))}),E.attr(s+"2",c*o),A.attr(s,c*p).text(d),m.filter(nt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Z?"start":t===J?"end":"middle"),m.each(function(){this.__axis=_})}return f.scale=function(t){return arguments.length?(n=t,f):n},f.ticks=function(){return e=W.call(arguments),f},f.tickArguments=function(t){return arguments.length?(e=null==t?[]:W.call(t),f):e.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:W.call(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=u=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(u=+t,f):u},f.tickPadding=function(t){return arguments.length?(a=+t,f):a},f}function rt(t){return et(H,t)}function it(t){return et(Z,t)}function ot(t){return et(X,t)}function ut(t){return et(J,t)}var at={value:function(){}};function ct(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new st(r)}function st(t){this._=t}function lt(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function ft(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=at,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}st.prototype=ct.prototype={constructor:st,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),u=-1,a=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u<a;)if(e=(t=o[u]).type)i[e]=ft(i[e],t.name,n);else if(null==n)for(e in i)i[e]=ft(i[e],t.name,null);return this}for(;++u<a;)if((e=(t=o[u]).type)&&(e=lt(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new st(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var ht=ct,dt="http://www.w3.org/1999/xhtml",pt={svg:"http://www.w3.org/2000/svg",xhtml:dt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},gt=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),pt.hasOwnProperty(n)?{space:pt[n],local:t}:t};var yt=function(t){var n=gt(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===dt&&n.documentElement.namespaceURI===dt?n.createElement(t):n.createElementNS(e,t)}})(n)};function vt(){}var _t=function(t){return null==t?vt:function(){return this.querySelector(t)}};function mt(){return[]}var bt=function(t){return null==t?mt:function(){return this.querySelectorAll(t)}},wt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var xt=document.documentElement;if(!xt.matches){var kt=xt.webkitMatchesSelector||xt.msMatchesSelector||xt.mozMatchesSelector||xt.oMatchesSelector;wt=function(t){return function(){return kt.call(this,t)}}}}var Et=wt,At=function(t){return new Array(t.length)};function Tt(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}Tt.prototype={constructor:Tt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var St="$";function Dt(t,n,e,r,i,o){for(var u,a=0,c=n.length,s=o.length;a<s;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new Tt(t,o[a]);for(;a<c;++a)(u=n[a])&&(i[a]=u)}function Mt(t,n,e,r,i,o,u){var a,c,s,l={},f=n.length,h=o.length,d=new Array(f);for(a=0;a<f;++a)(c=n[a])&&(d[a]=s=St+u.call(c,c.__data__,a,n),s in l?i[a]=c:l[s]=c);for(a=0;a<h;++a)(c=l[s=St+u.call(t,o[a],a,o)])?(r[a]=c,c.__data__=o[a],l[s]=null):e[a]=new Tt(t,o[a]);for(a=0;a<f;++a)(c=n[a])&&l[d[a]]===c&&(i[a]=c)}function Ct(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}var Ot=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function Lt(t,n){return t.style.getPropertyValue(n)||Ot(t).getComputedStyle(t,null).getPropertyValue(n)}function Nt(t){return t.trim().split(/^|\s+/)}function Ft(t){return t.classList||new Rt(t)}function Rt(t){this._node=t,this._names=Nt(t.getAttribute("class")||"")}function Bt(t,n){for(var e=Ft(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function It(t,n){for(var e=Ft(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}Rt.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Pt(){this.textContent=""}function jt(){this.innerHTML=""}function qt(){this.nextSibling&&this.parentNode.appendChild(this)}function Ut(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zt(){return null}function Yt(){var t=this.parentNode;t&&t.removeChild(this)}function $t(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function Vt(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var Wt={},Gt=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(Wt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Ht(t,n,e){return t=Zt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Zt(t,n,e){return function(r){var i=Gt;Gt=r;try{t.call(this,this.__data__,n,e)}finally{Gt=i}}}function Xt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function Jt(t,n,e){var r=Wt.hasOwnProperty(t.type)?Ht:Zt;return function(i,o,u){var a,c=this.__on,s=r(n,o,u);if(c)for(var l=0,f=c.length;l<f;++l)if((a=c[l]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=s,a.capture=e),void(a.value=n);this.addEventListener(t.type,s,e),a={type:t.type,name:t.name,value:n,listener:s,capture:e},c?c.push(a):this.__on=[a]}}function Kt(t,n,e,r){var i=Gt;t.sourceEvent=Gt,Gt=t;try{return n.apply(e,r)}finally{Gt=i}}function Qt(t,n,e){var r=Ot(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}var tn=[null];function nn(t,n){this._groups=t,this._parents=n}function en(){return new nn([[document.documentElement]],tn)}nn.prototype=en.prototype={constructor:nn,select:function(t){"function"!=typeof t&&(t=_t(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],c=a.length,s=r[i]=new Array(c),l=0;l<c;++l)(o=a[l])&&(u=t.call(o,o.__data__,l,a))&&("__data__"in o&&(u.__data__=o.__data__),s[l]=u);return new nn(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=bt(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],c=a.length,s=0;s<c;++s)(u=a[s])&&(r.push(t.call(u,u.__data__,s,a)),i.push(u));return new nn(r,i)},filter:function(t){"function"!=typeof t&&(t=Et(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,c=r[i]=[],s=0;s<a;++s)(o=u[s])&&t.call(o,o.__data__,s,u)&&c.push(o);return new nn(r,this._parents)},data:function(t,n){if(!t)return p=new Array(this.size()),l=-1,this.each(function(t){p[++l]=t}),p;var e,r=n?Mt:Dt,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var u=o.length,a=new Array(u),c=new Array(u),s=new Array(u),l=0;l<u;++l){var f=i[l],h=o[l],d=h.length,p=t.call(f,f&&f.__data__,l,i),g=p.length,y=c[l]=new Array(g),v=a[l]=new Array(g);r(f,h,y,v,s[l]=new Array(d),p,n);for(var _,m,b=0,w=0;b<g;++b)if(_=y[b]){for(b>=w&&(w=b+1);!(m=v[w])&&++w<g;);_._next=m||null}}return(a=new nn(a,i))._enter=c,a._exit=s,a},enter:function(){return new nn(this._enter||this._groups.map(At),this._parents)},exit:function(){return new nn(this._exit||this._groups.map(At),this._parents)},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var c,s=n[a],l=e[a],f=s.length,h=u[a]=new Array(f),d=0;d<f;++d)(c=s[d]||l[d])&&(h[d]=c);for(;a<r;++a)u[a]=n[a];return new nn(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=Ct);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,a=e[o],c=a.length,s=i[o]=new Array(c),l=0;l<c;++l)(u=a[l])&&(s[l]=u);s.sort(n)}return new nn(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=gt(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof n?e.local?function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}:function(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:e.local?function(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}:function(t,n){return function(){this.setAttribute(t,n)}})(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):Lt(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=Nt(t+"");if(arguments.length<2){for(var r=Ft(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?function(t,n){return function(){(n.apply(this,arguments)?Bt:It)(this,t)}}:n?function(t){return function(){Bt(this,t)}}:function(t){return function(){It(this,t)}})(e,n))},text:function(t){return arguments.length?this.each(null==t?Pt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?jt:("function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(qt)},lower:function(){return this.each(Ut)},append:function(t){var n="function"==typeof t?t:yt(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},insert:function(t,n){var e="function"==typeof t?t:yt(t),r=null==n?zt:"function"==typeof n?n:_t(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Yt)},clone:function(t){return this.select(t?Vt:$t)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}(t+""),u=o.length;if(!(arguments.length<2)){for(a=n?Jt:Xt,null==e&&(e=!1),r=0;r<u;++r)this.each(a(o[r],n,e));return this}var a=this.node().__on;if(a)for(var c,s=0,l=a.length;s<l;++s)for(r=0,c=a[s];r<u;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?function(t,n){return function(){return Qt(this,t,n.apply(this,arguments))}}:function(t,n){return function(){return Qt(this,t,n)}})(t,n))}};var rn=en,on=function(t){return"string"==typeof t?new nn([[document.querySelector(t)]],[document.documentElement]):new nn([[t]],tn)},un=function(t){return on(yt(t).call(document.documentElement))},an=0;function cn(){return new sn}function sn(){this._="@"+(++an).toString(36)}sn.prototype=cn.prototype={constructor:sn,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var ln=function(){for(var t,n=Gt;t=n.sourceEvent;)n=t;return n},fn=function(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]},hn=function(t){var n=ln();return n.changedTouches&&(n=n.changedTouches[0]),fn(t,n)},dn=function(t){return"string"==typeof t?new nn([document.querySelectorAll(t)],[document.documentElement]):new nn([null==t?[]:t],tn)},pn=function(t,n,e){arguments.length<3&&(e=n,n=ln().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return fn(t,r);return null},gn=function(t,n){null==n&&(n=ln().touches);for(var e=0,r=n?n.length:0,i=new Array(r);e<r;++e)i[e]=fn(t,n[e]);return i};function yn(){Gt.stopImmediatePropagation()}var vn=function(){Gt.preventDefault(),Gt.stopImmediatePropagation()},_n=function(t){var n=t.document.documentElement,e=on(t).on("dragstart.drag",vn,!0);"onselectstart"in n?e.on("selectstart.drag",vn,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")};function mn(t,n){var e=t.document.documentElement,r=on(t).on("dragstart.drag",null);n&&(r.on("click.drag",vn,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var bn=function(t){return function(){return t}};function wn(t,n,e,r,i,o,u,a,c,s){this.target=t,this.type=n,this.subject=e,this.identifier=r,this.active=i,this.x=o,this.y=u,this.dx=a,this.dy=c,this._=s}function xn(){return!Gt.button}function kn(){return this.parentNode}function En(t){return null==t?{x:Gt.x,y:Gt.y}:t}function An(){return"ontouchstart"in this}wn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Tn=function(){var t,n,e,r,i=xn,o=kn,u=En,a=An,c={},s=ht("start","drag","end"),l=0,f=0;function h(t){t.on("mousedown.drag",d).filter(a).on("touchstart.drag",y).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(){if(!r&&i.apply(this,arguments)){var u=m("mouse",o.apply(this,arguments),hn,this,arguments);u&&(on(Gt.view).on("mousemove.drag",p,!0).on("mouseup.drag",g,!0),_n(Gt.view),yn(),e=!1,t=Gt.clientX,n=Gt.clientY,u("start"))}}function p(){if(vn(),!e){var r=Gt.clientX-t,i=Gt.clientY-n;e=r*r+i*i>f}c.mouse("drag")}function g(){on(Gt.view).on("mousemove.drag mouseup.drag",null),mn(Gt.view,e),vn(),c.mouse("end")}function y(){if(i.apply(this,arguments)){var t,n,e=Gt.changedTouches,r=o.apply(this,arguments),u=e.length;for(t=0;t<u;++t)(n=m(e[t].identifier,r,pn,this,arguments))&&(yn(),n("start"))}}function v(){var t,n,e=Gt.changedTouches,r=e.length;for(t=0;t<r;++t)(n=c[e[t].identifier])&&(vn(),n("drag"))}function _(){var t,n,e=Gt.changedTouches,i=e.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),t=0;t<i;++t)(n=c[e[t].identifier])&&(yn(),n("end"))}function m(t,n,e,r,i){var o,a,f,d=e(n,t),p=s.copy();if(Kt(new wn(h,"beforestart",o,t,l,d[0],d[1],0,0,p),function(){return null!=(Gt.subject=o=u.apply(r,i))&&(a=o.x-d[0]||0,f=o.y-d[1]||0,!0)}))return function u(s){var g,y=d;switch(s){case"start":c[t]=u,g=l++;break;case"end":delete c[t],--l;case"drag":d=e(n,t),g=l}Kt(new wn(h,s,o,t,g,d[0]+a,d[1]+f,d[0]-y[0],d[1]-y[1],p),p.apply,p,[s,r,i])}}return h.filter=function(t){return arguments.length?(i="function"==typeof t?t:bn(!!t),h):i},h.container=function(t){return arguments.length?(o="function"==typeof t?t:bn(t),h):o},h.subject=function(t){return arguments.length?(u="function"==typeof t?t:bn(t),h):u},h.touchable=function(t){return arguments.length?(a="function"==typeof t?t:bn(!!t),h):a},h.on=function(){var t=s.on.apply(s,arguments);return t===s?h:t},h.clickDistance=function(t){return arguments.length?(f=(t=+t)*t,h):Math.sqrt(f)},h},Sn=function(t,n,e){t.prototype=n.prototype=e,e.constructor=t};function Dn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Mn(){}var Cn="\\s*([+-]?\\d+)\\s*",On="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ln="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nn=/^#([0-9a-f]{3})$/,Fn=/^#([0-9a-f]{6})$/,Rn=new RegExp("^rgb\\("+[Cn,Cn,Cn]+"\\)$"),Bn=new RegExp("^rgb\\("+[Ln,Ln,Ln]+"\\)$"),In=new RegExp("^rgba\\("+[Cn,Cn,Cn,On]+"\\)$"),Pn=new RegExp("^rgba\\("+[Ln,Ln,Ln,On]+"\\)$"),jn=new RegExp("^hsl\\("+[On,Ln,Ln]+"\\)$"),qn=new RegExp("^hsla\\("+[On,Ln,Ln,On]+"\\)$"),Un={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 zn(t){var n;return t=(t+"").trim().toLowerCase(),(n=Nn.exec(t))?new Gn((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=Fn.exec(t))?Yn(parseInt(n[1],16)):(n=Rn.exec(t))?new Gn(n[1],n[2],n[3],1):(n=Bn.exec(t))?new Gn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=In.exec(t))?$n(n[1],n[2],n[3],n[4]):(n=Pn.exec(t))?$n(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=jn.exec(t))?Zn(n[1],n[2]/100,n[3]/100,1):(n=qn.exec(t))?Zn(n[1],n[2]/100,n[3]/100,n[4]):Un.hasOwnProperty(t)?Yn(Un[t]):"transparent"===t?new Gn(NaN,NaN,NaN,0):null}function Yn(t){return new Gn(t>>16&255,t>>8&255,255&t,1)}function $n(t,n,e,r){return r<=0&&(t=n=e=NaN),new Gn(t,n,e,r)}function Vn(t){return t instanceof Mn||(t=zn(t)),t?new Gn((t=t.rgb()).r,t.g,t.b,t.opacity):new Gn}function Wn(t,n,e,r){return 1===arguments.length?Vn(t):new Gn(t,n,e,null==r?1:r)}function Gn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Zn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Jn(t,n,e,r)}function Xn(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Jn)return new Jn(t.h,t.s,t.l,t.opacity);if(t instanceof Mn||(t=zn(t)),!t)return new Jn;if(t instanceof Jn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,c=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e<r):e===o?(r-n)/a+2:(n-e)/a+4,a/=c<.5?o+i:2-o-i,u*=60):a=c>0&&c<1?0:u,new Jn(u,a,c,t.opacity)}(t):new Jn(t,n,e,null==r?1:r)}function Jn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Sn(Mn,zn,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Sn(Gn,Wn,Dn(Mn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Gn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Gn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Hn(this.r)+Hn(this.g)+Hn(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Sn(Jn,Xn,Dn(Mn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Gn(Kn(t>=240?t-240:t+120,i,r),Kn(t,i,r),Kn(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 Qn=Math.PI/180,te=180/Math.PI,ne=.96422,ee=1,re=.82521,ie=4/29,oe=6/29,ue=3*oe*oe,ae=oe*oe*oe;function ce(t){if(t instanceof fe)return new fe(t.l,t.a,t.b,t.opacity);if(t instanceof me){if(isNaN(t.h))return new fe(t.l,0,0,t.opacity);var n=t.h*Qn;return new fe(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Gn||(t=Vn(t));var e,r,i=ge(t.r),o=ge(t.g),u=ge(t.b),a=he((.2225045*i+.7168786*o+.0606169*u)/ee);return i===o&&o===u?e=r=a:(e=he((.4360747*i+.3850649*o+.1430804*u)/ne),r=he((.0139322*i+.0971045*o+.7141733*u)/re)),new fe(116*a-16,500*(e-a),200*(a-r),t.opacity)}function se(t,n){return new fe(t,0,0,null==n?1:n)}function le(t,n,e,r){return 1===arguments.length?ce(t):new fe(t,n,e,null==r?1:r)}function fe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function he(t){return t>ae?Math.pow(t,1/3):t/ue+ie}function de(t){return t>oe?t*t*t:ue*(t-ie)}function pe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ge(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ye(t){if(t instanceof me)return new me(t.h,t.c,t.l,t.opacity);if(t instanceof fe||(t=ce(t)),0===t.a&&0===t.b)return new me(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*te;return new me(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function ve(t,n,e,r){return 1===arguments.length?ye(t):new me(e,n,t,null==r?1:r)}function _e(t,n,e,r){return 1===arguments.length?ye(t):new me(t,n,e,null==r?1:r)}function me(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}Sn(fe,le,Dn(Mn,{brighter:function(t){return new fe(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new fe(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Gn(pe(3.1338561*(n=ne*de(n))-1.6168667*(t=ee*de(t))-.4906146*(e=re*de(e))),pe(-.9787684*n+1.9161415*t+.033454*e),pe(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Sn(me,_e,Dn(Mn,{brighter:function(t){return new me(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new me(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return ce(this).rgb()}}));var be=-.29227,we=-.90649,xe=1.97294,ke=xe*we,Ee=1.78277*xe,Ae=1.78277*be- -.14861*we;function Te(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Se)return new Se(t.h,t.s,t.l,t.opacity);t instanceof Gn||(t=Vn(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Ae*r+ke*n-Ee*e)/(Ae+ke-Ee),o=r-i,u=(xe*(e-i)-be*o)/we,a=Math.sqrt(u*u+o*o)/(xe*i*(1-i)),c=a?Math.atan2(u,o)*te-120:NaN;return new Se(c<0?c+360:c,a,i,t.opacity)}(t):new Se(t,n,e,null==r?1:r)}function Se(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function De(t,n,e,r,i){var o=t*t,u=o*t;return((1-3*t+3*o-u)*n+(4-6*o+3*u)*e+(1+3*t+3*o-3*u)*r+u*i)/6}Sn(Se,Te,Dn(Mn,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Se(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Se(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Qn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Gn(255*(n+e*(-.14861*r+1.78277*i)),255*(n+e*(be*r+we*i)),255*(n+e*(xe*r)),this.opacity)}}));var Me=function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],u=r>0?t[r-1]:2*i-o,a=r<n-1?t[r+2]:2*o-i;return De((e-r/n)*n,u,i,o,a)}},Ce=function(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],u=t[(r+1)%n],a=t[(r+2)%n];return De((e-r/n)*n,i,o,u,a)}},Oe=function(t){return function(){return t}};function Le(t,n){return function(e){return t+e*n}}function Ne(t,n){var e=n-t;return e?Le(t,e>180||e<-180?e-360*Math.round(e/360):e):Oe(isNaN(t)?n:t)}function Fe(t){return 1==(t=+t)?Re:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Oe(isNaN(n)?e:n)}}function Re(t,n){var e=n-t;return e?Le(t,e):Oe(isNaN(t)?n:t)}var Be=function t(n){var e=Fe(n);function r(t,n){var r=e((t=Wn(t)).r,(n=Wn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=Re(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}return r.gamma=t,r}(1);function Ie(t){return function(n){var e,r,i=n.length,o=new Array(i),u=new Array(i),a=new Array(i);for(e=0;e<i;++e)r=Wn(n[e]),o[e]=r.r||0,u[e]=r.g||0,a[e]=r.b||0;return o=t(o),u=t(u),a=t(a),r.opacity=1,function(t){return r.r=o(t),r.g=u(t),r.b=a(t),r+""}}}var Pe=Ie(Me),je=Ie(Ce),qe=function(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),u=new Array(r);for(e=0;e<i;++e)o[e]=Je(t[e],n[e]);for(;e<r;++e)u[e]=n[e];return function(t){for(e=0;e<i;++e)u[e]=o[e](t);return u}},Ue=function(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}},ze=function(t,n){return n-=t=+t,function(e){return t+n*e}},Ye=function(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Je(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}},$e=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ve=new RegExp($e.source,"g");var We,Ge,He,Ze,Xe=function(t,n){var e,r,i,o=$e.lastIndex=Ve.lastIndex=0,u=-1,a=[],c=[];for(t+="",n+="";(e=$e.exec(t))&&(r=Ve.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:ze(e,r)})),o=Ve.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)a[(e=c[r]).i]=e.x(t);return a.join("")})},Je=function(t,n){var e,r=typeof n;return null==n||"boolean"===r?Oe(n):("number"===r?ze:"string"===r?(e=zn(n))?(n=e,Be):Xe:n instanceof zn?Be:n instanceof Date?Ue:Array.isArray(n)?qe:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Ye:ze)(t,n)},Ke=function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},Qe=function(t,n){var e=Ne(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},tr=function(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}},nr=180/Math.PI,er={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},rr=function(t,n,e,r,i,o){var u,a,c;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,c/=a),t*r<n*e&&(t=-t,n=-n,c=-c,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*nr,skewX:Math.atan(c)*nr,scaleX:u,scaleY:a}};function ir(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,u){var a=[],c=[];return o=t(o),u=t(u),function(t,r,i,o,u,a){if(t!==i||r!==o){var c=u.push("translate(",null,n,null,e);a.push({i:c-4,x:ze(t,i)},{i:c-2,x:ze(r,o)})}else(i||o)&&u.push("translate("+i+n+o+e)}(o.translateX,o.translateY,u.translateX,u.translateY,a,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:ze(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,u.rotate,a,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:ze(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,u.skewX,a,c),function(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:ze(t,e)},{i:a-2,x:ze(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,u.scaleX,u.scaleY,a,c),o=u=null,function(t){for(var n,e=-1,r=c.length;++e<r;)a[(n=c[e]).i]=n.x(t);return a.join("")}}}var or=ir(function(t){return"none"===t?er:(We||(We=document.createElement("DIV"),Ge=document.documentElement,He=document.defaultView),We.style.transform=t,t=He.getComputedStyle(Ge.appendChild(We),null).getPropertyValue("transform"),Ge.removeChild(We),t=t.slice(7,-1).split(","),rr(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),ur=ir(function(t){return null==t?er:(Ze||(Ze=document.createElementNS("http://www.w3.org/2000/svg","g")),Ze.setAttribute("transform",t),(t=Ze.transform.baseVal.consolidate())?(t=t.matrix,rr(t.a,t.b,t.c,t.d,t.e,t.f)):er)},", ",")",")"),ar=Math.SQRT2;function cr(t){return((t=Math.exp(t))+1/t)/2}var sr=function(t,n){var e,r,i=t[0],o=t[1],u=t[2],a=n[0],c=n[1],s=n[2],l=a-i,f=c-o,h=l*l+f*f;if(h<1e-12)r=Math.log(s/u)/ar,e=function(t){return[i+t*l,o+t*f,u*Math.exp(ar*t*r)]};else{var d=Math.sqrt(h),p=(s*s-u*u+4*h)/(2*u*2*d),g=(s*s-u*u-4*h)/(2*s*2*d),y=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(g*g+1)-g);r=(v-y)/ar,e=function(t){var n,e=t*r,a=cr(y),c=u/(2*d)*(a*(n=ar*e+y,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(y));return[i+c*l,o+c*f,u*a/cr(ar*e+y)]}}return e.duration=1e3*r,e};function lr(t){return function(n,e){var r=t((n=Xn(n)).h,(e=Xn(e)).h),i=Re(n.s,e.s),o=Re(n.l,e.l),u=Re(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=u(t),n+""}}}var fr=lr(Ne),hr=lr(Re);function dr(t,n){var e=Re((t=le(t)).l,(n=le(n)).l),r=Re(t.a,n.a),i=Re(t.b,n.b),o=Re(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}}function pr(t){return function(n,e){var r=t((n=_e(n)).h,(e=_e(e)).h),i=Re(n.c,e.c),o=Re(n.l,e.l),u=Re(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=u(t),n+""}}}var gr=pr(Ne),yr=pr(Re);function vr(t){return function n(e){function r(n,r){var i=t((n=Te(n)).h,(r=Te(r)).h),o=Re(n.s,r.s),u=Re(n.l,r.l),a=Re(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=u(Math.pow(t,e)),n.opacity=a(t),n+""}}return e=+e,r.gamma=n,r}(1)}var _r=vr(Ne),mr=vr(Re);function br(t,n){for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var wr,xr,kr=function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e},Er=0,Ar=0,Tr=0,Sr=1e3,Dr=0,Mr=0,Cr=0,Or="object"==typeof performance&&performance.now?performance:Date,Lr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Nr(){return Mr||(Lr(Fr),Mr=Or.now()+Cr)}function Fr(){Mr=0}function Rr(){this._call=this._time=this._next=null}function Br(t,n,e){var r=new Rr;return r.restart(t,n,e),r}function Ir(){Nr(),++Er;for(var t,n=wr;n;)(t=Mr-n._time)>=0&&n._call.call(null,t),n=n._next;--Er}function Pr(){Mr=(Dr=Or.now())+Cr,Er=Ar=0;try{Ir()}finally{Er=0,function(){var t,n,e=wr,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:wr=n);xr=t,qr(r)}(),Mr=0}}function jr(){var t=Or.now(),n=t-Dr;n>Sr&&(Cr-=n,Dr=t)}function qr(t){Er||(Ar&&(Ar=clearTimeout(Ar)),t-Mr>24?(t<1/0&&(Ar=setTimeout(Pr,t-Or.now()-Cr)),Tr&&(Tr=clearInterval(Tr))):(Tr||(Dr=Or.now(),Tr=setInterval(jr,Sr)),Er=1,Lr(Pr)))}Rr.prototype=Br.prototype={constructor:Rr,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Nr():+e)+(null==n?0:+n),this._next||xr===this||(xr?xr._next=this:wr=this,xr=this),this._call=t,this._time=e,qr()},stop:function(){this._call&&(this._call=null,this._time=1/0,qr())}};var Ur=function(t,n,e){var r=new Rr;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r},zr=function(t,n,e){var r=new Rr,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?Nr():+e,r.restart(function o(u){u+=i,r.restart(o,i+=n,e),t(u)},n,e),r)},Yr=ht("start","end","interrupt"),$r=[],Vr=0,Wr=1,Gr=2,Hr=3,Zr=4,Xr=5,Jr=6,Kr=function(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(c){var s,l,f,h;if(e.state!==Wr)return a();for(s in i)if((h=i[s]).name===e.name){if(h.state===Hr)return Ur(o);h.state===Zr?(h.state=Jr,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[s]):+s<n&&(h.state=Jr,h.timer.stop(),delete i[s])}if(Ur(function(){e.state===Hr&&(e.state=Zr,e.timer.restart(u,e.delay,e.time),u(c))}),e.state=Gr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Gr){for(e.state=Hr,r=new Array(f=e.tween.length),s=0,l=-1;s<f;++s)(h=e.tween[s].value.call(t,t.__data__,e.index,e.group))&&(r[++l]=h);r.length=l+1}}function u(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(a),e.state=Xr,1),o=-1,u=r.length;++o<u;)r[o].call(null,i);e.state===Xr&&(e.on.call("end",t,t.__data__,e.index,e.group),a())}function a(){for(var r in e.state=Jr,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Br(function(t){e.state=Wr,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)},0,e.time)}(t,e,{name:n,index:r,group:i,on:Yr,tween:$r,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Vr})};function Qr(t,n){var e=ni(t,n);if(e.state>Vr)throw new Error("too late; already scheduled");return e}function ti(t,n){var e=ni(t,n);if(e.state>Gr)throw new Error("too late; already started");return e}function ni(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var ei=function(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Gr&&e.state<Xr,e.state=Jr,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}};function ri(t,n,e){var r=t._id;return t.each(function(){var t=ti(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return ni(t,r).value[n]}}var ii=function(t,n){var e;return("number"==typeof n?ze:n instanceof zn?Be:(e=zn(n))?(n=e,Be):Xe)(t,n)};var oi=rn.prototype.constructor;var ui=0;function ai(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ci(t){return rn().transition(t)}function si(){return++ui}var li=rn.prototype;function fi(t){return+t}function hi(t){return t*t}function di(t){return t*(2-t)}function pi(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function gi(t){return t*t*t}function yi(t){return--t*t*t+1}function vi(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}ai.prototype=ci.prototype={constructor:ai,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=_t(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,c,s=r[u],l=s.length,f=o[u]=new Array(l),h=0;h<l;++h)(a=s[h])&&(c=t.call(a,a.__data__,h,s))&&("__data__"in a&&(c.__data__=a.__data__),f[h]=c,Kr(f[h],n,e,h,f,ni(a,e)));return new ai(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=bt(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var c,s=r[a],l=s.length,f=0;f<l;++f)if(c=s[f]){for(var h,d=t.call(c,c.__data__,f,s),p=ni(c,e),g=0,y=d.length;g<y;++g)(h=d[g])&&Kr(h,n,e,g,d,p);o.push(d),u.push(c)}return new ai(o,u,n,e)},filter:function(t){"function"!=typeof t&&(t=Et(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,c=r[i]=[],s=0;s<a;++s)(o=u[s])&&t.call(o,o.__data__,s,u)&&c.push(o);return new ai(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var c,s=n[a],l=e[a],f=s.length,h=u[a]=new Array(f),d=0;d<f;++d)(c=s[d]||l[d])&&(h[d]=c);for(;a<r;++a)u[a]=n[a];return new ai(u,this._parents,this._name,this._id)},selection:function(){return new oi(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=si(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],c=a.length,s=0;s<c;++s)if(u=a[s]){var l=ni(u,n);Kr(u,t,e,s,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ai(r,this._parents,t,e)},call:li.call,nodes:li.nodes,node:li.node,size:li.size,empty:li.empty,each:li.each,on:function(t,n){var e=this._id;return arguments.length<2?ni(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}(n)?Qr:ti;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}(e,t,n))},attr:function(t,n){var e=gt(t),r="transform"===e?ur:ii;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,i,o;return function(){var u,a=e(this);if(null!=a)return(u=this.getAttributeNS(t.space,t.local))===a?null:u===r&&a===i?o:o=n(r=u,i=a);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,i,o;return function(){var u,a=e(this);if(null!=a)return(u=this.getAttribute(t))===a?null:u===r&&a===i?o:o=n(r=u,i=a);this.removeAttribute(t)}})(e,r,ri(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}:function(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.t