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