cryptpad/www/lib/markmap/view.min.js

3 lines
66 KiB
JavaScript

/*! markmap-lib v0.7.11 | MIT License */
define(["exports"],(function(t){"use strict";function n(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}var e,r;1===(e=n).length&&(r=e,e=function(t,e){return n(r(t),e)});function i(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}function o(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}var a={value:function(){}};function s(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new u(r)}function u(t){this._=t}function l(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function c(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function h(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=a,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}u.prototype=s.prototype={constructor:u,on:function(t,n){var e,r=this._,i=l(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<a;)if(e=(t=i[o]).type)r[e]=h(r[e],t.name,n);else if(null==n)for(e in r)r[e]=h(r[e],t.name,null);return this}for(;++o<a;)if((e=(t=i[o]).type)&&(e=c(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new u(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 f="http://www.w3.org/1999/xhtml",p={svg:"http://www.w3.org/2000/svg",xhtml:f,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function d(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),p.hasOwnProperty(n)?{space:p[n],local:t}:t}function m(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===f&&n.documentElement.namespaceURI===f?n.createElement(t):n.createElementNS(e,t)}}function g(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function y(t){var n=d(t);return(n.local?g:m)(n)}function v(){}function _(t){return null==t?v:function(){return this.querySelector(t)}}function w(){return[]}function x(t){return null==t?w:function(){return this.querySelectorAll(t)}}function b(t){return function(){return this.matches(t)}}function z(t){return new Array(t.length)}function k(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}k.prototype={constructor:k,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function M(t,n,e,r,i,o){for(var a,s=0,u=n.length,l=o.length;s<l;++s)(a=n[s])?(a.__data__=o[s],r[s]=a):e[s]=new k(t,o[s]);for(;s<u;++s)(a=n[s])&&(i[s]=a)}function E(t,n,e,r,i,o,a){var s,u,l,c={},h=n.length,f=o.length,p=new Array(h);for(s=0;s<h;++s)(u=n[s])&&(p[s]=l="$"+a.call(u,u.__data__,s,n),l in c?i[s]=u:c[l]=u);for(s=0;s<f;++s)(u=c[l="$"+a.call(t,o[s],s,o)])?(r[s]=u,u.__data__=o[s],c[l]=null):e[s]=new k(t,o[s]);for(s=0;s<h;++s)(u=n[s])&&c[p[s]]===u&&(i[s]=u)}function S(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function A(t){return function(){this.removeAttribute(t)}}function N(t){return function(){this.removeAttributeNS(t.space,t.local)}}function X(t,n){return function(){this.setAttribute(t,n)}}function $(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function C(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(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function O(t){return function(){this.style.removeProperty(t)}}function P(t,n,e){return function(){this.style.setProperty(t,n,e)}}function R(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function I(t,n){return t.style.getPropertyValue(n)||T(t).getComputedStyle(t,null).getPropertyValue(n)}function q(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function B(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function D(t){return t.trim().split(/^|\s+/)}function H(t){return t.classList||new L(t)}function L(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function V(t,n){for(var e=H(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function U(t,n){for(var e=H(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function F(t){return function(){V(this,t)}}function G(t){return function(){U(this,t)}}function Z(t,n){return function(){(n.apply(this,arguments)?V:U)(this,t)}}function J(){this.textContent=""}function K(t){return function(){this.textContent=t}}function Q(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function W(){this.innerHTML=""}function tt(t){return function(){this.innerHTML=t}}function nt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function et(){this.nextSibling&&this.parentNode.appendChild(this)}function rt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function it(){return null}function ot(){var t=this.parentNode;t&&t.removeChild(this)}function at(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function st(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}L.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}};var ut={},lt=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(ut={mouseenter:"mouseover",mouseleave:"mouseout"}));function ct(t,n,e){return t=ht(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function ht(t,n,e){return function(r){var i=lt;lt=r;try{t.call(this,this.__data__,n,e)}finally{lt=i}}}function ft(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}}))}function pt(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 dt(t,n,e){var r=ut.hasOwnProperty(t.type)?ct:ht;return function(i,o,a){var s,u=this.__on,l=r(n,o,a);if(u)for(var c=0,h=u.length;c<h;++c)if((s=u[c]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=l,s.capture=e),void(s.value=n);this.addEventListener(t.type,l,e),s={type:t.type,name:t.name,value:n,listener:l,capture:e},u?u.push(s):this.__on=[s]}}function mt(t,n,e){var r=T(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)}function gt(t,n){return function(){return mt(this,t,n)}}function yt(t,n){return function(){return mt(this,t,n.apply(this,arguments))}}var vt=[null];function _t(t,n){this._groups=t,this._parents=n}function wt(){return new _t([[document.documentElement]],vt)}function xt(t){return"string"==typeof t?new _t([[document.querySelector(t)]],[document.documentElement]):new _t([[t]],vt)}function bt(){for(var t,n=lt;t=n.sourceEvent;)n=t;return n}function zt(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]}function kt(t){var n=bt();return n.changedTouches&&(n=n.changedTouches[0]),zt(t,n)}function Mt(t,n,e){arguments.length<3&&(e=n,n=bt().changedTouches);for(var r,i=0,o=n?n.length:0;i<o;++i)if((r=n[i]).identifier===e)return zt(t,r);return null}function Et(){lt.preventDefault(),lt.stopImmediatePropagation()}function St(t){var n=t.document.documentElement,e=xt(t).on("dragstart.drag",Et,!0);"onselectstart"in n?e.on("selectstart.drag",Et,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function At(t,n){var e=t.document.documentElement,r=xt(t).on("dragstart.drag",null);n&&(r.on("click.drag",Et,!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)}function Nt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Xt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function $t(){}_t.prototype=wt.prototype={constructor:_t,select:function(t){"function"!=typeof t&&(t=_(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,s=n[i],u=s.length,l=r[i]=new Array(u),c=0;c<u;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);return new _t(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=x(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,s=n[o],u=s.length,l=0;l<u;++l)(a=s[l])&&(r.push(t.call(a,a.__data__,l,s)),i.push(a));return new _t(r,i)},filter:function(t){"function"!=typeof t&&(t=b(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new _t(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=n?E:M,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),u=new Array(o),l=0;l<o;++l){var c=r[l],h=i[l],f=h.length,p=t.call(c,c&&c.__data__,l,r),d=p.length,m=s[l]=new Array(d),g=a[l]=new Array(d);e(c,h,m,g,u[l]=new Array(f),p,n);for(var y,v,_=0,w=0;_<d;++_)if(y=m[_]){for(_>=w&&(w=_+1);!(v=g[w])&&++w<d;);y._next=v||null}}return(a=new _t(a,r))._enter=s,a._exit=u,a},enter:function(){return new _t(this._enter||this._groups.map(z),this._parents)},exit:function(){return new _t(this._exit||this._groups.map(z),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u,l=n[s],c=e[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new _t(a,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,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=S);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,s=e[o],u=s.length,l=i[o]=new Array(u),c=0;c<u;++c)(a=s[c])&&(l[c]=a);l.sort(n)}return new _t(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 a=r[i];if(a)return a}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],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=d(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?N:A:"function"==typeof n?e.local?C:j:e.local?$:X)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?O:"function"==typeof n?R:P)(t,n,null==e?"":e)):I(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?q:"function"==typeof n?B:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=D(t+"");if(arguments.length<2){for(var r=H(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Z:n?F:G)(e,n))},text:function(t){return arguments.length?this.each(null==t?J:("function"==typeof t?Q:K)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?nt:tt)(t)):this.node().innerHTML},raise:function(){return this.each(et)},lower:function(){return this.each(rt)},append:function(t){var n="function"==typeof t?t:y(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:y(t),r=null==n?it:"function"==typeof n?n:_(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ot)},clone:function(t){return this.select(t?st:at)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=ft(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?dt:pt,null==e&&(e=!1),r=0;r<a;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var u,l=0,c=s.length;l<c;++l)for(r=0,u=s[l];r<a;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value},dispatch:function(t,n){return this.each(("function"==typeof n?yt:gt)(t,n))}};var jt="\\s*([+-]?\\d+)\\s*",Ct="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Tt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ot=/^#([0-9a-f]{3,8})$/,Pt=new RegExp("^rgb\\("+[jt,jt,jt]+"\\)$"),Rt=new RegExp("^rgb\\("+[Tt,Tt,Tt]+"\\)$"),It=new RegExp("^rgba\\("+[jt,jt,jt,Ct]+"\\)$"),qt=new RegExp("^rgba\\("+[Tt,Tt,Tt,Ct]+"\\)$"),Yt=new RegExp("^hsl\\("+[Ct,Tt,Tt]+"\\)$"),Bt=new RegExp("^hsla\\("+[Ct,Tt,Tt,Ct]+"\\)$"),Dt={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 Ht(){return this.rgb().formatHex()}function Lt(){return this.rgb().formatRgb()}function Vt(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Ot.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Ut(n):3===e?new Jt(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Ft(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Ft(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Pt.exec(t))?new Jt(n[1],n[2],n[3],1):(n=Rt.exec(t))?new Jt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=It.exec(t))?Ft(n[1],n[2],n[3],n[4]):(n=qt.exec(t))?Ft(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Yt.exec(t))?tn(n[1],n[2]/100,n[3]/100,1):(n=Bt.exec(t))?tn(n[1],n[2]/100,n[3]/100,n[4]):Dt.hasOwnProperty(t)?Ut(Dt[t]):"transparent"===t?new Jt(NaN,NaN,NaN,0):null}function Ut(t){return new Jt(t>>16&255,t>>8&255,255&t,1)}function Ft(t,n,e,r){return r<=0&&(t=n=e=NaN),new Jt(t,n,e,r)}function Gt(t){return t instanceof $t||(t=Vt(t)),t?new Jt((t=t.rgb()).r,t.g,t.b,t.opacity):new Jt}function Zt(t,n,e,r){return 1===arguments.length?Gt(t):new Jt(t,n,e,null==r?1:r)}function Jt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Kt(){return"#"+Wt(this.r)+Wt(this.g)+Wt(this.b)}function Qt(){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+")")}function Wt(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function tn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new en(t,n,e,r)}function nn(t){if(t instanceof en)return new en(t.h,t.s,t.l,t.opacity);if(t instanceof $t||(t=Vt(t)),!t)return new en;if(t instanceof en)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),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new en(a,s,u,t.opacity)}function en(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function rn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function on(t){return function(){return t}}function an(t){return 1==(t=+t)?sn: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):on(isNaN(n)?e:n)}}function sn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):on(isNaN(t)?n:t)}Nt($t,Vt,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Ht,formatHex:Ht,formatHsl:function(){return nn(this).formatHsl()},formatRgb:Lt,toString:Lt}),Nt(Jt,Zt,Xt($t,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Jt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Kt,formatHex:Kt,formatRgb:Qt,toString:Qt})),Nt(en,(function(t,n,e,r){return 1===arguments.length?nn(t):new en(t,n,e,null==r?1:r)}),Xt($t,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new en(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new en(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 Jt(rn(t>=240?t-240:t+120,i,r),rn(t,i,r),rn(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},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var un=function t(n){var e=an(n);function r(t,n){var r=e((t=Zt(t)).r,(n=Zt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=sn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function ln(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var cn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hn=new RegExp(cn.source,"g");function fn(t,n){var e,r,i,o=cn.lastIndex=hn.lastIndex=0,a=-1,s=[],u=[];for(t+="",n+="";(e=cn.exec(t))&&(r=hn.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:ln(e,r)})),o=hn.lastIndex;return o<n.length&&(i=n.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(n){return t(n)+""}}(u[0].x):function(t){return function(){return t}}(n):(n=u.length,function(t){for(var e,r=0;r<n;++r)s[(e=u[r]).i]=e.x(t);return s.join("")})}var pn,dn,mn,gn,yn=180/Math.PI,vn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _n(t,n,e,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(u=t*e+n*r)&&(e-=t*u,r-=n*u),(s=Math.sqrt(e*e+r*r))&&(e/=s,r/=s,u/=s),t*r<n*e&&(t=-t,n=-n,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*yn,skewX:Math.atan(u)*yn,scaleX:a,scaleY:s}}function wn(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,n,null,e);s.push({i:u-4,x:ln(t,i)},{i:u-2,x:ln(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),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:ln(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,s,u),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:ln(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,s,u),function(t,n,e,r,o,a){if(t!==e||n!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:ln(t,e)},{i:s-2,x:ln(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var n,e=-1,r=u.length;++e<r;)s[(n=u[e]).i]=n.x(t);return s.join("")}}}var xn=wn((function(t){return"none"===t?vn:(pn||(pn=document.createElement("DIV"),dn=document.documentElement,mn=document.defaultView),pn.style.transform=t,t=mn.getComputedStyle(dn.appendChild(pn),null).getPropertyValue("transform"),dn.removeChild(pn),_n(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),bn=wn((function(t){return null==t?vn:(gn||(gn=document.createElementNS("http://www.w3.org/2000/svg","g")),gn.setAttribute("transform",t),(t=gn.transform.baseVal.consolidate())?_n((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):vn)}),", ",")",")"),zn=Math.SQRT2;function kn(t){return((t=Math.exp(t))+1/t)/2}function Mn(t,n){var e,r,i=t[0],o=t[1],a=t[2],s=n[0],u=n[1],l=n[2],c=s-i,h=u-o,f=c*c+h*h;if(f<1e-12)r=Math.log(l/a)/zn,e=function(t){return[i+t*c,o+t*h,a*Math.exp(zn*t*r)]};else{var p=Math.sqrt(f),d=(l*l-a*a+4*f)/(2*a*2*p),m=(l*l-a*a-4*f)/(2*l*2*p),g=Math.log(Math.sqrt(d*d+1)-d),y=Math.log(Math.sqrt(m*m+1)-m);r=(y-g)/zn,e=function(t){var n=t*r,e=kn(g),s=a/(2*p)*(e*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(zn*n+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+s*c,o+s*h,a*e/kn(zn*n+g)]}}return e.duration=1e3*r,e}var En,Sn,An=0,Nn=0,Xn=0,$n=0,jn=0,Cn=0,Tn="object"==typeof performance&&performance.now?performance:Date,On="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Pn(){return jn||(On(Rn),jn=Tn.now()+Cn)}function Rn(){jn=0}function In(){this._call=this._time=this._next=null}function qn(t,n,e){var r=new In;return r.restart(t,n,e),r}function Yn(){jn=($n=Tn.now())+Cn,An=Nn=0;try{!function(){Pn(),++An;for(var t,n=En;n;)(t=jn-n._time)>=0&&n._call.call(null,t),n=n._next;--An}()}finally{An=0,function(){var t,n,e=En,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:En=n);Sn=t,Dn(r)}(),jn=0}}function Bn(){var t=Tn.now(),n=t-$n;n>1e3&&(Cn-=n,$n=t)}function Dn(t){An||(Nn&&(Nn=clearTimeout(Nn)),t-jn>24?(t<1/0&&(Nn=setTimeout(Yn,t-Tn.now()-Cn)),Xn&&(Xn=clearInterval(Xn))):(Xn||($n=Tn.now(),Xn=setInterval(Bn,1e3)),An=1,On(Yn)))}function Hn(t,n,e){var r=new In;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r}In.prototype=qn.prototype={constructor:In,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Pn():+e)+(null==n?0:+n),this._next||Sn===this||(Sn?Sn._next=this:En=this,Sn=this),this._call=t,this._time=e,Dn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dn())}};var Ln=s("start","end","cancel","interrupt"),Vn=[];function Un(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var l,c,h,f;if(1!==e.state)return s();for(l in i)if((f=i[l]).name===e.name){if(3===f.state)return Hn(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l<n&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[l])}if(Hn((function(){3===e.state&&(e.state=4,e.timer.restart(a,e.delay,e.time),a(u))})),e.state=2,e.on.call("start",t,t.__data__,e.index,e.group),2===e.state){for(e.state=3,r=new Array(h=e.tween.length),l=0,c=-1;l<h;++l)(f=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(r[++c]=f);r.length=c+1}}function a(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(s),e.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===e.state&&(e.on.call("end",t,t.__data__,e.index,e.group),s())}function s(){for(var r in e.state=6,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=qn((function(t){e.state=1,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:Ln,tween:Vn,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Fn(t,n){var e=Zn(t,n);if(e.state>0)throw new Error("too late; already scheduled");return e}function Gn(t,n){var e=Zn(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Zn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Jn(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}function Kn(t,n){var e,r;return function(){var i=Gn(this,t),o=i.tween;if(o!==e)for(var a=0,s=(r=e=o).length;a<s;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function Qn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Gn(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:n,value:e},u=0,l=i.length;u<l;++u)if(i[u].name===n){i[u]=s;break}u===l&&i.push(s)}o.tween=i}}function Wn(t,n,e){var r=t._id;return t.each((function(){var t=Gn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Zn(t,r).value[n]}}function te(t,n){var e;return("number"==typeof n?ln:n instanceof Vt?un:(e=Vt(n))?(n=e,un):fn)(t,n)}function ne(t){return function(){this.removeAttribute(t)}}function ee(t){return function(){this.removeAttributeNS(t.space,t.local)}}function re(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function ie(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function oe(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttribute(t)}}function ae(t,n,e){var r,i,o;return function(){var a,s,u=e(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===r&&s===i?o:(i=s,o=n(r=a,u));this.removeAttributeNS(t.space,t.local)}}function se(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}function ue(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}function le(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&ue(t,i)),e}return i._value=n,i}function ce(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&se(t,i)),e}return i._value=n,i}function he(t,n){return function(){Fn(this,t).delay=+n.apply(this,arguments)}}function fe(t,n){return n=+n,function(){Fn(this,t).delay=n}}function pe(t,n){return function(){Gn(this,t).duration=+n.apply(this,arguments)}}function de(t,n){return n=+n,function(){Gn(this,t).duration=n}}function me(t,n){if("function"!=typeof n)throw new Error;return function(){Gn(this,t).ease=n}}function ge(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)?Fn:Gn;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}var ye=wt.prototype.constructor;function ve(t){return function(){this.style.removeProperty(t)}}function _e(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function we(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&_e(t,o,e)),r}return o._value=n,o}function xe(t){return function(n){this.textContent=t.call(this,n)}}function be(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&xe(r)),n}return r._value=t,r}var ze=0;function ke(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Me(){return++ze}var Ee=wt.prototype;ke.prototype=function(t){return wt().transition(t)}.prototype={constructor:ke,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=_(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,u,l=r[a],c=l.length,h=o[a]=new Array(c),f=0;f<c;++f)(s=l[f])&&(u=t.call(s,s.__data__,f,l))&&("__data__"in s&&(u.__data__=s.__data__),h[f]=u,Un(h[f],n,e,f,h,Zn(s,e)));return new ke(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=x(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var u,l=r[s],c=l.length,h=0;h<c;++h)if(u=l[h]){for(var f,p=t.call(u,u.__data__,h,l),d=Zn(u,e),m=0,g=p.length;m<g;++m)(f=p[m])&&Un(f,n,e,m,p,d);o.push(p),a.push(u)}return new ke(o,a,n,e)},filter:function(t){"function"!=typeof t&&(t=b(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],s=a.length,u=r[i]=[],l=0;l<s;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&u.push(o);return new ke(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),a=new Array(r),s=0;s<o;++s)for(var u,l=n[s],c=e[s],h=l.length,f=a[s]=new Array(h),p=0;p<h;++p)(u=l[p]||c[p])&&(f[p]=u);for(;s<r;++s)a[s]=n[s];return new ke(a,this._parents,this._name,this._id)},selection:function(){return new ye(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Me(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)if(a=s[l]){var c=Zn(a,n);Un(a,t,e,l,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new ke(r,this._parents,t,e)},call:Ee.call,nodes:Ee.nodes,node:Ee.node,size:Ee.size,empty:Ee.empty,each:Ee.each,on:function(t,n){var e=this._id;return arguments.length<2?Zn(this.node(),e).on.on(t):this.each(ge(e,t,n))},attr:function(t,n){var e=d(t),r="transform"===e?bn:te;return this.attrTween(t,"function"==typeof n?(e.local?ae:oe)(e,r,Wn(this,"attr."+t,n)):null==n?(e.local?ee:ne)(e):(e.local?ie:re)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=d(t);return this.tween(e,(r.local?le:ce)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?xn:te;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=I(this,t),a=(this.style.removeProperty(t),I(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,ve(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=I(this,t),s=e(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=I(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}(t,r,Wn(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,s="end."+a;return function(){var u=Gn(this,t),l=u.on,c=null==u.value[a]?o||(o=ve(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=I(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,we(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Wn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,be(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Zn(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Kn:Qn)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?he:fe)(n,t)):Zn(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?pe:de)(n,t)):Zn(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(me(n,t)):Zn(this.node(),n).ease},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,a){var s={value:a},u={value:function(){0==--i&&o()}};e.each((function(){var e=Gn(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(s),n._.interrupt.push(s),n._.end.push(u)),e.on=n}))}))}};var Se={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Ae(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Se.time=Pn(),Se;return e}wt.prototype.interrupt=function(t){return this.each((function(){Jn(this,t)}))},wt.prototype.transition=function(t){var n,e;t instanceof ke?(n=t._id,t=t._name):(n=Me(),(e=Se).time=Pn(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],u=s.length,l=0;l<u;++l)(a=s[l])&&Un(a,t,n,l,s,e||Ae(a,n));return new ke(r,this._parents,t,n)};var Ne=Math.PI,Xe=2*Ne,$e=Xe-1e-6;function je(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ce(){return new je}je.prototype=Ce.prototype={constructor:je,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,a=this._y1,s=e-t,u=r-n,l=o-t,c=a-n,h=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(h>1e-6)if(Math.abs(c*s-u*l)>1e-6&&i){var f=e-o,p=r-a,d=s*s+u*u,m=f*f+p*p,g=Math.sqrt(d),y=Math.sqrt(h),v=i*Math.tan((Ne-Math.acos((d+h-m)/(2*g*y)))/2),_=v/y,w=v/g;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*f>l*p)+","+(this._x1=t+w*s)+","+(this._y1=n+w*u)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,o=!!o;var a=(e=+e)*Math.cos(r),s=e*Math.sin(r),u=t+a,l=n+s,c=1^o,h=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+u+","+l:(Math.abs(this._x1-u)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+u+","+l),e&&(h<0&&(h=h%Xe+Xe),h>$e?this._+="A"+e+","+e+",0,1,"+c+","+(t-a)+","+(n-s)+"A"+e+","+e+",0,1,"+c+","+(this._x1=u)+","+(this._y1=l):h>1e-6&&(this._+="A"+e+","+e+",0,"+ +(h>=Ne)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};function Te(){}function Oe(t,n){var e=new Te;if(t instanceof Te)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var a in t)e.set(a,t[a]);return e}function Pe(){}Te.prototype=Oe.prototype={constructor:Te,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Re=Oe.prototype;function Ie(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function qe(t,n){var e,r,i,o,a,s=new He(t),u=+t.value&&(s.value=t.value),l=[s];for(null==n&&(n=Ye);e=l.pop();)if(u&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)l.push(r=e.children[o]=new He(i[o])),r.parent=e,r.depth=e.depth+1;return s.eachBefore(De)}function Ye(t){return t.children}function Be(t){t.data=t.data.data}function De(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function He(t){this.data=t,this.depth=this.height=0,this.parent=null}function Le(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}Pe.prototype=function(t,n){var e=new Pe;if(t instanceof Pe)t.each((function(t){e.add(t)}));else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}.prototype={constructor:Pe,has:Re.has,add:function(t){return this["$"+(t+="")]=t,this},remove:Re.remove,clear:Re.clear,values:Re.keys,size:Re.size,empty:Re.empty,each:Re.each},He.prototype=qe.prototype={constructor:He,count:function(){return this.eachAfter(Ie)},each:function(t){var n,e,r,i,o=this,a=[o];do{for(n=a.reverse(),a=[];o=n.pop();)if(t(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r])}while(a.length);return this},eachAfter:function(t){for(var n,e,r,i=this,o=[i],a=[];i=o.pop();)if(a.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e]);for(;i=a.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each((function(n){t.push(n)})),t},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return qe(this).eachBefore(Be)}};var Ve=Array.prototype.slice,Ue={name:"implicit"};function Fe(){var t=Oe(),n=[],e=[],r=Ue;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Ue)return r;t.set(o,a=n.push(i))}return e[(a-1)%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=Oe();for(var r,o,a=-1,s=e.length;++a<s;)t.has(o=(r=e[a])+"")||t.set(o,n.push(r));return i},i.range=function(t){return arguments.length?(e=Ve.call(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Fe(n,e).unknown(r)},Le.apply(i,arguments),i}var Ge=function(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");function Ze(t){return function(){return t}}function Je(t){return t[0]}function Ke(t){return t[1]}var Qe=Array.prototype.slice;function We(t){return t.source}function tr(t){return t.target}function nr(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function er(){return function(t){var n=We,e=tr,r=Je,i=Ke,o=null;function a(){var a,s=Qe.call(arguments),u=n.apply(this,s),l=e.apply(this,s);if(o||(o=a=Ce()),t(o,+r.apply(this,(s[0]=u,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"==typeof t?t:Ze(+t),a):r},a.y=function(t){return arguments.length?(i="function"==typeof t?t:Ze(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}(nr)}function rr(t){return function(){return t}}function ir(t,n,e){this.target=t,this.type=n,this.transform=e}function or(t,n,e){this.k=t,this.x=n,this.y=e}or.prototype={constructor:or,scale:function(t){return 1===t?this:new or(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new or(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ar=new or(1,0,0);function sr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ar;return t.__zoom}function ur(){lt.stopImmediatePropagation()}function lr(){lt.preventDefault(),lt.stopImmediatePropagation()}function cr(){return!lt.ctrlKey&&!lt.button}function hr(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function fr(){return this.__zoom||ar}function pr(){return-lt.deltaY*(1===lt.deltaMode?.05:lt.deltaMode?1:.002)}function dr(){return navigator.maxTouchPoints||"ontouchstart"in this}function mr(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function gr(){var t,n,e=cr,r=hr,i=mr,o=pr,a=dr,u=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],c=250,h=Mn,f=s("start","zoom","end"),p=0;function d(t){t.property("__zoom",fr).on("wheel.zoom",x).on("mousedown.zoom",b).on("dblclick.zoom",z).filter(a).on("touchstart.zoom",k).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(t,n){return(n=Math.max(u[0],Math.min(u[1],n)))===t.k?t:new or(n,t.x,t.y)}function g(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new or(t.k,r,i)}function y(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function v(t,n,e){t.on("start.zoom",(function(){_(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).end()})).tween("zoom",(function(){var t=this,i=arguments,o=_(t,i),a=r.apply(t,i),s=null==e?y(a):"function"==typeof e?e.apply(t,i):e,u=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),l=t.__zoom,c="function"==typeof n?n.apply(t,i):n,f=h(l.invert(s).concat(u/l.k),c.invert(s).concat(u/c.k));return function(t){if(1===t)t=c;else{var n=f(t),e=u/n[2];t=new or(e,s[0]-n[0]*e,s[1]-n[1]*e)}o.zoom(null,t)}}))}function _(t,n,e){return!e&&t.__zooming||new w(t,n)}function w(t,n){this.that=t,this.args=n,this.active=0,this.extent=r.apply(t,n),this.taps=0}function x(){if(e.apply(this,arguments)){var t=_(this,arguments),n=this.__zoom,r=Math.max(u[0],Math.min(u[1],n.k*Math.pow(2,o.apply(this,arguments)))),a=kt(this);if(t.wheel)t.mouse[0][0]===a[0]&&t.mouse[0][1]===a[1]||(t.mouse[1]=n.invert(t.mouse[0]=a)),clearTimeout(t.wheel);else{if(n.k===r)return;t.mouse=[a,n.invert(a)],Jn(this),t.start()}lr(),t.wheel=setTimeout(s,150),t.zoom("mouse",i(g(m(n,r),t.mouse[0],t.mouse[1]),t.extent,l))}function s(){t.wheel=null,t.end()}}function b(){if(!n&&e.apply(this,arguments)){var t=_(this,arguments,!0),r=xt(lt.view).on("mousemove.zoom",u,!0).on("mouseup.zoom",c,!0),o=kt(this),a=lt.clientX,s=lt.clientY;St(lt.view),ur(),t.mouse=[o,this.__zoom.invert(o)],Jn(this),t.start()}function u(){if(lr(),!t.moved){var n=lt.clientX-a,e=lt.clientY-s;t.moved=n*n+e*e>p}t.zoom("mouse",i(g(t.that.__zoom,t.mouse[0]=kt(t.that),t.mouse[1]),t.extent,l))}function c(){r.on("mousemove.zoom mouseup.zoom",null),At(lt.view,t.moved),lr(),t.end()}}function z(){if(e.apply(this,arguments)){var t=this.__zoom,n=kt(this),o=t.invert(n),a=t.k*(lt.shiftKey?.5:2),s=i(g(m(t,a),n,o),r.apply(this,arguments),l);lr(),c>0?xt(this).transition().duration(c).call(v,s,n):xt(this).call(d.transform,s)}}function k(){if(e.apply(this,arguments)){var n,r,i,o,a=lt.touches,s=a.length,u=_(this,arguments,lt.changedTouches.length===s);for(ur(),r=0;r<s;++r)o=[o=Mt(this,a,(i=a[r]).identifier),this.__zoom.invert(o),i.identifier],u.touch0?u.touch1||u.touch0[2]===o[2]||(u.touch1=o,u.taps=0):(u.touch0=o,n=!0,u.taps=1+!!t);t&&(t=clearTimeout(t)),n&&(u.taps<2&&(t=setTimeout((function(){t=null}),500)),Jn(this),u.start())}}function M(){if(this.__zooming){var n,e,r,o,a=_(this,arguments),s=lt.changedTouches,u=s.length;for(lr(),t&&(t=clearTimeout(t)),a.taps=0,n=0;n<u;++n)r=Mt(this,s,(e=s[n]).identifier),a.touch0&&a.touch0[2]===e.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===e.identifier&&(a.touch1[0]=r);if(e=a.that.__zoom,a.touch1){var c=a.touch0[0],h=a.touch0[1],f=a.touch1[0],p=a.touch1[1],d=(d=f[0]-c[0])*d+(d=f[1]-c[1])*d,y=(y=p[0]-h[0])*y+(y=p[1]-h[1])*y;e=m(e,Math.sqrt(d/y)),r=[(c[0]+f[0])/2,(c[1]+f[1])/2],o=[(h[0]+p[0])/2,(h[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],o=a.touch0[1]}a.zoom("touch",i(g(e,r,o),a.extent,l))}}function E(){if(this.__zooming){var t,e,r=_(this,arguments),i=lt.changedTouches,o=i.length;for(ur(),n&&clearTimeout(n),n=setTimeout((function(){n=null}),500),t=0;t<o;++t)e=i[t],r.touch0&&r.touch0[2]===e.identifier?delete r.touch0:r.touch1&&r.touch1[2]===e.identifier&&delete r.touch1;if(r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0)r.touch0[1]=this.__zoom.invert(r.touch0[0]);else if(r.end(),2===r.taps){var a=xt(this).on("dblclick.zoom");a&&a.apply(this,arguments)}}}return d.transform=function(t,n,e){var r=t.selection?t.selection():t;r.property("__zoom",fr),t!==r?v(t,n,e):r.interrupt().each((function(){_(this,arguments).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},d.scaleBy=function(t,n,e){d.scaleTo(t,(function(){var t=this.__zoom.k,e="function"==typeof n?n.apply(this,arguments):n;return t*e}),e)},d.scaleTo=function(t,n,e){d.transform(t,(function(){var t=r.apply(this,arguments),o=this.__zoom,a=null==e?y(t):"function"==typeof e?e.apply(this,arguments):e,s=o.invert(a),u="function"==typeof n?n.apply(this,arguments):n;return i(g(m(o,u),a,s),t,l)}),e)},d.translateBy=function(t,n,e){d.transform(t,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof e?e.apply(this,arguments):e),r.apply(this,arguments),l)}))},d.translateTo=function(t,n,e,o){d.transform(t,(function(){var t=r.apply(this,arguments),a=this.__zoom,s=null==o?y(t):"function"==typeof o?o.apply(this,arguments):o;return i(ar.translate(s[0],s[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof e?-e.apply(this,arguments):-e),t,l)}),o)},w.prototype={start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,n){return this.mouse&&"mouse"!==t&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){!function(t,n,e,r){var i=lt;t.sourceEvent=lt,lt=t;try{n.apply(e,r)}finally{lt=i}}(new ir(d,t,this.that.__zoom),f.apply,f,[t,this.that,this.args])}},d.wheelDelta=function(t){return arguments.length?(o="function"==typeof t?t:rr(+t),d):o},d.filter=function(t){return arguments.length?(e="function"==typeof t?t:rr(!!t),d):e},d.touchable=function(t){return arguments.length?(a="function"==typeof t?t:rr(!!t),d):a},d.extent=function(t){return arguments.length?(r="function"==typeof t?t:rr([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),d):r},d.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],d):[u[0],u[1]]},d.translateExtent=function(t){return arguments.length?(l[0][0]=+t[0][0],l[1][0]=+t[1][0],l[0][1]=+t[0][1],l[1][1]=+t[1][1],d):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},d.constrain=function(t){return arguments.length?(i=t,d):i},d.duration=function(t){return arguments.length?(c=+t,d):c},d.interpolate=function(t){return arguments.length?(h=t,d):h},d.on=function(){var t=f.on.apply(f,arguments);return t===f?d:t},d.clickDistance=function(t){return arguments.length?(p=(t=+t)*t,d):Math.sqrt(p)},d}sr.prototype=or.prototype;const yr=Object.freeze({children:t=>t.children,nodeSize:t=>t.data.size,spacing:0});function vr(t){const n=Object.assign({},yr,t);function e(t){const e=n[t];return"function"==typeof e?e:()=>e}function r(t){const n=o(function(){const t=i(),n=e("nodeSize"),r=e("spacing");return class extends t{constructor(t){super(t),Object.assign(this,{x:0,y:0,relX:0,prelim:0,shift:0,change:0,lExt:this,lExtRelX:0,lThr:null,rExt:this,rExtRelX:0,rThr:null})}get size(){return n(this.data)}spacing(t){return r(this.data,t.data)}get x(){return this.data.x}set x(t){this.data.x=t}get y(){return this.data.y}set y(t){this.data.y=t}update(){return _r(this),wr(this),this}}}(),t,t=>t.children);return n.update(),n.data}function i(){const t=e("nodeSize"),n=e("spacing");return class e extends qe.prototype.constructor{constructor(t){super(t)}copy(){const t=o(this.constructor,this,t=>t.children);return t.each(t=>t.data=t.data.data),t}get size(){return t(this)}spacing(t){return n(this,t)}get nodes(){return this.descendants()}get xSize(){return this.size[0]}get ySize(){return this.size[1]}get top(){return this.y}get bottom(){return this.y+this.ySize}get left(){return this.x-this.xSize/2}get right(){return this.x+this.xSize/2}get root(){const t=this.ancestors();return t[t.length-1]}get numChildren(){return this.hasChildren?this.children.length:0}get hasChildren(){return!this.noChildren}get noChildren(){return null===this.children}get firstChild(){return this.hasChildren?this.children[0]:null}get lastChild(){return this.hasChildren?this.children[this.numChildren-1]:null}get extents(){return(this.children||[]).reduce((t,n)=>e.maxExtents(t,n.extents),this.nodeExtents)}get nodeExtents(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}static maxExtents(t,n){return{top:Math.min(t.top,n.top),bottom:Math.max(t.bottom,n.bottom),left:Math.min(t.left,n.left),right:Math.max(t.right,n.right)}}}}function o(t,n,e){const r=(n,i)=>{const o=new t(n);Object.assign(o,{parent:i,depth:null===i?0:i.depth+1,height:0,length:1});const a=e(n)||[];return o.children=0===a.length?null:a.map(t=>r(t,o)),o.children&&Object.assign(o,o.children.reduce((t,n)=>({height:Math.max(t.height,n.height+1),length:t.length+n.length}),o)),o};return r(n,null)}return Object.assign(r,{nodeSize(t){return arguments.length?(n.nodeSize=t,r):n.nodeSize},spacing(t){return arguments.length?(n.spacing=t,r):n.spacing},children(t){return arguments.length?(n.children=t,r):n.children},hierarchy(t,e){const r=void 0===e?n.children:e;return o(i(),t,r)},dump(t){const n=e("nodeSize"),r=t=>e=>{const i=t+" ",o=t+" ",{x:a,y:s}=e,u=n(e),l=e.children||[],c=0===l.length?" ":`,${i}children: [${o}${l.map(r(o)).join(o)}${i}],${t}`;return`{ size: [${u.join(", ")}],${i}x: ${a}, y: ${s}${c}},`};return r("\n")(t)}}),r}vr.version="2.1.1";const _r=(t,n=0)=>(t.y=n,(t.children||[]).reduce((n,e)=>{const[r,i]=n;_r(e,t.y+t.ySize);const o=(0===r?e.lExt:e.rExt).bottom;0!==r&&br(t,r,i);return[r+1,Xr(o,r,i)]},[0,null]),xr(t),Nr(t),t),wr=(t,n,e)=>{void 0===n&&(n=-t.relX-t.prelim,e=0);const r=n+t.relX;return t.relX=r+t.prelim-e,t.prelim=0,t.x=e+t.relX,(t.children||[]).forEach(n=>wr(n,r,t.x)),t},xr=t=>{(t.children||[]).reduce((t,n)=>{const[e,r]=t,i=e+n.shift,o=r+i+n.change;return n.relX+=o,[i,o]},[0,0])},br=(t,n,e)=>{const r=t.children[n-1],i=t.children[n];let o=r,a=r.relX,s=i,u=i.relX,l=!0;for(;o&&s;){o.bottom>e.lowY&&(e=e.next);const r=a+o.prelim-(u+s.prelim)+o.xSize/2+s.xSize/2+o.spacing(s);(r>0||r<0&&l)&&(u+=r,zr(i,r),kr(t,n,e.index,r)),l=!1;const c=o.bottom,h=s.bottom;c<=h&&(o=Er(o),o&&(a+=o.relX)),c>=h&&(s=Mr(s),s&&(u+=s.relX))}!o&&s?Sr(t,n,s,u):o&&!s&&Ar(t,n,o,a)},zr=(t,n)=>{t.relX+=n,t.lExtRelX+=n,t.rExtRelX+=n},kr=(t,n,e,r)=>{const i=t.children[n],o=n-e;if(o>1){const n=r/o;t.children[e+1].shift+=n,i.shift-=n,i.change-=r-n}},Mr=t=>t.hasChildren?t.firstChild:t.lThr,Er=t=>t.hasChildren?t.lastChild:t.rThr,Sr=(t,n,e,r)=>{const i=t.firstChild,o=i.lExt,a=t.children[n];o.lThr=e;const s=r-e.relX-i.lExtRelX;o.relX+=s,o.prelim-=s,i.lExt=a.lExt,i.lExtRelX=a.lExtRelX},Ar=(t,n,e,r)=>{const i=t.children[n],o=i.rExt,a=t.children[n-1];o.rThr=e;const s=r-e.relX-i.rExtRelX;o.relX+=s,o.prelim-=s,i.rExt=a.rExt,i.rExtRelX=a.rExtRelX},Nr=t=>{if(t.hasChildren){const n=t.firstChild,e=t.lastChild,r=(n.prelim+n.relX-n.xSize/2+e.relX+e.prelim+e.xSize/2)/2;Object.assign(t,{prelim:r,lExt:n.lExt,lExtRelX:n.lExtRelX,rExt:e.rExt,rExtRelX:e.rExtRelX})}},Xr=(t,n,e)=>{for(;null!==e&&t>=e.lowY;)e=e.next;return{lowY:t,index:n,next:e}},$r=Math.random().toString(36).slice(2,8);let jr=0;function Cr(){}function Tr(t,n,e="c"){const r=(t,i)=>n(t,()=>{var n;null==(n=t[e])||n.forEach(n=>{r(n,t)})},i);r(t)}function Or(t){if(Array.from)return Array.from(t);const n=[];for(let e=0;e<t.length;e+=1)n.push(t[e]);return n}function Pr(t,...n){const e=(t||"").split(" ").filter(Boolean);return n.forEach(t=>{t&&e.indexOf(t)<0&&e.push(t)}),e.join(" ")}function Rr(t){if("string"==typeof t){const n=t;t=t=>t.tagName===n}const n=t;return function(){let t=Or(this.childNodes);return n&&(t=t.filter(t=>n(t))),t}}function Ir(t,n,e){const r=document.createElement(t);return n&&Object.entries(n).forEach(([t,n])=>{r[t]=n}),e&&Object.entries(e).forEach(([t,n])=>{r.setAttribute(t,n)}),r}const qr=function(t){const n={};return function(...e){const r=""+e[0];let i=n[r];return i||(i={value:t(...e)},n[r]=i),i.value}}(t=>{document.head.append(Ir("link",{rel:"preload",as:"script",href:t}))});function Yr(t,n){if("script"===t.type)return new Promise((n,e)=>{document.head.append(Ir("script",Object.assign({},t.data,{onload:n,onerror:e})))});if("iife"===t.type){const{fn:e,getParams:r}=t.data;e(...(null==r?void 0:r(n))||[])}}function Br(t){"style"===t.type?document.head.append(Ir("style",{textContent:t.data})):"stylesheet"===t.type&&document.head.append(Ir("link",Object.assign({rel:"stylesheet"},t.data)))}async function Dr(t,n,e){e=Object.assign({},e),await Promise.all(n.map(t=>(function(t){for(const n of t)Br(n)}(t.styles),async function(t,n){const e=t.filter(t=>"script"===t.type);e.length>1&&e.forEach(t=>qr(t.data.src));for(const e of t)await Yr(e,n)}(t.scripts,e))));for(const{initialize:r}of n)r&&r(t,e)}const Hr={styles:[],scripts:[{type:"iife",data:{fn:t=>{t.options=Object.assign({skipHtmlTags:{"[-]":["code","pre"]}},t.options),t.startup=Object.assign({typeset:!1},t.startup),window.MathJax=t},getParams:t=>[Object.assign({},t.mathJax)]}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"}}],initialize:function(t,n){t.transformHtml.tap((t,n)=>{var e,r;null==(e=(r=window.MathJax).typeset)||e.call(r,n)})}},Lr={};const Vr={styles:[{type:"stylesheet",data:{href:"https://cdn.jsdelivr.net/npm/prismjs@1/themes/prism.css"}}],scripts:[{type:"iife",data:{fn:()=>{window.Prism={manual:!0}}}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-core.min.js"}},{type:"script",data:{src:"https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js"}}],initialize:function(t,n){t.transformHtml.tap((t,n)=>{const{Prism:e}=window;!async function(t,n){if(!n.length)return;const{Prism:e}=window;try{await new Promise((t,r)=>{e.plugins.autoloader.loadLanguages(n,t,r)})}catch(t){Lr[t]=!0}t.setData(),t.fit()}(t,function(t,n){if(t.flatMap)return t.flatMap(n);const e=[];for(let r=0;r<t.length;r+=1){const i=n(t[r],r,t);Array.isArray(i)?e.push(...i):e.push(i)}return e}(n,t=>Or(t.querySelectorAll("code[class*=language-]"))).map(t=>{const n=t.className.match(/(?:^|\s)language-(\S+)|$/)[1];if(e.languages[n])e.highlightElement(t);else if(!Lr[n])return n}).filter(Boolean))})}};var Ur=Object.freeze({__proto__:null,mathJax:Hr,prism:Vr});function Fr(t){const n=t.data;return Math.max(6-2*n.d,1.5)}class Gr{constructor(t,n){var e;this.options=void 0,this.state=void 0,this.svg=void 0,this.styleNode=void 0,this.g=void 0,this.zoom=void 0,["handleZoom","handleClick"].forEach(t=>{this[t]=this[t].bind(this)}),this.svg=t.datum?t:xt(t),this.styleNode=this.svg.append("style"),this.zoom=gr().on("zoom",this.handleZoom),this.options=Object.assign({duration:500,nodeFont:"300 16px/20px sans-serif",nodeMinHeight:16,spacingVertical:5,spacingHorizontal:80,autoFit:!1,fitRatio:.95,color:(e=Fe(Ge),t=>e(t.p.i)),paddingX:8},n),this.state={id:this.options.id||(jr+=1,`mm-${$r}-${jr}`)},this.g=this.svg.append("g").attr("class",this.state.id+"-g"),this.updateStyle(),this.svg.call(this.zoom)}getStyleContent(){const{style:t,nodeFont:n}=this.options,{id:e}=this.state;return`.${e} a { color: #0097e6; }\n.${e} a:hover { color: #00a8ff; }\n.${e}-g > path { fill: none; }\n.${e}-fo > div { font: ${n}; white-space: nowrap; }\n.${e}-fo code { padding: .2em .4em; font-size: calc(1em - 2px); color: #555; background-color: #f0f0f0; border-radius: 2px; }\n.${e}-fo del { text-decoration: line-through; }\n.${e}-fo em { font-style: italic; }\n.${e}-fo strong { font-weight: 600; }\n.${e}-fo pre { margin: 0; }\n.${e}-fo pre[class*=language-] { padding: 0; }\n.${e}-g > g { cursor: pointer; }\n${"function"==typeof t?t(e):""}\n`}updateStyle(){this.svg.attr("class",Pr(this.svg.attr("class"),this.state.id)),this.styleNode.text(this.getStyleContent())}handleZoom(){const{transform:t}=lt;this.g.attr("transform",t)}handleClick(t){var n;const{data:e}=t;e.p=Object.assign({},e.p,{f:!(null==(n=e.p)?void 0:n.f)}),this.renderData(t.data)}initializeData(t){let n=0;const{nodeFont:e,color:r,nodeMinHeight:i}=this.options,{id:o}=this.state,a=document.createElement("div"),s=o+"-container";a.className=Pr(a.className,o+"-fo",s);const u=document.createElement("style");u.textContent=`\n${this.getStyleContent()}\n.${s} {\n position: absolute;\n width: 0;\n height: 0;\n top: -100px;\n left: -100px;\n overflow: hidden;\n font: ${e};\n}\n.${s} > div {\n display: inline-block;\n}\n`,document.body.append(u,a),Tr(t,(t,e)=>{var i;t.c=null==(i=t.c)?void 0:i.map(t=>Object.assign({},t)),n+=1;const o=document.createElement("div");o.innerHTML=t.v,a.append(o),t.p=Object.assign({},t.p,{i:n,el:o}),r(t),e()});const l=Or(a.childNodes);this.constructor.transformHtml.call(this,l),Tr(t,(t,n,e)=>{var r;const o=t.p.el.getBoundingClientRect();t.v=t.p.el.innerHTML,t.p.s=[Math.ceil(o.width),Math.max(Math.ceil(o.height),i)],t.p.k=`${(null==e||null==(r=e.p)?void 0:r.i)||""}.${t.p.i}:${t.v}`,n()}),a.remove(),u.remove()}setOptions(t){Object.assign(this.options,t)}setData(t,n){t||(t=Object.assign({},this.state.data)),this.state.data=t,this.initializeData(t),n&&this.setOptions(n),this.renderData()}renderData(t){var n,e;if(!this.state.data)return;const{spacingHorizontal:r,paddingX:a,spacingVertical:s,autoFit:u,color:l}=this.options,{id:c}=this.state,h=vr().children(t=>{var n;return!(null==(n=t.p)?void 0:n.f)&&t.c}).nodeSize(t=>{const[n,e]=t.data.p.s;return[e,n+(n?2*a:0)+r]}).spacing((t,n)=>t.parent===n.parent?s:2*s),f=h.hierarchy(this.state.data);h(f),function(t,n){Tr(t,(t,e)=>{t.ySizeInner=t.ySize-n,t.y+=n,e()},"children")}(f,r);const p=f.descendants().reverse(),d=f.links(),m=er(),g=o(p,t=>t.x-t.xSize/2),y=i(p,t=>t.x+t.xSize/2),v=o(p,t=>t.y),_=i(p,t=>t.y+t.ySizeInner);Object.assign(this.state,{minX:g,maxX:y,minY:v,maxY:_}),u&&this.fit();const w=t&&p.find(n=>n.data===t)||f,x=null!=(n=w.data.p.x0)?n:w.x,b=null!=(e=w.data.p.y0)?e:w.y,z=this.g.selectAll(Rr("g")).data(p,t=>t.data.p.k),k=z.enter().append("g").attr("transform",t=>`translate(${b+w.ySizeInner-t.ySizeInner},${x+w.xSize/2-t.xSize})`).on("click",this.handleClick),M=this.transition(z.exit());M.select("rect").attr("width",0).attr("x",t=>t.ySizeInner),M.select("foreignObject").style("opacity",0),M.attr("transform",t=>`translate(${w.y+w.ySizeInner-t.ySizeInner},${w.x+w.xSize/2-t.xSize})`).remove();const E=z.merge(k);this.transition(E).attr("transform",t=>`translate(${t.y},${t.x-t.xSize/2})`);const S=E.selectAll(Rr("rect")).data(t=>[t],t=>t.data.p.k).join(t=>t.append("rect").attr("x",t=>t.ySizeInner).attr("y",t=>t.xSize-Fr(t)/2).attr("width",0).attr("height",Fr),t=>t,t=>t.remove());this.transition(S).attr("x",-1).attr("width",t=>t.ySizeInner+2).attr("fill",t=>l(t.data));const A=E.selectAll(Rr("circle")).data(t=>t.data.c?[t]:[],t=>t.data.p.k).join(t=>t.append("circle").attr("stroke-width","1.5").attr("cx",t=>t.ySizeInner).attr("cy",t=>t.xSize).attr("r",0),t=>t,t=>t.remove());this.transition(A).attr("r",6).attr("stroke",t=>l(t.data)).attr("fill",t=>{var n;return(null==(n=t.data.p)?void 0:n.f)?l(t.data):"#fff"});const N=E.selectAll(Rr("foreignObject")).data(t=>[t],t=>t.data.p.k).join(t=>{const n=t.append("foreignObject").attr("class",c+"-fo").attr("x",a).attr("y",0).style("opacity",0).attr("height",t=>t.xSize);return n.append("xhtml:div").select((function(t){const n=t.data.p.el.cloneNode(!0);return this.replaceWith(n),n})).attr("xmlns","http://www.w3.org/1999/xhtml"),n},t=>t,t=>t.remove()).attr("width",t=>Math.max(0,t.ySizeInner-2*a));this.transition(N).style("opacity",1);const X=this.g.selectAll(Rr("path")).data(d,t=>t.target.data.p.k).join(t=>{const n=[b+w.ySizeInner,x+w.xSize/2];return t.insert("path","g").attr("d",m({source:n,target:n}))},t=>t,t=>{const n=[w.y+w.ySizeInner,w.x+w.xSize/2];return this.transition(t).attr("d",m({source:n,target:n})).remove()});this.transition(X).attr("stroke",t=>l(t.target.data)).attr("stroke-width",t=>Fr(t.target)).attr("d",t=>{const n=[t.source.y+t.source.ySizeInner,t.source.x+t.source.xSize/2],e=[t.target.y,t.target.x+t.target.xSize/2];return m({source:n,target:e})}),p.forEach(t=>{t.data.p.x0=t.x,t.data.p.y0=t.y})}transition(t){const{duration:n}=this.options;return t.transition().duration(n)}fit(){const t=this.svg.node(),{width:n,height:e}=t.getBoundingClientRect(),{fitRatio:r}=this.options,{minX:i,maxX:o,minY:a,maxY:s}=this.state,u=s-a,l=o-i,c=Math.min(n/u*r,e/l*r,2),h=ar.translate((n-u*c)/2-a*c,(e-l*c)/2-i*c).scale(c);return this.transition(this.svg).call(this.zoom.transform,h).end().catch(Cr)}rescale(t){const n=this.svg.node(),{width:e,height:r}=n.getBoundingClientRect(),i=e/2,o=r/2,a=sr(n),s=a.translate((i-a.x)*(1-t)/a.k,(o-a.y)*(1-t)/a.k).scale(t);return this.transition(this.svg).call(this.zoom.transform,s).end().catch(Cr)}static create(t,n,e){const r=new Gr(t,n);return e&&(r.setData(e),r.fit()),r}}Gr.transformHtml=new class{constructor(){this.listeners=[]}tap(t){this.listeners.push(t)}call(...t){for(const n of this.listeners)n(...t)}},t.Markmap=Gr,t.loadPlugins=async function(t,n){return t=t.map(t=>{if("string"==typeof t){const n=t;(t=Ur[n])||console.warn("[markmap] Unknown plugin: "+n)}return t}).filter(Boolean),Dr(Gr,t,n)},t.markmap=function(t,n,e){return Gr.create(t,e,n)},t.plugins=Ur}));