(self.webpackChunk=self.webpackChunk||[]).push([[79266],{49336:function(t,e){"use strict";var r=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{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function i(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)&&i(o,e,r,n))return!0;return!1}const s=()=>!0;class a{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}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]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];o([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];i(this.getNode(t),new Set,e,n)}}class u extends n.Z{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.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):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);this.bothEdgesMap.get(t)?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((r=>{r.childrenMap.get(t)?.forEach((t=>{r.parentMap.delete(t.id)}));const n=r.parentMap.get(t);n&&r.childrenMap.get(n.id)?.delete(e),r.parentMap.delete(t),r.childrenMap.delete(t)})),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.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){this.checkNodeExistence(t),this.checkTreeExistence(e);return 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);if(i?.id===e)return;if(void 0===e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const s=this.getNode(e);n.parentMap.set(t,s),i&&n.childrenMap.get(i.id)?.delete(o);let a=n.childrenMap.get(s.id);a||(a=new Set,n.childrenMap.set(s.id,a)),a.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:s.id})}))}dfsTree(t,e,r){return i(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return o([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 o([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 i(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 u({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()})}createView(t){return new a({graph:this,...t})}}},7499:function(t,e,r){"use strict";r.d(e,{b:function(){return he}});var n=r(80813),o=r(56354),i=r(25719),s=r(23481);const a=(t,e)=>{if("next"!==t&&"prev"!==t)return e},u=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class c{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return u(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&u(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,a)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class d extends c{}const h=()=>1,l=(t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let s;for(;t.getAllNodes().length;){for(;s=i.dequeue();)f(t,e,r,s);for(;s=o.dequeue();)f(t,e,r,s);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(f(t,e,r,s,!0));break}}return n},f=(t,e,r,n,o)=>{var i,s;const a=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,s=t.getNode(n.source);o&&a.push({v:n.source,w:n.target,in:0,out:0}),void 0===s.data.out&&(s.data.out=0),s.data.out-=i,v(e,r,Object.assign({v:s.id},s.data))})),null===(s=t.getRelatedEdges(n.v,"out"))||void 0===s||s.forEach((n=>{const o=n.data.weight,i=n.target,s=t.getNode(i);void 0===s.data.in&&(s.data.in=0),s.data.in-=o,v(e,r,Object.assign({v:s.id},s.data))})),t.removeNode(n.v)),o?a:void 0},g=(t,e)=>{const r=new o.k;let n=0,i=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const o=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),s=(null==e?void 0:e(t))||1;o?r.updateEdgeData(null==o?void 0:o.id,Object.assign(Object.assign({},o.data),{weight:o.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),n=Math.max(n,r.getNode(t.target).data.in+=s)}));const s=[],a=i+n+3;for(let t=0;t{v(s,u,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:s,zeroIdx:u,graph:r}},v=(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)},p=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=g(t,e||h);return null===(r=l(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t,(t=>t.data.weight||1)):m(t);null==r||r.forEach((e=>{const 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:Object.assign({},r)})}))},m=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},y=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},w=t=>{const e=new o.k;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},x=(t,e)=>null==t?void 0:t.reduce(((t,r,n)=>(t[r]=e[n],t)),{}),b=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let s,a,u=Number(t.width)/2,c=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*c?(i<0&&(c=-c),s=c*o/i,a=c):(o<0&&(u=-u),s=u,a=u*i/o),{x:r+s,y:n+a}):{x:0,y:0}},E=t=>{const e=[],r=M(t)+1;for(let t=0;t{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},N=(t,e,r,n)=>{const o={width:0,height:0};return(0,i.Z)(r)&&(0,i.Z)(n)&&(o.rank=r,o.order=n),y(t,"border",o,e)},M=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},k=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),_=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>_(t,e,r,n,o,i))),r&&i.push(e.id))},A=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),s=[],a=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);_(t,e,"post"===r,a,i,s)})),s},S=(t,e,r,n,o,i)=>{const s={rank:i,borderType:e,width:0,height:0},a=o.data[e][i-1],u=y(t,"border",s,r);o.data[e][i]=u,t.setParent(u,n),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:u,data:{weight:1}})},j=t=>{t.getAllNodes().forEach((t=>{O(t)})),t.getAllEdges().forEach((t=>{O(t)}))},O=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},R=t=>{t.getAllNodes().forEach((t=>{I(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>I(t))),t.data.hasOwnProperty("y")&&I(t.data)}))},I=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},z=t=>{t.getAllNodes().forEach((t=>{C(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>C(t))),t.data.hasOwnProperty("x")&&C(t.data)}))},C=t=>{const e=t.x;t.x=t.y,t.y=e},D=(t,e,r,n,o,i,s)=>{const a=t.getChildren(s);if(!(null==a?void 0:a.length))return void(s!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:s,data:{weight:0,minlen:r}}));const u=N(t,"_bt"),c=N(t,"_bb"),d=t.getNode(s);t.setParent(u,s),d.data.borderTop=u,t.setParent(c,s),d.data.borderBottom=c,null==a||a.forEach((a=>{D(t,e,r,n,o,i,a.id);const d=a.data.borderTop?a.data.borderTop:a.id,h=a.data.borderBottom?a.data.borderBottom:a.id,l=a.data.borderTop?n:2*n,f=d!==h?1:o-i[s]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:d,data:{minlen:f,weight:l,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:h,target:c,data:{minlen:f,weight:l,nestingEdge:!0}})})),t.getParent(s)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[s]}})},T=t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e},P=t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e},L="edge-label",F=(t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,s=t.getNode(i).data.rank,a=e.data.labelRank;if(s===o+1)return;let u,c,d;for(t.removeEdge(e.id),d=0,++o;o{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},Z=(t,e,r)=>{const n=x(r,r.map(((t,e)=>e))),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})).flat().filter((t=>void 0!==t));let i=1;for(;i{if(t){let e=t.pos+i;a[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=a[e+1]),e=e-1>>1,a[e]+=t.weight;u+=t.weight*r}})),u},G=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=Z(t,e[n-1],e[n]);return r},B=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;tt.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),a=s.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==a||a.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==s||s.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},U=t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&W(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))},W=(t,e)=>{var r;let 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};var $=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const 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((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));const s=null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree));return U(s)};const Y=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},H=(t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycentern.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.ordern.order)return 1}return t?n.i-r.i:r.i-n.i},K=(t,e,r,n,o,i)=>{var s,a,u,c;let d=t.getChildren(e).map((t=>t.id));const h=t.getNode(e),l=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,g={};l&&(d=null==d?void 0:d.filter((t=>t!==l&&t!==f)));const v=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const 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==v||v.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=K(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&Q(e,o)}}));const p=$(v,r);J(p,g),null===(s=p.filter((t=>t.vs.length>0)))||void 0===s||s.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const m=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{e(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t,(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})),i=o.lhs,s=o.rhs.sort(((t,e)=>-t.i- -e.i)),a=[];let u=0,c=0,d=0;null==i||i.sort(H(!!e,!!r)),d=Y(a,s,d),null==i||i.forEach((t=>{var e;d+=null===(e=t.vs)||void 0===e?void 0:e.length,a.push(t.vs),u+=t.barycenter*t.weight,c+=t.weight,d=Y(a,s,d)}));const h={vs:a.flat()};return c&&(h.barycenter=u/c,h.weight=c),h})(p,n,o,i);if(l&&(m.vs=[l,m.vs,f].flat(),null===(a=t.getPredecessors(l))||void 0===a?void 0:a.length)){const e=t.getNode((null===(u=t.getPredecessors(l))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(c=t.getPredecessors(f))||void 0===c?void 0:c[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+e.data.order+r.data.order)/(m.weight+2),m.weight+=2}return m},J=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},Q=(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)},X=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=V(t),i=new o.k({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((o=>{const s=t.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(i.hasNode(o.id)||i.addNode(Object.assign({},o)),(null==s?void 0:s.id)&&!i.hasNode(null==s?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(o.id,(null==s?void 0:s.id)||n),t.getRelatedEdges(o.id,r).forEach((e=>{const r=e.source===o.id?e.target:e.source;i.hasNode(r)||i.addNode(Object.assign({},t.getNode(r)));const n=i.getRelatedEdges(r,"out").find((({target:t})=>t===o.id)),s=void 0!==n?n.data.weight:0;n?i.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+s})):i.addEdge({id:e.id,source:r,target:o.id,data:{weight:e.data.weight+s}})})),o.data.hasOwnProperty("minRank")&&i.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:o.data.borderLeft[e],borderRight:o.data.borderRight[e]})))})),i})(t,e,r))),tt=(t,e,r,n)=>{const i=new o.k;null==t||t.forEach((t=>{var o;const s=t.getRoots()[0].id,a=K(t,s,i,e,r,n);for(let e=0;e<(null===(o=a.vs)||void 0===o?void 0:o.length);e++){const r=t.getNode(a.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,s,a=t.getParent(r);for(;a;){if(i=t.getParent(a.id),i?(s=n[i.id],n[i.id]=a.id):(s=o,o=a.id),s&&s!==a.id)return e.hasNode(s)||e.addNode({id:s,data:{}}),e.hasNode(a.id)||e.addNode({id:a.id,data:{}}),void(e.hasEdge(`e${s}-${a.id}`)||e.addEdge({id:`e${s}-${a.id}`,source:s,target:a.id,data:{}}));a=i}}))})(t,i,a.vs)}))},et=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},rt=(t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,s=t.getNode(i);const a=s.data.originalEdge;if(!a)return;const u=((t,e,r,n)=>{var o,i;const s=[],a=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);let d,h;d=r;do{d=null===(o=t.getParent(d))||void 0===o?void 0:o.id,s.push(d)}while(d&&(e[d].low>u||c>e[d].lim));for(h=d,d=n;d&&d!==h;)a.push(d),d=null===(i=t.getParent(d))||void 0===i?void 0:i.id;return{lca:h,path:s.concat(a.reverse())}})(t,r,a.source,a.target),c=u.path,d=u.lca;let h=0,l=c[h],f=!0;for(;i!==a.target;){if(s=t.getNode(i),f){for(;l!==d&&(null===(n=t.getNode(l))||void 0===n?void 0:n.data.maxRank){const r={},n=(e,n)=>{let o=0,i=0;const s=e.length,a=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var c;const d=it(t,e),h=d?t.getNode(d.id).data.order:s;(d||e===a)&&(null===(c=n.slice(i,u+1))||void 0===c||c.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const s=t.getNode(n.id),a=s.data.order;!(a{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(!function(e,n,o,i,s){var a,u;let c;for(let d=n;d{const n=t.getNode(e.id);n.data.dummy&&(n.data.orders)&&st(r,e.id,c)})))}(...e),n.set(o,!0))}const o=(e,r)=>{let o,i=-1,s=0;const a=new Map;return null==r||r.forEach(((u,c)=>{var d;if("border"===(null===(d=t.getNode(u))||void 0===d?void 0:d.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,s,c,i,o],a),s=c,i=o)}n([r,s,r.length,o,e.length],a)})),r};return(null==e?void 0:e.length)&&e.reduce(o),r},it=(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((e=>t.getNode(e.id).data.dummy))},st=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},at=(t,e,r)=>{let n=e,o=r;if(n>r){n=r,o=e}return!!t[n]},ut=(t,e,r,n)=>{const o={},i={},s={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,s[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let a=n(t).map((t=>t.id));if(a.length){a=a.sort(((t,e)=>s[t]-s[e]));const n=(a.length-1)/2;for(let u=Math.floor(n),c=Math.ceil(n);u<=c;++u){const n=a[u];i[t]===t&&e{var a;const u={},c=dt(t,e,r,o,i,s),d=s?"borderLeft":"borderRight",h=(t,e)=>{let r=c.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return h((t=>{u[t]=(c.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),c.getPredecessors.bind(c)),h((e=>{const r=(c.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>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))}),c.getSuccessors.bind(c)),null===(a=Object.values(n))||void 0===a||a.forEach((t=>{u[t]=u[r[t]]})),u},dt=(t,e,r,n,i,s)=>{const a=new o.k,u=gt(n,i,s);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(a.hasNode(o)||a.addNode({id:o,data:{}}),n){const i=r[n],s=a.getRelatedEdges(i,"out").find((t=>t.target===o));s?a.updateEdgeData(s.id,Object.assign(Object.assign({},s.data),{weight:Math.max(u(t,e,n),s.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(u(t,e,n),0)}})}n=e}))})),a},ht=(t,e)=>k(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],s=vt(t,r)/2;n=Math.max(i+s,n),o=Math.min(i-s,o)})),n-o}));function lt(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const s=r+i,a=t[s];let u;if(a===e)return;const c=Object.values(a);u="l"===i?n-Math.min(...c):o-Math.max(...c),u&&(t[s]={},Object.keys(a).forEach((e=>{t[s][e]=a[e]+u})))}))}))}const ft=(t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r},gt=(t,e,r)=>(n,o,i)=>{const s=n.getNode(o),a=n.getNode(i);let u=0,c=0;if(u+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":c=-s.data.width/2;break;case"r":c=s.data.width/2}if(c&&(u+=r?c:-c),c=0,u+=(s.data.dummy?e:t)/2,u+=(a.data.dummy?e:t)/2,u+=a.data.width/2,a.data.labelpos)switch((a.data.labelpos||"").toLowerCase()){case"l":c=a.data.width/2;break;case"r":c=-a.data.width/2}return c&&(u+=r?c:-c),c=0,u},vt=(t,e)=>t.getNode(e).data.width||0,pt=(t,e)=>{var r;const n=w(t);((t,e)=>{const{ranksep:r=0}=e||{},n=E(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=E(t),s=Object.assign(nt(t,i),ot(t,i)),a={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=ut(0,u,s,i),d=ct(t,u,c.root,c.align,n,o,"r"===r);"r"===r&&Object.keys(d).forEach((t=>d[t]=-d[t])),a[e+r]=d}))}));const c=ht(t,a);return c&<(a,c),ft(a,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},mt=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let s;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},yt=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,wt=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||yt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},xt=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,s=n===i?o.target:i;t.hasNode(s)||void 0===e.getNode(s).data.layer&&yt(e,o)||(t.addNode({id:s,data:{}}),t.addEdge({id:o.id,source:n,target:s,data:{}}),r(s))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},bt=(t,e)=>k(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?yt(e,r):1/0)),Et=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},Nt=t=>{const e=(t=>{const e=new o.k;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},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);mt(e);const r=(t=>{const e=new o.k({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let i,s;for(e.addNode(r);wt(e,t){let r=A(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{kt(t,e,r)}))},kt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=_t(t,e,r)},_t=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),s=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),s=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,a=i?e.target:e.source;if(a!==n){const n=i===o,u=e.data.weight;if(s+=n?u:-u,zt(t,r,a)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===a||t.target===a)).data.cutvalue;s+=n?-e:e}}})),s},At=(t,e=t.getAllNodes()[0].id)=>{St(t,{},1,e)},St=(t,e,r,n,o)=>{var i;const s=r;let a=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(a=St(t,e,a,r.id,n))})),u.data.low=s,u.data.lim=a++,o?u.data.parent=o:delete u.data.parent,a},jt=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),Ot=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),s=t.getNode(o);let a=i,u=!1;i.data.lim>s.data.lim&&(a=s,u=!0);const c=e.getAllEdges().filter((e=>u===Ct(t.getNode(e.source),a)&&u!==Ct(t.getNode(e.target),a)));return k(c,(t=>yt(e,t)))},Rt=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>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:{}}),At(t),Mt(t,e),It(t,e)},It=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=A(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>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))}))},zt=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),Ct=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,Dt=mt,Tt=t=>{(t=>{const e={};let r;const n=o=>{var i;const s=t.getNode(o);if(!s)return 0;if(e[o])return s.data.rank;let a;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const s=t.getNode(e),a=isNaN(s.data.layer)?r:s.data.layer;(void 0===s.data.rank||s.data.rank{i(t.target,a+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new o.k({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let i,s;for(e.addNode(r);xt(e,t){Nt(t)},Lt=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:u=50,edgesep:c=20,ranksep:d=50}=e;re(t),p(t,r);const{nestingRoot:h,nodeRankFactor:l}=(t=>{const e=y(t,"root",{},"_root"),r=T(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const s=P(t)+1;return t.getRoots().forEach((n=>{D(t,e,i,s,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":Pt(t);break;case"tight-tree":default:Tt(t);break;case"longest-path":Dt(t)}})(w(t),n),Yt(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let s=0;for(let r=0;r{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=s)})))}})(t,l),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,h),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),Ht(t),Kt(t);const f=[];((t,e)=>{t.getAllEdges().forEach((r=>F(t,r,e)))})(t,f),rt(t,f),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;ee(t.id)))})(t),s&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t{const 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,i),((t,e)=>{const r=M(t),n=[],o=[];for(let t=1;t-1;t--)o.push(t);const i=X(t,n,"in"),s=X(t,o,"out");let a=B(t);et(t,a);let u,c=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){tt(r%2?i:s,r%4>=2,!1,e),a=E(t);const o=G(t,a);o=2,!0,e),a=E(t);const o=G(t,a);o{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||j(t)})(t,o),pt(t,{align:a,nodesep:u,edgesep:c,ranksep:d}),oe(t),ee(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let s=e;for(;r.data.dummy;)i=t.getSuccessors(s)[0],t.removeNode(s),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===L&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),s=i.id,r=t.getNode(s)}))})(t,f),Xt(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||R(t),"lr"!==r&&"rl"!==r||(z(t),j(t))})(t,o);const{width:g,height:v}=Jt(t);return Qt(t),te(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:g,height:v}},Ft=(t,e)=>{t.getAllNodes().forEach((r=>{const n=t.getNode(r.id);if(e.hasNode(r.id)){const t=e.getNode(r.id);n.data.fixorder=t.data._order,delete t.data._order}else delete n.data.fixorder}))},qt=(t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const 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)}))},Vt=["width","height","layer","fixorder"],Zt={width:0,height:0},Gt=["minlen","weight","width","height","labeloffset"],Bt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ut=["labelpos"],Wt=t=>{const e=new o.k({tree:[]});return t.getAllNodes().forEach((r=>{const n=se(t.getNode(r.id).data),o=Object.assign(Object.assign({},Zt),n),i=ie(o,Vt);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const a=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);(0,s.Z)(a)||(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(r.id,a.id))})),t.getAllEdges().forEach((r=>{const n=se(t.getEdge(r.id).data),o={};null==Ut||Ut.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},Bt,ie(n,Gt),o)})})),e},$t=(t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2},Yt=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e:e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};y(t,"edge-proxy",n,"_ep")}}))},Ht=t=>{let e=0;return t.getAllNodes().forEach((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},Kt=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Jt=(t,e)=>{let r,n,o=0,i=0;const{marginx:s=0,marginy:a=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,s=t.data.y,a=t.data.width,u=t.data.height;isNaN(e)||isNaN(a)||(void 0===r&&(r=e-a/2),r=Math.min(r,e-a/2),o=Math.max(o,e+a/2)),isNaN(s)||isNaN(u)||(void 0===n&&(n=s-u/2),n=Math.min(n,s-u/2),i=Math.max(i,s+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=s,n-=a,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((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+s,height:i-n+a}},Qt=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(b(r.data,o)),e.data.points.push(b(n.data,i))}))},Xt=t=>{t.getAllEdges().forEach((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}}))},te=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},ee=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),s=t.getNode(r.data.borderBottom),a=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==a?void 0:a.data.x))||10,r.data.height=Math.abs((null==s?void 0:s.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==a?void 0:a.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},re=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},ne=t=>{const e=E(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{y(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e:e},"_se")})),delete i.data.selfEdges}))}))},oe=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,s=r.data.x-o,a=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*s/3,y:i-a},{x:o+5*s/6,y:i-a},{y:i,x:o+s},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},ie=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},se=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e};var ae=r(35714),ue=r(21361),ce=r(10259);const de={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class he{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},de),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,e)}))}genericDagreLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{nodeSize:s,align:a,rankdir:u="TB",ranksep:c,nodesep:d,ranksepFunc:h,nodesepFunc:l,edgeLabelSpace:f,ranker:g,nodeOrder:v,begin:p,controlPoints:m,radial:y,sortByCombo:w,preset:x}=n,b=new o.k({tree:[]}),E=(0,ae.jE)(c||50,h),N=(0,ae.jE)(d||50,l);let M=N,k=E;"LR"!==u&&"RL"!==u||(M=E,k=N);const _=(0,ae.tO)(10,s,!1),A=e.getAllNodes(),S=e.getAllEdges();let j;A.forEach((t=>{const e=(0,ce._)(_(t)),r=k(t),n=M(t),o=e[0]+2*n,s=e[1]+2*r,a=t.data.layer;(0,i.Z)(a)?b.addNode({id:t.id,data:{width:o,height:s,layer:a}}):b.addNode({id:t.id,data:{width:o,height:s}})})),w&&(b.attachTreeStructure("combo"),A.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),S.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==x?void 0:x.length)&&(j=new o.k({nodes:x})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:s}=e;!n&&o&&Ft(t,o);const a=Wt(t);let u;r&&(e.ranksep=$t(a,{rankdir:i,ranksep:s}));try{u=Lt(a,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}qt(t,a)})(b,{prevGraph:j,edgeLabelSpace:f,keepNodeOrder:!!v,nodeOrder:v||[],acyclicer:"greedy",ranker:g,rankdir:u,nodesep:d,align:a});const O=[0,0];if(p){let t=1/0,e=1/0;b.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),b.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=p[0]-t,O[1]=p[1]-e}const R="LR"===u||"RL"===u;if(y);else{const t=new Set,e="BT"===u||"RL"===u?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(R?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=R?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=R?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};b.getAllEdges().forEach(((t,e)=>{var i;f&&m&&"loop"!==t.data.type&&(t.data.controlPoints=le(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),b.getNode(t.source),b.getNode(t.target),r,R,n,o))}))}let I=[];I=b.getAllNodes().map((t=>(0,ue.u)(t)));const z=b.getAllEdges();t&&(I.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),z.forEach((t=>{e.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})));return{nodes:I,edges:z}}))}}const le=(t,e,r,n,o,i,s)=>{let a=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:c,y:d}=r.data;if(o&&(t=e.data.y,u=e.data.x,c=r.data.y,d=r.data.x),d!==u&&t!==c){const h=n.indexOf(u),l=n[h+1];if(l){const t=a[0],e=o?{x:(u+l)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(u+l)/2};t&&!i(t,e)||a.unshift(e)}const f=n.indexOf(d),g=Math.abs(f-h);if(1===g)a=s(a,e.data,r.data),a.length||a.push(o?{x:(u+d)/2,y:t}:{x:t,y:(u+d)/2});else if(g>1){const e=n[f-1];if(e){const r=a[a.length-1],n=o?{x:(d+e)/2,y:(null==r?void 0:r.y)||c}:{x:(null==r?void 0:r.x)||t,y:(d+e)/2};r&&!i(r,n)||a.push(n)}}}}return a}},64589:function(t,e,r){"use strict";r.d(e,{S:function(){return u}});var n=r(80813),o=r(35714),i=r(21361),s=r(18949);const a={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class u{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},a),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,e)}))}genericCircularLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{width:a,height:u,center:h,divisions:l,startAngle:f=0,endAngle:g=2*Math.PI,angleRatio:v,ordering:p,clockwise:m,nodeSpacing:y,nodeSize:w}=n,x=e.getAllNodes(),b=e.getAllEdges(),[E,N,M]=d(a,u,h),k=null==x?void 0:x.length;if(!k||1===k)return(0,s.P)(e,t,M);const _=(g-f)/k;let{radius:A,startRadius:S,endRadius:j}=n;if(y){const t=(0,o.jE)(10,y),e=(0,o.tO)(10,w);let r=-1/0;x.forEach((t=>{const n=e(t);r{n+=0===o?r||10:(t(e)||0)+(r||10)})),A=n/(2*Math.PI)}else A||S||j?!S&&j?S=j:S&&!j&&(j=S):A=Math.min(N,E)/2;const O=_*v;let R=[];R="topology"===p?c(e,x):"topology-directed"===p?c(e,x,!0):"degree"===p?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push((0,i.u)(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(e,x):x.map((t=>(0,i.u)(t)));const I=Math.ceil(k/l);for(let t=0;t{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:R,edges:b}}))}}const c=(t,e,r=!1)=>{const n=[(0,i.u)(e[0])],o={},s=e.length;o[e[0].id]=!0;let a=0;return e.forEach(((u,c)=>{if(0!==c)if(c!==s-1&&t.getDegree(u.id,"both")===t.getDegree(e[c+1].id,"both")&&!t.areNeighbors(n[a].id,u.id)||o[u.id]){const c=r?t.getSuccessors(n[a].id):t.getNeighbors(n[a].id);let d=!1;for(let e=0;e{let 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]}},70709:function(t,e,r){"use strict";r.d(e,{u:function(){return m}});var n=r(80813),o=r(56354),i=r(25719),s=r(77817),a=r(85266),u=r(73510),c=r(93712),d=r(8421),h=r(31350),l=r(34748),f=r(23041),g=r(18949);const v={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},p={center:[0,0],comboPadding:10,treeKey:"combo"};class m{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},p),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,e)}))}genericComboCombinedLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=this.initVals(Object.assign(Object.assign({},this.options),r)),{center:i,treeKey:s,outerLayout:a}=n,h=e.getAllNodes().filter((t=>!t.data._isCombo)),f=e.getAllNodes().filter((t=>t.data._isCombo)),p=e.getAllEdges(),m=null==h?void 0:h.length;if(!m||1===m)return(0,g.P)(e,t,i);const w=[],x=new Map;h.forEach((t=>{x.set(t.id,t)}));const b=new Map;f.forEach((t=>{b.set(t.id,t)}));const E=new Map,N=this.getInnerGraphs(e,s,x,b,p,n,E);yield Promise.all(N);const M=new Map,k=[],_=new Map;let A=!0;e.getRoots(s).forEach((t=>{const r=E.get(t.id),n=b.get(t.id)||x.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:r.data.x||n.data.x,y:r.data.y||n.data.y,fx:r.data.fx||n.data.fx,fy:r.data.fy||n.data.fy,mass:r.data.mass||n.data.mass,size:r.data.size})};k.push(o),M.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):A=!1,(0,l._)(e,[t],(e=>{e.id!==t.id&&_.set(e.id,t.id)}),"TB",s)}));const S=[];let j;if(p.forEach((t=>{const e=_.get(t.source)||t.source,r=_.get(t.target)||t.target;e!==r&&M.has(e)&&M.has(r)&&S.push({id:t.id,source:e,target:r,data:{}})})),null==k?void 0:k.length){if(1===k.length)k[0].data.x=i[0],k[0].data.y=i[1];else{const t=new o.k({nodes:k,edges:S}),e=a||new c.y;if(A&&v[e.id]){const e=k.length<100?new d.A:new u.W;yield e.assign(t)}const r=Object.assign({center:i,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{});j=yield y(e,t,r)}E.forEach((t=>{var e;const r=j.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,w.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{w.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),E.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=w.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}t&&w.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:w,edges:p}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let u,c,d;if(c=(0,i.Z)(n)?()=>n:(0,s.Z)(n)?n:()=>0,e.spacing=c,r)if((0,s.Z)(r))u=t=>{const e=r(t),n=c(t);if((0,f.k)(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2}return((e||32)+n)/2};else if((0,f.k)(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;u=e=>t+c(e)/2}else{const t=r/2;u=e=>t+c(e)/2}else u=t=>{const e=c(t);if(t.size){if((0,f.k)(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2}if((0,a.Z)(t.size)){return((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2}return(t.size+e)/2}return 32+e/2};return e.nodeSize=u,d=(0,i.Z)(o)?()=>o:(0,f.k)(o)?()=>Math.max.apply(null,o):(0,s.Z)(o)?o:()=>0,e.comboPadding=d,e}getInnerGraphs(t,e,r,s,a,c,d){const{nodeSize:h,comboPadding:g,spacing:v,innerLayout:p}=c,m=p||new u.W({}),w={center:[0,0],preventOverlap:!0,nodeSpacing:v},x=[],b=t=>{let e=(null==g?void 0:g(t))||10;return(0,f.k)(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(e).forEach((u=>{d.set(u.id,{id:u.id,data:{nodes:[],size:b(u).size}});let c=Promise.resolve();(0,l._)(t,[u],(u=>{var f;if(!u.data._isCombo)return;const{size:g,padding:v}=b(u);if(null===(f=t.getChildren(u.id,e))||void 0===f?void 0:f.length){const f=d.get(u.id);d.set(u.id,{id:u.id,data:Object.assign({nodes:[]},null==f?void 0:f.data)});const g=new Map,p=t.getChildren(u.id,e).map((t=>{if(t.data._isCombo)return d.has(t.id)||d.set(t.id,{id:t.id,data:Object.assign({},t.data)}),g.set(t.id,!0),d.get(t.id);const e=r.get(t.id)||s.get(t.id);return g.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),x={nodes:p,edges:a.filter((t=>g.has(t.source)&&g.has(t.target)))};let b=1/0;p.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=d.get(t.id))||void 0===e?void 0:e.data.size)||(null==h?void 0:h(t))||[30,30]),(0,i.Z)(r)&&(r=[r,r]);const[n,o]=r;b>n&&(b=n),b>o&&(b=o),t.data.size=r})),c=c.then((()=>(0,n.mG)(this,void 0,void 0,(function*(){const t=new o.k(x);yield y(m,t,w,!0);const{minX:e,minY:r,maxX:n,maxY:i}=(0,l.H0)(p),s=(n+e)/2,a=(i+r)/2;x.nodes.forEach((t=>{t.data.x-=s,t.data.y-=a}));const c=[Math.max(n-e,b)+2*v,Math.max(i-r,b)+2*v];d.get(u.id).data.size=c,d.get(u.id).data.nodes=p}))))}else d.set(u.id,{id:u.id,data:Object.assign(Object.assign({},u.data),{size:g})});return!0}),"BT",e),x.push(c)})),x}}function y(t,e,r,o){var i;return(0,n.mG)(this,void 0,void 0,(function*(){return(0,h.h)(t)?(t.execute(e,r),t.stop(),t.tick(null!==(i=r.iterations)&&void 0!==i?i:300)):o?yield t.assign(e,r):yield t.execute(e,r)}))}},73510:function(t,e,r){"use strict";r.d(e,{W:function(){return f}});var n=r(80813),o=r(77817),i=r(25719),s=r(85266),a=r(18756),u=r(23041),c=r(21361),d=r(18949),h=r(10259);const l={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class f{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},l),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericConcentricLayout(!0,t,e)}))}genericConcentricLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{center:l,width:f,height:g,sortBy:v,maxLevelDiff:p,sweep:m,clockwise:y,equidistant:w,preventOverlap:x,startAngle:b=1.5*Math.PI,nodeSize:E,nodeSpacing:N}=n,M=e.getAllNodes(),k=e.getAllEdges(),_=f||"undefined"==typeof window?f:window.innerWidth,A=g||"undefined"==typeof window?g:window.innerHeight,S=l||[_/2,A/2];if(!(null==M?void 0:M.length)||1===M.length)return(0,d.P)(e,t,S);const j=[];let O,R=0;(0,u.k)(E)?O=Math.max(E[0],E[1]):(0,o.Z)(E)?(O=-1/0,M.forEach((t=>{const e=Math.max(...(0,h._)(E(t)));e>O&&(O=e)}))):O=E,(0,u.k)(N)?R=Math.max(N[0],N[1]):(0,i.Z)(N)&&(R=N),M.forEach((t=>{const e=(0,c.u)(t);j.push(e);let r=O;const{data:n}=e;(0,u.k)(n.size)?r=Math.max(n.size[0],n.size[1]):(0,i.Z)(n.size)?r=n.size:(0,s.Z)(n.size)&&(r=Math.max(n.size.width,n.size.height)),O=Math.max(O,r),(0,o.Z)(N)&&(R=Math.max(N(t),R))}));const I={};j.forEach(((t,e)=>{I[t.id]=e}));let z=v;(0,a.Z)(z)&&void 0!==j[0].data[z]||(z="degree"),"degree"===z?j.sort(((t,r)=>e.getDegree(r.id,"both")-e.getDegree(t.id,"both"))):j.sort(((t,e)=>e.data[z]-t.data[z]));const C=j[0],D=(p||("degree"===z?e.getDegree(C.id,"both"):C.data[z]))/4,T=[{nodes:[]}];let P=T[0];j.forEach((t=>{if(P.nodes.length>0){const r="degree"===z?Math.abs(e.getDegree(P.nodes[0].id,"both")-e.getDegree(t.id,"both")):Math.abs(P.nodes[0].data[z]-t.data[z]);D&&r>=D&&(P={nodes:[]},T.push(P))}P.nodes.push(t)}));let L=O+R;if(!x){const t=T.length>0&&T[0].nodes.length>1,e=(Math.min(_,A)/2-L)/(T.length+(t?1:0));L=Math.min(L,e)}let F=0;if(T.forEach((t=>{const e=void 0===m?2*Math.PI-2*Math.PI/t.nodes.length:m;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&x){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(L*L/(e*e+r*r));F=Math.max(n,F)}t.r=F,F+=L})),w){let t=0,e=0;for(let r=0;r{0===n&&(e=r.r||0),r.r=e,e+=t}))}T.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=b+(y?1:-1)*e*n;t.data.x=S[0]+r*Math.cos(o),t.data.y=S[1]+r*Math.sin(o)}))})),t&&j.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:j,edges:k}}))}}},31392:function(t,e,r){"use strict";r.d(e,{j:function(){return A}});var n=r(80813),o=r(58212),i=r(84942);function s(t){return function(){return t}}function a(t){return 1e-6*(t()-.5)}function u(t){return t.index}function c(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function d(t){var e,r,n,o,i,d,h=u,l=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},f=s(30),g=1;function v(n){for(var o=0,s=t.length;o[h(t,e,n),t])));for(s=0,o=new Array(u);s(t=(1664525*t+1013904223)%g)/g}();function h(){v(),c.call("tick",e),r1?(null==r?a.delete(t):a.set(t,y(r)),e):a.get(t)},find:function(e,r,n){var o,i,s,a,u,c=0,d=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(c.on(t,r),e):c.on(t)}}}function w(){var t,e,r,n,o,i=s(-30),u=1,c=1/0,d=.81;function l(r){var o,i=t.length,s=(0,h.Z)(t,v,p).visitAfter(g);for(n=r,o=0;o=c)){(t.data!==e||t.next)&&(0===l&&(v+=(l=a(r))*l),0===f&&(v+=(f=a(r))*f),vd+v||il+v||su.index){var p=d-c.x-c.vx,m=l-c.y-c.vy,y=p*p+m*m;yt.r&&(t.r=t[e].r)}function d(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;nt.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},(0,o.Z)(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,e)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find((e=>e.id===t));r&&e.forEach(((t,e)=>{if("number"==typeof t||null===t){r[["fx","fy","fz"][e]]=t}}))}getOptions(t){var e,r;const n=(0,o.Z)({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,e,r){var o;return(0,n.mG)(this,void 0,void 0,(function*(){const n=this.getOptions(r),s=e.getAllNodes().map((({id:t,data:e})=>Object.assign(Object.assign({id:t},e),(0,i.Z)(e.data,this.config.inputNodeAttrs)))),a=e.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:s,edges:a,graph:e});const u=new Promise((t=>{this.resolver=t})),c=this.setSimulation(n);return c.nodes(s),null===(o=c.force("link"))||void 0===o||o.links(a),u}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),(0,i.Z)(t,this.config.outputNodeAttrs))}))),s=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:s}}initSimulation(){return y()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),S(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),S(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const S=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t)},14742:function(t,e,r){"use strict";r.d(e,{V:function(){return c}});var n=r(80813),o=r(25719),i=r(77817),s=r(92546),a=r.n(s),u=r(10259);class c{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,c.defaultOptions,t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))}))}genericDagreLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const{nodeSize:c}=r,d=new s.graphlib.Graph;d.setGraph(r),d.setDefaultEdgeLabel((()=>({})));[...e.getAllNodes(),...e.getAllEdges()].some((({id:t})=>(0,o.Z)(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach((t=>{const{id:e}=t,r=Object.assign({},t.data);if(void 0!==c){const[e,n]=(0,u._)((0,i.Z)(c)?c(t):c);Object.assign(r,{width:e,height:n})}d.setNode(e.toString(),r)})),e.getAllEdges().forEach((({id:t,source:e,target:r})=>{d.setEdge(e.toString(),r.toString(),{id:t})})),a().layout(d);const h={nodes:[],edges:[]};return d.nodes().forEach((r=>{const n=d.node(r);h.nodes.push({id:r,data:n}),t&&e.mergeNodeData(r,n)})),d.edges().forEach((r=>{const o=d.edge(r),{id:i}=o,s=(0,n._T)(o,["id"]),{v:a,w:u}=r;h.edges.push({id:i,source:a,target:u,data:s}),t&&e.mergeEdgeData(i,s)})),h}))}}c.defaultOptions={}},71636:function(t,e,r){"use strict";r.d(e,{E:function(){return f}});var n=r(80813),o=r(56354),i=r(25719),s=r(21361),a=r(35714),u=r(18949);class c{constructor(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}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new c({rx:r,ry:n,mass:e,degree:o})}}class d{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new d({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new d({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new d({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new d({xmid:t,ymid:e,length:r})}}class h{constructor(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)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new h(this.quad.NW()),this.NE=new h(this.quad.NE()),this.SW=new h(this.quad.SW()),this.SE=new h(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(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))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)(0,s.u)(t,[c,d]))),p=n.filter((t=>{const{source:e,target:r}=t;return e!==r})),m=new o.k({nodes:v,edges:p}),y=this.getSizes(m,f);if(this.run(m,e,l,y,t,a),h){for(let t=0;t250&&(r.barnesHut=!0),void 0===a&&e>100&&(r.prune=!0),0!==u||a?0===u&&a&&(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)),c||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),d||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:s,barnesHut:a,onTick:u}=i,d=t.getAllNodes();let h=0,l=r;const f={},g={},v={};for(let e=0;e0;)h=this.oneStep(t,{iter:l,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:g,bodies:v,sizes:n},i),l--,null==u||u({nodes:d,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:s,preForces:a,bodies:u,sizes:c}=e;let{forces:d}=e;const{preventOverlap:h,barnesHut:l}=r,f=t.getAllNodes();for(let t=0;to||!h)?this.getOptRepGraForces(t,d,u,r):this.getRepGraForces(t,n,o,d,i,c,r),this.updatePos(t,d,a,s,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:s,dissuadeHubs:a,mode:u,prune:c}=i,d=t.getAllEdges();for(let i=0;i0&&(w=y,x=y),o[h][0]+=w*m[0],o[l][0]-=x*m[0],o[h][1]+=w*m[1],o[l][1]-=x*m[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:s}=n,a=t.getAllNodes(),u=a.length;let c=9e10,l=-9e10,f=9e10,g=-9e10;for(let e=0;e=l&&(l=o.x),o.x<=c&&(c=o.x),o.y>=g&&(g=o.y),o.y<=f&&(f=o.y))}const v=Math.max(l-c,g-f),p=new d({xmid:(l+c)/2,ymid:(g+f)/2,length:v,massCenter:i,mass:u}),m=new h(p);for(let e=0;e0&&(m=u*(v+1)*(d+1)/p),n[g.id][0]-=m*f[0],n[s.id][0]+=m*f[0],n[g.id][1]-=m*f[1],n[s.id][1]+=m*f[1]}const p=[g.data.x-d[0],g.data.y-d[1]],m=Math.hypot(p[0],p[1]);p[0]=p[0]/m,p[1]=p[1]/m;const y=c*(v+1);n[g.id][0]-=y*p[0],n[g.id][1]-=y*p[1]}return n}updatePos(t,e,r,n,o){const{ks:s,tao:a,prune:u,ksmax:c}=o,d=t.getAllNodes(),h=d.length,l=[],f=[];let g=0,v=0,p=n;for(let n=0;n1.5*m?1.5*m:p);for(let r=0;rg?g:h;const v=h*e[n][0],m=h*e[n][1];t.mergeNodeData(n,{x:o.x+v,y:o.y+m})}return p}}},93712:function(t,e,r){"use strict";r.d(e,{y:function(){return f}});var n=r(80813),o=r(56354),i=r(25719),s=r(35714),a=r(92730),u=r(81815);const c=.1;function d(t,e,r,n,o=2){const i=e/r,s=t.getAllNodes(),d=s.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:s,size:a}=t.data;return{x:n,y:o,z:s,size:a,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),l=(2===o?(0,a.Z)(d,(t=>t.x),(t=>t.y)):(0,u.Z)(d,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(h),f=new Map;return d.forEach((t=>{f.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,s)=>((t,e,r,n,o,i,s)=>{var a;if((null===(a=t.data)||void 0===a?void 0:a.id)===i.id)return;const u=[r,n,o][s-1],d=i.x-t.x||c,h=i.y-t.y||c,l=i.z-t.z||c,f=[d,h,l],g=u-e;let v=0;for(let t=0;t{const{id:r,data:o}=s[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}})),n}function h(t){let e=0,r=0,n=0,o=0,i=0;const s=t.length;if(s){for(let a=0;athis.lastOptions.minMovement||e<1)&&ethis.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),s=e.getAllNodes(),a=e.getAllEdges(),u=this.formatOptions(n,e),{dimensions:c,width:d,height:h,nodeSize:l,getMass:f,nodeStrength:g,edgeStrength:v,linkDistance:p}=u,m=s.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:(0,i.Z)(t.data.x)?t.data.x:Math.random()*d,y:(0,i.Z)(t.data.y)?t.data.y:Math.random()*h,z:(0,i.Z)(t.data.z)?t.data.z:Math.random()*Math.sqrt(d*h),size:l(t)||30,mass:f(t),nodeStrength:g(t)})}))),w=a.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:v(t),linkDistance:p(t,e.getNode(t.source),e.getNode(t.target))})})));if(!(null==s?void 0:s.length))return this.lastResult={nodes:[],edges:a},{nodes:[],edges:a};const x={};s.forEach(((t,e)=>{x[t.id]={x:0,y:0,z:0}}));const b=new o.k({nodes:m,edges:w});this.formatCentripetal(u,b);const{maxIteration:E,minMovement:N,onTick:M}=u;if(this.lastLayoutNodes=m,this.lastLayoutEdges=w,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=b,this.lastOptions=u,this.lastVelMap=x,"undefined"==typeof window)return;let k=0;return new Promise((r=>{this.timeInterval=window.setInterval((()=>{s&&this.running||r({nodes:y(e,m),edges:a}),this.runOneStep(b,e,k,x,u),this.updatePosition(e,b,x,u),t&&m.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===c?t.data.z:void 0}))),null==M||M({nodes:y(e,m),edges:a}),k++,(k>=E||this.judgingDistance{let r=1;(0,i.Z)(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),r.nodeSize=(0,s.uE)(t.nodeSize,t.nodeSpacing);const u=t.linkDistance?(0,s.jE)(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=u,r.nodeStrength=(0,s.jE)(1,t.nodeStrength),r.edgeStrength=(0,s.jE)(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:s,clustering:a,nodeClusterBy:u}=t,c=e.getAllNodes(),d=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let h,l;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),s&&u&&(h=g(e,u),l=Array.from(new Set(null==c?void 0:c.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(d,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=h[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==l?void 0:l.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=h[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=m(e))}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}}})),a&&u){h||(h=g(e,u)),l||(l=Array.from(new Set(c.map((t=>t.data[u]))))),l=l.filter((t=>void 0!==t));const r={};l.forEach((t=>{const n=c.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=m(n)})),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:v,others:p}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),v&&"function"!=typeof v&&(t.centripetalOptions.single=()=>v),p&&"function"!=typeof p&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,r,n,o){const i={},s=t.getAllNodes(),a=t.getAllEdges();if(!(null==s?void 0:s.length))return;const{monitor:u}=o;if(this.calRepulsive(t,i,o),a&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u){u({energy:this.calTotalEnergy(i,s),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,s=3===this.options.dimensions?t[e.id].z:0,a=o*o+i*i+s*s,{mass:u=1}=e.data;r+=u*a*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;d(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:s,target:a}=r,u=t.getNode(s),c=t.getNode(a);if(!u||!c)return;let d=c.data.x-u.data.x,h=c.data.y-u.data.y,l=3===n?c.data.z-u.data.z:0;d||h||(d=.01*Math.random(),h=.01*Math.random(),3!==n||l||(l=.01*Math.random()));const f=Math.sqrt(d*d+h*h+l*l);if(f{const{id:s,data:g}=n,{mass:v,x:p,y:m,z:y}=g,w=e.getNode(s);let x=0,b=0,E=0,N=l;const M=t.getDegree(s,"in"),k=t.getDegree(s,"out"),_=t.getDegree(s,"both"),A=null==o?void 0:o(w,_);if(A){const[t,e,r]=A;x=p-t,b=m-e,N=r}else x=p-h[0],b=m-h[1],E=y-h[2];if(N&&(r[s].x-=N*x/v,r[s].y-=N*b/v,r[s].z-=N*E/v),f){const{leaf:t,single:e,others:n,center:o}=f,{x:h,y:l,z:g,centerStrength:x}=(null==o?void 0:o(w,a,u,c,d))||{x:0,y:0,z:0,centerStrength:0};if(!(0,i.Z)(h)||!(0,i.Z)(l))return;const b=(p-h)/v,E=(m-l)/v,N=(y-g)/v;if(x&&(r[s].x-=x*b,r[s].y-=x*E,r[s].z-=x*N),0===_){const t=e(w);if(!t)return;return r[s].x-=t*b,r[s].y-=t*E,void(r[s].z-=t*N)}if(0===M||0===k){const e=t(w,a,u);if(!e)return;return r[s].x-=e*b,r[s].y-=e*E,void(r[s].z-=e*N)}const A=n(w);if(!A)return;r[s].x-=A*b,r[s].y-=A*E,r[s].z-=A*N}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:s,dimensions:a}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*s)*o||.01,c=(r[n].y+e[n].y*s)*o||.01,d=3===a?(r[n].z+e[n].z*s)*o||.01:0;const h=Math.sqrt(u*u+c*c+d*d);if(h>i){const t=i/h;u*=t,c*=t,d*=t}r[n]={x:u,y:c,z:d}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:s,dimensions:a}=n,u=e.getAllNodes();if(!(null==u?void 0:u.length))return void(this.judgingDistance=0);let c=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),u.forEach((n=>{const{id:u}=n,d=t.getNode(u);if((0,i.Z)(d.data.fx)&&(0,i.Z)(d.data.fy))return void e.mergeNodeData(u,{x:d.data.fx,y:d.data.fy,z:3===a?d.data.fz:void 0});const h=r[u].x*s,l=r[u].y*s,f=3===a?r[u].z*s:0;e.mergeNodeData(u,{x:n.data.x+h,y:n.data.y+l,z:n.data.z+f});const g=Math.sqrt(h*h+l*l+f*f);switch(o){case"max":this.judgingDistanceg&&(this.judgingDistance=g);break;default:c+=g}})),o&&"mean"!==o||(this.judgingDistance=c/u.length)}}const g=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=v(t,"leaf",r,e))})),n},v=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let s=r,a=[];0===o?(s=t.getSuccessors(r.id)[0],a=t.getNeighbors(s.id)):0===i&&(s=t.getPredecessors(r.id)[0],a=t.getNeighbors(s.id)),a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")));return{coreNode:s,siblingLeaves:a,sameTypeLeaves:p(t,e,n,r,a)}},p=(t,e,r,n,o)=>{const i=n.data[r]||"";let s=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),s},m=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},y=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}))},79189:function(t,e,r){"use strict";r.d(e,{O:function(){return u}});var n=r(80813),o=r(56354),i=r(25719),s=r(21361);const a={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};class u{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},a),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericFruchtermanLayout(!0,t,e)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;ethis.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){if(this.running)return;const n=this.formatOptions(r),{dimensions:i,width:a,height:u,center:c,clustering:d,nodeClusterBy:h,maxIteration:l,onTick:f}=n,g=e.getAllNodes(),v=e.getAllEdges();if(!(null==g?void 0:g.length)){const t={nodes:[],edges:v};return this.lastResult=t,t}if(1===g.length){t&&e.mergeNodeData(g[0].id,{x:c[0],y:c[1],z:3===i?c[2]:void 0});const r={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:c[0],y:c[1],z:3===i?c[2]:void 0})})],edges:v};return this.lastResult=r,r}const p=g.map((t=>(0,s.u)(t,[a,u]))),m=new o.k({nodes:p,edges:v}),y={};if(d&&p.forEach((t=>{const e=t.data[h];y[e]||(y[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=v,this.lastAssign=t,this.lastGraph=m,this.lastOptions=n,this.lastClusterMap=y,"undefined"==typeof window)return;let w=0;return new Promise((r=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(m,y,n),t&&p.forEach((({id:t,data:r})=>e.mergeNodeData(t,{x:r.x,y:r.y,z:3===i?r.z:void 0}))),null==f||f({nodes:p,edges:v}),w++,w>=l&&(window.clearInterval(this.timeInterval),r({nodes:p,edges:v}))):r({nodes:p,edges:v})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:s}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=s||"undefined"==typeof window?s:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:s,gravity:a,center:u,speed:c,clustering:d,nodeClusterBy:h,clusterGravity:l}=r,f=o*s,g=Math.sqrt(f)/10,v=t.getAllNodes(),p=f/(v.length+1),m=Math.sqrt(p),y={};if(this.applyCalculate(t,y,m,p),d){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;v.forEach((t=>{const{data:r}=t,n=e[r[h]];(0,i.Z)(r.x)&&(n.cx+=r.x),(0,i.Z)(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=l||a;v.forEach(((r,n)=>{const{id:o,data:s}=r;if(!(0,i.Z)(s.x)||!(0,i.Z)(s.y))return;const a=e[s[h]],u=Math.sqrt((s.x-a.cx)*(s.x-a.cx)+(s.y-a.cy)*(s.y-a.cy)),c=m*t;y[o].x-=c*(s.x-a.cx)/u,y[o].y-=c*(s.y-a.cy)/u}))}v.forEach(((t,e)=>{const{id:r,data:o}=t;if(!(0,i.Z)(o.x)||!(0,i.Z)(o.y))return;const s=.01*m*a;y[r].x-=s*(o.x-u[0]),y[r].y-=s*(o.y-u[1]),3===n&&(y[r].z-=s*(o.z-u[2]))})),v.forEach(((e,r)=>{const{id:o,data:s}=e;if((0,i.Z)(s.fx)&&(0,i.Z)(s.fy))return s.x=s.fx,s.y=s.fy,void(3===n&&(s.z=s.fz));if(!(0,i.Z)(s.x)||!(0,i.Z)(s.y))return;const a=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(a>0){const e=Math.min(g*(c/800),a);t.mergeNodeData(o,{x:s.x+y[o].x/a*e,y:s.y+y[o].y/a*e,z:3===n?s.z+y[o].z/a*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},s)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:a},u)=>{if(s<=u||!(0,i.Z)(t.x)||!(0,i.Z)(n.x)||!(0,i.Z)(t.y)||!(0,i.Z)(n.y))return;let c=t.x-n.x,d=t.y-n.y,h=3===this.options.dimensions?t.z-n.z:0,l=c*c+d*d+h*h;0===l&&(l=1,c=.01,d=.01,h=.01);const f=r/l,g=c*f,v=d*f,p=h*f;e[o].x+=g,e[o].y+=v,e[a].x-=g,e[a].y-=v,3===this.options.dimensions&&(e[o].z+=p,e[a].z-=p)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:s}=n;if(!o||!s||o===s)return;const{data:a}=t.getNode(o),{data:u}=t.getNode(s);if(!((0,i.Z)(u.x)&&(0,i.Z)(a.x)&&(0,i.Z)(u.y)&&(0,i.Z)(a.y)))return;const c=u.x-a.x,d=u.y-a.y,h=3===this.options.dimensions?u.z-a.z:0,l=Math.sqrt(c*c+d*d+h*h)/r,f=c*l,g=d*l,v=h*l;e[o].x+=f,e[o].y+=g,e[s].x-=f,e[s].y-=g,3===this.options.dimensions&&(e[o].z+=v,e[s].z-=v)}))}}},93786:function(t,e,r){"use strict";r.d(e,{M:function(){return h}});var n=r(80813),o=r(18756),i=r(25719),s=r(21361),a=r(35714),u=r(18949),c=r(10259);const d={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};class h{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},d),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericGridLayout(!0,t,e)}))}genericGridLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{begin:d=[0,0],condense:h,preventOverlapPadding:p,preventOverlap:y,rows:w,cols:x,nodeSpacing:b,nodeSize:E,width:N,height:M,position:k}=n;let{sortBy:_}=n;const A=e.getAllNodes(),S=e.getAllEdges(),j=null==A?void 0:A.length;if(!j||1===j)return(0,u.P)(e,t,d);const O=A.map((t=>(0,s.u)(t)));"id"===_||(0,o.Z)(_)&&void 0!==O[0].data[_]||(_="degree"),"degree"===_?O.sort(((t,r)=>e.getDegree(r.id,"both")-e.getDegree(t.id,"both"))):"id"===_?O.sort(((t,e)=>(0,i.Z)(e.id)&&(0,i.Z)(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):O.sort(((t,e)=>e.data[_]-t.data[_]));const R=N||"undefined"==typeof window?N:window.innerWidth,I=M||"undefined"==typeof window?M:window.innerHeight,z=j,C={rows:w,cols:x};if(null!=w&&null!=x)C.rows=w,C.cols=x;else if(null!=w&&null==x)C.rows=w,C.cols=Math.ceil(z/C.rows);else if(null==w&&null!=x)C.cols=x,C.rows=Math.ceil(z/C.cols);else{const t=Math.sqrt(z*I/R);C.rows=Math.round(t),C.cols=Math.round(R/I*t)}if(C.rows=Math.max(C.rows,1),C.cols=Math.max(C.cols,1),C.cols*C.rows>z){const t=l(C),e=f(C);(t-1)*e>=z?l(C,t-1):(e-1)*t>=z&&f(C,e-1)}else for(;C.cols*C.rows=z?f(C,e+1):l(C,t+1)}let D=h?0:R/C.cols,T=h?0:I/C.rows;if(y||b){const t=(0,a.jE)(10,b),r=(0,a.tO)(30,E,!1);O.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=e.getNode(n.id),[i,s]=(0,c._)(r(o)||30),a=void 0!==t?t(n):p,u=i+a,d=s+a;D=Math.max(D,u),T=Math.max(T,d)}))}const P={},L={row:0,col:0},F={};for(let t=0;t{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),q}))}}const l=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.min(n,o);else{Math.min(n,o)===t.rows?t.rows=e:t.cols=e}return r},f=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.max(n,o);else{Math.max(n,o)===t.rows?t.rows=e:t.cols=e}return r},g=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,v=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,p=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},m=(t,e,r,n,o,i,s,a)=>{let u,c;const d=o[t.id];if(d)u=d.col*r+r/2+e[0],c=d.row*n+n/2+e[1];else{for(;g(a,s);)p(i,s);u=s.col*r+r/2+e[0],c=s.row*n+n/2+e[1],v(a,s),p(i,s)}t.data.x=u,t.data.y=c}},8421:function(t,e,r){"use strict";r.d(e,{A:function(){return c}});var n=r(80813),o=r(73728),i=r(34748),s=r(21361),a=r(18949);const u={center:[0,0],linkDistance:50};class c{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},u),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericMDSLayout(!0,t,e)}))}genericMDSLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{center:o=[0,0],linkDistance:u=50}=n,c=e.getAllNodes(),l=e.getAllEdges();if(!(null==c?void 0:c.length)||1===c.length)return(0,a.P)(e,t,o);const f=(0,i.zJ)({nodes:c,edges:l},!1),g=(0,i.qs)(f);d(g);const v=(0,i.nu)(g,u),p=h(v),m=[];p.forEach(((t,e)=>{const r=(0,s.u)(c[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],m.push(r)})),t&&m.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:m,edges:l}}))}}const d=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},h=t=>{const e=o.y3.mul(o.y3.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),i=e.mean();e.add(i).subRowVector(r).subColumnVector(n);const s=new o.Sc(e),a=o.y3.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((t=>o.y3.mul([t],[a]).toJSON()[0].splice(0,2)))}},16589:function(t,e,r){"use strict";r.d(e,{D:function(){return g}});var n=r(80813),o=r(18756),i=r(34748),s=r(35714),a=r(21361),u=r(18949),c=r(73728);const d={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},h=(t,e,r,n,o,i)=>{e.forEach(((s,a)=>{r[a]={x:0,y:0},e.forEach(((e,u)=>{if(a===u)return;if(o[a]!==o[u])return;let c=s.x-e.x,d=s.y-e.y,h=Math.sqrt(c*c+d*d);if(0===h){h=1;const t=a>u?1:-1;c=.01*t,d=.01*t}if(h{const u=i||s/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,s=Math.sqrt(n*n+i*i);let a=i/s,u=-n/s;const c=Math.sqrt(e.x*e.x+e.y*e.y);let d=Math.acos((a*e.x+u*e.y)/c);d>Math.PI/2&&(d-=Math.PI/2,a*=-1,u*=-1);const h=Math.cos(d)*c;e.x=a*h,e.y=u*h})),t.forEach(((i,s)=>{if(s===o)return;const c=Math.sqrt(e[s].x*e[s].x+e[s].y*e[s].y);if(c>0&&s!==o){const d=Math.min(u*(r/800),c);if(i.x+=e[s].x/c*d,i.y+=e[s].y/c*d,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*a[s],r=r/n*a[s],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},f={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class g{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},f),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericRadialLayout(!0,t,e)}))}genericRadialLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{width:f,height:g,center:x,focusNode:b,unitRadius:E,nodeSize:N,nodeSpacing:M,strictRadial:k,preventOverlap:_,maxPreventOverlapIteration:A,sortBy:S,linkDistance:j=50,sortStrength:O=10,maxIteration:R=1e3}=n,I=e.getAllNodes(),z=e.getAllEdges(),C=f||"undefined"==typeof window?f:window.innerWidth,D=g||"undefined"==typeof window?g:window.innerHeight,T=x||[C/2,D/2];if(!(null==I?void 0:I.length)||1===I.length)return(0,u.P)(e,t,T);let P=I[0];if((0,o.Z)(b)){for(let t=0;tT[0]?T[0]:C-T[0],B=D-T[1]>T[1]?T[1]:D-T[1];0===G&&(G=C/2),0===B&&(B=D/2);const U=Math.min(G,B),W=Math.max(...Z),$=[],Y=E||U/W;Z.forEach(((t,e)=>{$[e]=t*Y}));const H=v(I,q,j,$,Y,S,O),K=p(H),J=((t,e,r)=>{try{const r=c.y3.mul(c.y3.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const s=new c.Sc(r),a=c.y3.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map((e=>c.y3.mul([e],[a]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t({x:(isNaN(t)?Math.random()*j:t)-J[L][0],y:(isNaN(e)?Math.random()*j:e)-J[L][1]})));if(this.run(R,X,K,H,$,L),_){Q=(0,s.uE)(N,M);const t={nodes:I,nodeSizeFunc:Q,positions:X,radii:$,height:D,width:C,strictRadial:Boolean(k),focusIdx:L,iterations:A||200,k:X.length/4.5};X=((t,e)=>{const r=Object.assign(Object.assign({},d),e),{positions:n,iterations:o,width:i,k:s,speed:a=100,strictRadial:u,focusIdx:c,radii:f=[],nodeSizeFunc:g}=r,v=t.getAllNodes(),p=[],m=i/10;for(let t=0;t{p[e]={x:0,y:0}})),h(v,n,p,s,f,g),l(n,p,a,u,c,m,i,f);return n})(e,t)}const tt=[];X.forEach(((t,e)=>{const r=(0,a.u)(I[e]);r.data.x=t.x+T[0],r.data.y=t.y+T[1],tt.push(r)})),t&&tt.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:tt,edges:z}}))}run(t,e,r,n,o,i){for(let s=0;s<=t;s++){const a=s/t;this.oneIteration(a,e,o,n,r,i)}}oneIteration(t,e,r,n,o,s){const a=1-t;e.forEach(((u,c)=>{const d=(0,i.$y)(u,{x:0,y:0}),h=0===d?0:1/d;if(c===s)return;let l=0,f=0,g=0;e.forEach(((t,e)=>{if(c===e)return;const r=(0,i.$y)(u,t),s=0===r?0:1/r,a=n[e][c];g+=o[c][e],l+=o[c][e]*(t.x+a*(u.x-t.x)*s),f+=o[c][e]*(t.y+a*(u.y-t.y)*s)}));const v=0===r[c]?0:1/r[c];g*=a,g+=t*v*v,l*=a,l+=t*v*u.x*h,u.x=l/g,f*=a,f+=t*v*u.y*h,u.y=f/g}))}}const v=(t,e,r,n,i,s,a)=>{if(!t)return[];const u=[];if(e){const c={};e.forEach(((e,d)=>{const h=[];e.forEach(((e,u)=>{var l,f;if(d===u)h.push(0);else if(n[d]===n[u])if("data"===s)h.push(e*(Math.abs(d-u)*a)/(n[d]/i));else if(s){let r,g;if(c[t[d].id])r=c[t[d].id];else{const e=("id"===s?t[d].id:null===(l=t[d].data)||void 0===l?void 0:l[s])||0;r=(0,o.Z)(e)?e.charCodeAt(0):e,c[t[d].id]=r}if(c[t[u].id])g=c[t[u].id];else{const e=("id"===s?t[u].id:null===(f=t[u].data)||void 0===f?void 0:f[s])||0;g=(0,o.Z)(e)?e.charCodeAt(0):e,c[t[u].id]=g}h.push(e*(Math.abs(r-g)*a)/(n[d]/i))}else h.push(e*r/(n[d]/i));else{const t=(r+i)/2;h.push(e*t)}})),u.push(h)}))}return u},p=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)},y=(t,e,r)=>{const n=t.length;for(let o=0;o{let r=0;for(let n=0;nr?t[e][n]:r);return r}},61649:function(t,e,r){"use strict";r.d(e,{_:function(){return i}});var n=r(80813);const o={center:[0,0],width:300,height:300};class i{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},o),t)}execute(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,e)}))}assign(t,e){return(0,n.mG)(this,void 0,void 0,(function*(){yield this.genericRandomLayout(!0,t,e)}))}genericRandomLayout(t,e,r){return(0,n.mG)(this,void 0,void 0,(function*(){const n=Object.assign(Object.assign({},this.options),r),{center:o,width:i,height:s}=n,a=e.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,c=s||"undefined"==typeof window?s:window.innerHeight,d=o||[u/2,c/2],h=[];a&&a.forEach((t=>{h.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+d[0],y:.9*(Math.random()-.5)*c+d[1]}})})),t&&h.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:h,edges:e.getAllEdges()}}))}}},31350:function(t,e,r){"use strict";function n(t){return!!t.tick&&!!t.stop}r.d(e,{h:function(){return n}})},23041:function(t,e,r){"use strict";r.d(e,{k:function(){return n}});const n=Array.isArray},18949:function(t,e,r){"use strict";r.d(e,{P:function(){return n}});const n=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();if(!(null==n?void 0:n.length)){return{nodes:[],edges:o}}if(1===n.length){e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]});return{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}}}},35714:function(t,e,r){"use strict";r.d(e,{jE:function(){return a},tO:function(){return u},uE:function(){return c}});var n=r(77817),o=r(25719),i=r(85266),s=r(10259);function a(t,e){let r;return r=(0,n.Z)(e)?e:(0,o.Z)(e)?()=>e:()=>t,r}function u(t,e,r=!0){return e||0===e?(0,n.Z)(e)?e:(0,o.Z)(e)?()=>e:Array.isArray(e)?()=>r?Math.max(...e)||t:e:(0,i.Z)(e)&&e.width&&e.height?()=>r?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?r?Math.max(...n)||t:n:(0,i.Z)(n)&&n.width&&n.height?r?Math.max(n.width,n.height)||t:[n.width,n.height]:n:t}}const c=(t,e,r=10)=>{let o;const a="function"==typeof e?e:()=>e||0;o=t?Array.isArray(t)?e=>t:(0,n.Z)(t)?t:e=>t:t=>{var e,n,o;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(n=t.data)||void 0===n?void 0:n.bboxSize;if(null===(o=t.data)||void 0===o?void 0:o.size){const e=t.data.size;return Array.isArray(e)?e:(0,i.Z)(e)?[e.width,e.height]:e}return r};return t=>{const e=o(t),r=a(t);return Math.max(...(0,s._)(e))+r}}},34748:function(t,e,r){"use strict";r.d(e,{$y:function(){return c},H0:function(){return u},_:function(){return d},nu:function(){return a},qs:function(){return i},zJ:function(){return s}});var n=r(25719),o=r(23041);const i=t=>{const e=[],r=t.length;for(let n=0;ne[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e},s=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e;o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,s=i[r],a=i[n];void 0!==s&&void 0!==a&&(o[s][a]=1,e||(o[a][s]=1))})),o},a=(t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r},u=t=>{let e=1/0,r=1/0,i=-1/0,s=-1/0;return t.forEach((t=>{let a=t.data.size;(0,o.k)(a)?1===a.length&&(a=[a[0],a[0]]):(0,n.Z)(a)?a=[a,a]:(void 0===a||isNaN(a))&&(a=[30,30]);const u=[a[0]/2,a[1]/2],c=t.data.x-u[0],d=t.data.x+u[0],h=t.data.y-u[1],l=t.data.y+u[1];e>c&&(e=c),r>h&&(r=h),iMath.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),d=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:s,stopAllFn:a}=i;for(let u=0;u{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>o(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=o(t[r])})),e}return t},i=(t,e)=>{const r=o(t);return r.data=r.data||{},e&&((0,n.Z)(r.data.x)||(r.data.x=Math.random()*e[0]),(0,n.Z)(r.data.y)||(r.data.y=Math.random()*e[1])),r}},10259:function(t,e,r){"use strict";r.d(e,{_:function(){return o}});var n=r(25719);function o(t){if(!t)return[0,0,0];if((0,n.Z)(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,o=e]=t;return[e,r,o]}},83559:function(t,e,r){"use strict";var n=r(1623),o=function(t){if("object"!=typeof t||null===t)return t;var e;if((0,n.Z)(t)){e=[];for(var r=0,i=t.length;r1&&void 0!==arguments[1]?arguments[1]:{},r=e.maxRows,n=void 0===r?15:r,o=e.maxColumns,i=void 0===o?10:o,s=e.maxNumSize,a=void 0===s?8:s,u=e.padMinus,c=void 0===u?"auto":u;return"".concat(t.constructor.name," {\n").concat(E,"[\n").concat(N).concat(k(t,n,i,a,c),"\n").concat(E,"]\n").concat(E,"rows: ").concat(t.rows,"\n").concat(E,"columns: ").concat(t.columns,"\n}")}function k(t,e,r,n,o){var i=t.rows,s=t.columns,a=Math.min(i,e),u=Math.min(s,r),c=[];if("auto"===o){o=!1;t:for(var d=0;d=0&&r?" ".concat(A(t,e-1)):A(t,e)).padEnd(e)}function A(t,e){var r=t.toString();if(r.length<=e)return r;var 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;var o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function S(t,e,r){var n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function j(t,e,r){var n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function O(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 R(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 I(t,e){if(!x.isAnyArray(e))throw new TypeError("row indices must be an array");for(var r=0;r=t.rows)throw new RangeError("row indices are out of range")}function z(t,e){if(!x.isAnyArray(e))throw new TypeError("column indices must be an array");for(var r=0;r=t.columns)throw new RangeError("column indices are out of range")}function C(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(T("startRow",e),T("endRow",r),T("startColumn",n),T("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 D(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0;nr?(o=!0,r=e):(n=!1,o=!0);t++}return n}},{key:"isReducedEchelonForm",value:function(){for(var t=0,e=0,r=-1,n=!0,o=!1;tr?(o=!0,r=e):(n=!1,o=!0);for(var i=e+1;it.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);for(var i=t.get(e,r),s=r;s=0;)if(0===t.maxRow(n))n--;else{for(var o=0,i=!1;o0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==m(t))throw new TypeError("options must be an object");var e=t.rows,r=void 0===e?1:e,n=t.columns,o=void 0===n?1:n;if(!Number.isInteger(r)||r<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(o)||o<=0)throw new TypeError("columns must be a positive integer");for(var i=new X(this.rows*r,this.columns*o),s=0;se[r]&&(e[r]=this.get(r,n));return e;case"column":for(var o=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),i=0;io[s]&&(o[s]=this.get(i,s));return o;case void 0:for(var a=this.get(0,0),u=0;ua&&(a=this.get(u,c));return a;default:throw new Error("invalid option: ".concat(t))}}},{key:"maxIndex",value:function(){P(this);for(var t=this.get(0,0),e=[0,0],r=0;rt&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}},{key:"min",value:function(t){if(this.isEmpty())return NaN;switch(t){case"row":for(var e=new Array(this.rows).fill(Number.POSITIVE_INFINITY),r=0;re&&(e=this.get(t,r));return e}},{key:"maxRowIndex",value:function(t){S(this,t),P(this);for(var e=this.get(t,0),r=[t,0],n=1;ne&&(e=this.get(t,n),r[1]=n);return r}},{key:"minRow",value:function(t){if(S(this,t),this.isEmpty())return NaN;for(var e=this.get(t,0),r=1;re&&(e=this.get(r,t));return e}},{key:"maxColumnIndex",value:function(t){j(this,t),P(this);for(var e=this.get(0,t),r=[0,t],n=1;ne&&(e=this.get(n,t),r[0]=n);return r}},{key:"minColumn",value:function(t){if(j(this,t),this.isEmpty())return NaN;for(var e=this.get(0,t),r=1;r0&&void 0!==arguments[0]?arguments[0]:"frobenius";switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError("unknown norm type: ".concat(t))}}},{key:"cumulativeSum",value:function(){for(var t=0,e=0;e1;n/=2)0!=(1&n)&&(e=e.mmul(r)),r=r.mmul(r);return e}},{key:"strassen2x2",value:function(t){t=X.checkMatrix(t);var e=new X(2,2),r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),s=this.get(1,0),a=t.get(1,0),u=this.get(1,1),c=t.get(1,1),d=(r+u)*(n+c),h=(s+u)*n,l=r*(i-c),f=u*(a-n),g=(r+o)*c,v=d+f-g+(o-u)*(a+c),p=l+g,m=h+f,y=d-h+l+(s-r)*(n+i);return e.set(0,0,v),e.set(0,1,p),e.set(1,0,m),e.set(1,1,y),e}},{key:"strassen3x3",value:function(t){t=X.checkMatrix(t);var e=new X(3,3),r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),s=this.get(1,1),a=this.get(1,2),u=this.get(2,0),c=this.get(2,1),d=this.get(2,2),h=t.get(0,0),l=t.get(0,1),f=t.get(0,2),g=t.get(1,0),v=t.get(1,1),p=t.get(1,2),m=t.get(2,0),y=t.get(2,1),w=t.get(2,2),x=(r-i)*(-l+v),b=(-r+i+s)*(h-l+v),E=(i+s)*(-h+l),N=r*h,M=(-r+u+c)*(h-f+p),k=(-r+u)*(f-p),_=(u+c)*(-h+f),A=(-o+c+d)*(v+m-y),S=(o-d)*(v-y),j=o*m,O=(c+d)*(-m+y),R=(-o+s+a)*(p+m-w),I=(o-a)*(p-w),z=(s+a)*(-m+w),C=N+j+n*g,D=(r+n+o-i-s-c-d)*v+b+E+N+A+j+O,T=N+M+_+(r+n+o-s-a-u-c)*p+j+R+z,P=x+s*(-h+l+g-v-p-m+w)+b+N+j+R+I,L=x+b+E+N+a*y,F=j+R+I+z+i*f,q=N+M+k+c*(-h+f+g-v-p-m+y)+A+S+j,V=A+S+j+O+u*l,Z=N+M+k+_+d*w;return e.set(0,0,C),e.set(0,1,D),e.set(0,2,T),e.set(1,0,P),e.set(1,1,L),e.set(1,2,F),e.set(2,0,q),e.set(2,1,V),e.set(2,2,Z),e}},{key:"mmulStrassen",value:function(t){t=X.checkMatrix(t);var r=this.clone(),n=r.rows,o=r.columns,i=t.rows,s=t.columns;function a(t,r,n){var o=t.rows,i=t.columns;if(o===r&&i===n)return t;var s=e.zeros(r,n);return s=s.setSubMatrix(t,0,0)}o!==i&&console.warn("Multiplying ".concat(n," x ").concat(o," and ").concat(i," x ").concat(s," matrix: dimensions do not match."));var u=Math.max(n,i),c=Math.max(o,s);return function t(r,n,o,i){if(o<=512||i<=512)return r.mmul(n);o%2==1&&i%2==1?(r=a(r,o+1,i+1),n=a(n,o+1,i+1)):o%2==1?(r=a(r,o+1,i),n=a(n,o+1,i)):i%2==1&&(r=a(r,o,i+1),n=a(n,o,i+1));var s=parseInt(r.rows/2,10),u=parseInt(r.columns/2,10),c=r.subMatrix(0,s-1,0,u-1),d=n.subMatrix(0,s-1,0,u-1),h=r.subMatrix(0,s-1,u,r.columns-1),l=n.subMatrix(0,s-1,u,n.columns-1),f=r.subMatrix(s,r.rows-1,0,u-1),g=n.subMatrix(s,n.rows-1,0,u-1),v=r.subMatrix(s,r.rows-1,u,r.columns-1),p=n.subMatrix(s,n.rows-1,u,n.columns-1),m=t(e.add(c,v),e.add(d,p),s,u),y=t(e.add(f,v),d,s,u),w=t(c,e.sub(l,p),s,u),x=t(v,e.sub(g,d),s,u),b=t(e.add(c,h),p,s,u),E=t(e.sub(f,c),e.add(d,l),s,u),N=t(e.sub(h,v),e.add(g,p),s,u),M=e.add(m,x);M.sub(b),M.add(N);var k=e.add(w,b),_=e.add(y,x),A=e.sub(m,y);A.add(w),A.add(E);var S=e.zeros(2*M.rows,2*M.columns);return(S=(S=(S=(S=S.setSubMatrix(M,0,0)).setSubMatrix(k,M.rows,0)).setSubMatrix(_,0,M.columns)).setSubMatrix(A,M.rows,M.columns)).subMatrix(0,o-1,0,i-1)}(r=a(r,u,c),t=a(t,u,c),u,c)}},{key:"scaleRows",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==m(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var i=new X(this.rows,this.columns),s=0;s0&&b(a,{min:r,max:o,output:a}),i.setRow(s,a)}return i}},{key:"scaleColumns",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==m(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var i=new X(this.rows,this.columns),s=0;s0&&void 0!==arguments[0]?arguments[0]:J,e=0;e0&&void 0!==arguments[0]?arguments[0]:J,e=0;er||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");for(var n=new X(t.length,r-e+1),o=0;o=this.rows)throw new RangeError("Row index out of range: ".concat(t[o]));n.set(o,i-e,this.get(t[o],i))}return n}},{key:"subMatrixColumn",value:function(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");for(var n=new X(r-e+1,t.length),o=0;o=this.columns)throw new RangeError("Column index out of range: ".concat(t[o]));n.set(i-e,o,this.get(i,t[o]))}return n}},{key:"setSubMatrix",value:function(t,e,r){if((t=X.checkMatrix(t)).isEmpty())return this;C(this,e,e+t.rows-1,r,r+t.columns-1);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if("object"===m(t)&&(e=t,t=void 0),"object"!==m(e))throw new TypeError("options must be an object");var r=e,n=r.unbiased,o=void 0===n||n,i=r.mean,s=void 0===i?this.mean(t):i;if("boolean"!=typeof o)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!x.isAnyArray(s))throw new TypeError("mean must be an array");return L(this,o,s);case"column":if(!x.isAnyArray(s))throw new TypeError("mean must be an array");return F(this,o,s);case void 0:if("number"!=typeof s)throw new TypeError("mean must be a number");return q(this,o,s);default:throw new Error("invalid option: ".concat(t))}}},{key:"standardDeviation",value:function(t,e){"object"===m(t)&&(e=t,t=void 0);var r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if("object"===m(t)&&(e=t,t=void 0),"object"!==m(e))throw new TypeError("options must be an object");var r=e,n=r.center,o=void 0===n?this.mean(t):n;switch(t){case"row":if(!x.isAnyArray(o))throw new TypeError("center must be an array");return V(this,o),this;case"column":if(!x.isAnyArray(o))throw new TypeError("center must be an array");return Z(this,o),this;case void 0:if("number"!=typeof o)throw new TypeError("center must be a number");return G(this,o),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"scale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===m(t)&&(e=t,t=void 0),"object"!==m(e))throw new TypeError("options must be an object");var r=e.scale;switch(t){case"row":if(void 0===r)r=B(this);else if(!x.isAnyArray(r))throw new TypeError("scale must be an array");return U(this,r),this;case"column":if(void 0===r)r=W(this);else if(!x.isAnyArray(r))throw new TypeError("scale must be an array");return $(this,r),this;case void 0:if(void 0===r)r=Y(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return H(this,r),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"toString",value:function(t){return M(this,t)}},{key:t,value:function(){return this.entries()}},{key:"entries",value:p().mark((function t(){var e,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0;case 1:if(!(e2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==m(r))throw new TypeError("options must be an object");for(var n=r.random,o=void 0===n?Math.random:n,i=new X(t,e),s=0;s2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==m(r))throw new TypeError("options must be an object");var n=r.min,o=void 0===n?0:n,i=r.max,s=void 0===i?1e3:i,a=r.random,u=void 0===a?Math.random:a;if(!Number.isInteger(o))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(o>=s)throw new RangeError("min must be smaller than max");for(var c=s-o,d=new X(t,e),h=0;h=0)f(u(o),Q,tt).call(u(o),t,n);else{if(!x.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");var i=t;if("number"!=typeof(n=(t=i.length)?i[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");o.data=[];for(var s=0;s=0))throw new TypeError("nColumns must be a positive integer");for(var r=0;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(var r=0;r>t.get(r,n));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(var e=0;e>>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(var r=0;r>>t.get(r,n));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(var t=0;t=0)s(u(n),et,new X(t,t));else if(s(u(n),et,new X(t)),!n.isSymmetric())throw new TypeError("not symmetric data");return n}return w(r,[{key:"size",get:function(){return a(this,et).size}},{key:"rows",get:function(){return a(this,et).rows}},{key:"columns",get:function(){return a(this,et).columns}},{key:"diagonalSize",get:function(){return this.rows}},{key:"clone",value:function(){var t,e=new r(this.diagonalSize),n=v(this.upperRightEntries());try{for(n.s();!(t=n.n()).done;){var o=g(t.value,3),i=o[0],s=o[1],a=o[2];e.set(i,s,a)}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"toMatrix",value:function(){return new X(this)}},{key:"get",value:function(t,e){return a(this,et).get(t,e)}},{key:"set",value:function(t,e,r){return a(this,et).set(t,e,r),a(this,et).set(e,t,r),this}},{key:"removeCross",value:function(t){return a(this,et).removeRow(t),a(this,et).removeColumn(t),this}},{key:"addCross",value:function(t,e){void 0===e&&(e=t,t=this.diagonalSize);var r=e.slice();return r.splice(t,1),a(this,et).addRow(t,r),a(this,et).addColumn(t,e),this}},{key:"applyMask",value:function(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");var e,r=[],n=v(t.entries());try{for(n.s();!(e=n.n()).done;){var o=g(e.value,2),i=o[0];o[1]||r.push(i)}}catch(t){n.e(t)}finally{n.f()}r.reverse();for(var s=0,a=r;s=t&&(r=++n);return e}},{key:"upperRightEntries",value:p().mark((function t(){var e,r,n;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0,r=0;case 1:if(!(e=this.diagonalSize&&(r=++e);case 6:t.next=1;break;case 9:case"end":return t.stop()}}),t,this)}))},{key:"upperRightValues",value:p().mark((function t(){var e,r,n;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0,r=0;case 1:if(!(e=this.diagonalSize&&(r=++e);case 6:t.next=1;break;case 9:case"end":return t.stop()}}),t,this)}))}],[{key:"isSymmetricMatrix",value:function(t){return X.isMatrix(t)&&"SymmetricMatrix"===t.klassType}},{key:"zeros",value:function(t){return new this(t)}},{key:"ones",value:function(t){return new this(t).fill(1)}},{key:"fromCompact",value:function(t){var e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError("This array is not a compact representation of a Symmetric Matrix, ".concat(JSON.stringify(t)));for(var o=new r(n),i=0,s=0,a=0;a=n&&(i=++s);return o}}]),r}(K);rt.prototype.klassType="SymmetricMatrix";var nt=function(t){c(r,t);var e=d(r);function r(t){var n;if(y(this,r),!(n=e.call(this,t)).isDistance())throw new TypeError("Provided arguments do no produce a distance matrix");return n}return w(r,[{key:"set",value:function(t,e,i){return t===e&&(i=0),n(o(r.prototype),"set",this).call(this,t,e,i)}},{key:"addCross",value:function(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,n(o(r.prototype),"addCross",this).call(this,t,e)}},{key:"toSymmetricMatrix",value:function(){return new rt(this)}},{key:"clone",value:function(){var t,e=new r(this.diagonalSize),n=v(this.upperRightEntries());try{for(n.s();!(t=n.n()).done;){var o=g(t.value,3),i=o[0],s=o[1],a=o[2];i!==s&&e.set(i,s,a)}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"toCompact",value:function(){for(var t=this.diagonalSize,e=new Array((t-1)*t/2),r=1,n=0,o=0;o=t&&(r=1+ ++n);return e}}],[{key:"isDistanceMatrix",value:function(t){return rt.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}},{key:"fromCompact",value:function(t){var e=t.length;if(0===e)return new this(0);var r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError("This array is not a compact representation of a DistanceMatrix, ".concat(JSON.stringify(t)));for(var n=new this(r),o=1,i=0,s=0;s=r&&(o=1+ ++i);return n}}]),r}(rt);nt.prototype.klassSubType="DistanceMatrix";var ot=function(t){c(r,t);var e=d(r);function r(t,n,o){var i;return y(this,r),(i=e.call(this)).matrix=t,i.rows=n,i.columns=o,i}return w(r)}(K),it=function(t){c(r,t);var e=d(r);function r(t,n){var o;return y(this,r),j(t,n),(o=e.call(this,t,t.rows,1)).column=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.column,r),this}},{key:"get",value:function(t){return this.matrix.get(t,this.column)}}]),r}(ot),st=function(t){c(r,t);var e=d(r);function r(t,n){var o;return y(this,r),z(t,n),(o=e.call(this,t,t.rows,n.length)).columnIndices=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}},{key:"get",value:function(t,e){return this.matrix.get(t,this.columnIndices[e])}}]),r}(ot),at=function(t){c(r,t);var e=d(r);function r(t){return y(this,r),e.call(this,t,t.rows,t.columns)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}},{key:"get",value:function(t,e){return this.matrix.get(t,this.columns-e-1)}}]),r}(ot),ut=function(t){c(r,t);var e=d(r);function r(t){return y(this,r),e.call(this,t,t.rows,t.columns)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rows-t-1,e)}}]),r}(ot),ct=function(t){c(r,t);var e=d(r);function r(t,n){var o;return y(this,r),S(t,n),(o=e.call(this,t,1,t.columns)).row=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.row,e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.row,e)}}]),r}(ot),dt=function(t){c(r,t);var e=d(r);function r(t,n){var o;return y(this,r),I(t,n),(o=e.call(this,t,n.length,t.columns)).rowIndices=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rowIndices[t],e)}}]),r}(ot),ht=function(t){c(r,t);var e=d(r);function r(t,n,o){var i;return y(this,r),I(t,n),z(t,o),(i=e.call(this,t,n.length,o.length)).rowIndices=n,i.columnIndices=o,i}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}]),r}(ot),lt=function(t){c(r,t);var e=d(r);function r(t,n,o,i,s){var a;return y(this,r),C(t,n,o,i,s),(a=e.call(this,t,o-n+1,s-i+1)).startRow=n,a.startColumn=i,a}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}]),r}(ot),ft=function(t){c(r,t);var e=d(r);function r(t){return y(this,r),e.call(this,t,t.columns,t.rows)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(e,t,r),this}},{key:"get",value:function(t,e){return this.matrix.get(e,t)}}]),r}(ot),gt=function(t){c(r,t);var e=d(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,r);var i=o.rows,s=void 0===i?1:i;if(t.length%s!=0)throw new Error("the data length is not divisible by the number of rows");return(n=e.call(this)).rows=s,n.columns=t.length/s,n.data=t,n}return w(r,[{key:"set",value:function(t,e,r){var n=this._calculateIndex(t,e);return this.data[n]=r,this}},{key:"get",value:function(t,e){var r=this._calculateIndex(t,e);return this.data[r]}},{key:"_calculateIndex",value:function(t,e){return t*this.columns+e}}]),r}(K),vt=function(t){c(r,t);var e=d(r);function r(t){var n;return y(this,r),(n=e.call(this)).data=t,n.rows=t.length,n.columns=t[0].length,n}return w(r,[{key:"set",value:function(t,e,r){return this.data[t][e]=r,this}},{key:"get",value:function(t,e){return this.data[t][e]}}]),r}(K);var pt=function(){function t(e){y(this,t);var r,n,o,i,s,a,u,c,d,h=(e=vt.checkMatrix(e)).clone(),l=h.rows,f=h.columns,g=new Float64Array(l),v=1;for(r=0;rMath.abs(c[i])&&(i=r);if(i!==n){for(o=0;o=0;o--){for(n=0;ni?n.set(o,i,t.get(o,i)):o===i?n.set(o,i,1):n.set(o,i,0);return n}},{key:"upperTriangularMatrix",get:function(){for(var t=this.LU,e=t.rows,r=t.columns,n=new X(e,r),o=0;oMath.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}var yt=function(){function t(e){y(this,t);var r,n,o,i,s=(e=vt.checkMatrix(e)).clone(),a=e.rows,u=e.columns,c=new Float64Array(u);for(o=0;o=0;i--){for(o=0;o=0;r--){for(t=0;t1&&void 0!==arguments[1]?arguments[1]:{};if(y(this,t),(e=vt.checkMatrix(e)).isEmpty())throw new Error("Matrix must be non-empty");var n,o=e.rows,i=e.columns,s=r.computeLeftSingularVectors,a=void 0===s||s,u=r.computeRightSingularVectors,c=void 0===u||u,d=r.autoTranspose,h=void 0!==d&&d,l=Boolean(a),f=Boolean(c),g=!1;if(o=0;H--)if(0!==w[H]){for(var K=H+1;K=0;ot--){if(ot0;){var lt=void 0,ft=void 0;for(lt=W-2;lt>=-1&&-1!==lt;lt--){var gt=Number.MIN_VALUE+ht*Math.abs(w[lt]+Math.abs(w[lt+1]));if(Math.abs(E[lt])<=gt||Number.isNaN(E[lt])){E[lt]=0;break}}if(lt===W-2)ft=4;else{var pt=void 0;for(pt=W-1;pt>=lt&&pt!==lt;pt--){var yt=(pt!==W?Math.abs(E[pt]):0)+(pt!==lt+1?Math.abs(E[pt-1]):0);if(Math.abs(w[pt])<=ht*yt){w[pt]=0;break}}pt===lt?ft=3:pt===W-1?ft=1:(ft=2,lt=pt)}switch(lt++,ft){case 1:var wt=E[W-2];E[W-2]=0;for(var xt=W-2;xt>=lt;xt--){var bt=mt(w[xt],wt),Et=w[xt]/bt,Nt=wt/bt;if(w[xt]=bt,xt!==lt&&(wt=-Nt*E[xt-1],E[xt-1]=Et*E[xt-1]),f)for(var Mt=0;Mt=w[lt+1]);){var Ht=w[lt];if(w[lt]=w[lt+1],w[lt+1]=Ht,f&<e&&o.set(i,s,t.get(i,s)/this.s[s]);for(var a=this.U,u=a.rows,c=a.columns,d=new X(r,u),h=0;ht&&e++;return e}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return X.diag(this.s)}}]),t}();function xt(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t=vt.checkMatrix(t),e=vt.checkMatrix(e),r?new wt(t).solve(e):t.isSquare()?new pt(t).solve(e):new yt(t).solve(e)}function bt(t,e){for(var r=[],n=0;n3&&void 0!==arguments[3]?arguments[3]:1e-9,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e-9;if(t>o)return new Array(e.rows+1).fill(0);for(var i=e.addRow(r,[0]),s=0;s1&&void 0!==arguments[1]?arguments[1]:{};y(this,t);var n=r.assumeSymmetric,o=void 0!==n&&n;if(!(e=vt.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");var i,s,a=e.columns,u=new X(a,a),c=new Float64Array(a),d=new Float64Array(a),h=e;if(!!o||e.isSymmetric()){for(i=0;i0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}]),t}();function Mt(t,e,r,n){var o,i,s,a,u,c,d,h;for(u=0;u0;a--){for(h=0,s=0,c=0;c0&&(i=-i),e[a]=h*i,s-=o*i,r[a-1]=o-i,u=0;uc)do{for(o=r[c],l=mt(h=(r[c+1]-o)/(2*e[c]),1),h<0&&(l=-l),r[c]=e[c]/(h+l),r[c+1]=e[c]*(h+l),f=r[c+1],i=o-r[c],s=c+2;s=c;s--)for(p=v,v=g,w=y,o=g*e[s],i=g*h,l=mt(h,e[s]),e[s+1]=y*l,y=e[s]/l,h=(g=h/l)*r[s]-y*o,r[s+1]=i+y*(g*o+y*r[s]),u=0;uE*b);r[c]=r[c]+x,e[c]=0}for(s=0;s=c;a--)r[a]=e.get(a,c-1)/d,s+=r[a]*r[a];for(i=Math.sqrt(s),r[c]>0&&(i=-i),s-=r[c]*i,r[c]=r[c]-i,u=c;u=c;a--)o+=r[a]*e.get(a,u);for(o/=s,a=c;a<=h;a++)e.set(a,u,e.get(a,u)-o*r[a])}for(a=0;a<=h;a++){for(o=0,u=h;u>=c;u--)o+=r[u]*e.get(a,u);for(o/=s,u=c;u<=h;u++)e.set(a,u,e.get(a,u)-o*r[u])}r[c]=d*r[c],e.set(c,c-1,d*i)}}for(a=0;a=1;c--)if(0!==e.get(c,c-1)){for(a=c+1;a<=h;a++)r[a]=e.get(a,c-1);for(u=c;u<=h;u++){for(i=0,a=c;a<=h;a++)i+=r[a]*n.get(a,u);for(i=i/r[c]/e.get(c,c-1),a=c;a<=h;a++)n.set(a,u,n.get(a,u)+i*r[a])}}}function At(t,e,r,n,o){var i,s,a,u,c,d,h,l,f,g,v,p,m,y,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,k=0,_=0,A=0,S=0,j=0,O=0;for(i=0;ib)&&(r[i]=o.get(i,i),e[i]=0),s=Math.max(i-1,0);s=0;){for(u=x;u>0&&(0===(S=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)))&&(S=M),!(Math.abs(o.get(u,u-1))=0){for(j=k>=0?k+j:k-j,r[x-1]=l+j,r[x]=r[x-1],0!==j&&(r[x]=l-h/j),e[x-1]=0,e[x]=0,k=(l=o.get(x,x-1))/(S=Math.abs(l)+Math.abs(j)),_=j/S,k/=A=Math.sqrt(k*k+_*_),_/=A,s=x-1;s0){for(S=Math.sqrt(S),f=u&&(k=((A=l-(j=o.get(c,c)))*(S=f-j)-h)/o.get(c+1,c)+o.get(c,c+1),_=o.get(c+1,c+1)-j-A-S,A=o.get(c+2,c+1),k/=S=Math.abs(k)+Math.abs(_)+Math.abs(A),_/=S,A/=S,c!==u)&&!(Math.abs(o.get(c,c-1))*(Math.abs(_)+Math.abs(A))c+2&&o.set(i,i-3,0);for(a=c;a<=x-1&&(y=a!==x-1,a!==c&&(k=o.get(a,a-1),_=o.get(a+1,a-1),A=y?o.get(a+2,a-1):0,0!==(l=Math.abs(k)+Math.abs(_)+Math.abs(A))&&(k/=l,_/=l,A/=l)),0!==l);a++)if(S=Math.sqrt(k*k+_*_+A*A),k<0&&(S=-S),0!==S){for(a!==c?o.set(a,a-1,-S*l):u!==c&&o.set(a,a-1,-o.get(a,a-1)),l=(k+=S)/S,f=_/S,j=A/S,_/=k,A/=k,s=a;s=0;x--)if(k=r[x],0===(_=e[x]))for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(h=o.get(i,i)-k,A=0,s=u;s<=x;s++)A+=o.get(i,s)*o.get(s,x);if(e[i]<0)j=h,S=A;else if(u=i,0===e[i]?o.set(i,x,0!==h?-A/h:-A/(E*M)):(l=o.get(i,i+1),f=o.get(i+1,i),d=(l*S-j*A)/(_=(r[i]-k)*(r[i]-k)+e[i]*e[i]),o.set(i,x,d),o.set(i+1,x,Math.abs(l)>Math.abs(j)?(-A-h*d)/l:(-S-f*d)/j)),E*(d=Math.abs(o.get(i,x)))*d>1)for(s=i;s<=x;s++)o.set(s,x,o.get(s,x)/d)}else if(_<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,_/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-k)/o.get(x,x-1))):(w=St(0,-o.get(x-1,x),o.get(x-1,x-1)-k,_),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,v=0,s=u;s<=x;s++)g+=o.get(i,s)*o.get(s,x-1),v+=o.get(i,s)*o.get(s,x);if(h=o.get(i,i)-k,e[i]<0)j=h,A=g,S=v;else if(u=i,0===e[i]?(w=St(-g,-v,h,_),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(l=o.get(i,i+1),f=o.get(i+1,i),p=(r[i]-k)*(r[i]-k)+e[i]*e[i]-_*_,m=2*(r[i]-k)*_,0===p&&0===m&&(p=E*M*(Math.abs(h)+Math.abs(_)+Math.abs(l)+Math.abs(f)+Math.abs(j))),w=St(l*A-j*g+_*v,l*S-j*v-_*g,p,m),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(l)>Math.abs(j)+Math.abs(_)?(o.set(i+1,x-1,(-g-h*o.get(i,x-1)+_*o.get(i,x))/l),o.set(i+1,x,(-v-h*o.get(i,x)-_*o.get(i,x-1))/l)):(w=St(-A-f*o.get(i,x-1),-S-f*o.get(i,x),j,_),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),E*(d=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))))*d>1)for(s=i;s<=x;s++)o.set(s,x-1,o.get(s,x-1)/d),o.set(s,x,o.get(s,x)/d)}for(i=0;ib)for(s=i;s=0;s--)for(i=0;i<=b;i++){for(j=0,a=0;a<=Math.min(s,b);a++)j+=n.get(i,a)*o.get(a,s);n.set(i,s,j)}}}function St(t,e,r,n){var o,i;return Math.abs(r)>Math.abs(n)?[(t+(o=n/r)*e)/(i=r+o*n),(e-o*t)/i]:[((o=r/n)*t+e)/(i=n+o*r),(o*e-t)/i]}var jt=function(){function t(e){if(y(this,t),!(e=vt.checkMatrix(e)).isSymmetric())throw new Error("Matrix is not symmetric");var r,n,o,i=e,s=i.rows,a=new X(s,s),u=!0;for(n=0;n0),a.set(n,n,Math.sqrt(Math.max(c,0))),o=n+1;o=0;i--)for(o=0;o1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),e=vt.checkMatrix(e);var n,o=r.Y,i=r.scaleScores,s=void 0!==i&&i,a=r.maxIterations,u=void 0===a?1e3:a,c=r.terminationCriteria,d=void 0===c?1e-10:c;if(o){if((o=x.isAnyArray(o)&&"number"==typeof o[0]?X.columnVector(o):vt.checkMatrix(o)).rows!==e.rows)throw new Error("Y should have the same number of rows as X");n=o.getColumnVector(0)}else n=e.getColumnVector(0);for(var h,l,f,g,v=1,p=0;pd;p++)f=(f=e.transpose().mmul(n).div(n.transpose().mmul(n).get(0,0))).div(f.norm()),h=e.mmul(f).div(f.transpose().mmul(f).get(0,0)),p>0&&(v=h.clone().sub(g).pow(2).sum()),g=h.clone(),o?(l=(l=o.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0))).div(l.norm()),n=o.mmul(l).div(l.transpose().mmul(l).get(0,0))):n=h;if(o){var m=e.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0));m=m.div(m.norm());var w=e.clone().sub(h.clone().mmul(m.transpose())),b=n.transpose().mmul(h).div(h.transpose().mmul(h).get(0,0)),E=o.clone().sub(h.clone().mulS(b.get(0,0)).mmul(l.transpose()));this.t=h,this.p=m.transpose(),this.w=f.transpose(),this.q=l,this.u=n,this.s=h.transpose().mmul(h),this.xResidual=w,this.yResidual=E,this.betas=b}else this.w=f.transpose(),this.s=h.transpose().mmul(h).sqrt(),this.t=s?h.clone().div(this.s.get(0,0)):h,this.xResidual=e.sub(h.mmul(f.transpose()))}));e.XA=K,e.a_=jt,e.yQ=jt,e.Hs=nt,e.Ec=Nt,e.dx=Nt,e.LU=pt,e.Rm=pt,e.y3=X,e.qK=st,e.pb=it,e.j=at,e.sO=ut,e.BZ=dt,e.EK=ct,e.Db=ht,e.Fx=lt,e.tU=ft,e.Ym=Ot,e.rs=Ot,e.QR=yt,e.TB=yt,e.oH=wt,e.Sc=wt,e.BN=rt,e.it=gt,e.$r=vt,e.QM=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new X(t);var n=!1;if("object"!==m(e)||X.isMatrix(e)||x.isAnyArray(e)?e=new X(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r,i=o.center,s=void 0===i||i,a=o.scale,u=void 0===a||a;s&&(t.center("column"),n||e.center("column")),u&&(t.scale("column"),n||e.scale("column"));for(var c=t.standardDeviation("column",{unbiased:!0}),d=n?c:e.standardDeviation("column",{unbiased:!0}),h=t.transpose().mmul(e),l=0;l1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new X(t);var n=!1;if("object"!==m(e)||X.isMatrix(e)||x.isAnyArray(e)?e=new X(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r,i=o.center,s=void 0===i||i;s&&(t=t.center("column"),n||(e=e.center("column")));for(var a=t.transpose().mmul(e),u=0;u1&&void 0!==arguments[1]&&arguments[1];return t=vt.checkMatrix(t),e?new wt(t).inverse():xt(t,X.eye(t.rows))},e.uZ=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.thresholdValue,n=void 0===r?1e-9:r,o=e.thresholdError,i=void 0===o?1e-9:o,s=(t=X.checkMatrix(t)).rows,a=new X(s,s),u=0;u1&&void 0!==arguments[1]?arguments[1]:Number.EPSILON;if((t=X.checkMatrix(t)).isEmpty())return t.transpose();for(var r=new wt(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal,s=0;se?i[s]=1/i[s]:i[s]=0;return o.mmul(X.diag(i).mmul(n.transpose()))},e.F1=xt,e.re=function(t,e){if(x.isAnyArray(t))return t[0]&&x.isAnyArray(t[0])?new vt(t):new gt(t,e);throw new Error("the argument is not an array")}},92546:function(t,e,r){t.exports={graphlib:r(76626),layout:r(47194),debug:r(11303),util:{time:r(53063).time,notime:r(53063).notime},version:r(11897)}},81255:function(t,e,r){"use strict";var n=r(72361),o=r(39240);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};function i(s){n.has(o,s)||(o[s]=!0,r[s]=!0,n.forEach(t.outEdges(s),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[s])}return n.forEach(t.nodes(),i),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},60765:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r,n,i,s){var a={width:0,height:0,rank:s,borderType:e},u=i[e][s-1],c=o.addDummyNode(t,"border",a,r);i[e][s]=c,t.setParent(c,n),u&&t.setEdge(u,c,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),s=t.node(r);if(o.length&&n.forEach(o,e),n.has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var a=s.minRank,u=s.maxRank+1;a0;--u)if(n=e[u].dequeue()){o=o.concat(a(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(c,(function(e){return t.outEdges(e.v,e.w)})),!0)};var s=n.constant(1);function a(t,e,r,o,i){var s=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),a=t.node(n.v);i&&s.push({v:n.v,w:n.w}),a.out-=o,u(e,r,a)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,s=t.node(i);s.in-=o,u(e,r,s)})),t.removeNode(o.v),s}function u(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)}},47194:function(t,e,r){"use strict";var n=r(72361),o=r(81255),i=r(27163),s=r(64505),a=r(53063).normalizeRanks,u=r(71970),c=r(53063).removeEmptyRanks,d=r(31733),h=r(60765),l=r(13257),f=r(62852),g=r(93021),v=r(53063),p=r(76626).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?v.time:v.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new p({multigraph:!0,compound:!0}),r=_(t.graph());return e.setGraph(n.merge({},y,k(r,m),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=_(t.node(r));e.setNode(r,n.defaults(k(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=_(t.edge(r));e.setEdge(r,n.merge({},N,k(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){d.run(t)})),e(" rank",(function(){s(v.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};v.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){c(t)})),e(" nestingGraph.cleanup",(function(){d.cleanup(t)})),e(" normalizeRanks",(function(){a(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){h(t)})),e(" order",(function(){f(t)})),e(" insertSelfEdges",(function(){!function(t){var e=v.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){v.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){l.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,s=r.x-o,a=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*s/3,y:i-a},{x:o+5*s/6,y:i-a},{x:o+s,y:i},{x:o+5*s/6,y:i+a},{x:o+2*s/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),s=t.node(n.last(r.borderLeft)),a=t.node(n.last(r.borderRight));r.width=Math.abs(a.x-s.x),r.height=Math.abs(i.y-o.y),r.x=s.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){l.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,s=t.graph(),a=s.marginx||0,u=s.marginy||0;function c(t){var n=t.x,s=t.y,a=t.width,u=t.height;e=Math.min(e,n-a/2),r=Math.max(r,n+a/2),o=Math.min(o,s-u/2),i=Math.max(i,s+u/2)}n.forEach(t.nodes(),(function(e){c(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&c(r)})),e-=a,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),s.width=r-e+a,s.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),s=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=s,n=i),o.points.unshift(v.intersectRect(i,r)),o.points.push(v.intersectRect(s,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function k(t,e){return n.mapValues(n.pick(t,e),Number)}function _(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},72361:function(t,e,r){var n;try{n={cloneDeep:r(20250),constant:r(13503),defaults:r(28548),each:r(76934),filter:r(64725),find:r(87362),flatten:r(40151),forEach:r(11105),forIn:r(23190),has:r(99946),isUndefined:r(16513),last:r(10611),map:r(9924),mapValues:r(70642),max:r(95987),merge:r(28440),min:r(73376),minBy:r(83296),now:r(5795),pick:r(89409),range:r(60859),reduce:r(16473),sortBy:r(351),uniqueId:r(95708),values:r(81229),zipObject:r(65441)}}catch(t){}n||(n=window._),t.exports=n},31733:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r,s,a,u,c){var d=t.children(c);if(d.length){var h=o.addBorderNode(t,"_bt"),l=o.addBorderNode(t,"_bb"),f=t.node(c);t.setParent(h,c),f.borderTop=h,t.setParent(l,c),f.borderBottom=l,n.forEach(d,(function(n){i(t,e,r,s,a,u,n);var o=t.node(n),d=o.borderTop?o.borderTop:n,f=o.borderBottom?o.borderBottom:n,g=o.borderTop?s:2*s,v=d!==f?1:a-u[c]+1;t.setEdge(h,d,{weight:g,minlen:v,nestingEdge:!0}),t.setEdge(f,l,{weight:g,minlen:v,nestingEdge:!0})})),t.parent(c)||t.setEdge(e,h,{weight:0,minlen:a+u[c]})}else c!==e&&t.setEdge(e,c,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var s=t.children(o);s&&s.length&&n.forEach(s,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),s=n.max(n.values(r))-1,a=2*s+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=a}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,a,u,s,r,n)})),t.graph().nodeRankFactor=a},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},27163:function(t,e,r){"use strict";var n=r(72361),o=r(53063);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,s=e.v,a=t.node(s).rank,u=e.w,c=t.node(u).rank,d=e.name,h=t.edge(e),l=h.labelRank;if(c===a+1)return;for(t.removeEdge(e),i=0,++a;a0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*r}))),c}t.exports=function(t,e){for(var r=0,n=1;n=2),a=d.buildLayerMatrix(t);var p=i(t,a);p=t.barycenter)&&function(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight);e.weight&&(r+=e.barycenter*e.weight,n+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},86490:function(t,e,r){var n=r(72361),o=r(99506),i=r(45926),s=r(1349);t.exports=function t(e,r,a,u){var c=e.children(r),d=e.node(r),h=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,f={};h&&(c=n.filter(c,(function(t){return t!==h&&t!==l})));var g=o(e,c);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,a,u);f[r.v]=o,n.has(o,"barycenter")&&(i=r,s=o,n.isUndefined(i.barycenter)?(i.barycenter=s.barycenter,i.weight=s.weight):(i.barycenter=(i.barycenter*i.weight+s.barycenter*s.weight)/(i.weight+s.weight),i.weight+=s.weight))}var i,s}));var v=i(g,a);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(v,f);var p=s(v,u);if(h&&(p.vs=n.flatten([h,p.vs,l],!0),e.predecessors(h).length)){var m=e.node(e.predecessors(h)[0]),y=e.node(e.predecessors(l)[0]);n.has(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+m.order+y.order)/(p.weight+2),p.weight+=2}return p}},1349:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r=o.partition(t,(function(t){return n.has(t,"barycenter")})),s=r.lhs,a=n.sortBy(r.rhs,(function(t){return-t.i})),u=[],c=0,d=0,h=0;s.sort((l=!!e,function(t,e){return t.barycentere.barycenter?1:l?e.i-t.i:t.i-e.i})),h=i(u,a,h),n.forEach(s,(function(t){h+=t.vs.length,u.push(t.vs),c+=t.barycenter*t.weight,d+=t.weight,h=i(u,a,h)}));var l;var f={vs:n.flatten(u,!0)};d&&(f.barycenter=c/d,f.weight=d);return f}},71970:function(t,e,r){var n=r(72361);t.exports=function(t){var e=function(t){var e={},r=0;function o(i){var s=r;n.forEach(t.children(i),o),e[i]={low:s,lim:r++}}return n.forEach(t.children(),o),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,s=[],a=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),s.push(o)}while(o&&(e[o].low>u||c>e[o].lim));i=o,o=n;for(;(o=t.parent(o))!==i;)a.push(o);return{path:s.concat(a.reverse()),lca:i}}(t,e,o.v,o.w),s=i.path,a=i.lca,u=0,c=s[u],d=!0;r!==o.w;){if(n=t.node(r),d){for(;(c=s[u])!==a&&t.node(c).maxRanka)&&u(r,e,c)}))}))}return n.reduce(e,(function(e,r){var i,s=-1,a=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var c=t.predecessors(n);c.length&&(i=t.node(c[0]).order,o(r,a,u,s,i),a=u,s=i)}o(r,a,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function c(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function d(t,e,r,o){var i={},s={},a={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,s[t]=t,a[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return a[t]}));for(var d=(u.length-1)/2,h=Math.floor(d),l=Math.ceil(d);h<=l;++h){var f=u[h];s[t]===t&&eu.lim&&(c=u,d=!0);var h=n.filter(e.edges(),(function(e){return d===y(t,t.node(e.v),c)&&d!==y(t,t.node(e.w),c)}));return n.minBy(h,(function(t){return i(e,t)}))}function m(t,e,r,o){var i=r.v,s=r.w;t.removeEdge(i,s),t.setEdge(o.v,o.w,{}),f(t),h(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=a(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function y(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=d,d.initLowLimValues=f,d.initCutValues=h,d.calcCutValue=l,d.leaveEdge=v,d.enterEdge=p,d.exchangeEdges=m},2416:function(t,e,r){"use strict";var n=r(72361);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var s=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return s!==Number.POSITIVE_INFINITY&&null!=s||(s=0),i.rank=s}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},53063:function(t,e,r){"use strict";var n=r(72361),o=r(76626).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function s(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,s=e.x-o,a=e.y-i,u=t.width/2,c=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(a)*u>Math.abs(s)*c?(a<0&&(c=-c),r=c*s/a,n=c):(s<0&&(u=-u),r=u,n=u*a/s);return{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(s(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};arguments.length>=4&&(o.rank=r,o.order=n);return i(t,"border",o,e)},maxRank:s,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},11897:function(t){t.exports="0.8.5"},75172:function(t,e,r){var n=r(89224);t.exports={Graph:n.Graph,json:r(17401),alg:r(54613),version:n.version}},91606:function(t,e,r){var n=r(95329);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},21482:function(t,e,r){var n=r(95329);function o(t,e,r,i,s,a){n.has(i,e)||(i[e]=!0,r||a.push(e),n.each(s(e),(function(e){o(t,e,r,i,s,a)})),r&&a.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],a={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,a,i,s)})),s}},40845:function(t,e,r){var n=r(13746),o=r(95329);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},13746:function(t,e,r){var n=r(95329),o=r(36614);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,s,a={},u=new o,c=function(t){var e=t.v!==i?t.v:t.w,n=a[e],o=r(t),c=s.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);c0&&(i=u.removeMin(),(s=a[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(c);return a}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},59324:function(t,e,r){var n=r(95329),o=r(94558);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},17600:function(t,e,r){var n=r(95329);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],s=i[r],a=n.distance+o.distance;a0;){if(r=u.removeMin(),n.has(a,r))s.setEdge(r,a[r]);else{if(d)throw new Error("Input graph is not connected: "+t);d=!0}t.nodeEdges(r).forEach(c)}return s}},94558:function(t,e,r){var n=r(95329);t.exports=function(t){var e=0,r=[],o={},i=[];function s(a){var u=o[a]={onStack:!0,lowlink:e,index:e++};if(r.push(a),t.successors(a).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(s(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var c,d=[];do{c=r.pop(),o[c].onStack=!1,d.push(c)}while(a!==c);i.push(d)}}return t.nodes().forEach((function(t){n.has(o,t)||s(t)})),i}},7793:function(t,e,r){var n=r(95329);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function s(a){if(n.has(r,a))throw new i;n.has(e,a)||(r[a]=!0,e[a]=!0,n.each(t.predecessors(a),s),delete r[a],o.push(a))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},36614:function(t,e,r){var n=r(95329);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r>1].prioritys){var a=i;i=s,s=a}return i+""+s+""+(n.isUndefined(o)?"\0":o)}function c(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var s=o;o=i,i=s}var a={v:o,w:i};return n&&(a.name=n),a}function d(t,e){return u(t,e.v,e.w,e.name)}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},i.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},i.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},i.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=o,this._children[t]={},this._children[o][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return n.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=o;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==o)return e}},i.prototype.children=function(t){if(n.isUndefined(t)&&(t=o),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===o)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},i.prototype.setEdge=function(){var t,e,r,o,i=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(t=a.v,e=a.w,r=a.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=a,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var d=u(this._isDirected,t,e,r);if(n.has(this._edgeLabels,d))return i&&(this._edgeLabels[d]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[d]=i?o:this._defaultEdgeLabelFn(t,e,r);var h=c(this._isDirected,t,e,r);return t=h.v,e=h.w,Object.freeze(h),this._edgeObjs[d]=h,s(this._preds[e],t),s(this._sucs[t],e),this._in[e][d]=h,this._out[t][d]=h,this._edgeCount++,this},i.prototype.edge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},i.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?d(this._isDirected,arguments[0]):u(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},i.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},i.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},89224:function(t,e,r){t.exports={Graph:r(6349),version:r(16544)}},17401:function(t,e,r){var n=r(95329),o=r(6349);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function s(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:s(t)};n.isUndefined(t.graph())||(e.value=n.clone(t.graph()));return e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},95329:function(t,e,r){var n;try{n={clone:r(76833),constant:r(13503),each:r(76934),filter:r(64725),has:r(99946),isArray:r(80744),isEmpty:r(61627),isFunction:r(9363),isUndefined:r(16513),keys:r(55451),map:r(9924),reduce:r(16473),size:r(40617),transform:r(91116),union:r(44065),values:r(81229)}}catch(t){}n||(n=window._),t.exports=n},16544:function(t){t.exports="2.1.8"},34634:function(t,e,r){"use strict";r.r(e),r.d(e,{isAnyArray:function(){return o}});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},15584:function(t,e,r){var n=r(73893)(r(33152),"DataView");t.exports=n},97288:function(t,e,r){var n=r(73893)(r(33152),"Promise");t.exports=n},23599:function(t,e,r){var n=r(73893)(r(33152),"Set");t.exports=n},98924:function(t,e,r){var n=r(52166),o=r(34776),i=r(40393);function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e-1}},94874:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n0&&i(d)?r>1?t(d,r-1,i,s,a):n(a,d):s||(a[a.length]=d)}return a}},1585:function(t,e,r){var n=r(14018),o=r(55451);t.exports=function(t,e){return t&&n(t,e,o)}},89147:function(t,e,r){var n=r(1186),o=r(9171);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&re}},3251:function(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},62348:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},17424:function(t,e,r){var n=r(51533),o=r(8373),i=r(49237);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},77295:function(t,e,r){var n=r(84412),o=r(93913);t.exports=function t(e,r,i,s,a){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,s,t,a))}},84412:function(t,e,r){var n=r(91866),o=r(50401),i=r(57710),s=r(4983),a=r(66139),u=r(80744),c=r(57835),d=r(18397),h="[object Arguments]",l="[object Array]",f="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,v,p,m){var y=u(t),w=u(e),x=y?l:a(t),b=w?l:a(e),E=(x=x==h?f:x)==f,N=(b=b==h?f:b)==f,M=x==b;if(M&&c(t)){if(!c(e))return!1;y=!0,E=!1}if(M&&!E)return m||(m=new n),y||d(t)?o(t,e,r,v,p,m):i(t,e,x,r,v,p,m);if(!(1&r)){var k=E&&g.call(t,"__wrapped__"),_=N&&g.call(e,"__wrapped__");if(k||_){var A=k?t.value():t,S=_?e.value():e;return m||(m=new n),p(A,S,r,v,m)}}return!!M&&(m||(m=new n),s(t,e,r,v,p,m))}},55005:function(t,e,r){var n=r(66139),o=r(93913);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},51524:function(t,e,r){var n=r(91866),o=r(77295);t.exports=function(t,e,r,i){var s=r.length,a=s,u=!i;if(null==t)return!a;for(t=Object(t);s--;){var c=r[s];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++s=200){var v=e?null:a(t);if(v)return u(v);l=!1,d=s,g=new n}else g=e?[]:f;t:for(;++ce||s&&a&&c&&!u&&!d||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!d&&t=u?c:c*("desc"==r[o]?-1:1)}return t.index-e.index}},15168:function(t,e,r){var n=r(95378),o=r(58966);t.exports=function(t,e){return n(t,o(t),e)}},71678:function(t,e,r){var n=r(95378),o=r(66817);t.exports=function(t,e){return n(t,o(t),e)}},49164:function(t,e,r){var n=r(24665);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,s=e?i:-1,a=Object(r);(e?s--:++s-1?a[u?e[c]:c]:void 0}}},76106:function(t,e,r){var n=r(36121),o=r(8138),i=r(97341);t.exports=function(t){return function(e,r,s){return s&&"number"!=typeof s&&o(e,r,s)&&(r=s=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),s=void 0===s?ed))return!1;var l=u.get(t),f=u.get(e);if(l&&f)return l==e&&f==t;var g=-1,v=!0,p=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g2?e[2]:void 0;for(c&&i(e[0],e[1],c)&&(n=1);++r1&&s(t,e[0],e[1])?e=[]:r>2&&s(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=a},4134:function(t){t.exports=function(){return[]}},97341:function(t,e,r){var n=r(59406),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},12824:function(t,e,r){var n=r(97341);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},59406:function(t,e,r){var n=r(13927),o=r(20816),i=r(45029),s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=a.test(t);return r||u.test(t)?c(t.slice(2),r?2:8):s.test(t)?NaN:+t}},44140:function(t,e,r){var n=r(50230);t.exports=function(t){return null==t?"":n(t)}},91116:function(t,e,r){var n=r(74809),o=r(35024),i=r(1585),s=r(95979),a=r(49217),u=r(80744),c=r(57835),d=r(9363),h=r(20816),l=r(18397);t.exports=function(t,e,r){var f=u(t),g=f||c(t)||l(t);if(e=s(e,4),null==r){var v=t&&t.constructor;r=g?f?new v:[]:h(t)&&d(v)?o(a(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},44065:function(t,e,r){var n=r(9256),o=r(92918),i=r(29098),s=r(41590),a=o((function(t){return i(n(t,1,s,!0))}));t.exports=a},95708:function(t,e,r){var n=r(44140),o=0;t.exports=function(t){var e=++o;return n(t)+e}},81229:function(t,e,r){var n=r(20720),o=r(55451);t.exports=function(t){return null==t?[]:n(t,o(t))}},65441:function(t,e,r){var n=r(60348),o=r(94484);t.exports=function(t,e){return o(t||[],e||[],n)}},34402:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return s}});var n=r(34634);function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(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,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;ua&&(a=t[u]);return a}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(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,o=void 0===r?0:r,i=e.toIndex,s=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=o||s>t.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[o],u=o+1;u1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(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(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var s=i(t),a=o(t);if(s===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var u=r.min,c=void 0===u?r.autoMinMax?s:0:u,d=r.max,h=void 0===d?r.autoMinMax?a:1:d;if(c>=h)throw new RangeError("min option must be smaller than max option");for(var l=(h-c)/(a-s),f=0;f=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function s(t,e){for(var r,n=0,o=t.length;n0)for(var r,n,o=new Array(r),i=0;i=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u,i=m,!(m=m[v=g<<2|f<<1|l]))return i[v]=y,t;if(c=+t._x.call(null,m.data),d=+t._y.call(null,m.data),h=+t._z.call(null,m.data),e===c&&r===d&&n===h)return y.next=m,i?i[v]=y:t._root=y,t;do{i=i?i[v]=new Array(8):t._root=new Array(8),(l=e>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(x+N)/2))?x=a:N=a,(g=n>=(u=(b+M)/2))?b=u:M=u}while((v=g<<2|f<<1|l)==(p=(h>=u)<<2|(d>=a)<<1|c>=s));return i[p]=m,i[v]=y,t}function o(t,e,r,n,o,i,s){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=s}function i(t){return t[0]}function s(t){return t[1]}function a(t){return t[2]}function u(t,e,r,n){var o=new c(null==e?i:e,null==r?s:r,null==n?a:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function c(t,e,r,n,o,i,s,a,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=s,this._y1=a,this._z1=u,this._root=void 0}function d(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}r.d(e,{Z:function(){return u}});var h=u.prototype=c.prototype;h.copy=function(){var t,e,r=new c(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=d(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]=d(e));return r},h.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),o=+this._z.call(null,t);return n(this.cover(e,r,o),e,r,o,t)},h.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),o=new Float64Array(e),i=new Float64Array(e);let s=1/0,a=1/0,u=1/0,c=-1/0,d=-1/0,h=-1/0;for(let n,l,f,g,v=0;vc&&(c=l),fd&&(d=f),gh&&(h=g));if(s>c||a>d||u>h)return this;this.cover(s,a,u).cover(c,d,h);for(let s=0;st||t>=s||o>e||e>=a||i>r||r>=u;)switch(d=(rm||(a=l.y0)>y||(u=l.z0)>w||(c=l.x1)=M)<<2|(e>=N)<<1|t>=E)&&(l=x[x.length-1],x[x.length-1]=x[x.length-1-f],x[x.length-1-f]=l)}else{var k=t-+this._x.call(null,b.data),_=e-+this._y.call(null,b.data),A=r-+this._z.call(null,b.data),S=k*k+_*_+A*A;if(S=(u=(m+x)/2))?m=u:x=u,(l=s>=(c=(y+b)/2))?y=c:b=c,(f=a>=(d=(w+E)/2))?w=d:E=d,e=p,!(p=p[g=f<<2|l<<1|h]))return this;if(!p.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,v=g)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(o=p.next)&&delete p.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(p=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&p===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[v]=p:this._root=p),this):(this._root=o,this)},h.removeAll=function(t){for(var e=0,r=t.length;e=(i=(v+m)/2))?v=i:m=i,(d=r>=(s=(p+y)/2))?p=s:y=s,o=f,!(f=f[h=d<<1|c]))return o[h]=g,t;if(a=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===a&&r===u)return g.next=f,o?o[h]=g:t._root=g,t;do{o=o?o[h]=new Array(4):t._root=new Array(4),(c=e>=(i=(v+m)/2))?v=i:m=i,(d=r>=(s=(p+y)/2))?p=s:y=s}while((h=d<<1|c)==(l=(u>=s)<<1|a>=i));return o[l]=f,o[h]=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 i(t){return t[0]}function s(t){return t[1]}function a(t,e,r){var n=new u(null==e?i:e,null==r?s:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function u(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 c(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}r.d(e,{Z:function(){return a}});var d=a.prototype=u.prototype;d.copy=function(){var t,e,r=new u(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=c(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]=c(e));return r},d.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return n(this.cover(e,r),e,r,t)},d.addAll=function(t){var e,r,o,i,s=t.length,a=new Array(s),u=new Array(s),c=1/0,d=1/0,h=-1/0,l=-1/0;for(r=0;rh&&(h=o),il&&(l=i));if(c>h||d>l)return this;for(this.cover(c,d).cover(h,l),r=0;rt||t>=o||n>e||e>=i;)switch(a=(ef||(s=c.y0)>g||(a=c.x1)=y)<<1|t>=m)&&(c=v[v.length-1],v[v.length-1]=v[v.length-1-d],v[v.length-1-d]=c)}else{var w=t-+this._x.call(null,p.data),x=e-+this._y.call(null,p.data),b=w*w+x*x;if(b=(a=(g+p)/2))?g=a:p=a,(d=s>=(u=(v+m)/2))?v=u:m=u,e=f,!(f=f[h=d<<1|c]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,l=h)}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[h]=o:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(r?r[l]=f:this._root=f),this):(this._root=o,this)},d.removeAll=function(t){for(var e=0,r=t.length;e=0&&e._call.call(void 0,t),e=e._next;--i}()}finally{i=0,function(){var t,e,r=n,i=1/0;for(;r;)r._call?(i>r._time&&(i=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:n=e);o=t,w(i)}(),c=0}}function y(){var t=h.now(),e=t-u;e>1e3&&(d-=e,u=t)}function w(t){i||(s&&(s=clearTimeout(s)),t-c>24?(t<1/0&&(s=setTimeout(m,t-h.now()-d)),a&&(a=clearInterval(a))):(a||(u=h.now(),a=setInterval(y,1e3)),i=1,l(m)))}v.prototype=p.prototype={constructor:v,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?f():+r)+(null==e?0:+e),this._next||o===this||(o?o._next=this:n=this,o=this),this._call=t,this._time=r,w()},stop:function(){this._call&&(this._call=null,this._time=1/0,w())}}}}]);