@antv/layout 1.2.1 → 1.2.2
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/0229766b7896aada2515.worker.js +2 -0
- package/dist/0229766b7896aada2515.worker.js.map +1 -0
- package/dist/index.min.js +1 -2
- package/dist/index.min.js.map +1 -1
- package/lib/bundle-entry.d.ts +18 -0
- package/lib/bundle-entry.js +19 -0
- package/lib/bundle-entry.js.map +1 -0
- package/lib/bundle-supervisor.d.ts +51 -0
- package/lib/bundle-supervisor.js +93 -0
- package/lib/bundle-supervisor.js.map +1 -0
- package/lib/bundle-worker.d.ts +3 -0
- package/lib/bundle-worker.js +53 -0
- package/lib/bundle-worker.js.map +1 -0
- package/lib/supervisor.js +1 -10
- package/lib/supervisor.js.map +1 -1
- package/package.json +5 -2
- package/dist/11.index.min.js +0 -2
- package/dist/11.index.min.js.map +0 -1
- package/dist/435.index.min.js +0 -3
- package/dist/435.index.min.js.LICENSE.txt +0 -5
- package/dist/435.index.min.js.map +0 -1
- package/dist/index.min.js.LICENSE.txt +0 -5
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{calculateLayout:()=>Ln,stopLayout:()=>qn});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},n=function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};function o(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function i(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function a(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function u(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}Object.create,Object.create;const h=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],a=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var a=n[i],s=a.callback;a.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),s.apply(e,r)}};a(o),a(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function d(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function l(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&l(o,e,r,n))return!0;return!1}class c extends h{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.find((e=>e.type===t.type&&e.id===t.id&&e.propertyName===t.propertyName));r?r.newValue=t.newValue:e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),r=this.bothEdgesMap.get(t);r?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){return this.checkNodeExistence(t),this.checkTreeExistence(e),this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r),o=this.getNode(t),i=n.parentMap.get(t),a=this.getNode(e);n.parentMap.set(t,a),i&&n.childrenMap.get(i.id)?.delete(o);let s=n.childrenMap.get(a.id);s||(s=new Set,n.childrenMap.set(a.id,s)),s.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:a.id})}))}dfsTree(t,e,r){return l(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return d([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return d([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return l(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new c({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}}const f=function(t){return"function"==typeof t};var g={}.toString;const p=function(t,e){return g.call(t)==="[object "+e+"]"},v=function(t){return p(t,"Number")},y=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};var m=Array.isArray;function w(t,e){return f(e)?e:v(e)?function(){return e}:function(){return t}}function x(t,e,r){return void 0===r&&(r=!0),e||0===e?f(e)?e:v(e)?function(){return e}:m(e)?function(){if(r){var n=Math.max.apply(Math,u([],s(e)));return isNaN(n)?t:n}return e}:y(e)?function(){if(r){var n=Math.max(e.width,e.height);return isNaN(n)?t:n}return[e.width,e.height]}:function(){return t}:function(e){var r=(e.data||{}).size;return r?m(r)?r[0]>r[1]?r[0]:r[1]:y(r)?r.width>r.height?r.width:r.height:r:t}}var E=function(t,e){var r;return r=v(e)?function(){return e}:f(e)?e:function(){return 0},t?m(t)?function(e){return(t[0]>t[1]?t[0]:t[1])+r(e)}:function(e){return t+r(e)}:function(t){var e,n;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+r(t);if(null===(n=t.data)||void 0===n?void 0:n.size){if(m(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+r(t);var o=t.data.size;return y(o)?(o.width>o.height?o.width:o.height)+r(t):o+r(t)}return 10+r(t)}},N=function(t){if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){var e=[];return t.forEach((function(t){e.push(t)})),e.map((function(t){return N(t)}))}if("object"==typeof t){var r={};return Object.keys(t).forEach((function(e){r[e]=N(t[e])})),r}return t},b=function(t,e){var r=N(t);return r.data=r.data||{},e&&(v(r.data.x)||(r.data.x=Math.random()*e[0]),v(r.data.y)||(r.data.y=Math.random()*e[1])),r},M=function(t,e,r){var o=t.getAllNodes(),i=t.getAllEdges();return(null==o?void 0:o.length)?1===o.length?(e&&t.mergeNodeData(o[0].id,{x:r[0],y:r[1]}),{nodes:[n(n({},o[0]),{data:n(n({},o[0].data),{x:r[0],y:r[1]})})],edges:i}):void 0:{nodes:[],edges:i}},S={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1},k=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="circular",this.options=n(n({},S),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericCircularLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return[4,this.genericCircularLayout(!0,t,e)];case 1:return r.sent(),[2]}}))}))},t.prototype.genericCircularLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,u,h,d,l,c,f,g,p,v,y,m,E,N,S,k,z,R,I,D,O,P,T,C,q,L,j,F,V,B,G,W,$,U;return a(this,(function(a){if(o=n(n({},this.options),r),i=o.width,u=o.height,h=o.center,d=o.divisions,l=o.startAngle,c=void 0===l?0:l,f=o.endAngle,g=void 0===f?2*Math.PI:f,p=o.angleRatio,v=o.ordering,y=o.clockwise,m=o.nodeSpacing,E=o.nodeSize,N=e.getAllNodes(),S=e.getAllEdges(),k=s(_(i,u,h),3),z=k[0],R=k[1],I=k[2],!(D=null==N?void 0:N.length)||1===D)return[2,M(e,t,I)];for(O=(g-c)/D,P=o.radius,T=o.startRadius,C=o.endRadius,m?(q=w(10,m),L=x(10,E),j=-1/0,N.forEach((function(t){var e=L(t);j<e&&(j=e)})),F=0,N.forEach((function(t,e){F+=0===e?j||10:(q(t)||0)+(j||10)})),P=F/(2*Math.PI)):P||T||C?!T&&C?T=C:T&&!C&&(C=T):P=Math.min(R,z)/2,V=O*p,B=[],B="topology"===v?A(e,N):"topology-directed"===v?A(e,N,!0):"degree"===v?function(t,e){var r=[];return e.forEach((function(t,e){r.push(b(t))})),r.sort((function(e,r){return t.getDegree(e.id,"both")-t.getDegree(r.id,"both")})),r}(e,N):N.map((function(t){return b(t)})),G=Math.ceil(D/d),W=0;W<D;++W)($=P)||null===T||null===C||($=T+W*(C-T)/(D-1)),$||($=10+100*W/(D-1)),U=c+W%G*V+2*Math.PI/d*Math.floor(W/G),y||(U=g-W%G*V-2*Math.PI/d*Math.floor(W/G)),B[W].data.x=I[0]+Math.cos(U)*$,B[W].data.y=I[1]+Math.sin(U)*$;return t&&B.forEach((function(t){e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,{nodes:B,edges:S}]}))}))},t}(),A=function(t,e,r){void 0===r&&(r=!1);var n=[b(e[0])],o={},i=e.length;o[e[0].id]=!0;var a=0;return e.forEach((function(s,u){if(0!==u)if(u!==i-1&&t.getDegree(s.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[a].id,s.id)||o[s.id]){for(var h=r?t.getSuccessors(n[a].id):t.getNeighbors(n[a].id),d=!1,l=0;l<h.length;l++){var c=h[l];if(t.getDegree(c.id)===t.getDegree(s.id)&&!o[c.id]){n.push(b(c)),o[c.id]=!0,d=!0;break}}for(var f=0;!d&&(o[e[f].id]||(n.push(b(e[f])),o[e[f].id]=!0,d=!0),++f!==i););}else n.push(b(s)),o[s.id]=!0,a++})),n},_=function(t,e,r){var n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]};const z=function(t){return p(t,"String")};var R={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"},I=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="concentric",this.options=n(n({},R),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericConcentricLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericConcentricLayout(!0,t,e),[2]}))}))},t.prototype.genericConcentricLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,c,g,p,w,x,E,N,S,k,A,_,R,I,D,O,P,T,C,q,L,j,F,V,B,G,W,$,U,H,K,Y;return a(this,(function(a){if(o=n(n({},this.options),r),i=o.center,s=o.width,u=o.height,h=o.sortBy,d=o.maxLevelDiff,l=o.sweep,c=o.clockwise,g=o.equidistant,p=o.preventOverlap,w=o.startAngle,x=void 0===w?1.5*Math.PI:w,E=o.nodeSize,N=o.nodeSpacing,S=e.getAllNodes(),k=e.getAllEdges(),A=s||"undefined"==typeof window?s:window.innerWidth,_=u||"undefined"==typeof window?u:window.innerHeight,R=i||[A/2,_/2],!(null==S?void 0:S.length)||1===S.length)return[2,M(e,t,R)];if(I=[],O=0,D=m(E)?Math.max(E[0],E[1]):E,m(N)?O=Math.max(N[0],N[1]):v(N)&&(O=N),S.forEach((function(t){var e=b(t);I.push(e);var r=D,n=e.data;m(n.size)?r=Math.max(n.size[0],n.size[1]):v(n.size)?r=n.size:y(n.size)&&(r=Math.max(n.size.width,n.size.height)),D=Math.max(D,r),f(N)&&(O=Math.max(N(t),O))})),P={},I.forEach((function(t,e){P[t.id]=e})),z(T=h)&&void 0!==I[0].data[T]||(T="degree"),"degree"===T?I.sort((function(t,r){return e.getDegree(r.id,"both")-e.getDegree(t.id,"both")})):I.sort((function(t,e){return e.data[T]-t.data[T]})),C=I[0],q=(d||("degree"===T?e.getDegree(C.id,"both"):C.data[T]))/4,j=(L=[{nodes:[]}])[0],I.forEach((function(t){if(j.nodes.length>0){var r="degree"===T?Math.abs(e.getDegree(j.nodes[0].id,"both")-e.getDegree(t.id,"both")):Math.abs(j.nodes[0].data[T]-t.data[T]);q&&r>=q&&(j={nodes:[]},L.push(j))}j.nodes.push(t)})),F=D+O,p||(V=L.length>0&&L[0].nodes.length>1,B=Math.min(A,_)/2-F,G=B/(L.length+(V?1:0)),F=Math.min(F,G)),W=0,L.forEach((function(t){var e=void 0===l?2*Math.PI-2*Math.PI/t.nodes.length:l;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&p){var r=Math.cos(t.dTheta)-Math.cos(0),n=Math.sin(t.dTheta)-Math.sin(0),o=Math.sqrt(F*F/(r*r+n*n));W=Math.max(o,W)}t.r=W,W+=F})),g){for($=0,U=0,H=0;H<L.length;H++)K=L[H],Y=(K.r||0)-U,$=Math.max($,Y);U=0,L.forEach((function(t,e){0===e&&(U=t.r||0),t.r=U,U+=$}))}return L.forEach((function(t){var e=t.dTheta||0,r=t.r||0;t.nodes.forEach((function(t,n){var o=x+(c?1:-1)*e*n;t.data.x=R[0]+r*Math.cos(o),t.data.y=R[1]+r*Math.sin(o)}))})),t&&I.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,{nodes:I,edges:k}]}))}))},t}();function D(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,a,s,u,h,d,l,c,f=t._root,g={data:n},p=t._x0,v=t._y0,y=t._x1,m=t._y1;if(!f)return t._root=g,t;for(;f.length;)if((h=e>=(i=(p+y)/2))?p=i:y=i,(d=r>=(a=(v+m)/2))?v=a:m=a,o=f,!(f=f[l=d<<1|h]))return o[l]=g,t;if(s=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===s&&r===u)return g.next=f,o?o[l]=g:t._root=g,t;do{o=o?o[l]=new Array(4):t._root=new Array(4),(h=e>=(i=(p+y)/2))?p=i:y=i,(d=r>=(a=(v+m)/2))?v=a:m=a}while((l=d<<1|h)==(c=(u>=a)<<1|s>=i));return o[c]=f,o[l]=g,t}function O(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function P(t){return t[0]}function T(t){return t[1]}function C(t,e,r){var n=new q(null==e?P:e,null==r?T:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function q(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function L(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var j=C.prototype=q.prototype;function F(t){return function(){return t}}function V(t){return 1e-6*(t()-.5)}j.copy=function(){var t,e,r=new q(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=L(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=L(e));return r},j.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return D(this.cover(e,r),e,r,t)},j.addAll=function(t){var e,r,n,o,i=t.length,a=new Array(i),s=new Array(i),u=1/0,h=1/0,d=-1/0,l=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(a[r]=n,s[r]=o,n<u&&(u=n),n>d&&(d=n),o<h&&(h=o),o>l&&(l=o));if(u>d||h>l)return this;for(this.cover(u,h).cover(d,l),r=0;r<i;++r)D(this,a[r],s[r],t[r]);return this},j.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var a,s,u=o-r||1,h=this._root;r>t||t>=o||n>e||e>=i;)switch(s=(e<n)<<1|t<r,(a=new Array(4))[s]=h,h=a,u*=2,s){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},j.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},j.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]]},j.find=function(t,e,r){var n,o,i,a,s,u,h,d=this._x0,l=this._y0,c=this._x1,f=this._y1,g=[],p=this._root;for(p&&g.push(new O(p,d,l,c,f)),null==r?r=1/0:(d=t-r,l=e-r,c=t+r,f=e+r,r*=r);u=g.pop();)if(!(!(p=u.node)||(o=u.x0)>c||(i=u.y0)>f||(a=u.x1)<d||(s=u.y1)<l))if(p.length){var v=(o+a)/2,y=(i+s)/2;g.push(new O(p[3],v,y,a,s),new O(p[2],o,y,v,s),new O(p[1],v,i,a,y),new O(p[0],o,i,v,y)),(h=(e>=y)<<1|t>=v)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=u)}else{var m=t-+this._x.call(null,p.data),w=e-+this._y.call(null,p.data),x=m*m+w*w;if(x<r){var E=Math.sqrt(r=x);d=t-E,l=e-E,c=t+E,f=e+E,n=p.data}}return n},j.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,r,n,o,i,a,s,u,h,d,l,c,f=this._root,g=this._x0,p=this._y0,v=this._x1,y=this._y1;if(!f)return this;if(f.length)for(;;){if((h=i>=(s=(g+v)/2))?g=s:v=s,(d=a>=(u=(p+y)/2))?p=u:y=u,e=f,!(f=f[l=d<<1|h]))return this;if(!f.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(r=e,c=l)}for(;f.data!==t;)if(n=f,!(f=f.next))return this;return(o=f.next)&&delete f.next,n?(o?n.next=o:delete n.next,this):e?(o?e[l]=o:delete e[l],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[c]=f:this._root=f),this):(this._root=o,this)},j.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},j.root=function(){return this._root},j.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},j.visit=function(t){var e,r,n,o,i,a,s=[],u=this._root;for(u&&s.push(new O(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,a=e.y1)&&u.length){var h=(n+i)/2,d=(o+a)/2;(r=u[3])&&s.push(new O(r,h,d,i,a)),(r=u[2])&&s.push(new O(r,n,d,h,a)),(r=u[1])&&s.push(new O(r,h,o,i,d)),(r=u[0])&&s.push(new O(r,n,o,h,d))}return this},j.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new O(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,a=e.x0,s=e.y0,u=e.x1,h=e.y1,d=(a+u)/2,l=(s+h)/2;(i=o[0])&&r.push(new O(i,a,s,d,l)),(i=o[1])&&r.push(new O(i,d,s,u,l)),(i=o[2])&&r.push(new O(i,a,l,d,h)),(i=o[3])&&r.push(new O(i,d,l,u,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},j.x=function(t){return arguments.length?(this._x=t,this):this._x},j.y=function(t){return arguments.length?(this._y=t,this):this._y};var B={value:()=>{}};function G(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new W(n)}function W(t){this._=t}function $(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function U(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=B,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}W.prototype=G.prototype={constructor:W,on:function(t,e){var r,n,o=this._,i=(n=o,(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}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(r=(t=i[a]).type)o[r]=U(o[r],t.name,e);else if(null==e)for(r in o)o[r]=U(o[r],t.name,null);return this}for(;++a<s;)if((r=(t=i[a]).type)&&(r=$(o[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new W(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};const H=G;var K,Y,J=0,X=0,Q=0,Z=1e3,tt=0,et=0,rt=0,nt="object"==typeof performance&&performance.now?performance:Date,ot="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function it(){return et||(ot(at),et=nt.now()+rt)}function at(){et=0}function st(){this._call=this._time=this._next=null}function ut(t,e,r){var n=new st;return n.restart(t,e,r),n}function ht(){et=(tt=nt.now())+rt,J=X=0;try{!function(){it(),++J;for(var t,e=K;e;)(t=et-e._time)>=0&&e._call.call(void 0,t),e=e._next;--J}()}finally{J=0,function(){for(var t,e,r=K,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:K=e);Y=t,lt(n)}(),et=0}}function dt(){var t=nt.now(),e=t-tt;e>Z&&(rt-=e,tt=t)}function lt(t){J||(X&&(X=clearTimeout(X)),t-et>24?(t<1/0&&(X=setTimeout(ht,t-nt.now()-rt)),Q&&(Q=clearInterval(Q))):(Q||(tt=nt.now(),Q=setInterval(dt,Z)),J=1,ot(ht)))}st.prototype=ut.prototype={constructor:st,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?it():+r)+(null==e?0:+e),this._next||Y===this||(Y?Y._next=this:K=this,Y=this),this._call=t,this._time=r,lt()},stop:function(){this._call&&(this._call=null,this._time=1/0,lt())}};const ct=1664525,ft=1013904223,gt=4294967296;function pt(t){return t.x}function vt(t){return t.y}var yt=10,mt=Math.PI*(3-Math.sqrt(5));function wt(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,a=.6,s=new Map,u=ut(l),h=H("tick","end"),d=function(){let t=1;return()=>(t=(ct*t+ft)%gt)/gt}();function l(){c(),h.call("tick",e),r<n&&(u.stop(),h.call("end",e))}function c(n){var u,h,d=t.length;void 0===n&&(n=1);for(var l=0;l<n;++l)for(r+=(i-r)*o,s.forEach((function(t){t(r)})),u=0;u<d;++u)null==(h=t[u]).fx?h.x+=h.vx*=a:(h.x=h.fx,h.vx=0),null==h.fy?h.y+=h.vy*=a:(h.y=h.fy,h.vy=0);return e}function f(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=yt*Math.sqrt(.5+r),i=r*mt;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,d),e}return null==t&&(t=[]),f(),e={tick:c,restart:function(){return u.restart(l),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,f(),s.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(d=t,s.forEach(g),e):d},force:function(t,r){return arguments.length>1?(null==r?s.delete(t):s.set(t,g(r)),e):s.get(t)},find:function(e,r,n){var o,i,a,s,u,h=0,d=t.length;for(null==n?n=1/0:n*=n,h=0;h<d;++h)(a=(o=e-(s=t[h]).x)*o+(i=r-s.y)*i)<n&&(u=s,n=a);return u},on:function(t,r){return arguments.length>1?(h.on(t,r),e):h.on(t)}}}function xt(){var t,e,r,n,o,i=F(-30),a=1,s=1/0,u=.81;function h(r){var o,i=t.length,a=C(t,pt,vt).visitAfter(l);for(n=r,o=0;o<i;++o)e=t[o],a.visit(c)}function d(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function l(t){var e,r,n,i,a,s=0,u=0;if(t.length){for(n=i=a=0;a<4;++a)(e=t[a])&&(r=Math.abs(e.value))&&(s+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=o[e.data.index]}while(e=e.next)}t.value=s}function c(t,i,h,d){if(!t.value)return!0;var l=t.x-e.x,c=t.y-e.y,f=d-i,g=l*l+c*c;if(f*f/u<g)return g<s&&(0===l&&(g+=(l=V(r))*l),0===c&&(g+=(c=V(r))*c),g<a&&(g=Math.sqrt(a*g)),e.vx+=l*t.value*n/g,e.vy+=c*t.value*n/g),!0;if(!(t.length||g>=s)){(t.data!==e||t.next)&&(0===l&&(g+=(l=V(r))*l),0===c&&(g+=(c=V(r))*c),g<a&&(g=Math.sqrt(a*g)));do{t.data!==e&&(f=o[t.data.index]*n/g,e.vx+=l*f,e.vy+=c*f)}while(t=t.next)}}return h.initialize=function(e,n){t=e,r=n,d()},h.strength=function(t){return arguments.length?(i="function"==typeof t?t:F(+t),d(),h):i},h.distanceMin=function(t){return arguments.length?(a=t*t,h):Math.sqrt(a)},h.distanceMax=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.theta=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h}function Et(t){return t.index}function Nt(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function bt(t){var e,r,n,o,i,a,s=Et,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},h=F(30),d=1;function l(n){for(var o=0,s=t.length;o<d;++o)for(var u,h,l,c,f,g,p,v=0;v<s;++v)h=(u=t[v]).source,c=(l=u.target).x+l.vx-h.x-h.vx||V(a),f=l.y+l.vy-h.y-h.vy||V(a),c*=g=((g=Math.sqrt(c*c+f*f))-r[v])/g*n*e[v],f*=g,l.vx-=c*(p=i[v]),l.vy-=f*p,h.vx+=c*(p=1-p),h.vy+=f*p}function c(){if(n){var a,u,h=n.length,d=t.length,l=new Map(n.map(((t,e)=>[s(t,e,n),t])));for(a=0,o=new Array(h);a<d;++a)(u=t[a]).index=a,"object"!=typeof u.source&&(u.source=Nt(l,u.source)),"object"!=typeof u.target&&(u.target=Nt(l,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(a=0,i=new Array(d);a<d;++a)u=t[a],i[a]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(d),f(),r=new Array(d),g()}}function f(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),l.initialize=function(t,e){n=t,a=e,c()},l.links=function(e){return arguments.length?(t=e,c(),l):t},l.id=function(t){return arguments.length?(s=t,l):s},l.iterations=function(t){return arguments.length?(d=+t,l):d},l.strength=function(t){return arguments.length?(u="function"==typeof t?t:F(+t),f(),l):u},l.distance=function(t){return arguments.length?(h="function"==typeof t?t:F(+t),g(),l):h},l}function Mt(t){return t.x+t.vx}function St(t){return t.y+t.vy}function kt(t){var e,r,n,o=1,i=1;function a(){for(var t,a,u,h,d,l,c,f=e.length,g=0;g<i;++g)for(a=C(e,Mt,St).visitAfter(s),t=0;t<f;++t)u=e[t],l=r[u.index],c=l*l,h=u.x+u.vx,d=u.y+u.vy,a.visit(p);function p(t,e,r,i,a){var s=t.data,f=t.r,g=l+f;if(!s)return e>h+g||i<h-g||r>d+g||a<d-g;if(s.index>u.index){var p=h-s.x-s.vx,v=d-s.y-s.vy,y=p*p+v*v;y<g*g&&(0===p&&(y+=(p=V(n))*p),0===v&&(y+=(v=V(n))*v),y=(g-(y=Math.sqrt(y)))/y*o,u.vx+=(p*=y)*(g=(f*=f)/(c+f)),u.vy+=(v*=y)*g,s.vx-=p*(g=1-g),s.vy-=v*g)}}}function s(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=F(null==t?1:+t)),a.initialize=function(t,r){e=t,n=r,u()},a.iterations=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(o=+t,a):o},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:F(+e),u(),a):t},a}function At(t){var e,r,n,o=F(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=F(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:F(+t),a(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:F(+e),a(),i):t},i}function _t(t){var e,r,n,o=F(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=F(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:F(+t),a(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:F(+e),a(),i):t},i}function zt(){function t(t){return function(){return t}}var e,r=function(t){return t.cluster},n=t(1),o=t(-1),i=t(100),a=t(.1),u=[0,0],h=[],d={},l=[],c=100,f=100,g={none:{x:0,y:0}},p=[],v="force",y=!0,m=.1;function w(t){if(!y)return w;e.tick(),E();for(var n=0,o=h.length,i=void 0,a=t*m;n<o;++n)(i=h[n]).vx+=(g[r(i)].x-i.x)*a,i.vy+=(g[r(i)].y-i.y)*a}function x(){h&&function(){if(h&&h.length){if(void 0===r(h[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInBox.groupBy('clusterAttr') before calling .links()");var t,u,g,v,y,m=(t=[],u=[],g={},{},y=[],v=function(t){var e={};return t.forEach((function(t){var n=r(t);e[n]||(e[n]={count:0,sumforceNodeSize:0})})),t.forEach((function(t){var o=r(t),i=n(t),a=e[o];a.count=a.count+1,a.sumforceNodeSize=a.sumforceNodeSize+Math.PI*(i*i)*1.3,e[o]=a})),e}(h),y=function(t){var e={},n=[];return t.forEach((function(t){var n,o,i,a,s,u=(o=(n=t).source,i=n.target,(a=r(d[o]))<=(s=r(d[i]))?a+"~"+s:s+"~"+a),h=0;void 0!==e[u]&&(h=e[u]),h+=1,e[u]=h})),Object.entries(e).forEach((function(t){var e=s(t,2),r=e[0],o=e[1],i=r.split("~")[0],a=r.split("~")[1];void 0!==i&&void 0!==a&&n.push({source:i,target:a,count:o})})),n}(l),Object.keys(v).forEach((function(e,r){var n=v[e];t.push({id:e,size:n.count,r:Math.sqrt(n.sumforceNodeSize/Math.PI)}),g[e]=r})),y.forEach((function(t){var e=t.source,r=t.target,n=g[e],o=g[r];void 0!==n&&void 0!==o&&u.push({source:n,target:o,count:t.count})})),{nodes:t,links:u});e=wt(m.nodes).force("x",At(c).strength(.1)).force("y",_t(f).strength(.1)).force("collide",kt((function(t){return t.r})).iterations(4)).force("charge",xt().strength(o)).force("links",bt(m.nodes.length?m.links:[]).distance(i).strength(a)),p=e.nodes(),E()}}()}function E(){return g={none:{x:0,y:0}},p.forEach((function(t){g[t.id]={x:t.x-u[0],y:t.y-u[1]}})),g}return w.initialize=function(t){h=t,x()},w.template=function(t){return arguments.length?(v=t,x(),w):v},w.groupBy=function(t){return arguments.length?"string"==typeof t?(r=function(e){return e[t]},w):(r=t,w):r},w.enableGrouping=function(t){return arguments.length?(y=t,w):y},w.strength=function(t){return arguments.length?(m=t,w):m},w.centerX=function(t){return arguments.length?(c=t,w):c},w.centerY=function(t){return arguments.length?(f=t,w):f},w.nodes=function(t){return arguments.length?(function(t){d={},t.forEach((function(t){d[t.id]=t}))}(t||[]),h=t||[],w):h},w.links=function(t){return arguments.length?(l=t||[],x(),w):l},w.forceNodeSize=function(e){return arguments.length?(n="function"==typeof e?e:t(+e),x(),w):n},w.nodeSize=w.forceNodeSize,w.forceCharge=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),x(),w):o},w.forceLinkDistance=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),x(),w):i},w.forceLinkStrength=function(e){return arguments.length?(a="function"==typeof e?e:t(+e),x(),w):a},w.offset=function(t){return arguments.length?(u=t,w):u},w.getFocis=E,w}var Rt={center:[0,0],preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10},It=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="d3force",this.options=n(n({},Rt),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericForceLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericForceLayout(!0,t,e),[2]}))}))},t.prototype.stop=function(){var t;null===(t=this.forceSimulation)||void 0===t||t.stop()},t.prototype.tick=function(t){var e=this;void 0===t&&(t=1),this.forceSimulation.tick(t);var r={nodes:Dt(this.lastLayoutNodes),edges:Ot(this.lastLayoutEdges)};return this.lastAssign&&r.nodes.forEach((function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),r},t.prototype.genericForceLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,c,f,g,p,v,y,m,w,x,E,N,M,S,k,A,_,z,R,I,D=this;return a(this,(function(a){return o=n(n({},this.options),r),i=e.getAllNodes(),s=e.getAllEdges(),u=i.map((function(t){var e,r;return n(n({},b(t)),{x:null===(e=t.data)||void 0===e?void 0:e.x,y:null===(r=t.data)||void 0===r?void 0:r.y})})),h=s.map((function(t){return b(t)})),this.lastLayoutNodes=u,this.lastLayoutEdges=h,this.lastAssign=t,this.lastGraph=e,d=o.alphaMin,l=o.alphaDecay,c=o.alpha,f=o.nodeStrength,g=o.edgeStrength,p=o.linkDistance,v=o.clustering,y=o.clusterFociStrength,m=o.clusterEdgeDistance,w=o.clusterEdgeStrength,x=o.clusterNodeStrength,E=o.clusterNodeSize,N=o.collideStrength,M=void 0===N?1:N,S=o.center,k=void 0===S?[0,0]:S,A=o.preventOverlap,_=o.nodeSize,z=o.nodeSpacing,R=o.onTick,I=o.forceSimulation,[2,new Promise((function(r){if(I){v&&((i=zt()).nodes(u),i.links(h)),I.nodes(u),h&&(s=bt().id((function(t){return t.id})).links(h),g&&s.strength(g),p&&s.distance(p),I.force("link",s)),A&&D.overlapProcess(I,{nodeSize:_,nodeSpacing:z,collideStrength:M}),I.alpha(c).restart();var n=Dt(u),o=Ot(h);t&&n.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),r({nodes:n,edges:o})}else try{var i,a=xt();if(f&&a.strength(f),I=wt().nodes(u),v&&((i=zt()).centerX(k[0]).centerY(k[1]).template("force").strength(y),h&&i.links(h),u&&i.nodes(u),i.forceLinkDistance(m).forceLinkStrength(w).forceCharge(x).forceNodeSize(E),I.force("group",i)),I.force("center",function(t,e){var r,n=1;function o(){var o,i,a=r.length,s=0,u=0;for(o=0;o<a;++o)s+=(i=r[o]).x,u+=i.y;for(s=(s/a-t)*n,u=(u/a-e)*n,o=0;o<a;++o)(i=r[o]).x-=s,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}(k[0],k[1])).force("charge",a).alpha(c).alphaDecay(l).alphaMin(d),A&&D.overlapProcess(I,{nodeSize:_,nodeSpacing:z,collideStrength:M}),h){var s=bt().id((function(t){return t.id})).links(h);g&&s.strength(g),p&&s.distance(p),I.force("link",s)}I.on("tick",(function(){var r=Dt(u);null==R||R({nodes:r,edges:Ot(h)}),t&&r.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}))})).on("end",(function(){var n=Dt(u);t&&n.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),r({nodes:n,edges:Ot(h)})}))}catch(t){console.warn(t)}D.forceSimulation=I}))]}))}))},t.prototype.overlapProcess=function(t,e){var r,n,o=e.nodeSize,i=e.nodeSpacing,a=e.collideStrength;if(n=v(i)?function(){return i}:f(i)?i:function(){return 0},o)if(f(o))r=function(t){return o(t)+n(t)};else if(m(o)){var s=(o[0]>o[1]?o[0]:o[1])/2;r=function(t){return s+n(t)}}else if(v(o)){var u=o/2;r=function(t){return u+n(t)}}else r=function(){return 10};else r=function(t){return t.size?m(t.size)?(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+n(t):y(t.size)?(t.size.width>t.size.height?t.size.width:t.size.height)/2+n(t):t.size/2+n(t):10+n(t)};t.force("collisionForce",kt(r).strength(a))},t}(),Dt=function(t){return t.map((function(t){var e=t.x,r=t.y,i=o(t,["x","y"]);return n(n({},i),{data:n(n({},i.data),{x:e,y:r})})}))},Ot=function(t){return t.map((function(t){var e=t.source,r=t.target,i=o(t,["source","target"]);return n(n({},i),{source:e.id,target:r.id})}))};var Pt=function(t,e){if("next"!==t&&"prev"!==t)return e},Tt=function(t){t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev},Ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e}(function(){function t(){var t={};t.prev=t,t.next=t.prev,this.shortcut=t}return t.prototype.dequeue=function(){var t=this.shortcut,e=t.prev;if(e&&e!==t)return Tt(e),e},t.prototype.enqueue=function(t){var e=this.shortcut;t.prev&&t.next&&Tt(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e},t.prototype.toString=function(){for(var t=[],e=this.shortcut,r=e.prev;r!==e;)t.push(JSON.stringify(r,Pt)),r=null==r?void 0:r.prev;return"["+t.join(", ")+"]"},t}()),qt=function(){return 1},Lt=function(t,e,r,o,i){var a,s,u=[];return t.hasNode(o.v)&&(null===(a=t.getRelatedEdges(o.v,"in"))||void 0===a||a.forEach((function(o){var a=o.data.weight,s=t.getNode(o.source);i&&u.push({v:o.source,w:o.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=a,jt(e,r,n({v:s.id},s.data))})),null===(s=t.getRelatedEdges(o.v,"out"))||void 0===s||s.forEach((function(o){var i=o.data.weight,a=o.target,s=t.getNode(a);void 0===s.data.in&&(s.data.in=0),s.data.in-=i,jt(e,r,n({v:s.id},s.data))})),t.removeNode(o.v)),i?u:void 0},jt=function(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},Ft=function(t,e){var r="greedy"===e?function(t,e){var r;if(t.getAllNodes().length<=1)return[];var o=function(t,e){var r=new c,o=0,i=0;t.getAllNodes().forEach((function(t){r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((function(t){var a=r.getRelatedEdges(t.source,"out").find((function(e){return e.target===t.target})),s=(null==e?void 0:e(t))||1;a?r.updateEdgeData(null==a?void 0:a.id,n(n({},a.data),{weight:a.data.weight+s})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:s}}),i=Math.max(i,r.getNode(t.source).data.out+=s),o=Math.max(o,r.getNode(t.target).data.in+=s)}));for(var a=[],s=i+o+3,u=0;u<s;u++)a.push(new Ct);var h=o+1;return r.getAllNodes().forEach((function(t){jt(a,h,n({v:t.id},r.getNode(t.id).data))})),{buckets:a,zeroIdx:h,graph:r}}(t,function(t){return t.data.weight||1}||qt);return null===(r=function(t,e,r){for(var n,o=[],i=e[e.length-1],a=e[0];t.getAllNodes().length;){for(;n=a.dequeue();)Lt(t,e,r,n);for(;n=i.dequeue();)Lt(t,e,r,n);if(t.getAllNodes().length)for(var s=e.length-2;s>0;--s)if(n=e[s].dequeue()){o=o.concat(Lt(t,e,r,n,!0));break}}return o}(o.graph,o.buckets,o.zeroIdx).map((function(e){return t.getRelatedEdges(e.v,"out").filter((function(t){return t.target===e.w}))})))||void 0===r?void 0:r.flat()}(t):Vt(t);null==r||r.forEach((function(e){var r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:n({},r)})}))},Vt=function(t){var e=[],r={},n={},o=function(i){n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((function(t){r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((function(t){return o(t.id)})),e},Bt=function(t,e,r,n){var o;do{o=""+n+Math.random()}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},Gt=function(t){var e=new c;return t.getAllNodes().forEach((function(r){t.getChildren(r.id).length||e.addNode(n({},r))})),t.getAllEdges().forEach((function(t){e.addEdge(t)})),e},Wt=function(t,e){var r,n,o=Number(t.x),i=Number(t.y),a=Number(e.x)-o,s=Number(e.y)-i,u=Number(t.width)/2,h=Number(t.height)/2;return a||s?(Math.abs(s)*u>Math.abs(a)*h?(s<0&&(h=-h),r=h*a/s,n=h):(a<0&&(u=-u),r=u,n=u*s/a),{x:o+r,y:i+n}):{x:0,y:0}},$t=function(t){for(var e=[],r=Ht(t)+1,n=0;n<r;n++)e.push([]);for(t.getAllNodes().forEach((function(t){var r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)})),n=0;n<r;n++)e[n]=e[n].sort((function(e,r){return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},Ut=function(t,e,r,n){var o={width:0,height:0};return v(r)&&v(n)&&(o.rank=r,o.order=n),Bt(t,"border",o,e)},Ht=function(t){var e;return t.getAllNodes().forEach((function(t){var r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},Kt=function(t,e){return t.reduce((function(t,r){return e(t)>e(r)?r:t}))},Yt=function(t,e,r,n,o,i){n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((function(e){return Yt(t,e,r,n,o,i)})),r&&i.push(e.id))},Jt=function(t,e,r,n){var o=Array.isArray(e)?e:[e],i=function(e){return n?t.getSuccessors(e):t.getNeighbors(e)},a=[],s=[];return o.forEach((function(e){if(!t.hasNode(e.id))throw new Error("Graph does not have node: "+e);Yt(t,e,"post"===r,s,i,a)})),a},Xt="edge-label",Qt=function(t){var e={},r=function(n){var o,i,a=t.getNode(n);return a?e[n]?a.data.rank:(e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((function(t){var e=r(t.target)-t.data.minlen;e&&(void 0===i||e<i)&&(i=e)})),i||(i=0),a.data.rank=i,i):0};t.getAllNodes().filter((function(e){return 0===t.getRelatedEdges(e.id,"in").length})).forEach((function(t){return r(t.id)}))},Zt=function(t,e){return t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen},te=function(t,e){var r=function(n){e.getRelatedEdges(n,"both").forEach((function(o){var i=o.source,a=n===i?o.target:i;t.hasNode(a)||Zt(e,o)||(t.addNode({id:a,data:{}}),t.addEdge({id:o.id,source:n,target:a,data:{}}),r(a))}))};return t.getAllNodes().forEach((function(t){return r(t.id)})),t.getAllNodes().length},ee=function(t,e){var r=function(n){var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((function(o){var i=o.source,a=n===i?o.target:i;t.hasNode(a)||void 0===e.getNode(a).data.layer&&Zt(e,o)||(t.addNode({id:a,data:{}}),t.addEdge({id:o.id,source:n,target:a,data:{}}),r(a))}))};return t.getAllNodes().forEach((function(t){return r(t.id)})),t.getAllNodes().length},re=function(t,e){return Kt(e.getAllEdges(),(function(r){return t.hasNode(r.source)!==t.hasNode(r.target)?Zt(e,r):1/0}))},ne=function(t,e,r){t.getAllNodes().forEach((function(t){var n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},oe=function(t,e){var r=Jt(t,t.getAllNodes(),"post",!1);(r=r.slice(0,(null==r?void 0:r.length)-1)).forEach((function(r){ie(t,e,r)}))},ie=function(t,e,r){var n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((function(t){return t.target===n||t.source===n})).data.cutvalue=ae(t,e,r)},ae=function(t,e,r){var n=t.getNode(r).data.parent,o=!0,i=e.getRelatedEdges(r,"out").find((function(t){return t.target===n})),a=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((function(t){return t.target===r}))),a=i.data.weight,e.getRelatedEdges(r,"both").forEach((function(e){var i=e.source===r,s=i?e.target:e.source;if(s!==n){var u=i===o,h=e.data.weight;if(a+=u?h:-h,fe(t,r,s)){var d=t.getRelatedEdges(r,"both").find((function(t){return t.source===s||t.target===s})).data.cutvalue;a+=u?-d:d}}})),a},se=function(t,e){void 0===e&&(e=t.getAllNodes()[0].id),ue(t,{},1,e)},ue=function(t,e,r,n,o){var i,a=r,s=r,u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((function(r){e[r.id]||(s=ue(t,e,s,r.id,n))})),u.data.low=a,u.data.lim=s++,o?u.data.parent=o:delete u.data.parent,s},he=function(t){return t.getAllEdges().find((function(t){return t.data.cutvalue<0}))},de=function(t,e,r){var n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((function(t){return t.target===o}))||(n=r.target,o=r.source);var i=t.getNode(n),a=t.getNode(o),s=i,u=!1;i.data.lim>a.data.lim&&(s=a,u=!0);var h=e.getAllEdges().filter((function(e){return u===ge(t.getNode(e.source),s)&&u!==ge(t.getNode(e.target),s)}));return Kt(h,(function(t){return Zt(e,t)}))},le=function(t,e,r,n){var o=t.getRelatedEdges(r.source,"both").find((function(t){return t.source===r.target||t.target===r.target}));o&&t.removeEdge(o.id),t.addEdge({id:"e"+Math.random(),source:n.source,target:n.target,data:{}}),se(t),oe(t,e),ce(t,e)},ce=function(t,e){var r=t.getAllNodes().find((function(t){return!t.data.parent})),n=Jt(t,r,"pre",!1);(n=n.slice(1)).forEach((function(r){var n=t.getNode(r).data.parent,o=e.getRelatedEdges(r,"out").find((function(t){return t.target===n})),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((function(t){return t.target===r})),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},fe=function(t,e,r){return t.getRelatedEdges(e,"both").find((function(t){return t.source===r||t.target===r}))},ge=function(t,e){return e.data.low<=t.data.lim&&t.data.lim<=e.data.lim},pe=Qt,ve=function(t){!function(t){var e=function(t){var e=new c;return t.getAllNodes().forEach((function(t){e.addNode(n({},t))})),t.getAllEdges().forEach((function(t){var r=e.getRelatedEdges(t.source,"out").find((function(e){return e.target===t.target}));r?e.updateEdgeData(null==r?void 0:r.id,n(n({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e}(t);Qt(e);var r,o,i=function(t){var e,r,n=new c({tree:[]}),o=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(o);te(n,t)<i;)e=re(n,t),r=n.hasNode(e.source)?Zt(t,e):-Zt(t,e),ne(n,t,r);return n}(e);for(se(i),oe(i,e);r=he(i);)o=de(i,e,r),le(i,e,r,o)}(t)},ye=function(t,e,r,n,o,i,a){var s=t.getChildren(a);if(null==s?void 0:s.length){var u=Ut(t,"_bt"),h=Ut(t,"_bb"),d=t.getNode(a);t.setParent(u,a),d.data.borderTop=u,t.setParent(h,a),d.data.borderBottom=h,null==s||s.forEach((function(s){ye(t,e,r,n,o,i,s.id);var d=s.data.borderTop?s.data.borderTop:s.id,l=s.data.borderBottom?s.data.borderBottom:s.id,c=s.data.borderTop?n:2*n,f=d!==l?1:o-i[a]+1;t.addEdge({id:"e"+Math.random(),source:u,target:d,data:{minlen:f,weight:c,nestingEdge:!0}}),t.addEdge({id:"e"+Math.random(),source:l,target:h,data:{minlen:f,weight:c,nestingEdge:!0}})})),t.getParent(a)||t.addEdge({id:"e"+Math.random(),source:e,target:u,data:{weight:0,minlen:o+i[a]}})}else a!==e&&t.addEdge({id:"e"+Math.random(),source:e,target:a,data:{weight:0,minlen:r}})},me=function(t,e,r,n,o,i){var a={rank:i,borderType:e,width:0,height:0},s=o.data[e][i-1],u=Bt(t,"border",a,r);o.data[e][i]=u,t.setParent(u,n),s&&t.addEdge({id:"e"+Math.random(),source:s,target:u,data:{weight:1}})},we=function(t){t.getAllNodes().forEach((function(t){xe(t)})),t.getAllEdges().forEach((function(t){xe(t)}))},xe=function(t){var e=t.data.width;t.data.width=t.data.height,t.data.height=e},Ee=function(t){(null==t?void 0:t.y)&&(t.y=-t.y)},Ne=function(t){var e=t.x;t.x=t.y,t.y=e},be=function(t){for(var e={},r=t.getAllNodes(),n=r.map((function(t){var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max.apply(Math,u([],s(n))),i=[],a=0;a<o+1;a++)i.push([]);var h=r.sort((function(e,r){return t.getNode(e.id).data.rank-t.getNode(r.id).data.rank})),d=h.filter((function(e){return void 0!==t.getNode(e.id).data.fixorder})).sort((function(e,r){return t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder}));return null==d||d.forEach((function(r){isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==h||h.forEach((function(r){return t.dfsTree(r.id,(function(t){if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)}))})),i},Me=function(t,e,r){for(var n=function(t,e){return null==t?void 0:t.reduce((function(t,r,n){return t[r]=e[n],t}),{})}(r,r.map((function(t,e){return e}))),o=e.map((function(e){var r=t.getRelatedEdges(e,"out").map((function(t){return{pos:n[t.target]||0,weight:t.data.weight}}));return null==r?void 0:r.sort((function(t,e){return t.pos-e.pos}))})),i=o.flat().filter((function(t){return void 0!==t})),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var u=Array(s).fill(0,0,s),h=0;return null==i||i.forEach((function(t){if(t){var e=t.pos+a;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;h+=t.weight*r}})),h},Se=function(t,e){for(var r=0,n=1;n<(null==e?void 0:e.length);n+=1)r+=Me(t,e[n-1],e[n]);return r},ke=function(t,e){var r,n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0};const Ae=function(t,e){var r,n,o,i={};return null==t||t.forEach((function(t,e){i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};var r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((function(t){var e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))})),function(t){for(var e,r,n=[],o=function(){var o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((function(t){return(e=o,function(t){t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&ke(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((function(e){return(r=o,function(e){e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))};null==t?void 0:t.length;)o();var i=n.filter((function(t){return!t.merged})),a=["vs","i","barycenter","weight"];return i.map((function(t){var e={};return null==a||a.forEach((function(r){void 0!==t[r]&&(e[r]=t[r])})),e}))}(null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(function(t){return!t.indegree})))};var _e=function(t,e,r){for(var n,o=r;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},ze=function(t,e,r,n,o,i){var a,s,u,h,d=t.getChildren(e).map((function(t){return t.id})),l=t.getNode(e),c=l?l.data.borderLeft:void 0,f=l?l.data.borderRight:void 0,g={};c&&(d=null==d?void 0:d.filter((function(t){return t!==c&&t!==f})));var p=function(t,e){return e.map((function(e){var r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};var n={sum:0,weight:0};return null==r||r.forEach((function(e){var r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}}))}(t,d||[]);null==p||p.forEach((function(e){var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){var a=ze(t,e.v,r,n,i);g[e.v]=a,a.hasOwnProperty("barycenter")&&Ie(e,a)}}));var v=Ae(p,r);Re(v,g),null===(a=v.filter((function(t){return t.vs.length>0})))||void 0===a||a.forEach((function(e){var r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));var y=function(t,e,r,n){var o=function(t,e){var r={lhs:[],rhs:[]};return null==t||t.forEach((function(t){var e,o;o=(e=t).hasOwnProperty("fixorder")&&!isNaN(e.fixorder),(n?!o&&e.hasOwnProperty("barycenter"):o||e.hasOwnProperty("barycenter"))?r.lhs.push(t):r.rhs.push(t)})),r}(t),i=o.lhs,a=o.rhs.sort((function(t,e){return-t.i- -e.i})),s=[],u=0,h=0,d=0;null==i||i.sort(function(t,e){return function(r,n){if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i}}(!!e,!!r)),d=_e(s,a,d),null==i||i.forEach((function(t){var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,d=_e(s,a,d)}));var l={vs:s.flat()};return h&&(l.barycenter=u/h,l.weight=h),l}(v,n,o,i);if(c&&(y.vs=[c,y.vs,f].flat(),null===(s=t.getPredecessors(c))||void 0===s?void 0:s.length)){var m=t.getNode((null===(u=t.getPredecessors(c))||void 0===u?void 0:u[0].id)||""),w=t.getNode((null===(h=t.getPredecessors(f))||void 0===h?void 0:h[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.data.order+w.data.order)/(y.weight+2),y.weight+=2}return y},Re=function(t,e){null==t||t.forEach((function(t){var r,n=null===(r=t.vs)||void 0===r?void 0:r.map((function(t){return e[t]?e[t].vs:t}));t.vs=n.flat()}))},Ie=function(t,e){void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},De=function(t){if("object"!=typeof t||null===t)return t;var e,r;if(r=t,Array.isArray?Array.isArray(r):p(r,"Array")){e=[];for(var n=0,o=t.length;n<o;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=De(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=De(t[i]):e[i]=t[i];return e};const Oe=De;var Pe=function(t,e,r){return e.map((function(e){return function(t,e,r){var o=function(t){for(var e;t.hasNode(e="_root"+Math.random()););return e}(t),i=new c({tree:[{id:o,children:[],data:{}}]});return t.getAllNodes().forEach((function(a){var s=t.getParent(a.id);(a.data.rank===e||a.data.minRank<=e&&e<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(n({},a)),(null==s?void 0:s.id)&&!i.hasNode(null==s?void 0:s.id)&&i.addNode(n({},s)),i.setParent(a.id,(null==s?void 0:s.id)||o),t.getRelatedEdges(a.id,r).forEach((function(e){var r=e.source===a.id?e.target:e.source;i.hasNode(r)||i.addNode(n({},t.getNode(r)));var o=i.getRelatedEdges(r,"out").find((function(t){return t.target===a.id})),s=void 0!==o?o.data.weight:0;o?i.updateEdgeData(o.id,n(n({},o.data),{weight:e.data.weight+s})):i.addEdge({id:e.id,source:r,target:a.id,data:{weight:e.data.weight+s}})})),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,n(n({},a.data),{borderLeft:a.data.borderLeft[e],borderRight:a.data.borderRight[e]})))})),i}(t,e,r)}))},Te=function(t,e,r,n){var o=new c;null==t||t.forEach((function(t){for(var i,a=t.getRoots()[0].id,s=ze(t,a,o,e,r,n),u=0;u<(null===(i=s.vs)||void 0===i?void 0:i.length);u++){var h=t.getNode(s.vs[u]);h&&(h.data.order=u)}!function(t,e,r){var n,o={};null==r||r.forEach((function(r){for(var i,a,s=t.getParent(r);s;){if((i=t.getParent(s.id))?(a=o[i.id],o[i.id]=s.id):(a=n,n=s.id),a&&a!==s.id)return e.addNodes([{id:a,data:{}},{id:s.id,data:{}}]),void e.addEdge({id:"e"+a+"-"+s.id,source:a,target:s.id,data:{}});s=i}}))}(t,o,s.vs)}))},Ce=function(t,e){null==e||e.forEach((function(e){null==e||e.forEach((function(e,r){t.getNode(e).data.order=r}))}))},qe=function(t,e){var r={};function n(e,n,o,i,a){for(var s,u,h,d=n;d<o;d++)h=e[d],(null===(s=t.getNode(h))||void 0===s?void 0:s.data.dummy)&&(null===(u=t.getPredecessors(h))||void 0===u||u.forEach((function(e){var n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>a)&&je(r,e.id,h)})))}function o(t,e){var r=function(t){return JSON.stringify(t.slice(1))}(t);e.get(r)||(n.apply(void 0,u([],s(t))),e.set(r,!0))}return(null==e?void 0:e.length)&&e.reduce((function(e,r){var n,i=-1,a=0,s=new Map;return null==r||r.forEach((function(u,h){var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){var l=t.getPredecessors(u)||[];l.length&&(n=t.getNode(l[0].id).data.order,o([r,a,h,i,n],s),a=h,i=n)}o([r,a,r.length,n,e.length],s)})),r})),r},Le=function(t,e){var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((function(e){return t.getNode(e.id).data.dummy}))},je=function(t,e,r){var n=e,o=r;if(n>o){var i=n;n=o,o=i}var a=t[n];a||(t[n]=a={}),a[o]=!0},Fe=function(t,e,r){var n=e;return n>r&&(n=r),!!t[n]},Ve=function(t,e,r,o,i,a){var s=new c,u=Be(o,i,a);return null==e||e.forEach((function(e){var o;null==e||e.forEach((function(e){var i=r[e];if(s.hasNode(i)||s.addNode({id:i,data:{}}),o){var a=r[o],h=s.getRelatedEdges(a,"out").find((function(t){return t.target===i}));h?s.updateEdgeData(h.id,n(n({},h.data),{weight:Math.max(u(t,e,o),h.data.weight||0)})):s.addEdge({id:"e"+Math.random(),source:a,target:i,data:{weight:Math.max(u(t,e,o),0)}})}o=e}))})),s};var Be=function(t,e,r){return function(n,o,i){var a=n.getNode(o),s=n.getNode(i),u=0,h=0;if(u+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":h=-a.data.width/2;break;case"r":h=a.data.width/2}if(h&&(u+=r?h:-h),h=0,u+=(a.data.dummy?e:t)/2,u+=(s.data.dummy?e:t)/2,u+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":h=s.data.width/2;break;case"r":h=-s.data.width/2}return h&&(u+=r?h:-h),h=0,u}},Ge=function(t,e){return t.getNode(e).data.width||0},We=function(t,e){var r,n=Gt(t);!function(t,e){var r=(e||{}).ranksep,n=void 0===r?0:r,o=$t(t),i=0;null==o||o.forEach((function(e){var r=e.map((function(e){return t.getNode(e).data.height})),o=Math.max.apply(Math,u(u([],s(r)),[0]));null==e||e.forEach((function(e){t.getNode(e).data.y=i+o/2})),i+=o+n}))}(n,e);var o=function(t,e){var r=e||{},n=r.align,o=r.nodesep,i=void 0===o?0:o,a=r.edgesep,h=void 0===a?0:a,d=$t(t),l=Object.assign(function(t,e){var r={};return(null==e?void 0:e.length)&&e.reduce((function(e,n){var o=0,i=0,a=e.length,s=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach((function(e,u){var h,d=Le(t,e),l=d?t.getNode(d.id).data.order:a;(d||e===s)&&(null===(h=n.slice(i,u+1))||void 0===h||h.forEach((function(e){var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((function(n){var i,a=t.getNode(n.id),s=a.data.order;!(s<o||l<s)||a.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||je(r,n.id,e)}))})),i=u+1,o=l)})),n})),r}(t,d),qe(t,d)),c={},f=[];["u","d"].forEach((function(e){f="u"===e?d:Object.values(d).reverse(),["l","r"].forEach((function(r){"r"===r&&(f=f.map((function(t){return Object.values(t).reverse()})));var n=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),o=function(t,e,r,n){var o={},i={},a={};return null==e||e.forEach((function(t){null==t||t.forEach((function(t,e){o[t]=t,i[t]=t,a[t]=e}))})),null==e||e.forEach((function(t){var e=-1;null==t||t.forEach((function(t){var s=n(t).map((function(t){return t.id}));if(s.length){s=s.sort((function(t,e){return a[t]-a[e]}));for(var u=(s.length-1)/2,h=Math.floor(u),d=Math.ceil(u);h<=d;++h){var l=s[h];i[t]===t&&e<a[l]&&!Fe(r,t,l)&&(i[l]=t,i[t]=o[t]=o[l],e=a[l])}}}))})),{root:o,align:i}}(0,f,l,n),a=function(t,e,r,n,o,i,a){var s,u={},h=Ve(t,e,r,o,i,a),d=a?"borderLeft":"borderRight",l=function(t,e){for(var r=h.getAllNodes(),n=r.pop(),o={};n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return l((function(t){u[t]=(h.getRelatedEdges(t,"in")||[]).reduce((function(t,e){return Math.max(t,(u[e.source]||0)+e.data.weight)}),0)}),h.getPredecessors.bind(h)),l((function(e){var r=(h.getRelatedEdges(e,"out")||[]).reduce((function(t,e){return Math.min(t,(u[e.target]||0)-e.data.weight)}),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==d&&(u[e]=Math.max(u[e],r))}),h.getSuccessors.bind(h)),null===(s=Object.values(n))||void 0===s||s.forEach((function(t){u[t]=u[r[t]]})),u}(t,f,o.root,o.align,i,h,"r"===r);"r"===r&&Object.keys(a).forEach((function(t){return a[t]=-a[t]})),c[e+r]=a}))}));var g=function(t,e){return Kt(Object.values(e),(function(e){var r,n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((function(r){var i=e[r],a=Ge(t,r)/2;n=Math.max(i+a,n),o=Math.min(i-a,o)})),n-o}))}(t,c);return g&&function(t,e){var r=Object.values(e),n=Math.min.apply(Math,u([],s(r))),o=Math.max.apply(Math,u([],s(r)));["u","d"].forEach((function(r){["l","r"].forEach((function(i){var a,h=r+i,d=t[h];if(d!==e){var l=Object.values(d);(a="l"===i?n-Math.min.apply(Math,u([],s(l))):o-Math.max.apply(Math,u([],s(l))))&&(t[h]={},Object.keys(d).forEach((function(e){t[h][e]=d[e]+a})))}}))}))}(c,g),function(t,e){var r={};return Object.keys(t.ul).forEach((function(n){if(e)r[n]=t[e.toLowerCase()][n];else{var o=Object.values(t).map((function(t){return t[n]}));r[n]=(o[0]+o[1])/2}})),r}(c,n)}(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((function(t){n.getNode(t).data.x=o[t]}))},$e=function(t,e){var r=e.acyclicer,o=e.ranker,i=e.rankdir,a=void 0===i?"tb":i,h=e.nodeOrder,d=e.keepNodeOrder,l=e.align,f=e.nodesep,g=void 0===f?50:f,p=e.edgesep,v=void 0===p?20:p,y=e.ranksep,m=void 0===y?50:y;ir(t),Ft(t,r);var w=function(t){var e=Bt(t,"root",{},"_root"),r=function(t){var e={},r=function(n,o){var i=t.getChildren(n);null==i||i.forEach((function(t){return r(t.id,o+1)})),e[n]=o};return t.getRoots().forEach((function(t){return r(t.id,1)})),e}(t),n=Math.max.apply(Math,u([],s(Object.values(r))));Math.abs(n)===1/0&&(n=1);var o=n-1,i=2*o+1;t.getAllEdges().forEach((function(t){t.data.minlen*=i}));var a=function(t){var e=0;return t.getAllEdges().forEach((function(t){e+=t.data.weight})),e}(t)+1;return t.getRoots().forEach((function(n){ye(t,e,i,a,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}}(t),x=w.nestingRoot,E=w.nodeRankFactor;!function(t,e){switch(e){case"network-simplex":ve(t);break;case"tight-tree":default:!function(t){!function(t){var e,r={},n=function(o){var i,a,s=t.getNode(o);return s?r[o]?s.data.rank:(r[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((function(t){var e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),(void 0===e||a<e)&&(e=a),s.data.rank=a,a):0};t.getAllNodes().filter((function(e){return 0===t.getRelatedEdges(e.id,"in").length})).forEach((function(t){t&&n(t.id)})),void 0===e&&(e=0);var o={},i=function(e,r){var n,a=t.getNode(e),s=isNaN(a.data.layer)?r:a.data.layer;(void 0===a.data.rank||a.data.rank<s)&&(a.data.rank=s),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((function(t){i(t.target,s+t.data.minlen)})))};t.getAllNodes().forEach((function(t){var r=t.data;r&&(isNaN(r.layer)?r.rank-=e:i(t.id,r.layer))}))}(t),function(t){var e,r,n=new c({tree:[]}),o=t.getAllNodes()[0],i=t.getAllNodes().length;for(n.addNode(o);ee(n,t)<i;)e=re(n,t),r=n.hasNode(e.source)?Zt(t,e):-Zt(t,e),ne(n,t,r)}(t)}(t);break;case"longest-path":pe(t)}}(Gt(t),o),Xe(t),function(t,e){void 0===e&&(e=0);var r=t.getAllNodes(),n=r.filter((function(t){return void 0!==t.data.rank})).map((function(t){return t.data.rank})),o=Math.min.apply(Math,u([],s(n))),i=[];r.forEach((function(t){var e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));for(var a=0,h=0;h<i.length;h++){var d=i[h];void 0===d?h%e!=0&&(a-=1):a&&(null==d||d.forEach((function(e){var r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=a)})))}}(t,E),function(t,e){e&&t.removeNode(e),t.getAllEdges().forEach((function(e){e.data.nestingEdge&&t.removeEdge(e.id)}))}(t,x),function(t){var e=t.getAllNodes().filter((function(t){return void 0!==t.data.rank})).map((function(t){return t.data.rank})),r=Math.min.apply(Math,u([],s(e)));t.getAllNodes().forEach((function(t){t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))}(t),Qe(t),Ze(t);var N=[];!function(t,e){t.getAllEdges().forEach((function(r){return function(t,e,r){var n=e.source,o=t.getNode(n).data.rank,i=e.target,a=t.getNode(i).data.rank,s=e.data.labelRank;if(a!==o+1){var u,h,d;for(t.removeEdge(e.id),d=0,++o;o<a;++d,++o)e.data.points=[],u=Bt(t,"edge",h={originalEdge:e,width:0,height:0,rank:o},"_d"),o===s&&(h.width=e.data.width,h.height=e.data.height,h.dummy=Xt,h.labelpos=e.data.labelpos),t.addEdge({id:"e"+Math.random(),source:n,target:u,data:{weight:e.data.weight}}),0===d&&r.push(u),n=u;t.addEdge({id:"e"+Math.random(),source:n,target:i,data:{weight:e.data.weight}})}}(t,r,e)}))}(t,N),function(t,e){var r=function(t){var e={},r=0,n=function(o){var i=r;t.getChildren(o).forEach((function(t){return n(t.id)})),e[o]={low:i,lim:r++}};return t.getRoots().forEach((function(t){return n(t.id)})),e}(t);e.forEach((function(e){var n,o,i=e,a=t.getNode(i),s=a.data.originalEdge;if(s)for(var u=function(t,e,r,n){var o,i,a,s,u=[],h=[],d=Math.min(e[r].low,e[n].low),l=Math.max(e[r].lim,e[n].lim);a=r;do{a=null===(o=t.getParent(a))||void 0===o?void 0:o.id,u.push(a)}while(a&&(e[a].low>d||l>e[a].lim));for(s=a,a=n;a&&a!==s;)h.push(a),a=null===(i=t.getParent(a))||void 0===i?void 0:i.id;return{lca:s,path:u.concat(h.reverse())}}(t,r,s.source,s.target),h=u.path,d=u.lca,l=0,c=h[l],f=!0;i!==s.target;){if(a=t.getNode(i),f){for(;c!==d&&(null===(n=t.getNode(c))||void 0===n?void 0:n.data.maxRank)<a.data.rank;)c=h[++l];c===d&&(f=!1)}if(!f){for(;l<h.length-1&&(null===(o=t.getNode(h[l+1]))||void 0===o?void 0:o.data.minRank)<=a.data.rank;)l++;c=h[l]}t.hasNode(c)&&t.setParent(i,c),i=t.getSuccessors(i)[0].id}}))}(t,N),function(t){var e=function(r){var n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((function(t){return e(t.id)})),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(var i=o.data.minRank,a=o.data.maxRank+1;i<a;i+=1)me(t,"borderLeft","_bl",r,o,i),me(t,"borderRight","_br",r,o,i)}};t.getRoots().forEach((function(t){return e(t.id)}))}(t),d&&function(t,e){for(var r=t.getAllNodes().filter((function(e){var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((function(t){return t.data.rank})),n=Math.max.apply(Math,u([],s(r))),o=[],i=0;i<n+1;i++)o[i]=[];null==e||e.forEach((function(e){var r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))}(t,h),function(t,e){for(var r=Ht(t),n=[],o=[],i=1;i<r+1;i++)n.push(i);for(i=r-1;i>-1;i--)o.push(i);var a=Pe(t,n,"in"),s=Pe(t,o,"out"),u=be(t);Ce(t,u);for(var h,d=Number.POSITIVE_INFINITY,l=(i=0,0);l<4;++i,++l)Te(i%2?a:s,i%4>=2,!1,e),u=$t(t),(c=Se(t,u))<d&&(l=0,h=Oe(u),d=c);for(u=be(t),Ce(t,u),i=0,l=0;l<4;++i,++l){var c;Te(i%2?a:s,i%4>=2,!0,e),u=$t(t),(c=Se(t,u))<d&&(l=0,h=Oe(u),d=c)}Ce(t,h)}(t,d),ar(t),function(t,e){var r=e.toLowerCase();"lr"!==r&&"rl"!==r||we(t)}(t,a),We(t,{align:l,nodesep:g,edgesep:v,ranksep:m}),sr(t),or(t),function(t,e){e.forEach((function(e){var r,n=t.getNode(e),o=n.data.originalEdge;o&&t.addEdge(o);for(var i=e;n.data.dummy;)r=t.getSuccessors(i)[0],t.removeNode(i),o.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===Xt&&(o.data.x=n.data.x,o.data.y=n.data.y,o.data.width=n.data.width,o.data.height=n.data.height),i=r.id,n=t.getNode(i)}))}(t,N),rr(t),function(t,e){var r=e.toLowerCase();"bt"!==r&&"rl"!==r||function(t){t.getAllNodes().forEach((function(t){Ee(t.data)})),t.getAllEdges().forEach((function(t){var e;null===(e=t.data.points)||void 0===e||e.forEach((function(t){return Ee(t)})),t.data.hasOwnProperty("y")&&Ee(t.data)}))}(t),"lr"!==r&&"rl"!==r||(function(t){t.getAllNodes().forEach((function(t){Ne(t.data)})),t.getAllEdges().forEach((function(t){var e;null===(e=t.data.points)||void 0===e||e.forEach((function(t){return Ne(t)})),t.data.hasOwnProperty("x")&&Ne(t.data)}))}(t),we(t))}(t,a);var b=tr(t),M=b.width,S=b.height;return er(t),nr(t),function(t){t.getAllEdges().forEach((function(e){var r=e.data;if(r.reversed){t.removeEdge(e.id);var o=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:n(n({},r),{forwardName:o})})}}))}(t),{width:M,height:S}},Ue=["width","height","layer","fixorder"],He={width:0,height:0},Ke=["minlen","weight","width","height","labeloffset"],Ye={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Je=["labelpos"],Xe=function(t){t.getAllEdges().forEach((function(e){if(e.data.width&&e.data.height){var r=t.getNode(e.source),n={e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};Bt(t,"edge-proxy",n,"_ep")}}))},Qe=function(t){var e=0;return t.getAllNodes().forEach((function(r){var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Ze=function(t){t.getAllNodes().forEach((function(e){"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},tr=function(t,e){var r,n,o=0,i=0,a=e||{},s=a.marginx,u=void 0===s?0:s,h=a.marginy,d=void 0===h?0:h,l=function(t){if(t.data){var e=t.data.x,a=t.data.y,s=t.data.width,u=t.data.height;isNaN(e)||isNaN(s)||(void 0===r&&(r=e-s/2),r=Math.min(r,e-s/2),o=Math.max(o,e+s/2)),isNaN(a)||isNaN(u)||(void 0===n&&(n=a-u/2),n=Math.min(n,a-u/2),i=Math.max(i,a+u/2))}};return t.getAllNodes().forEach((function(t){l(t)})),t.getAllEdges().forEach((function(t){(null==t?void 0:t.data.hasOwnProperty("x"))&&l(t)})),r-=u,n-=d,t.getAllNodes().forEach((function(t){t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((function(t){var e;null===(e=t.data.points)||void 0===e||e.forEach((function(t){t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+u,height:i-n+d}},er=function(t){t.getAllEdges().forEach((function(e){var r,n,o=t.getNode(e.source),i=t.getNode(e.target);e.data.points?(r=e.data.points[0],n=e.data.points[e.data.points.length-1]):(e.data.points=[],r={x:i.data.x,y:i.data.y},n={x:o.data.x,y:o.data.y}),e.data.points.unshift(Wt(o.data,r)),e.data.points.push(Wt(i.data,n))}))},rr=function(t){t.getAllEdges().forEach((function(t){if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},nr=function(t){t.getAllEdges().forEach((function(t){var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},or=function(t){t.getAllNodes().forEach((function(e){var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){var i=t.getNode(e.id),a=t.getNode(i.data.borderTop),s=t.getNode(i.data.borderBottom),u=t.getNode(i.data.borderLeft[(null===(n=i.data.borderLeft)||void 0===n?void 0:n.length)-1]),h=t.getNode(i.data.borderRight[(null===(o=i.data.borderRight)||void 0===o?void 0:o.length)-1]);i.data.width=Math.abs((null==h?void 0:h.data.x)-(null==u?void 0:u.data.x))||10,i.data.height=Math.abs((null==s?void 0:s.data.y)-(null==a?void 0:a.data.y))||10,i.data.x=((null==u?void 0:u.data.x)||0)+i.data.width/2,i.data.y=((null==a?void 0:a.data.y)||0)+i.data.height/2}})),t.getAllNodes().forEach((function(e){"border"===e.data.dummy&&t.removeNode(e.id)}))},ir=function(t){t.getAllEdges().forEach((function(e){if(e.source===e.target){var r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},ar=function(t){var e=$t(t);null==e||e.forEach((function(e){var r=0;null==e||e.forEach((function(e,n){var o,i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((function(e){Bt(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e},"_se")})),delete i.data.selfEdges}))}))},sr=function(t){t.getAllNodes().forEach((function(e){var r=t.getNode(e.id);if("selfedge"===r.data.dummy){var n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,a=r.data.x-o,s=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*a/3,y:i-s},{x:o+5*a/6,y:i-s},{y:i,x:o+a},{x:o+5*a/6,y:i+s},{x:o+2*a/3,y:i+s}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},ur=function(t,e){var r={};return null==e||e.forEach((function(e){void 0!==t[e]&&(r[e]=+t[e])})),r},hr=function(t){void 0===t&&(t={});var e={};return Object.keys(t).forEach((function(r){e[r.toLowerCase()]=t[r]})),e},dr={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,controlPoints:!1,radial:!1,focusNode:null},lr=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="dagre",this.options=n(n({},dr),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericDagreLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return[4,this.genericDagreLayout(!0,t,e)];case 1:return r.sent(),[2]}}))}))},t.prototype.genericDagreLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,f,g,p,y,m,x,N,M,S,k,A,_,z,R,I,D,O,P,T,C,q,L,j,F,V,B;return a(this,(function(a){return o=n(n({},this.options),r),i=o.nodeSize,s=o.align,u=o.rankdir,h=void 0===u?"TB":u,d=o.ranksep,l=o.nodesep,f=o.ranksepFunc,g=o.nodesepFunc,p=o.edgeLabelSpace,y=o.nodeOrder,m=o.begin,x=o.controlPoints,N=o.radial,M=new c({tree:[]}),S=w(d||50,f),k=w(l||50,g),A=k,_=S,"LR"!==h&&"RL"!==h||(A=S,_=k),z=E(i,void 0),R=e.getAllNodes(),I=e.getAllEdges(),R.forEach((function(t){var e=z(t),r=_(t),n=e+2*A(t),o=e+2*r,i=t.data.layer;v(i)?M.addNode({id:t.id,data:{width:n,height:o,layer:i}}):M.addNode({id:t.id,data:{width:n,height:o}})})),I.forEach((function(t){M.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),function(t,e){var r,o,i=e.edgeLabelSpace,a=e.keepNodeOrder,s=e.prevGraph,u=e.rankdir,h=e.ranksep;!a&&s&&(o=s,(r=t).getAllNodes().forEach((function(t){var e=r.getNode(t.id),n=o.getNode(t.id);void 0!==n?(e.data.fixorder=n.data._order,delete n.data._order):delete e.data.fixorder})));var d=function(t){var e=new c({tree:[]});return t.getAllNodes().forEach((function(r){var o=hr(t.getNode(r.id).data),i=n(n({},He),o),a=ur(i,Ue);e.hasNode(r.id)||e.addNode({id:r.id,data:n({},a)});var s=t.getParent(r.id);null==s||(e.hasNode(s.id)||e.addNode(n({},s)),e.setParent(r.id,s.id))})),t.getAllEdges().forEach((function(r){var n=hr(t.getEdge(r.id).data),o={};null==Je||Je.forEach((function(t){void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},Ye,ur(n,Ke),o)})})),e}(t);i&&(e.ranksep=function(t,e){var r=e.ranksep,n=void 0===r?0:r,o=e.rankdir;return t.getAllNodes().forEach((function(t){isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((function(t){var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===o||"BT"===o?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),n/2}(d,{rankdir:u,ranksep:h}));try{$e(d,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}!function(t,e){t.getAllNodes().forEach((function(r){var n,o=t.getNode(r.id);if(o){var i=e.getNode(r.id);o.data.x=i.data.x,o.data.y=i.data.y,o.data._order=i.data.order,o.data._rank=i.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=i.data.width,o.data.height=i.data.height)}})),t.getAllEdges().forEach((function(r){var n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))}(t,d)}(M,{prevGraph:null,edgeLabelSpace:p,keepNodeOrder:!!y,nodeOrder:y||[],acyclicer:"greedy",ranker:"network-simplex",rankdir:h,nodesep:l,align:s}),D=[0,0],m&&(O=1/0,P=1/0,M.getAllNodes().forEach((function(t){O>t.data.x&&(O=t.data.x),P>t.data.y&&(P=t.data.y)})),M.getAllEdges().forEach((function(t){var e;null===(e=t.data.points)||void 0===e||e.forEach((function(t){O>t.x&&(O=t.x),P>t.y&&(P=t.y)}))})),D[0]=m[0]-O,D[1]=m[1]-P),T="LR"===h||"RL"===h,N||(C=new Set,q="BT"===h||"RL"===h?function(t,e){return e-t}:function(t,e){return t-e},M.getAllNodes().forEach((function(t){t.data.x=t.data.x+D[0],t.data.y=t.data.y+D[1],C.add(T?t.data.x:t.data.y)})),L=Array.from(C).sort(q),j=T?function(t,e){return t.x!==e.x}:function(t,e){return t.y!==e.y},F=T?function(t,e,r){var n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((function(t){return t.y<=n&&t.y>=o}))}:function(t,e,r){var n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((function(t){return t.x<=n&&t.x>=o}))},M.getAllEdges().forEach((function(t,e){var r;p&&x&&"loop"!==t.data.type&&(t.data.controlPoints=cr(null===(r=t.data.points)||void 0===r?void 0:r.map((function(t){var e=t.x,r=t.y;return{x:e+D[0],y:r+D[1]}})),M.getNode(t.source),M.getNode(t.target),L,T,j,F))}))),V=[],V=M.getAllNodes().map((function(t){return b(t)})),B=M.getAllEdges(),t&&(V.forEach((function(t){e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),B.forEach((function(t){e.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})}))),[2,{nodes:V,edges:B}]}))}))},t}(),cr=function(t,e,r,n,o,i,a){var s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){var u=e.data,h=u.x,d=u.y,l=r.data,c=l.x,f=l.y;if(o&&(h=e.data.y,d=e.data.x,c=r.data.y,f=r.data.x),f!==d&&h!==c){var g=n.indexOf(d),p=n[g+1];if(p){var v=s[0],y=o?{x:(d+p)/2,y:(null==v?void 0:v.y)||c}:{x:(null==v?void 0:v.x)||c,y:(d+p)/2};v&&!i(v,y)||s.unshift(y)}var m=n.indexOf(f),w=Math.abs(m-g);if(1===w)(s=a(s,e.data,r.data)).length||s.push(o?{x:(d+f)/2,y:h}:{x:h,y:(d+f)/2});else if(w>1){var x=n[m-1];if(x){var E=s[s.length-1],N=o?{x:(f+x)/2,y:(null==E?void 0:E.y)||c}:{x:(null==E?void 0:E.x)||h,y:(f+x)/2};E&&!i(E,N)||s.push(N)}}}}return s};function fr(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,a,s,u,h,d,l,c,f,g,p,v,y=t._root,m={data:o},w=t._x0,x=t._y0,E=t._z0,N=t._x1,b=t._y1,M=t._z1;if(!y)return t._root=m,t;for(;y.length;)if((c=e>=(a=(w+N)/2))?w=a:N=a,(f=r>=(s=(x+b)/2))?x=s:b=s,(g=n>=(u=(E+M)/2))?E=u:M=u,i=y,!(y=y[p=g<<2|f<<1|c]))return i[p]=m,t;if(h=+t._x.call(null,y.data),d=+t._y.call(null,y.data),l=+t._z.call(null,y.data),e===h&&r===d&&n===l)return m.next=y,i?i[p]=m:t._root=m,t;do{i=i?i[p]=new Array(8):t._root=new Array(8),(c=e>=(a=(w+N)/2))?w=a:N=a,(f=r>=(s=(x+b)/2))?x=s:b=s,(g=n>=(u=(E+M)/2))?E=u:M=u}while((p=g<<2|f<<1|c)==(v=(l>=u)<<2|(d>=s)<<1|h>=a));return i[v]=y,i[p]=m,t}function gr(t,e,r,n,o,i,a){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=a}function pr(t){return t[0]}function vr(t){return t[1]}function yr(t){return t[2]}function mr(t,e,r,n){var o=new wr(null==e?pr:e,null==r?vr:r,null==n?yr:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function wr(t,e,r,n,o,i,a,s,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=u,this._root=void 0}function xr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Er=mr.prototype=wr.prototype;function Nr(t){var e=0,r=0,n=0,o=0,i=t.length;if(i){for(var a=0;a<i;a++)(s=t[a])&&s.weight&&(e+=s.weight,r+=s.x*s.weight,n+=s.y*s.weight,o+=s.z*s.weight);t.x=r/e,t.y=n/e,t.z=o/e,t.weight=e}else{var s=t;t.x=s.data.x,t.y=s.data.y,t.z=s.data.z,t.weight=s.data.weight}}Er.copy=function(){var t,e,r=new wr(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=xr(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=xr(e));return r},Er.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return fr(this.cover(e,r,n),e,r,n,t)},Er.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,a=1/0,s=1/0,u=-1/0,h=-1/0,d=-1/0;for(let l,c,f,g,p=0;p<e;++p)isNaN(c=+this._x.call(null,l=t[p]))||isNaN(f=+this._y.call(null,l))||isNaN(g=+this._z.call(null,l))||(r[p]=c,n[p]=f,o[p]=g,c<i&&(i=c),c>u&&(u=c),f<a&&(a=f),f>h&&(h=f),g<s&&(s=g),g>d&&(d=g));if(i>u||a>h||s>d)return this;this.cover(i,a,s).cover(u,h,d);for(let i=0;i<e;++i)fr(this,r[i],n[i],o[i],t[i]);return this},Er.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,a=this._x1,s=this._y1,u=this._z1;if(isNaN(n))a=(n=Math.floor(t))+1,s=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var h,d,l=a-n||1,c=this._root;n>t||t>=a||o>e||e>=s||i>r||r>=u;)switch(d=(r<i)<<2|(e<o)<<1|t<n,(h=new Array(8))[d]=c,c=h,l*=2,d){case 0:a=n+l,s=o+l,u=i+l;break;case 1:n=a-l,s=o+l,u=i+l;break;case 2:a=n+l,o=s-l,u=i+l;break;case 3:n=a-l,o=s-l,u=i+l;break;case 4:a=n+l,s=o+l,i=u-l;break;case 5:n=a-l,s=o+l,i=u-l;break;case 6:a=n+l,o=s-l,i=u-l;break;case 7:n=a-l,o=s-l,i=u-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=u,this},Er.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Er.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},Er.find=function(t,e,r,n){var o,i,a,s,u,h,d,l,c,f=this._x0,g=this._y0,p=this._z0,v=this._x1,y=this._y1,m=this._z1,w=[],x=this._root;for(x&&w.push(new gr(x,f,g,p,v,y,m)),null==n?n=1/0:(f=t-n,g=e-n,p=r-n,v=t+n,y=e+n,m=r+n,n*=n);l=w.pop();)if(!(!(x=l.node)||(i=l.x0)>v||(a=l.y0)>y||(s=l.z0)>m||(u=l.x1)<f||(h=l.y1)<g||(d=l.z1)<p))if(x.length){var E=(i+u)/2,N=(a+h)/2,b=(s+d)/2;w.push(new gr(x[7],E,N,b,u,h,d),new gr(x[6],i,N,b,E,h,d),new gr(x[5],E,a,b,u,N,d),new gr(x[4],i,a,b,E,N,d),new gr(x[3],E,N,s,u,h,b),new gr(x[2],i,N,s,E,h,b),new gr(x[1],E,a,s,u,N,b),new gr(x[0],i,a,s,E,N,b)),(c=(r>=b)<<2|(e>=N)<<1|t>=E)&&(l=w[w.length-1],w[w.length-1]=w[w.length-1-c],w[w.length-1-c]=l)}else{var M=t-+this._x.call(null,x.data),S=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+S*S+k*k;if(A<n){var _=Math.sqrt(n=A);f=t-_,g=e-_,p=r-_,v=t+_,y=e+_,m=r+_,o=x.data}}return o},Er.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,r,n,o,i,a,s,u,h,d,l,c,f,g,p,v=this._root,y=this._x0,m=this._y0,w=this._z0,x=this._x1,E=this._y1,N=this._z1;if(!v)return this;if(v.length)for(;;){if((l=i>=(u=(y+x)/2))?y=u:x=u,(c=a>=(h=(m+E)/2))?m=h:E=h,(f=s>=(d=(w+N)/2))?w=d:N=d,e=v,!(v=v[g=f<<2|c<<1|l]))return this;if(!v.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,p=g)}for(;v.data!==t;)if(n=v,!(v=v.next))return this;return(o=v.next)&&delete v.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(r?r[p]=v:this._root=v),this):(this._root=o,this)},Er.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Er.root=function(){return this._root},Er.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Er.visit=function(t){var e,r,n,o,i,a,s,u,h=[],d=this._root;for(d&&h.push(new gr(d,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(d=e.node,n=e.x0,o=e.y0,i=e.z0,a=e.x1,s=e.y1,u=e.z1)&&d.length){var l=(n+a)/2,c=(o+s)/2,f=(i+u)/2;(r=d[7])&&h.push(new gr(r,l,c,f,a,s,u)),(r=d[6])&&h.push(new gr(r,n,c,f,l,s,u)),(r=d[5])&&h.push(new gr(r,l,o,f,a,c,u)),(r=d[4])&&h.push(new gr(r,n,o,f,l,c,u)),(r=d[3])&&h.push(new gr(r,l,c,i,a,s,f)),(r=d[2])&&h.push(new gr(r,n,c,i,l,s,f)),(r=d[1])&&h.push(new gr(r,l,o,i,a,c,f)),(r=d[0])&&h.push(new gr(r,n,o,i,l,c,f))}return this},Er.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new gr(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,a=e.x0,s=e.y0,u=e.z0,h=e.x1,d=e.y1,l=e.z1,c=(a+h)/2,f=(s+d)/2,g=(u+l)/2;(i=o[0])&&r.push(new gr(i,a,s,u,c,f,g)),(i=o[1])&&r.push(new gr(i,c,s,u,h,f,g)),(i=o[2])&&r.push(new gr(i,a,f,u,c,d,g)),(i=o[3])&&r.push(new gr(i,c,f,u,h,d,g)),(i=o[4])&&r.push(new gr(i,a,s,g,c,f,l)),(i=o[5])&&r.push(new gr(i,c,s,g,h,f,l)),(i=o[6])&&r.push(new gr(i,a,f,g,c,d,l)),(i=o[7])&&r.push(new gr(i,c,f,g,h,d,l))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},Er.x=function(t){return arguments.length?(this._x=t,this):this._x},Er.y=function(t){return arguments.length?(this._y=t,this):this._y},Er.z=function(t){return arguments.length?(this._z=t,this):this._z};var br=function(t,e,r,n,o,i,a){var s=[r,n,o][a-1],u=i.x-t.x||.1,h=i.y-t.y||.1,d=i.z-t.z||.1,l=s-e,c=u*u+h*h+d*d,f=Math.sqrt(c)*c;if(l*l*.81<c){var g=t.weight/f;return i.vx+=u*g,i.vy+=h*g,i.vz+=d*g,!0}if(t.length)return!1;t.data!==i&&(g=t.data.weight/f,i.vx+=u*g,i.vy+=h*g,i.vz+=d*g)},Mr={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:200,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:500,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"},Sr=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=n(n({},Mr),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericForceLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericForceLayout(!0,t,e),[2]}))}))},t.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},t.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var r=0;(this.judgingDistance>this.lastOptions.minMovement||r<1)&&r<t;r++)this.runOneStep(this.lastCalcGraph,this.lastGraph,r,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);var n={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&n.nodes.forEach((function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})})),n},t.prototype.genericForceLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,f,g,p,y,m,w,x,E,N,b,M,S,k,A=this;return a(this,(function(a){return o=n(n({},this.options),r),i=e.getAllNodes(),s=e.getAllEdges(),u=this.formatOptions(o,e),h=u.dimensions,d=u.width,l=u.height,f=u.nodeSize,g=u.getMass,p=u.nodeStrength,y=u.edgeStrength,m=u.linkDistance,w=i.map((function(t,e){return n(n({},t),{data:n(n({},t.data),{x:v(t.data.x)?t.data.x:Math.random()*d,y:v(t.data.y)?t.data.y:Math.random()*l,z:v(t.data.z)?t.data.z:Math.random()*Math.sqrt(d*l),size:f(t)||30,mass:g(t),nodeStrength:p(t)})})})),x=s.map((function(t){return n(n({},t),{data:n(n({},t.data),{edgeStrength:y(t),linkDistance:m(t,e.getNode(t.source),e.getNode(t.target))})})})),(null==i?void 0:i.length)?(E={},i.forEach((function(t,e){E[t.id]={x:0,y:0,z:0}})),N=new c({nodes:w,edges:x}),this.formatCentripetal(u,N),b=u.maxIteration,M=u.minMovement,S=u.onTick,this.lastLayoutNodes=w,this.lastLayoutEdges=x,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=N,this.lastOptions=u,this.lastVelMap=E,"undefined"==typeof window?[2]:(k=0,[2,new Promise((function(r){A.timeInterval=window.setInterval((function(){i&&A.running||r({nodes:Rr(e,w),edges:s}),A.runOneStep(N,e,k,E,u),A.updatePosition(e,N,E,u),t&&w.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===h?t.data.z:void 0})})),null==S||S({nodes:Rr(e,w),edges:s}),(++k>=b||A.judgingDistance<M)&&(window.clearInterval(A.timeInterval),r({nodes:Rr(e,w),edges:s}))}),0),A.running=!0}))])):(this.lastResult={nodes:[],edges:s},[2,{nodes:[],edges:s}])}))}))},t.prototype.formatOptions=function(t,e){var r=t,n=t.width,o=t.height,i=t.getMass;if(r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=function(t){var r=1;v(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);var n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),t.preventOverlap){var a=w(0,t.nodeSpacing);t.nodeSize?m(t.nodeSize)?r.nodeSize=function(e){var r=t.nodeSize;return Math.max(r[0],r[1])+a(e)}:r.nodeSize=function(e){return t.nodeSize+a(e)}:r.nodeSize=function(t){var e=((null==t?void 0:t.data)||{}).size;return e?m(e)?Math.max(e[0],e[1])+a(t):y(e)?Math.max(e.width,e.height)+a(t):e+a(t):10+a(t)}}return r.linkDistance=t.linkDistance?w(1,t.linkDistance):function(t){return 1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target))},r.nodeStrength=w(1,t.nodeStrength),r.edgeStrength=w(1,t.edgeStrength),t},t.prototype.formatCentripetal=function(t,e){var r,n=t.dimensions,o=t.centripetalOptions,i=t.center,a=t.clusterNodeStrength,s=t.leafCluster,u=t.clustering,h=t.nodeClusterBy,d=e.getAllNodes(),l=o||{leaf:2,single:2,others:1,center:function(t){return{x:i[0],y:i[1],z:3===n?i[2]:void 0}}};"function"!=typeof a&&(t.clusterNodeStrength=function(t){return a});var c=[];if(s&&h&&(r=kr(e,h),c=Array.from(new Set(null==d?void 0:d.map((function(t){return t.data[h]}))))||[],t.centripetalOptions=Object.assign(l,{single:100,leaf:function(e){var n=r[e.id]||{},o=n.siblingLeaves,i=n.sameTypeLeaves;return(null==i?void 0:i.length)===(null==o?void 0:o.length)||1===(null==c?void 0:c.length)?1:t.clusterNodeStrength(e)},others:1,center:function(t){var n,o=e.getDegree(t.id,"both");if(!o)return{x:100,y:100,z:0};if(1===o){var i=(r[t.id]||{}).sameTypeLeaves,a=void 0===i?[]:i;1===a.length?n=void 0:a.length>1&&(n=zr(a))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),u&&h){r||(r=kr(e,h)),c||(c=Array.from(new Set(d.map((function(t){return t.data[h]}))))),c=c.filter((function(t){return void 0!==t}));var f={};c.forEach((function(t){var r=d.filter((function(e){return e.data[h]===t})).map((function(t){return e.getNode(t.id)}));f[t]=zr(r)})),t.centripetalOptions=Object.assign(l,{single:function(e){return t.clusterNodeStrength(e)},leaf:function(e){return t.clusterNodeStrength(e)},others:function(e){return t.clusterNodeStrength(e)},center:function(t){var e=f[t.data[h]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}var g=t.centripetalOptions||{},p=g.leaf,v=g.single,y=g.others;p&&"function"!=typeof p&&(t.centripetalOptions.leaf=function(){return p}),v&&"function"!=typeof v&&(t.centripetalOptions.single=function(){return v}),y&&"function"!=typeof y&&(t.centripetalOptions.others=function(){return y})},t.prototype.runOneStep=function(t,e,r,n,o){var i={},a=t.getAllNodes(),s=t.getAllEdges();if(null==a?void 0:a.length){var u=o.monitor;this.calRepulsive(t,i,o),s&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u&&u({energy:this.calTotalEnergy(i,a),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}},t.prototype.calTotalEnergy=function(t,e){var r=this;if(!(null==e?void 0:e.length))return 0;var n=0;return e.forEach((function(e,o){var i=t[e.id].x,a=t[e.id].y,s=3===r.options.dimensions?t[e.id].z:0,u=i*i+a*a+s*s,h=e.data.mass;n+=(void 0===h?1:h)*u*.5})),n},t.prototype.calRepulsive=function(t,e,r){var n=r.dimensions,o=r.factor,i=r.coulombDisScale;!function(t,e,r,n,o){var i=e/r,a=t.getAllNodes(),s=a.map((function(t,e){var r=t.data,n=r.nodeStrength;return{x:r.x,y:r.y,z:r.z,size:r.size,index:e,vx:0,vy:0,vz:0,weight:i*n}})),u=(2===o?C(s,(function(t){return t.x}),(function(t){return t.y})):mr(s,(function(t){return t.x}),(function(t){return t.y}),(function(t){return t.z}))).visitAfter(Nr);s.forEach((function(t){!function(t,e,r){e.visit((function(e,n,o,i,a){return br(e,n,o,i,a,t,r)}))}(t,u,o)})),s.map((function(t,e){var r=a[e],o=r.id,i=r.data.mass,s=void 0===i?1:i;n[o]={x:t.vx/s,y:t.vy/s,z:t.vz/s}}))}(t,o,i*i,e,n)},t.prototype.calAttractive=function(t,e,r){var n=r.dimensions;t.getAllEdges().forEach((function(r,o){var i=r.source,a=r.target,s=t.getNode(i),u=t.getNode(a);if(s&&u){var h=u.data.x-s.data.x,d=u.data.y-s.data.y,l=3===n?u.data.z-s.data.z:0;h||d||(h=.01*Math.random(),d=.01*Math.random(),3!==n||l||(l=.01*Math.random()));var c=Math.sqrt(h*h+d*d+l*l),f=h/c,g=d/c,p=l/c,v=r.data||{},y=v.linkDistance,m=void 0===y?200:y,w=v.edgeStrength,x=(m-c)*(void 0===w?200:w),E=1/(s.data.mass||1),N=1/(u.data.mass||1),b=f*x,M=g*x,S=p*x;e[i].x-=b*E,e[i].y-=M*E,e[i].z-=S*E,e[a].x+=b*N,e[a].y+=M*N,e[a].z+=S*N}}))},t.prototype.calGravity=function(t,e,r,n){var o=n.getCenter,i=t.getAllNodes(),a=e.getAllNodes(),u=e.getAllEdges(),h=n.width,d=n.height,l=n.center,c=n.gravity,f=n.centripetalOptions;i&&i.forEach((function(n){var i=n.id,g=n.data,p=g.mass,y=g.x,m=g.y,w=g.z,x=e.getNode(i),E=0,N=0,b=0,M=c,S=t.getDegree(i,"in"),k=t.getDegree(i,"out"),A=t.getDegree(i,"both"),_=null==o?void 0:o(x,A);if(_){var z=s(_,3);E=y-z[0],N=m-z[1],M=z[2]}else E=y-l[0],N=m-l[1],b=w-l[2];if(M&&(r[i].x-=M*E/p,r[i].y-=M*N/p,r[i].z-=M*b/p),f){var R=f.leaf,I=f.single,D=f.others,O=f.center,P=(null==O?void 0:O(x,a,u,h,d))||{x:0,y:0,z:0,centerStrength:0},T=P.x,C=P.y,q=P.z,L=P.centerStrength;if(!v(T)||!v(C))return;var j=(y-T)/p,F=(m-C)/p,V=(w-q)/p;if(L&&(r[i].x-=L*j,r[i].y-=L*F,r[i].z-=L*V),0===A){var B=I(x);if(!B)return;return r[i].x-=B*j,r[i].y-=B*F,void(r[i].z-=B*V)}if(0===S||0===k){var G=R(x,a,u);if(!G)return;return r[i].x-=G*j,r[i].y-=G*F,void(r[i].z-=G*V)}var W=D(x);if(!W)return;r[i].x-=W*j,r[i].y-=W*F,r[i].z-=W*V}}))},t.prototype.updateVelocity=function(t,e,r,n){var o=n.damping,i=n.maxSpeed,a=n.interval,s=n.dimensions,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((function(t){var n=t.id,u=(r[n].x+e[n].x*a)*o||.01,h=(r[n].y+e[n].y*a)*o||.01,d=3===s?(r[n].z+e[n].z*a)*o||.01:0,l=Math.sqrt(u*u+h*h+d*d);if(l>i){var c=i/l;u*=c,h*=c,d*=c}r[n]={x:u,y:h,z:d}}))},t.prototype.updatePosition=function(t,e,r,n){var o=this,i=n.distanceThresholdMode,a=n.interval,s=n.dimensions,u=e.getAllNodes();if(null==u?void 0:u.length){var h=0;"max"===i?this.judgingDistance=-1/0:"min"===i&&(this.judgingDistance=1/0),u.forEach((function(n){var u=n.id,d=t.getNode(u);if(v(d.data.fx)&&v(d.data.fy))e.mergeNodeData(u,{x:d.data.fx,y:d.data.fy,z:3===s?d.data.fz:void 0});else{var l=r[u].x*a,c=r[u].y*a,f=3===s?r[u].z*a:0;e.mergeNodeData(u,{x:n.data.x+l,y:n.data.y+c,z:n.data.z+f});var g=Math.sqrt(l*l+c*c+f*f);switch(i){case"max":o.judgingDistance<g&&(o.judgingDistance=g);break;case"min":o.judgingDistance>g&&(o.judgingDistance=g);break;default:h+=g}}})),i&&"mean"!==i||(this.judgingDistance=h/u.length)}else this.judgingDistance=0},t}(),kr=function(t,e){var r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};var n={};return r.forEach((function(r,o){1===t.getDegree(r.id,"both")&&(n[r.id]=Ar(t,"leaf",r,e))})),n},Ar=function(t,e,r,n){var o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out"),a=r,s=[];return 0===o?(a=t.getSuccessors(r.id)[0],s=t.getNeighbors(a.id)):0===i&&(a=t.getPredecessors(r.id)[0],s=t.getNeighbors(a.id)),s=s.filter((function(e){return 0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")})),{coreNode:a,siblingLeaves:s,sameTypeLeaves:_r(t,e,n,r,s)}},_r=function(t,e,r,n,o){var i=n.data[r]||"",a=(null==o?void 0:o.filter((function(t){return t.data[r]===i})))||[];return"leaf"===e&&(a=a.filter((function(e){return 0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")}))),a},zr=function(t){var e={x:0,y:0};t.forEach((function(t){var r=t.data,n=r.x,o=r.y;e.x+=n||0,e.y+=o||0}));var r=t.length||1;return{x:e.x/r,y:e.y/r}},Rr=function(t,e){return e.map((function(e){var r=e.id,o=e.data,i=t.getNode(r);return n(n({},i),{data:n(n({},i.data),{x:o.x,y:o.y,z:o.z})})}))},Ir=function(){function t(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}return t.prototype.distanceTo=function(t){var e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)},t.prototype.setPos=function(t,e){this.rx=t,this.ry=e},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(t){var e=t.rx-this.rx,r=t.ry-this.ry,n=Math.hypot(e,r);n=n<1e-4?1e-4:n;var o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n},t.prototype.in=function(t){return t.contains(this.rx,this.ry)},t.prototype.add=function(e){var r=this.mass+e.mass;return new t({rx:(this.rx*this.mass+e.rx*e.mass)/r,ry:(this.ry*this.mass+e.ry*e.mass)/r,mass:r,degree:this.degree+e.degree})},t}();const Dr=Ir;const Or=function(){function t(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(t,e){var r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r},t.prototype.NW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.NE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid+this.length/4,length:this.length/2})},t.prototype.SW=function(){return new t({xmid:this.xmid-this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t.prototype.SE=function(){return new t({xmid:this.xmid+this.length/4,ymid:this.ymid-this.length/4,length:this.length/2})},t}(),Pr=function(){function t(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}return t.prototype.insert=function(e){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e)):this.body=e},t.prototype._putBody=function(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))},t.prototype._isExternal=function(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE},t.prototype.updateForce=function(t){null!=this.body&&t!==this.body&&(this._isExternal()||(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t)))},t}();var Tr={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1},Cr=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="forceAtlas2",this.options=n(n({},Tr),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericForceAtlas2Layout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericForceAtlas2Layout(!0,t,e),[2]}))}))},t.prototype.genericForceAtlas2Layout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,f,g,p,v,y,m,w,x,E,N,S,k,A,_,z;return a(this,(function(a){if(o=e.getAllEdges(),i=e.getAllNodes(),s=this.formatOptions(r,i.length),u=s.width,h=s.height,d=s.prune,l=s.maxIteration,f=s.nodeSize,g=s.center,!(null==i?void 0:i.length)||1===i.length)return[2,M(e,t,g)];if(p=i.map((function(t){return b(t,[u,h])})),v=o.filter((function(t){return t.source!==t.target})),y=new c({nodes:p,edges:v}),m=this.getSizes(y,e,f),this.run(y,e,l,m,t,s),d){for(w=0;w<v.length;w+=1)x=v[w],E=x.source,N=x.target,S=y.getDegree(E),k=y.getDegree(E),S<=1?(A=y.getNode(N),y.mergeNodeData(E,{x:A.data.x,y:A.data.y})):k<=1&&(_=y.getNode(E),y.mergeNodeData(N,{x:_.data.x,y:_.data.y}));z=n(n({},s),{prune:!1,barnesHut:!1}),this.run(y,e,100,m,t,z)}return[2,{nodes:p,edges:o}]}))}))},t.prototype.getSizes=function(t,e,r){for(var n=t.getAllNodes(),o={},i=0;i<n.length;i+=1){var a=n[i],h=a.id,d=a.data;if(o[h]=10,v(d.size))o[h]=d.size;else if(m(d.size))isNaN(d.size[0])||(o[h]=Math.max(d.size[0])),isNaN(d.size[1])||(o[h]=Math.max(d.size[1]));else if(y(d.size))o[h]=Math.max(d.size.width,d.size.height);else if(f(r)){var l=r(e.getNode(h));m(l)?o[h]=Math.max.apply(Math,u([],s(l))):o[h]=l}else m(r)?o[h]=Math.max.apply(Math,u([],s(r))):v(r)&&(o[h]=r)}return o},t.prototype.formatOptions=function(t,e){void 0===t&&(t={});var r=n(n({},this.options),t),o=r.center,i=r.width,a=r.height,s=r.barnesHut,u=r.prune,h=r.maxIteration,d=r.kr,l=r.kg;return r.width=i||"undefined"==typeof window?i:window.innerWidth,r.height=a||"undefined"==typeof window?a:window.innerHeight,r.center=o||[r.width/2,r.height/2],void 0===s&&e>250&&(r.barnesHut=!0),void 0===u&&e>100&&(r.prune=!0),0!==h||u?0===h&&u&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),d||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),l||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r},t.prototype.run=function(t,e,r,n,o,i){for(var a=i.kr,s=i.barnesHut,u=i.onTick,h=t.getAllNodes(),d=0,l=r,c={},f={},g={},p=0;p<h.length;p+=1){var v=h[p],y=v.data,m=v.id;if(c[m]=[0,0],s){var w={id:p,rx:y.x,ry:y.y,mass:1,g:a,degree:t.getDegree(m)};g[m]=new Dr(w)}}for(;l>0;)d=this.oneStep(t,{iter:l,preventOverlapIters:50,krPrime:100,sg:d,forces:c,preForces:f,bodies:g,sizes:n},i),l--,null==u||u({nodes:h,edges:e.getAllEdges()});return t},t.prototype.oneStep=function(t,e,r){for(var n=e.iter,o=e.preventOverlapIters,i=e.krPrime,a=e.sg,h=e.preForces,d=e.bodies,l=e.sizes,c=e.forces,f=r.preventOverlap,g=r.barnesHut,p=t.getAllNodes(),v=0;v<p.length;v+=1){var y=p[v].id;h[y]=u([],s(c[y])),c[y]=[0,0]}return c=this.getAttrForces(t,n,o,l,c,r),c=g&&(f&&n>o||!f)?this.getOptRepGraForces(t,c,d,r):this.getRepGraForces(t,n,o,c,i,l,r),this.updatePos(t,c,h,a,r)},t.prototype.getAttrForces=function(t,e,r,n,o,i){for(var a=i.preventOverlap,s=i.dissuadeHubs,u=i.mode,h=i.prune,d=t.getAllEdges(),l=0;l<d.length;l+=1){var c=d[l],f=c.source,g=c.target,p=t.getNode(f),v=t.getNode(g),y=t.getDegree(f),m=t.getDegree(g);if(!h||!(y<=1||m<=1)){var w=[v.data.x-p.data.x,v.data.y-p.data.y],x=Math.hypot(w[0],w[1]);x=x<1e-4?1e-4:x,w[0]=w[0]/x,w[1]=w[1]/x,a&&e<r&&(x=x-n[f]-n[g]);var E=x,N=E;"linlog"===u&&(N=E=Math.log(1+x)),s&&(E=x/y,N=x/m),a&&e<r&&x<=0?(E=0,N=0):a&&e<r&&x>0&&(E=x,N=x),o[f][0]+=E*w[0],o[g][0]-=N*w[0],o[f][1]+=E*w[1],o[g][1]-=N*w[1]}}return o},t.prototype.getOptRepGraForces=function(t,e,r,n){for(var o=n.kg,i=n.center,a=n.prune,s=t.getAllNodes(),u=s.length,h=9e10,d=-9e10,l=9e10,c=-9e10,f=0;f<u;f+=1){var g=s[f],p=g.id,v=g.data;a&&t.getDegree(p)<=1||(r[p].setPos(v.x,v.y),v.x>=d&&(d=v.x),v.x<=h&&(h=v.x),v.y>=c&&(c=v.y),v.y<=l&&(l=v.y))}var y=Math.max(d-h,c-l),m=new Or({xmid:(d+h)/2,ymid:(c+l)/2,length:y,massCenter:i,mass:u}),w=new Pr(m);for(f=0;f<u;f+=1)p=s[f].id,a&&t.getDegree(p)<=1||r[p].in(m)&&w.insert(r[p]);for(f=0;f<u;f+=1){var x=s[f],E=(p=x.id,v=x.data,t.getDegree(p));if(!(a&&E<=1)){r[p].resetForce(),w.updateForce(r[p]),e[p][0]-=r[p].fx,e[p][1]-=r[p].fy;var N=[v.x-i[0],v.y-i[1]],b=Math.hypot(N[0],N[1]);b=b<1e-4?1e-4:b,N[0]=N[0]/b,N[1]=N[1]/b;var M=o*(E+1);e[p][0]-=M*N[0],e[p][1]-=M*N[1]}}return e},t.prototype.getRepGraForces=function(t,e,r,n,o,i,a){for(var s=a.preventOverlap,u=a.kr,h=a.kg,d=a.center,l=a.prune,c=t.getAllNodes(),f=c.length,g=0;g<f;g+=1){for(var p=c[g],v=t.getDegree(p.id),y=g+1;y<f;y+=1){var m=c[y],w=t.getDegree(m.id);if(!l||!(v<=1||w<=1)){var x=[m.data.x-p.data.x,m.data.y-p.data.y],E=Math.hypot(x[0],x[1]);E=E<1e-4?1e-4:E,x[0]=x[0]/E,x[1]=x[1]/E,s&&e<r&&(E=E-i[p.id]-i[m.id]);var N=u*(v+1)*(w+1)/E;s&&e<r&&E<0?N=o*(v+1)*(w+1):s&&e<r&&0===E?N=0:s&&e<r&&E>0&&(N=u*(v+1)*(w+1)/E),n[p.id][0]-=N*x[0],n[m.id][0]+=N*x[0],n[p.id][1]-=N*x[1],n[m.id][1]+=N*x[1]}}var b=[p.data.x-d[0],p.data.y-d[1]],M=Math.hypot(b[0],b[1]);b[0]=b[0]/M,b[1]=b[1]/M;var S=h*(v+1);n[p.id][0]-=S*b[0],n[p.id][1]-=S*b[1]}return n},t.prototype.updatePos=function(t,e,r,n,o){for(var i=o.ks,a=o.tao,s=o.prune,u=o.ksmax,h=t.getAllNodes(),d=h.length,l=[],c=[],f=0,g=0,p=n,y=0;y<d;y+=1){var m=h[y].id,w=t.getDegree(m);if(!(s&&w<=1)){var x=[e[m][0]-r[m][0],e[m][1]-r[m][1]],E=Math.hypot(x[0],x[1]),N=[e[m][0]+r[m][0],e[m][1]+r[m][1]],b=Math.hypot(N[0],N[1]);l[y]=E,c[y]=b/2,f+=(w+1)*l[y],g+=(w+1)*c[y]}}var M=p;for(p=a*g/f,0!==M&&(p=p>1.5*M?1.5*M:p),y=0;y<d;y+=1){var S=h[y],k=(m=S.id,S.data);if(w=t.getDegree(m),!(s&&w<=1||v(k.fx)&&v(k.fy))){var A=i*p/(1+p*Math.sqrt(l[y])),_=Math.hypot(e[m][0],e[m][1]),z=u/(_=_<1e-4?1e-4:_),R=(A=A>z?z:A)*e[m][0],I=A*e[m][1];t.mergeNodeData(m,{x:k.x+R,y:k.y+I})}}return p},t}(),qr={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Lr=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=n(n({},qr),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericFruchtermanLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericFruchtermanLayout(!0,t,e),[2]}))}))},t.prototype.stop=function(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1},t.prototype.tick=function(t){var e=this;if(void 0===t&&(t=this.options.maxIteration||1),this.lastResult)return this.lastResult;for(var r=0;r<t;r++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);var n={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&n.nodes.forEach((function(t){return e.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===e.options.dimensions?t.data.z:void 0})})),n},t.prototype.genericFruchtermanLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,f,g,p,v,y,m,w,x,E,N=this;return a(this,(function(a){return this.running?[2]:(o=this.formatOptions(r),i=o.dimensions,s=o.width,u=o.height,h=o.center,d=o.clustering,l=o.nodeClusterBy,f=o.maxIteration,g=o.onTick,p=e.getAllNodes(),v=e.getAllEdges(),(null==p?void 0:p.length)?1===p.length?(t&&e.mergeNodeData(p[0].id,{x:h[0],y:h[1],z:3===i?h[2]:void 0}),y={nodes:[n(n({},p[0]),{data:n(n({},p[0].data),{x:h[0],y:h[1],z:3===i?h[2]:void 0})})],edges:v},this.lastResult=y,[2,y]):(m=p.map((function(t){return b(t,[s,u])})),w=new c({nodes:m,edges:v}),x={},d&&m.forEach((function(t){var e=t.data[l];x[e]||(x[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=m,this.lastLayoutEdges=v,this.lastAssign=t,this.lastGraph=w,this.lastOptions=o,this.lastClusterMap=x,"undefined"==typeof window?[2]:(E=0,[2,new Promise((function(r){N.timeInterval=window.setInterval((function(){N.running?(N.runOneStep(w,x,o),t&&m.forEach((function(t){var r=t.id,n=t.data;return e.mergeNodeData(r,{x:n.x,y:n.y,z:3===i?n.z:void 0})})),null==g||g({nodes:m,edges:v}),++E>=f&&(window.clearInterval(N.timeInterval),r({nodes:m,edges:v}))):r({nodes:m,edges:v})}),0),N.running=!0}))])):(y={nodes:[],edges:v},this.lastResult=y,[2,y]))}))}))},t.prototype.formatOptions=function(t){void 0===t&&(t={});var e=n(n({},this.options),t),r=e.clustering,o=e.nodeClusterBy,i=e.center,a=e.width,s=e.height;return e.width=a||"undefined"==typeof window?a:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=i||[e.width/2,e.height/2],e.clustering=r&&!!o,e},t.prototype.runOneStep=function(t,e,r){var n=r.dimensions,o=r.height,i=r.width,a=r.gravity,s=r.center,u=r.speed,h=r.clustering,d=r.nodeClusterBy,l=r.clusterGravity,c=o*i,f=Math.sqrt(c)/10,g=t.getAllNodes(),p=c/(g.length+1),y=Math.sqrt(p),m={};if(this.applyCalculate(t,m,y,p),h){for(var w in e)e[w].cx=0,e[w].cy=0,e[w].count=0;for(var w in g.forEach((function(t){var r=t.data,n=e[r[d]];v(r.x)&&(n.cx+=r.x),v(r.y)&&(n.cy+=r.y),n.count++})),e)e[w].cx/=e[w].count,e[w].cy/=e[w].count;var x=l||a;g.forEach((function(t,r){var n=t.id,o=t.data;if(v(o.x)&&v(o.y)){var i=e[o[d]],a=Math.sqrt((o.x-i.cx)*(o.x-i.cx)+(o.y-i.cy)*(o.y-i.cy)),s=y*x;m[n].x-=s*(o.x-i.cx)/a,m[n].y-=s*(o.y-i.cy)/a}}))}g.forEach((function(t,e){var r=t.id,o=t.data;if(v(o.x)&&v(o.y)){var i=.01*y*a;m[r].x-=i*(o.x-s[0]),m[r].y-=i*(o.y-s[1]),3===n&&(m[r].z-=i*(o.z-s[2]))}})),g.forEach((function(e,r){var o=e.id,i=e.data;if(v(i.fx)&&v(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(v(i.x)&&v(i.y)){var a=Math.sqrt(m[o].x*m[o].x+m[o].y*m[o].y+(3===n?m[o].z*m[o].z:0));if(a>0){var s=Math.min(f*(u/800),a);t.mergeNodeData(o,{x:i.x+m[o].x/a*s,y:i.y+m[o].y/a*s,z:3===n?i.z+m[o].z/a*s:void 0})}}}))},t.prototype.applyCalculate=function(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)},t.prototype.calRepulsive=function(t,e,r){var n=this,o=t.getAllNodes();o.forEach((function(t,i){var a=t.data,s=t.id;e[s]={x:0,y:0,z:0},o.forEach((function(t,o){var u=t.data,h=t.id;if(!(i<=o)&&v(a.x)&&v(u.x)&&v(a.y)&&v(u.y)){var d=a.x-u.x,l=a.y-u.y,c=3===n.options.dimensions?a.z-u.z:0,f=d*d+l*l+c*c;0===f&&(f=1,d=.01,l=.01,c=.01);var g=r/f,p=d*g,y=l*g,m=c*g;e[s].x+=p,e[s].y+=y,e[h].x-=p,e[h].y-=y,3===n.options.dimensions&&(e[s].z+=m,e[h].z-=m)}}))}))},t.prototype.calAttractive=function(t,e,r){var n=this;t.getAllEdges().forEach((function(o){var i=o.source,a=o.target;if(i&&a&&i!==a){var s=t.getNode(i).data,u=t.getNode(a).data;if(v(u.x)&&v(s.x)&&v(u.y)&&v(s.y)){var h=u.x-s.x,d=u.y-s.y,l=3===n.options.dimensions?u.z-s.z:0,c=Math.sqrt(h*h+d*d+l*l)/r,f=h*c,g=d*c,p=l*c;e[i].x+=f,e[i].y+=g,e[a].x-=f,e[a].y-=g,3===n.options.dimensions&&(e[i].z+=p,e[a].z-=p)}}}))},t}(),jr={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300},Fr=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="grid",this.options=n(n({},jr),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericGridLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericGridLayout(!0,t,e),[2]}))}))},t.prototype.genericGridLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,c,f,g,p,y,E,N,S,k,A,_,R,I,D,O,P,T,C,q,L,j,F,V,B,G,W,$,U,H,K;return a(this,(function(a){if(o=n(n({},this.options),r),i=o.begin,s=void 0===i?[0,0]:i,u=o.condense,h=o.preventOverlapPadding,d=o.preventOverlap,l=o.rows,c=o.cols,f=o.nodeSpacing,g=o.nodeSize,p=o.width,y=o.height,E=o.position,N=o.sortBy,S=e.getAllNodes(),k=e.getAllEdges(),!(A=null==S?void 0:S.length)||1===A)return[2,M(e,t,s)];if(_=S.map((function(t){return b(t)})),"id"===N||z(N)&&void 0!==_[0].data[N]||(N="degree"),"degree"===N?_.sort((function(t,r){return e.getDegree(r.id,"both")-e.getDegree(t.id,"both")})):"id"===N?_.sort((function(t,e){return v(e.id)&&v(t.id)?e.id-t.id:(""+t.id).localeCompare(""+e.id)})):_.sort((function(t,e){return e.data[N]-t.data[N]})),R=p||"undefined"==typeof window?p:window.innerWidth,I=y||"undefined"==typeof window?y:window.innerHeight,D=A,O={rows:l,cols:c},null!=l&&null!=c?(O.rows=l,O.cols=c):null!=l&&null==c?(O.rows=l,O.cols=Math.ceil(D/O.rows)):null==l&&null!=c?(O.cols=c,O.rows=Math.ceil(D/O.cols)):(P=Math.sqrt(D*I/R),O.rows=Math.round(P),O.cols=Math.round(R/I*P)),O.rows=Math.max(O.rows,1),O.cols=Math.max(O.cols,1),O.cols*O.rows>D)T=Vr(O),C=Br(O),(T-1)*C>=D?Vr(O,T-1):(C-1)*T>=D&&Br(O,C-1);else for(;O.cols*O.rows<D;)T=Vr(O),((C=Br(O))+1)*T>=D?Br(O,C+1):Vr(O,T+1);for(q=u?0:R/O.cols,L=u?0:I/O.rows,(d||f)&&(j=w(10,f),F=x(30,g,!1),_.forEach((function(t){t.data.x&&t.data.y||(t.data.x=0,t.data.y=0);var r,n,o=e.getNode(t.id),i=F(o)||30;m(i)?(r=i[0],n=i[1]):(r=i,n=i);var a=void 0!==j?j(t):h,s=r+a,u=n+a;q=Math.max(q,s),L=Math.max(L,u)}))),V={},B={row:0,col:0},G={},W=0;W<_.length;W++){if($=_[W],U=void 0,E&&(U=E(e.getNode($.id))),U&&(void 0!==U.row||void 0!==U.col)){if(void 0===(H={row:U.row,col:U.col}).col)for(H.col=0;Gr(V,H);)H.col++;else if(void 0===H.row)for(H.row=0;Gr(V,H);)H.row++;G[$.id]=H,Wr(V,H)}Ur($,s,q,L,G,O,B,V)}return K={nodes:_,edges:k},t&&_.forEach((function(t){e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,K]}))}))},t}(),Vr=function(t,e){var r,n=t.rows||5,o=t.cols||5;return null==e?r=Math.min(n,o):Math.min(n,o)===t.rows?t.rows=e:t.cols=e,r},Br=function(t,e){var r,n=t.rows||5,o=t.cols||5;return null==e?r=Math.max(n,o):Math.max(n,o)===t.rows?t.rows=e:t.cols=e,r},Gr=function(t,e){return t["c-"+e.row+"-"+e.col]||!1},Wr=function(t,e){return t["c-"+e.row+"-"+e.col]=!0},$r=function(t,e){var r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},Ur=function(t,e,r,n,o,i,a,s){var u,h,d=o[t.id];if(d)u=d.col*r+r/2+e[0],h=d.row*n+n/2+e[1];else{for(;Gr(s,a);)$r(i,a);u=a.col*r+r/2+e[0],h=a.row*n+n/2+e[1],Wr(s,a),$r(i,a)}t.data.x=u,t.data.y=h};const Hr=Object.prototype.toString;function Kr(t){const e=Hr.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function Yr(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Kr(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!Kr(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Kr(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[n],s=n+1;s<i;s++)t[s]<a&&(a=t[s]);return a}(t),o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Kr(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,n=void 0===r?0:r,o=e.toIndex,i=void 0===o?t.length:o;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[n],s=n+1;s<i;s++)t[s]>a&&(a=t[s]);return a}(t);if(n===o)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=r.min,a=void 0===i?r.autoMinMax?n:0:i,s=r.max,u=void 0===s?r.autoMinMax?o:1:s;if(a>=u)throw new RangeError("min option must be smaller than max option");for(var h=(u-a)/(o-n),d=0;d<t.length;d++)e[d]=(t[d]-n)*h+a;return e}const Jr=" ".repeat(2),Xr=" ".repeat(4);function Qr(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:o=8,padMinus:i="auto"}=e;return`${t.constructor.name} {\n${Jr}[\n${Xr}${function(t,e,r,n,o){const{rows:i,columns:a}=t,s=Math.min(i,e),u=Math.min(a,r),h=[];if("auto"===o){o=!1;t:for(let e=0;e<s;e++)for(let r=0;r<u;r++)if(t.get(e,r)<0){o=!0;break t}}for(let e=0;e<s;e++){let r=[];for(let i=0;i<u;i++)r.push(Zr(t.get(e,i),n,o));h.push(`${r.join(" ")}`)}return u!==a&&(h[h.length-1]+=` ... ${a-r} more columns`),s!==i&&h.push(`... ${i-e} more rows`),h.join(`\n${Xr}`)}(t,r,n,o,i)}\n${Jr}]\n${Jr}rows: ${t.rows}\n${Jr}columns: ${t.columns}\n}`}function Zr(t,e,r){return(t>=0&&r?` ${tn(t,e-1)}`:tn(t,e)).padEnd(e)}function tn(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function en(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function rn(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function nn(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function on(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function an(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(un("startRow",e),un("endRow",r),un("startColumn",n),un("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function sn(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function un(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function hn(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class dn{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new cn(t,e);for(let o=0;o<t;o++)for(let t=0;t<e;t++)n.set(o,t,r[o*e+t]);return n}static rowVector(t){let e=new cn(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new cn(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new cn(t,e)}static ones(t,e){return new cn(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let o=new cn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)o.set(r,t,n());return o}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:o=1e3,random:i=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(o))throw new TypeError("max must be an integer");if(n>=o)throw new RangeError("min must be smaller than max");let a=o-n,s=new cn(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(i()*a);s.set(r,t,e)}return s}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),o=this.zeros(t,e);for(let t=0;t<n;t++)o.set(t,t,r);return o}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let o=Math.min(n,e,r),i=this.zeros(e,r);for(let e=0;e<o;e++)i.set(e,e,t[e]);return i}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new cn(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.min(t.get(i,r),e.get(i,r)));return o}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,o=new this(r,n);for(let i=0;i<r;i++)for(let r=0;r<n;r++)o.set(i,r,Math.max(t.get(i,r),e.get(i,r)));return o}static checkMatrix(t){return dn.isMatrix(t)?t:new cn(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,o=!1;for(;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let o=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/o);for(let n=e+1;n<t.rows;n++){let o=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let i=r+1;i<t.columns;i++)t.set(n,i,t.get(n,i)-t.get(e,i)*o)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let o=0,i=!1;for(;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(let r=0;r<n;r++){let i=t.get(r,o);for(let a=o;a<e;a++){let e=t.get(r,a)-i*t.get(n,a);t.set(r,a,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new cn(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){en(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return cn.rowVector(this.getRow(t))}setRow(t,e){en(this,t),e=nn(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){en(this,t),en(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){rn(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return cn.columnVector(this.getColumn(t))}setColumn(t,e){rn(this,t),e=on(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){rn(this,t),rn(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=nn(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=nn(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=nn(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=nn(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=on(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=on(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=on(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=on(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){en(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){rn(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){hn(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){hn(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(en(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){en(this,t),hn(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(en(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){en(this,t),hn(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(rn(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){rn(this,t),hn(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(rn(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){rn(this,t),hn(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r)*this.get(t,r);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){dn.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=cn.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,o=new cn(e,n),i=new Float64Array(r);for(let a=0;a<n;a++){for(let e=0;e<r;e++)i[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*i[n];o.set(t,a,e)}}return o}strassen2x2(t){t=cn.checkMatrix(t);let e=new cn(2,2);const r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),a=this.get(1,0),s=t.get(1,0),u=this.get(1,1),h=t.get(1,1),d=(r+u)*(n+h),l=(a+u)*n,c=r*(i-h),f=u*(s-n),g=(r+o)*h,p=d+f-g+(o-u)*(s+h),v=c+g,y=l+f,m=d-l+c+(a-r)*(n+i);return e.set(0,0,p),e.set(0,1,v),e.set(1,0,y),e.set(1,1,m),e}strassen3x3(t){t=cn.checkMatrix(t);let e=new cn(3,3);const r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),a=this.get(1,1),s=this.get(1,2),u=this.get(2,0),h=this.get(2,1),d=this.get(2,2),l=t.get(0,0),c=t.get(0,1),f=t.get(0,2),g=t.get(1,0),p=t.get(1,1),v=t.get(1,2),y=t.get(2,0),m=t.get(2,1),w=t.get(2,2),x=(r-i)*(-c+p),E=(-r+i+a)*(l-c+p),N=(i+a)*(-l+c),b=r*l,M=(-r+u+h)*(l-f+v),S=(-r+u)*(f-v),k=(u+h)*(-l+f),A=(-o+h+d)*(p+y-m),_=(o-d)*(p-m),z=o*y,R=(h+d)*(-y+m),I=(-o+a+s)*(v+y-w),D=(o-s)*(v-w),O=(a+s)*(-y+w),P=b+z+n*g,T=(r+n+o-i-a-h-d)*p+E+N+b+A+z+R,C=b+M+k+(r+n+o-a-s-u-h)*v+z+I+O,q=x+a*(-l+c+g-p-v-y+w)+E+b+z+I+D,L=x+E+N+b+s*m,j=z+I+D+O+i*f,F=b+M+S+h*(-l+f+g-p-v-y+m)+A+_+z,V=A+_+z+R+u*c,B=b+M+S+k+d*w;return e.set(0,0,P),e.set(0,1,T),e.set(0,2,C),e.set(1,0,q),e.set(1,1,L),e.set(1,2,j),e.set(2,0,F),e.set(2,1,V),e.set(2,2,B),e}mmulStrassen(t){t=cn.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,o=t.rows,i=t.columns;function a(t,e,r){let n=t.rows,o=t.columns;if(n===e&&o===r)return t;{let n=dn.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==o&&console.warn(`Multiplying ${r} x ${n} and ${o} x ${i} matrix: dimensions do not match.`);let s=Math.max(r,o),u=Math.max(n,i);return e=a(e,s,u),function t(e,r,n,o){if(n<=512||o<=512)return e.mmul(r);n%2==1&&o%2==1?(e=a(e,n+1,o+1),r=a(r,n+1,o+1)):n%2==1?(e=a(e,n+1,o),r=a(r,n+1,o)):o%2==1&&(e=a(e,n,o+1),r=a(r,n,o+1));let i=parseInt(e.rows/2,10),s=parseInt(e.columns/2,10),u=e.subMatrix(0,i-1,0,s-1),h=r.subMatrix(0,i-1,0,s-1),d=e.subMatrix(0,i-1,s,e.columns-1),l=r.subMatrix(0,i-1,s,r.columns-1),c=e.subMatrix(i,e.rows-1,0,s-1),f=r.subMatrix(i,r.rows-1,0,s-1),g=e.subMatrix(i,e.rows-1,s,e.columns-1),p=r.subMatrix(i,r.rows-1,s,r.columns-1),v=t(dn.add(u,g),dn.add(h,p),i,s),y=t(dn.add(c,g),h,i,s),m=t(u,dn.sub(l,p),i,s),w=t(g,dn.sub(f,h),i,s),x=t(dn.add(u,d),p,i,s),E=t(dn.sub(c,u),dn.add(h,l),i,s),N=t(dn.sub(d,g),dn.add(f,p),i,s),b=dn.add(v,w);b.sub(x),b.add(N);let M=dn.add(m,x),S=dn.add(y,w),k=dn.sub(v,y);k.add(m),k.add(E);let A=dn.zeros(2*b.rows,2*b.columns);return A=A.setSubMatrix(b,0,0),A=A.setSubMatrix(M,b.rows,0),A=A.setSubMatrix(S,0,b.columns),A=A.setSubMatrix(k,b.rows,b.columns),A.subMatrix(0,n-1,0,o-1)}(e,t=a(t,s,u),s,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new cn(this.rows,this.columns);for(let t=0;t<this.rows;t++){const o=this.getRow(t);o.length>0&&Yr(o,{min:e,max:r,output:o}),n.setRow(t,o)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new cn(this.rows,this.columns);for(let t=0;t<this.columns;t++){const o=this.getColumn(t);o.length&&Yr(o,{min:e,max:r,output:o}),n.setColumn(t,o)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=cn.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new cn(e*n,r*o);for(let a=0;a<e;a++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let s=0;s<o;s++)i.set(n*a+r,o*e+s,this.get(a,e)*t.get(r,s));return i}kroneckerSum(t){if(t=cn.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(cn.eye(r,r)),o=cn.eye(e,e).kroneckerProduct(t);return n.add(o)}transpose(){let t=new cn(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=ln){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=ln){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){an(this,t,e,r,n);let o=new cn(e-t+1,n-r+1);for(let i=t;i<=e;i++)for(let e=r;e<=n;e++)o.set(i-t,e-r,this.get(i,e));return o}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new cn(t.length,r-e+1);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError(`Row index out of range: ${t[o]}`);n.set(o,i-e,this.get(t[o],i))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new cn(r-e+1,t.length);for(let o=0;o<t.length;o++)for(let i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError(`Column index out of range: ${t[o]}`);n.set(i-e,o,this.get(i,t[o]))}return n}setSubMatrix(t,e,r){if((t=cn.checkMatrix(t)).isEmpty())return this;an(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}selection(t,e){!function(t,e){if(!Kr(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!Kr(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let r=new cn(t.length,e.length);for(let n=0;n<t.length;n++){let o=t[n];for(let t=0;t<e.length;t++){let i=e[t];r.set(n,t,this.get(o,i))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){let t=new cn(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(e,r,this.get(e,r));return t}sum(t){switch(t){case"row":return function(t){let e=sn(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=sn(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=sn(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=sn(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Kr(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let a=0;a<n;a++){let n=0,s=0,u=0;for(let e=0;e<o;e++)u=t.get(a,e)-r[a],n+=u,s+=u*u;e?i.push((s-n*n/o)/(o-1)):i.push((s-n*n/o)/o)}return i}(this,r,n);case"column":if(!Kr(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,o=t.columns,i=[];for(let a=0;a<o;a++){let o=0,s=0,u=0;for(let e=0;e<n;e++)u=t.get(e,a)-r[a],o+=u,s+=u*u;e?i.push((s-o*o/n)/(n-1)):i.push((s-o*o/n)/n)}return i}(this,r,n);case void 0:if("number"!=typeof n)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,o=t.columns,i=n*o;let a=0,s=0,u=0;for(let e=0;e<n;e++)for(let n=0;n<o;n++)u=t.get(e,n)-r,a+=u,s+=u*u;return e?(s-a*a/i)/(i-1):(s-a*a/i)/i}(this,r,n);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!Kr(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!Kr(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!Kr(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!Kr(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return Qr(this,t)}}function ln(t,e){return t-e}dn.prototype.klass="Matrix","undefined"!=typeof Symbol&&(dn.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Qr(this)}),dn.random=dn.rand,dn.randomInt=dn.randInt,dn.diagonal=dn.diag,dn.prototype.diagonal=dn.prototype.diag,dn.identity=dn.eye,dn.prototype.negate=dn.prototype.neg,dn.prototype.tensorProduct=dn.prototype.kroneckerProduct;class cn extends dn{constructor(t,e){if(super(),cn.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e))}else{if(!Kr(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}}}this.rows=t,this.columns=e}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return en(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),en(this,t,!0),e=Float64Array.from(nn(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){rn(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),rn(this,t,!0),e=on(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let o=0;for(;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(dn,cn);class fn extends dn{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function gn(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class pn{constructor(t,e={}){if((t=fn.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:o=!0,computeRightSingularVectors:i=!0,autoTranspose:a=!1}=e;let s,u=Boolean(o),h=Boolean(i),d=!1;if(r<n)if(a){s=t.transpose(),r=s.rows,n=s.columns,d=!0;let e=u;u=h,h=e}else s=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else s=t.clone();let l=Math.min(r,n),c=Math.min(r+1,n),f=new Float64Array(c),g=new cn(r,l),p=new cn(n,n),v=new Float64Array(n),y=new Float64Array(r),m=new Float64Array(c);for(let t=0;t<c;t++)m[t]=t;let w=Math.min(r-1,n),x=Math.max(0,Math.min(n-2,r)),E=Math.max(w,x);for(let t=0;t<E;t++){if(t<w){f[t]=0;for(let e=t;e<r;e++)f[t]=gn(f[t],s.get(e,t));if(0!==f[t]){s.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<r;e++)s.set(e,t,s.get(e,t)/f[t]);s.set(t,t,s.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<n;e++){if(t<w&&0!==f[t]){let n=0;for(let o=t;o<r;o++)n+=s.get(o,t)*s.get(o,e);n=-n/s.get(t,t);for(let o=t;o<r;o++)s.set(o,e,s.get(o,e)+n*s.get(o,t))}v[e]=s.get(t,e)}if(u&&t<w)for(let e=t;e<r;e++)g.set(e,t,s.get(e,t));if(t<x){v[t]=0;for(let e=t+1;e<n;e++)v[t]=gn(v[t],v[e]);if(0!==v[t]){v[t+1]<0&&(v[t]=0-v[t]);for(let e=t+1;e<n;e++)v[e]/=v[t];v[t+1]+=1}if(v[t]=-v[t],t+1<r&&0!==v[t]){for(let e=t+1;e<r;e++)y[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)y[e]+=v[r]*s.get(e,r);for(let e=t+1;e<n;e++){let n=-v[e]/v[t+1];for(let o=t+1;o<r;o++)s.set(o,e,s.get(o,e)+n*y[o])}}if(h)for(let e=t+1;e<n;e++)p.set(e,t,v[e])}}let N=Math.min(n,r+1);if(w<n&&(f[w]=s.get(w,w)),r<N&&(f[N-1]=0),x+1<N&&(v[x]=s.get(x,N-1)),v[N-1]=0,u){for(let t=w;t<l;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<l;e++){let n=0;for(let o=t;o<r;o++)n+=g.get(o,t)*g.get(o,e);n=-n/g.get(t,t);for(let o=t;o<r;o++)g.set(o,e,g.get(o,e)+n*g.get(o,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(h)for(let t=n-1;t>=0;t--){if(t<x&&0!==v[t])for(let e=t+1;e<n;e++){let r=0;for(let o=t+1;o<n;o++)r+=p.get(o,t)*p.get(o,e);r=-r/p.get(t+1,t);for(let o=t+1;o<n;o++)p.set(o,e,p.get(o,e)+r*p.get(o,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let b=N-1,M=0,S=Number.EPSILON;for(;N>0;){let t,e;for(t=N-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+S*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(v[t])<=e||Number.isNaN(v[t])){v[t]=0;break}}if(t===N-2)e=4;else{let r;for(r=N-1;r>=t&&r!==t;r--){let e=(r!==N?Math.abs(v[r]):0)+(r!==t+1?Math.abs(v[r-1]):0);if(Math.abs(f[r])<=S*e){f[r]=0;break}}r===t?e=3:r===N-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=v[N-2];v[N-2]=0;for(let r=N-2;r>=t;r--){let o=gn(f[r],e),i=f[r]/o,a=e/o;if(f[r]=o,r!==t&&(e=-a*v[r-1],v[r-1]=i*v[r-1]),h)for(let t=0;t<n;t++)o=i*p.get(t,r)+a*p.get(t,N-1),p.set(t,N-1,-a*p.get(t,r)+i*p.get(t,N-1)),p.set(t,r,o)}break}case 2:{let e=v[t-1];v[t-1]=0;for(let n=t;n<N;n++){let o=gn(f[n],e),i=f[n]/o,a=e/o;if(f[n]=o,e=-a*v[n],v[n]=i*v[n],u)for(let e=0;e<r;e++)o=i*g.get(e,n)+a*g.get(e,t-1),g.set(e,t-1,-a*g.get(e,n)+i*g.get(e,t-1)),g.set(e,n,o)}break}case 3:{const e=Math.max(Math.abs(f[N-1]),Math.abs(f[N-2]),Math.abs(v[N-2]),Math.abs(f[t]),Math.abs(v[t])),o=f[N-1]/e,i=f[N-2]/e,a=v[N-2]/e,s=f[t]/e,d=v[t]/e,l=((i+o)*(i-o)+a*a)/2,c=o*a*(o*a);let y=0;0===l&&0===c||(y=l<0?0-Math.sqrt(l*l+c):Math.sqrt(l*l+c),y=c/(l+y));let m=(s+o)*(s-o)+y,w=s*d;for(let e=t;e<N-1;e++){let o=gn(m,w);0===o&&(o=Number.MIN_VALUE);let i=m/o,a=w/o;if(e!==t&&(v[e-1]=o),m=i*f[e]+a*v[e],v[e]=i*v[e]-a*f[e],w=a*f[e+1],f[e+1]=i*f[e+1],h)for(let t=0;t<n;t++)o=i*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+i*p.get(t,e+1)),p.set(t,e,o);if(o=gn(m,w),0===o&&(o=Number.MIN_VALUE),i=m/o,a=w/o,f[e]=o,m=i*v[e]+a*f[e+1],f[e+1]=-a*v[e]+i*f[e+1],w=a*v[e+1],v[e+1]=i*v[e+1],u&&e<r-1)for(let t=0;t<r;t++)o=i*g.get(t,e)+a*g.get(t,e+1),g.set(t,e+1,-a*g.get(t,e)+i*g.get(t,e+1)),g.set(t,e,o)}v[N-2]=m,M+=1;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=b;e++)p.set(e,t,-p.get(e,t));for(;t<b&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}M=0,N--}}if(d){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=f,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,o=cn.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?o.set(t,t,0):o.set(t,t,1/this.s[t]);let i=this.U,a=this.rightSingularVectors,s=a.mmul(o),u=a.rows,h=i.rows,d=cn.zeros(u,h);for(let t=0;t<u;t++)for(let e=0;e<h;e++){let r=0;for(let o=0;o<n;o++)r+=s.get(t,o)*i.get(e,o);d.set(t,e,r)}return d.mmul(e)}solveForDiagonal(t){return this.solve(cn.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new cn(r,this.s.length);for(let i=0;i<r;i++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&o.set(i,r,t.get(i,r)/this.s[r]);let i=this.U,a=i.rows,s=i.columns,u=new cn(r,a);for(let t=0;t<r;t++)for(let e=0;e<a;e++){let r=0;for(let n=0;n<s;n++)r+=o.get(t,n)*i.get(e,n);u.set(t,e,r)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return cn.diag(this.s)}}var vn,yn=function(t){for(var e=[],r=t.length,n=0;n<r;n+=1){e[n]=[];for(var o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(var i=0;i<r;i+=1)for(n=0;n<r;n+=1)for(o=0;o<r;o+=1)e[n][o]>e[n][i]+e[i][o]&&(e[n][o]=e[n][i]+e[i][o]);return e},mn=function(t,e){var r=t.nodes,n=t.edges,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach((function(t,e){i[t.id]=e,o.push([])})),null==n||n.forEach((function(t){var r=t.source,n=t.target,a=i[r],s=i[n];void 0!==a&&void 0!==s&&(o[a][s]=1,e||(o[s][a]=1))})),o},wn=function(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))},xn={center:[0,0],linkDistance:50},En=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="mds",this.options=n(n({},xn),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericMDSLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericMDSLayout(!0,t,e),[2]}))}))},t.prototype.genericMDSLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,c,f,g,p;return a(this,(function(a){return o=n(n({},this.options),r),i=o.center,s=void 0===i?[0,0]:i,u=o.linkDistance,h=void 0===u?50:u,d=e.getAllNodes(),l=e.getAllEdges(),(null==d?void 0:d.length)&&1!==d.length?(c=mn({nodes:d,edges:l},!1),f=yn(c),Nn(f),v=h,y=[],f.forEach((function(t){var e=[];t.forEach((function(t){e.push(t*v)})),y.push(e)})),g=bn(y),p=[],g.forEach((function(t,e){var r=b(d[e]);r.data.x=t[0]+s[0],r.data.y=t[1]+s[1],p.push(r)})),t&&p.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,{nodes:p,edges:l}]):[2,M(e,t,s)];var v,y}))}))},t}(),Nn=function(t){var e=-999999;t.forEach((function(t){t.forEach((function(t){t!==1/0&&e<t&&(e=t)}))})),t.forEach((function(r,n){r.forEach((function(r,o){r===1/0&&(t[n][o]=e)}))}))},bn=function(t){var e=cn.mul(cn.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);var i=new pn(e),a=cn.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((function(t){return cn.mul([t],[a]).toJSON()[0].splice(0,2)}))},Mn={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Sn=function(t,e,r,n,o,i){e.forEach((function(a,s){r[s]={x:0,y:0},e.forEach((function(e,u){if(s!==u&&o[s]===o[u]){var h=a.x-e.x,d=a.y-e.y,l=Math.sqrt(h*h+d*d);if(0===l){l=1;var c=s>u?1:-1;h=.01*c,d=.01*c}if(l<i(t[s])/2+i(t[u])/2){var f=n*n/l;r[s].x+=h/l*f,r[s].y+=d/l*f}}}))}))},kn=function(t,e,r,n,o,i,a,s){var u=i||a/10;return n&&e.forEach((function(e,r){var n=t[r].x-t[o].x,i=t[r].y-t[o].y,a=Math.sqrt(n*n+i*i),s=i/a,u=-n/a,h=Math.sqrt(e.x*e.x+e.y*e.y),d=Math.acos((s*e.x+u*e.y)/h);d>Math.PI/2&&(d-=Math.PI/2,s*=-1,u*=-1);var l=Math.cos(d)*h;e.x=s*l,e.y=u*l})),t.forEach((function(i,a){if(a!==o){var h=Math.sqrt(e[a].x*e[a].x+e[a].y*e[a].y);if(h>0&&a!==o){var d=Math.min(u*(r/800),h);if(i.x+=e[a].x/h*d,i.y+=e[a].y/h*d,n){var l=i.x-t[o].x,c=i.y-t[o].y,f=Math.sqrt(l*l+c*c);l=l/f*s[a],c=c/f*s[a],i.x=t[o].x+l,i.y=t[o].y+c}}}})),t},An={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10},_n=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="radial",this.options=n(n({},An),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericRadialLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericRadialLayout(!0,t,e),[2]}))}))},t.prototype.genericRadialLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,h,d,l,c,f,g,p,v,y,m,w,x,N,S,k,A,_,R,I,D,O,P,T,C,q,L,j,F,V,B,G,W,$,U,H,K,Y,J,X,Q,Z;return a(this,(function(a){if(o=n(n({},this.options),r),i=o.width,h=o.height,d=o.center,l=o.focusNode,c=o.unitRadius,f=o.nodeSize,g=o.nodeSpacing,p=o.strictRadial,v=o.preventOverlap,y=o.maxPreventOverlapIteration,m=o.sortBy,w=o.linkDistance,x=void 0===w?50:w,N=o.sortStrength,S=void 0===N?10:N,k=o.maxIteration,A=void 0===k?1e3:k,_=e.getAllNodes(),R=e.getAllEdges(),I=i||"undefined"==typeof window?i:window.innerWidth,D=h||"undefined"==typeof window?h:window.innerHeight,O=d||[I/2,D/2],!(null==_?void 0:_.length)||1===_.length)return[2,M(e,t,O)];if(P=_[0],z(l)){for(T=0;T<_.length;T++)if(_[T].id===l){P=_[T];break}}else P=l||_[0];return C=In(_,P.id),q=mn({nodes:_,edges:R},!1),L=yn(q),j=On(L,C),Dn(L,C,j+1),F=L[C],V=I-O[0]>O[0]?O[0]:I-O[0],B=D-O[1]>O[1]?O[1]:D-O[1],0===V&&(V=I/2),0===B&&(B=D/2),G=Math.min(V,B),W=Math.max.apply(Math,u([],s(F))),$=[],U=c||G/W,F.forEach((function(t,e){$[e]=t*U})),H=zn(_,L,x,$,U,m,S),K=Rn(H),Y=function(t,e,r){try{var n=cn.mul(cn.pow(e,2),-.5),o=n.mean("row"),i=n.mean("column"),a=n.mean();n.add(a).subRowVector(o).subColumnVector(i);var s=new pn(n),u=cn.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((function(e){return cn.mul([e],[u]).toJSON()[0].splice(0,t)}))}catch(t){for(var h=[],d=0;d<e.length;d++){var l=Math.random()*r,c=Math.random()*r;h.push([l,c])}return h}}(x,H,x),J=Y.map((function(t){var e=s(t,2),r=e[0],n=e[1];return{x:(isNaN(r)?Math.random()*x:r)-Y[C][0],y:(isNaN(n)?Math.random()*x:n)-Y[C][1]}})),this.run(A,J,K,H,$,C),v&&(X=E(f,g),Q={nodes:_,nodeSizeFunc:X,positions:J,radii:$,height:D,width:I,strictRadial:Boolean(p),focusIdx:C,iterations:y||200,k:J.length/4.5},J=function(t,e){for(var r=n(n({},Mn),e),o=r.positions,i=r.iterations,a=r.width,s=r.k,u=r.speed,h=void 0===u?100:u,d=r.strictRadial,l=r.focusIdx,c=r.radii,f=void 0===c?[]:c,g=r.nodeSizeFunc,p=t.getAllNodes(),v=[],y=a/10,m=0;m<i;m++)o.forEach((function(t,e){v[e]={x:0,y:0}})),Sn(p,o,v,s,f,g),kn(o,v,h,d,l,y,a,f);return o}(e,Q)),Z=[],J.forEach((function(t,e){var r=b(_[e]);r.data.x=t.x+O[0],r.data.y=t.y+O[1],Z.push(r)})),t&&Z.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,{nodes:Z,edges:R}]}))}))},t.prototype.run=function(t,e,r,n,o,i){for(var a=0;a<=t;a++){var s=a/t;this.oneIteration(s,e,o,n,r,i)}},t.prototype.oneIteration=function(t,e,r,n,o,i){var a=1-t;e.forEach((function(s,u){var h=wn(s,{x:0,y:0}),d=0===h?0:1/h;if(u!==i){var l=0,c=0,f=0;e.forEach((function(t,e){if(u!==e){var r=wn(s,t),i=0===r?0:1/r,a=n[e][u];f+=o[u][e],l+=o[u][e]*(t.x+a*(s.x-t.x)*i),c+=o[u][e]*(t.y+a*(s.y-t.y)*i)}}));var g=0===r[u]?0:1/r[u];f*=a,f+=t*g*g,l*=a,l+=t*g*s.x*d,s.x=l/f,c*=a,c+=t*g*s.y*d,s.y=c/f}}))},t}(),zn=function(t,e,r,n,o,i,a){if(!t)return[];var s=[];if(e){var u={};e.forEach((function(e,h){var d=[];e.forEach((function(e,s){var l,c;if(h===s)d.push(0);else if(n[h]===n[s])if("data"===i)d.push(e*(Math.abs(h-s)*a)/(n[h]/o));else if(i){var f=void 0,g=void 0;if(u[t[h].id])f=u[t[h].id];else{var p=("id"===i?t[h].id:null===(l=t[h].data)||void 0===l?void 0:l[i])||0;f=z(p)?p.charCodeAt(0):p,u[t[h].id]=f}u[t[s].id]?g=u[t[s].id]:(p=("id"===i?t[s].id:null===(c=t[s].data)||void 0===c?void 0:c[i])||0,g=z(p)?p.charCodeAt(0):p,u[t[s].id]=g),d.push(e*(Math.abs(f-g)*a)/(n[h]/o))}else d.push(e*r/(n[h]/o));else{var v=(r+o)/2;d.push(e*v)}})),s.push(d)}))}return s},Rn=function(t){for(var e=t.length,r=t[0].length,n=[],o=0;o<e;o++){for(var i=[],a=0;a<r;a++)0!==t[o][a]?i.push(1/(t[o][a]*t[o][a])):i.push(0);n.push(i)}return n},In=function(t,e){var r=-1;return t.forEach((function(t,n){t.id===e&&(r=n)})),Math.max(r,0)},Dn=function(t,e,r){for(var n=t.length,o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(var i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(o=0;o<n;o++)if(o!==e)for(i=0;i<n;i++)if(t[o][i]===1/0){var a=Math.abs(t[e][o]-t[e][i]);a=0===a?1:a,t[o][i]=a}},On=function(t,e){for(var r=0,n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r},Pn={center:[0,0],width:300,height:300},Tn=function(){function t(t){void 0===t&&(t={}),this.options=t,this.id="random",this.options=n(n({},Pn),t)}return t.prototype.execute=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.genericRandomLayout(!1,t,e)]}))}))},t.prototype.assign=function(t,e){return i(this,void 0,void 0,(function(){return a(this,(function(r){return this.genericRandomLayout(!0,t,e),[2]}))}))},t.prototype.genericRandomLayout=function(t,e,r){return i(this,void 0,void 0,(function(){var o,i,s,u,h,d,l,c,f;return a(this,(function(a){return o=n(n({},this.options),r),i=o.center,s=o.width,u=o.height,h=e.getAllNodes(),d=s||"undefined"==typeof window?s:window.innerWidth,l=u||"undefined"==typeof window?u:window.innerHeight,c=i||[d/2,l/2],f=[],h&&h.forEach((function(t){f.push({id:t.id,data:{x:.9*(Math.random()-.5)*d+c[0],y:.9*(Math.random()-.5)*l+c[1]}})})),t&&f.forEach((function(t){return e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),[2,{nodes:f,edges:e.getAllEdges()}]}))}))},t}(),Cn={circular:k,concentric:I,mds:En,random:Tn,grid:Fr,radial:_n,force:Sr,d3force:It,fruchterman:Lr,forceAtlas2:Cr,dagre:lr};function qn(){var t;(null===(t=vn)||void 0===t?void 0:t.stop)&&vn.stop()}function Ln(t,e){return i(this,void 0,void 0,(function(){var r,n,o,i,s,u,h,d,l;return a(this,(function(a){switch(a.label){case 0:if(r=t.layout,n=r.id,o=r.options,i=r.iterations,s=t.nodes,u=t.edges,h=new c({nodes:s,edges:u}),!(d=Cn[n]))throw new Error("Unknown layout id: "+n);return[4,(vn=new d(o)).execute(h)];case 1:return l=a.sent(),!!(f=vn).tick&&!!f.stop&&(vn.stop(),l=vn.tick(i)),[2,[l,e]]}var f}))}))}addEventListener("message",(function(t){var r,n=t.data,o=n.type,i=n.method,a=n.id,s=n.params;"RPC"===o&&i&&((r=e[i])?Promise.resolve().then((function(){return r.apply(e,s)})):Promise.reject("No such method")).then((function(t){postMessage({type:"RPC",id:a,result:t})})).catch((function(t){var e={message:t};t.stack&&(e.message=t.message,e.stack=t.stack,e.name=t.name),postMessage({type:"RPC",id:a,error:e})}))})),postMessage({type:"RPC",method:"ready"})})();
|
|
2
|
+
//# sourceMappingURL=0229766b7896aada2515.worker.js.map
|