You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
456 KiB
23 lines
456 KiB
5 years ago
|
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.SentenTree=n():t.SentenTree=n()}(this,function(){return function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var e={};return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=140)}([function(t,n,e){"use strict";function r(t,n){this._groups=t,this._parents=n}function i(){return new r([[document.documentElement]],D)}var o=e(105),u=e(106),a=e(94),s=e(88),c=e(38),f=e(93),h=e(98),l=e(101),p=e(108),d=e(86),g=e(100),v=e(99),y=e(107),_=e(92),m=e(91),b=e(85),x=e(109),w=e(102),k=e(87),M=e(110),E=e(95),A=e(103),S=e(97),T=e(84),C=e(96),O=e(104),P=e(89),L=e(18),N=e(90);e.d(n,"c",function(){return D}),n.b=r;var D=[null];r.prototype=i.prototype={constructor:r,select:o.a,selectAll:u.a,filter:a.a,data:s.a,enter:c.a,exit:f.a,merge:h.a,order:l.a,sort:p.a,call:d.a,nodes:g.a,node:v.a,size:y.a,empty:_.a,each:m.a,attr:b.a,style:x.a,property:w.a,classed:k.a,text:M.a,html:E.a,raise:A.a,lower:S.a,append:T.a,insert:C.a,remove:O.a,datum:P.a,on:L.c,dispatch:N.a},n.a=i},function(t,n,e){"use strict";function r(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>h)throw new Error("too late");return e}function i(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>p)throw new Error("too late");return e}function o(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function u(t,n,r){function i(t){r.state=l,r.timer.restart(o,r.delay,r.time),r.delay<=t&&o(t-r.delay)}function o(i){var h,v,_,m;if(r.state!==l)return a();for(h in f)if(m=f[h],m.name===r.name){if(m.state===d)return e.i(s.b)(o);m.state===g?(m.state=y,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete f[h]):n>+h&&(m.state=y,m.timer.stop(),delete f[h])}if(e.i(s.b)(function(){r.state===d&&(r.state=g,r.timer.restart(u,r.delay,r.time),u(i))}),r.state=p,r.on.call("start",t,t.__data__,r.index,r.group),r.state===p){for(r.state=d,c=new Array(_=r.tween.length),h=0,v=-1;_>h;++h)(m=r.tween[h].value.call(t,t.__data__,r.index,r.group))&&(c[++v]=m);c.length=v+1}}function u(n){for(var e=n<r.duration?r.ease.call(null,n/r.duration):(r.timer.restart(a),r.state=v,1),i=-1,o=c.length;++i<o;)c[i].call(null,e);r.state===v&&(r.on.call("end",t,t.__data__,r.index,r.group),a())}function a(){r.state=y,r.timer.stop(),delete f[n];for(var e in f)return;delete t.__transition}var c,f=t.__transition;f[n]=r,r.timer=e.i(s.a)(i,0,r.time)}var a=e(29),s=e(41);e.d(n,"d",function(){return l}),e.d(n,"a",function(){return p}),e.d(n,"b",function(){return v}),e.d(n,"c",function(){return y}),n.g=r,n.e=i,n.f=o;var c=e.i(a.dispatch)("start","end","interrupt"),f=[],h=0,l=1,p=2,d=3,g=4,v=5,y=6;n.h=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};u(t,e,{name:n,index:r,group:i,on:c,tween:f,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:h})}},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e(14);e.d(n,"creator",function(){return r.a});var i=e(80);e.d(n,"local",function(){return i.a});var o=e(37);e.d(n,"matcher",function(){return o.a});var u=e(81);e.d(n,"mouse",function(){return u.a});var a=e(15);e.d(n,"namespace",function(){return a.a});var s=e(16);e.d(n,"namespaces",function(){return s.a});var c=e(82);e.d(n,"select",function(){return c.a});var f=e(83);e.d(n,"selectAll",function(){return f.a});var h=e(0);e.d(n,"selection",function(){return h.a});var l=e(19);e.d(n,"selector",function(){return l.a});var p=e(40);e.d(n,"selectorAll",function(){return p.a});var d=e(111);e.d(n,"touch",function(){return d.a});var g=e(112);e.d(n,"touches",function(){return g.a});var v=e(21);e
|
||
|
|
||
|
}var e=_h(t.prototype),r=t.apply(e,n);return ss(r)?r:e}}function Ji(t,n,e){function r(){for(var o=arguments.length,u=af(o),s=o,c=Mo(r);s--;)u[s]=arguments[s];var f=3>o&&u[0]!==c&&u[o-1]!==c?[]:H(u,c);if(o-=f.length,e>o)return co(t,n,no,r.placeholder,it,u,f,it,it,e-o);var h=this&&this!==ar&&this instanceof r?i:t;return a(h,this,u)}var i=Ki(t);return r}function Qi(t){return function(n,e,r){var i=lf(n);if(!Za(n)){var o=Eo(e,3);n=Ws(n),e=function(t){return o(i[t],t,i)}}var u=t(n,e,r);return u>-1?i[o?n[u]:u]:it}}function to(t){return bo(function(n){var e=n.length,i=e,o=r.prototype.thru;for(t&&n.reverse();i--;){var u=n[i];if("function"!=typeof u)throw new gf(st);if(o&&!a&&"wrapper"==ko(u))var a=new r([],!0)}for(i=a?i:e;++i<e;){u=n[i];var s=ko(u),c="wrapper"==s?Th(u):it;a=c&&Uo(c[0])&&c[1]==(Mt|bt|wt|Et)&&!c[4].length&&1==c[9]?a[ko(c[0])].apply(a,c[3]):1==u.length&&Uo(u)?a[s]():a.thru(u)}return function(){var t=arguments,r=t[0];if(a&&1==t.length&&xl(r))return a.plant(r).value();for(var i=0,o=e?n[i].apply(this,t):r;++i<e;)o=n[i].call(this,o);return o}})}function no(t,n,e,r,i,o,u,a,s,c){function f(){for(var y=arguments.length,_=af(y),m=y;m--;)_[m]=arguments[m];if(d)var b=Mo(f),x=B(_,b);if(r&&(_=Ri(_,r,i,d)),o&&(_=qi(_,o,u,d)),y-=x,d&&c>y){var w=H(_,b);return co(t,n,no,f.placeholder,e,_,w,a,s,c-y)}var k=l?e:this,M=p?k[t]:t;return y=_.length,a?_=Qo(_,a):g&&y>1&&_.reverse(),h&&y>s&&(_.length=s),this&&this!==ar&&this instanceof f&&(M=v||Ki(M)),M.apply(k,_)}var h=n&Mt,l=n&yt,p=n&_t,d=n&(bt|xt),g=n&At,v=p?it:Ki(t);return f}function eo(t,n){return function(e,r){return Sr(e,t,n(r),{})}}function ro(t,n){return function(e,r){var i;if(e===it&&r===it)return n;if(e!==it&&(i=e),r!==it){if(i===it)return r;"string"==typeof e||"string"==typeof r?(e=vi(e),r=vi(r)):(e=gi(e),r=gi(r)),i=t(e,r)}return i}}function io(t){return bo(function(n){return n=g(n,j(Eo())),oi(function(e){var r=this;return t(n,function(t){return a(t,r,e)})})})}function oo(t,n){n=n===it?" ":vi(n);var e=n.length;if(2>e)return e?ii(n,t):n;var r=ii(n,Vf(t/Q(n)));return V(n)?Si(tt(r),0,t).join(""):r.slice(0,t)}function uo(t,n,e,r){function i(){for(var n=-1,s=arguments.length,c=-1,f=r.length,h=af(f+s),l=this&&this!==ar&&this instanceof i?u:t;++c<f;)h[c]=r[c];for(;s--;)h[c++]=arguments[++n];return a(l,o?e:this,h)}var o=n&yt,u=Ki(t);return i}function ao(t){return function(n,e,r){return r&&"number"!=typeof r&&qo(n,e,r)&&(e=r=it),n=Es(n),e===it?(e=n,n=0):e=Es(e),r=r===it?e>n?1:-1:Es(r),ri(n,e,r,t)}}function so(t){return function(n,e){return("string"!=typeof n||"string"!=typeof e)&&(n=Ts(n),e=Ts(e)),t(n,e)}}function co(t,n,e,r,i,o,u,a,s,c){var f=n&bt,h=f?u:it,l=f?it:u,p=f?o:it,d=f?it:o;n|=f?wt:kt,n&=~(f?kt:wt),n&mt||(n&=~(yt|_t));var g=[t,n,i,p,h,d,l,a,s,c],v=e.apply(it,g);return Uo(t)&&Nh(v,g),v.placeholder=r,tu(v,t,n)}function fo(t){var n=hf[t];return function(t,e){if(t=Ts(t),e=null==e?0:Kf(As(e),292)){var r=(Ps(t)+"e").split("e"),i=n(r[0]+"e"+(+r[1]+e));return r=(Ps(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-e))}return n(t)}}function ho(t){return function(n){var e=Ph(n);return e==Kt?Y(n):e==on?Z(n):D(n,t(n))}}function lo(t,n,e,r,i,o,u,a){var s=n&_t;if(!s&&"function"!=typeof t)throw new gf(st);var c=r?r.length:0;if(c||(n&=~(wt|kt),r=i=it),u=u===it?u:Zf(As(u),0),a=a===it?a:As(a),c-=i?i.length:0,n&kt){var f=r,h=i;r=i=it}var l=s?it:Th(t),p=[t,n,e,r,i,f,h,o,u,a];if(l&&Ho(p,l),t=p[0],n=p[1],e=p[2],r=p[3],i=p[4],a=p[9]=p[9]===it?s?0:t.length:Zf(p[9]-c,0),!a&&n&(bt|xt)&&(n&=~(bt|xt)),n&&n!=yt)d=n==bt||n==xt?Ji(t,n,a):n!=wt&&n!=(yt|wt)||i.length?no.apply(it,p):uo(t,n,e,r);else var d=Hi(t,n,e);var g=l?kh:Nh;return tu(g(d,p),t,n)}function po(t,n,e,r){return t===it||$a(t,_f[e])&&!xf.call(r,e)?n:t}function go(t,n,e,r,i,o){return ss(t)&&ss(n)&&(o.set(n,t),Xr(t,n,it,go,o),o["delete"](n)),t}function vo(t){return ys(t)?it:t}function yo(t,n,e,r,i,o){var u=e>,a=t.length,s=n.length;if(a!=s&&!(u&&s>a))return!1;var c=o.get(t);if(c&&o.get(n))return c==n;var f=-1,h=!0,l=e&vt?new ye:it;for(o.set(t,n),o.set(n,t);++f<a;){var p=t[f],d=n[f];if(r)var g=u?r(d,p,f,n,t,o):r(p,d,f,t,n,o);if(g!==it){if(g)continue;h=!1;break}
|
||
|
|
||
|
if(r)switch(r){case fh:return ln;case hh:return Kt;case lh:return nn;case ph:return on;case dh:return cn}return n});var Lh=mf?os:Gc,Nh=nu(kh),Dh=Uf||function(t,n){return ar.setTimeout(t,n)},jh=nu(Mh),Ih=Xo(function(t){var n=[];return Dn.test(t)&&n.push(""),t.replace(jn,function(t,e,r,i){n.push(r?i.replace(Gn,"$1"):e||t)}),n}),zh=oi(function(t,n){return Ka(t)?Ge(t,tr(n,1,Ka,!0)):[]}),Rh=oi(function(t,n){var e=Eu(n);return Ka(e)&&(e=it),Ka(t)?Ge(t,tr(n,1,Ka,!0),Eo(e,2)):[]}),qh=oi(function(t,n){var e=Eu(n);return Ka(e)&&(e=it),Ka(t)?Ge(t,tr(n,1,Ka,!0),it,e):[]}),Bh=oi(function(t){var n=g(t,Mi);return n.length&&n[0]===t[0]?Ar(n):[]}),Fh=oi(function(t){var n=Eu(t),e=g(t,Mi);return n===Eu(e)?n=it:e.pop(),e.length&&e[0]===t[0]?Ar(e,Eo(n,2)):[]}),Uh=oi(function(t){var n=Eu(t),e=g(t,Mi);return n="function"==typeof n?n:it,n&&e.pop(),e.length&&e[0]===t[0]?Ar(e,it,n):[]}),Vh=oi(Tu),Wh=bo(function(t,n){var e=null==t?0:t.length,r=ze(t,n);return ni(t,g(n,function(t){return Ro(t,e)?+t:t}).sort(Ii)),r}),Gh=oi(function(t){return yi(tr(t,1,Ka,!0))}),Yh=oi(function(t){var n=Eu(t);return Ka(n)&&(n=it),yi(tr(t,1,Ka,!0),Eo(n,2))}),Xh=oi(function(t){var n=Eu(t);return n="function"==typeof n?n:it,yi(tr(t,1,Ka,!0),it,n)}),Hh=oi(function(t,n){return Ka(t)?Ge(t,n):[]}),$h=oi(function(t){return wi(l(t,Ka))}),Zh=oi(function(t){var n=Eu(t);return Ka(n)&&(n=it),wi(l(t,Ka),Eo(n,2))}),Kh=oi(function(t){var n=Eu(t);return n="function"==typeof n?n:it,wi(l(t,Ka),it,n)}),Jh=oi(Zu),Qh=oi(function(t){var n=t.length,e=n>1?t[n-1]:it;return e="function"==typeof e?(t.pop(),e):it,Ku(t,e)}),tl=bo(function(t){var n=t.length,e=n?t[0]:0,o=this.__wrapped__,u=function(n){return ze(n,t)};return!(n>1||this.__actions__.length)&&o instanceof i&&Ro(e)?(o=o.slice(e,+e+(n?1:0)),o.__actions__.push({func:ea,args:[u],thisArg:it}),new r(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(it),t})):this.thru(u)}),nl=Wi(function(t,n,e){xf.call(t,e)?++t[e]:Ie(t,e,1)}),el=Qi(gu),rl=Qi(vu),il=Wi(function(t,n,e){xf.call(t,e)?t[e].push(n):Ie(t,e,[n])}),ol=oi(function(t,n,e){var r=-1,i="function"==typeof n,o=Za(t)?af(t.length):[];return mh(t,function(t){o[++r]=i?a(n,t,e):Tr(t,n,e)}),o}),ul=Wi(function(t,n,e){Ie(t,e,n)}),al=Wi(function(t,n,e){t[e?0:1].push(n)},function(){return[[],[]]}),sl=oi(function(t,n){if(null==t)return[];var e=n.length;return e>1&&qo(t,n[0],n[1])?n=[]:e>2&&qo(n[0],n[1],n[2])&&(n=[n[0]]),Zr(t,tr(n,1),[])}),cl=Ff||function(){return ar.Date.now()},fl=oi(function(t,n,e){var r=yt;if(e.length){var i=H(e,Mo(fl));r|=wt}return lo(t,r,n,e,i)}),hl=oi(function(t,n,e){var r=yt|_t;if(e.length){var i=H(e,Mo(hl));r|=wt}return lo(n,r,t,e,i)}),ll=oi(function(t,n){return Ue(t,1,n)}),pl=oi(function(t,n,e){return Ue(t,Ts(n)||0,e)});ja.Cache=he;var dl=Eh(function(t,n){n=1==n.length&&xl(n[0])?g(n[0],j(Eo())):g(tr(n,1),j(Eo()));var e=n.length;return oi(function(r){for(var i=-1,o=Kf(r.length,e);++i<o;)r[i]=n[i].call(this,r[i]);return a(t,this,r)})}),gl=oi(function(t,n){var e=H(n,Mo(gl));return lo(t,wt,it,n,e)}),vl=oi(function(t,n){var e=H(n,Mo(vl));return lo(t,kt,it,n,e)}),yl=bo(function(t,n){return lo(t,Et,it,it,it,n)}),_l=so(hr),ml=so(function(t,n){return t>=n}),bl=Cr(function(){return arguments}())?Cr:function(t){return cs(t)&&xf.call(t,"callee")&&!Df.call(t,"callee")},xl=af.isArray,wl=pr?j(pr):Or,kl=Yf||Gc,Ml=dr?j(dr):Pr,El=gr?j(gr):Dr,Al=vr?j(vr):zr,Sl=yr?j(yr):Rr,Tl=_r?j(_r):qr,Cl=so(Vr),Ol=so(function(t,n){return n>=t}),Pl=Gi(function(t,n){if(Wo(n)||Za(n))return void Fi(n,Ws(n),t);for(var e in n)xf.call(n,e)&&Pe(t,e,n[e])}),Ll=Gi(function(t,n){Fi(n,Gs(n),t)}),Nl=Gi(function(t,n,e,r){Fi(n,Gs(n),t,r)}),Dl=Gi(function(t,n,e,r){Fi(n,Ws(n),t,r)}),jl=bo(ze),Il=oi(function(t){return t.push(it,po),a(Nl,it,t)}),zl=oi(function(t){return t.push(it,go),a(Ul,it,t)}),Rl=eo(function(t,n,e){t[n]=e},Lc(Dc)),ql=eo(function(t,n,e){xf.call(t,n)?t[n].push(e):t[n]=[e]},Eo),Bl=oi(Tr),Fl=Gi(function(t,n,e){Xr(t,n,e)}),Ul=Gi(function(t,n,e,r){Xr(t,n,e,r)}),Vl=bo(function(t,n){var e={};if(null==t)return e;var r=!1;n=g(n,function(n){return n=Ai(n,t),r||(r=n.length>1),n}),Fi(t,wo(t),e),r&&(e=qe(e,lt|pt
|
||
|
e=i.exec(t);return n}function r(t){return t.split(" ").filter(function(t){return t.length>0})}Object.defineProperty(n,"__esModule",{value:!0}),n.tokenize=e,n.tokenizeBySpace=r;var i=/http:\/\/t\.co\/\w+|http:\/\/vine\.co\/\w+|http:\/\/t\.co\w+|http:\/\/vine\.co\w+|http:\/\/t\.\w+|http:\/\/vine\.\w+|http:\/\/\w+|\@\w+|\#\w+|\d+(,\d+)+|\w+(-\w+)*|\$?\d+(\.\d+)?\%?|([A-Za-z]\.)+/g},function(t,n){"use strict";function e(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var r=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),i=function(){function t(n,r,i){e(this,t),this.source=n,this.target=r,this.freq=i,this.attachPoints={x1:0,y1:0,x2:1,y2:1}}return r(t,[{key:"getKey",value:function(){return[this.source.id,this.target.id].join(",")}},{key:"isTheOnlyBridge",value:function(){return 1===this.source.rightLinks.length&&1===this.target.leftLinks.length}},{key:"toConstraint",value:function(){var t=this.isTheOnlyBridge()?5:15;return{axis:"x",left:this.source.id,right:this.target.id,gap:(this.source.width+this.target.width)/2+t}}},{key:"toOnlyBridgeConstraint",value:function(){return{type:"alignment",axis:"y",offsets:[{node:this.source.id,offset:0},{node:this.target.id,offset:0}]}}}]),t}();n["default"]=i},function(t,n,e){"use strict";function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),o=e(5),u=function(){function t(n){r(this,t),this.data=n,this.leftLinks=[],this.rightLinks=[],this.id=-1,this.x=0,this.y=0,this.width=50,this.height=18}return i(t,[{key:"isLeaf",value:function(){return 0===this.leftLinks.length||0===this.rightLinks.length}},{key:"isLeftLeaf",value:function(){return 0===this.leftLinks.length}},{key:"isRightLeaf",value:function(){return 0===this.rightLinks.length}},{key:"leftEdge",value:function(){return this.x-this.width/2}},{key:"rightEdge",value:function(){return this.x+this.width/2}},{key:"getLeftNodes",value:function(){return this.leftLinks.map(function(t){return t.source})}},{key:"getRightNodes",value:function(){return this.rightLinks.map(function(t){return t.target})}},{key:"createAlignmentConstraints",value:function(t,n){return n.length>1?{type:"alignment",axis:t,offsets:n.map(function(t){return{node:t.id,offset:0}})}:null}},{key:"computeLeftConstraints",value:function(){var t=this.getLeftNodes().filter(function(t){return 1===t.rightLinks.length});return this.createAlignmentConstraints("x",t)}},{key:"computeRightConstraints",value:function(){var t=this.getRightNodes().filter(function(t){return 1===t.leftLinks.length});return this.createAlignmentConstraints("x",t)}},{key:"computeOrderConstraints",value:function(){var t=[];if(this.getRightNodes().length>1)for(var n=this.getRightNodes(),e=1;e<n.length;e++)t.push({axis:"y",left:n[e-1].id,right:n[e].id,gap:5});if(this.getLeftNodes().length>1)for(var r=this.getLeftNodes(),i=1;i<r.length;i++)t.push({axis:"y",left:r[i-1].id,right:r[i].id,gap:5});return t}},{key:"updateAttachPoints",value:function(){var t=this;1===this.leftLinks.length?this.leftLinks[0].attachPoints.y2=this.y:this.leftLinks.length>1&&!function(){var n=o.sum(t.leftLinks.map(function(t){return t.strokeWidth})),e=t.y-(n+2*(t.leftLinks.length-1))/2;t.leftLinks.concat().sort(function(t,n){return t.source.y-n.source.y}).forEach(function(t){t.attachPoints.y2=e+t.strokeWidth/2,e+=t.strokeWidth+2})}(),1===this.rightLinks.length?this.rightLinks[0].attachPoints.y1=this.y:this.rightLinks.length>1&&!function(){var n=o.sum(t.rightLinks.map(function(t){return t.strokeWidth})),e=t.y-(n+2*(t.rightLinks.length-1))/2;t.ri
|
||
|
|
||
|
}function r(){var t=ph(this),n=Ee(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?n[1][0]-l/2:n[0][0]-l/2}).attr("y",function(t){return"s"===t.type[0]?n[1][1]-l/2:n[0][1]-l/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+l:l}).attr("height",function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+l:l})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function i(t,n){return t.__brush.emitter||new o(t,n)}function o(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function u(){function e(){var t=Pf(M);!I||w||k||(Math.abs(t[0]-R[0])>Math.abs(t[1]-R[1])?k=!0:w=!0),R=t,x=!0,ud(),o()}function o(){var t;switch(m=R[0]-z[0],b=R[1]-z[1],A){case sd:case ad:S&&(m=Math.max(L-h,Math.min(D-g,m)),l=h+m,v=g+m),T&&(b=Math.max(N-p,Math.min(j-y,b)),d=p+b,_=y+b);break;case cd:0>S?(m=Math.max(L-h,Math.min(D-h,m)),l=h+m,v=g):S>0&&(m=Math.max(L-g,Math.min(D-g,m)),l=h,v=g+m),0>T?(b=Math.max(N-p,Math.min(j-p,b)),d=p+b,_=y):T>0&&(b=Math.max(N-y,Math.min(j-y,b)),d=p,_=y+b);break;case fd:S&&(l=Math.max(L,Math.min(D,h-m*S)),v=Math.max(L,Math.min(D,g+m*S))),T&&(d=Math.max(N,Math.min(j,p-b*T)),_=Math.max(N,Math.min(j,y+b*T)))}l>v&&(S*=-1,t=h,h=g,g=t,t=l,l=v,v=t,E in gd&&F.attr("cursor",dd[E=gd[E]])),d>_&&(T*=-1,t=p,p=y,y=t,t=d,d=_,_=t,E in vd&&F.attr("cursor",dd[E=vd[E]])),C.selection&&(P=C.selection),w&&(l=P[0][0],v=P[1][0]),k&&(d=P[0][1],_=P[1][1]),(P[0][0]!==l||P[0][1]!==d||P[1][0]!==v||P[1][1]!==_)&&(C.selection=[[l,d],[v,_]],r.call(M),q.brush())}function u(){if(xe(),t.event.touches){if(t.event.touches.length)return;s&&clearTimeout(s),s=setTimeout(function(){s=null},500),B.on("touchmove.brush touchend.brush touchcancel.brush",null)}else vt(t.event.view,x),U.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);B.attr("pointer-events","all"),F.attr("cursor",dd.overlay),C.selection&&(P=C.selection),Ae(P)&&(C.selection=null,r.call(M)),q.end()}function a(){switch(t.event.keyCode){case 16:I=S&&T;break;case 18:A===cd&&(S&&(g=v-m*S,h=l+m*S),T&&(y=_-b*T,p=d+b*T),A=fd,o());break;case 32:(A===cd||A===fd)&&(0>S?g=v-m:S>0&&(h=l-m),0>T?y=_-b:T>0&&(p=d-b),A=sd,F.attr("cursor",dd.selection),o());break;default:return}ud()}function c(){switch(t.event.keyCode){case 16:I&&(w=k=I=!1,o());break;case 18:A===fd&&(0>S?g=v:S>0&&(h=l),0>T?y=_:T>0&&(p=d),A=cd,o());break;case 32:A===sd&&(t.event.altKey?(S&&(g=v-m*S,h=l+m*S),T&&(y=_-b*T,p=d+b*T),A=fd):(0>S?g=v:S>0&&(h=l),0>T?y=_:T>0&&(p=d),A=cd),F.attr("cursor",dd[E]),o());break;default:return}ud()}if(t.event.touches){if(t.event.changedTouches.length<t.event.touches.length)return ud()}else if(s)return;if(f.apply(this,arguments)){var h,l,p,d,g,v,y,_,m,b,x,w,k,M=this,E=t.event.target.__data__.type,A="selection"===(t.event.metaKey?E="overlay":E)?ad:t.event.altKey?fd:cd,S=n===ld?null:yd[E],T=n===hd?null:_d[E],C=Ee(M),O=C.extent,P=C.selection,L=O[0][0],N=O[0][1],D=O[1][0],j=O[1][1],I=S&&T&&t.event.shiftKey,z=Pf(M),R=z,q=i(M,arguments).beforestart();"overlay"===E?C.selection=P=[[h=n===ld?L:z[0],p=n===hd?N:z[1]],[g=n===ld?D:h,y=n===hd?j:p]]:(h=P[0][0],p=P[0][1],g=P[1][0],y=P[1][1]),l=h,d=p,v=g,_=y;var B=ph(M).attr("pointer-events","none"),F=B.selectAll(".overlay").attr("cursor",dd[E]);if(t.event.touches)B.on("touchmove.brush",e,!0).on("touchend.brush touchcancel.brush",u,!0);else{var U=ph(t.event.view).on("keydown.brush",a,!0).on("keyup.brush",c,!0).on("mousemove.brush",e,!0).on("mouseup.brush",u,!0);_h(t.event.view)}xe(),op(M),r.call(M),q.start()}}function a(){var t=this.__brush||{selection:null};return t.extent=c.apply(this,arguments),t.dim=n,t}var s,c=Me,f=ke,h=p(e,"start","brush","end"),l=6;return e.move=function(t,e){t.selection?t.on("start.brush",function(){i(this,arguments).beforestart().start()}).on("interrupt.brush end.brush",function(){i(this,arguments).end()}).tween("bru
|
||
|
|
||
|
return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return vu(n())},t}function yu(){return vu(gu().paddingInner(1))}function _u(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:xm(n)}function mu(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return n>=t?0:t>=e?1:r(t)}}}function bu(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return 0>=t?n:t>=1?e:r(t)}}}function xu(t,n,e,r){var i=t[0],o=t[1],u=n[0],a=n[1];return i>o?(i=e(o,i),u=r(a,u)):(i=e(i,o),u=r(u,a)),function(t){return u(i(t))}}function wu(t,n,e,r){var i=Math.min(t.length,n.length)-1,o=new Array(i),u=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<i;)o[a]=e(t[a],t[a+1]),u[a]=r(n[a],n[a+1]);return function(n){var e=Tc(t,n,1,i)-1;return u[e](o[e](n))}}function ku(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function Mu(t,n){function e(){return i=Math.min(a.length,s.length)>2?wu:xu,o=u=null,r}function r(n){return(o||(o=i(a,s,f?mu(t):t,c)))(+n)}var i,o,u,a=km,s=km,c=ml,f=!1;return r.invert=function(t){return(u||(u=i(s,a,_u,f?bu(n):n)))(+t)},r.domain=function(t){return arguments.length?(a=_m.call(t,wm),e()):a.slice()},r.range=function(t){return arguments.length?(s=mm.call(t),e()):s.slice()},r.rangeRound=function(t){return s=mm.call(t),c=bl,e()},r.clamp=function(t){return arguments.length?(f=!!t,e()):f},r.interpolate=function(t){return arguments.length?(c=t,e()):c},e()}function Eu(t){var n=t.domain;return t.ticks=function(t){var e=n();return Wc(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Mm(n(),t,e)},t.nice=function(r){var i=n(),o=i.length-1,u=null==r?10:r,a=i[0],s=i[o],c=e(a,s,u);return c&&(c=e(Math.floor(a/c)*c,Math.ceil(s/c)*c,u),i[0]=Math.floor(a/c)*c,i[o]=Math.ceil(s/c)*c,n(i)),t},t}function Au(){var t=Mu(_u,dl);return t.copy=function(){return ku(t,Au())},Eu(t)}function Su(){function t(t){return+t}var n=[0,1];return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=_m.call(e,wm),t):n.slice()},t.copy=function(){return Su().domain(n)},Eu(t)}function Tu(t,n){return(n=Math.log(n/t))?function(e){return Math.log(e/t)/n}:xm(n)}function Cu(t,n){return 0>t?function(e){return-Math.pow(-n,e)*Math.pow(-t,1-e)}:function(e){return Math.pow(n,e)*Math.pow(t,1-e)}}function Ou(t){return isFinite(t)?+("1e"+t):0>t?0:t}function Pu(t){return 10===t?Ou:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}function Lu(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}function Nu(t){return function(n){return-t(-n)}}function Du(){function n(){return o=Lu(i),u=Pu(i),r()[0]<0&&(o=Nu(o),u=Nu(u)),e}var e=Mu(Tu,Cu).domain([1,10]),r=e.domain,i=10,o=Lu(10),u=Pu(10);return e.base=function(t){return arguments.length?(i=+t,n()):i},e.domain=function(t){return arguments.length?(r(t),n()):r()},e.ticks=function(t){var n,e=r(),a=e[0],s=e[e.length-1];(n=a>s)&&(l=a,a=s,s=l);var c,f,h,l=o(a),p=o(s),d=null==t?10:+t,g=[];if(!(i%1)&&d>p-l){if(l=Math.round(l)-1,p=Math.round(p)+1,a>0){for(;p>l;++l)for(f=1,c=u(l);i>f;++f)if(h=c*f,!(a>h)){if(h>s)break;g.push(h)}}else for(;p>l;++l)for(f=i-1,c=u(l);f>=1;--f)if(h=c*f,!(a>h)){if(h>s)break;g.push(h)}}else g=Wc(l,p,Math.min(p-l,d)).map(u);return n?g.reverse():g},e.tickFormat=function(n,r){if(null==r&&(r=10===i?".0e":","),"function"!=typeof r&&(r=t.format(r)),n===1/0)return r;null==n&&(n=10);var a=Math.max(1,i*n/e.ticks().length);return function(t){var n=t/u(Math.round(o(t)));return i-.5>n*i&&(n*=i),a>=n?r(t):""}},e.nice=function(){return r(Em(r(),{floor:function(t){return u(Math.floor(o(t)))},ceil:function(t){return u(Math.ceil(o(t)))}}))},e.copy=function(){return ku(e,Du().base(i))},e}function ju(t,n){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}function Iu(){function t(t,n){return(n=ju(n,e)-(t=ju(t,e)))?function(r){return(ju(r,e)-t)/n}:xm(n)}function n(t,n){return n=ju(n,e)-(t=ju(t,e)),function(r){return ju(t+n*r,1/e)}}var e=1,r=Mu(t,n),i=r.domain;return r.exponent=function(t){return arguments.length?(e=+t,i(i()
|
||
|
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()),[r.x,r.y]}var i=t.getBoundingClientRect();return[n.clientX-i.left-t.clientLeft,n.clientY-i.top-t.clientTop]},Pf=function(t){var n=Cf();return n.changedTouches&&(n=n.changedTouches[0]),Of(t,n)},Lf=function(t){return null==t?T:function(){return this.querySelector(t)}},Nf=function(t){"function"!=typeof t&&(t=Lf(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var o,u,a=n[i],s=a.length,c=r[i]=new Array(s),f=0;s>f;++f)(o=a[f])&&(u=t.call(o,o.__data__,f,a))&&("__data__"in o&&(u.__data__=o.__data__),c[f]=u);return new pt(r,this._parents)},Df=function(t){return null==t?C:function(){return this.querySelectorAll(t)}},jf=function(t){"function"!=typeof t&&(t=Df(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;e>o;++o)for(var u,a=n[o],s=a.length,c=0;s>c;++c)(u=a[c])&&(r.push(t.call(u,u.__data__,c,a)),i.push(u));return new pt(r,i)},If=function(t){"function"!=typeof t&&(t=Ef(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],c=0;a>c;++c)(o=u[c])&&t.call(o,o.__data__,c,u)&&s.push(o);return new pt(r,this._parents)},zf=function(t){return new Array(t.length)},Rf=function(){return new pt(this._enter||this._groups.map(zf),this._parents)};O.prototype={constructor:O,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var qf=function(t){return function(){return t}},Bf="$",Ff=function(t,n){if(!t)return p=new Array(this.size()),c=-1,this.each(function(t){p[++c]=t}),p;var e=n?L:P,r=this._parents,i=this._groups;"function"!=typeof t&&(t=qf(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),c=0;o>c;++c){var f=r[c],h=i[c],l=h.length,p=t.call(f,f&&f.__data__,c,r),d=p.length,g=a[c]=new Array(d),v=u[c]=new Array(d),y=s[c]=new Array(l);e(f,h,g,v,y,p,n);for(var _,m,b=0,x=0;d>b;++b)if(_=g[b]){for(b>=x&&(x=b+1);!(m=v[x])&&++x<d;);_._next=m||null}}return u=new pt(u,r),u._enter=a,u._exit=s,u},Uf=function(){return new pt(this._exit||this._groups.map(zf),this._parents)},Vf=function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;o>a;++a)for(var s,c=n[a],f=e[a],h=c.length,l=u[a]=new Array(h),p=0;h>p;++p)(s=c[p]||f[p])&&(l[p]=s);for(;r>a;++a)u[a]=n[a];return new pt(u,this._parents)},Wf=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},Gf=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=N);for(var e=this._groups,r=e.length,i=new Array(r),o=0;r>o;++o){for(var u,a=e[o],s=a.length,c=i[o]=new Array(s),f=0;s>f;++f)(u=a[f])&&(c[f]=u);c.sort(n)}return new pt(i,this._parents).order()},Yf=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},Xf=function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},Hf=function(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,o=r.length;o>i;++i){var u=r[i];if(u)return u}return null},$f=function(){var t=0;return this.each(function(){++t}),t},Zf=function(){return!this.node()},Kf=function(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,o=n[e],u=0,a=o.length;a>u;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},Jf=function(t,n){var e=mf(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?j:D:"function"==typeof n?e.local?q:R:e.local?z:I)(e,n))},Qf=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView},th=function(t,n,e){var r;return arguments.length>1?this.each((null==n?B:"function"==typeof n?U:F)(t,n,null==e?"":e)):Qf(r=this.node()).getComputedStyle(r,nu
|
||
|
13===n?(i=!0,10===t.charCodeAt(r+2)&&++f):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;c>f;){var a=1;if(n=t.charCodeAt(f++),10===n)i=!0;else if(13===n)i=!0,10===t.charCodeAt(f)&&(++f,++a);else if(n!==s)continue;return t.slice(e,f-a)}return t.slice(e)}for(var r,i,o={},u={},a=[],c=t.length,f=0,h=0;(r=e())!==u;){for(var l=[];r!==o&&r!==u;)l.push(r),r=e();n&&null==(l=n(l,h++))||a.push(l)}return a}function r(n,e){return null==e&&(e=$e(n)),[e.map(u).join(t)].concat(n.map(function(n){return e.map(function(t){return u(n[t])}).join(t)})).join("\n")}function i(t){return t.map(o).join("\n")}function o(n){return n.map(u).join(t)}function u(t){return null==t?"":a.test(t+="")?'"'+t.replace(/\"/g,'""')+'"':t}var a=new RegExp('["'+t+"\n]"),s=t.charCodeAt(0);return{parse:n,parseRows:e,format:r,formatRows:i}},Fd=Bd(","),Ud=Fd.parse,Vd=Fd.parseRows,Wd=Fd.format,Gd=Fd.formatRows,Yd=Bd(" "),Xd=Yd.parse,Hd=Yd.parseRows,$d=Yd.format,Zd=Yd.formatRows,Kd=function(t,n){function e(){var e,i,o=r.length,u=0,a=0;for(e=0;o>e;++e)i=r[e],u+=i.x,a+=i.y;for(u=u/o-t,a=a/o-n,e=0;o>e;++e)i=r[e],i.x-=u,i.y-=a}var r;return null==t&&(t=0),null==n&&(n=0),e.initialize=function(t){r=t},e.x=function(n){return arguments.length?(t=+n,e):t},e.y=function(t){return arguments.length?(n=+t,e):n},e},Jd=function(t){return function(){return t}},Qd=function(){return 1e-6*(Math.random()-.5)},tg=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return Ze(this.cover(n,e),n,e,t)},ng=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{if(!(e>t||t>i||r>n||n>o))return this;var u,a,s=i-e,c=this._root;switch(a=((r+o)/2>n)<<1|(e+i)/2>t){case 0:do u=new Array(4),u[a]=c,c=u;while(s*=2,i=e+s,o=r+s,t>i||n>o);break;case 1:do u=new Array(4),u[a]=c,c=u;while(s*=2,e=i-s,o=r+s,e>t||n>o);break;case 2:do u=new Array(4),u[a]=c,c=u;while(s*=2,i=e+s,r=o-s,t>i||r>n);break;case 3:do u=new Array(4),u[a]=c,c=u;while(s*=2,e=i-s,r=o-s,e>t||r>n)}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},eg=function(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t},rg=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},ig=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i},og=function(t,n,e){var r,i,o,u,a,s,c,f=this._x0,h=this._y0,l=this._x1,p=this._y1,d=[],g=this._root;for(g&&d.push(new ig(g,f,h,l,p)),null==e?e=1/0:(f=t-e,h=n-e,l=t+e,p=n+e,e*=e);s=d.pop();)if(!(!(g=s.node)||(i=s.x0)>l||(o=s.y0)>p||(u=s.x1)<f||(a=s.y1)<h))if(g.length){var v=(i+u)/2,y=(o+a)/2;d.push(new ig(g[3],v,y,u,a),new ig(g[2],i,y,v,a),new ig(g[1],v,o,u,y),new ig(g[0],i,o,v,y)),(c=(n>=y)<<1|t>=v)&&(s=d[d.length-1],d[d.length-1]=d[d.length-1-c],d[d.length-1-c]=s)}else{var _=t-+this._x.call(null,g.data),m=n-+this._y.call(null,g.data),b=_*_+m*m;if(e>b){var x=Math.sqrt(e=b);f=t-x,h=n-x,l=t+x,p=n+x,r=g.data}}return r},ug=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var n,e,r,i,o,u,a,s,c,f,h,l,p=this._root,d=this._x0,g=this._y0,v=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((c=o>=(a=(d+v)/2))?d=a:v=a,(f=u>=(s=(g+y)/2))?g=s:y=s,n=p,!(p=p[h=f<<1|c]))return this;if(!p.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,l=h)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[h]=i:delete n[h],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[l]=p:this._root=p),this):(this._root=i,this)},ag=function(){return this._root},sg=function(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t},cg=function(t){var n,e,r,i,o,u,a=[],s=this._root;for(s&&a.push(new ig(s,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,u=n.y1)&&s.length){var c=(r+o)/2,f=(i+u)/2;(e=s[3])&&a.push(new ig(e,c,f,o,u)),(e=s[2])&&a.pus
|
||
|
|
||
|
})},k_=function(t){for(var n=this,e=mo(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},M_=function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},E_=function(){var t=[];return this.each(function(n){t.push(n)}),t},A_=function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},S_=function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n};Eo.prototype=bo.prototype={constructor:Eo,count:y_,each:__,eachAfter:b_,eachBefore:m_,sum:x_,sort:w_,path:k_,ancestors:M_,descendants:E_,leaves:A_,links:S_,copy:xo};var T_=function(t){for(var n,e=(t=t.slice()).length,r=null,i=r;e;){var o=new Ao(t[e-1]);i=i?i.next=o:r=o,t[n]=t[--e]}return{head:r,tail:i}},C_=function(t){return To(T_(t),[])},O_=function(t){return zo(t),t},P_=function(t){return function(){return t}},L_=function(){function t(t){return t.x=e/2,t.y=r/2,n?t.eachBefore(Uo(n)).eachAfter(Vo(i,.5)).eachBefore(Wo(1)):t.eachBefore(Uo(Fo)).eachAfter(Vo(Bo,1)).eachAfter(Vo(i,t.r/Math.min(e,r))).eachBefore(Wo(Math.min(e,r)/(2*t.r))),t}var n=null,e=1,r=1,i=Bo;return t.radius=function(e){return arguments.length?(n=Ro(e),t):n},t.size=function(n){return arguments.length?(e=+n[0],r=+n[1],t):[e,r]},t.padding=function(n){return arguments.length?(i="function"==typeof n?n:P_(+n),t):i},t},N_=function(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)},D_=function(t,n,e,r,i){for(var o,u=t.children,a=-1,s=u.length,c=t.value&&(r-n)/t.value;++a<s;)o=u[a],o.y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c},j_=function(){function t(t){var u=t.height+1;return t.x0=t.y0=i,t.x1=e,t.y1=r/u,t.eachBefore(n(r,u)),o&&t.eachBefore(N_),t}function n(t,n){return function(e){e.children&&D_(e,e.x0,t*(e.depth+1)/n,e.x1,t*(e.depth+2)/n);var r=e.x0,o=e.y0,u=e.x1-i,a=e.y1-i;r>u&&(r=u=(r+u)/2),o>a&&(o=a=(o+a)/2),e.x0=r,e.y0=o,e.x1=u,e.y1=a}}var e=1,r=1,i=0,o=!1;return t.round=function(n){return arguments.length?(o=!!n,t):o},t.size=function(n){return arguments.length?(e=+n[0],r=+n[1],t):[e,r]},t.padding=function(n){return arguments.length?(i=+n,t):i},t},I_="$",z_={depth:-1},R_={},q_=function(){function t(t){var r,i,o,u,a,s,c,f=t.length,h=new Array(f),l={};for(i=0;f>i;++i)r=t[i],a=h[i]=new Eo(r),null!=(s=n(r,i,t))&&(s+="")&&(c=I_+(a.id=s),l[c]=c in l?R_:a);for(i=0;f>i;++i)if(a=h[i],s=e(t[i],i,t),null!=s&&(s+="")){if(u=l[I_+s],!u)throw new Error("missing: "+s);if(u===R_)throw new Error("ambiguous: "+s);u.children?u.children.push(a):u.children=[a],a.parent=u}else{if(o)throw new Error("multiple roots");o=a}if(!o)throw new Error("no root");if(o.parent=z_,o.eachBefore(function(t){t.depth=t.parent.depth+1,--f}).eachBefore(Mo),o.parent=null,f>0)throw new Error("cycle");return o}var n=Go,e=Yo;return t.id=function(e){return arguments.length?(n=qo(e),t):n},t.parentId=function(n){return arguments.length?(e=qo(n),t):e},t};Qo.prototype=Object.create(Eo.prototype);var B_=function(){function t(t){var r=tu(t);if(r.eachAfter(n),r.parent.m=-r.z,r.eachBefore(e),s)t.eachBefore(i);else{var c=t,f=t,h=t;t.eachBefore(function(t){t.x<c.x&&(c=t),t.x>f.x&&(f=t),t.depth>h.depth&&(h=t)});var l=c===f?1:o(c,f)/2,p=l-c.x,d=u/(f.x+l+p),g=a/(h.depth||1);t.eachBefore(function(t){t.x=(t.x+p)*d,t.y=t.depth*g})}return t}function n(t){var n=t.children,e=t.parent.children,i=t.i?e[t.i-1]:null;if(n){Ko(t);var u=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+o(t._,i._),t.m=t.z-u):t.z=u}else i&&(t.z=i.z+o(t._,i._));t.parent.A=r(t,i,t.parent.A||e[0])}function e(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function r(t,n,e){if(n){for(var r,i=t,u=t,a=n,s=i.parent.children[0],c=i.m,f=u.m,h=a.m,l=s.m;a=$o(a),i=Ho(i),a&&i;)s=Ho(s),u=$o(u),u.a=t,r=a.z+h-i.z-c+o(a._,i._),r>0&&(Zo(Jo(a,t,e),t,r),c+=r,f+=r),h+=a.m,c+=i.m,l+=s.m,f+=u.m;a&&!$o(u)&&(u.t=a,u.m+=h-f),i&&!Ho(s)&&(s.t=i,s.m+=c-l,e=t)}return e}function i(t){t.x*=u,t.y=t.depth*a}var o=Xo,u=1,a=1,s=null;return t.separation=function(n){return arguments.length?(o=n,t):o},t.size=function(n){return arguments.length?(s=!1,u=+n[0],a=+n[1],t):s?null:[u,a]},t.nodeSize=function(n){return argum
|
||
|
|
||
|
t.moveTo(r,i),t.lineTo(o,u),t.lineTo(a,s),t.lineTo(Ix*r-zx*i,zx*r+Ix*i),t.lineTo(Ix*o-zx*u,zx*o+Ix*u),t.lineTo(Ix*a-zx*s,zx*a+Ix*s),t.lineTo(Ix*r+zx*i,Ix*i-zx*r),t.lineTo(Ix*o+zx*u,Ix*u-zx*o),t.lineTo(Ix*a+zx*s,Ix*s-zx*a),t.closePath()}},Fx=[kx,Mx,Sx,Nx,Lx,jx,Bx],Ux=function(){function t(){var t;return r||(r=t=Ne()),n.apply(this,arguments).draw(r,+e.apply(this,arguments)),t?(r=null,t+""||null):void 0}var n=sx(kx),e=sx(64),r=null;return t.type=function(e){return arguments.length?(n="function"==typeof e?e:sx(e),t):n},t.size=function(n){return arguments.length?(e="function"==typeof n?n:sx(+n),t):e},t.context=function(n){return arguments.length?(r=null==n?null:n,t):r},t},Vx=function(){};fs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=0/0},lineStart:function(){this._x0=this._x1=this._y0=this._y1=0/0,this._point=0},lineEnd:function(){switch(this._point){case 3:cs(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cs(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var Wx=function(t){return new fs(t)};hs.prototype={areaStart:Vx,areaEnd:Vx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=0/0,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:cs(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var Gx=function(t){return new hs(t)};ls.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=0/0},lineStart:function(){this._x0=this._x1=this._y0=this._y1=0/0,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:cs(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var Yx=function(t){return new ls(t)};ps.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],u=t[e]-i,a=n[e]-o,s=-1;++s<=e;)r=s/e,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*n[s]+(1-this._beta)*(o+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Xx=function Fw(t){function n(n){return 1===t?new fs(n):new ps(n,t)}return n.beta=function(t){return Fw(+t)},n}(.85);gs.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=0/0},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=0/0,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ds(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineT
|
||
|
this)}},{key:"buildTokenizedDataset",value:function(t){var n=this,e=t.map(function(t){return{id:t.id,count:t.count||1,tokens:n._tokenize(t.text).map(n._transformToken).filter(n._filterToken),rawText:t.text}}).filter(function(t){return t.tokens.length>0});return new c["default"](e)}},{key:"buildModel",value:function(t,n){return new a["default"](this.buildTokenizedDataset(t),n)}}]),t}();n["default"]=d},function(t,n,e){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n["default"]=t,n}function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function u(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n}function a(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}(),c=function _(t,n,e){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:_(i,n,e)}if("value"in r)return r.value;var o=r.get;return void 0===o?void 0:o.call(e)};e(115);var f=e(44),h=i(f),l=e(136),p=e(5),d=e(53),g=r(d),v=e(54),y=function(t){function n(t,e){o(this,n);var r=u(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return r.layers.create(["link","node"]),r.fontSizeScale=h.scaleSqrt().clamp(!0),r.strokeSizeScale=h.scaleSqrt().domain([1,100]).range([1,6]).clamp(!0),r.layouts=[],r.updatePosition=r.updatePosition.bind(r),r.visualize=r.visualize.bind(r),r.on("data",r.visualize),r.on("options",r.visualize),r}return a(n,t),s(n,null,[{key:"getDefaultOptions",value:function(){return l.helper.deepExtend(c(n.__proto__||Object.getPrototypeOf(n),"getDefaultOptions",this).call(this),{initialWidth:800,initialHeight:200,margin:{left:0,top:0,bottom:0,right:0},fontSize:[10,32],gapBetweenGraph:10})}},{key:"getCustomEventNames",value:function(){return["layoutStart","layoutTick","layoutEnd","nodeMouseenter","nodeMouseleave","nodeMousemove","nodeClick","linkMouseenter","linkMouseleave","linkMousemove","linkClick"]}}]),s(n,[{key:"fontSize",value:function(t){return Math.round(this.fontSizeScale(t.data.freq))+"px"}},{key:"renderNodes",value:function(t){var n=this,e=this.layers.get("node").selectAll("g.graph").data(t);e.exit().remove();var r=e.enter().append("g").classed("graph",!0);this.sNodeGraphs=e.merge(r).attr("transform","translate("+this.getInnerWidth()/2+","+this.getInnerHeight()/2+")");var i=r.selectAll("g").data(function(t){return t.nodes},function(t){return t.id});i.exit().remove(),i.enter().append("g").classed("node",!0).on("click.event",this.dispatchAs("nodeClick")).on("mouseenter.event",this.dispatchAs("nodeMouseenter")).on("mousemove.event",this.dispatchAs("nodeMousemove")).on("mouseleave.event",this.dispatchAs("nodeMouseleave")).append("text").attr("dy",".28em").text(function(t){return t.data.entity}).style("cursor","pointer"),this.sNodes=this.layers.get("node").selectAll("g.node"),this.sNodes.select("text").style("font-size",function(t){return n.fontSize(t)}).style("text-anchor","middle")}},{key:"renderLinks",value:function(t){var n=this,e=this.layers.get("link").selectAll("g.graph").data(t);e.exit().remove();var r=e.enter().append("g").classed("graph",!0);this.sLinkGraphs=e.merge(r).attr("transform","translate("+this.getInnerWidth()/2+","+this.getInnerHeight()/2+")");var i=r.selectAll("path.link").data(function(t){return t.links},function
|
||
|
|
||
|
for(var n=this._groups,o=n.length,u=new Array(o),a=0;o>a;++a)for(var s,c=n[a],f=c.length,h=u[a]=[],l=0;f>l;++l)(s=c[l])&&t.call(s,s.__data__,l,c)&&h.push(s);return new r.b(u,this._parents)}},function(t,n){"use strict";function e(){this.innerHTML=""}function r(t){return function(){this.innerHTML=t}}function i(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}n.a=function(t){return arguments.length?this.each(null==t?e:("function"==typeof t?i:r)(t)):this.node().innerHTML}},function(t,n,e){"use strict";function r(){return null}var i=e(14),o=e(19);n.a=function(t,n){var u="function"==typeof t?t:e.i(i.a)(t),a=null==n?r:"function"==typeof n?n:e.i(o.a)(n);return this.select(function(){return this.insertBefore(u.apply(this,arguments),a.apply(this,arguments)||null)})}},function(t,n){"use strict";function e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}n.a=function(){return this.each(e)}},function(t,n,e){"use strict";var r=e(0);n.a=function(t){for(var n=this._groups,e=t._groups,i=n.length,o=e.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var c,f=n[s],h=e[s],l=f.length,p=a[s]=new Array(l),d=0;l>d;++d)(c=f[d]||h[d])&&(p[d]=c);for(;i>s;++s)a[s]=n[s];return new r.b(a,this._parents)}},function(t,n){"use strict";n.a=function(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,o=r.length;o>i;++i){var u=r[i];if(u)return u}return null}},function(t,n){"use strict";n.a=function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}},function(t,n){"use strict";n.a=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this}},function(t,n){"use strict";function e(t){return function(){delete this[t]}}function r(t,n){return function(){this[t]=n}}function i(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}n.a=function(t,n){return arguments.length>1?this.each((null==n?e:"function"==typeof n?i:r)(t,n)):this.node()[t]}},function(t,n){"use strict";function e(){this.nextSibling&&this.parentNode.appendChild(this)}n.a=function(){return this.each(e)}},function(t,n){"use strict";function e(){var t=this.parentNode;t&&t.removeChild(this)}n.a=function(){return this.each(e)}},function(t,n,e){"use strict";var r=e(0),i=e(19);n.a=function(t){"function"!=typeof t&&(t=e.i(i.a)(t));for(var n=this._groups,o=n.length,u=new Array(o),a=0;o>a;++a)for(var s,c,f=n[a],h=f.length,l=u[a]=new Array(h),p=0;h>p;++p)(s=f[p])&&(c=t.call(s,s.__data__,p,f))&&("__data__"in s&&(c.__data__=s.__data__),l[p]=c);return new r.b(u,this._parents)}},function(t,n,e){"use strict";var r=e(0),i=e(40);n.a=function(t){"function"!=typeof t&&(t=e.i(i.a)(t));for(var n=this._groups,o=n.length,u=[],a=[],s=0;o>s;++s)for(var c,f=n[s],h=f.length,l=0;h>l;++l)(c=f[l])&&(u.push(t.call(c,c.__data__,l,f)),a.push(c));return new r.b(u,a)}},function(t,n){"use strict";n.a=function(){var t=0;return this.each(function(){++t}),t}},function(t,n,e){"use strict";function r(t,n){return n>t?-1:t>n?1:t>=n?0:0/0}var i=e(0);n.a=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=r);for(var e=this._groups,o=e.length,u=new Array(o),a=0;o>a;++a){for(var s,c=e[a],f=c.length,h=u[a]=new Array(f),l=0;f>l;++l)(s=c[l])&&(h[l]=s);h.sort(n)}return new i.b(u,this._parents).order()}},function(t,n,e){"use strict";function r(t){return function(){this.style.removeProperty(t)}}function i(t,n,e){return function(){this.style.setProperty(t,n,e)}}function o(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}var u=e(21);n.a=function(t,n,a){var s;return arguments.length>1?this.each((null==n?r:"function"==typeof n?o:i)(t,n,null==a?"":a)):e.i(u.a)(s=this.node()).getComputedStyle(s,null).getPropertyValue(t)}},function(t,n){"use strict";function e(){this.textContent=""}function r(t){return function(){this.textContent=t}}function i(t){return function(){var n=t.apply(this,arguments);t
|
||
|
value:function(){return this.plates.canvas.clear(),this}}]),n}(at),ht=function(t){function n(){var t;S(this,n);for(var e=arguments.length,r=Array(e),i=0;e>i;i++)r[i]=arguments[i];var o=O(this,(t=Object.getPrototypeOf(n)).call.apply(t,[this,document.createElementNS("http://www.w3.org/2000/svg","svg")].concat(r)));return o.rootG=o.selection.append("g"),o.layers=new E(o.rootG),o}return C(n,t),T(n,[{key:"_updateDimension",value:function(){var t=this.width(),n=this.height(),e=this.margin(),r=e.top,i=e.left,o=this.offset(),u=P(o,2),a=u[0],s=u[1];return this.selection.attr("width",t).attr("height",n),this.rootG.attr("transform","translate("+(i+a)+","+(r+s)+")"),this}}]),n}(st),lt=function(t){function n(t){var e;S(this,n);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];var u=O(this,(e=Object.getPrototypeOf(n)).call.apply(e,[this,t].concat(i)));u.addPlate("svg",new ht);var a=u.plates.svg;return u.svg=a.getSelection(),u.rootG=a.rootG,u.layers=a.layers,u.updateDimensionNow(),u}return C(n,t),n}(ft),pt=function(t){function n(t){var e;S(this,n);for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;r>o;o++)i[o-1]=arguments[o];var u=O(this,(e=Object.getPrototypeOf(n)).call.apply(e,[this,t].concat(i)));u.addPlate("svg",new ht);var a=u.plates.svg;return u.svg=a.getSelection(),u.rootG=a.rootG,u.layers=a.layers,u.updateDimensionNow(),u}return C(n,t),n}(at),dt=function(t){function n(){var t;S(this,n);for(var e=arguments.length,r=Array(e),i=0;e>i;i++)r[i]=arguments[i];return O(this,(t=Object.getPrototypeOf(n)).call.apply(t,[this,document.createElement("div")].concat(r)))}return C(n,t),T(n,[{key:"_updateDimension",value:function(){var t=this.width(),n=this.height(),e=this.margin();return this.node.style.width=t-e.left-e.right+"px",this.node.style.height=n-e.top-e.bottom+"px",this.node.style.marginLeft=e.left+"px",this.node.style.marginRight=e.right+"px",this.node.style.marginTop=e.top+"px",this.node.style.marginBottom=e.bottom+"px",this}}]),n}(st);n.helper=nt,n.AbstractChart=at,n.CanvasChart=ft,n.HybridChart=lt,n.SvgChart=pt,n.AbstractPlate=st,n.CanvasPlate=ct,n.DivPlate=dt,n.SvgPlate=ht,n.LayerOrganizer=E,Object.defineProperty(n,"__esModule",{value:!0})})}).call(n,e(46))},function(t,n){var e,r,i;(function(){var o,u,a,s,c,f,h,l,p,d,g,v,y,_,m;a=Math.floor,d=Math.min,u=function(t,n){return n>t?-1:t>n?1:0},p=function(t,n,e,r,i){var o;if(null==e&&(e=0),null==i&&(i=u),0>e)throw new Error("lo must be non-negative");for(null==r&&(r=t.length);r>e;)o=a((e+r)/2),i(n,t[o])<0?r=o:e=o+1;return[].splice.apply(t,[e,e-e].concat(n)),n},f=function(t,n,e){return null==e&&(e=u),t.push(n),_(t,0,t.length-1,e)},c=function(t,n){var e,r;return null==n&&(n=u),e=t.pop(),t.length?(r=t[0],t[0]=e,m(t,0,n)):r=e,r},l=function(t,n,e){var r;return null==e&&(e=u),r=t[0],t[0]=n,m(t,0,e),r},h=function(t,n,e){var r;return null==e&&(e=u),t.length&&e(t[0],n)<0&&(r=[t[0],n],n=r[0],t[0]=r[1],m(t,0,e)),n},s=function(t,n){var e,r,i,o,s,c;for(null==n&&(n=u),o=function(){c=[];for(var n=0,e=a(t.length/2);e>=0?e>n:n>e;e>=0?n++:n--)c.push(n);return c}.apply(this).reverse(),s=[],r=0,i=o.length;i>r;r++)e=o[r],s.push(m(t,e,n));return s},y=function(t,n,e){var r;return null==e&&(e=u),r=t.indexOf(n),-1!==r?(_(t,0,r,e),m(t,r,e)):void 0},g=function(t,n,e){var r,i,o,a,c;if(null==e&&(e=u),i=t.slice(0,n),!i.length)return i;for(s(i,e),c=t.slice(n),o=0,a=c.length;a>o;o++)r=c[o],h(i,r,e);return i.sort(e).reverse()},v=function(t,n,e){var r,i,o,a,f,h,l,g,v,y;if(null==e&&(e=u),10*n<=t.length){if(a=t.slice(0,n).sort(e),!a.length)return a;for(o=a[a.length-1],g=t.slice(n),f=0,l=g.length;l>f;f++)r=g[f],e(r,o)<0&&(p(a,r,0,null,e),a.pop(),o=a[a.length-1]);return a}for(s(t,e),y=[],i=h=0,v=d(n,t.length);v>=0?v>h:h>v;i=v>=0?++h:--h)y.push(c(t,e));return y},_=function(t,n,e,r){var i,o,a;for(null==r&&(r=u),i=t[e];e>n&&(a=e-1>>1,o=t[a],r(i,o)<0);)t[e]=o,e=a;return t[e]=i},m=function(t,n,e){var r,i,o,a,s;for(null==e&&(e=u),i=t.length,s=n,o=t[n],r=2*n+1;i>r;)a=r+1,i>a&&!(e(t[r],t[a])<0)&&(r=a),t[n]=t[r],n=r,r=2*n+1;return t[n]=o,_(t,s,n,e)},o=function(){function t(t){this.cmp=null!=t?t:u,this.no
|
||
|
e=x[r];break}x.push(t),void 0!==e?(t.x=e.x+e.width+o.PADDING,t.y=e.bottom,t.space_left=t.height,t.bottom=t.y,e.space_left-=t.height+o.PADDING,e.bottom+=t.height+o.PADDING):(t.y=b,b+=t.height+o.PADDING,t.x=p,t.bottom=t.y,t.space_left=t.height),t.y+t.height-_>-o.FLOAT_EPSILON&&(_=t.y+t.height-d),t.x+t.width-y>-o.FLOAT_EPSILON&&(y=t.x+t.width-p)}function h(t){var n=0;return t.forEach(function(t){return n+=t.width+o.PADDING}),n}function l(){return y/_}void 0===i&&(i=1);var p=0,d=0,g=n,v=e,i="undefined"!=typeof i?i:1,r="undefined"!=typeof r?r:0,y=0,_=0,m=0,b=0,x=[];0!=t.length&&(u(t),s(t,i),a(t))}function i(t,n){function e(t,n){if(void 0===r[t.index]){n&&(u++,o.push({array:[]})),r[t.index]=u,o[u-1].array.push(t);var a=i[t.index];if(a)for(var s=0;s<a.length;s++)e(a[s],!1)}}for(var r={},i={},o=[],u=0,a=0;a<n.length;a++){var s=n[a],c=s.source,f=s.target;i[c.index]?i[c.index].push(f):i[c.index]=[f],i[f.index]?i[f.index].push(c):i[f.index]=[c]}for(var a=0;a<t.length;a++){var h=t[a];r[h.index]||e(h,!0)}return o}var o={PADDING:10,GOLDEN_SECTION:(1+Math.sqrt(5))/2,FLOAT_EPSILON:1e-4,MAX_INERATIONS:100};e.applyPacking=r,e.separateGraphs=i},{}],10:[function(t,n,e){"use strict";function r(t){return"undefined"!=typeof t.leaves||"undefined"!=typeof t.groups}var i,o=t("./powergraph"),u=t("./linklengths"),a=t("./descent"),s=t("./rectangle"),c=t("./shortestpaths"),f=t("./geom"),h=t("./handledisconnected");!function(t){t[t.start=0]="start",t[t.tick=1]="tick",t[t.end=2]="end"}(i=e.EventType||(e.EventType={}));var l=function(){function t(){var n=this;this._canvasSize=[1,1],this._linkDistance=20,this._defaultNodeSize=10,this._linkLengthCalculator=null,this._linkType=null,this._avoidOverlaps=!1,this._handleDisconnected=!0,this._running=!1,this._nodes=[],this._groups=[],this._rootGroup=null,this._links=[],this._constraints=[],this._distanceMatrix=null,this._descent=null,this._directedLinkConstraints=null,this._threshold=.01,this._visibilityGraph=null,this._groupCompactness=1e-6,this.event=null,this.linkAccessor={getSourceIndex:t.getSourceIndex,getTargetIndex:t.getTargetIndex,setLength:t.setLinkLength,getType:function(t){return"function"==typeof n._linkType?n._linkType(t):0}}}return t.prototype.on=function(t,n){return this.event||(this.event={}),"string"==typeof t?this.event[i[t]]=n:this.event[t]=n,this},t.prototype.trigger=function(t){this.event&&"undefined"!=typeof this.event[t.type]&&this.event[t.type](t)},t.prototype.kick=function(){for(;!this.tick(););},t.prototype.tick=function(){if(this._alpha<this._threshold)return this._running=!1,this.trigger({type:i.end,alpha:this._alpha=0,stress:this._lastStress}),!0;{var t,n,e=this._nodes.length;this._links.length}for(this._descent.locks.clear(),n=0;e>n;++n)if(t=this._nodes[n],t.fixed){("undefined"==typeof t.px||"undefined"==typeof t.py)&&(t.px=t.x,t.py=t.y);var r=[t.px,t.py];this._descent.locks.add(n,r)}var o=this._descent.rungeKutta();return 0===o?this._alpha=0:"undefined"!=typeof this._lastStress&&(this._alpha=o),this._lastStress=o,this.updateNodePositions(),this.trigger({type:i.tick,alpha:this._alpha,stress:this._lastStress}),!1},t.prototype.updateNodePositions=function(){for(var t,n=this._descent.x[0],e=this._descent.x[1],r=this._nodes.length;r--;)t=this._nodes[r],t.x=n[r],t.y=e[r]},t.prototype.nodes=function(t){if(!t){if(0===this._nodes.length&&this._links.length>0){var n=0;this._links.forEach(function(t){n=Math.max(n,t.source,t.target)}),this._nodes=new Array(++n);for(var e=0;n>e;++e)this._nodes[e]={}}return this._nodes}return this._nodes=t,this},t.prototype.groups=function(t){var n=this;return t?(this._groups=t,this._rootGroup={},this._groups.forEach(function(t){"undefined"==typeof t.padding&&(t.padding=1),"undefined"!=typeof t.leaves&&t.leaves.forEach(function(e,r){"number"==typeof e&&((t.leaves[r]=n._nodes[e]).parent=t)}),"undefined"!=typeof t.groups&&t.groups.forEach(function(e,r){"number"==typeof e&&((t.groups[r]=n._groups[e]).parent=t)})}),this._rootGroup.leaves=this._nodes.filter(function(t){return"undefined"==typeof t.parent}),this._rootGroup.groups=this._groups.filter(function(t){retur
|
||
|
|
||
|
}),t.groups.forEach(function(t){var e=(t.padding-n.getSize(t.bounds))/2;t.minVar.cIn.forEach(function(t){return t.gap+=e}),t.minVar.cOut.forEach(function(n){n.left=t.maxVar,n.gap+=e})})),a.concat(w)}function c(t,n,e,r){var i,o=t.length,s=2*o;console.assert(n.length>=o);var c=new Array(s);for(i=0;o>i;++i){var f=t[i],h=new x(n[i],f,e.getCentre(f));c[i]=new w(!0,h,e.getOpen(f)),c[i+o]=new w(!1,h,e.getClose(f))}c.sort(u);var l=new Array,p=a();for(i=0;s>i;++i){var d=c[i],h=d.v;if(d.isOpen)p.insert(h),e.findNeighbours(h,p);else{p.remove(h);var g=function(t,n){var i=(e.getSize(t.r)+e.getSize(n.r))/2+r;l.push(new _.Constraint(t.v,n.v,i))},v=function(t,n,e){for(var r,i=h[t].iterator();null!==(r=i[t]());)e(r,h),r[n].remove(h)};v("prev","next",function(t,n){return g(t,n)}),v("next","prev",function(t,n){return g(n,t)})}}return console.assert(0===p.size),l}function f(t,n){var e=function(e,r){for(var i,o=n.findIter(t);null!==(i=o[e]());){var u=i.r.overlapX(t.r);if((0>=u||u<=i.r.overlapY(t.r))&&(t[e].insert(i),i[r].insert(t)),0>=u)break}};e("next","prev"),e("prev","next")}function h(t,n){var e=function(e,r){var i=n.findIter(t)[e]();null!==i&&i.r.overlapX(t.r)>0&&(t[e].insert(i),i[r].insert(t))};e("next","prev"),e("prev","next")}function l(t,n){return c(t,n,k,1e-6)}function p(t,n){return c(t,n,M,1e-6)}function d(t){return s(t,k,1e-6)}function g(t){return s(t,M,1e-6)}function v(t){var n=t.map(function(t){return new _.Variable(t.cx())}),e=l(t,n),r=new _.Solver(n,e);r.solve(),n.forEach(function(n,e){return t[e].setXCentre(n.position())}),n=t.map(function(t){return new _.Variable(t.cy())}),e=p(t,n),r=new _.Solver(n,e),r.solve(),n.forEach(function(n,e){return t[e].setYCentre(n.position())})}var y=this&&this.__extends||function(t,n){function e(){this.constructor=t}for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r]);t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)},_=t("./vpsc"),m=t("./rbtree");e.computeGroupBounds=r;var b=function(){function t(t,n,e,r){this.x=t,this.X=n,this.y=e,this.Y=r}return t.empty=function(){return new t(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},t.prototype.cx=function(){return(this.x+this.X)/2},t.prototype.cy=function(){return(this.y+this.Y)/2},t.prototype.overlapX=function(t){var n=this.cx(),e=t.cx();return e>=n&&t.x<this.X?this.X-t.x:n>=e&&this.x<t.X?t.X-this.x:0},t.prototype.overlapY=function(t){var n=this.cy(),e=t.cy();return e>=n&&t.y<this.Y?this.Y-t.y:n>=e&&this.y<t.Y?t.Y-this.y:0},t.prototype.setXCentre=function(t){var n=t-this.cx();this.x+=n,this.X+=n},t.prototype.setYCentre=function(t){var n=t-this.cy();this.y+=n,this.Y+=n},t.prototype.width=function(){return this.X-this.x},t.prototype.height=function(){return this.Y-this.y},t.prototype.union=function(n){return new t(Math.min(this.x,n.x),Math.max(this.X,n.X),Math.min(this.y,n.y),Math.max(this.Y,n.Y))},t.prototype.lineIntersections=function(n,e,r,i){for(var o=[[this.x,this.y,this.X,this.y],[this.X,this.y,this.X,this.Y],[this.X,this.Y,this.x,this.Y],[this.x,this.Y,this.x,this.y]],u=[],a=0;4>a;++a){var s=t.lineIntersection(n,e,r,i,o[a][0],o[a][1],o[a][2],o[a][3]);null!==s&&u.push({x:s.x,y:s.y})}return u},t.prototype.rayIntersection=function(t,n){var e=this.lineIntersections(this.cx(),this.cy(),t,n);return e.length>0?e[0]:null},t.prototype.vertices=function(){return[{x:this.x,y:this.y},{x:this.X,y:this.y},{x:this.X,y:this.Y},{x:this.x,y:this.Y},{x:this.x,y:this.y}]},t.lineIntersection=function(t,n,e,r,i,o,u,a){var s=e-t,c=u-i,f=r-n,h=a-o,l=h*s-c*f;if(0==l)return null;var p=t-i,d=n-o,g=c*d-h*p,v=g/l,y=s*d-f*p,_=y/l;return v>=0&&1>=v&&_>=0&&1>=_?{x:t+v*s,y:n+v*f}:null},t.prototype.inflate=function(n){return new t(this.x-n,this.X+n,this.y-n,this.Y+n)},t}();e.Rectangle=b,e.makeEdgeBetween=i,e.makeEdgeTo=o;var x=function(){function t(t,n,e){this.v=t,this.r=n,this.pos=e,this.prev=a(),this.next=a()}return t}(),w=function(){function t(t,n,e){this.isOpen=t,this.v=n,this.pos=e}return t}(),k={getCentre:function(t){return t.cx()},getOpen:function(t){return t.y},getClose:function(t){return t.Y},getSiz
|