@hpcc-js/graph 2.75.0 → 2.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +8329 -718
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +8335 -724
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +24 -23
- package/src/__package__.ts +2 -2
- package/src/graph2/graph.ts +1 -3
- package/src/graph2/layouts/dagreWorker.ts +1 -1
- package/src/graph2/layouts/forceDirectedWorker.ts +1 -8
- package/src/graph2/layouts/graphvizWorker.ts +1 -22
- package/types/__package__.d.ts +2 -2
- package/types/graph2/graph.d.ts.map +1 -1
- package/types/graph2/layouts/forceDirectedWorker.d.ts.map +1 -1
- package/types/graph2/layouts/graphvizWorker.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/graph",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.77.0",
|
|
4
4
|
"description": "hpcc-js - Viz Graph",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -48,25 +48,26 @@
|
|
|
48
48
|
"stamp": "node node_modules/@hpcc-js/bundle/src/stamp.js",
|
|
49
49
|
"lint": "eslint src/**/*.ts",
|
|
50
50
|
"docs": "typedoc --options tdoptions.json .",
|
|
51
|
-
"ddd": "downlevel-dts . ts3.4"
|
|
51
|
+
"ddd": "downlevel-dts . ts3.4",
|
|
52
|
+
"update": "npx npm-check-updates -u -t minor"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@hpcc-js/api": "^2.8.
|
|
55
|
-
"@hpcc-js/common": "^2.
|
|
56
|
-
"@hpcc-js/html": "^2.
|
|
57
|
-
"@hpcc-js/react": "^2.
|
|
58
|
-
"@hpcc-js/util": "^2.
|
|
55
|
+
"@hpcc-js/api": "^2.8.59",
|
|
56
|
+
"@hpcc-js/common": "^2.64.0",
|
|
57
|
+
"@hpcc-js/html": "^2.39.0",
|
|
58
|
+
"@hpcc-js/react": "^2.47.0",
|
|
59
|
+
"@hpcc-js/util": "^2.44.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@hpcc-js/bundle": "^2.10.
|
|
62
|
+
"@hpcc-js/bundle": "^2.10.23",
|
|
62
63
|
"@hpcc-js/wasm": "1.7.1",
|
|
63
|
-
"@rollup/plugin-alias": "3.1.
|
|
64
|
-
"@rollup/plugin-commonjs": "
|
|
65
|
-
"@rollup/plugin-node-resolve": "
|
|
64
|
+
"@rollup/plugin-alias": "3.1.0",
|
|
65
|
+
"@rollup/plugin-commonjs": "12.0.0",
|
|
66
|
+
"@rollup/plugin-node-resolve": "8.0.0",
|
|
66
67
|
"@types/d3-transition": "1.3.2",
|
|
67
68
|
"@types/dagre": "0.7.41",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "
|
|
69
|
-
"@typescript-eslint/parser": "
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "4.31.0",
|
|
70
|
+
"@typescript-eslint/parser": "4.31.0",
|
|
70
71
|
"cpx": "1.5.0",
|
|
71
72
|
"d3-array": "^1",
|
|
72
73
|
"d3-drag": "^1",
|
|
@@ -81,17 +82,17 @@
|
|
|
81
82
|
"dagre": "0.8.5",
|
|
82
83
|
"downlevel-dts": "0.6.0",
|
|
83
84
|
"es6-promise": "4.2.8",
|
|
84
|
-
"eslint": "
|
|
85
|
+
"eslint": "7.32.0",
|
|
85
86
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
86
87
|
"npm-run-all": "4.1.5",
|
|
87
|
-
"rimraf": "
|
|
88
|
-
"rollup": "2.
|
|
89
|
-
"rollup-plugin-postcss": "
|
|
90
|
-
"rollup-plugin-sourcemaps": "0.6.
|
|
91
|
-
"terser": "
|
|
92
|
-
"tslib": "2.3.
|
|
93
|
-
"typedoc": "0.
|
|
94
|
-
"typescript": "4.
|
|
88
|
+
"rimraf": "2.6.3",
|
|
89
|
+
"rollup": "2.10.7",
|
|
90
|
+
"rollup-plugin-postcss": "3.1.1",
|
|
91
|
+
"rollup-plugin-sourcemaps": "0.6.2",
|
|
92
|
+
"terser": "4.0.0",
|
|
93
|
+
"tslib": "2.3.0",
|
|
94
|
+
"typedoc": "0.14.2",
|
|
95
|
+
"typescript": "4.3.4"
|
|
95
96
|
},
|
|
96
97
|
"repository": {
|
|
97
98
|
"type": "git",
|
|
@@ -104,5 +105,5 @@
|
|
|
104
105
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
105
106
|
},
|
|
106
107
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
107
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "f7efefac2a4dbd99309a35f040d149a8e8349c88"
|
|
108
109
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/graph";
|
|
2
|
-
export const PKG_VERSION = "2.
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "2.77.0";
|
|
3
|
+
export const BUILD_VERSION = "2.99.0";
|
package/src/graph2/graph.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface Options {
|
|
|
36
36
|
|
|
37
37
|
export function dagre(data: Data, options: Options) {
|
|
38
38
|
// eslint-disable-next-line quotes
|
|
39
|
-
const workerCode = `!function(){"use strict";var e,n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};try{e=require("graphlib")}catch(e){}e||(e=window.graphlib);var r,t=e;try{r={cloneDeep:require("lodash/cloneDeep"),constant:require("lodash/constant"),defaults:require("lodash/defaults"),each:require("lodash/each"),filter:require("lodash/filter"),find:require("lodash/find"),flatten:require("lodash/flatten"),forEach:require("lodash/forEach"),forIn:require("lodash/forIn"),has:require("lodash/has"),isUndefined:require("lodash/isUndefined"),last:require("lodash/last"),map:require("lodash/map"),mapValues:require("lodash/mapValues"),max:require("lodash/max"),merge:require("lodash/merge"),min:require("lodash/min"),minBy:require("lodash/minBy"),now:require("lodash/now"),pick:require("lodash/pick"),range:require("lodash/range"),reduce:require("lodash/reduce"),sortBy:require("lodash/sortBy"),uniqueId:require("lodash/uniqueId"),values:require("lodash/values"),zipObject:require("lodash/zipObject")}}catch(e){}r||(r=window._);var o=r,i=a;function a(){var e={};e._next=e._prev=e,this._sentinel=e}function u(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function c(e,n){if("_next"!==e&&"_prev"!==e)return n}a.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return u(n),n},a.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&u(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},a.prototype.toString=function(){for(var e=[],n=this._sentinel,r=n._prev;r!==n;)e.push(JSON.stringify(r,c)),r=r._prev;return"["+e.join(", ")+"]"};var s=o,f=t.Graph,d=i,h=function(e,n){if(e.nodeCount()<=1)return[];var r=function(e,n){var r=new f,t=0,o=0;s.forEach(e.nodes(),(function(e){r.setNode(e,{v:e,in:0,out:0})})),s.forEach(e.edges(),(function(e){var i=r.edge(e.v,e.w)||0,a=n(e),u=i+a;r.setEdge(e.v,e.w,u),o=Math.max(o,r.node(e.v).out+=a),t=Math.max(t,r.node(e.w).in+=a)}));var i=s.range(o+t+3).map((function(){return new d})),a=t+1;return s.forEach(r.nodes(),(function(e){g(i,a,r.node(e))})),{graph:r,buckets:i,zeroIdx:a}}(e,n||l),t=function(e,n,r){var t,o=[],i=n[n.length-1],a=n[0];for(;e.nodeCount();){for(;t=a.dequeue();)v(e,n,r,t);for(;t=i.dequeue();)v(e,n,r,t);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(t=n[u].dequeue()){o=o.concat(v(e,n,r,t,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return s.flatten(s.map(t,(function(n){return e.outEdges(n.v,n.w)})),!0)},l=s.constant(1);function v(e,n,r,t,o){var i=o?[]:void 0;return s.forEach(e.inEdges(t.v),(function(t){var a=e.edge(t),u=e.node(t.v);o&&i.push({v:t.v,w:t.w}),u.out-=a,g(n,r,u)})),s.forEach(e.outEdges(t.v),(function(t){var o=e.edge(t),i=t.w,a=e.node(i);a.in-=o,g(n,r,a)})),e.removeNode(t.v),i}function g(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var p=o,m=h,w={run:function(e){var n="greedy"===e.graph().acyclicer?m(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],r={},t={};function o(i){p.has(t,i)||(t[i]=!0,r[i]=!0,p.forEach(e.outEdges(i),(function(e){p.has(r,e.w)?n.push(e):o(e.w)})),delete r[i])}return p.forEach(e.nodes(),o),n}(e);p.forEach(n,(function(n){var r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,p.uniqueId("rev"))}))},undo:function(e){p.forEach(e.edges(),(function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}}))}};var E=o,y=t.Graph,b={addDummyNode:_,simplify:function(e){var n=(new y).setGraph(e.graph());return E.forEach(e.nodes(),(function(r){n.setNode(r,e.node(r))})),E.forEach(e.edges(),(function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new y({multigraph:e.isMultigraph()}).setGraph(e.graph());return E.forEach(e.nodes(),(function(r){e.children(r).length||n.setNode(r,e.node(r))})),E.forEach(e.edges(),(function(r){n.setEdge(r,e.edge(r))})),n},successorWeights:function(e){var n=E.map(e.nodes(),(function(n){var r={};return E.forEach(e.outEdges(n),(function(n){r[n.w]=(r[n.w]||0)+e.edge(n).weight})),r}));return E.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=E.map(e.nodes(),(function(n){var r={};return E.forEach(e.inEdges(n),(function(n){r[n.v]=(r[n.v]||0)+e.edge(n).weight})),r}));return E.zipObject(e.nodes(),n)},intersectRect:function(e,n){var r,t,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),r=s*a/u,t=s):(a<0&&(c=-c),r=c,t=c*u/a);return{x:o+r,y:i+t}},buildLayerMatrix:function(e){var n=E.map(E.range(x(e)+1),(function(){return[]}));return E.forEach(e.nodes(),(function(r){var t=e.node(r),o=t.rank;E.isUndefined(o)||(n[o][t.order]=r)})),n},normalizeRanks:function(e){var n=E.min(E.map(e.nodes(),(function(n){return e.node(n).rank})));E.forEach(e.nodes(),(function(r){var t=e.node(r);E.has(t,"rank")&&(t.rank-=n)}))},removeEmptyRanks:function(e){var n=E.min(E.map(e.nodes(),(function(n){return e.node(n).rank}))),r=[];E.forEach(e.nodes(),(function(t){var o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)}));var t=0,o=e.graph().nodeRankFactor;E.forEach(r,(function(n,r){E.isUndefined(n)&&r%o!=0?--t:t&&E.forEach(n,(function(n){e.node(n).rank+=t}))}))},addBorderNode:function(e,n,r,t){var o={width:0,height:0};arguments.length>=4&&(o.rank=r,o.order=t);return _(e,"border",o,n)},maxRank:x,partition:function(e,n){var r={lhs:[],rhs:[]};return E.forEach(e,(function(e){n(e)?r.lhs.push(e):r.rhs.push(e)})),r},time:function(e,n){var r=E.now();try{return n()}finally{console.log(e+" time: "+(E.now()-r)+"ms")}},notime:function(e,n){return n()}};function _(e,n,r,t){var o;do{o=E.uniqueId(t)}while(e.hasNode(o));return r.dummy=n,e.setNode(o,r),o}function x(e){return E.max(E.map(e.nodes(),(function(n){var r=e.node(n).rank;if(!E.isUndefined(r))return r})))}var k=o,N=b,I={run:function(e){e.graph().dummyChains=[],k.forEach(e.edges(),(function(n){!function(e,n){var r,t,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,f=e.edge(n),d=f.labelRank;if(c===a+1)return;for(e.removeEdge(n),o=0,++a;a<c;++o,++a)f.points=[],t={width:0,height:0,edgeLabel:f,edgeObj:n,rank:a},r=N.addDummyNode(e,"edge",t,"_d"),a===d&&(t.width=f.width,t.height=f.height,t.dummy="edge-label",t.labelpos=f.labelpos),e.setEdge(i,r,{weight:f.weight},s),0===o&&e.graph().dummyChains.push(r),i=r;e.setEdge(i,u,{weight:f.weight},s)}(e,n)}))},undo:function(e){k.forEach(e.graph().dummyChains,(function(n){var r,t=e.node(n),o=t.edgeLabel;for(e.setEdge(t.edgeObj,o);t.dummy;)r=e.successors(n)[0],e.removeNode(n),o.points.push({x:t.x,y:t.y}),"edge-label"===t.dummy&&(o.x=t.x,o.y=t.y,o.width=t.width,o.height=t.height),n=r,t=e.node(n)}))}};var q=o,M={longestPath:function(e){var n={};q.forEach(e.sources(),(function r(t){var o=e.node(t);if(q.has(n,t))return o.rank;n[t]=!0;var i=q.min(q.map(e.outEdges(t),(function(n){return r(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},slack:function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}};var T=o,R=t.Graph,L=M.slack,C=function(e){var n,r,t=new R({directed:!1}),o=e.nodes()[0],i=e.nodeCount();t.setNode(o,{});for(;P(t,e)<i;)n=S(t,e),r=t.hasNode(n.v)?L(e,n):-L(e,n),B(t,e,r);return t};function P(e,n){return T.forEach(e.nodes(),(function r(t){T.forEach(n.nodeEdges(t),(function(o){var i=o.v,a=t===i?o.w:i;e.hasNode(a)||L(n,o)||(e.setNode(a,{}),e.setEdge(t,a,{}),r(a))}))})),e.nodeCount()}function S(e,n){return T.minBy(n.edges(),(function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return L(n,r)}))}function B(e,n,r){T.forEach(e.nodes(),(function(e){n.node(e).rank+=r}))}var G=o,j=C,O=M.slack,A=M.longestPath,V=t.alg.preorder,D=t.alg.postorder,F=b.simplify,U=z;function z(e){e=F(e),A(e);var n,r=j(e);for(J(r),Y(r,e);n=H(r);)X(r,e,n,Q(r,e,n))}function Y(e,n){var r=D(e,e.nodes());r=r.slice(0,r.length-1),G.forEach(r,(function(r){!function(e,n,r){var t=e.node(r).parent;e.edge(r,t).cutvalue=W(e,n,r)}(e,n,r)}))}function W(e,n,r){var t=e.node(r).parent,o=!0,i=n.edge(r,t),a=0;return i||(o=!1,i=n.edge(t,r)),a=i.weight,G.forEach(n.nodeEdges(r),(function(i){var u,c,s=i.v===r,f=s?i.w:i.v;if(f!==t){var d=s===o,h=n.edge(i).weight;if(a+=d?h:-h,u=r,c=f,e.hasEdge(u,c)){var l=e.edge(r,f).cutvalue;a+=d?-l:l}}})),a}function J(e,n){arguments.length<2&&(n=e.nodes()[0]),K(e,{},1,n)}function K(e,n,r,t,o){var i=r,a=e.node(t);return n[t]=!0,G.forEach(e.neighbors(t),(function(o){G.has(n,o)||(r=K(e,n,r,o,t))})),a.low=i,a.lim=r++,o?a.parent=o:delete a.parent,r}function H(e){return G.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Q(e,n,r){var t=r.v,o=r.w;n.hasEdge(t,o)||(t=r.w,o=r.v);var i=e.node(t),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=G.filter(n.edges(),(function(n){return c===Z(e,e.node(n.v),u)&&c!==Z(e,e.node(n.w),u)}));return G.minBy(s,(function(e){return O(n,e)}))}function X(e,n,r,t){var o=r.v,i=r.w;e.removeEdge(o,i),e.setEdge(t.v,t.w,{}),J(e),Y(e,n),function(e,n){var r=G.find(e.nodes(),(function(e){return!n.node(e).parent})),t=V(e,r);t=t.slice(1),G.forEach(t,(function(r){var t=e.node(r).parent,o=n.edge(r,t),i=!1;o||(o=n.edge(t,r),i=!0),n.node(r).rank=n.node(t).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function Z(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}z.initLowLimValues=J,z.initCutValues=Y,z.calcCutValue=W,z.leaveEdge=H,z.enterEdge=Q,z.exchangeEdges=X;var $=M.longestPath,ee=C,ne=U,re=function(e){switch(e.graph().ranker){case"network-simplex":default:oe(e);break;case"tight-tree":!function(e){$(e),ee(e)}(e);break;case"longest-path":te(e)}};var te=$;function oe(e){ne(e)}var ie=o,ae=function(e){var n=function(e){var n={},r=0;function t(o){var i=r;ie.forEach(e.children(o),t),n[o]={low:i,lim:r++}}return ie.forEach(e.children(),t),n}(e);ie.forEach(e.graph().dummyChains,(function(r){for(var t=e.node(r),o=t.edgeObj,i=function(e,n,r,t){var o,i,a=[],u=[],c=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim);o=r;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));i=o,o=t;for(;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],f=!0;r!==o.w;){if(t=e.node(r),f){for(;(s=a[c])!==u&&e.node(s).maxRank<t.rank;)c++;s===u&&(f=!1)}if(!f){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=t.rank;)c++;s=a[c]}e.setParent(r,s),r=e.successors(r)[0]}}))};var ue=o,ce=b,se={run:function(e){var n=ce.addDummyNode(e,"root",{},"_root"),r=function(e){var n={};function r(t,o){var i=e.children(t);i&&i.length&&ue.forEach(i,(function(e){r(e,o+1)})),n[t]=o}return ue.forEach(e.children(),(function(e){r(e,1)})),n}(e),t=ue.max(ue.values(r))-1,o=2*t+1;e.graph().nestingRoot=n,ue.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return ue.reduce(e.edges(),(function(n,r){return n+e.edge(r).weight}),0)}(e)+1;ue.forEach(e.children(),(function(a){fe(e,n,o,i,t,r,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,ue.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function fe(e,n,r,t,o,i,a){var u=e.children(a);if(u.length){var c=ce.addBorderNode(e,"_bt"),s=ce.addBorderNode(e,"_bb"),f=e.node(a);e.setParent(c,a),f.borderTop=c,e.setParent(s,a),f.borderBottom=s,ue.forEach(u,(function(u){fe(e,n,r,t,o,i,u);var f=e.node(u),d=f.borderTop?f.borderTop:u,h=f.borderBottom?f.borderBottom:u,l=f.borderTop?t:2*t,v=d!==h?1:o-i[a]+1;e.setEdge(c,d,{weight:l,minlen:v,nestingEdge:!0}),e.setEdge(h,s,{weight:l,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:r})}var de=o,he=b,le=function(e){de.forEach(e.children(),(function n(r){var t=e.children(r),o=e.node(r);if(t.length&&de.forEach(t,n),de.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)ve(e,"borderLeft","_bl",r,o,i),ve(e,"borderRight","_br",r,o,i)}}))};function ve(e,n,r,t,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=he.addDummyNode(e,"border",a,r);o[n][i]=c,e.setParent(c,t),u&&e.setEdge(u,c,{weight:1})}var ge=o,pe={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||me(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ge.forEach(e.nodes(),(function(n){Ee(e.node(n))})),ge.forEach(e.edges(),(function(n){var r=e.edge(n);ge.forEach(r.points,Ee),ge.has(r,"y")&&Ee(r)}))}(e);"lr"!==n&&"rl"!==n||(!function(e){ge.forEach(e.nodes(),(function(n){ye(e.node(n))})),ge.forEach(e.edges(),(function(n){var r=e.edge(n);ge.forEach(r.points,ye),ge.has(r,"x")&&ye(r)}))}(e),me(e))}};function me(e){ge.forEach(e.nodes(),(function(n){we(e.node(n))})),ge.forEach(e.edges(),(function(n){we(e.edge(n))}))}function we(e){var n=e.width;e.width=e.height,e.height=n}function Ee(e){e.y=-e.y}function ye(e){var n=e.x;e.x=e.y,e.y=n}var be=o,_e=function(e){var n={},r=be.filter(e.nodes(),(function(n){return!e.children(n).length})),t=be.max(be.map(r,(function(n){return e.node(n).rank}))),o=be.map(be.range(t+1),(function(){return[]}));function i(r){if(!be.has(n,r)){n[r]=!0;var t=e.node(r);o[t.rank].push(r),be.forEach(e.successors(r),i)}}var a=be.sortBy(r,(function(n){return e.node(n).rank}));return be.forEach(a,i),o};var xe=o,ke=function(e,n){for(var r=0,t=1;t<n.length;++t)r+=Ne(e,n[t-1],n[t]);return r};function Ne(e,n,r){for(var t=xe.zipObject(r,xe.map(r,(function(e,n){return n}))),o=xe.flatten(xe.map(n,(function(n){return xe.sortBy(xe.map(e.outEdges(n),(function(n){return{pos:t[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<r.length;)i<<=1;var a=2*i-1;i-=1;var u=xe.map(new Array(a),(function(){return 0})),c=0;return xe.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var r=0;n>0;)n%2&&(r+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*r}))),c}var Ie=o;var qe=o;var Me=o,Te=b;function Re(e,n,r){for(var t;n.length&&(t=Me.last(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}var Le=o,Ce=function(e,n){return Ie.map(n,(function(n){var r=e.inEdges(n);if(r.length){var t=Ie.reduce(r,(function(n,r){var t=e.edge(r),o=e.node(r.v);return{sum:n.sum+t.weight*o.order,weight:n.weight+t.weight}}),{sum:0,weight:0});return{v:n,barycenter:t.sum/t.weight,weight:t.weight}}return{v:n}}))},Pe=function(e,n){var r={};return qe.forEach(e,(function(e,n){var t=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};qe.isUndefined(e.barycenter)||(t.barycenter=e.barycenter,t.weight=e.weight)})),qe.forEach(n.edges(),(function(e){var n=r[e.v],t=r[e.w];qe.isUndefined(n)||qe.isUndefined(t)||(t.indegree++,n.out.push(r[e.w]))})),function(e){var n=[];function r(e){return function(n){n.merged||(qe.isUndefined(n.barycenter)||qe.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight);n.weight&&(r+=n.barycenter*n.weight,t+=n.weight);e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function t(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}for(;e.length;){var o=e.pop();n.push(o),qe.forEach(o.in.reverse(),r(o)),qe.forEach(o.out,t(o))}return qe.map(qe.filter(n,(function(e){return!e.merged})),(function(e){return qe.pick(e,["vs","i","barycenter","weight"])}))}(qe.filter(r,(function(e){return!e.indegree})))},Se=function(e,n){var r=Te.partition(e,(function(e){return Me.has(e,"barycenter")})),t=r.lhs,o=Me.sortBy(r.rhs,(function(e){return-e.i})),i=[],a=0,u=0,c=0;t.sort((s=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:s?n.i-e.i:e.i-n.i})),c=Re(i,o,c),Me.forEach(t,(function(e){c+=e.vs.length,i.push(e.vs),a+=e.barycenter*e.weight,u+=e.weight,c=Re(i,o,c)}));var s;var f={vs:Me.flatten(i,!0)};u&&(f.barycenter=a/u,f.weight=u);return f},Be=function e(n,r,t,o){var i=n.children(r),a=n.node(r),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=Le.filter(i,(function(e){return e!==u&&e!==c})));var f=Ce(n,i);Le.forEach(f,(function(r){if(n.children(r.v).length){var i=e(n,r.v,t,o);s[r.v]=i,Le.has(i,"barycenter")&&(a=r,u=i,Le.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=Pe(f,t);!function(e,n){Le.forEach(e,(function(e){e.vs=Le.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var h=Se(d,o);if(u&&(h.vs=Le.flatten([u,h.vs,c],!0),n.predecessors(u).length)){var l=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);Le.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+l.order+v.order)/(h.weight+2),h.weight+=2}return h};var Ge=o,je=t.Graph,Oe=function(e,n,r){var t=function(e){var n;for(;e.hasNode(n=Ge.uniqueId("_root")););return n}(e),o=new je({compound:!0}).setGraph({root:t}).setDefaultNodeLabel((function(n){return e.node(n)}));return Ge.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||t),Ge.forEach(e[r](i),(function(n){var r=n.v===i?n.w:n.v,t=o.edge(r,i),a=Ge.isUndefined(t)?0:t.weight;o.setEdge(r,i,{weight:e.edge(n).weight+a})})),Ge.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o};var Ae=o;var Ve=o,De=_e,Fe=ke,Ue=Be,ze=Oe,Ye=function(e,n,r){var t,o={};Ae.forEach(r,(function(r){for(var i,a,u=e.parent(r);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=t,t=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))},We=t.Graph,Je=b,Ke=function(e){var n=Je.maxRank(e),r=He(e,Ve.range(1,n+1),"inEdges"),t=He(e,Ve.range(n-1,-1,-1),"outEdges"),o=De(e);Xe(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Qe(u%2?r:t,u%4>=2),o=Je.buildLayerMatrix(e);var s=Fe(e,o);s<a&&(c=0,i=Ve.cloneDeep(o),a=s)}Xe(e,i)};function He(e,n,r){return Ve.map(n,(function(n){return ze(e,n,r)}))}function Qe(e,n){var r=new We;Ve.forEach(e,(function(e){var t=e.graph().root,o=Ue(e,t,r,n);Ve.forEach(o.vs,(function(n,r){e.node(n).order=r})),Ye(e,r,o.vs)}))}function Xe(e,n){Ve.forEach(n,(function(n){Ve.forEach(n,(function(n,r){e.node(n).order=r}))}))}var Ze=o,$e=t.Graph,en=b,nn=function(e){var n,r=en.buildLayerMatrix(e),t=Ze.merge(rn(e,r),tn(e,r)),o={};Ze.forEach(["u","d"],(function(i){n="u"===i?r:Ze.values(r).reverse(),Ze.forEach(["l","r"],(function(r){"r"===r&&(n=Ze.map(n,(function(e){return Ze.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=un(e,n,t,a),c=cn(e,n,u.root,u.align,"r"===r);"r"===r&&(c=Ze.mapValues(c,(function(e){return-e}))),o[i+r]=c}))}));var i=sn(e,o);return fn(o,i),dn(o,e.graph().align)};function rn(e,n){var r={};return Ze.reduce(n,(function(n,t){var o=0,i=0,a=n.length,u=Ze.last(t);return Ze.forEach(t,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return Ze.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),f=s?e.node(s).order:a;(s||n===u)&&(Ze.forEach(t.slice(i,c+1),(function(n){Ze.forEach(e.predecessors(n),(function(t){var i=e.node(t),a=i.order;!(a<o||f<a)||i.dummy&&e.node(n).dummy||on(r,t,n)}))})),i=c+1,o=f)})),t})),r}function tn(e,n){var r={};function t(n,t,o,i,a){var u;Ze.forEach(Ze.range(t,o),(function(t){u=n[t],e.node(u).dummy&&Ze.forEach(e.predecessors(u),(function(n){var t=e.node(n);t.dummy&&(t.order<i||t.order>a)&&on(r,n,u)}))}))}return Ze.reduce(n,(function(n,r){var o,i=-1,a=0;return Ze.forEach(r,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,t(r,a,c,i,o),a=c,i=o)}t(r,a,r.length,o,n.length)})),r})),r}function on(e,n,r){if(n>r){var t=n;n=r,r=t}var o=e[n];o||(e[n]=o={}),o[r]=!0}function an(e,n,r){if(n>r){var t=n;n=r,r=t}return Ze.has(e[n],r)}function un(e,n,r,t){var o={},i={},a={};return Ze.forEach(n,(function(e){Ze.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Ze.forEach(n,(function(e){var n=-1;Ze.forEach(e,(function(e){var u=t(e);if(u.length){u=Ze.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),f=Math.ceil(c);s<=f;++s){var d=u[s];i[e]===e&&n<a[d]&&!an(r,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}function cn(e,n,r,t,o){var i={},a=function(e,n,r,t){var o=new $e,i=e.graph(),a=function(e,n,r){return function(t,o,i){var a,u=t.node(o),c=t.node(i),s=0;if(s+=u.width/2,Ze.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=r?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,Ze.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=r?a:-a),a=0,s}}(i.nodesep,i.edgesep,t);return Ze.forEach(n,(function(n){var t;Ze.forEach(n,(function(n){var i=r[n];if(o.setNode(i),t){var u=r[t],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,t),c||0))}t=n}))})),o}(e,n,r,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var r=a.nodes(),t=r.pop(),o={};t;)o[t]?e(t):(o[t]=!0,r.push(t),r=r.concat(n(t))),t=r.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var r=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),t=e.node(n);r!==Number.POSITIVE_INFINITY&&t.borderType!==u&&(i[n]=Math.max(i[n],r))}),a.successors.bind(a)),Ze.forEach(t,(function(e){i[e]=i[r[e]]})),i}function sn(e,n){return Ze.minBy(Ze.values(n),(function(n){var r=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY;return Ze.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;r=Math.max(n+i,r),t=Math.min(n-i,t)})),r-t}))}function fn(e,n){var r=Ze.values(n),t=Ze.min(r),o=Ze.max(r);Ze.forEach(["u","d"],(function(r){Ze.forEach(["l","r"],(function(i){var a,u=r+i,c=e[u];if(c!==n){var s=Ze.values(c);(a="l"===i?t-Ze.min(s):o-Ze.max(s))&&(e[u]=Ze.mapValues(c,(function(e){return e+a})))}}))}))}function dn(e,n){return Ze.mapValues(e.ul,(function(r,t){if(n)return e[n.toLowerCase()][t];var o=Ze.sortBy(Ze.map(e,t));return(o[1]+o[2])/2}))}var hn=o,ln=b,vn=nn;var gn=o,pn=w,mn=I,wn=re,En=b.normalizeRanks,yn=ae,bn=b.removeEmptyRanks,_n=se,xn=le,kn=pe,Nn=Ke,In=function(e){(function(e){var n=ln.buildLayerMatrix(e),r=e.graph().ranksep,t=0;hn.forEach(n,(function(n){var o=hn.max(hn.map(n,(function(n){return e.node(n).height})));hn.forEach(n,(function(n){e.node(n).y=t+o/2})),t+=o+r}))})(e=ln.asNonCompoundGraph(e)),hn.forEach(vn(e),(function(n,r){e.node(r).x=n}))},qn=b,Mn=t.Graph,Tn=function(e,n){var r=n&&n.debugTiming?qn.time:qn.notime;r("layout",(function(){var n=r(" buildLayoutGraph",(function(){return function(e){var n=new Mn({multigraph:!0,compound:!0}),r=An(e.graph());return n.setGraph(gn.merge({},Ln,On(r,Rn),gn.pick(r,Cn))),gn.forEach(e.nodes(),(function(r){var t=An(e.node(r));n.setNode(r,gn.defaults(On(t,Pn),Sn)),n.setParent(r,e.parent(r))})),gn.forEach(e.edges(),(function(r){var t=An(e.edge(r));n.setEdge(r,gn.merge({},Gn,On(t,Bn),gn.pick(t,jn)))})),n}(e)}));r(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,gn.forEach(e.edges(),(function(r){var t=e.edge(r);t.minlen*=2,"c"!==t.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?t.width+=t.labeloffset:t.height+=t.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){gn.forEach(e.edges(),(function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){pn.run(e)})),n(" nestingGraph.run",(function(){_n.run(e)})),n(" rank",(function(){wn(qn.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){gn.forEach(e.edges(),(function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),o={rank:(e.node(n.w).rank-t.rank)/2+t.rank,e:n};qn.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){bn(e)})),n(" nestingGraph.cleanup",(function(){_n.cleanup(e)})),n(" normalizeRanks",(function(){En(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;gn.forEach(e.nodes(),(function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=gn.max(n,t.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){gn.forEach(e.nodes(),(function(n){var r=e.node(n);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){mn.run(e)})),n(" parentDummyChains",(function(){yn(e)})),n(" addBorderSegments",(function(){xn(e)})),n(" order",(function(){Nn(e)})),n(" insertSelfEdges",(function(){!function(e){var n=qn.buildLayerMatrix(e);gn.forEach(n,(function(n){var r=0;gn.forEach(n,(function(n,t){var o=e.node(n);o.order=t+r,gn.forEach(o.selfEdges,(function(n){qn.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:t+ ++r,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){kn.adjust(e)})),n(" position",(function(){In(e)})),n(" positionSelfEdges",(function(){!function(e){gn.forEach(e.nodes(),(function(n){var r=e.node(n);if("selfedge"===r.dummy){var t=e.node(r.e.v),o=t.x+t.width/2,i=t.y,a=r.x-o,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],r.label.x=r.x,r.label.y=r.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){gn.forEach(e.nodes(),(function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),o=e.node(r.borderBottom),i=e.node(gn.last(r.borderLeft)),a=e.node(gn.last(r.borderRight));r.width=Math.abs(a.x-i.x),r.height=Math.abs(o.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}})),gn.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){mn.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){gn.forEach(e.edges(),(function(n){var r=e.edge(n);if(gn.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){kn.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),r=Math.max(r,i+u/2),t=Math.min(t,a-c/2),o=Math.max(o,a+c/2)}gn.forEach(e.nodes(),(function(n){c(e.node(n))})),gn.forEach(e.edges(),(function(n){var r=e.edge(n);gn.has(r,"x")&&c(r)})),n-=a,t-=u,gn.forEach(e.nodes(),(function(r){var o=e.node(r);o.x-=n,o.y-=t})),gn.forEach(e.edges(),(function(r){var o=e.edge(r);gn.forEach(o.points,(function(e){e.x-=n,e.y-=t})),gn.has(o,"x")&&(o.x-=n),gn.has(o,"y")&&(o.y-=t)})),i.width=r-n+a,i.height=o-t+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){gn.forEach(e.edges(),(function(n){var r,t,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(r=o.points[0],t=o.points[o.points.length-1]):(o.points=[],r=a,t=i),o.points.unshift(qn.intersectRect(i,r)),o.points.push(qn.intersectRect(a,t))}))}(e)})),n(" reversePoints",(function(){!function(e){gn.forEach(e.edges(),(function(n){var r=e.edge(n);r.reversed&&r.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){pn.undo(e)}))}(n,r)})),r(" updateInputGraph",(function(){!function(e,n){gn.forEach(e.nodes(),(function(r){var t=e.node(r),o=n.node(r);t&&(t.x=o.x,t.y=o.y,n.children(r).length&&(t.width=o.width,t.height=o.height))})),gn.forEach(e.edges(),(function(r){var t=e.edge(r),o=n.edge(r);t.points=o.points,gn.has(o,"x")&&(t.x=o.x,t.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))};var Rn=["nodesep","edgesep","ranksep","marginx","marginy"],Ln={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Cn=["acyclicer","ranker","rankdir","align"],Pn=["width","height"],Sn={width:0,height:0},Bn=["minlen","weight","width","height","labeloffset"],Gn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},jn=["labelpos"];function On(e,n){return gn.mapValues(gn.pick(e,n),Number)}function An(e){var n={};return gn.forEach(e,(function(e,r){n[r.toLowerCase()]=e})),n}var Vn=o,Dn=b,Fn=t.Graph;var Un={graphlib:t,layout:Tn,debug:{debugOrdering:function(e){var n=Dn.buildLayerMatrix(e),r=new Fn({compound:!0,multigraph:!0}).setGraph({});return Vn.forEach(e.nodes(),(function(n){r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)})),Vn.forEach(e.edges(),(function(e){r.setEdge(e.v,e.w,{},e.name)})),Vn.forEach(n,(function(e,n){var t="layer"+n;r.setNode(t,{rank:"same"}),Vn.reduce(e,(function(e,n){return r.setEdge(e,n,{style:"invis"}),n}))})),r}},util:{time:b.time,notime:b.notime},version:"0.8.5"},zn={exports:{}};function Yn(e,n){var r=e.subgraphs,t=e.nodes,o=e.links,i=e.hierarchy,a=new Un.graphlib.Graph({multigraph:!0,compound:!0,directed:!1!==n.digraph}).setGraph(n).setDefaultNodeLabel((function(){return{}})).setDefaultEdgeLabel((function(){return{}}));r.forEach((function(e){a.setNode(e.id,e)})),t.forEach((function(e){a.setNode(e.id,e)})),o.forEach((function(e){a.setEdge(e.source.id,e.target.id,e,e.id)})),i.forEach((function(e){a.setParent(e.child,e.parent)})),Un.layout(a,{debugTiming:!1});var u=-a.graph().width/2||0,c=-a.graph().height/2;return a.nodes().forEach((function(e){var n=a.node(e);n.x+=u,n.y+=c})),a.edges().forEach((function(e){var n=a.edge(e);n.points=n.points.map((function(e){return[e.x+u,e.y+c]}))})),{subgraphs:r,nodes:t,links:o}}zn.exports=function(){function e(e){var n=typeof e;return null!==e&&("object"===n||"function"===n)}function r(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,a=void 0,u=function(e,n){y[o]=e,y[o+1]=n,2===(o+=2)&&(a?a(b):x())};function c(e){a=e}function s(e){u=e}var f="undefined"!=typeof window?window:void 0,d=f||{},h=d.MutationObserver||d.WebKitMutationObserver,l="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),v="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function g(){return function(){return process.nextTick(b)}}function p(){return void 0!==i?function(){i(b)}:E()}function m(){var e=0,n=new h(b),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function w(){var e=new MessageChannel;return e.port1.onmessage=b,function(){return e.port2.postMessage(0)}}function E(){var e=setTimeout;return function(){return e(b,1)}}var y=new Array(1e3);function b(){for(var e=0;e<o;e+=2)(0,y[e])(y[e+1]),y[e]=void 0,y[e+1]=void 0;o=0}function _(){try{var e=Function("return this")().require("vertx");return i=e.runOnLoop||e.runOnContext,p()}catch(e){return E()}}var x=void 0;function k(e,n){var r=this,t=new this.constructor(q);void 0===t[I]&&J(t);var o=r._state;if(o){var i=arguments[o-1];u((function(){return U(o,t,i,r._result)}))}else D(r,t,e,n);return t}function N(e){var n=this;if(e&&"object"==typeof e&&e.constructor===n)return e;var r=new n(q);return j(r,e),r}x=l?g():h?m():v?w():void 0===f?_():E();var I=Math.random().toString(36).substring(2);function q(){}var M=void 0,T=1,R=2;function L(){return new TypeError("You cannot resolve a promise with itself")}function C(){return new TypeError("A promises callback cannot return that same promise.")}function P(e,n,r,t){try{e.call(n,r,t)}catch(e){return e}}function S(e,n,r){u((function(e){var t=!1,o=P(r,n,(function(r){t||(t=!0,n!==r?j(e,r):A(e,r))}),(function(n){t||(t=!0,V(e,n))}),"Settle: "+(e._label||" unknown promise"));!t&&o&&(t=!0,V(e,o))}),e)}function B(e,n){n._state===T?A(e,n._result):n._state===R?V(e,n._result):D(n,void 0,(function(n){return j(e,n)}),(function(n){return V(e,n)}))}function G(e,n,t){n.constructor===e.constructor&&t===k&&n.constructor.resolve===N?B(e,n):void 0===t?A(e,n):r(t)?S(e,n,t):A(e,n)}function j(n,r){if(n===r)V(n,L());else if(e(r)){var t=void 0;try{t=r.then}catch(e){return void V(n,e)}G(n,r,t)}else A(n,r)}function O(e){e._onerror&&e._onerror(e._result),F(e)}function A(e,n){e._state===M&&(e._result=n,e._state=T,0!==e._subscribers.length&&u(F,e))}function V(e,n){e._state===M&&(e._state=R,e._result=n,u(O,e))}function D(e,n,r,t){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=n,o[i+T]=r,o[i+R]=t,0===i&&e._state&&u(F,e)}function F(e){var n=e._subscribers,r=e._state;if(0!==n.length){for(var t=void 0,o=void 0,i=e._result,a=0;a<n.length;a+=3)t=n[a],o=n[a+r],t?U(r,t,o,i):o(i);e._subscribers.length=0}}function U(e,n,t,o){var i=r(t),a=void 0,u=void 0,c=!0;if(i){try{a=t(o)}catch(e){c=!1,u=e}if(n===a)return void V(n,C())}else a=o;n._state!==M||(i&&c?j(n,a):!1===c?V(n,u):e===T?A(n,a):e===R&&V(n,a))}function z(e,n){try{n((function(n){j(e,n)}),(function(n){V(e,n)}))}catch(n){V(e,n)}}var Y=0;function W(){return Y++}function J(e){e[I]=Y++,e._state=void 0,e._result=void 0,e._subscribers=[]}function K(){return new Error("Array Methods must be provided an Array")}var H=function(){function e(e,n){this._instanceConstructor=e,this.promise=new e(q),this.promise[I]||J(this.promise),t(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&A(this.promise,this._result))):V(this.promise,K())}return e.prototype._enumerate=function(e){for(var n=0;this._state===M&&n<e.length;n++)this._eachEntry(e[n],n)},e.prototype._eachEntry=function(e,n){var r=this._instanceConstructor,t=r.resolve;if(t===N){var o=void 0,i=void 0,a=!1;try{o=e.then}catch(e){a=!0,i=e}if(o===k&&e._state!==M)this._settledAt(e._state,n,e._result);else if("function"!=typeof o)this._remaining--,this._result[n]=e;else if(r===ne){var u=new r(q);a?V(u,i):G(u,e,o),this._willSettleAt(u,n)}else this._willSettleAt(new r((function(n){return n(e)})),n)}else this._willSettleAt(t(e),n)},e.prototype._settledAt=function(e,n,r){var t=this.promise;t._state===M&&(this._remaining--,e===R?V(t,r):this._result[n]=r),0===this._remaining&&A(t,this._result)},e.prototype._willSettleAt=function(e,n){var r=this;D(e,void 0,(function(e){return r._settledAt(T,n,e)}),(function(e){return r._settledAt(R,n,e)}))},e}();function Q(e){return new H(this,e).promise}function X(e){var n=this;return t(e)?new n((function(r,t){for(var o=e.length,i=0;i<o;i++)n.resolve(e[i]).then(r,t)})):new n((function(e,n){return n(new TypeError("You must pass an array to race."))}))}function Z(e){var n=new this(q);return V(n,e),n}function $(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ne=function(){function e(n){this[I]=W(),this._result=this._state=void 0,this._subscribers=[],q!==n&&("function"!=typeof n&&$(),this instanceof e?z(this,n):ee())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var n=this,t=n.constructor;return r(e)?n.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))})):n.then(e,e)},e}();function re(){var e=void 0;if(void 0!==n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;if(r){var t=null;try{t=Object.prototype.toString.call(r.resolve())}catch(e){}if("[object Promise]"===t&&!r.cast)return}e.Promise=ne}return ne.prototype.then=k,ne.all=Q,ne.race=X,ne.resolve=N,ne.reject=Z,ne._setScheduler=c,ne._setAsap=s,ne._asap=u,ne.polyfill=re,ne.Promise=ne,ne}(),zn.exports.polyfill(),self.onmessage=function(e){var n=Yn.apply(void 0,e.data);self.postMessage(n)}}();`;
|
|
39
|
+
const workerCode = `!function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e,n,t){return e(t={path:n,exports:{},require:function(e,n){return r(null==n&&t.path)}},t.exports),t.exports}function r(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var t=function(){this.__data__=[],this.size=0};var o=function(e,n){return e===n||e!=e&&n!=n};var i=function(e,n){for(var r=e.length;r--;)if(o(e[r][0],n))return r;return-1},a=Array.prototype.splice;var u=function(e){var n=this.__data__,r=i(n,e);return!(r<0||(r==n.length-1?n.pop():a.call(n,r,1),--this.size,0))};var c=function(e){var n=this.__data__,r=i(n,e);return r<0?void 0:n[r][1]};var s=function(e){return i(this.__data__,e)>-1};var f=function(e,n){var r=this.__data__,t=i(r,e);return t<0?(++this.size,r.push([e,n])):r[t][1]=n,this};function d(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var t=e[n];this.set(t[0],t[1])}}d.prototype.clear=t,d.prototype.delete=u,d.prototype.get=c,d.prototype.has=s,d.prototype.set=f;var h=d;var v=function(){this.__data__=new h,this.size=0};var l=function(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r};var p=function(e){return this.__data__.get(e)};var g=function(e){return this.__data__.has(e)},y="object"==typeof e&&e&&e.Object===Object&&e,b="object"==typeof self&&self&&self.Object===Object&&self,_=y||b||Function("return this")(),m=_.Symbol,w=Object.prototype,E=w.hasOwnProperty,j=w.toString,k=m?m.toStringTag:void 0;var x=function(e){var n=E.call(e,k),r=e[k];try{e[k]=void 0;var t=!0}catch(e){}var o=j.call(e);return t&&(n?e[k]=r:delete e[k]),o},N=Object.prototype.toString;var O=function(e){return N.call(e)},I="[object Null]",A="[object Undefined]",C=m?m.toStringTag:void 0;var M=function(e){return null==e?void 0===e?A:I:C&&C in Object(e)?x(e):O(e)};var S=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)},P="[object AsyncFunction]",L="[object Function]",T="[object GeneratorFunction]",F="[object Proxy]";var R,z=function(e){if(!S(e))return!1;var n=M(e);return n==L||n==T||n==P||n==F},D=_["__core-js_shared__"],U=(R=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"";var B=function(e){return!!U&&U in e},G=Function.prototype.toString;var V=function(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""},q=/^\\[object .+?Constructor\\]$/,Y=Function.prototype,$=Object.prototype,W=Y.toString,K=$.hasOwnProperty,J=RegExp("^"+W.call(K).replace(/[\\\\^$.*+?()[\\]{}|]/g,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$");var Q=function(e){return!(!S(e)||B(e))&&(z(e)?J:q).test(V(e))};var H=function(e,n){return null==e?void 0:e[n]};var X=function(e,n){var r=H(e,n);return Q(r)?r:void 0},Z=X(_,"Map"),ee=X(Object,"create");var ne=function(){this.__data__=ee?ee(null):{},this.size=0};var re=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n},te="__lodash_hash_undefined__",oe=Object.prototype.hasOwnProperty;var ie=function(e){var n=this.__data__;if(ee){var r=n[e];return r===te?void 0:r}return oe.call(n,e)?n[e]:void 0},ae=Object.prototype.hasOwnProperty;var ue=function(e){var n=this.__data__;return ee?void 0!==n[e]:ae.call(n,e)},ce="__lodash_hash_undefined__";var se=function(e,n){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ee&&void 0===n?ce:n,this};function fe(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var t=e[n];this.set(t[0],t[1])}}fe.prototype.clear=ne,fe.prototype.delete=re,fe.prototype.get=ie,fe.prototype.has=ue,fe.prototype.set=se;var de=fe;var he=function(){this.size=0,this.__data__={hash:new de,map:new(Z||h),string:new de}};var ve=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e};var le=function(e,n){var r=e.__data__;return ve(n)?r["string"==typeof n?"string":"hash"]:r.map};var pe=function(e){var n=le(this,e).delete(e);return this.size-=n?1:0,n};var ge=function(e){return le(this,e).get(e)};var ye=function(e){return le(this,e).has(e)};var be=function(e,n){var r=le(this,e),t=r.size;return r.set(e,n),this.size+=r.size==t?0:1,this};function _e(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var t=e[n];this.set(t[0],t[1])}}_e.prototype.clear=he,_e.prototype.delete=pe,_e.prototype.get=ge,_e.prototype.has=ye,_e.prototype.set=be;var me=_e,we=200;var Ee=function(e,n){var r=this.__data__;if(r instanceof h){var t=r.__data__;if(!Z||t.length<we-1)return t.push([e,n]),this.size=++r.size,this;r=this.__data__=new me(t)}return r.set(e,n),this.size=r.size,this};function je(e){var n=this.__data__=new h(e);this.size=n.size}je.prototype.clear=v,je.prototype.delete=l,je.prototype.get=p,je.prototype.has=g,je.prototype.set=Ee;var ke=je;var xe=function(e,n){for(var r=-1,t=null==e?0:e.length;++r<t&&!1!==n(e[r],r,e););return e},Ne=function(){try{var e=X(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Oe=function(e,n,r){"__proto__"==n&&Ne?Ne(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r},Ie=Object.prototype.hasOwnProperty;var Ae=function(e,n,r){var t=e[n];Ie.call(e,n)&&o(t,r)&&(void 0!==r||n in e)||Oe(e,n,r)};var Ce=function(e,n,r,t){var o=!r;r||(r={});for(var i=-1,a=n.length;++i<a;){var u=n[i],c=t?t(r[u],e[u],u,r,e):void 0;void 0===c&&(c=e[u]),o?Oe(r,u,c):Ae(r,u,c)}return r};var Me=function(e,n){for(var r=-1,t=Array(e);++r<e;)t[r]=n(r);return t};var Se=function(e){return null!=e&&"object"==typeof e},Pe="[object Arguments]";var Le=function(e){return Se(e)&&M(e)==Pe},Te=Object.prototype,Fe=Te.hasOwnProperty,Re=Te.propertyIsEnumerable,ze=Le(function(){return arguments}())?Le:function(e){return Se(e)&&Fe.call(e,"callee")&&!Re.call(e,"callee")},De=Array.isArray;var Ue=function(){return!1},Be=n(function(e,n){var r=n&&!n.nodeType&&n,t=r&&e&&!e.nodeType&&e,o=t&&t.exports===r?_.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ue;e.exports=i}),Ge=9007199254740991,Ve=/^(?:0|[1-9]\\d*)$/;var qe=function(e,n){var r=typeof e;return!!(n=null==n?Ge:n)&&("number"==r||"symbol"!=r&&Ve.test(e))&&e>-1&&e%1==0&&e<n},Ye=9007199254740991;var $e=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ye},We={};We["[object Float32Array]"]=We["[object Float64Array]"]=We["[object Int8Array]"]=We["[object Int16Array]"]=We["[object Int32Array]"]=We["[object Uint8Array]"]=We["[object Uint8ClampedArray]"]=We["[object Uint16Array]"]=We["[object Uint32Array]"]=!0,We["[object Arguments]"]=We["[object Array]"]=We["[object ArrayBuffer]"]=We["[object Boolean]"]=We["[object DataView]"]=We["[object Date]"]=We["[object Error]"]=We["[object Function]"]=We["[object Map]"]=We["[object Number]"]=We["[object Object]"]=We["[object RegExp]"]=We["[object Set]"]=We["[object String]"]=We["[object WeakMap]"]=!1;var Ke=function(e){return Se(e)&&$e(e.length)&&!!We[M(e)]};var Je=function(e){return function(n){return e(n)}},Qe=n(function(e,n){var r=n&&!n.nodeType&&n,t=r&&e&&!e.nodeType&&e,o=t&&t.exports===r&&y.process,i=function(){try{var e=t&&t.require&&t.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=i}),He=Qe&&Qe.isTypedArray,Xe=He?Je(He):Ke,Ze=Object.prototype.hasOwnProperty;var en=function(e,n){var r=De(e),t=!r&&ze(e),o=!r&&!t&&Be(e),i=!r&&!t&&!o&&Xe(e),a=r||t||o||i,u=a?Me(e.length,String):[],c=u.length;for(var s in e)!n&&!Ze.call(e,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||qe(s,c))||u.push(s);return u},nn=Object.prototype;var rn=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||nn)};var tn=function(e,n){return function(r){return e(n(r))}},on=tn(Object.keys,Object),an=Object.prototype.hasOwnProperty;var un=function(e){if(!rn(e))return on(e);var n=[];for(var r in Object(e))an.call(e,r)&&"constructor"!=r&&n.push(r);return n};var cn=function(e){return null!=e&&$e(e.length)&&!z(e)};var sn=function(e){return cn(e)?en(e):un(e)};var fn=function(e,n){return e&&Ce(n,sn(n),e)};var dn=function(e){var n=[];if(null!=e)for(var r in Object(e))n.push(r);return n},hn=Object.prototype.hasOwnProperty;var vn=function(e){if(!S(e))return dn(e);var n=rn(e),r=[];for(var t in e)("constructor"!=t||!n&&hn.call(e,t))&&r.push(t);return r};var ln=function(e){return cn(e)?en(e,!0):vn(e)};var pn=function(e,n){return e&&Ce(n,ln(n),e)},gn=n(function(e,n){var r=n&&!n.nodeType&&n,t=r&&e&&!e.nodeType&&e,o=t&&t.exports===r?_.Buffer:void 0,i=o?o.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var r=e.length,t=i?i(r):new e.constructor(r);return e.copy(t),t}});var yn=function(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r<t;)n[r]=e[r];return n};var bn=function(e,n){for(var r=-1,t=null==e?0:e.length,o=0,i=[];++r<t;){var a=e[r];n(a,r,e)&&(i[o++]=a)}return i};var _n=function(){return[]},mn=Object.prototype.propertyIsEnumerable,wn=Object.getOwnPropertySymbols,En=wn?function(e){return null==e?[]:(e=Object(e),bn(wn(e),function(n){return mn.call(e,n)}))}:_n;var jn=function(e,n){return Ce(e,En(e),n)};var kn=function(e,n){for(var r=-1,t=n.length,o=e.length;++r<t;)e[o+r]=n[r];return e},xn=tn(Object.getPrototypeOf,Object),Nn=Object.getOwnPropertySymbols?function(e){for(var n=[];e;)kn(n,En(e)),e=xn(e);return n}:_n;var On=function(e,n){return Ce(e,Nn(e),n)};var In=function(e,n,r){var t=n(e);return De(e)?t:kn(t,r(e))};var An=function(e){return In(e,sn,En)};var Cn=function(e){return In(e,ln,Nn)},Mn=X(_,"DataView"),Sn=X(_,"Promise"),Pn=X(_,"Set"),Ln=X(_,"WeakMap"),Tn=V(Mn),Fn=V(Z),Rn=V(Sn),zn=V(Pn),Dn=V(Ln),Un=M;(Mn&&"[object DataView]"!=Un(new Mn(new ArrayBuffer(1)))||Z&&"[object Map]"!=Un(new Z)||Sn&&"[object Promise]"!=Un(Sn.resolve())||Pn&&"[object Set]"!=Un(new Pn)||Ln&&"[object WeakMap]"!=Un(new Ln))&&(Un=function(e){var n=M(e),r="[object Object]"==n?e.constructor:void 0,t=r?V(r):"";if(t)switch(t){case Tn:return"[object DataView]";case Fn:return"[object Map]";case Rn:return"[object Promise]";case zn:return"[object Set]";case Dn:return"[object WeakMap]"}return n});var Bn=Un,Gn=Object.prototype.hasOwnProperty;var Vn=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&Gn.call(e,"index")&&(r.index=e.index,r.input=e.input),r},qn=_.Uint8Array;var Yn=function(e){var n=new e.constructor(e.byteLength);return new qn(n).set(new qn(e)),n};var $n=function(e,n){var r=n?Yn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},Wn=/\\w*$/;var Kn=function(e){var n=new e.constructor(e.source,Wn.exec(e));return n.lastIndex=e.lastIndex,n},Jn=m?m.prototype:void 0,Qn=Jn?Jn.valueOf:void 0;var Hn=function(e){return Qn?Object(Qn.call(e)):{}};var Xn=function(e,n){var r=n?Yn(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},Zn="[object Boolean]",er="[object Date]",nr="[object Map]",rr="[object Number]",tr="[object RegExp]",or="[object Set]",ir="[object String]",ar="[object Symbol]",ur="[object ArrayBuffer]",cr="[object DataView]",sr="[object Float32Array]",fr="[object Float64Array]",dr="[object Int8Array]",hr="[object Int16Array]",vr="[object Int32Array]",lr="[object Uint8Array]",pr="[object Uint8ClampedArray]",gr="[object Uint16Array]",yr="[object Uint32Array]";var br=function(e,n,r){var t=e.constructor;switch(n){case ur:return Yn(e);case Zn:case er:return new t(+e);case cr:return $n(e,r);case sr:case fr:case dr:case hr:case vr:case lr:case pr:case gr:case yr:return Xn(e,r);case nr:return new t;case rr:case ir:return new t(e);case tr:return Kn(e);case or:return new t;case ar:return Hn(e)}},_r=Object.create,mr=function(){function e(){}return function(n){if(!S(n))return{};if(_r)return _r(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}}();var wr=function(e){return"function"!=typeof e.constructor||rn(e)?{}:mr(xn(e))},Er="[object Map]";var jr=function(e){return Se(e)&&Bn(e)==Er},kr=Qe&&Qe.isMap,xr=kr?Je(kr):jr,Nr="[object Set]";var Or=function(e){return Se(e)&&Bn(e)==Nr},Ir=Qe&&Qe.isSet,Ar=Ir?Je(Ir):Or,Cr=1,Mr=2,Sr=4,Pr="[object Arguments]",Lr="[object Function]",Tr="[object GeneratorFunction]",Fr="[object Object]",Rr={};Rr[Pr]=Rr["[object Array]"]=Rr["[object ArrayBuffer]"]=Rr["[object DataView]"]=Rr["[object Boolean]"]=Rr["[object Date]"]=Rr["[object Float32Array]"]=Rr["[object Float64Array]"]=Rr["[object Int8Array]"]=Rr["[object Int16Array]"]=Rr["[object Int32Array]"]=Rr["[object Map]"]=Rr["[object Number]"]=Rr[Fr]=Rr["[object RegExp]"]=Rr["[object Set]"]=Rr["[object String]"]=Rr["[object Symbol]"]=Rr["[object Uint8Array]"]=Rr["[object Uint8ClampedArray]"]=Rr["[object Uint16Array]"]=Rr["[object Uint32Array]"]=!0,Rr["[object Error]"]=Rr[Lr]=Rr["[object WeakMap]"]=!1;var zr=function e(n,r,t,o,i,a){var u,c=r&Cr,s=r&Mr,f=r&Sr;if(t&&(u=i?t(n,o,i,a):t(n)),void 0!==u)return u;if(!S(n))return n;var d=De(n);if(d){if(u=Vn(n),!c)return yn(n,u)}else{var h=Bn(n),v=h==Lr||h==Tr;if(Be(n))return gn(n,c);if(h==Fr||h==Pr||v&&!i){if(u=s||v?{}:wr(n),!c)return s?On(n,pn(u,n)):jn(n,fn(u,n))}else{if(!Rr[h])return i?n:{};u=br(n,h,c)}}a||(a=new ke);var l=a.get(n);if(l)return l;a.set(n,u),Ar(n)?n.forEach(function(o){u.add(e(o,r,t,o,n,a))}):xr(n)&&n.forEach(function(o,i){u.set(i,e(o,r,t,i,n,a))});var p=d?void 0:(f?s?Cn:An:s?ln:sn)(n);return xe(p||n,function(o,i){p&&(o=n[i=o]),Ae(u,i,e(o,r,t,i,n,a))}),u},Dr=4;var Ur=function(e){return zr(e,Dr)};var Br=function(e){return function(){return e}};var Gr=function(e){return function(n,r,t){for(var o=-1,i=Object(n),a=t(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===r(i[c],c,i))break}return n}}();var Vr=function(e,n){return e&&Gr(e,n,sn)};var qr=function(e,n){return function(r,t){if(null==r)return r;if(!cn(r))return e(r,t);for(var o=r.length,i=n?o:-1,a=Object(r);(n?i--:++i<o)&&!1!==t(a[i],i,a););return r}}(Vr);var Yr=function(e){return e};var $r=function(e){return"function"==typeof e?e:Yr};var Wr=function(e,n){return(De(e)?xe:qr)(e,$r(n))},Kr=Wr;var Jr=function(e,n){var r=[];return qr(e,function(e,t,o){n(e,t,o)&&r.push(e)}),r},Qr="__lodash_hash_undefined__";var Hr=function(e){return this.__data__.set(e,Qr),this};var Xr=function(e){return this.__data__.has(e)};function Zr(e){var n=-1,r=null==e?0:e.length;for(this.__data__=new me;++n<r;)this.add(e[n])}Zr.prototype.add=Zr.prototype.push=Hr,Zr.prototype.has=Xr;var et=Zr;var nt=function(e,n){for(var r=-1,t=null==e?0:e.length;++r<t;)if(n(e[r],r,e))return!0;return!1};var rt=function(e,n){return e.has(n)},tt=1,ot=2;var it=function(e,n,r,t,o,i){var a=r&tt,u=e.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(e),f=i.get(n);if(s&&f)return s==n&&f==e;var d=-1,h=!0,v=r&ot?new et:void 0;for(i.set(e,n),i.set(n,e);++d<u;){var l=e[d],p=n[d];if(t)var g=a?t(p,l,d,n,e,i):t(l,p,d,e,n,i);if(void 0!==g){if(g)continue;h=!1;break}if(v){if(!nt(n,function(e,n){if(!rt(v,n)&&(l===e||o(l,e,r,t,i)))return v.push(n)})){h=!1;break}}else if(l!==p&&!o(l,p,r,t,i)){h=!1;break}}return i.delete(e),i.delete(n),h};var at=function(e){var n=-1,r=Array(e.size);return e.forEach(function(e,t){r[++n]=[t,e]}),r};var ut=function(e){var n=-1,r=Array(e.size);return e.forEach(function(e){r[++n]=e}),r},ct=1,st=2,ft="[object Boolean]",dt="[object Date]",ht="[object Error]",vt="[object Map]",lt="[object Number]",pt="[object RegExp]",gt="[object Set]",yt="[object String]",bt="[object Symbol]",_t="[object ArrayBuffer]",mt="[object DataView]",wt=m?m.prototype:void 0,Et=wt?wt.valueOf:void 0;var jt=function(e,n,r,t,i,a,u){switch(r){case mt:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case _t:return!(e.byteLength!=n.byteLength||!a(new qn(e),new qn(n)));case ft:case dt:case lt:return o(+e,+n);case ht:return e.name==n.name&&e.message==n.message;case pt:case yt:return e==n+"";case vt:var c=at;case gt:var s=t&ct;if(c||(c=ut),e.size!=n.size&&!s)return!1;var f=u.get(e);if(f)return f==n;t|=st,u.set(e,n);var d=it(c(e),c(n),t,i,a,u);return u.delete(e),d;case bt:if(Et)return Et.call(e)==Et.call(n)}return!1},kt=1,xt=Object.prototype.hasOwnProperty;var Nt=function(e,n,r,t,o,i){var a=r&kt,u=An(e),c=u.length;if(c!=An(n).length&&!a)return!1;for(var s=c;s--;){var f=u[s];if(!(a?f in n:xt.call(n,f)))return!1}var d=i.get(e),h=i.get(n);if(d&&h)return d==n&&h==e;var v=!0;i.set(e,n),i.set(n,e);for(var l=a;++s<c;){var p=e[f=u[s]],g=n[f];if(t)var y=a?t(g,p,f,n,e,i):t(p,g,f,e,n,i);if(!(void 0===y?p===g||o(p,g,r,t,i):y)){v=!1;break}l||(l="constructor"==f)}if(v&&!l){var b=e.constructor,_=n.constructor;b!=_&&"constructor"in e&&"constructor"in n&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(v=!1)}return i.delete(e),i.delete(n),v},Ot=1,It="[object Arguments]",At="[object Array]",Ct="[object Object]",Mt=Object.prototype.hasOwnProperty;var St=function(e,n,r,t,o,i){var a=De(e),u=De(n),c=a?At:Bn(e),s=u?At:Bn(n),f=(c=c==It?Ct:c)==Ct,d=(s=s==It?Ct:s)==Ct,h=c==s;if(h&&Be(e)){if(!Be(n))return!1;a=!0,f=!1}if(h&&!f)return i||(i=new ke),a||Xe(e)?it(e,n,r,t,o,i):jt(e,n,c,r,t,o,i);if(!(r&Ot)){var v=f&&Mt.call(e,"__wrapped__"),l=d&&Mt.call(n,"__wrapped__");if(v||l){var p=v?e.value():e,g=l?n.value():n;return i||(i=new ke),o(p,g,r,t,i)}}return!!h&&(i||(i=new ke),Nt(e,n,r,t,o,i))};var Pt=function e(n,r,t,o,i){return n===r||(null==n||null==r||!Se(n)&&!Se(r)?n!=n&&r!=r:St(n,r,t,o,e,i))},Lt=1,Tt=2;var Ft=function(e,n,r,t){var o=r.length,i=o,a=!t;if(null==e)return!i;for(e=Object(e);o--;){var u=r[o];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<i;){var c=(u=r[o])[0],s=e[c],f=u[1];if(a&&u[2]){if(void 0===s&&!(c in e))return!1}else{var d=new ke;if(t)var h=t(s,f,c,e,n,d);if(!(void 0===h?Pt(f,s,Lt|Tt,t,d):h))return!1}}return!0};var Rt=function(e){return e==e&&!S(e)};var zt=function(e){for(var n=sn(e),r=n.length;r--;){var t=n[r],o=e[t];n[r]=[t,o,Rt(o)]}return n};var Dt=function(e,n){return function(r){return null!=r&&r[e]===n&&(void 0!==n||e in Object(r))}};var Ut=function(e){var n=zt(e);return 1==n.length&&n[0][2]?Dt(n[0][0],n[0][1]):function(r){return r===e||Ft(r,e,n)}},Bt="[object Symbol]";var Gt=function(e){return"symbol"==typeof e||Se(e)&&M(e)==Bt},Vt=/\\.|\\[(?:[^[\\]]*|(["'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,qt=/^\\w*$/;var Yt=function(e,n){if(De(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Gt(e))||qt.test(e)||!Vt.test(e)||null!=n&&e in Object(n)},$t="Expected a function";function Wt(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError($t);var r=function(){var t=arguments,o=n?n.apply(this,t):t[0],i=r.cache;if(i.has(o))return i.get(o);var a=e.apply(this,t);return r.cache=i.set(o,a)||i,a};return r.cache=new(Wt.Cache||me),r}Wt.Cache=me;var Kt=Wt,Jt=500;var Qt=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Ht=/\\\\(\\\\)?/g,Xt=function(e){var n=Kt(e,function(e){return r.size===Jt&&r.clear(),e}),r=n.cache;return n}(function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(Qt,function(e,r,t,o){n.push(t?o.replace(Ht,"$1"):r||e)}),n});var Zt=function(e,n){for(var r=-1,t=null==e?0:e.length,o=Array(t);++r<t;)o[r]=n(e[r],r,e);return o},eo=1/0,no=m?m.prototype:void 0,ro=no?no.toString:void 0;var to=function e(n){if("string"==typeof n)return n;if(De(n))return Zt(n,e)+"";if(Gt(n))return ro?ro.call(n):"";var r=n+"";return"0"==r&&1/n==-eo?"-0":r};var oo=function(e){return null==e?"":to(e)};var io=function(e,n){return De(e)?e:Yt(e,n)?[e]:Xt(oo(e))},ao=1/0;var uo=function(e){if("string"==typeof e||Gt(e))return e;var n=e+"";return"0"==n&&1/e==-ao?"-0":n};var co=function(e,n){for(var r=0,t=(n=io(n,e)).length;null!=e&&r<t;)e=e[uo(n[r++])];return r&&r==t?e:void 0};var so=function(e,n,r){var t=null==e?void 0:co(e,n);return void 0===t?r:t};var fo=function(e,n){return null!=e&&n in Object(e)};var ho=function(e,n,r){for(var t=-1,o=(n=io(n,e)).length,i=!1;++t<o;){var a=uo(n[t]);if(!(i=null!=e&&r(e,a)))break;e=e[a]}return i||++t!=o?i:!!(o=null==e?0:e.length)&&$e(o)&&qe(a,o)&&(De(e)||ze(e))};var vo=function(e,n){return null!=e&&ho(e,n,fo)},lo=1,po=2;var go=function(e,n){return Yt(e)&&Rt(n)?Dt(uo(e),n):function(r){var t=so(r,e);return void 0===t&&t===n?vo(r,e):Pt(n,t,lo|po)}};var yo=function(e){return function(n){return null==n?void 0:n[e]}};var bo=function(e){return function(n){return co(n,e)}};var _o=function(e){return Yt(e)?yo(uo(e)):bo(e)};var mo=function(e){return"function"==typeof e?e:null==e?Yr:"object"==typeof e?De(e)?go(e[0],e[1]):Ut(e):_o(e)};var wo=function(e,n){return(De(e)?bn:Jr)(e,mo(n))},Eo=Object.prototype.hasOwnProperty;var jo=function(e,n){return null!=e&&Eo.call(e,n)};var ko=function(e,n){return null!=e&&ho(e,n,jo)},xo="[object Map]",No="[object Set]",Oo=Object.prototype.hasOwnProperty;var Io=function(e){if(null==e)return!0;if(cn(e)&&(De(e)||"string"==typeof e||"function"==typeof e.splice||Be(e)||Xe(e)||ze(e)))return!e.length;var n=Bn(e);if(n==xo||n==No)return!e.size;if(rn(e))return!un(e).length;for(var r in e)if(Oo.call(e,r))return!1;return!0};var Ao=function(e){return void 0===e};var Co=function(e,n){var r=-1,t=cn(e)?Array(e.length):[];return qr(e,function(e,o,i){t[++r]=n(e,o,i)}),t};var Mo=function(e,n){return(De(e)?Zt:Co)(e,mo(n))};var So=function(e,n,r,t){var o=-1,i=null==e?0:e.length;for(t&&i&&(r=e[++o]);++o<i;)r=n(r,e[o],o,e);return r};var Po=function(e,n,r,t,o){return o(e,function(e,o,i){r=t?(t=!1,e):n(r,e,o,i)}),r};var Lo=function(e,n,r){var t=De(e)?So:Po,o=arguments.length<3;return t(e,mo(n),r,o,qr)},To="[object String]";var Fo=function(e){return"string"==typeof e||!De(e)&&Se(e)&&M(e)==To},Ro=yo("length"),zo=RegExp("[\\\\u200d\\\\ud800-\\\\udfff\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff\\\\ufe0e\\\\ufe0f]");var Do=function(e){return zo.test(e)},Uo="[\\\\ud800-\\\\udfff]",Bo="[\\\\u0300-\\\\u036f\\\\ufe20-\\\\ufe2f\\\\u20d0-\\\\u20ff]",Go="\\\\ud83c[\\\\udffb-\\\\udfff]",Vo="[^\\\\ud800-\\\\udfff]",qo="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Yo="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",$o="(?:"+Bo+"|"+Go+")"+"?",Wo="[\\\\ufe0e\\\\ufe0f]?"+$o+("(?:\\\\u200d(?:"+[Vo,qo,Yo].join("|")+")[\\\\ufe0e\\\\ufe0f]?"+$o+")*"),Ko="(?:"+[Vo+Bo+"?",Bo,qo,Yo,Uo].join("|")+")",Jo=RegExp(Go+"(?="+Go+")|"+Ko+Wo,"g");var Qo=function(e){for(var n=Jo.lastIndex=0;Jo.test(e);)++n;return n};var Ho=function(e){return Do(e)?Qo(e):Ro(e)},Xo="[object Map]",Zo="[object Set]";var ei=function(e){if(null==e)return 0;if(cn(e))return Fo(e)?Ho(e):e.length;var n=Bn(e);return n==Xo||n==Zo?e.size:un(e).length};var ni=function(e,n,r){var t=De(e),o=t||Be(e)||Xe(e);if(n=mo(n),null==r){var i=e&&e.constructor;r=o?t?new i:[]:S(e)&&z(i)?mr(xn(e)):{}}return(o?xe:Vr)(e,function(e,t,o){return n(r,e,t,o)}),r},ri=m?m.isConcatSpreadable:void 0;var ti=function(e){return De(e)||ze(e)||!!(ri&&e&&e[ri])};var oi=function e(n,r,t,o,i){var a=-1,u=n.length;for(t||(t=ti),i||(i=[]);++a<u;){var c=n[a];r>0&&t(c)?r>1?e(c,r-1,t,o,i):kn(i,c):o||(i[i.length]=c)}return i};var ii=function(e,n,r){switch(r.length){case 0:return e.call(n);case 1:return e.call(n,r[0]);case 2:return e.call(n,r[0],r[1]);case 3:return e.call(n,r[0],r[1],r[2])}return e.apply(n,r)},ai=Math.max;var ui=function(e,n,r){return n=ai(void 0===n?e.length-1:n,0),function(){for(var t=arguments,o=-1,i=ai(t.length-n,0),a=Array(i);++o<i;)a[o]=t[n+o];o=-1;for(var u=Array(n+1);++o<n;)u[o]=t[o];return u[n]=r(a),ii(e,this,u)}},ci=Ne?function(e,n){return Ne(e,"toString",{configurable:!0,enumerable:!1,value:Br(n),writable:!0})}:Yr,si=800,fi=16,di=Date.now;var hi=function(e){var n=0,r=0;return function(){var t=di(),o=fi-(t-r);if(r=t,o>0){if(++n>=si)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}(ci);var vi=function(e,n){return hi(ui(e,n,Yr),e+"")};var li=function(e,n,r,t){for(var o=e.length,i=r+(t?1:-1);t?i--:++i<o;)if(n(e[i],i,e))return i;return-1};var pi=function(e){return e!=e};var gi=function(e,n,r){for(var t=r-1,o=e.length;++t<o;)if(e[t]===n)return t;return-1};var yi=function(e,n,r){return n==n?gi(e,n,r):li(e,pi,r)};var bi=function(e,n){return!(null==e||!e.length)&&yi(e,n,0)>-1};var _i=function(e,n,r){for(var t=-1,o=null==e?0:e.length;++t<o;)if(r(n,e[t]))return!0;return!1};var mi=function(){},wi=Pn&&1/ut(new Pn([,-0]))[1]==1/0?function(e){return new Pn(e)}:mi,Ei=200;var ji=function(e,n,r){var t=-1,o=bi,i=e.length,a=!0,u=[],c=u;if(r)a=!1,o=_i;else if(i>=Ei){var s=n?null:wi(e);if(s)return ut(s);a=!1,o=rt,c=new et}else c=n?[]:u;e:for(;++t<i;){var f=e[t],d=n?n(f):f;if(f=r||0!==f?f:0,a&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;n&&c.push(d),u.push(f)}else o(c,d,r)||(c!==u&&c.push(d),u.push(f))}return u};var ki=function(e){return Se(e)&&cn(e)},xi=vi(function(e){return ji(oi(e,1,ki,!0))});var Ni=function(e,n){return Zt(n,function(n){return e[n]})};var Oi,Ii=function(e){return null==e?[]:Ni(e,sn(e))};try{Oi={clone:Ur,constant:Br,each:Kr,filter:wo,has:ko,isArray:De,isEmpty:Io,isFunction:z,isUndefined:Ao,keys:sn,map:Mo,reduce:Lo,size:ei,transform:ni,union:xi,values:Ii}}catch(e){}Oi||(Oi=window._);var Ai=Oi,Ci=Li,Mi="\\0",Si="\\0",Pi="";function Li(e){this._isDirected=!Ai.has(e,"directed")||e.directed,this._isMultigraph=!!Ai.has(e,"multigraph")&&e.multigraph,this._isCompound=!!Ai.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=Ai.constant(void 0),this._defaultEdgeLabelFn=Ai.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Si]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function Ti(e,n){e[n]?e[n]++:e[n]=1}function Fi(e,n){--e[n]||delete e[n]}function Ri(e,n,r,t){var o=""+n,i=""+r;if(!e&&o>i){var a=o;o=i,i=a}return o+Pi+i+Pi+(Ai.isUndefined(t)?Mi:t)}function zi(e,n){return Ri(e,n.v,n.w,n.name)}Li.prototype._nodeCount=0,Li.prototype._edgeCount=0,Li.prototype.isDirected=function(){return this._isDirected},Li.prototype.isMultigraph=function(){return this._isMultigraph},Li.prototype.isCompound=function(){return this._isCompound},Li.prototype.setGraph=function(e){return this._label=e,this},Li.prototype.graph=function(){return this._label},Li.prototype.setDefaultNodeLabel=function(e){return Ai.isFunction(e)||(e=Ai.constant(e)),this._defaultNodeLabelFn=e,this},Li.prototype.nodeCount=function(){return this._nodeCount},Li.prototype.nodes=function(){return Ai.keys(this._nodes)},Li.prototype.sources=function(){var e=this;return Ai.filter(this.nodes(),function(n){return Ai.isEmpty(e._in[n])})},Li.prototype.sinks=function(){var e=this;return Ai.filter(this.nodes(),function(n){return Ai.isEmpty(e._out[n])})},Li.prototype.setNodes=function(e,n){var r=arguments,t=this;return Ai.each(e,function(e){r.length>1?t.setNode(e,n):t.setNode(e)}),this},Li.prototype.setNode=function(e,n){return Ai.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=n),this):(this._nodes[e]=arguments.length>1?n:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Si,this._children[e]={},this._children[Si][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},Li.prototype.node=function(e){return this._nodes[e]},Li.prototype.hasNode=function(e){return Ai.has(this._nodes,e)},Li.prototype.removeNode=function(e){var n=this;if(Ai.has(this._nodes,e)){var r=function(e){n.removeEdge(n._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],Ai.each(this.children(e),function(e){n.setParent(e)}),delete this._children[e]),Ai.each(Ai.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],Ai.each(Ai.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},Li.prototype.setParent=function(e,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Ai.isUndefined(n))n=Si;else{for(var r=n+="";!Ai.isUndefined(r);r=this.parent(r))if(r===e)throw new Error("Setting "+n+" as parent of "+e+" would create a cycle");this.setNode(n)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=n,this._children[n][e]=!0,this},Li.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},Li.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==Si)return n}},Li.prototype.children=function(e){if(Ai.isUndefined(e)&&(e=Si),this._isCompound){var n=this._children[e];if(n)return Ai.keys(n)}else{if(e===Si)return this.nodes();if(this.hasNode(e))return[]}},Li.prototype.predecessors=function(e){var n=this._preds[e];if(n)return Ai.keys(n)},Li.prototype.successors=function(e){var n=this._sucs[e];if(n)return Ai.keys(n)},Li.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return Ai.union(n,this.successors(e))},Li.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},Li.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Ai.each(this._nodes,function(r,t){e(t)&&n.setNode(t,r)}),Ai.each(this._edgeObjs,function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,r.edge(e))});var t={};return this._isCompound&&Ai.each(n.nodes(),function(e){n.setParent(e,function e(o){var i=r.parent(o);return void 0===i||n.hasNode(i)?(t[o]=i,i):i in t?t[i]:e(i)}(e))}),n},Li.prototype.setDefaultEdgeLabel=function(e){return Ai.isFunction(e)||(e=Ai.constant(e)),this._defaultEdgeLabelFn=e,this},Li.prototype.edgeCount=function(){return this._edgeCount},Li.prototype.edges=function(){return Ai.values(this._edgeObjs)},Li.prototype.setPath=function(e,n){var r=this,t=arguments;return Ai.reduce(e,function(e,o){return t.length>1?r.setEdge(e,o,n):r.setEdge(e,o),o}),this},Li.prototype.setEdge=function(){var e,n,r,t,o=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,n=i.w,r=i.name,2===arguments.length&&(t=arguments[1],o=!0)):(e=i,n=arguments[1],r=arguments[3],arguments.length>2&&(t=arguments[2],o=!0)),e=""+e,n=""+n,Ai.isUndefined(r)||(r=""+r);var a=Ri(this._isDirected,e,n,r);if(Ai.has(this._edgeLabels,a))return o&&(this._edgeLabels[a]=t),this;if(!Ai.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[a]=o?t:this._defaultEdgeLabelFn(e,n,r);var u=function(e,n,r,t){var o=""+n,i=""+r;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};t&&(u.name=t);return u}(this._isDirected,e,n,r);return e=u.v,n=u.w,Object.freeze(u),this._edgeObjs[a]=u,Ti(this._preds[n],e),Ti(this._sucs[e],n),this._in[n][a]=u,this._out[e][a]=u,this._edgeCount++,this},Li.prototype.edge=function(e,n,r){var t=1===arguments.length?zi(this._isDirected,arguments[0]):Ri(this._isDirected,e,n,r);return this._edgeLabels[t]},Li.prototype.hasEdge=function(e,n,r){var t=1===arguments.length?zi(this._isDirected,arguments[0]):Ri(this._isDirected,e,n,r);return Ai.has(this._edgeLabels,t)},Li.prototype.removeEdge=function(e,n,r){var t=1===arguments.length?zi(this._isDirected,arguments[0]):Ri(this._isDirected,e,n,r),o=this._edgeObjs[t];return o&&(e=o.v,n=o.w,delete this._edgeLabels[t],delete this._edgeObjs[t],Fi(this._preds[n],e),Fi(this._sucs[e],n),delete this._in[n][t],delete this._out[e][t],this._edgeCount--),this},Li.prototype.inEdges=function(e,n){var r=this._in[e];if(r){var t=Ai.values(r);return n?Ai.filter(t,function(e){return e.v===n}):t}},Li.prototype.outEdges=function(e,n){var r=this._out[e];if(r){var t=Ai.values(r);return n?Ai.filter(t,function(e){return e.w===n}):t}},Li.prototype.nodeEdges=function(e,n){var r=this.inEdges(e,n);if(r)return r.concat(this.outEdges(e,n))};var Di={Graph:Ci,version:"2.1.8"},Ui={write:function(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Bi(e),edges:Gi(e)};Ai.isUndefined(e.graph())||(n.value=Ai.clone(e.graph()));return n},read:function(e){var n=new Ci(e.options).setGraph(e.value);return Ai.each(e.nodes,function(e){n.setNode(e.v,e.value),e.parent&&n.setParent(e.v,e.parent)}),Ai.each(e.edges,function(e){n.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),n}};function Bi(e){return Ai.map(e.nodes(),function(n){var r=e.node(n),t=e.parent(n),o={v:n};return Ai.isUndefined(r)||(o.value=r),Ai.isUndefined(t)||(o.parent=t),o})}function Gi(e){return Ai.map(e.edges(),function(n){var r=e.edge(n),t={v:n.v,w:n.w};return Ai.isUndefined(n.name)||(t.name=n.name),Ai.isUndefined(r)||(t.value=r),t})}var Vi=function(e){var n,r={},t=[];function o(t){Ai.has(r,t)||(r[t]=!0,n.push(t),Ai.each(e.successors(t),o),Ai.each(e.predecessors(t),o))}return Ai.each(e.nodes(),function(e){n=[],o(e),n.length&&t.push(n)}),t};var qi=Yi;function Yi(){this._arr=[],this._keyIndices={}}Yi.prototype.size=function(){return this._arr.length},Yi.prototype.keys=function(){return this._arr.map(function(e){return e.key})},Yi.prototype.has=function(e){return Ai.has(this._keyIndices,e)},Yi.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},Yi.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Yi.prototype.add=function(e,n){var r=this._keyIndices;if(e=String(e),!Ai.has(r,e)){var t=this._arr,o=t.length;return r[e]=o,t.push({key:e,priority:n}),this._decrease(o),!0}return!1},Yi.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},Yi.prototype.decrease=function(e,n){var r=this._keyIndices[e];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)},Yi.prototype._heapify=function(e){var n=this._arr,r=2*e,t=r+1,o=e;r<n.length&&(o=n[r].priority<n[o].priority?r:o,t<n.length&&(o=n[t].priority<n[o].priority?t:o),o!==e&&(this._swap(e,o),this._heapify(o)))},Yi.prototype._decrease=function(e){for(var n,r=this._arr,t=r[e].priority;0!==e&&!(r[n=e>>1].priority<t);)this._swap(e,n),e=n},Yi.prototype._swap=function(e,n){var r=this._arr,t=this._keyIndices,o=r[e],i=r[n];r[e]=i,r[n]=o,t[i.key]=e,t[o.key]=n};var $i=function(e,n,r,t){return function(e,n,r,t){var o,i,a={},u=new qi,c=function(e){var n=e.v!==o?e.v:e.w,t=a[n],c=r(e),s=i.distance+c;if(c<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+c);s<t.distance&&(t.distance=s,t.predecessor=o,u.decrease(n,s))};e.nodes().forEach(function(e){var r=e===n?0:Number.POSITIVE_INFINITY;a[e]={distance:r},u.add(e,r)});for(;u.size()>0&&(o=u.removeMin(),(i=a[o]).distance!==Number.POSITIVE_INFINITY);)t(o).forEach(c);return a}(e,String(n),r||Wi,t||function(n){return e.outEdges(n)})},Wi=Ai.constant(1);var Ki=function(e,n,r){return Ai.transform(e.nodes(),function(t,o){t[o]=$i(e,o,n,r)},{})};var Ji=function(e){var n=0,r=[],t={},o=[];return e.nodes().forEach(function(i){Ai.has(t,i)||function i(a){var u=t[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),e.successors(a).forEach(function(e){Ai.has(t,e)?t[e].onStack&&(u.lowlink=Math.min(u.lowlink,t[e].index)):(i(e),u.lowlink=Math.min(u.lowlink,t[e].lowlink))}),u.lowlink===u.index){var c,s=[];do{c=r.pop(),t[c].onStack=!1,s.push(c)}while(a!==c);o.push(s)}}(i)}),o};var Qi=function(e){return Ai.filter(Ji(e),function(n){return n.length>1||1===n.length&&e.hasEdge(n[0],n[0])})};var Hi=function(e,n,r){return function(e,n,r){var t={},o=e.nodes();return o.forEach(function(e){t[e]={},t[e][e]={distance:0},o.forEach(function(n){e!==n&&(t[e][n]={distance:Number.POSITIVE_INFINITY})}),r(e).forEach(function(r){var o=r.v===e?r.w:r.v,i=n(r);t[e][o]={distance:i,predecessor:e}})}),o.forEach(function(e){var n=t[e];o.forEach(function(r){var i=t[r];o.forEach(function(r){var t=i[e],o=n[r],a=i[r],u=t.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)})})}),t}(e,n||Xi,r||function(n){return e.outEdges(n)})},Xi=Ai.constant(1);var Zi=ea;function ea(e){var n={},r={},t=[];if(Ai.each(e.sinks(),function o(i){if(Ai.has(r,i))throw new na;Ai.has(n,i)||(r[i]=!0,n[i]=!0,Ai.each(e.predecessors(i),o),delete r[i],t.push(i))}),Ai.size(n)!==e.nodeCount())throw new na;return t}function na(){}ea.CycleException=na,na.prototype=new Error;var ra=function(e,n,r){Ai.isArray(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],i={};return Ai.each(n,function(n){if(!e.hasNode(n))throw new Error("Graph does not have node: "+n);!function e(n,r,t,o,i,a){Ai.has(o,r)||(o[r]=!0,t||a.push(r),Ai.each(i(r),function(r){e(n,r,t,o,i,a)}),t&&a.push(r))}(e,n,"post"===r,i,t,o)}),o};var ta,oa={Graph:Di.Graph,json:Ui,alg:{components:Vi,dijkstra:$i,dijkstraAll:Ki,findCycles:Qi,floydWarshall:Hi,isAcyclic:function(e){try{Zi(e)}catch(e){if(e instanceof Zi.CycleException)return!1;throw e}return!0},postorder:function(e,n){return ra(e,n,"post")},preorder:function(e,n){return ra(e,n,"pre")},prim:function(e,n){var r,t=new Ci,o={},i=new qi;function a(e){var t=e.v===r?e.w:e.v,a=i.priority(t);if(void 0!==a){var u=n(e);u<a&&(o[t]=r,i.decrease(t,u))}}if(0===e.nodeCount())return t;Ai.each(e.nodes(),function(e){i.add(e,Number.POSITIVE_INFINITY),t.setNode(e)}),i.decrease(e.nodes()[0],0);var u=!1;for(;i.size()>0;){if(r=i.removeMin(),Ai.has(o,r))t.setEdge(r,o[r]);else{if(u)throw new Error("Input graph is not connected: "+e);u=!0}e.nodeEdges(r).forEach(a)}return t},tarjan:Ji,topsort:Zi},version:Di.version};try{ta=oa}catch(e){}ta||(ta=window.graphlib);var ia=ta,aa=1,ua=4;var ca=function(e){return zr(e,aa|ua)};var sa=function(e,n,r){if(!S(r))return!1;var t=typeof n;return!!("number"==t?cn(r)&&qe(n,r.length):"string"==t&&n in r)&&o(r[n],e)},fa=Object.prototype,da=fa.hasOwnProperty,ha=vi(function(e,n){e=Object(e);var r=-1,t=n.length,i=t>2?n[2]:void 0;for(i&&sa(n[0],n[1],i)&&(t=1);++r<t;)for(var a=n[r],u=ln(a),c=-1,s=u.length;++c<s;){var f=u[c],d=e[f];(void 0===d||o(d,fa[f])&&!da.call(e,f))&&(e[f]=a[f])}return e});var va=function(e){return function(n,r,t){var o=Object(n);if(!cn(n)){var i=mo(r);n=sn(n),r=function(e){return i(o[e],e,o)}}var a=e(n,r,t);return a>-1?o[i?n[a]:a]:void 0}},la=/\\s/;var pa=function(e){for(var n=e.length;n--&&la.test(e.charAt(n)););return n},ga=/^\\s+/;var ya=function(e){return e?e.slice(0,pa(e)+1).replace(ga,""):e},ba=NaN,_a=/^[-+]0x[0-9a-f]+$/i,ma=/^0b[01]+$/i,wa=/^0o[0-7]+$/i,Ea=parseInt;var ja=function(e){if("number"==typeof e)return e;if(Gt(e))return ba;if(S(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=S(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=ya(e);var r=ma.test(e);return r||wa.test(e)?Ea(e.slice(2),r?2:8):_a.test(e)?ba:+e},ka=1/0,xa=1.7976931348623157e308;var Na=function(e){return e?(e=ja(e))===ka||e===-ka?(e<0?-1:1)*xa:e==e?e:0:0===e?e:0};var Oa=function(e){var n=Na(e),r=n%1;return n==n?r?n-r:n:0},Ia=Math.max;var Aa=va(function(e,n,r){var t=null==e?0:e.length;if(!t)return-1;var o=null==r?0:Oa(r);return o<0&&(o=Ia(t+o,0)),li(e,mo(n),o)});var Ca=function(e){return null!=e&&e.length?oi(e,1):[]};var Ma=function(e,n){return null==e?e:Gr(e,$r(n),ln)};var Sa=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0};var Pa=function(e,n){var r={};return n=mo(n),Vr(e,function(e,t,o){Oe(r,t,n(e,t,o))}),r};var La=function(e,n,r){for(var t=-1,o=e.length;++t<o;){var i=e[t],a=n(i);if(null!=a&&(void 0===u?a==a&&!Gt(a):r(a,u)))var u=a,c=i}return c};var Ta=function(e,n){return e>n};var Fa=function(e){return e&&e.length?La(e,Yr,Ta):void 0};var Ra=function(e,n,r){(void 0===r||o(e[n],r))&&(void 0!==r||n in e)||Oe(e,n,r)},za="[object Object]",Da=Function.prototype,Ua=Object.prototype,Ba=Da.toString,Ga=Ua.hasOwnProperty,Va=Ba.call(Object);var qa=function(e){if(!Se(e)||M(e)!=za)return!1;var n=xn(e);if(null===n)return!0;var r=Ga.call(n,"constructor")&&n.constructor;return"function"==typeof r&&r instanceof r&&Ba.call(r)==Va};var Ya=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]};var $a=function(e){return Ce(e,ln(e))};var Wa=function(e,n,r,t,o,i,a){var u=Ya(e,r),c=Ya(n,r),s=a.get(c);if(s)Ra(e,r,s);else{var f=i?i(u,c,r+"",e,n,a):void 0,d=void 0===f;if(d){var h=De(c),v=!h&&Be(c),l=!h&&!v&&Xe(c);f=c,h||v||l?De(u)?f=u:ki(u)?f=yn(u):v?(d=!1,f=gn(c,!0)):l?(d=!1,f=Xn(c,!0)):f=[]:qa(c)||ze(c)?(f=u,ze(u)?f=$a(u):S(u)&&!z(u)||(f=wr(c))):d=!1}d&&(a.set(c,f),o(f,c,t,i,a),a.delete(c)),Ra(e,r,f)}};var Ka=function e(n,r,t,o,i){n!==r&&Gr(r,function(a,u){if(i||(i=new ke),S(a))Wa(n,r,u,t,e,o,i);else{var c=o?o(Ya(n,u),a,u+"",n,r,i):void 0;void 0===c&&(c=a),Ra(n,u,c)}},ln)};var Ja=function(e){return vi(function(n,r){var t=-1,o=r.length,i=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,a&&sa(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),n=Object(n);++t<o;){var u=r[t];u&&e(n,u,t,i)}return n})}(function(e,n,r){Ka(e,n,r)});var Qa=function(e,n){return e<n};var Ha=function(e){return e&&e.length?La(e,Yr,Qa):void 0};var Xa=function(e,n){return e&&e.length?La(e,mo(n),Qa):void 0},Za=function(){return _.Date.now()};var eu=function(e,n,r,t){if(!S(e))return e;for(var o=-1,i=(n=io(n,e)).length,a=i-1,u=e;null!=u&&++o<i;){var c=uo(n[o]),s=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var f=u[c];void 0===(s=t?t(f,c,u):void 0)&&(s=S(f)?f:qe(n[o+1])?[]:{})}Ae(u,c,s),u=u[c]}return e};var nu=function(e,n,r){for(var t=-1,o=n.length,i={};++t<o;){var a=n[t],u=co(e,a);r(u,a)&&eu(i,io(a,e),u)}return i};var ru=function(e,n){return nu(e,n,function(n,r){return vo(e,r)})};var tu=function(e){return hi(ui(e,void 0,Ca),e+"")}(function(e,n){return null==e?{}:ru(e,n)}),ou=Math.ceil,iu=Math.max;var au=function(e,n,r,t){for(var o=-1,i=iu(ou((n-e)/(r||1)),0),a=Array(i);i--;)a[t?i:++o]=e,e+=r;return a};var uu=function(e){return function(n,r,t){return t&&"number"!=typeof t&&sa(n,r,t)&&(r=t=void 0),n=Na(n),void 0===r?(r=n,n=0):r=Na(r),t=void 0===t?n<r?1:-1:Na(t),au(n,r,t,e)}}();var cu=function(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e};var su=function(e,n){if(e!==n){var r=void 0!==e,t=null===e,o=e==e,i=Gt(e),a=void 0!==n,u=null===n,c=n==n,s=Gt(n);if(!u&&!s&&!i&&e>n||i&&a&&c&&!u&&!s||t&&a&&c||!r&&c||!o)return 1;if(!t&&!i&&!s&&e<n||s&&r&&o&&!t&&!i||u&&r&&o||!a&&o||!c)return-1}return 0};var fu=function(e,n,r){for(var t=-1,o=e.criteria,i=n.criteria,a=o.length,u=r.length;++t<a;){var c=su(o[t],i[t]);if(c)return t>=u?c:c*("desc"==r[t]?-1:1)}return e.index-n.index};var du=function(e,n,r){n=n.length?Zt(n,function(e){return De(e)?function(n){return co(n,1===e.length?e[0]:e)}:e}):[Yr];var t=-1;n=Zt(n,Je(mo));var o=Co(e,function(e,r,o){return{criteria:Zt(n,function(n){return n(e)}),index:++t,value:e}});return cu(o,function(e,n){return fu(e,n,r)})},hu=vi(function(e,n){if(null==e)return[];var r=n.length;return r>1&&sa(e,n[0],n[1])?n=[]:r>2&&sa(n[0],n[1],n[2])&&(n=[n[0]]),du(e,oi(n,1),[])}),vu=0;var lu=function(e){var n=++vu;return oo(e)+n};var pu=function(e,n,r){for(var t=-1,o=e.length,i=n.length,a={};++t<o;){var u=t<i?n[t]:void 0;r(a,e[t],u)}return a};var gu,yu=function(e,n){return pu(e||[],n||[],Ae)};try{gu={cloneDeep:ca,constant:Br,defaults:ha,each:Kr,filter:wo,find:Aa,flatten:Ca,forEach:Wr,forIn:Ma,has:ko,isUndefined:Ao,last:Sa,map:Mo,mapValues:Pa,max:Fa,merge:Ja,min:Ha,minBy:Xa,now:Za,pick:tu,range:uu,reduce:Lo,sortBy:hu,uniqueId:lu,values:Ii,zipObject:yu}}catch(e){}gu||(gu=window._);var bu=gu,_u=mu;function mu(){var e={};e._next=e._prev=e,this._sentinel=e}function wu(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Eu(e,n){if("_next"!==e&&"_prev"!==e)return n}mu.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return wu(n),n},mu.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&wu(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},mu.prototype.toString=function(){for(var e=[],n=this._sentinel,r=n._prev;r!==n;)e.push(JSON.stringify(r,Eu)),r=r._prev;return"["+e.join(", ")+"]"};var ju=ia.Graph,ku=function(e,n){if(e.nodeCount()<=1)return[];var r=function(e,n){var r=new ju,t=0,o=0;bu.forEach(e.nodes(),function(e){r.setNode(e,{v:e,in:0,out:0})}),bu.forEach(e.edges(),function(e){var i=r.edge(e.v,e.w)||0,a=n(e),u=i+a;r.setEdge(e.v,e.w,u),o=Math.max(o,r.node(e.v).out+=a),t=Math.max(t,r.node(e.w).in+=a)});var i=bu.range(o+t+3).map(function(){return new _u}),a=t+1;return bu.forEach(r.nodes(),function(e){Ou(i,a,r.node(e))}),{graph:r,buckets:i,zeroIdx:a}}(e,n||xu),t=function(e,n,r){var t,o=[],i=n[n.length-1],a=n[0];for(;e.nodeCount();){for(;t=a.dequeue();)Nu(e,n,r,t);for(;t=i.dequeue();)Nu(e,n,r,t);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(t=n[u].dequeue()){o=o.concat(Nu(e,n,r,t,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return bu.flatten(bu.map(t,function(n){return e.outEdges(n.v,n.w)}),!0)},xu=bu.constant(1);function Nu(e,n,r,t,o){var i=o?[]:void 0;return bu.forEach(e.inEdges(t.v),function(t){var a=e.edge(t),u=e.node(t.v);o&&i.push({v:t.v,w:t.w}),u.out-=a,Ou(n,r,u)}),bu.forEach(e.outEdges(t.v),function(t){var o=e.edge(t),i=t.w,a=e.node(i);a.in-=o,Ou(n,r,a)}),e.removeNode(t.v),i}function Ou(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var Iu={run:function(e){var n="greedy"===e.graph().acyclicer?ku(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],r={},t={};return bu.forEach(e.nodes(),function o(i){bu.has(t,i)||(t[i]=!0,r[i]=!0,bu.forEach(e.outEdges(i),function(e){bu.has(r,e.w)?n.push(e):o(e.w)}),delete r[i])}),n}(e);bu.forEach(n,function(n){var r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,bu.uniqueId("rev"))})},undo:function(e){bu.forEach(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}};var Au=ia.Graph,Cu={addDummyNode:Mu,simplify:function(e){var n=(new Au).setGraph(e.graph());return bu.forEach(e.nodes(),function(r){n.setNode(r,e.node(r))}),bu.forEach(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},o=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})}),n},asNonCompoundGraph:function(e){var n=new Au({multigraph:e.isMultigraph()}).setGraph(e.graph());return bu.forEach(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),bu.forEach(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n},successorWeights:function(e){var n=bu.map(e.nodes(),function(n){var r={};return bu.forEach(e.outEdges(n),function(n){r[n.w]=(r[n.w]||0)+e.edge(n).weight}),r});return bu.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=bu.map(e.nodes(),function(n){var r={};return bu.forEach(e.inEdges(n),function(n){r[n.v]=(r[n.v]||0)+e.edge(n).weight}),r});return bu.zipObject(e.nodes(),n)},intersectRect:function(e,n){var r,t,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),r=s*a/u,t=s):(a<0&&(c=-c),r=c,t=c*u/a);return{x:o+r,y:i+t}},buildLayerMatrix:function(e){var n=bu.map(bu.range(Su(e)+1),function(){return[]});return bu.forEach(e.nodes(),function(r){var t=e.node(r),o=t.rank;bu.isUndefined(o)||(n[o][t.order]=r)}),n},normalizeRanks:function(e){var n=bu.min(bu.map(e.nodes(),function(n){return e.node(n).rank}));bu.forEach(e.nodes(),function(r){var t=e.node(r);bu.has(t,"rank")&&(t.rank-=n)})},removeEmptyRanks:function(e){var n=bu.min(bu.map(e.nodes(),function(n){return e.node(n).rank})),r=[];bu.forEach(e.nodes(),function(t){var o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)});var t=0,o=e.graph().nodeRankFactor;bu.forEach(r,function(n,r){bu.isUndefined(n)&&r%o!=0?--t:t&&bu.forEach(n,function(n){e.node(n).rank+=t})})},addBorderNode:function(e,n,r,t){var o={width:0,height:0};arguments.length>=4&&(o.rank=r,o.order=t);return Mu(e,"border",o,n)},maxRank:Su,partition:function(e,n){var r={lhs:[],rhs:[]};return bu.forEach(e,function(e){n(e)?r.lhs.push(e):r.rhs.push(e)}),r},time:function(e,n){var r=bu.now();try{return n()}finally{console.log(e+" time: "+(bu.now()-r)+"ms")}},notime:function(e,n){return n()}};function Mu(e,n,r,t){var o;do{o=bu.uniqueId(t)}while(e.hasNode(o));return r.dummy=n,e.setNode(o,r),o}function Su(e){return bu.max(bu.map(e.nodes(),function(n){var r=e.node(n).rank;if(!bu.isUndefined(r))return r}))}var Pu={run:function(e){e.graph().dummyChains=[],bu.forEach(e.edges(),function(n){!function(e,n){var r,t,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,f=e.edge(n),d=f.labelRank;if(c===a+1)return;for(e.removeEdge(n),o=0,++a;a<c;++o,++a)f.points=[],t={width:0,height:0,edgeLabel:f,edgeObj:n,rank:a},r=Cu.addDummyNode(e,"edge",t,"_d"),a===d&&(t.width=f.width,t.height=f.height,t.dummy="edge-label",t.labelpos=f.labelpos),e.setEdge(i,r,{weight:f.weight},s),0===o&&e.graph().dummyChains.push(r),i=r;e.setEdge(i,u,{weight:f.weight},s)}(e,n)})},undo:function(e){bu.forEach(e.graph().dummyChains,function(n){var r,t=e.node(n),o=t.edgeLabel;for(e.setEdge(t.edgeObj,o);t.dummy;)r=e.successors(n)[0],e.removeNode(n),o.points.push({x:t.x,y:t.y}),"edge-label"===t.dummy&&(o.x=t.x,o.y=t.y,o.width=t.width,o.height=t.height),n=r,t=e.node(n)})}};var Lu=function(e){var n={};bu.forEach(e.sources(),function r(t){var o=e.node(t);if(bu.has(n,t))return o.rank;n[t]=!0;var i=bu.min(bu.map(e.outEdges(t),function(n){return r(n.w)-e.edge(n).minlen}));i!==Number.POSITIVE_INFINITY&&null!=i||(i=0);return o.rank=i})},Tu=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen};var Fu=ia.Graph,Ru=Tu,zu=function(e){var n,r,t=new Fu({directed:!1}),o=e.nodes()[0],i=e.nodeCount();t.setNode(o,{});for(;Du(t,e)<i;)n=Uu(t,e),r=t.hasNode(n.v)?Ru(e,n):-Ru(e,n),Bu(t,e,r);return t};function Du(e,n){return bu.forEach(e.nodes(),function r(t){bu.forEach(n.nodeEdges(t),function(o){var i=o.v,a=t===i?o.w:i;e.hasNode(a)||Ru(n,o)||(e.setNode(a,{}),e.setEdge(t,a,{}),r(a))})}),e.nodeCount()}function Uu(e,n){return bu.minBy(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return Ru(n,r)})}function Bu(e,n,r){bu.forEach(e.nodes(),function(e){n.node(e).rank+=r})}var Gu=Tu,Vu=Lu,qu=ia.alg.preorder,Yu=ia.alg.postorder,$u=Cu.simplify,Wu=Ku;function Ku(e){e=$u(e),Vu(e);var n,r=zu(e);for(Hu(r),Ju(r,e);n=Xu(r);)ec(r,e,n,Zu(r,e,n))}function Ju(e,n){var r=Yu(e,e.nodes());r=r.slice(0,r.length-1),bu.forEach(r,function(r){!function(e,n,r){var t=e.node(r).parent;e.edge(r,t).cutvalue=Qu(e,n,r)}(e,n,r)})}function Qu(e,n,r){var t=e.node(r).parent,o=!0,i=n.edge(r,t),a=0;return i||(o=!1,i=n.edge(t,r)),a=i.weight,bu.forEach(n.nodeEdges(r),function(i){var u,c,s=i.v===r,f=s?i.w:i.v;if(f!==t){var d=s===o,h=n.edge(i).weight;if(a+=d?h:-h,u=r,c=f,e.hasEdge(u,c)){var v=e.edge(r,f).cutvalue;a+=d?-v:v}}}),a}function Hu(e,n){arguments.length<2&&(n=e.nodes()[0]),function e(n,r,t,o,i){var a=t;var u=n.node(o);r[o]=!0;bu.forEach(n.neighbors(o),function(i){bu.has(r,i)||(t=e(n,r,t,i,o))});u.low=a;u.lim=t++;i?u.parent=i:delete u.parent;return t}(e,{},1,n)}function Xu(e){return bu.find(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Zu(e,n,r){var t=r.v,o=r.w;n.hasEdge(t,o)||(t=r.w,o=r.v);var i=e.node(t),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=bu.filter(n.edges(),function(n){return c===nc(e,e.node(n.v),u)&&c!==nc(e,e.node(n.w),u)});return bu.minBy(s,function(e){return Gu(n,e)})}function ec(e,n,r,t){var o=r.v,i=r.w;e.removeEdge(o,i),e.setEdge(t.v,t.w,{}),Hu(e),Ju(e,n),function(e,n){var r=bu.find(e.nodes(),function(e){return!n.node(e).parent}),t=qu(e,r);t=t.slice(1),bu.forEach(t,function(r){var t=e.node(r).parent,o=n.edge(r,t),i=!1;o||(o=n.edge(t,r),i=!0),n.node(r).rank=n.node(t).rank+(i?o.minlen:-o.minlen)})}(e,n)}function nc(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}Ku.initLowLimValues=Hu,Ku.initCutValues=Ju,Ku.calcCutValue=Qu,Ku.leaveEdge=Xu,Ku.enterEdge=Zu,Ku.exchangeEdges=ec;var rc=Lu,tc=function(e){switch(e.graph().ranker){case"network-simplex":ic(e);break;case"tight-tree":!function(e){rc(e),zu(e)}(e);break;case"longest-path":oc(e);break;default:ic(e)}};var oc=rc;function ic(e){Wu(e)}var ac=function(e){var n=function(e){var n={},r=0;return bu.forEach(e.children(),function t(o){var i=r;bu.forEach(e.children(o),t),n[o]={low:i,lim:r++}}),n}(e);bu.forEach(e.graph().dummyChains,function(r){for(var t=e.node(r),o=t.edgeObj,i=function(e,n,r,t){var o,i,a=[],u=[],c=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim);o=r;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));i=o,o=t;for(;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],f=!0;r!==o.w;){if(t=e.node(r),f){for(;(s=a[c])!==u&&e.node(s).maxRank<t.rank;)c++;s===u&&(f=!1)}if(!f){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=t.rank;)c++;s=a[c]}e.setParent(r,s),r=e.successors(r)[0]}})};var uc={run:function(e){var n=Cu.addDummyNode(e,"root",{},"_root"),r=function(e){var n={};return bu.forEach(e.children(),function(r){!function r(t,o){var i=e.children(t);i&&i.length&&bu.forEach(i,function(e){r(e,o+1)}),n[t]=o}(r,1)}),n}(e),t=bu.max(bu.values(r))-1,o=2*t+1;e.graph().nestingRoot=n,bu.forEach(e.edges(),function(n){e.edge(n).minlen*=o});var i=function(e){return bu.reduce(e.edges(),function(n,r){return n+e.edge(r).weight},0)}(e)+1;bu.forEach(e.children(),function(a){!function e(n,r,t,o,i,a,u){var c=n.children(u);if(!c.length)return void(u!==r&&n.setEdge(r,u,{weight:0,minlen:t}));var s=Cu.addBorderNode(n,"_bt");var f=Cu.addBorderNode(n,"_bb");var d=n.node(u);n.setParent(s,u);d.borderTop=s;n.setParent(f,u);d.borderBottom=f;bu.forEach(c,function(c){e(n,r,t,o,i,a,c);var d=n.node(c),h=d.borderTop?d.borderTop:c,v=d.borderBottom?d.borderBottom:c,l=d.borderTop?o:2*o,p=h!==v?1:i-a[u]+1;n.setEdge(s,h,{weight:l,minlen:p,nestingEdge:!0}),n.setEdge(v,f,{weight:l,minlen:p,nestingEdge:!0})});n.parent(u)||n.setEdge(r,s,{weight:0,minlen:i+a[u]})}(e,n,o,i,t,r,a)}),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,bu.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}};var cc=function(e){bu.forEach(e.children(),function n(r){var t=e.children(r);var o=e.node(r);t.length&&bu.forEach(t,n);if(bu.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)sc(e,"borderLeft","_bl",r,o,i),sc(e,"borderRight","_br",r,o,i)}})};function sc(e,n,r,t,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Cu.addDummyNode(e,"border",a,r);o[n][i]=c,e.setParent(c,t),u&&e.setEdge(u,c,{weight:1})}var fc={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||dc(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){bu.forEach(e.nodes(),function(n){vc(e.node(n))}),bu.forEach(e.edges(),function(n){var r=e.edge(n);bu.forEach(r.points,vc),bu.has(r,"y")&&vc(r)})}(e);"lr"!==n&&"rl"!==n||(!function(e){bu.forEach(e.nodes(),function(n){lc(e.node(n))}),bu.forEach(e.edges(),function(n){var r=e.edge(n);bu.forEach(r.points,lc),bu.has(r,"x")&&lc(r)})}(e),dc(e))}};function dc(e){bu.forEach(e.nodes(),function(n){hc(e.node(n))}),bu.forEach(e.edges(),function(n){hc(e.edge(n))})}function hc(e){var n=e.width;e.width=e.height,e.height=n}function vc(e){e.y=-e.y}function lc(e){var n=e.x;e.x=e.y,e.y=n}var pc=function(e){var n={},r=bu.filter(e.nodes(),function(n){return!e.children(n).length}),t=bu.max(bu.map(r,function(n){return e.node(n).rank})),o=bu.map(bu.range(t+1),function(){return[]});var i=bu.sortBy(r,function(n){return e.node(n).rank});return bu.forEach(i,function r(t){if(!bu.has(n,t)){n[t]=!0;var i=e.node(t);o[i.rank].push(t),bu.forEach(e.successors(t),r)}}),o};var gc=function(e,n){for(var r=0,t=1;t<n.length;++t)r+=yc(e,n[t-1],n[t]);return r};function yc(e,n,r){for(var t=bu.zipObject(r,bu.map(r,function(e,n){return n})),o=bu.flatten(bu.map(n,function(n){return bu.sortBy(bu.map(e.outEdges(n),function(n){return{pos:t[n.w],weight:e.edge(n).weight}}),"pos")}),!0),i=1;i<r.length;)i<<=1;var a=2*i-1;i-=1;var u=bu.map(new Array(a),function(){return 0}),c=0;return bu.forEach(o.forEach(function(e){var n=e.pos+i;u[n]+=e.weight;for(var r=0;n>0;)n%2&&(r+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*r})),c}var bc=function(e,n){return bu.map(n,function(n){var r=e.inEdges(n);if(r.length){var t=bu.reduce(r,function(n,r){var t=e.edge(r),o=e.node(r.v);return{sum:n.sum+t.weight*o.order,weight:n.weight+t.weight}},{sum:0,weight:0});return{v:n,barycenter:t.sum/t.weight,weight:t.weight}}return{v:n}})};var _c=function(e,n){var r={};return bu.forEach(e,function(e,n){var t=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};bu.isUndefined(e.barycenter)||(t.barycenter=e.barycenter,t.weight=e.weight)}),bu.forEach(n.edges(),function(e){var n=r[e.v],t=r[e.w];bu.isUndefined(n)||bu.isUndefined(t)||(t.indegree++,n.out.push(r[e.w]))}),function(e){var n=[];function r(e){return function(n){var r,t,o,i;n.merged||(bu.isUndefined(n.barycenter)||bu.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&(t=n,o=0,i=0,(r=e).weight&&(o+=r.barycenter*r.weight,i+=r.weight),t.weight&&(o+=t.barycenter*t.weight,i+=t.weight),r.vs=t.vs.concat(r.vs),r.barycenter=o/i,r.weight=i,r.i=Math.min(t.i,r.i),t.merged=!0)}}function t(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}for(;e.length;){var o=e.pop();n.push(o),bu.forEach(o.in.reverse(),r(o)),bu.forEach(o.out,t(o))}return bu.map(bu.filter(n,function(e){return!e.merged}),function(e){return bu.pick(e,["vs","i","barycenter","weight"])})}(bu.filter(r,function(e){return!e.indegree}))};var mc=function(e,n){var r=Cu.partition(e,function(e){return bu.has(e,"barycenter")}),t=r.lhs,o=bu.sortBy(r.rhs,function(e){return-e.i}),i=[],a=0,u=0,c=0;t.sort((s=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:s?n.i-e.i:e.i-n.i})),c=wc(i,o,c),bu.forEach(t,function(e){c+=e.vs.length,i.push(e.vs),a+=e.barycenter*e.weight,u+=e.weight,c=wc(i,o,c)});var s;var f={vs:bu.flatten(i,!0)};u&&(f.barycenter=a/u,f.weight=u);return f};function wc(e,n,r){for(var t;n.length&&(t=bu.last(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}var Ec=function e(n,r,t,o){var i=n.children(r);var a=n.node(r);var u=a?a.borderLeft:void 0;var c=a?a.borderRight:void 0;var s={};u&&(i=bu.filter(i,function(e){return e!==u&&e!==c}));var f=bc(n,i);bu.forEach(f,function(r){if(n.children(r.v).length){var i=e(n,r.v,t,o);s[r.v]=i,bu.has(i,"barycenter")&&(a=r,u=i,bu.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u});var d=_c(f,t);!function(e,n){bu.forEach(e,function(e){e.vs=bu.flatten(e.vs.map(function(e){return n[e]?n[e].vs:e}),!0)})}(d,s);var h=mc(d,o);if(u&&(h.vs=bu.flatten([u,h.vs,c],!0),n.predecessors(u).length)){var v=n.node(n.predecessors(u)[0]),l=n.node(n.predecessors(c)[0]);bu.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+v.order+l.order)/(h.weight+2),h.weight+=2}return h};var jc=ia.Graph,kc=function(e,n,r){var t=function(e){var n;for(;e.hasNode(n=bu.uniqueId("_root")););return n}(e),o=new jc({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(n){return e.node(n)});return bu.forEach(e.nodes(),function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||t),bu.forEach(e[r](i),function(n){var r=n.v===i?n.w:n.v,t=o.edge(r,i),a=bu.isUndefined(t)?0:t.weight;o.setEdge(r,i,{weight:e.edge(n).weight+a})}),bu.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),o};var xc=function(e,n,r){var t,o={};bu.forEach(r,function(r){for(var i,a,u=e.parent(r);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=t,t=u),a&&a!==u)return void n.setEdge(a,u);u=i}})};var Nc=ia.Graph,Oc=function(e){var n=Cu.maxRank(e),r=Ic(e,bu.range(1,n+1),"inEdges"),t=Ic(e,bu.range(n-1,-1,-1),"outEdges"),o=pc(e);Cc(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ac(u%2?r:t,u%4>=2),o=Cu.buildLayerMatrix(e);var s=gc(e,o);s<a&&(c=0,i=bu.cloneDeep(o),a=s)}Cc(e,i)};function Ic(e,n,r){return bu.map(n,function(n){return kc(e,n,r)})}function Ac(e,n){var r=new Nc;bu.forEach(e,function(e){var t=e.graph().root,o=Ec(e,t,r,n);bu.forEach(o.vs,function(n,r){e.node(n).order=r}),xc(e,r,o.vs)})}function Cc(e,n){bu.forEach(n,function(n){bu.forEach(n,function(n,r){e.node(n).order=r})})}var Mc=ia.Graph,Sc=function(e){var n,r=Cu.buildLayerMatrix(e),t=bu.merge(Pc(e,r),Lc(e,r)),o={};bu.forEach(["u","d"],function(i){n="u"===i?r:bu.values(r).reverse(),bu.forEach(["l","r"],function(r){"r"===r&&(n=bu.map(n,function(e){return bu.values(e).reverse()}));var a=("u"===i?e.predecessors:e.successors).bind(e),u=Rc(e,n,t,a),c=zc(e,n,u.root,u.align,"r"===r);"r"===r&&(c=bu.mapValues(c,function(e){return-e})),o[i+r]=c})});var i=Dc(e,o);return Uc(o,i),Bc(o,e.graph().align)};function Pc(e,n){var r={};return bu.reduce(n,function(n,t){var o=0,i=0,a=n.length,u=bu.last(t);return bu.forEach(t,function(n,c){var s=function(e,n){if(e.node(n).dummy)return bu.find(e.predecessors(n),function(n){return e.node(n).dummy})}(e,n),f=s?e.node(s).order:a;(s||n===u)&&(bu.forEach(t.slice(i,c+1),function(n){bu.forEach(e.predecessors(n),function(t){var i=e.node(t),a=i.order;!(a<o||f<a)||i.dummy&&e.node(n).dummy||Tc(r,t,n)})}),i=c+1,o=f)}),t}),r}function Lc(e,n){var r={};function t(n,t,o,i,a){var u;bu.forEach(bu.range(t,o),function(t){u=n[t],e.node(u).dummy&&bu.forEach(e.predecessors(u),function(n){var t=e.node(n);t.dummy&&(t.order<i||t.order>a)&&Tc(r,n,u)})})}return bu.reduce(n,function(n,r){var o,i=-1,a=0;return bu.forEach(r,function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,t(r,a,c,i,o),a=c,i=o)}t(r,a,r.length,o,n.length)}),r}),r}function Tc(e,n,r){if(n>r){var t=n;n=r,r=t}var o=e[n];o||(e[n]=o={}),o[r]=!0}function Fc(e,n,r){if(n>r){var t=n;n=r,r=t}return bu.has(e[n],r)}function Rc(e,n,r,t){var o={},i={},a={};return bu.forEach(n,function(e){bu.forEach(e,function(e,n){o[e]=e,i[e]=e,a[e]=n})}),bu.forEach(n,function(e){var n=-1;bu.forEach(e,function(e){var u=t(e);if(u.length)for(var c=((u=bu.sortBy(u,function(e){return a[e]})).length-1)/2,s=Math.floor(c),f=Math.ceil(c);s<=f;++s){var d=u[s];i[e]===e&&n<a[d]&&!Fc(r,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}})}),{root:o,align:i}}function zc(e,n,r,t,o){var i={},a=function(e,n,r,t){var o=new Mc,i=e.graph(),a=function(e,n,r){return function(t,o,i){var a,u=t.node(o),c=t.node(i),s=0;if(s+=u.width/2,bu.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=r?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,bu.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=r?a:-a),a=0,s}}(i.nodesep,i.edgesep,t);return bu.forEach(n,function(n){var t;bu.forEach(n,function(n){var i=r[n];if(o.setNode(i),t){var u=r[t],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,t),c||0))}t=n})}),o}(e,n,r,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var r=a.nodes(),t=r.pop(),o={};t;)o[t]?e(t):(o[t]=!0,r.push(t),r=r.concat(n(t))),t=r.pop()}return c(function(e){i[e]=a.inEdges(e).reduce(function(e,n){return Math.max(e,i[n.v]+a.edge(n))},0)},a.predecessors.bind(a)),c(function(n){var r=a.outEdges(n).reduce(function(e,n){return Math.min(e,i[n.w]-a.edge(n))},Number.POSITIVE_INFINITY),t=e.node(n);r!==Number.POSITIVE_INFINITY&&t.borderType!==u&&(i[n]=Math.max(i[n],r))},a.successors.bind(a)),bu.forEach(t,function(e){i[e]=i[r[e]]}),i}function Dc(e,n){return bu.minBy(bu.values(n),function(n){var r=Number.NEGATIVE_INFINITY,t=Number.POSITIVE_INFINITY;return bu.forIn(n,function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;r=Math.max(n+i,r),t=Math.min(n-i,t)}),r-t})}function Uc(e,n){var r=bu.values(n),t=bu.min(r),o=bu.max(r);bu.forEach(["u","d"],function(r){bu.forEach(["l","r"],function(i){var a,u=r+i,c=e[u];if(c!==n){var s=bu.values(c);(a="l"===i?t-bu.min(s):o-bu.max(s))&&(e[u]=bu.mapValues(c,function(e){return e+a}))}})})}function Bc(e,n){return bu.mapValues(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var o=bu.sortBy(bu.map(e,t));return(o[1]+o[2])/2})}var Gc=Sc,Vc=function(e){(function(e){var n=Cu.buildLayerMatrix(e),r=e.graph().ranksep,t=0;bu.forEach(n,function(n){var o=bu.max(bu.map(n,function(n){return e.node(n).height}));bu.forEach(n,function(n){e.node(n).y=t+o/2}),t+=o+r})})(e=Cu.asNonCompoundGraph(e)),bu.forEach(Gc(e),function(n,r){e.node(r).x=n})};var qc=Cu.normalizeRanks,Yc=Cu.removeEmptyRanks,$c=Cu,Wc=ia.Graph,Kc=function(e,n){var r=n&&n.debugTiming?$c.time:$c.notime;r("layout",function(){var n=r(" buildLayoutGraph",function(){return function(e){var n=new Wc({multigraph:!0,compound:!0}),r=os(e.graph());return n.setGraph(bu.merge({},Qc,ts(r,Jc),bu.pick(r,Hc))),bu.forEach(e.nodes(),function(r){var t=os(e.node(r));n.setNode(r,bu.defaults(ts(t,Xc),Zc)),n.setParent(r,e.parent(r))}),bu.forEach(e.edges(),function(r){var t=os(e.edge(r));n.setEdge(r,bu.merge({},ns,ts(t,es),bu.pick(t,rs)))}),n}(e)});r(" runLayout",function(){!function(e,n){n(" makeSpaceForEdgeLabels",function(){!function(e){var n=e.graph();n.ranksep/=2,bu.forEach(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,"c"!==t.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?t.width+=t.labeloffset:t.height+=t.labeloffset)})}(e)}),n(" removeSelfEdges",function(){!function(e){bu.forEach(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}(e)}),n(" acyclic",function(){Iu.run(e)}),n(" nestingGraph.run",function(){uc.run(e)}),n(" rank",function(){tc($c.asNonCompoundGraph(e))}),n(" injectEdgeLabelProxies",function(){!function(e){bu.forEach(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),o=e.node(n.w),i={rank:(o.rank-t.rank)/2+t.rank,e:n};$c.addDummyNode(e,"edge-proxy",i,"_ep")}})}(e)}),n(" removeEmptyRanks",function(){Yc(e)}),n(" nestingGraph.cleanup",function(){uc.cleanup(e)}),n(" normalizeRanks",function(){qc(e)}),n(" assignRankMinMax",function(){!function(e){var n=0;bu.forEach(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=bu.max(n,t.maxRank))}),e.graph().maxRank=n}(e)}),n(" removeEdgeLabelProxies",function(){!function(e){bu.forEach(e.nodes(),function(n){var r=e.node(n);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}(e)}),n(" normalize.run",function(){Pu.run(e)}),n(" parentDummyChains",function(){ac(e)}),n(" addBorderSegments",function(){cc(e)}),n(" order",function(){Oc(e)}),n(" insertSelfEdges",function(){!function(e){var n=$c.buildLayerMatrix(e);bu.forEach(n,function(n){var r=0;bu.forEach(n,function(n,t){var o=e.node(n);o.order=t+r,bu.forEach(o.selfEdges,function(n){$c.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:t+ ++r,e:n.e,label:n.label},"_se")}),delete o.selfEdges})})}(e)}),n(" adjustCoordinateSystem",function(){fc.adjust(e)}),n(" position",function(){Vc(e)}),n(" positionSelfEdges",function(){!function(e){bu.forEach(e.nodes(),function(n){var r=e.node(n);if("selfedge"===r.dummy){var t=e.node(r.e.v),o=t.x+t.width/2,i=t.y,a=r.x-o,u=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],r.label.x=r.x,r.label.y=r.y}})}(e)}),n(" removeBorderNodes",function(){!function(e){bu.forEach(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),o=e.node(r.borderBottom),i=e.node(bu.last(r.borderLeft)),a=e.node(bu.last(r.borderRight));r.width=Math.abs(a.x-i.x),r.height=Math.abs(o.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),bu.forEach(e.nodes(),function(n){"border"===e.node(n).dummy&&e.removeNode(n)})}(e)}),n(" normalize.undo",function(){Pu.undo(e)}),n(" fixupEdgeLabelCoords",function(){!function(e){bu.forEach(e.edges(),function(n){var r=e.edge(n);if(bu.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}(e)}),n(" undoCoordinateSystem",function(){fc.undo(e)}),n(" translateGraph",function(){!function(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),r=Math.max(r,i+u/2),t=Math.min(t,a-c/2),o=Math.max(o,a+c/2)}bu.forEach(e.nodes(),function(n){c(e.node(n))}),bu.forEach(e.edges(),function(n){var r=e.edge(n);bu.has(r,"x")&&c(r)}),n-=a,t-=u,bu.forEach(e.nodes(),function(r){var o=e.node(r);o.x-=n,o.y-=t}),bu.forEach(e.edges(),function(r){var o=e.edge(r);bu.forEach(o.points,function(e){e.x-=n,e.y-=t}),bu.has(o,"x")&&(o.x-=n),bu.has(o,"y")&&(o.y-=t)}),i.width=r-n+a,i.height=o-t+u}(e)}),n(" assignNodeIntersects",function(){!function(e){bu.forEach(e.edges(),function(n){var r,t,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(r=o.points[0],t=o.points[o.points.length-1]):(o.points=[],r=a,t=i),o.points.unshift($c.intersectRect(i,r)),o.points.push($c.intersectRect(a,t))})}(e)}),n(" reversePoints",function(){!function(e){bu.forEach(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}(e)}),n(" acyclic.undo",function(){Iu.undo(e)})}(n,r)}),r(" updateInputGraph",function(){!function(e,n){bu.forEach(e.nodes(),function(r){var t=e.node(r),o=n.node(r);t&&(t.x=o.x,t.y=o.y,n.children(r).length&&(t.width=o.width,t.height=o.height))}),bu.forEach(e.edges(),function(r){var t=e.edge(r),o=n.edge(r);t.points=o.points,bu.has(o,"x")&&(t.x=o.x,t.y=o.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)})})};var Jc=["nodesep","edgesep","ranksep","marginx","marginy"],Qc={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Hc=["acyclicer","ranker","rankdir","align"],Xc=["width","height"],Zc={width:0,height:0},es=["minlen","weight","width","height","labeloffset"],ns={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},rs=["labelpos"];function ts(e,n){return bu.mapValues(bu.pick(e,n),Number)}function os(e){var n={};return bu.forEach(e,function(e,r){n[r.toLowerCase()]=e}),n}var is=ia.Graph;var as={graphlib:ia,layout:Kc,debug:{debugOrdering:function(e){var n=Cu.buildLayerMatrix(e),r=new is({compound:!0,multigraph:!0}).setGraph({});return bu.forEach(e.nodes(),function(n){r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)}),bu.forEach(e.edges(),function(e){r.setEdge(e.v,e.w,{},e.name)}),bu.forEach(n,function(e,n){var t="layer"+n;r.setNode(t,{rank:"same"}),bu.reduce(e,function(e,n){return r.setEdge(e,n,{style:"invis"}),n})}),r}},util:{time:Cu.time,notime:Cu.notime},version:"0.8.5"},us=as.graphlib,cs=as.layout;n(function(n,r){n.exports=function(){function n(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},t=0,o=void 0,i=void 0,a=function(e,n){v[t]=e,v[t+1]=n,2===(t+=2)&&(i?i(l):_())},u="undefined"!=typeof window?window:void 0,c=u||{},s=c.MutationObserver||c.WebKitMutationObserver,f="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(l,1)}}var v=new Array(1e3);function l(){for(var e=0;e<t;e+=2){var n=v[e],r=v[e+1];n(r),v[e]=void 0,v[e+1]=void 0}t=0}var p,g,y,b,_=void 0;function m(e,n){var r=this,t=new this.constructor(j);void 0===t[E]&&F(t);var o=r._state;if(o){var i=arguments[o-1];a(function(){return L(o,t,i,r._result)})}else S(r,t,e,n);return t}function w(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var n=new this(j);return I(n,e),n}f?_=function(){return process.nextTick(l)}:s?(g=0,y=new s(l),b=document.createTextNode(""),y.observe(b,{characterData:!0}),_=function(){b.data=g=++g%2}):d?((p=new MessageChannel).port1.onmessage=l,_=function(){return p.port2.postMessage(0)}):_=void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(o=e.runOnLoop||e.runOnContext)?function(){o(l)}:h()}catch(e){return h()}}():h();var E=Math.random().toString(36).substring(2);function j(){}var k=void 0,x=1,N=2;function O(e,r,t){r.constructor===e.constructor&&t===m&&r.constructor.resolve===w?function(e,n){n._state===x?C(e,n._result):n._state===N?M(e,n._result):S(n,void 0,function(n){return I(e,n)},function(n){return M(e,n)})}(e,r):void 0===t?C(e,r):n(t)?function(e,n,r){a(function(e){var t=!1,o=function(e,n,r,t){try{e.call(n,r,t)}catch(e){return e}}(r,n,function(r){t||(t=!0,n!==r?I(e,r):C(e,r))},function(n){t||(t=!0,M(e,n))},e._label);!t&&o&&(t=!0,M(e,o))},e)}(e,r,t):C(e,r)}function I(e,n){if(e===n)M(e,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(t=n),null===t||"object"!==o&&"function"!==o)C(e,n);else{var r=void 0;try{r=n.then}catch(n){return void M(e,n)}O(e,n,r)}var t,o}function A(e){e._onerror&&e._onerror(e._result),P(e)}function C(e,n){e._state===k&&(e._result=n,e._state=x,0!==e._subscribers.length&&a(P,e))}function M(e,n){e._state===k&&(e._state=N,e._result=n,a(A,e))}function S(e,n,r,t){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=n,o[i+x]=r,o[i+N]=t,0===i&&e._state&&a(P,e)}function P(e){var n=e._subscribers,r=e._state;if(0!==n.length){for(var t=void 0,o=void 0,i=e._result,a=0;a<n.length;a+=3)t=n[a],o=n[a+r],t?L(r,t,o,i):o(i);e._subscribers.length=0}}function L(e,r,t,o){var i=n(t),a=void 0,u=void 0,c=!0;if(i){try{a=t(o)}catch(e){c=!1,u=e}if(r===a)return void M(r,new TypeError("A promises callback cannot return that same promise."))}else a=o;r._state!==k||(i&&c?I(r,a):!1===c?M(r,u):e===x?C(r,a):e===N&&M(r,a))}var T=0;function F(e){e[E]=T++,e._state=void 0,e._result=void 0,e._subscribers=[]}var R=function(){function e(e,n){this._instanceConstructor=e,this.promise=new e(j),this.promise[E]||F(this.promise),r(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&C(this.promise,this._result))):M(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var n=0;this._state===k&&n<e.length;n++)this._eachEntry(e[n],n)},e.prototype._eachEntry=function(e,n){var r=this._instanceConstructor,t=r.resolve;if(t===w){var o=void 0,i=void 0,a=!1;try{o=e.then}catch(e){a=!0,i=e}if(o===m&&e._state!==k)this._settledAt(e._state,n,e._result);else if("function"!=typeof o)this._remaining--,this._result[n]=e;else if(r===z){var u=new r(j);a?M(u,i):O(u,e,o),this._willSettleAt(u,n)}else this._willSettleAt(new r(function(n){return n(e)}),n)}else this._willSettleAt(t(e),n)},e.prototype._settledAt=function(e,n,r){var t=this.promise;t._state===k&&(this._remaining--,e===N?M(t,r):this._result[n]=r),0===this._remaining&&C(t,this._result)},e.prototype._willSettleAt=function(e,n){var r=this;S(e,void 0,function(e){return r._settledAt(x,n,e)},function(e){return r._settledAt(N,n,e)})},e}(),z=function(){function e(n){this[E]=T++,this._result=this._state=void 0,this._subscribers=[],j!==n&&("function"!=typeof n&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,n){try{n(function(n){I(e,n)},function(n){M(e,n)})}catch(n){M(e,n)}}(this,n):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var r=this.constructor;return n(e)?this.then(function(n){return r.resolve(e()).then(function(){return n})},function(n){return r.resolve(e()).then(function(){throw n})}):this.then(e,e)},e}();return z.prototype.then=m,z.all=function(e){return new R(this,e).promise},z.race=function(e){var n=this;return r(e)?new n(function(r,t){for(var o=e.length,i=0;i<o;i++)n.resolve(e[i]).then(r,t)}):new n(function(e,n){return n(new TypeError("You must pass an array to race."))})},z.resolve=w,z.reject=function(e){var n=new this(j);return M(n,e),n},z._setScheduler=function(e){i=e},z._setAsap=function(e){a=e},z._asap=a,z.polyfill=function(){var n=void 0;if(void 0!==e)n=e;else if("undefined"!=typeof self)n=self;else try{n=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=n.Promise;if(r){var t=null;try{t=Object.prototype.toString.call(r.resolve())}catch(e){}if("[object Promise]"===t&&!r.cast)return}n.Promise=z},z.Promise=z,z}()}).polyfill();self.onmessage=function(e){var n=function(e,n){var r=e.subgraphs,t=e.nodes,o=e.links,i=e.hierarchy,a=new us.Graph({multigraph:!0,compound:!0,directed:!1!==n.digraph}).setGraph(n).setDefaultNodeLabel(function(){return{}}).setDefaultEdgeLabel(function(){return{}});r.forEach(function(e){a.setNode(e.id,e)}),t.forEach(function(e){a.setNode(e.id,e)}),o.forEach(function(e){a.setEdge(e.source.id,e.target.id,e,e.id)}),i.forEach(function(e){a.setParent(e.child,e.parent)}),cs(a,{debugTiming:!1});var u=-a.graph().width/2||0,c=-a.graph().height/2;return a.nodes().forEach(function(e){var n=a.node(e);n.x+=u,n.y+=c}),a.edges().forEach(function(e){var n=a.edge(e);n.points=n.points.map(function(e){return[e.x+u,e.y+c]})}),{subgraphs:r,nodes:t,links:o}}.apply(void 0,e.data);self.postMessage(n)}}();`;
|
|
40
40
|
|
|
41
41
|
const workerBlob = new Blob([workerCode], { type: "application/javascript" });
|
|
42
42
|
const workerUrl = URL.createObjectURL(workerBlob);
|
|
@@ -31,14 +31,7 @@ export interface Options {
|
|
|
31
31
|
|
|
32
32
|
export function forceDirected(data: Data, options: Options) {
|
|
33
33
|
// eslint-disable-next-line quotes
|
|
34
|
-
const workerCode = `var forceDirected=function(t){"use strict";function n(t){return function(){return t}}function e(){return 1e-6*(Math.random()-.5)}function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,s,u,a,c,f,l,h,v=t._root,y={data:r},p=t._x0,_=t._y0,d=t._x1,g=t._y1;if(!v)return t._root=y,t;for(;v.length;)if((c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s,i=v,!(v=v[l=f<<1|c]))return i[l]=y,t;if(u=+t._x.call(null,v.data),a=+t._y.call(null,v.data),n===u&&e===a)return y.next=v,i?i[l]=y:t._root=y,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+d)/2))?p=o:d=o,(f=e>=(s=(_+g)/2))?_=s:g=s}while((l=f<<1|c)==(h=(a>=s)<<1|u>=o));return i[h]=v,i[l]=y,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function s(t){return t[1]}function u(t,n,e){var r=new a(null==n?o:n,null==e?s:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function a(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function c(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var f=u.prototype=a.prototype;f.copy=function(){var t,n,e=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=c(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=c(n));return e},f.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},f.addAll=function(t){var n,e,i,o,s=t.length,u=new Array(s),a=new Array(s),c=1/0,f=1/0,l=-1/0,h=-1/0;for(e=0;e<s;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,a[e]=o,i<c&&(c=i),i>l&&(l=i),o<f&&(f=o),o>h&&(h=o));if(c>l||f>h)return this;for(this.cover(c,f).cover(l,h),e=0;e<s;++e)r(this,u[e],a[e],t[e]);return this},f.cover=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{for(var s,u,a=i-e,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(s=new Array(4))[u]=c,c=s,a*=2,u){case 0:i=e+a,o=r+a;break;case 1:e=i-a,o=r+a;break;case 2:i=e+a,r=o-a;break;case 3:e=i-a,r=o-a}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},f.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},f.extent=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]]},f.find=function(t,n,e){var r,o,s,u,a,c,f,l=this._x0,h=this._y0,v=this._x1,y=this._y1,p=[],_=this._root;for(_&&p.push(new i(_,l,h,v,y)),null==e?e=1/0:(l=t-e,h=n-e,v=t+e,y=n+e,e*=e);c=p.pop();)if(!(!(_=c.node)||(o=c.x0)>v||(s=c.y0)>y||(u=c.x1)<l||(a=c.y1)<h))if(_.length){var d=(o+u)/2,g=(s+a)/2;p.push(new i(_[3],d,g,u,a),new i(_[2],o,g,d,a),new i(_[1],d,s,u,g),new i(_[0],o,s,d,g)),(f=(n>=g)<<1|t>=d)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-f],p[p.length-1-f]=c)}else{var x=t-+this._x.call(null,_.data),w=n-+this._y.call(null,_.data),m=x*x+w*w;if(m<e){var b=Math.sqrt(e=m);l=t-b,h=n-b,v=t+b,y=n+b,r=_.data}}return r},f.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var n,e,r,i,o,s,u,a,c,f,l,h,v=this._root,y=this._x0,p=this._y0,_=this._x1,d=this._y1;if(!v)return this;if(v.length)for(;;){if((c=o>=(u=(y+_)/2))?y=u:_=u,(f=s>=(a=(p+d)/2))?p=a:d=a,n=v,!(v=v[l=f<<1|c]))return this;if(!v.length)break;(n[l+1&3]||n[l+2&3]||n[l+3&3])&&(e=n,h=l)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):n?(i?n[l]=i:delete n[l],(v=n[0]||n[1]||n[2]||n[3])&&v===(n[3]||n[2]||n[1]||n[0])&&!v.length&&(e?e[h]=v:this._root=v),this):(this._root=i,this)},f.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},f.root=function(){return this._root},f.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},f.visit=function(t){var n,e,r,o,s,u,a=[],c=this._root;for(c&&a.push(new i(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,o=n.y0,s=n.x1,u=n.y1)&&c.length){var f=(r+s)/2,l=(o+u)/2;(e=c[3])&&a.push(new i(e,f,l,s,u)),(e=c[2])&&a.push(new i(e,r,l,f,u)),(e=c[1])&&a.push(new i(e,f,o,s,l)),(e=c[0])&&a.push(new i(e,r,o,f,l))}return this},f.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var s,u=n.x0,a=n.y0,c=n.x1,f=n.y1,l=(u+c)/2,h=(a+f)/2;(s=o[0])&&e.push(new i(s,u,a,l,h)),(s=o[1])&&e.push(new i(s,l,a,c,h)),(s=o[2])&&e.push(new i(s,u,h,l,f)),(s=o[3])&&e.push(new i(s,l,h,c,f))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},f.x=function(t){return arguments.length?(this._x=t,this):this._x},f.y=function(t){return arguments.length?(this._y=t,this):this._y};var l="$";function h(){}function v(t,n){var e=new h;if(t instanceof h)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var s in t)e.set(s,t[s]);return e}function y(){}h.prototype=v.prototype={constructor:h,has:function(t){return l+t in this},get:function(t){return this[l+t]},set:function(t,n){return this[l+t]=n,this},remove:function(t){var n=l+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===l&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===l&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===l&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===l&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===l&&++t;return t},empty:function(){for(var t in this)if(t[0]===l)return!1;return!0},each:function(t){for(var n in this)n[0]===l&&t(this[n],n.slice(1),this)}};var p=v.prototype;function _(t){return t.index}function d(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}y.prototype={constructor:y,has:p.has,add:function(t){return this[l+(t+="")]=t,this},remove:p.remove,clear:p.clear,values:p.keys,size:p.size,empty:p.empty,each:p.each};var g={value:function(){}};function x(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new w(r)}function w(t){this._=t}function m(t,n){return t.trim().split(/^|\\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function b(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function A(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=g,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}w.prototype=x.prototype={constructor:w,on:function(t,n){var e,r=this._,i=m(t+"",r),o=-1,s=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<s;)if(e=(t=i[o]).type)r[e]=A(r[e],t.name,n);else if(null==n)for(e in r)r[e]=A(r[e],t.name,null);return this}for(;++o<s;)if((e=(t=i[o]).type)&&(e=b(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new w(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var N,M,k=0,E=0,j=0,T=0,S=0,q=0,D="object"==typeof performance&&performance.now?performance:Date,O="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function P(){return S||(O(z),S=D.now()+q)}function z(){S=0}function C(){this._call=this._time=this._next=null}function F(t,n,e){var r=new C;return r.restart(t,n,e),r}function I(){S=(T=D.now())+q,k=E=0;try{!function(){P(),++k;for(var t,n=N;n;)(t=S-n._time)>=0&&n._call.call(null,t),n=n._next;--k}()}finally{k=0,function(){var t,n,e=N,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:N=n);M=t,K(r)}(),S=0}}function Y(){var t=D.now(),n=t-T;n>1e3&&(q-=n,T=t)}function K(t){k||(E&&(E=clearTimeout(E)),t-S>24?(t<1/0&&(E=setTimeout(I,t-D.now()-q)),j&&(j=clearInterval(j))):(j||(T=D.now(),j=setInterval(Y,1e3)),k=1,O(I)))}function L(t){return t.x}function U(t){return t.y}C.prototype=F.prototype={constructor:C,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?P():+e)+(null==n?0:+n),this._next||M===this||(M?M._next=this:N=this,M=this),this._call=t,this._time=e,K()},stop:function(){this._call&&(this._call=null,this._time=1/0,K())}};var W=Math.PI*(3-Math.sqrt(5));var $="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var B={exports:{}};
|
|
35
|
-
/*!
|
|
36
|
-
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
37
|
-
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
38
|
-
* @license Licensed under MIT license
|
|
39
|
-
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
40
|
-
* @version v4.2.8+1e68dce6
|
|
41
|
-
*/function G(t,r){var i=t.nodes,o=t.links,s=function(t){var r,i,o,s,u,a=_,c=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},f=n(30),l=1;function h(n){for(var o=0,s=t.length;o<l;++o)for(var a,c,f,h,v,y,p,_=0;_<s;++_)c=(a=t[_]).source,h=(f=a.target).x+f.vx-c.x-c.vx||e(),v=f.y+f.vy-c.y-c.vy||e(),h*=y=((y=Math.sqrt(h*h+v*v))-i[_])/y*n*r[_],v*=y,f.vx-=h*(p=u[_]),f.vy-=v*p,c.vx+=h*(p=1-p),c.vy+=v*p}function y(){if(o){var n,e,c=o.length,f=t.length,l=v(o,a);for(n=0,s=new Array(c);n<f;++n)(e=t[n]).index=n,"object"!=typeof e.source&&(e.source=d(l,e.source)),"object"!=typeof e.target&&(e.target=d(l,e.target)),s[e.source.index]=(s[e.source.index]||0)+1,s[e.target.index]=(s[e.target.index]||0)+1;for(n=0,u=new Array(f);n<f;++n)e=t[n],u[n]=s[e.source.index]/(s[e.source.index]+s[e.target.index]);r=new Array(f),p(),i=new Array(f),g()}}function p(){if(o)for(var n=0,e=t.length;n<e;++n)r[n]=+c(t[n],n,t)}function g(){if(o)for(var n=0,e=t.length;n<e;++n)i[n]=+f(t[n],n,t)}return null==t&&(t=[]),h.initialize=function(t){o=t,y()},h.links=function(n){return arguments.length?(t=n,y(),h):t},h.id=function(t){return arguments.length?(a=t,h):a},h.iterations=function(t){return arguments.length?(l=+t,h):l},h.strength=function(t){return arguments.length?(c="function"==typeof t?t:n(+t),p(),h):c},h.distance=function(t){return arguments.length?(f="function"==typeof t?t:n(+t),g(),h):f},h}(o).id((function(t){return t.id})).distance(r.linkDistance).strength(r.linkStrength),a=function(){var t,r,i,o,s=n(-30),a=1,c=1/0,f=.81;function l(n){var e,o=t.length,s=u(t,L,U).visitAfter(v);for(i=n,e=0;e<o;++e)r=t[e],s.visit(y)}function h(){if(t){var n,e,r=t.length;for(o=new Array(r),n=0;n<r;++n)e=t[n],o[e.index]=+s(e,n,t)}}function v(t){var n,e,r,i,s,u=0,a=0;if(t.length){for(r=i=s=0;s<4;++s)(n=t[s])&&(e=Math.abs(n.value))&&(u+=n.value,a+=e,r+=e*n.x,i+=e*n.y);t.x=r/a,t.y=i/a}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=o[n.data.index]}while(n=n.next)}t.value=u}function y(t,n,s,u){if(!t.value)return!0;var l=t.x-r.x,h=t.y-r.y,v=u-n,y=l*l+h*h;if(v*v/f<y)return y<c&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)),r.vx+=l*t.value*i/y,r.vy+=h*t.value*i/y),!0;if(!(t.length||y>=c)){(t.data!==r||t.next)&&(0===l&&(y+=(l=e())*l),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(v=o[t.data.index]*i/y,r.vx+=l*v,r.vy+=h*v)}while(t=t.next)}}return l.initialize=function(n){t=n,h()},l.strength=function(t){return arguments.length?(s="function"==typeof t?t:n(+t),h(),l):s},l.distanceMin=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.distanceMax=function(t){return arguments.length?(c=t*t,l):Math.sqrt(c)},l.theta=function(t){return arguments.length?(f=t*t,l):Math.sqrt(f)},l}().strength(r.repulsionStrength);return function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,s=.6,u=v(),a=F(f),c=x("tick","end");function f(){l(),c.call("tick",n),e<r&&(a.stop(),c.call("end",n))}function l(r){var a,c,f=t.length;void 0===r&&(r=1);for(var l=0;l<r;++l)for(e+=(o-e)*i,u.each((function(t){t(e)})),a=0;a<f;++a)null==(c=t[a]).fx?c.x+=c.vx*=s:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=s:(c.y=c.fy,c.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(e),o=e*W;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function y(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:l,restart:function(){return a.restart(f),n},stop:function(){return a.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.each(y),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(s=1-t,n):1-s},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,y(e)),n):u.get(t)},find:function(n,e,r){var i,o,s,u,a,c=0,f=t.length;for(null==r?r=1/0:r*=r,c=0;c<f;++c)(s=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(a=u,r=s);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(i).force("link",s).force("charge",a).force("center",function(t,n){var e;function r(){var r,i,o=e.length,s=0,u=0;for(r=0;r<o;++r)s+=(i=e[r]).x,u+=i.y;for(s=s/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=s,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r}()).alpha(r.alpha).alphaMin(r.alphaMin).alphaDecay(r.alphaDecay).velocityDecay(r.velocityDecay).stop().tick(r.iterations),{nodes:i,links:o}}return B.exports=function(){function t(t){var n=typeof t;return null!==t&&("object"===n||"function"===n)}function n(t){return"function"==typeof t}var e=void 0;e=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var r=e,i=0,o=void 0,s=void 0,u=function(t,n){w[i]=t,w[i+1]=n,2===(i+=2)&&(s?s(m):A())};function a(t){s=t}function c(t){u=t}var f="undefined"!=typeof window?window:void 0,l=f||{},h=l.MutationObserver||l.WebKitMutationObserver,v="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),y="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(m)}}function _(){return void 0!==o?function(){o(m)}:x()}function d(){var t=0,n=new h(m),e=document.createTextNode("");return n.observe(e,{characterData:!0}),function(){e.data=t=++t%2}}function g(){var t=new MessageChannel;return t.port1.onmessage=m,function(){return t.port2.postMessage(0)}}function x(){var t=setTimeout;return function(){return t(m,1)}}var w=new Array(1e3);function m(){for(var t=0;t<i;t+=2)(0,w[t])(w[t+1]),w[t]=void 0,w[t+1]=void 0;i=0}function b(){try{var t=Function("return this")().require("vertx");return o=t.runOnLoop||t.runOnContext,_()}catch(t){return x()}}var A=void 0;function N(t,n){var e=this,r=new this.constructor(E);void 0===r[k]&&J(r);var i=e._state;if(i){var o=arguments[i-1];u((function(){return W(i,r,o,e._result)}))}else L(e,r,t,n);return r}function M(t){var n=this;if(t&&"object"==typeof t&&t.constructor===n)return t;var e=new n(E);return F(e,t),e}A=v?p():h?d():y?g():void 0===f?b():x();var k=Math.random().toString(36).substring(2);function E(){}var j=void 0,T=1,S=2;function q(){return new TypeError("You cannot resolve a promise with itself")}function D(){return new TypeError("A promises callback cannot return that same promise.")}function O(t,n,e,r){try{t.call(n,e,r)}catch(t){return t}}function P(t,n,e){u((function(t){var r=!1,i=O(e,n,(function(e){r||(r=!0,n!==e?F(t,e):Y(t,e))}),(function(n){r||(r=!0,K(t,n))}),"Settle: "+(t._label||" unknown promise"));!r&&i&&(r=!0,K(t,i))}),t)}function z(t,n){n._state===T?Y(t,n._result):n._state===S?K(t,n._result):L(n,void 0,(function(n){return F(t,n)}),(function(n){return K(t,n)}))}function C(t,e,r){e.constructor===t.constructor&&r===N&&e.constructor.resolve===M?z(t,e):void 0===r?Y(t,e):n(r)?P(t,e,r):Y(t,e)}function F(n,e){if(n===e)K(n,q());else if(t(e)){var r=void 0;try{r=e.then}catch(t){return void K(n,t)}C(n,e,r)}else Y(n,e)}function I(t){t._onerror&&t._onerror(t._result),U(t)}function Y(t,n){t._state===j&&(t._result=n,t._state=T,0!==t._subscribers.length&&u(U,t))}function K(t,n){t._state===j&&(t._state=S,t._result=n,u(I,t))}function L(t,n,e,r){var i=t._subscribers,o=i.length;t._onerror=null,i[o]=n,i[o+T]=e,i[o+S]=r,0===o&&t._state&&u(U,t)}function U(t){var n=t._subscribers,e=t._state;if(0!==n.length){for(var r=void 0,i=void 0,o=t._result,s=0;s<n.length;s+=3)r=n[s],i=n[s+e],r?W(e,r,i,o):i(o);t._subscribers.length=0}}function W(t,e,r,i){var o=n(r),s=void 0,u=void 0,a=!0;if(o){try{s=r(i)}catch(t){a=!1,u=t}if(e===s)return void K(e,D())}else s=i;e._state!==j||(o&&a?F(e,s):!1===a?K(e,u):t===T?Y(e,s):t===S&&K(e,s))}function B(t,n){try{n((function(n){F(t,n)}),(function(n){K(t,n)}))}catch(n){K(t,n)}}var G=0;function H(){return G++}function J(t){t[k]=G++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Q(){return new Error("Array Methods must be provided an Array")}var R=function(){function t(t,n){this._instanceConstructor=t,this.promise=new t(E),this.promise[k]||J(this.promise),r(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?Y(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&Y(this.promise,this._result))):K(this.promise,Q())}return t.prototype._enumerate=function(t){for(var n=0;this._state===j&&n<t.length;n++)this._eachEntry(t[n],n)},t.prototype._eachEntry=function(t,n){var e=this._instanceConstructor,r=e.resolve;if(r===M){var i=void 0,o=void 0,s=!1;try{i=t.then}catch(t){s=!0,o=t}if(i===N&&t._state!==j)this._settledAt(t._state,n,t._result);else if("function"!=typeof i)this._remaining--,this._result[n]=t;else if(e===et){var u=new e(E);s?K(u,o):C(u,t,i),this._willSettleAt(u,n)}else this._willSettleAt(new e((function(n){return n(t)})),n)}else this._willSettleAt(r(t),n)},t.prototype._settledAt=function(t,n,e){var r=this.promise;r._state===j&&(this._remaining--,t===S?K(r,e):this._result[n]=e),0===this._remaining&&Y(r,this._result)},t.prototype._willSettleAt=function(t,n){var e=this;L(t,void 0,(function(t){return e._settledAt(T,n,t)}),(function(t){return e._settledAt(S,n,t)}))},t}();function V(t){return new R(this,t).promise}function X(t){var n=this;return r(t)?new n((function(e,r){for(var i=t.length,o=0;o<i;o++)n.resolve(t[o]).then(e,r)})):new n((function(t,n){return n(new TypeError("You must pass an array to race."))}))}function Z(t){var n=new this(E);return K(n,t),n}function tt(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function nt(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var et=function(){function t(n){this[k]=H(),this._result=this._state=void 0,this._subscribers=[],E!==n&&("function"!=typeof n&&tt(),this instanceof t?B(this,n):nt())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this,r=e.constructor;return n(t)?e.then((function(n){return r.resolve(t()).then((function(){return n}))}),(function(n){return r.resolve(t()).then((function(){throw n}))})):e.then(t,t)},t}();function rt(){var t=void 0;if(void 0!==$)t=$;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var e=null;try{e=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===e&&!n.cast)return}t.Promise=et}return et.prototype.then=N,et.all=V,et.race=X,et.resolve=M,et.reject=Z,et._setScheduler=a,et._setAsap=c,et._asap=u,et.polyfill=rt,et.Promise=et,et}(),B.exports.polyfill(),self.onmessage=function(t){var n=G.apply(void 0,t.data);self.postMessage(n)},t.forceDirected=G,Object.defineProperty(t,"__esModule",{value:!0}),t}({});`;
|
|
34
|
+
const workerCode = `var forceDirected=function(t){"use strict";function n(t){return function(){return t}}function e(){return 1e-6*(Math.random()-.5)}function r(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,s,u,a,c,l,f,h,v=t._root,y={data:r},p=t._x0,_=t._y0,d=t._x1,g=t._y1;if(!v)return t._root=y,t;for(;v.length;)if((c=n>=(o=(p+d)/2))?p=o:d=o,(l=e>=(s=(_+g)/2))?_=s:g=s,i=v,!(v=v[f=l<<1|c]))return i[f]=y,t;if(u=+t._x.call(null,v.data),a=+t._y.call(null,v.data),n===u&&e===a)return y.next=v,i?i[f]=y:t._root=y,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+d)/2))?p=o:d=o,(l=e>=(s=(_+g)/2))?_=s:g=s}while((f=l<<1|c)==(h=(a>=s)<<1|u>=o));return i[h]=v,i[f]=y,t}function i(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function o(t){return t[0]}function s(t){return t[1]}function u(t,n,e){var r=new a(null==n?o:n,null==e?s:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function a(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function c(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var l=u.prototype=a.prototype;l.copy=function(){var t,n,e=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=c(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=c(n));return e},l.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return r(this.cover(n,e),n,e,t)},l.addAll=function(t){var n,e,i,o,s=t.length,u=new Array(s),a=new Array(s),c=1/0,l=1/0,f=-1/0,h=-1/0;for(e=0;e<s;++e)isNaN(i=+this._x.call(null,n=t[e]))||isNaN(o=+this._y.call(null,n))||(u[e]=i,a[e]=o,i<c&&(c=i),i>f&&(f=i),o<l&&(l=o),o>h&&(h=o));if(c>f||l>h)return this;for(this.cover(c,l).cover(f,h),e=0;e<s;++e)r(this,u[e],a[e],t[e]);return this},l.cover=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{for(var s,u,a=i-e,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(s=new Array(4))[u]=c,c=s,a*=2,u){case 0:i=e+a,o=r+a;break;case 1:e=i-a,o=r+a;break;case 2:i=e+a,r=o-a;break;case 3:e=i-a,r=o-a}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},l.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},l.extent=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]]},l.find=function(t,n,e){var r,o,s,u,a,c,l,f=this._x0,h=this._y0,v=this._x1,y=this._y1,p=[],_=this._root;for(_&&p.push(new i(_,f,h,v,y)),null==e?e=1/0:(f=t-e,h=n-e,v=t+e,y=n+e,e*=e);c=p.pop();)if(!(!(_=c.node)||(o=c.x0)>v||(s=c.y0)>y||(u=c.x1)<f||(a=c.y1)<h))if(_.length){var d=(o+u)/2,g=(s+a)/2;p.push(new i(_[3],d,g,u,a),new i(_[2],o,g,d,a),new i(_[1],d,s,u,g),new i(_[0],o,s,d,g)),(l=(n>=g)<<1|t>=d)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=c)}else{var x=t-+this._x.call(null,_.data),w=n-+this._y.call(null,_.data),m=x*x+w*w;if(m<e){var b=Math.sqrt(e=m);f=t-b,h=n-b,v=t+b,y=n+b,r=_.data}}return r},l.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var n,e,r,i,o,s,u,a,c,l,f,h,v=this._root,y=this._x0,p=this._y0,_=this._x1,d=this._y1;if(!v)return this;if(v.length)for(;;){if((c=o>=(u=(y+_)/2))?y=u:_=u,(l=s>=(a=(p+d)/2))?p=a:d=a,n=v,!(v=v[f=l<<1|c]))return this;if(!v.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,h=f)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(v=n[0]||n[1]||n[2]||n[3])&&v===(n[3]||n[2]||n[1]||n[0])&&!v.length&&(e?e[h]=v:this._root=v),this):(this._root=i,this)},l.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},l.root=function(){return this._root},l.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},l.visit=function(t){var n,e,r,o,s,u,a=[],c=this._root;for(c&&a.push(new i(c,this._x0,this._y0,this._x1,this._y1));n=a.pop();)if(!t(c=n.node,r=n.x0,o=n.y0,s=n.x1,u=n.y1)&&c.length){var l=(r+s)/2,f=(o+u)/2;(e=c[3])&&a.push(new i(e,l,f,s,u)),(e=c[2])&&a.push(new i(e,r,f,l,u)),(e=c[1])&&a.push(new i(e,l,o,s,f)),(e=c[0])&&a.push(new i(e,r,o,l,f))}return this},l.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new i(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var o=n.node;if(o.length){var s,u=n.x0,a=n.y0,c=n.x1,l=n.y1,f=(u+c)/2,h=(a+l)/2;(s=o[0])&&e.push(new i(s,u,a,f,h)),(s=o[1])&&e.push(new i(s,f,a,c,h)),(s=o[2])&&e.push(new i(s,u,h,f,l)),(s=o[3])&&e.push(new i(s,f,h,c,l))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y};function f(){}function h(t,n){var e=new f;if(t instanceof f)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i<o;)e.set(i,t[i]);else for(;++i<o;)e.set(n(r=t[i],i,t),r)}else if(t)for(var s in t)e.set(s,t[s]);return e}function v(){}f.prototype=h.prototype={constructor:f,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var y=h.prototype;function p(t){return t.index}function _(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}v.prototype=function(t,n){var e=new v;if(t instanceof v)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}.prototype={constructor:v,has:y.has,add:function(t){return this["$"+(t+="")]=t,this},remove:y.remove,clear:y.clear,values:y.keys,size:y.size,empty:y.empty,each:y.each};var d={value:function(){}};function g(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new x(r)}function x(t){this._=t}function w(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function m(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=d,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}x.prototype=g.prototype={constructor:x,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),s=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<u;)if(e=(t=o[s]).type)i[e]=m(i[e],t.name,n);else if(null==n)for(e in i)i[e]=m(i[e],t.name,null);return this}for(;++s<u;)if((e=(t=o[s]).type)&&(e=w(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new x(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var b,A,N=0,M=0,k=0,E=1e3,j=0,T=0,q=0,D="object"==typeof performance&&performance.now?performance:Date,S="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function $(){return T||(S(O),T=D.now()+q)}function O(){T=0}function P(){this._call=this._time=this._next=null}function z(t,n,e){var r=new P;return r.restart(t,n,e),r}function C(){T=(j=D.now())+q,N=M=0;try{!function(){$(),++N;for(var t,n=b;n;)(t=T-n._time)>=0&&n._call.call(null,t),n=n._next;--N}()}finally{N=0,function(){var t,n,e=b,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:b=n);A=t,I(r)}(),T=0}}function F(){var t=D.now(),n=t-j;n>E&&(q-=n,j=t)}function I(t){N||(M&&(M=clearTimeout(M)),t-T>24?(t<1/0&&(M=setTimeout(C,t-D.now()-q)),k&&(k=clearInterval(k))):(k||(j=D.now(),k=setInterval(F,E)),N=1,S(C)))}function Y(t){return t.x}function K(t){return t.y}P.prototype=z.prototype={constructor:P,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?$():+e)+(null==n?0:+n),this._next||A===this||(A?A._next=this:b=this,A=this),this._call=t,this._time=e,I()},stop:function(){this._call&&(this._call=null,this._time=1/0,I())}};var L=10,U=Math.PI*(3-Math.sqrt(5));var W="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function B(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var G,H;(function(t,n){t.exports=function(){function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},e=0,r=void 0,i=void 0,o=function(t,n){h[e]=t,h[e+1]=n,2===(e+=2)&&(i?i(v):g())},s="undefined"!=typeof window?window:void 0,u=s||{},a=u.MutationObserver||u.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<e;t+=2){var n=h[t],r=h[t+1];n(r),h[t]=void 0,h[t+1]=void 0}e=0}var y,p,_,d,g=void 0;function x(t,n){var e=this,r=new this.constructor(b);void 0===r[m]&&P(r);var i=e._state;if(i){var s=arguments[i-1];o(function(){return $(i,r,s,e._result)})}else D(e,r,t,n);return r}function w(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var n=new this(b);return E(n,t),n}c?g=function(){return process.nextTick(v)}:a?(p=0,_=new a(v),d=document.createTextNode(""),_.observe(d,{characterData:!0}),g=function(){d.data=p=++p%2}):l?((y=new MessageChannel).port1.onmessage=v,g=function(){return y.port2.postMessage(0)}):g=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(v)}:f()}catch(t){return f()}}():f();var m=Math.random().toString(36).substring(2);function b(){}var A=void 0,N=1,M=2;function k(n,e,r){e.constructor===n.constructor&&r===x&&e.constructor.resolve===w?function(t,n){n._state===N?T(t,n._result):n._state===M?q(t,n._result):D(n,void 0,function(n){return E(t,n)},function(n){return q(t,n)})}(n,e):void 0===r?T(n,e):t(r)?function(t,n,e){o(function(t){var r=!1,i=function(t,n,e,r){try{t.call(n,e,r)}catch(t){return t}}(e,n,function(e){r||(r=!0,n!==e?E(t,e):T(t,e))},function(n){r||(r=!0,q(t,n))},t._label);!r&&i&&(r=!0,q(t,i))},t)}(n,e,r):T(n,e)}function E(t,n){if(t===n)q(t,new TypeError("You cannot resolve a promise with itself"));else if(function(t){var n=typeof t;return null!==t&&("object"===n||"function"===n)}(n)){var e=void 0;try{e=n.then}catch(n){return void q(t,n)}k(t,n,e)}else T(t,n)}function j(t){t._onerror&&t._onerror(t._result),S(t)}function T(t,n){t._state===A&&(t._result=n,t._state=N,0!==t._subscribers.length&&o(S,t))}function q(t,n){t._state===A&&(t._state=M,t._result=n,o(j,t))}function D(t,n,e,r){var i=t._subscribers,s=i.length;t._onerror=null,i[s]=n,i[s+N]=e,i[s+M]=r,0===s&&t._state&&o(S,t)}function S(t){var n=t._subscribers,e=t._state;if(0!==n.length){for(var r=void 0,i=void 0,o=t._result,s=0;s<n.length;s+=3)r=n[s],i=n[s+e],r?$(e,r,i,o):i(o);t._subscribers.length=0}}function $(n,e,r,i){var o=t(r),s=void 0,u=void 0,a=!0;if(o){try{s=r(i)}catch(t){a=!1,u=t}if(e===s)return void q(e,new TypeError("A promises callback cannot return that same promise."))}else s=i;e._state!==A||(o&&a?E(e,s):!1===a?q(e,u):n===N?T(e,s):n===M&&q(e,s))}var O=0;function P(t){t[m]=O++,t._state=void 0,t._result=void 0,t._subscribers=[]}var z=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(b),this.promise[m]||P(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?T(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&T(this.promise,this._result))):q(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var n=0;this._state===A&&n<t.length;n++)this._eachEntry(t[n],n)},t.prototype._eachEntry=function(t,n){var e=this._instanceConstructor,r=e.resolve;if(r===w){var i=void 0,o=void 0,s=!1;try{i=t.then}catch(t){s=!0,o=t}if(i===x&&t._state!==A)this._settledAt(t._state,n,t._result);else if("function"!=typeof i)this._remaining--,this._result[n]=t;else if(e===C){var u=new e(b);s?q(u,o):k(u,t,i),this._willSettleAt(u,n)}else this._willSettleAt(new e(function(n){return n(t)}),n)}else this._willSettleAt(r(t),n)},t.prototype._settledAt=function(t,n,e){var r=this.promise;r._state===A&&(this._remaining--,t===M?q(r,e):this._result[n]=e),0===this._remaining&&T(r,this._result)},t.prototype._willSettleAt=function(t,n){var e=this;D(t,void 0,function(t){return e._settledAt(N,n,t)},function(t){return e._settledAt(M,n,t)})},t}(),C=function(){function n(t){this[m]=O++,this._result=this._state=void 0,this._subscribers=[],b!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof n?function(t,n){try{n(function(n){E(t,n)},function(n){q(t,n)})}catch(n){q(t,n)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return n.prototype.catch=function(t){return this.then(null,t)},n.prototype.finally=function(n){var e=this.constructor;return t(n)?this.then(function(t){return e.resolve(n()).then(function(){return t})},function(t){return e.resolve(n()).then(function(){throw t})}):this.then(n,n)},n}();return C.prototype.then=x,C.all=function(t){return new z(this,t).promise},C.race=function(t){var e=this;return n(t)?new e(function(n,r){for(var i=t.length,o=0;o<i;o++)e.resolve(t[o]).then(n,r)}):new e(function(t,n){return n(new TypeError("You must pass an array to race."))})},C.resolve=w,C.reject=function(t){var n=new this(b);return q(n,t),n},C._setScheduler=function(t){i=t},C._setAsap=function(t){o=t},C._asap=o,C.polyfill=function(){var t=void 0;if(void 0!==W)t=W;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var e=null;try{e=Object.prototype.toString.call(n.resolve())}catch(t){}if("[object Promise]"===e&&!n.cast)return}t.Promise=C},C.Promise=C,C}()}(H={path:G,exports:{},require:function(t,n){return B(null==n&&H.path)}},H.exports),H.exports).polyfill();function J(t,r){var i=t.nodes,o=t.links,s=function(t){var r,i,o,s,u,a=p,c=function(t){return 1/Math.min(s[t.source.index],s[t.target.index])},l=n(30),f=1;function v(n){for(var o=0,s=t.length;o<f;++o)for(var a,c,l,h,v,y,p,_=0;_<s;++_)c=(a=t[_]).source,h=(l=a.target).x+l.vx-c.x-c.vx||e(),v=l.y+l.vy-c.y-c.vy||e(),h*=y=((y=Math.sqrt(h*h+v*v))-i[_])/y*n*r[_],v*=y,l.vx-=h*(p=u[_]),l.vy-=v*p,c.vx+=h*(p=1-p),c.vy+=v*p}function y(){if(o){var n,e,c=o.length,l=t.length,f=h(o,a);for(n=0,s=new Array(c);n<l;++n)(e=t[n]).index=n,"object"!=typeof e.source&&(e.source=_(f,e.source)),"object"!=typeof e.target&&(e.target=_(f,e.target)),s[e.source.index]=(s[e.source.index]||0)+1,s[e.target.index]=(s[e.target.index]||0)+1;for(n=0,u=new Array(l);n<l;++n)e=t[n],u[n]=s[e.source.index]/(s[e.source.index]+s[e.target.index]);r=new Array(l),d(),i=new Array(l),g()}}function d(){if(o)for(var n=0,e=t.length;n<e;++n)r[n]=+c(t[n],n,t)}function g(){if(o)for(var n=0,e=t.length;n<e;++n)i[n]=+l(t[n],n,t)}return null==t&&(t=[]),v.initialize=function(t){o=t,y()},v.links=function(n){return arguments.length?(t=n,y(),v):t},v.id=function(t){return arguments.length?(a=t,v):a},v.iterations=function(t){return arguments.length?(f=+t,v):f},v.strength=function(t){return arguments.length?(c="function"==typeof t?t:n(+t),d(),v):c},v.distance=function(t){return arguments.length?(l="function"==typeof t?t:n(+t),g(),v):l},v}(o).id(function(t){return t.id}).distance(r.linkDistance).strength(r.linkStrength),a=function(){var t,r,i,o,s=n(-30),a=1,c=1/0,l=.81;function f(n){var e,o=t.length,s=u(t,Y,K).visitAfter(v);for(i=n,e=0;e<o;++e)r=t[e],s.visit(y)}function h(){if(t){var n,e,r=t.length;for(o=new Array(r),n=0;n<r;++n)e=t[n],o[e.index]=+s(e,n,t)}}function v(t){var n,e,r,i,s,u=0,a=0;if(t.length){for(r=i=s=0;s<4;++s)(n=t[s])&&(e=Math.abs(n.value))&&(u+=n.value,a+=e,r+=e*n.x,i+=e*n.y);t.x=r/a,t.y=i/a}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=o[n.data.index]}while(n=n.next)}t.value=u}function y(t,n,s,u){if(!t.value)return!0;var f=t.x-r.x,h=t.y-r.y,v=u-n,y=f*f+h*h;if(v*v/l<y)return y<c&&(0===f&&(y+=(f=e())*f),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)),r.vx+=f*t.value*i/y,r.vy+=h*t.value*i/y),!0;if(!(t.length||y>=c)){(t.data!==r||t.next)&&(0===f&&(y+=(f=e())*f),0===h&&(y+=(h=e())*h),y<a&&(y=Math.sqrt(a*y)));do{t.data!==r&&(v=o[t.data.index]*i/y,r.vx+=f*v,r.vy+=h*v)}while(t=t.next)}}return f.initialize=function(n){t=n,h()},f.strength=function(t){return arguments.length?(s="function"==typeof t?t:n(+t),h(),f):s},f.distanceMin=function(t){return arguments.length?(a=t*t,f):Math.sqrt(a)},f.distanceMax=function(t){return arguments.length?(c=t*t,f):Math.sqrt(c)},f.theta=function(t){return arguments.length?(l=t*t,f):Math.sqrt(l)},f}().strength(r.repulsionStrength);return function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,s=.6,u=h(),a=z(l),c=g("tick","end");function l(){f(),c.call("tick",n),e<r&&(a.stop(),c.call("end",n))}function f(r){var a,c,l=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(e+=(o-e)*i,u.each(function(t){t(e)}),a=0;a<l;++a)null==(c=t[a]).fx?c.x+=c.vx*=s:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=s:(c.y=c.fy,c.vy=0);return n}function v(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=L*Math.sqrt(e),o=e*U;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function y(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),v(),n={tick:f,restart:function(){return a.restart(l),n},stop:function(){return a.stop(),n},nodes:function(e){return arguments.length?(t=e,v(),u.each(y),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(s=1-t,n):1-s},force:function(t,e){return arguments.length>1?(null==e?u.remove(t):u.set(t,y(e)),n):u.get(t)},find:function(n,e,r){var i,o,s,u,a,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(s=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(a=u,r=s);return a},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(i).force("link",s).force("charge",a).force("center",function(t,n){var e;function r(){var r,i,o=e.length,s=0,u=0;for(r=0;r<o;++r)s+=(i=e[r]).x,u+=i.y;for(s=s/o-t,u=u/o-n,r=0;r<o;++r)(i=e[r]).x-=s,i.y-=u}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r}()).alpha(r.alpha).alphaMin(r.alphaMin).alphaDecay(r.alphaDecay).velocityDecay(r.velocityDecay).stop().tick(r.iterations),{nodes:i,links:o}}return self.onmessage=function(t){var n=J.apply(void 0,t.data);self.postMessage(n)},t.forceDirected=J,t}({});`;
|
|
42
35
|
|
|
43
36
|
const workerBlob = new Blob([workerCode], { type: "application/javascript" });
|
|
44
37
|
const workerUrl = URL.createObjectURL(workerBlob);
|