/*! markmap-lib v0.7.11 | MIT License */ define(["exports"],(function(t){"use strict";function n(t,n){return tn?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=e)for(r=e;++or&&(r=e)}else for(;++o=e)for(r=e;++or&&(r=e);return r}function o(t,n){var e,r,i=t.length,o=-1;if(null==n){for(;++o=e)for(r=e;++oe&&(r=e)}else for(;++o=e)for(r=e;++oe&&(r=e);return r}var a={value:function(){}};function s(){for(var t,n=0,e=arguments.length,r={};n=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;r0)for(var e,r,i=new Array(e),o=0;o=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;sn?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=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=w&&(w=_+1);!(v=g[w])&&++w=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;o1?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>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*(e0&&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 o180?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=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]):+l0)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=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;a1e-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=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=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;++ar?(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;rt.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&&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;rOr(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}));