fastadmin 0.2.19__py3-none-any.whl → 0.2.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ var iN=Object.defineProperty,sN=Object.defineProperties;var oN=Object.getOwnPropertyDescriptors;var q0=Object.getOwnPropertySymbols;var aN=Object.prototype.hasOwnProperty,uN=Object.prototype.propertyIsEnumerable;var R0=Se=>{throw TypeError(Se)},Ot=Math.pow,Oc=(Se,se,Re)=>se in Se?iN(Se,se,{enumerable:!0,configurable:!0,writable:!0,value:Re}):Se[se]=Re,ir=(Se,se)=>{for(var Re in se||(se={}))aN.call(se,Re)&&Oc(Se,Re,se[Re]);if(q0)for(var Re of q0(se))uN.call(se,Re)&&Oc(Se,Re,se[Re]);return Se},Ac=(Se,se)=>sN(Se,oN(se));var Te=(Se,se,Re)=>Oc(Se,typeof se!="symbol"?se+"":se,Re),Ic=(Se,se,Re)=>se.has(Se)||R0("Cannot "+Re);var gt=(Se,se,Re)=>(Ic(Se,se,"read from private field"),Re?Re.call(Se):se.get(Se)),Tc=(Se,se,Re)=>se.has(Se)?R0("Cannot add the same private member more than once"):se instanceof WeakSet?se.add(Se):se.set(Se,Re),hn=(Se,se,Re,Er)=>(Ic(Se,se,"write to private field"),Er?Er.call(Se,Re):se.set(Se,Re),Re),kc=(Se,se,Re)=>(Ic(Se,se,"access private method"),Re);(function(){"use strict";function Se(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(t[n[i]]=e[n[i]]);return t}function se(e,r,t,n){function i(s){return s instanceof t?s:new t(function(a){a(s)})}return new(t||(t=Promise))(function(s,a){function o(l){try{f(n.next(l))}catch(p){a(p)}}function c(l){try{f(n.throw(l))}catch(p){a(p)}}function f(l){l.done?s(l.value):i(l.value).then(o,c)}f((n=n.apply(e,r||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var Re="*",Er=function(){function e(){this._events={}}return e.prototype.on=function(r,t,n){return this._events[r]||(this._events[r]=[]),this._events[r].push({callback:t,once:!!n}),this},e.prototype.once=function(r,t){return this.on(r,t,!0)},e.prototype.emit=function(r){for(var t=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=this._events[r]||[],a=this._events[Re]||[],o=function(c){for(var f=c.length,l=0;l<f;l++)if(c[l]){var p=c[l],m=p.callback,y=p.once;y&&(c.splice(l,1),c.length===0&&delete t._events[r],f--,l--),m.apply(t,n)}};o(s),o(a)},e.prototype.off=function(r,t){if(!r)this._events={};else if(!t)delete this._events[r];else{for(var n=this._events[r]||[],i=n.length,s=0;s<i;s++)n[s].callback===t&&(n.splice(s,1),i--,s--);n.length===0&&delete this._events[r]}return this},e.prototype.getEvents=function(){return this._events},e}();function dn(e,r,t,n){for(;e.length;){const i=e.shift();if(t(i))return!0;r.add(i.id),n(i.id).forEach(a=>{r.has(a.id)||(r.add(a.id),e.push(a))})}return!1}function xr(e,r,t,n){if(t(e))return!0;r.add(e.id);for(const s of n(e.id))if(!r.has(s.id)&&xr(s,r,t,n))return!0;return!1}const Cc=()=>!0;class O0{constructor(r){Te(this,"graph");Te(this,"nodeFilter");Te(this,"edgeFilter");Te(this,"cacheEnabled");Te(this,"inEdgesMap",new Map);Te(this,"outEdgesMap",new Map);Te(this,"bothEdgesMap",new Map);Te(this,"allNodesMap",new Map);Te(this,"allEdgesMap",new Map);Te(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});Te(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(r=>r.id))});Te(this,"updateCache",r=>{const t=new Set;r.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(s=>t.add(s.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const s=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),a=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...s,...a]));o.forEach(c=>t.add(c.id)),this.inEdgesMap.set(n,s),this.outEdgesMap.set(n,a),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),t.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});Te(this,"handleGraphChanged",r=>{const t=new Set;r.changes.forEach(n=>{switch(n.type){case"NodeAdded":t.add(n.value.id);break;case"NodeDataUpdated":t.add(n.id);break;case"EdgeAdded":t.add(n.value.source),t.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(t.add(n.oldValue),t.add(n.newValue));break;case"EdgeDataUpdated":if(r.graph.hasEdge(n.id)){const i=r.graph.getEdge(n.id);t.add(i.source),t.add(i.target)}break;case"EdgeRemoved":t.add(n.value.source),t.add(n.value.target);break;case"NodeRemoved":t.add(n.value.id);break}}),this.updateCache(t)});this.graph=r.graph;const t=r.nodeFilter||Cc,n=r.edgeFilter||Cc;this.nodeFilter=t,this.edgeFilter=i=>{const{source:s,target:a}=this.graph.getEdgeDetail(i.id);return!t(s)||!t(a)?!1:n(i,s,a)},r.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):r.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(r){this.getNode(r)}hasNode(r){if(!this.graph.hasNode(r))return!1;const t=this.graph.getNode(r);return this.nodeFilter(t)}areNeighbors(r,t){return this.checkNodeExistence(r),this.getNeighbors(t).some(n=>n.id===r)}getNode(r){const t=this.graph.getNode(r);if(!this.nodeFilter(t))throw new Error("Node not found for id: "+r);return t}getRelatedEdges(r,t){return this.checkNodeExistence(r),this.cacheEnabled?t==="in"?this.inEdgesMap.get(r):t==="out"?this.outEdgesMap.get(r):this.bothEdgesMap.get(r):this.graph.getRelatedEdges(r,t).filter(this.edgeFilter)}getDegree(r,t){return this.getRelatedEdges(r,t).length}getSuccessors(r){const n=this.getRelatedEdges(r,"out").map(i=>this.getNode(i.target));return Array.from(new Set(n))}getPredecessors(r){const n=this.getRelatedEdges(r,"in").map(i=>this.getNode(i.source));return Array.from(new Set(n))}getNeighbors(r){const t=this.getPredecessors(r),n=this.getSuccessors(r);return Array.from(new Set([...t,...n]))}hasEdge(r){if(!this.graph.hasEdge(r))return!1;const t=this.graph.getEdge(r);return this.edgeFilter(t)}getEdge(r){const t=this.graph.getEdge(r);if(!this.edgeFilter(t))throw new Error("Edge not found for id: "+r);return t}getEdgeDetail(r){const t=this.getEdge(r);return{edge:t,source:this.getNode(t.source),target:this.getNode(t.target)}}hasTreeStructure(r){return this.graph.hasTreeStructure(r)}getRoots(r){return this.graph.getRoots(r).filter(this.nodeFilter)}getChildren(r,t){return this.checkNodeExistence(r),this.graph.getChildren(r,t).filter(this.nodeFilter)}getParent(r,t){this.checkNodeExistence(r);const n=this.graph.getParent(r,t);return!n||!this.nodeFilter(n)?null:n}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(r,t,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];dn([this.getNode(r)],new Set,t,i)}dfs(r,t,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];xr(this.getNode(r),new Set,t,i)}}class Be extends Er{constructor(t){super();Te(this,"nodeMap",new Map);Te(this,"edgeMap",new Map);Te(this,"inEdgesMap",new Map);Te(this,"outEdgesMap",new Map);Te(this,"bothEdgesMap",new Map);Te(this,"treeIndices",new Map);Te(this,"changes",[]);Te(this,"batchCount",0);Te(this,"onChanged",()=>{});Te(this,"batch",t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()});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))}commit(){const t=this.changes;this.changes=[];const n={graph:this,changes:t};this.emit("changed",n),this.onChanged(n)}reduceChanges(t){let n=[];return t.forEach(i=>{switch(i.type){case"NodeRemoved":{let s=!1;n=n.filter(a=>{if(a.type==="NodeAdded"){const o=a.value.id===i.value.id;return o&&(s=!0),!o}else{if(a.type==="NodeDataUpdated")return a.id!==i.value.id;if(a.type==="TreeStructureChanged")return a.nodeId!==i.value.id}return!0}),s||n.push(i);break}case"EdgeRemoved":{let s=!1;n=n.filter(a=>{if(a.type==="EdgeAdded"){const o=a.value.id===i.value.id;return o&&(s=!0),!o}else if(a.type==="EdgeDataUpdated"||a.type==="EdgeUpdated")return a.id!==i.value.id;return!0}),s||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const s=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),a=n[s];a?i.propertyName!==void 0?a.newValue=i.newValue:(n.splice(s,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(s=>s.type==="TreeStructureAttached"||s.type==="TreeStructureChanged"?s.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const s=n.find(a=>a.type==="TreeStructureChanged"&&a.treeKey===i.treeKey&&a.nodeId===i.nodeId);s?s.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,n){return this.getNeighbors(n).some(i=>i.id===t)}getNode(t){const n=this.nodeMap.get(t);if(!n)throw new Error("Node not found for id: "+t);return n}getRelatedEdges(t,n){if(this.checkNodeExistence(t),n==="in"){const i=this.inEdgesMap.get(t);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(t);return Array.from(i)}else{const i=this.bothEdgesMap.get(t);return Array.from(i)}}getDegree(t,n){return this.getRelatedEdges(t,n).length}getSuccessors(t){const i=this.getRelatedEdges(t,"out").map(s=>this.getNode(s.target));return Array.from(new Set(i))}getPredecessors(t){const i=this.getRelatedEdges(t,"in").map(s=>this.getNode(s.source));return Array.from(new Set(i))}getNeighbors(t){const n=this.getPredecessors(t),i=this.getSuccessors(t);return Array.from(new Set([...n,...i]))}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(n=>{n.childrenMap.set(t.id,new Set)}),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch(()=>{for(const n of t)this.doAddNode(n)})}addNode(t){this.addNodes([t])}doRemoveNode(t){const n=this.getNode(t),i=this.bothEdgesMap.get(t);i==null||i.forEach(s=>this.doRemoveEdge(s.id)),this.nodeMap.delete(t),this.treeIndices.forEach(s=>{var o,c;(o=s.childrenMap.get(t))==null||o.forEach(f=>{s.parentMap.delete(f.id)});const a=s.parentMap.get(t);a&&((c=s.childrenMap.get(a.id))==null||c.delete(n)),s.parentMap.delete(t),s.childrenMap.delete(t)}),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(t){this.batch(()=>{t.forEach(n=>this.doRemoveNode(n))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,n,i){const s=this.getNode(t);this.batch(()=>{const a=s.data[n],o=i;s.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:n,oldValue:a,newValue:o})})}mergeNodeData(t,n){this.batch(()=>{Object.entries(n).forEach(([i,s])=>{this.updateNodeDataProperty(t,i,s)})})}updateNodeData(...t){const n=t[0],i=this.getNode(n);if(typeof t[1]=="string"){this.updateNodeDataProperty(n,t[1],t[2]);return}let s;if(typeof t[1]=="function"){const a=t[1];s=a(i.data)}else typeof t[1]=="object"&&(s=t[1]);this.batch(()=>{const a=i.data,o=s;i.data=s,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:a,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 n=this.getEdge(t);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.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 n=this.inEdgesMap.get(t.target),i=this.outEdgesMap.get(t.source),s=this.bothEdgesMap.get(t.source),a=this.bothEdgesMap.get(t.target);n.add(t),i.add(t),s.add(t),a.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch(()=>{for(const n of t)this.doAddEdge(n)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const n=this.getEdge(t),i=this.outEdgesMap.get(n.source),s=this.inEdgesMap.get(n.target),a=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),s.delete(n),a.delete(n),o.delete(n),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(t){this.batch(()=>{t.forEach(n=>this.doRemoveEdge(n))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,n){const i=this.getEdge(t);this.checkNodeExistence(n);const s=i.source,a=n;this.outEdgesMap.get(s).delete(i),this.bothEdgesMap.get(s).delete(i),this.outEdgesMap.get(a).add(i),this.bothEdgesMap.get(a).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:s,newValue:a})})}updateEdgeTarget(t,n){const i=this.getEdge(t);this.checkNodeExistence(n);const s=i.target,a=n;this.inEdgesMap.get(s).delete(i),this.bothEdgesMap.get(s).delete(i),this.inEdgesMap.get(a).add(i),this.bothEdgesMap.get(a).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:s,newValue:a})})}updateEdgeDataProperty(t,n,i){const s=this.getEdge(t);this.batch(()=>{const a=s.data[n],o=i;s.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:n,oldValue:a,newValue:o})})}updateEdgeData(...t){const n=t[0],i=this.getEdge(n);if(typeof t[1]=="string"){this.updateEdgeDataProperty(n,t[1],t[2]);return}let s;if(typeof t[1]=="function"){const a=t[1];s=a(i.data)}else typeof t[1]=="object"&&(s=t[1]);this.batch(()=>{const a=i.data,o=s;i.data=s,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:a,newValue:o})})}mergeEdgeData(t,n){this.batch(()=>{Object.entries(n).forEach(([i,s])=>{this.updateEdgeDataProperty(t,i,s)})})}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,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],s=Array.isArray(t)?t:[t];for(;s.length;){const a=s.shift();i.push(a),a.children&&s.push(...a.children)}this.addNodes(i),i.forEach(a=>{var o;(o=a.children)==null||o.forEach(c=>{this.setParent(c.id,a.id,n)})})})}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter(n=>!this.getParent(n.id,t))}getChildren(t,n){this.checkNodeExistence(t),this.checkTreeExistence(n);const s=this.treeIndices.get(n).childrenMap.get(t);return Array.from(s||[])}getParent(t,n){return this.checkNodeExistence(t),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(t)||null}getAncestors(t,n){const i=[];let s=this.getNode(t),a;for(;a=this.getParent(s.id,n);)i.push(a),s=a;return i}setParent(t,n,i){var l,p;this.checkTreeExistence(i);const s=this.treeIndices.get(i);if(!s)return;const a=this.getNode(t),o=s.parentMap.get(t);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((l=s.childrenMap.get(o.id))==null||l.delete(a)),s.parentMap.delete(t);return}const c=this.getNode(n);s.parentMap.set(t,c),o&&((p=s.childrenMap.get(o.id))==null||p.delete(a));let f=s.childrenMap.get(c.id);f||(f=new Set,s.childrenMap.set(c.id,f)),f.add(a),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:t,oldParentId:o==null?void 0:o.id,newParentId:c.id})})}dfsTree(t,n,i){const s=a=>this.getChildren(a,i);return xr(this.getNode(t),new Set,n,s)}bfsTree(t,n,i){const s=a=>this.getChildren(a,i);return dn([this.getNode(t)],new Set,n,s)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,n,i="out"){const s={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return dn([this.getNode(t)],new Set,n,s)}dfs(t,n,i="out"){const s={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return xr(this.getNode(t),new Set,n,s)}clone(){const t=this.getAllNodes().map(s=>Ac(ir({},s),{data:ir({},s.data)})),n=this.getAllEdges().map(s=>Ac(ir({},s),{data:ir({},s.data)})),i=new Be({nodes:t,edges:n});return this.treeIndices.forEach(({parentMap:s,childrenMap:a},o)=>{const c=new Map;s.forEach((l,p)=>{c.set(p,i.getNode(l.id))});const f=new Map;a.forEach((l,p)=>{f.set(p,new Set(Array.from(l).map(m=>i.getNode(m.id))))}),i.treeIndices.set(o,{parentMap:c,childrenMap:f})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new O0(ir({graph:this},t))}}/**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */const Pc=Symbol("Comlink.proxy"),A0=Symbol("Comlink.endpoint"),I0=Symbol("Comlink.releaseProxy"),gn=Symbol("Comlink.finalizer"),Nr=Symbol("Comlink.thrown"),Lc=e=>typeof e=="object"&&e!==null||typeof e=="function",T0={canHandle:e=>Lc(e)&&e[Pc],serialize(e){const{port1:r,port2:t}=new MessageChannel;return pn(e,r),[t,[t]]},deserialize(e){return e.start(),P0(e)}},k0={canHandle:e=>Lc(e)&&Nr in e,serialize({value:e}){let r;return e instanceof Error?r={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:r={isError:!1,value:e},[r,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},Dc=new Map([["proxy",T0],["throw",k0]]);function j0(e,r){for(const t of e)if(r===t||t==="*"||t instanceof RegExp&&t.test(r))return!0;return!1}function pn(e,r=globalThis,t=["*"]){r.addEventListener("message",function n(i){if(!i||!i.data)return;if(!j0(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:s,type:a,path:o}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(Ct);let f;try{const l=o.slice(0,-1).reduce((m,y)=>m[y],e),p=o.reduce((m,y)=>m[y],e);switch(a){case"GET":f=p;break;case"SET":l[o.slice(-1)[0]]=Ct(i.data.value),f=!0;break;case"APPLY":f=p.apply(l,c);break;case"CONSTRUCT":{const m=new p(...c);f=B0(m)}break;case"ENDPOINT":{const{port1:m,port2:y}=new MessageChannel;pn(e,y),f=F0(m,[m])}break;case"RELEASE":f=void 0;break;default:return}}catch(l){f={value:l,[Nr]:0}}Promise.resolve(f).catch(l=>({value:l,[Nr]:0})).then(l=>{const[p,m]=Rr(l);r.postMessage(Object.assign(Object.assign({},p),{id:s}),m),a==="RELEASE"&&(r.removeEventListener("message",n),zc(r),gn in e&&typeof e[gn]=="function"&&e[gn]())}).catch(l=>{const[p,m]=Rr({value:new TypeError("Unserializable return value"),[Nr]:0});r.postMessage(Object.assign(Object.assign({},p),{id:s}),m)})}),r.start&&r.start()}function C0(e){return e.constructor.name==="MessagePort"}function zc(e){C0(e)&&e.close()}function P0(e,r){const t=new Map;return e.addEventListener("message",function(i){const{data:s}=i;if(!s||!s.id)return;const a=t.get(s.id);if(a)try{a(s)}finally{t.delete(s.id)}}),vn(e,t,[],r)}function Mr(e){if(e)throw new Error("Proxy has been released and is not useable")}function Fc(e){return Ut(e,new Map,{type:"RELEASE"}).then(()=>{zc(e)})}const Sr=new WeakMap,qr="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const r=(Sr.get(e)||0)-1;Sr.set(e,r),r===0&&Fc(e)});function L0(e,r){const t=(Sr.get(r)||0)+1;Sr.set(r,t),qr&&qr.register(e,r,e)}function D0(e){qr&&qr.unregister(e)}function vn(e,r,t=[],n=function(){}){let i=!1;const s=new Proxy(n,{get(a,o){if(Mr(i),o===I0)return()=>{D0(s),Fc(e),r.clear(),i=!0};if(o==="then"){if(t.length===0)return{then:()=>s};const c=Ut(e,r,{type:"GET",path:t.map(f=>f.toString())}).then(Ct);return c.then.bind(c)}return vn(e,r,[...t,o])},set(a,o,c){Mr(i);const[f,l]=Rr(c);return Ut(e,r,{type:"SET",path:[...t,o].map(p=>p.toString()),value:f},l).then(Ct)},apply(a,o,c){Mr(i);const f=t[t.length-1];if(f===A0)return Ut(e,r,{type:"ENDPOINT"}).then(Ct);if(f==="bind")return vn(e,r,t.slice(0,-1));const[l,p]=Bc(c);return Ut(e,r,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:l},p).then(Ct)},construct(a,o){Mr(i);const[c,f]=Bc(o);return Ut(e,r,{type:"CONSTRUCT",path:t.map(l=>l.toString()),argumentList:c},f).then(Ct)}});return L0(s,e),s}function z0(e){return Array.prototype.concat.apply([],e)}function Bc(e){const r=e.map(Rr);return[r.map(t=>t[0]),z0(r.map(t=>t[1]))]}const $c=new WeakMap;function F0(e,r){return $c.set(e,r),e}function B0(e){return Object.assign(e,{[Pc]:!0})}function Rr(e){for(const[r,t]of Dc)if(t.canHandle(e)){const[n,i]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},i]}return[{type:"RAW",value:e},$c.get(e)||[]]}function Ct(e){switch(e.type){case"HANDLER":return Dc.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Ut(e,r,t,n){return new Promise(i=>{const s=$0();r.set(s,i),e.start&&e.start(),e.postMessage(Object.assign({id:s},t),n)})}function $0(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function wt(e){return typeof e=="function"}function G0(e){return e==null}function mn(e){return Array.isArray(e)}var Vt=function(e){var r=typeof e;return e!==null&&r==="object"||r==="function"};function U0(e,r){if(e){var t;if(mn(e))for(var n=0,i=e.length;n<i&&(t=r(e[n],n),t!==!1);n++);else if(Vt(e)){for(var s in e)if(e.hasOwnProperty(s)&&(t=r(e[s],s),t===!1))break}}}var V0=function(e){return typeof e=="object"&&e!==null},W0={}.toString,Y0=function(e,r){return W0.call(e)==="[object "+r+"]"},yn=function(e){if(!V0(e)||!Y0(e,"Object"))return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r};function sr(e){return typeof e=="string"}function me(e){return typeof e=="number"}var Or=function(e){if(typeof e!="object"||e===null)return e;var r;if(mn(e)){r=[];for(var t=0,n=e.length;t<n;t++)typeof e[t]=="object"&&e[t]!=null?r[t]=Or(e[t]):r[t]=e[t]}else{r={};for(var i in e)typeof e[i]=="object"&&e[i]!=null?r[i]=Or(e[i]):r[i]=e[i]}return r},K0=5;function X0(e,r){if(Object.hasOwn)return Object.hasOwn(e,r);if(e==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),r)}function Gc(e,r,t,n){t=t||0,n=n||K0;for(var i in r)if(X0(r,i)){var s=r[i];s!==null&&yn(s)?(yn(e[i])||(e[i]={}),t<n?Gc(e[i],s,t+1,n):e[i]=r[i]):mn(s)?(e[i]=[],e[i]=e[i].concat(s)):s!==void 0&&(e[i]=s)}}var Uc=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];for(var n=0;n<r.length;n+=1)Gc(e,r[n]);return e},Z0=Object.prototype.hasOwnProperty,Vc=function(e,r){if(e===null||!yn(e))return{};var t={};return U0(r,function(n){Z0.call(e,n)&&(t[n]=e[n])}),t};const J0=(e,r)=>{if(e!=="next"&&e!=="prev")return r},Wc=e=>{e.prev.next=e.next,e.next.prev=e.prev,delete e.next,delete e.prev};let Q0=class{constructor(){const r={};r.prev=r,r.next=r.prev,this.shortcut=r}dequeue(){const r=this.shortcut,t=r.prev;if(t&&t!==r)return Wc(t),t}enqueue(r){const t=this.shortcut;r.prev&&r.next&&Wc(r),r.next=t.next,t.next.prev=r,t.next=r,r.prev=t}toString(){const r=[],t=this.shortcut;let n=t.prev;for(;n!==t;)r.push(JSON.stringify(n,J0)),n=n==null?void 0:n.prev;return`[${r.join(", ")}]`}};class H0 extends Q0{}const em=()=>1,tm=(e,r)=>{var t;if(e.getAllNodes().length<=1)return[];const n=nm(e,r||em);return(t=rm(n.graph,n.buckets,n.zeroIdx).map(s=>e.getRelatedEdges(s.v,"out").filter(({target:a})=>a===s.w)))===null||t===void 0?void 0:t.flat()},rm=(e,r,t)=>{let n=[];const i=r[r.length-1],s=r[0];let a;for(;e.getAllNodes().length;){for(;a=s.dequeue();)wn(e,r,t,a);for(;a=i.dequeue();)wn(e,r,t,a);if(e.getAllNodes().length){for(let o=r.length-2;o>0;--o)if(a=r[o].dequeue(),a){n=n.concat(wn(e,r,t,a,!0));break}}}return n},wn=(e,r,t,n,i)=>{var s,a;const o=[];return e.hasNode(n.v)&&((s=e.getRelatedEdges(n.v,"in"))===null||s===void 0||s.forEach(c=>{const f=c.data.weight,l=e.getNode(c.source);i&&o.push({v:c.source,w:c.target,in:0,out:0}),l.data.out===void 0&&(l.data.out=0),l.data.out-=f,bn(r,t,Object.assign({v:l.id},l.data))}),(a=e.getRelatedEdges(n.v,"out"))===null||a===void 0||a.forEach(c=>{const f=c.data.weight,l=c.target,p=e.getNode(l);p.data.in===void 0&&(p.data.in=0),p.data.in-=f,bn(r,t,Object.assign({v:p.id},p.data))}),e.removeNode(n.v)),i?o:void 0},nm=(e,r)=>{const t=new Be;let n=0,i=0;e.getAllNodes().forEach(c=>{t.addNode({id:c.id,data:{v:c.id,in:0,out:0}})}),e.getAllEdges().forEach(c=>{const f=t.getRelatedEdges(c.source,"out").find(p=>p.target===c.target),l=(r==null?void 0:r(c))||1;f?t.updateEdgeData(f==null?void 0:f.id,Object.assign(Object.assign({},f.data),{weight:f.data.weight+l})):t.addEdge({id:c.id,source:c.source,target:c.target,data:{weight:l}}),i=Math.max(i,t.getNode(c.source).data.out+=l),n=Math.max(n,t.getNode(c.target).data.in+=l)});const s=[],a=i+n+3;for(let c=0;c<a;c++)s.push(new H0);const o=n+1;return t.getAllNodes().forEach(c=>{bn(s,o,Object.assign({v:c.id},t.getNode(c.id).data))}),{buckets:s,zeroIdx:o,graph:t}},bn=(e,r,t)=>{t.out?t.in?e[t.out-t.in+r].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)},im=(e,r)=>{const n=tm(e,(i=>s=>s.data.weight||1)());n==null||n.forEach(i=>{const s=i.data;e.removeEdge(i.id),s.forwardName=i.data.name,s.reversed=!0,e.addEdge({id:i.id,source:i.target,target:i.source,data:Object.assign({},s)})})},sm=e=>{e.getAllEdges().forEach(r=>{const t=r.data;if(t.reversed){e.removeEdge(r.id);const n=t.forwardName;delete t.reversed,delete t.forwardName,e.addEdge({id:r.id,source:r.target,target:r.source,data:Object.assign(Object.assign({},t),{forwardName:n})})}})},om=(e,r)=>Number(e)-Number(r),Wt=(e,r,t,n)=>{let i;do i=`${n}${Math.random()}`;while(e.hasNode(i));return t.dummy=r,e.addNode({id:i,data:t}),i},am=e=>{const r=new Be;return e.getAllNodes().forEach(t=>{r.addNode(Object.assign({},t))}),e.getAllEdges().forEach(t=>{const n=r.getRelatedEdges(t.source,"out").find(i=>i.target===t.target);n?r.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+t.data.weight||0,minlen:Math.max(n.data.minlen,t.data.minlen||1)})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})}),r},Yc=e=>{const r=new Be;return e.getAllNodes().forEach(t=>{e.getChildren(t.id).length||r.addNode(Object.assign({},t))}),e.getAllEdges().forEach(t=>{r.addEdge(t)}),r},um=(e,r)=>e==null?void 0:e.reduce((t,n,i)=>(t[n]=r[i],t),{}),Kc=(e,r)=>{const t=Number(e.x),n=Number(e.y),i=Number(r.x)-t,s=Number(r.y)-n;let a=Number(e.width)/2,o=Number(e.height)/2;if(!i&&!s)return{x:0,y:0};let c,f;return Math.abs(s)*a>Math.abs(i)*o?(s<0&&(o=-o),c=o*i/s,f=o):(i<0&&(a=-a),c=a,f=a*s/i),{x:t+c,y:n+f}},or=e=>{const r=[],t=Zc(e)+1;for(let n=0;n<t;n++)r.push([]);e.getAllNodes().forEach(n=>{const i=n.data.rank;i!==void 0&&r[i]&&r[i].push(n.id)});for(let n=0;n<t;n++)r[n]=r[n].sort((i,s)=>om(e.getNode(i).data.order,e.getNode(s).data.order));return r},cm=e=>{const r=e.getAllNodes().filter(n=>n.data.rank!==void 0).map(n=>n.data.rank),t=Math.min(...r);e.getAllNodes().forEach(n=>{n.data.hasOwnProperty("rank")&&t!==1/0&&(n.data.rank-=t)})},fm=(e,r=0)=>{const t=e.getAllNodes(),n=t.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),s=[];t.forEach(o=>{const c=(o.data.rank||0)-i;s[c]||(s[c]=[]),s[c].push(o.id)});let a=0;for(let o=0;o<s.length;o++){const c=s[o];c===void 0?o%r!==0&&(a-=1):a&&(c==null||c.forEach(f=>{const l=e.getNode(f);l&&(l.data.rank=l.data.rank||0,l.data.rank+=a)}))}},Xc=(e,r,t,n)=>{const i={width:0,height:0};return me(t)&&me(n)&&(i.rank=t,i.order=n),Wt(e,"border",i,r)},Zc=e=>{let r;return e.getAllNodes().forEach(t=>{const n=t.data.rank;n!==void 0&&(r===void 0||n>r)&&(r=n)}),r||(r=0),r},lm=(e,r)=>{const t={lhs:[],rhs:[]};return e==null||e.forEach(n=>{r(n)?t.lhs.push(n):t.rhs.push(n)}),t},_n=(e,r)=>e.reduce((t,n)=>{const i=r(t),s=r(n);return i>s?n:t}),Jc=(e,r,t,n,i,s)=>{n.includes(r.id)||(n.push(r.id),t||s.push(r.id),i(r.id).forEach(a=>Jc(e,a,t,n,i,s)),t&&s.push(r.id))},Qc=(e,r,t,n)=>{const i=Array.isArray(r)?r:[r],s=c=>e.getNeighbors(c),a=[],o=[];return i.forEach(c=>{if(e.hasNode(c.id))Jc(e,c,t==="post",o,s,a);else throw new Error(`Graph does not have node: ${c}`)}),a},hm=e=>{const r=t=>{const n=e.getChildren(t),i=e.getNode(t);if(n!=null&&n.length&&n.forEach(s=>r(s.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let s=i.data.minRank,a=i.data.maxRank+1;s<a;s+=1)Hc(e,"borderLeft","_bl",t,i,s),Hc(e,"borderRight","_br",t,i,s)}};e.getRoots().forEach(t=>r(t.id))},Hc=(e,r,t,n,i,s)=>{const a={rank:s,borderType:r,width:0,height:0},o=i.data[r][s-1],c=Wt(e,"border",a,t);i.data[r][s]=c,e.setParent(c,n),o&&e.addEdge({id:`e${Math.random()}`,source:o,target:c,data:{weight:1}})},dm=(e,r)=>{const t=r.toLowerCase();(t==="lr"||t==="rl")&&ef(e)},gm=(e,r)=>{const t=r.toLowerCase();(t==="bt"||t==="rl")&&pm(e),(t==="lr"||t==="rl")&&(vm(e),ef(e))},ef=e=>{e.getAllNodes().forEach(r=>{tf(r)}),e.getAllEdges().forEach(r=>{tf(r)})},tf=e=>{const r=e.data.width;e.data.width=e.data.height,e.data.height=r},pm=e=>{e.getAllNodes().forEach(r=>{En(r.data)}),e.getAllEdges().forEach(r=>{var t;(t=r.data.points)===null||t===void 0||t.forEach(n=>En(n)),r.data.hasOwnProperty("y")&&En(r.data)})},En=e=>{e!=null&&e.y&&(e.y=-e.y)},vm=e=>{e.getAllNodes().forEach(r=>{xn(r.data)}),e.getAllEdges().forEach(r=>{var t;(t=r.data.points)===null||t===void 0||t.forEach(n=>xn(n)),r.data.hasOwnProperty("x")&&xn(r.data)})},xn=e=>{const r=e.x;e.x=e.y,e.y=r},mm=e=>{const r=Wt(e,"root",{},"_root"),t=ym(e);let n=Math.max(...Object.values(t));Math.abs(n)===1/0&&(n=1);const i=n-1,s=2*i+1;e.getAllEdges().forEach(o=>{o.data.minlen*=s});const a=wm(e)+1;return e.getRoots().forEach(o=>{rf(e,r,s,a,i,t,o.id)}),{nestingRoot:r,nodeRankFactor:s}},rf=(e,r,t,n,i,s,a)=>{const o=e.getChildren(a);if(!(o!=null&&o.length)){a!==r&&e.addEdge({id:`e${Math.random()}`,source:r,target:a,data:{weight:0,minlen:t}});return}const c=Xc(e,"_bt"),f=Xc(e,"_bb"),l=e.getNode(a);e.setParent(c,a),l.data.borderTop=c,e.setParent(f,a),l.data.borderBottom=f,o==null||o.forEach(p=>{rf(e,r,t,n,i,s,p.id);const m=p.data.borderTop?p.data.borderTop:p.id,y=p.data.borderBottom?p.data.borderBottom:p.id,x=p.data.borderTop?n:2*n,_=m!==y?1:i-s[a]+1;e.addEdge({id:`e${Math.random()}`,source:c,target:m,data:{minlen:_,weight:x,nestingEdge:!0}}),e.addEdge({id:`e${Math.random()}`,source:y,target:f,data:{minlen:_,weight:x,nestingEdge:!0}})}),e.getParent(a)||e.addEdge({id:`e${Math.random()}`,source:r,target:c,data:{weight:0,minlen:i+s[a]}})},ym=e=>{const r={},t=(n,i)=>{const s=e.getChildren(n);s==null||s.forEach(a=>t(a.id,i+1)),r[n]=i};return e.getRoots().forEach(n=>t(n.id,1)),r},wm=e=>{let r=0;return e.getAllEdges().forEach(t=>{r+=t.data.weight}),r},bm=(e,r)=>{r&&e.removeNode(r),e.getAllEdges().forEach(t=>{t.data.nestingEdge&&e.removeEdge(t.id)})},_m="edge",nf="edge-label",Em=(e,r)=>{e.getAllEdges().forEach(t=>xm(e,t,r))},xm=(e,r,t)=>{let n=r.source,i=e.getNode(n).data.rank;const s=r.target,a=e.getNode(s).data.rank,o=r.data.labelRank;if(a===i+1)return;e.removeEdge(r.id);let c,f,l;for(l=0,++i;i<a;++l,++i)r.data.points=[],f={originalEdge:r,width:0,height:0,rank:i},c=Wt(e,_m,f,"_d"),i===o&&(f.width=r.data.width,f.height=r.data.height,f.dummy=nf,f.labelpos=r.data.labelpos),e.addEdge({id:`e${Math.random()}`,source:n,target:c,data:{weight:r.data.weight}}),l===0&&t.push(c),n=c;e.addEdge({id:`e${Math.random()}`,source:n,target:s,data:{weight:r.data.weight}})},Nm=(e,r)=>{r.forEach(t=>{let n=e.getNode(t);const{data:i}=n,s=i.originalEdge;let a;s&&e.addEdge(s);let o=t;for(;n.data.dummy;)a=e.getSuccessors(o)[0],e.removeNode(o),s.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===nf&&(s.data.x=n.data.x,s.data.y=n.data.y,s.data.width=n.data.width,s.data.height=n.data.height),o=a.id,n=e.getNode(o)})},Mm=(e,r,t)=>{const n={};let i;t==null||t.forEach(s=>{let a=e.getParent(s),o,c;for(;a;){if(o=e.getParent(a.id),o?(c=n[o.id],n[o.id]=a.id):(c=i,i=a.id),c&&c!==a.id){r.hasNode(c)||r.addNode({id:c,data:{}}),r.hasNode(a.id)||r.addNode({id:a.id,data:{}}),r.hasEdge(`e${c}-${a.id}`)||r.addEdge({id:`e${c}-${a.id}`,source:c,target:a.id,data:{}});return}a=o}})},Sm=(e,r,t)=>{const n=qm(e),i=new Be({tree:[{id:n,children:[],data:{}}]});return e.getAllNodes().forEach(s=>{const a=e.getParent(s.id);(s.data.rank===r||s.data.minRank<=r&&r<=s.data.maxRank)&&(i.hasNode(s.id)||i.addNode(Object.assign({},s)),a!=null&&a.id&&!i.hasNode(a==null?void 0:a.id)&&i.addNode(Object.assign({},a)),i.setParent(s.id,(a==null?void 0:a.id)||n),e.getRelatedEdges(s.id,t).forEach(o=>{const c=o.source===s.id?o.target:o.source;i.hasNode(c)||i.addNode(Object.assign({},e.getNode(c)));const f=i.getRelatedEdges(c,"out").find(({target:p})=>p===s.id),l=f!==void 0?f.data.weight:0;f?i.updateEdgeData(f.id,Object.assign(Object.assign({},f.data),{weight:o.data.weight+l})):i.addEdge({id:o.id,source:c,target:s.id,data:{weight:o.data.weight+l}})}),s.data.hasOwnProperty("minRank")&&i.updateNodeData(s.id,Object.assign(Object.assign({},s.data),{borderLeft:s.data.borderLeft[r],borderRight:s.data.borderRight[r]})))}),i},qm=e=>{let r;for(;e.hasNode(r=`_root${Math.random()}`););return r},Rm=(e,r,t)=>{const n=um(t,t.map((l,p)=>p)),s=r.map(l=>{const p=e.getRelatedEdges(l,"out").map(m=>({pos:n[m.target]||0,weight:m.data.weight}));return p==null?void 0:p.sort((m,y)=>m.pos-y.pos)}).flat().filter(l=>l!==void 0);let a=1;for(;a<t.length;)a<<=1;const o=2*a-1;a-=1;const c=Array(o).fill(0,0,o);let f=0;return s==null||s.forEach(l=>{if(l){let p=l.pos+a;c[p]+=l.weight;let m=0;for(;p>0;)p%2&&(m+=c[p+1]),p=p-1>>1,c[p]+=l.weight;f+=l.weight*m}}),f},sf=(e,r)=>{let t=0;for(let n=1;n<(r==null?void 0:r.length);n+=1)t+=Rm(e,r[n-1],r[n]);return t},of=e=>{const r={},t=e.getAllNodes(),n=t.map(f=>{var l;return(l=f.data.rank)!==null&&l!==void 0?l:-1/0}),i=Math.max(...n),s=[];for(let f=0;f<i+1;f++)s.push([]);const a=t.sort((f,l)=>e.getNode(f.id).data.rank-e.getNode(l.id).data.rank),c=a.filter(f=>e.getNode(f.id).data.fixorder!==void 0).sort((f,l)=>e.getNode(f.id).data.fixorder-e.getNode(l.id).data.fixorder);return c==null||c.forEach(f=>{isNaN(e.getNode(f.id).data.rank)||s[e.getNode(f.id).data.rank].push(f.id),r[f.id]=!0}),a==null||a.forEach(f=>e.dfsTree(f.id,l=>{if(r.hasOwnProperty(l.id))return!0;r[l.id]=!0,isNaN(l.data.rank)||s[l.data.rank].push(l.id)})),s},Om=(e,r)=>r.map(t=>{const n=e.getRelatedEdges(t,"in");if(!(n!=null&&n.length))return{v:t};const i={sum:0,weight:0};return n==null||n.forEach(s=>{const a=e.getNode(s.source);i.sum+=s.data.weight*a.data.order,i.weight+=s.data.weight}),{v:t,barycenter:i.sum/i.weight,weight:i.weight}}),Am=(e,r)=>{var t,n,i;const s={};e==null||e.forEach((o,c)=>{s[o.v]={i:c,indegree:0,in:[],out:[],vs:[o.v]};const f=s[o.v];o.barycenter!==void 0&&(f.barycenter=o.barycenter,f.weight=o.weight)}),(t=r.getAllEdges())===null||t===void 0||t.forEach(o=>{const c=s[o.source],f=s[o.target];c!==void 0&&f!==void 0&&(f.indegree++,c.out.push(s[o.target]))});const a=(i=(n=Object.values(s)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return Im(a)},Im=e=>{var r,t;const n=[],i=c=>f=>{f.merged||(f.barycenter===void 0||c.barycenter===void 0||f.barycenter>=c.barycenter)&&Tm(c,f)},s=c=>f=>{f.in.push(c),--f.indegree===0&&e.push(f)};for(;e!=null&&e.length;){const c=e.pop();n.push(c),(r=c.in.reverse())===null||r===void 0||r.forEach(f=>i(c)(f)),(t=c.out)===null||t===void 0||t.forEach(f=>s(c)(f))}const a=n.filter(c=>!c.merged),o=["vs","i","barycenter","weight"];return a.map(c=>{const f={};return o==null||o.forEach(l=>{c[l]!==void 0&&(f[l]=c[l])}),f})},Tm=(e,r)=>{var t;let n=0,i=0;e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),e.vs=(t=r.vs)===null||t===void 0?void 0:t.concat(e.vs),e.barycenter=n/i,e.weight=i,e.i=Math.min(r.i,e.i),r.merged=!0},km=(e,r,t,n)=>{const i=lm(e,m=>{const y=m.hasOwnProperty("fixorder")&&!isNaN(m.fixorder);return n?!y&&m.hasOwnProperty("barycenter"):y||m.hasOwnProperty("barycenter")}),s=i.lhs,a=i.rhs.sort((m,y)=>-m.i- -y.i),o=[];let c=0,f=0,l=0;s==null||s.sort(jm(!!r,!!t)),l=af(o,a,l),s==null||s.forEach(m=>{var y;l+=(y=m.vs)===null||y===void 0?void 0:y.length,o.push(m.vs),c+=m.barycenter*m.weight,f+=m.weight,l=af(o,a,l)});const p={vs:o.flat()};return f&&(p.barycenter=c/f,p.weight=f),p},af=(e,r,t)=>{let n=t,i;for(;r.length&&(i=r[r.length-1]).i<=n;)r.pop(),e==null||e.push(i.vs),n++;return n},jm=(e,r)=>(t,n)=>{if(t.fixorder!==void 0&&n.fixorder!==void 0)return t.fixorder-n.fixorder;if(t.barycenter<n.barycenter)return-1;if(t.barycenter>n.barycenter)return 1;if(r&&t.order!==void 0&&n.order!==void 0){if(t.order<n.order)return-1;if(t.order>n.order)return 1}return e?n.i-t.i:t.i-n.i},uf=(e,r,t,n,i,s)=>{var a,o,c,f;let l=e.getChildren(r).map(E=>E.id);const p=e.getNode(r),m=p?p.data.borderLeft:void 0,y=p?p.data.borderRight:void 0,x={};m&&(l=l==null?void 0:l.filter(E=>E!==m&&E!==y));const _=Om(e,l||[]);_==null||_.forEach(E=>{var N;if(!((N=e.getChildren(E.v))===null||N===void 0)&&N.length){const S=uf(e,E.v,t,n,s);x[E.v]=S,S.hasOwnProperty("barycenter")&&Pm(E,S)}});const b=Am(_,t);Cm(b,x),(a=b.filter(E=>E.vs.length>0))===null||a===void 0||a.forEach(E=>{const N=e.getNode(E.vs[0]);N&&(E.fixorder=N.data.fixorder,E.order=N.data.order)});const w=km(b,n,i,s);if(m&&(w.vs=[m,w.vs,y].flat(),!((o=e.getPredecessors(m))===null||o===void 0)&&o.length)){const E=e.getNode(((c=e.getPredecessors(m))===null||c===void 0?void 0:c[0].id)||""),N=e.getNode(((f=e.getPredecessors(y))===null||f===void 0?void 0:f[0].id)||"");w.hasOwnProperty("barycenter")||(w.barycenter=0,w.weight=0),w.barycenter=(w.barycenter*w.weight+E.data.order+N.data.order)/(w.weight+2),w.weight+=2}return w},Cm=(e,r)=>{e==null||e.forEach(t=>{var n;const i=(n=t.vs)===null||n===void 0?void 0:n.map(s=>r[s]?r[s].vs:s);t.vs=i.flat()})},Pm=(e,r)=>{e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+r.barycenter*r.weight)/(e.weight+r.weight),e.weight+=r.weight):(e.barycenter=r.barycenter,e.weight=r.weight)},Lm=(e,r)=>{const t=Zc(e),n=[],i=[];for(let l=1;l<t+1;l++)n.push(l);for(let l=t-1;l>-1;l--)i.push(l);const s=cf(e,n,"in"),a=cf(e,i,"out");let o=of(e);Nn(e,o);let c=Number.POSITIVE_INFINITY,f;for(let l=0,p=0;p<4;++l,++p){ff(l%2?s:a,l%4>=2,!1,r),o=or(e);const m=sf(e,o);m<c&&(p=0,f=Or(o),c=m)}o=of(e),Nn(e,o);for(let l=0,p=0;p<4;++l,++p){ff(l%2?s:a,l%4>=2,!0,r),o=or(e);const m=sf(e,o);m<c&&(p=0,f=Or(o),c=m)}Nn(e,f)},cf=(e,r,t)=>r.map(n=>Sm(e,n,t)),ff=(e,r,t,n)=>{const i=new Be;e==null||e.forEach(s=>{var a;const o=s.getRoots()[0].id,c=uf(s,o,i,r,t,n);for(let f=0;f<((a=c.vs)===null||a===void 0?void 0:a.length);f++){const l=s.getNode(c.vs[f]);l&&(l.data.order=f)}Mm(s,i,c.vs)})},Nn=(e,r)=>{r==null||r.forEach(t=>{t==null||t.forEach((n,i)=>{e.getNode(n).data.order=i})})},Dm=(e,r)=>{const n=e.getAllNodes().filter(a=>{var o;return!(!((o=e.getChildren(a.id))===null||o===void 0)&&o.length)}).map(a=>a.data.rank),i=Math.max(...n),s=[];for(let a=0;a<i+1;a++)s[a]=[];r==null||r.forEach(a=>{const o=e.getNode(a);!o||o.data.dummy||isNaN(o.data.rank)||(o.data.fixorder=s[o.data.rank].length,s[o.data.rank].push(a))})},zm=e=>{const r={};let t=0;const n=i=>{const s=t;e.getChildren(i).forEach(a=>n(a.id)),r[i]={low:s,lim:t++}};return e.getRoots().forEach(i=>n(i.id)),r},Fm=(e,r,t,n)=>{var i,s;const a=[],o=[],c=Math.min(r[t].low,r[n].low),f=Math.max(r[t].lim,r[n].lim);let l,p;l=t;do l=(i=e.getParent(l))===null||i===void 0?void 0:i.id,a.push(l);while(l&&(r[l].low>c||f>r[l].lim));for(p=l,l=n;l&&l!==p;)o.push(l),l=(s=e.getParent(l))===null||s===void 0?void 0:s.id;return{lca:p,path:a.concat(o.reverse())}},Bm=(e,r)=>{const t=zm(e);r.forEach(n=>{var i,s;let a=n,o=e.getNode(a);const c=o.data.originalEdge;if(!c)return;const f=Fm(e,t,c.source,c.target),l=f.path,p=f.lca;let m=0,y=l[m],x=!0;for(;a!==c.target;){if(o=e.getNode(a),x){for(;y!==p&&((i=e.getNode(y))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)m++,y=l[m];y===p&&(x=!1)}if(!x){for(;m<l.length-1&&((s=e.getNode(l[m+1]))===null||s===void 0?void 0:s.data.minRank)<=o.data.rank;)m++;y=l[m]}e.hasNode(y)&&e.setParent(a,y),a=e.getSuccessors(a)[0].id}})},$m=(e,r)=>{const t={},n=(i,s)=>{let a=0,o=0;const c=i.length,f=s==null?void 0:s[(s==null?void 0:s.length)-1];return s==null||s.forEach((l,p)=>{var m;const y=Um(e,l),x=y?e.getNode(y.id).data.order:c;(y||l===f)&&((m=s.slice(o,p+1))===null||m===void 0||m.forEach(_=>{var b;(b=e.getPredecessors(_))===null||b===void 0||b.forEach(w=>{var E;const N=e.getNode(w.id),S=N.data.order;(S<a||x<S)&&!(N.data.dummy&&(!((E=e.getNode(_))===null||E===void 0)&&E.data.dummy))&&lf(t,w.id,_)})}),o=p+1,a=x)}),s};return r!=null&&r.length&&r.reduce(n),t},Gm=(e,r)=>{const t={};function n(o,c,f,l,p){var m,y;let x;for(let _=c;_<f;_++)x=o[_],!((m=e.getNode(x))===null||m===void 0)&&m.data.dummy&&((y=e.getPredecessors(x))===null||y===void 0||y.forEach(b=>{const w=e.getNode(b.id);w.data.dummy&&(w.data.order<l||w.data.order>p)&&lf(t,b.id,x)}))}function i(o){return JSON.stringify(o.slice(1))}function s(o,c){const f=i(o);c.get(f)||(n(...o),c.set(f,!0))}const a=(o,c)=>{let f=-1,l,p=0;const m=new Map;return c==null||c.forEach((y,x)=>{var _;if(((_=e.getNode(y))===null||_===void 0?void 0:_.data.dummy)==="border"){const b=e.getPredecessors(y)||[];b.length&&(l=e.getNode(b[0].id).data.order,s([c,p,x,f,l],m),p=x,f=l)}s([c,p,c.length,l,o.length],m)}),c};return r!=null&&r.length&&r.reduce(a),t},Um=(e,r)=>{var t,n;if(!((t=e.getNode(r))===null||t===void 0)&&t.data.dummy)return(n=e.getPredecessors(r))===null||n===void 0?void 0:n.find(i=>e.getNode(i.id).data.dummy)},lf=(e,r,t)=>{let n=r,i=t;if(n>i){const a=n;n=i,i=a}let s=e[n];s||(e[n]=s={}),s[i]=!0},Vm=(e,r,t)=>{let n=r,i=t;if(n>i){const s=r;n=i,i=s}return!!e[n]},Wm=(e,r,t,n)=>{const i={},s={},a={};return r==null||r.forEach(o=>{o==null||o.forEach((c,f)=>{i[c]=c,s[c]=c,a[c]=f})}),r==null||r.forEach(o=>{let c=-1;o==null||o.forEach(f=>{let l=n(f).map(p=>p.id);if(l.length){l=l.sort((m,y)=>a[m]-a[y]);const p=(l.length-1)/2;for(let m=Math.floor(p),y=Math.ceil(p);m<=y;++m){const x=l[m];s[f]===f&&c<a[x]&&!Vm(t,f,x)&&(s[x]=f,s[f]=i[f]=i[x],c=a[x])}}})}),{root:i,align:s}},Ym=(e,r,t,n,i,s,a)=>{var o;const c={},f=Km(e,r,t,i,s,a),l=a?"borderLeft":"borderRight",p=(x,_)=>{let b=f.getAllNodes(),w=b.pop();const E={};for(;w;)E[w.id]?x(w.id):(E[w.id]=!0,b.push(w),b=b.concat(_(w.id))),w=b.pop()},m=x=>{c[x]=(f.getRelatedEdges(x,"in")||[]).reduce((_,b)=>Math.max(_,(c[b.source]||0)+b.data.weight),0)},y=x=>{const _=(f.getRelatedEdges(x,"out")||[]).reduce((w,E)=>Math.min(w,(c[E.target]||0)-E.data.weight),Number.POSITIVE_INFINITY),b=e.getNode(x);_!==Number.POSITIVE_INFINITY&&b.data.borderType!==l&&(c[x]=Math.max(c[x],_))};return p(m,f.getPredecessors.bind(f)),p(y,f.getSuccessors.bind(f)),(o=Object.values(n))===null||o===void 0||o.forEach(x=>{c[x]=c[t[x]]}),c},Km=(e,r,t,n,i,s)=>{const a=new Be,o=Qm(n,i,s);return r==null||r.forEach(c=>{let f;c==null||c.forEach(l=>{const p=t[l];if(a.hasNode(p)||a.addNode({id:p,data:{}}),f){const m=t[f],y=a.getRelatedEdges(m,"out").find(x=>x.target===p);y?a.updateEdgeData(y.id,Object.assign(Object.assign({},y.data),{weight:Math.max(o(e,l,f),y.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:m,target:p,data:{weight:Math.max(o(e,l,f),0)}})}f=l})}),a},Xm=(e,r)=>_n(Object.values(r),t=>{var n;let i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;return(n=Object.keys(t))===null||n===void 0||n.forEach(a=>{const o=t[a],c=Hm(e,a)/2;i=Math.max(o+c,i),s=Math.min(o-c,s)}),i-s});function Zm(e,r){const t=Object.values(r),n=Math.min(...t),i=Math.max(...t);["u","d"].forEach(s=>{["l","r"].forEach(a=>{const o=s+a,c=e[o];let f;if(c===r)return;const l=Object.values(c);f=a==="l"?n-Math.min(...l):i-Math.max(...l),f&&(e[o]={},Object.keys(c).forEach(p=>{e[o][p]=c[p]+f}))})})}const Jm=(e,r)=>{const t={};return Object.keys(e.ul).forEach(n=>{if(r)t[n]=e[r.toLowerCase()][n];else{const i=Object.values(e).map(s=>s[n]);t[n]=(i[0]+i[1])/2}}),t},Qm=(e,r,t)=>(n,i,s)=>{const a=n.getNode(i),o=n.getNode(s);let c=0,f=0;if(c+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":f=-a.data.width/2;break;case"r":f=a.data.width/2;break}if(f&&(c+=t?f:-f),f=0,c+=(a.data.dummy?r:e)/2,c+=(o.data.dummy?r:e)/2,c+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":f=o.data.width/2;break;case"r":f=-o.data.width/2;break}return f&&(c+=t?f:-f),f=0,c},Hm=(e,r)=>e.getNode(r).data.width||0,ey=(e,r)=>{const{ranksep:t=0}=r||{},n=or(e);let i=0;n==null||n.forEach(s=>{const a=s.map(c=>e.getNode(c).data.height),o=Math.max(...a,0);s==null||s.forEach(c=>{e.getNode(c).data.y=i+o/2}),i+=o+t})},ty=(e,r)=>{const{align:t,nodesep:n=0,edgesep:i=0}=r||{},s=or(e),a=Object.assign($m(e,s),Gm(e,s)),o={};let c=[];["u","d"].forEach(l=>{c=l==="u"?s:Object.values(s).reverse(),["l","r"].forEach(p=>{p==="r"&&(c=c.map(_=>Object.values(_).reverse()));const m=(l==="u"?e.getPredecessors:e.getSuccessors).bind(e),y=Wm(e,c,a,m),x=Ym(e,c,y.root,y.align,n,i,p==="r");p==="r"&&Object.keys(x).forEach(_=>x[_]=-x[_]),o[l+p]=x})});const f=Xm(e,o);return f&&Zm(o,f),Jm(o,t)},ry=(e,r)=>{var t;const n=Yc(e);ey(n,r);const i=ty(n,r);(t=Object.keys(i))===null||t===void 0||t.forEach(s=>{n.getNode(s).data.x=i[s]})},hf=e=>{const r={},t=n=>{var i;const s=e.getNode(n);if(!s)return 0;if(r[n])return s.data.rank;r[n]=!0;let a;return(i=e.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const c=t(o.target),f=o.data.minlen,l=c-f;l&&(a===void 0||l<a)&&(a=l)}),a||(a=0),s.data.rank=a,a};e.getAllNodes().filter(n=>e.getRelatedEdges(n.id,"in").length===0).forEach(n=>t(n.id))},ny=e=>{const r={};let t;const n=a=>{var o;const c=e.getNode(a);if(!c)return 0;if(r[a])return c.data.rank;r[a]=!0;let f;return(o=e.getRelatedEdges(a,"out"))===null||o===void 0||o.forEach(l=>{const p=n(l.target),m=l.data.minlen,y=p-m;y&&(f===void 0||y<f)&&(f=y)}),f||(f=0),(t===void 0||f<t)&&(t=f),c.data.rank=f,f};e.getAllNodes().filter(a=>e.getRelatedEdges(a.id,"in").length===0).forEach(a=>{a&&n(a.id)}),t===void 0&&(t=0);const i={},s=(a,o)=>{var c;const f=e.getNode(a),l=isNaN(f.data.layer)?o:f.data.layer;(f.data.rank===void 0||f.data.rank<l)&&(f.data.rank=l),!i[a]&&(i[a]=!0,(c=e.getRelatedEdges(a,"out"))===null||c===void 0||c.forEach(p=>{s(p.target,l+p.data.minlen)}))};e.getAllNodes().forEach(a=>{const o=a.data;o&&(isNaN(o.layer)?o.rank-=t:s(a.id,o.layer))})},At=(e,r)=>e.getNode(r.target).data.rank-e.getNode(r.source).data.rank-r.data.minlen,iy=e=>{const r=new Be({tree:[]}),t=e.getAllNodes()[0],n=e.getAllNodes().length;r.addNode(t);let i,s;for(;sy(r,e)<n;)i=df(r,e),s=r.hasNode(i.source)?At(e,i):-At(e,i),gf(r,e,s);return r},sy=(e,r)=>{const t=n=>{r.getRelatedEdges(n,"both").forEach(i=>{const s=i.source,a=n===s?i.target:s;!e.hasNode(a)&&!At(r,i)&&(e.addNode({id:a,data:{}}),e.addEdge({id:i.id,source:n,target:a,data:{}}),t(a))})};return e.getAllNodes().forEach(n=>t(n.id)),e.getAllNodes().length},oy=e=>{const r=new Be({tree:[]}),t=e.getAllNodes()[0],n=e.getAllNodes().length;r.addNode(t);let i,s;for(;ay(r,e)<n;)i=df(r,e),s=r.hasNode(i.source)?At(e,i):-At(e,i),gf(r,e,s);return r},ay=(e,r)=>{const t=n=>{var i;(i=r.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(s=>{const a=s.source,o=n===a?s.target:a;!e.hasNode(o)&&(r.getNode(o).data.layer!==void 0||!At(r,s))&&(e.addNode({id:o,data:{}}),e.addEdge({id:s.id,source:n,target:o,data:{}}),t(o))})};return e.getAllNodes().forEach(n=>t(n.id)),e.getAllNodes().length},df=(e,r)=>_n(r.getAllEdges(),t=>e.hasNode(t.source)!==e.hasNode(t.target)?At(r,t):1/0),gf=(e,r,t)=>{e.getAllNodes().forEach(n=>{const i=r.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=t})},uy=e=>{const r=am(e);hf(r);const t=iy(r);vf(t),pf(t,r);let n,i;for(;n=ly(t);)i=hy(t,r,n),dy(t,r,n,i)},pf=(e,r)=>{let t=Qc(e,e.getAllNodes(),"post");t=t.slice(0,(t==null?void 0:t.length)-1),t.forEach(n=>{cy(e,r,n)})},cy=(e,r,t)=>{const i=e.getNode(t).data.parent,s=e.getRelatedEdges(t,"both").find(a=>a.target===i||a.source===i);s.data.cutvalue=fy(e,r,t)},fy=(e,r,t)=>{const i=e.getNode(t).data.parent;let s=!0,a=r.getRelatedEdges(t,"out").find(c=>c.target===i),o=0;return a||(s=!1,a=r.getRelatedEdges(i,"out").find(c=>c.target===t)),o=a.data.weight,r.getRelatedEdges(t,"both").forEach(c=>{const f=c.source===t,l=f?c.target:c.source;if(l!==i){const p=f===s,m=c.data.weight;if(o+=p?m:-m,py(e,t,l)){const y=e.getRelatedEdges(t,"both").find(x=>x.source===l||x.target===l).data.cutvalue;o+=p?-y:y}}}),o},vf=(e,r=e.getAllNodes()[0].id)=>{mf(e,{},1,r)},mf=(e,r,t,n,i)=>{var s;const a=t;let o=t;const c=e.getNode(n);return r[n]=!0,(s=e.getNeighbors(n))===null||s===void 0||s.forEach(f=>{r[f.id]||(o=mf(e,r,o,f.id,n))}),c.data.low=a,c.data.lim=o++,i?c.data.parent=i:delete c.data.parent,o},ly=e=>e.getAllEdges().find(r=>r.data.cutvalue<0),hy=(e,r,t)=>{let n=t.source,i=t.target;r.getRelatedEdges(n,"out").find(l=>l.target===i)||(n=t.target,i=t.source);const s=e.getNode(n),a=e.getNode(i);let o=s,c=!1;s.data.lim>a.data.lim&&(o=a,c=!0);const f=r.getAllEdges().filter(l=>c===yf(e.getNode(l.source),o)&&c!==yf(e.getNode(l.target),o));return _n(f,l=>At(r,l))},dy=(e,r,t,n)=>{const i=e.getRelatedEdges(t.source,"both").find(s=>s.source===t.target||s.target===t.target);i&&e.removeEdge(i.id),e.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),vf(e),pf(e,r),gy(e,r)},gy=(e,r)=>{const t=e.getAllNodes().find(i=>!i.data.parent);let n=Qc(e,t,"pre");n=n.slice(1),n.forEach(i=>{const s=e.getNode(i).data.parent;let a=r.getRelatedEdges(i,"out").find(c=>c.target===s),o=!1;!a&&r.hasNode(s)&&(a=r.getRelatedEdges(s,"out").find(c=>c.target===i),o=!0),r.getNode(i).data.rank=(r.hasNode(s)&&r.getNode(s).data.rank||0)+(o?a==null?void 0:a.data.minlen:-(a==null?void 0:a.data.minlen))})},py=(e,r,t)=>e.getRelatedEdges(r,"both").find(n=>n.source===t||n.target===t),yf=(e,r)=>r.data.low<=e.data.lim&&e.data.lim<=r.data.lim,vy=(e,r)=>{switch(r){case"network-simplex":yy(e);break;case"tight-tree":wf(e);break;case"longest-path":my(e);break;default:wf(e)}},my=hf,wf=e=>{ny(e),oy(e)},yy=e=>{uy(e)},wy=(e,r)=>{const{edgeLabelSpace:t,keepNodeOrder:n,prevGraph:i,rankdir:s,ranksep:a}=r;!n&&i&&_y(e,i);const o=qy(e);t&&(r.ranksep=Ry(o,{rankdir:s,ranksep:a}));let c;try{c=by(o,r)}catch(f){if(f.message==="Not possible to find intersection inside of the rectangle"){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:
6
+ `,f);return}throw f}return Ey(e,o),c},by=(e,r)=>{const{ranker:t,rankdir:n="tb",nodeOrder:i,keepNodeOrder:s,align:a,nodesep:o=50,edgesep:c=20,ranksep:f=50}=r;Ly(e),im(e);const{nestingRoot:l,nodeRankFactor:p}=mm(e);vy(Yc(e),t),Oy(e),fm(e,p),bm(e,l),cm(e),Ay(e),Iy(e);const m=[];Em(e,m),Bm(e,m),hm(e),s&&Dm(e,i),Lm(e,s),Dy(e),dm(e,n),ry(e,{align:a,nodesep:o,edgesep:c,ranksep:f}),zy(e),Py(e),Nm(e,m),jy(e),gm(e,n);const{width:y,height:x}=Ty(e);return ky(e),Cy(e),sm(e),{width:y,height:x}},_y=(e,r)=>{e.getAllNodes().forEach(t=>{const n=e.getNode(t.id);if(r.hasNode(t.id)){const i=r.getNode(t.id);n.data.fixorder=i.data._order,delete i.data._order}else delete n.data.fixorder})},Ey=(e,r)=>{e.getAllNodes().forEach(t=>{var n;const i=e.getNode(t.id);if(i){const s=r.getNode(t.id);i.data.x=s.data.x,i.data.y=s.data.y,i.data._order=s.data.order,i.data._rank=s.data.rank,!((n=r.getChildren(t.id))===null||n===void 0)&&n.length&&(i.data.width=s.data.width,i.data.height=s.data.height)}}),e.getAllEdges().forEach(t=>{const n=e.getEdge(t.id),i=r.getEdge(t.id);n.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(n.data.x=i.data.x,n.data.y=i.data.y)})},xy=["width","height","layer","fixorder"],Ny={width:0,height:0},My=["minlen","weight","width","height","labeloffset"],Sy={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Mn=["labelpos"],qy=e=>{const r=new Be({tree:[]});return e.getAllNodes().forEach(t=>{const n=_f(e.getNode(t.id).data),i=Object.assign(Object.assign({},Ny),n),s=bf(i,xy);r.hasNode(t.id)||r.addNode({id:t.id,data:Object.assign({},s)});const a=e.hasTreeStructure("combo")?e.getParent(t.id,"combo"):e.getParent(t.id);G0(a)||(r.hasNode(a.id)||r.addNode(Object.assign({},a)),r.setParent(t.id,a.id))}),e.getAllEdges().forEach(t=>{const n=_f(e.getEdge(t.id).data),i={};Mn==null||Mn.forEach(s=>{n[s]!==void 0&&(i[s]=n[s])}),r.addEdge({id:t.id,source:t.source,target:t.target,data:Object.assign({},Sy,bf(n,My),i)})}),r},Ry=(e,r)=>{const{ranksep:t=0,rankdir:n}=r;return e.getAllNodes().forEach(i=>{isNaN(i.data.layer)||i.data.layer||(i.data.layer=0)}),e.getAllEdges().forEach(i=>{var s;i.data.minlen*=2,((s=i.data.labelpos)===null||s===void 0?void 0:s.toLowerCase())!=="c"&&(n==="TB"||n==="BT"?i.data.width+=i.data.labeloffset:i.data.height+=i.data.labeloffset)}),t/2},Oy=e=>{e.getAllEdges().forEach(r=>{if(r.data.width&&r.data.height){const t=e.getNode(r.source),n=e.getNode(r.target),i={e:r,rank:(n.data.rank-t.data.rank)/2+t.data.rank};Wt(e,"edge-proxy",i,"_ep")}})},Ay=e=>{let r=0;return e.getAllNodes().forEach(t=>{var n,i;t.data.borderTop&&(t.data.minRank=(n=e.getNode(t.data.borderTop))===null||n===void 0?void 0:n.data.rank,t.data.maxRank=(i=e.getNode(t.data.borderBottom))===null||i===void 0?void 0:i.data.rank,r=Math.max(r,t.data.maxRank||-1/0))}),r},Iy=e=>{e.getAllNodes().forEach(r=>{r.data.dummy==="edge-proxy"&&(e.getEdge(r.data.e.id).data.labelRank=r.data.rank,e.removeNode(r.id))})},Ty=(e,r)=>{let t,n=0,i,s=0;const{marginx:a=0,marginy:o=0}={},c=f=>{if(!f.data)return;const l=f.data.x,p=f.data.y,m=f.data.width,y=f.data.height;!isNaN(l)&&!isNaN(m)&&(t===void 0&&(t=l-m/2),t=Math.min(t,l-m/2),n=Math.max(n,l+m/2)),!isNaN(p)&&!isNaN(y)&&(i===void 0&&(i=p-y/2),i=Math.min(i,p-y/2),s=Math.max(s,p+y/2))};return e.getAllNodes().forEach(f=>{c(f)}),e.getAllEdges().forEach(f=>{f!=null&&f.data.hasOwnProperty("x")&&c(f)}),t-=a,i-=o,e.getAllNodes().forEach(f=>{f.data.x-=t,f.data.y-=i}),e.getAllEdges().forEach(f=>{var l;(l=f.data.points)===null||l===void 0||l.forEach(p=>{p.x-=t,p.y-=i}),f.data.hasOwnProperty("x")&&(f.data.x-=t),f.data.hasOwnProperty("y")&&(f.data.y-=i)}),{width:n-t+a,height:s-i+o}},ky=e=>{e.getAllEdges().forEach(r=>{const t=e.getNode(r.source),n=e.getNode(r.target);let i,s;r.data.points?(i=r.data.points[0],s=r.data.points[r.data.points.length-1]):(r.data.points=[],i={x:n.data.x,y:n.data.y},s={x:t.data.x,y:t.data.y}),r.data.points.unshift(Kc(t.data,i)),r.data.points.push(Kc(n.data,s))})},jy=e=>{e.getAllEdges().forEach(r=>{if(r.data.hasOwnProperty("x"))switch((r.data.labelpos==="l"||r.data.labelpos==="r")&&(r.data.width-=r.data.labeloffset),r.data.labelpos){case"l":r.data.x-=r.data.width/2+r.data.labeloffset;break;case"r":r.data.x+=r.data.width/2+r.data.labeloffset;break}})},Cy=e=>{e.getAllEdges().forEach(r=>{var t;r.data.reversed&&((t=r.data.points)===null||t===void 0||t.reverse())})},Py=e=>{e.getAllNodes().forEach(r=>{var t,n,i;if(!((t=e.getChildren(r.id))===null||t===void 0)&&t.length){const s=e.getNode(r.id),a=e.getNode(s.data.borderTop),o=e.getNode(s.data.borderBottom),c=e.getNode(s.data.borderLeft[((n=s.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),f=e.getNode(s.data.borderRight[((i=s.data.borderRight)===null||i===void 0?void 0:i.length)-1]);s.data.width=Math.abs((f==null?void 0:f.data.x)-(c==null?void 0:c.data.x))||10,s.data.height=Math.abs((o==null?void 0:o.data.y)-(a==null?void 0:a.data.y))||10,s.data.x=((c==null?void 0:c.data.x)||0)+s.data.width/2,s.data.y=((a==null?void 0:a.data.y)||0)+s.data.height/2}}),e.getAllNodes().forEach(r=>{r.data.dummy==="border"&&e.removeNode(r.id)})},Ly=e=>{e.getAllEdges().forEach(r=>{if(r.source===r.target){const t=e.getNode(r.source);t.data.selfEdges||(t.data.selfEdges=[]),t.data.selfEdges.push(r),e.removeEdge(r.id)}})},Dy=e=>{const r=or(e);r==null||r.forEach(t=>{let n=0;t==null||t.forEach((i,s)=>{var a;const o=e.getNode(i);o.data.order=s+n,(a=o.data.selfEdges)===null||a===void 0||a.forEach(c=>{Wt(e,"selfedge",{width:c.data.width,height:c.data.height,rank:o.data.rank,order:s+ ++n,e:c},"_se")}),delete o.data.selfEdges})})},zy=e=>{e.getAllNodes().forEach(r=>{const t=e.getNode(r.id);if(t.data.dummy==="selfedge"){const n=e.getNode(t.data.e.source),i=n.data.x+n.data.width/2,s=n.data.y,a=t.data.x-i,o=n.data.height/2;e.hasEdge(t.data.e.id)?e.updateEdgeData(t.data.e.id,t.data.e.data):e.addEdge({id:t.data.e.id,source:t.data.e.source,target:t.data.e.target,data:t.data.e.data}),e.removeNode(r.id),t.data.e.data.points=[{x:i+2*a/3,y:s-o},{x:i+5*a/6,y:s-o},{y:s,x:i+a},{x:i+5*a/6,y:s+o},{x:i+2*a/3,y:s+o}],t.data.e.data.x=t.data.x,t.data.e.data.y=t.data.y}})},bf=(e,r)=>{const t={};return r==null||r.forEach(n=>{e[n]!==void 0&&(t[n]=+e[n])}),t},_f=(e={})=>{const r={};return Object.keys(e).forEach(t=>{r[t.toLowerCase()]=e[t]}),r},bt=Array.isArray,Ef=e=>{const r=[],t=e.length;for(let n=0;n<t;n+=1){r[n]=[];for(let i=0;i<t;i+=1)n===i?r[n][i]=0:e[n][i]===0||!e[n][i]?r[n][i]=1/0:r[n][i]=e[n][i]}for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)for(let s=0;s<t;s+=1)r[i][s]>r[i][n]+r[n][s]&&(r[i][s]=r[i][n]+r[n][s]);return r},xf=(e,r)=>{const{nodes:t,edges:n}=e,i=[],s={};if(!t)throw new Error("invalid nodes data!");return t&&t.forEach((a,o)=>{s[a.id]=o;const c=[];i.push(c)}),n==null||n.forEach(a=>{const{source:o,target:c}=a,f=s[o],l=s[c];f===void 0||l===void 0||(i[f][l]=1,i[l][f]=1)}),i},Fy=(e,r)=>{const t=[];return e.forEach(n=>{const i=[];n.forEach(s=>{i.push(s*r)}),t.push(i)}),t},By=e=>{let r=1/0,t=1/0,n=-1/0,i=-1/0;return e.forEach(s=>{let a=s.data.size;bt(a)?a.length===1&&(a=[a[0],a[0]]):me(a)?a=[a,a]:(a===void 0||isNaN(a))&&(a=[30,30]);const o=[a[0]/2,a[1]/2],c=s.data.x-o[0],f=s.data.x+o[0],l=s.data.y-o[1],p=s.data.y+o[1];r>c&&(r=c),t>l&&(t=l),n<f&&(n=f),i<p&&(i=p)}),{minX:r,minY:t,maxX:n,maxY:i}},Nf=(e,r)=>Math.sqrt((e.x-r.x)*(e.x-r.x)+(e.y-r.y)*(e.y-r.y)),Sn=(e,r,t,n="TB",i,s={})=>{if(!(r!=null&&r.length))return;const{stopBranchFn:a,stopAllFn:o}=s;for(let c=0;c<r.length;c++){const f=r[c];if(e.hasNode(f.id)&&!(a!=null&&a(f))){if(o!=null&&o(f))return;n==="TB"&&t(f),Sn(e,e.getChildren(f.id,i),t,n,i,s),n!=="TB"&&t(f)}}},qn=e=>{if(e===null)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){const r=[];return e.forEach(t=>{r.push(t)}),r.map(t=>qn(t))}if(typeof e=="object"){const r={};return Object.keys(e).forEach(t=>{r[t]=qn(e[t])}),r}return e},it=(e,r)=>{const t=qn(e);return t.data=t.data||{},r&&(me(t.data.x)||(t.data.x=Math.random()*r[0]),me(t.data.y)||(t.data.y=Math.random()*r[1])),t};function ar(e){if(!e)return[0,0,0];if(me(e))return[e,e,e];if(e.length===0)return[0,0,0];const[r,t=r,n=r]=e;return[r,t,n]}function Pt(e,r){let t;return wt(r)?t=r:me(r)?t=()=>r:t=()=>e,t}function Rn(e,r,t=!0){return!r&&r!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?t?Math.max(...i)||e:i:Vt(i)&&i.width&&i.height?t?Math.max(i.width,i.height)||e:[i.width,i.height]:i:e}:wt(r)?r:me(r)?()=>r:Array.isArray(r)?()=>t?Math.max(...r)||e:r:Vt(r)&&r.width&&r.height?()=>t?Math.max(r.width,r.height)||e:[r.width,r.height]:()=>e}const On=(e,r,t=10)=>{let n;const i=typeof r=="function"?r:()=>r||0;return e?Array.isArray(e)?n=a=>e:wt(e)?n=e:n=a=>e:n=a=>{var o,c,f;if(!((o=a.data)===null||o===void 0)&&o.bboxSize)return(c=a.data)===null||c===void 0?void 0:c.bboxSize;if(!((f=a.data)===null||f===void 0)&&f.size){const l=a.data.size;return Array.isArray(l)?l:Vt(l)?[l.width,l.height]:l}return t},a=>{const o=n(a),c=i(a);return Math.max(...ar(o))+c}},$y={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class Gy{constructor(r={}){this.options=r,this.id="antv-dagre",this.options=Object.assign(Object.assign({},$y),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,r,t)})}genericDagreLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:s,align:a,rankdir:o="TB",ranksep:c,nodesep:f,ranksepFunc:l,nodesepFunc:p,edgeLabelSpace:m,ranker:y,nodeOrder:x,begin:_,controlPoints:b,radial:w,sortByCombo:E,preset:N}=i,S=new Be({tree:[]}),R=Pt(c||50,l),A=Pt(f||50,p);let j=A,I=R;(o==="LR"||o==="RL")&&(j=R,I=A);const D=Rn(10,s,!1),z=t.getAllNodes(),$=t.getAllEdges();z.forEach(Z=>{const ce=ar(D(Z)),pe=I(Z),he=j(Z),ie=ce[0]+2*he,_e=ce[1]+2*pe,G=Z.data.layer;me(G)?S.addNode({id:Z.id,data:{width:ie,height:_e,layer:G}}):S.addNode({id:Z.id,data:{width:ie,height:_e}})}),E&&(S.attachTreeStructure("combo"),z.forEach(Z=>{const{parentId:ce}=Z.data;ce!==void 0&&S.hasNode(ce)&&S.setParent(Z.id,ce,"combo")})),$.forEach(Z=>{S.addEdge({id:Z.id,source:Z.source,target:Z.target,data:{weight:Z.data.weight||1}})});let V;N!=null&&N.length&&(V=new Be({nodes:N})),wy(S,{prevGraph:V,edgeLabelSpace:m,keepNodeOrder:!!x,nodeOrder:x||[],acyclicer:"greedy",ranker:y,rankdir:o,nodesep:f,align:a});const Y=[0,0];if(_){let Z=1/0,ce=1/0;S.getAllNodes().forEach(pe=>{Z>pe.data.x&&(Z=pe.data.x),ce>pe.data.y&&(ce=pe.data.y)}),S.getAllEdges().forEach(pe=>{var he;(he=pe.data.points)===null||he===void 0||he.forEach(ie=>{Z>ie.x&&(Z=ie.x),ce>ie.y&&(ce=ie.y)})}),Y[0]=_[0]-Z,Y[1]=_[1]-ce}const ee=o==="LR"||o==="RL";if(!w){const Z=new Set,pe=o==="BT"||o==="RL"?(G,P)=>P-G:(G,P)=>G-P;S.getAllNodes().forEach(G=>{G.data.x=G.data.x+Y[0],G.data.y=G.data.y+Y[1],Z.add(ee?G.data.x:G.data.y)});const he=Array.from(Z).sort(pe),ie=ee?(G,P)=>G.x!==P.x:(G,P)=>G.y!==P.y,_e=ee?(G,P,X)=>{const te=Math.max(P.y,X.y),le=Math.min(P.y,X.y);return G.filter(xe=>xe.y<=te&&xe.y>=le)}:(G,P,X)=>{const te=Math.max(P.x,X.x),le=Math.min(P.x,X.x);return G.filter(xe=>xe.x<=te&&xe.x>=le)};S.getAllEdges().forEach((G,P)=>{var X;m&&b&&G.data.type!=="loop"&&(G.data.controlPoints=Uy((X=G.data.points)===null||X===void 0?void 0:X.map(({x:te,y:le})=>({x:te+Y[0],y:le+Y[1]})),S.getNode(G.source),S.getNode(G.target),he,ee,ie,_e))})}let J=[];J=S.getAllNodes().map(Z=>it(Z));const ue=S.getAllEdges();return r&&(J.forEach(Z=>{t.mergeNodeData(Z.id,{x:Z.data.x,y:Z.data.y})}),ue.forEach(Z=>{t.mergeEdgeData(Z.id,{controlPoints:Z.data.controlPoints})})),{nodes:J,edges:ue}})}}const Uy=(e,r,t,n,i,s,a)=>{let o=(e==null?void 0:e.slice(1,e.length-1))||[];if(r&&t){let{x:c,y:f}=r.data,{x:l,y:p}=t.data;if(i&&(c=r.data.y,f=r.data.x,l=t.data.y,p=t.data.x),p!==f&&c!==l){const m=n.indexOf(f),y=n[m+1];if(y){const b=o[0],w=i?{x:(f+y)/2,y:(b==null?void 0:b.y)||l}:{x:(b==null?void 0:b.x)||l,y:(f+y)/2};(!b||s(b,w))&&o.unshift(w)}const x=n.indexOf(p),_=Math.abs(x-m);if(_===1)o=a(o,r.data,t.data),o.length||o.push(i?{x:(f+p)/2,y:c}:{x:c,y:(f+p)/2});else if(_>1){const b=n[x-1];if(b){const w=o[o.length-1],E=i?{x:(p+b)/2,y:(w==null?void 0:w.y)||l}:{x:(w==null?void 0:w.x)||c,y:(p+b)/2};(!w||s(w,E))&&o.push(E)}}}}return o},Lt=(e,r,t)=>{const n=e.getAllNodes(),i=e.getAllEdges();if(!(n!=null&&n.length))return{nodes:[],edges:i};if(n.length===1)return r&&e.mergeNodeData(n[0].id,{x:t[0],y:t[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:t[0],y:t[1]})})],edges:i}},Vy={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class Wy{constructor(r={}){this.options=r,this.id="circular",this.options=Object.assign(Object.assign({},Vy),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,r,t)})}genericCircularLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:s,height:a,center:o,divisions:c,startAngle:f=0,endAngle:l=2*Math.PI,angleRatio:p,ordering:m,clockwise:y,nodeSpacing:x,nodeSize:_}=i,b=t.getAllNodes(),w=t.getAllEdges(),[E,N,S]=Ky(s,a,o),R=b==null?void 0:b.length;if(!R||R===1)return Lt(t,r,S);const A=(l-f)/R;let{radius:j,startRadius:I,endRadius:D}=i;if(x){const ee=Pt(10,x),J=Rn(10,_);let ue=-1/0;b.forEach(Z=>{const ce=J(Z);ue<ce&&(ue=ce)});let be=0;b.forEach((Z,ce)=>{ce===0?be+=ue||10:be+=(ee(Z)||0)+(ue||10)}),j=be/(2*Math.PI)}else!j&&!I&&!D?j=Math.min(N,E)/2:!I&&D?I=D:I&&!D&&(D=I);const z=A*p;let $=[];m==="topology"?$=Mf(t,b):m==="topology-directed"?$=Mf(t,b,!0):m==="degree"?$=Yy(t,b):$=b.map(ee=>it(ee));const V=Math.ceil(R/c);for(let ee=0;ee<R;++ee){let J=j;!J&&I!==null&&D!==null&&(J=I+ee*(D-I)/(R-1)),J||(J=10+ee*100/(R-1));let ue=f+ee%V*z+2*Math.PI/c*Math.floor(ee/V);y||(ue=l-ee%V*z-2*Math.PI/c*Math.floor(ee/V)),$[ee].data.x=S[0]+Math.cos(ue)*J,$[ee].data.y=S[1]+Math.sin(ue)*J}return r&&$.forEach(ee=>{t.mergeNodeData(ee.id,{x:ee.data.x,y:ee.data.y})}),{nodes:$,edges:w}})}}const Mf=(e,r,t=!1)=>{const n=[it(r[0])],i={},s=r.length;i[r[0].id]=!0;let a=0;return r.forEach((o,c)=>{if(c!==0)if((c===s-1||e.getDegree(o.id,"both")!==e.getDegree(r[c+1].id,"both")||e.areNeighbors(n[a].id,o.id))&&!i[o.id])n.push(it(o)),i[o.id]=!0,a++;else{const f=t?e.getSuccessors(n[a].id):e.getNeighbors(n[a].id);let l=!1;for(let m=0;m<f.length;m++){const y=f[m];if(e.getDegree(y.id)===e.getDegree(o.id)&&!i[y.id]){n.push(it(y)),i[y.id]=!0,l=!0;break}}let p=0;for(;!l&&(i[r[p].id]||(n.push(it(r[p])),i[r[p].id]=!0,l=!0),p++,p!==s););}}),n};function Yy(e,r){const t=[];return r.forEach((n,i)=>{t.push(it(n))}),t.sort((n,i)=>e.getDegree(n.id,"both")-e.getDegree(i.id,"both")),t}const Ky=(e,r,t)=>{let n=e,i=r,s=t;return!n&&typeof window!="undefined"&&(n=window.innerWidth),!i&&typeof window!="undefined"&&(i=window.innerHeight),s||(s=[n/2,i/2]),[n,i,s]},Xy={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class An{constructor(r={}){this.options=r,this.id="concentric",this.options=Object.assign(Object.assign({},Xy),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,r,t)})}genericConcentricLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:s,width:a,height:o,sortBy:c,maxLevelDiff:f,sweep:l,clockwise:p,equidistant:m,preventOverlap:y,startAngle:x=3/2*Math.PI,nodeSize:_,nodeSpacing:b}=i,w=t.getAllNodes(),E=t.getAllEdges(),N=!a&&typeof window!="undefined"?window.innerWidth:a,S=!o&&typeof window!="undefined"?window.innerHeight:o,R=s||[N/2,S/2];if(!(w!=null&&w.length)||w.length===1)return Lt(t,r,R);const A=[];let j,I=0;bt(_)?j=Math.max(_[0],_[1]):wt(_)?(j=-1/0,w.forEach(Z=>{const ce=Math.max(...ar(_(Z)));ce>j&&(j=ce)})):j=_,bt(b)?I=Math.max(b[0],b[1]):me(b)&&(I=b),w.forEach(Z=>{const ce=it(Z);A.push(ce);let pe=j;const{data:he}=ce;bt(he.size)?pe=Math.max(he.size[0],he.size[1]):me(he.size)?pe=he.size:Vt(he.size)&&(pe=Math.max(he.size.width,he.size.height)),j=Math.max(j,pe),wt(b)&&(I=Math.max(b(Z),I))});const D={};A.forEach((Z,ce)=>{D[Z.id]=ce});let z=c;(!sr(z)||A[0].data[z]===void 0)&&(z="degree"),z==="degree"?A.sort((Z,ce)=>t.getDegree(ce.id,"both")-t.getDegree(Z.id,"both")):A.sort((Z,ce)=>ce.data[z]-Z.data[z]);const $=A[0],V=(f||(z==="degree"?t.getDegree($.id,"both"):$.data[z]))/4,Y=[{nodes:[]}];let ee=Y[0];A.forEach(Z=>{if(ee.nodes.length>0){const ce=Math.abs(z==="degree"?t.getDegree(ee.nodes[0].id,"both")-t.getDegree(Z.id,"both"):ee.nodes[0].data[z]-Z.data[z]);V&&ce>=V&&(ee={nodes:[]},Y.push(ee))}ee.nodes.push(Z)});let J=j+I;if(!y){const Z=Y.length>0&&Y[0].nodes.length>1,pe=(Math.min(N,S)/2-J)/(Y.length+(Z?1:0));J=Math.min(J,pe)}let ue=0;if(Y.forEach(Z=>{const ce=l===void 0?2*Math.PI-2*Math.PI/Z.nodes.length:l;if(Z.dTheta=ce/Math.max(1,Z.nodes.length-1),Z.nodes.length>1&&y){const pe=Math.cos(Z.dTheta)-Math.cos(0),he=Math.sin(Z.dTheta)-Math.sin(0),ie=Math.sqrt(J*J/(pe*pe+he*he));ue=Math.max(ie,ue)}Z.r=ue,ue+=J}),m){let Z=0,ce=0;for(let pe=0;pe<Y.length;pe++){const ie=(Y[pe].r||0)-ce;Z=Math.max(Z,ie)}ce=0,Y.forEach((pe,he)=>{he===0&&(ce=pe.r||0),pe.r=ce,ce+=Z})}return Y.forEach(Z=>{const ce=Z.dTheta||0,pe=Z.r||0;Z.nodes.forEach((he,ie)=>{const _e=x+(p?1:-1)*ce*ie;he.data.x=R[0]+pe*Math.cos(_e),he.data.y=R[1]+pe*Math.sin(_e)})}),r&&A.forEach(Z=>t.mergeNodeData(Z.id,{x:Z.data.x,y:Z.data.y})),{nodes:A,edges:E}})}}function Zy(e){const r=+this._x.call(null,e),t=+this._y.call(null,e);return Sf(this.cover(r,t),r,t,e)}function Sf(e,r,t,n){if(isNaN(r)||isNaN(t))return e;var i,s=e._root,a={data:n},o=e._x0,c=e._y0,f=e._x1,l=e._y1,p,m,y,x,_,b,w,E;if(!s)return e._root=a,e;for(;s.length;)if((_=r>=(p=(o+f)/2))?o=p:f=p,(b=t>=(m=(c+l)/2))?c=m:l=m,i=s,!(s=s[w=b<<1|_]))return i[w]=a,e;if(y=+e._x.call(null,s.data),x=+e._y.call(null,s.data),r===y&&t===x)return a.next=s,i?i[w]=a:e._root=a,e;do i=i?i[w]=new Array(4):e._root=new Array(4),(_=r>=(p=(o+f)/2))?o=p:f=p,(b=t>=(m=(c+l)/2))?c=m:l=m;while((w=b<<1|_)===(E=(x>=m)<<1|y>=p));return i[E]=s,i[w]=a,e}function Jy(e){var r,t,n=e.length,i,s,a=new Array(n),o=new Array(n),c=1/0,f=1/0,l=-1/0,p=-1/0;for(t=0;t<n;++t)isNaN(i=+this._x.call(null,r=e[t]))||isNaN(s=+this._y.call(null,r))||(a[t]=i,o[t]=s,i<c&&(c=i),i>l&&(l=i),s<f&&(f=s),s>p&&(p=s));if(c>l||f>p)return this;for(this.cover(c,f).cover(l,p),t=0;t<n;++t)Sf(this,a[t],o[t],e[t]);return this}function Qy(e,r){if(isNaN(e=+e)||isNaN(r=+r))return this;var t=this._x0,n=this._y0,i=this._x1,s=this._y1;if(isNaN(t))i=(t=Math.floor(e))+1,s=(n=Math.floor(r))+1;else{for(var a=i-t||1,o=this._root,c,f;t>e||e>=i||n>r||r>=s;)switch(f=(r<n)<<1|e<t,c=new Array(4),c[f]=o,o=c,a*=2,f){case 0:i=t+a,s=n+a;break;case 1:t=i-a,s=n+a;break;case 2:i=t+a,n=s-a;break;case 3:t=i-a,n=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=n,this._x1=i,this._y1=s,this}function Hy(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}function ew(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function et(e,r,t,n,i){this.node=e,this.x0=r,this.y0=t,this.x1=n,this.y1=i}function tw(e,r,t){var n,i=this._x0,s=this._y0,a,o,c,f,l=this._x1,p=this._y1,m=[],y=this._root,x,_;for(y&&m.push(new et(y,i,s,l,p)),t==null?t=1/0:(i=e-t,s=r-t,l=e+t,p=r+t,t*=t);x=m.pop();)if(!(!(y=x.node)||(a=x.x0)>l||(o=x.y0)>p||(c=x.x1)<i||(f=x.y1)<s))if(y.length){var b=(a+c)/2,w=(o+f)/2;m.push(new et(y[3],b,w,c,f),new et(y[2],a,w,b,f),new et(y[1],b,o,c,w),new et(y[0],a,o,b,w)),(_=(r>=w)<<1|e>=b)&&(x=m[m.length-1],m[m.length-1]=m[m.length-1-_],m[m.length-1-_]=x)}else{var E=e-+this._x.call(null,y.data),N=r-+this._y.call(null,y.data),S=E*E+N*N;if(S<t){var R=Math.sqrt(t=S);i=e-R,s=r-R,l=e+R,p=r+R,n=y.data}}return n}function rw(e){if(isNaN(l=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e)))return this;var r,t=this._root,n,i,s,a=this._x0,o=this._y0,c=this._x1,f=this._y1,l,p,m,y,x,_,b,w;if(!t)return this;if(t.length)for(;;){if((x=l>=(m=(a+c)/2))?a=m:c=m,(_=p>=(y=(o+f)/2))?o=y:f=y,r=t,!(t=t[b=_<<1|x]))return this;if(!t.length)break;(r[b+1&3]||r[b+2&3]||r[b+3&3])&&(n=r,w=b)}for(;t.data!==e;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):r?(s?r[b]=s:delete r[b],(t=r[0]||r[1]||r[2]||r[3])&&t===(r[3]||r[2]||r[1]||r[0])&&!t.length&&(n?n[w]=t:this._root=t),this):(this._root=s,this)}function nw(e){for(var r=0,t=e.length;r<t;++r)this.remove(e[r]);return this}function iw(){return this._root}function sw(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}function ow(e){var r=[],t,n=this._root,i,s,a,o,c;for(n&&r.push(new et(n,this._x0,this._y0,this._x1,this._y1));t=r.pop();)if(!e(n=t.node,s=t.x0,a=t.y0,o=t.x1,c=t.y1)&&n.length){var f=(s+o)/2,l=(a+c)/2;(i=n[3])&&r.push(new et(i,f,l,o,c)),(i=n[2])&&r.push(new et(i,s,l,f,c)),(i=n[1])&&r.push(new et(i,f,a,o,l)),(i=n[0])&&r.push(new et(i,s,a,f,l))}return this}function aw(e){var r=[],t=[],n;for(this._root&&r.push(new et(this._root,this._x0,this._y0,this._x1,this._y1));n=r.pop();){var i=n.node;if(i.length){var s,a=n.x0,o=n.y0,c=n.x1,f=n.y1,l=(a+c)/2,p=(o+f)/2;(s=i[0])&&r.push(new et(s,a,o,l,p)),(s=i[1])&&r.push(new et(s,l,o,c,p)),(s=i[2])&&r.push(new et(s,a,p,l,f)),(s=i[3])&&r.push(new et(s,l,p,c,f))}t.push(n)}for(;n=t.pop();)e(n.node,n.x0,n.y0,n.x1,n.y1);return this}function uw(e){return e[0]}function cw(e){return arguments.length?(this._x=e,this):this._x}function fw(e){return e[1]}function lw(e){return arguments.length?(this._y=e,this):this._y}function Yt(e,r,t){var n=new In(r==null?uw:r,t==null?fw:t,NaN,NaN,NaN,NaN);return e==null?n:n.addAll(e)}function In(e,r,t,n,i,s){this._x=e,this._y=r,this._x0=t,this._y0=n,this._x1=i,this._y1=s,this._root=void 0}function qf(e){for(var r={data:e.data},t=r;e=e.next;)t=t.next={data:e.data};return r}var tt=Yt.prototype=In.prototype;tt.copy=function(){var e=new In(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root,t,n;if(!r)return e;if(!r.length)return e._root=qf(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=qf(n));return e},tt.add=Zy,tt.addAll=Jy,tt.cover=Qy,tt.data=Hy,tt.extent=ew,tt.find=tw,tt.remove=rw,tt.removeAll=nw,tt.root=iw,tt.size=sw,tt.visit=ow,tt.visitAfter=aw,tt.x=cw,tt.y=lw;function hw(e){const r=+this._x.call(null,e),t=+this._y.call(null,e),n=+this._z.call(null,e);return Rf(this.cover(r,t,n),r,t,n,e)}function Rf(e,r,t,n,i){if(isNaN(r)||isNaN(t)||isNaN(n))return e;var s,a=e._root,o={data:i},c=e._x0,f=e._y0,l=e._z0,p=e._x1,m=e._y1,y=e._z1,x,_,b,w,E,N,S,R,A,j,I;if(!a)return e._root=o,e;for(;a.length;)if((S=r>=(x=(c+p)/2))?c=x:p=x,(R=t>=(_=(f+m)/2))?f=_:m=_,(A=n>=(b=(l+y)/2))?l=b:y=b,s=a,!(a=a[j=A<<2|R<<1|S]))return s[j]=o,e;if(w=+e._x.call(null,a.data),E=+e._y.call(null,a.data),N=+e._z.call(null,a.data),r===w&&t===E&&n===N)return o.next=a,s?s[j]=o:e._root=o,e;do s=s?s[j]=new Array(8):e._root=new Array(8),(S=r>=(x=(c+p)/2))?c=x:p=x,(R=t>=(_=(f+m)/2))?f=_:m=_,(A=n>=(b=(l+y)/2))?l=b:y=b;while((j=A<<2|R<<1|S)===(I=(N>=b)<<2|(E>=_)<<1|w>=x));return s[I]=a,s[j]=o,e}function dw(e){Array.isArray(e)||(e=Array.from(e));const r=e.length,t=new Float64Array(r),n=new Float64Array(r),i=new Float64Array(r);let s=1/0,a=1/0,o=1/0,c=-1/0,f=-1/0,l=-1/0;for(let p=0,m,y,x,_;p<r;++p)isNaN(y=+this._x.call(null,m=e[p]))||isNaN(x=+this._y.call(null,m))||isNaN(_=+this._z.call(null,m))||(t[p]=y,n[p]=x,i[p]=_,y<s&&(s=y),y>c&&(c=y),x<a&&(a=x),x>f&&(f=x),_<o&&(o=_),_>l&&(l=_));if(s>c||a>f||o>l)return this;this.cover(s,a,o).cover(c,f,l);for(let p=0;p<r;++p)Rf(this,t[p],n[p],i[p],e[p]);return this}function gw(e,r,t){if(isNaN(e=+e)||isNaN(r=+r)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,s=this._z0,a=this._x1,o=this._y1,c=this._z1;if(isNaN(n))a=(n=Math.floor(e))+1,o=(i=Math.floor(r))+1,c=(s=Math.floor(t))+1;else{for(var f=a-n||1,l=this._root,p,m;n>e||e>=a||i>r||r>=o||s>t||t>=c;)switch(m=(t<s)<<2|(r<i)<<1|e<n,p=new Array(8),p[m]=l,l=p,f*=2,m){case 0:a=n+f,o=i+f,c=s+f;break;case 1:n=a-f,o=i+f,c=s+f;break;case 2:a=n+f,i=o-f,c=s+f;break;case 3:n=a-f,i=o-f,c=s+f;break;case 4:a=n+f,o=i+f,s=c-f;break;case 5:n=a-f,o=i+f,s=c-f;break;case 6:a=n+f,i=o-f,s=c-f;break;case 7:n=a-f,i=o-f,s=c-f;break}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=i,this._z0=s,this._x1=a,this._y1=o,this._z1=c,this}function pw(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}function vw(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Oe(e,r,t,n,i,s,a){this.node=e,this.x0=r,this.y0=t,this.z0=n,this.x1=i,this.y1=s,this.z1=a}function mw(e,r,t,n){var i,s=this._x0,a=this._y0,o=this._z0,c,f,l,p,m,y,x=this._x1,_=this._y1,b=this._z1,w=[],E=this._root,N,S;for(E&&w.push(new Oe(E,s,a,o,x,_,b)),n==null?n=1/0:(s=e-n,a=r-n,o=t-n,x=e+n,_=r+n,b=t+n,n*=n);N=w.pop();)if(!(!(E=N.node)||(c=N.x0)>x||(f=N.y0)>_||(l=N.z0)>b||(p=N.x1)<s||(m=N.y1)<a||(y=N.z1)<o))if(E.length){var R=(c+p)/2,A=(f+m)/2,j=(l+y)/2;w.push(new Oe(E[7],R,A,j,p,m,y),new Oe(E[6],c,A,j,R,m,y),new Oe(E[5],R,f,j,p,A,y),new Oe(E[4],c,f,j,R,A,y),new Oe(E[3],R,A,l,p,m,j),new Oe(E[2],c,A,l,R,m,j),new Oe(E[1],R,f,l,p,A,j),new Oe(E[0],c,f,l,R,A,j)),(S=(t>=j)<<2|(r>=A)<<1|e>=R)&&(N=w[w.length-1],w[w.length-1]=w[w.length-1-S],w[w.length-1-S]=N)}else{var I=e-+this._x.call(null,E.data),D=r-+this._y.call(null,E.data),z=t-+this._z.call(null,E.data),$=I*I+D*D+z*z;if($<n){var V=Math.sqrt(n=$);s=e-V,a=r-V,o=t-V,x=e+V,_=r+V,b=t+V,i=E.data}}return i}const yw=(e,r,t,n,i,s)=>Math.sqrt(Ot(e-n,2)+Ot(r-i,2)+Ot(t-s,2));function ww(e,r,t,n){const i=[],s=e-n,a=r-n,o=t-n,c=e+n,f=r+n,l=t+n;return this.visit((p,m,y,x,_,b,w)=>{if(!p.length)do{const E=p.data;yw(e,r,t,this._x(E),this._y(E),this._z(E))<=n&&i.push(E)}while(p=p.next);return m>c||y>f||x>l||_<s||b<a||w<o}),i}function bw(e){if(isNaN(m=+this._x.call(null,e))||isNaN(y=+this._y.call(null,e))||isNaN(x=+this._z.call(null,e)))return this;var r,t=this._root,n,i,s,a=this._x0,o=this._y0,c=this._z0,f=this._x1,l=this._y1,p=this._z1,m,y,x,_,b,w,E,N,S,R,A;if(!t)return this;if(t.length)for(;;){if((E=m>=(_=(a+f)/2))?a=_:f=_,(N=y>=(b=(o+l)/2))?o=b:l=b,(S=x>=(w=(c+p)/2))?c=w:p=w,r=t,!(t=t[R=S<<2|N<<1|E]))return this;if(!t.length)break;(r[R+1&7]||r[R+2&7]||r[R+3&7]||r[R+4&7]||r[R+5&7]||r[R+6&7]||r[R+7&7])&&(n=r,A=R)}for(;t.data!==e;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):r?(s?r[R]=s:delete r[R],(t=r[0]||r[1]||r[2]||r[3]||r[4]||r[5]||r[6]||r[7])&&t===(r[7]||r[6]||r[5]||r[4]||r[3]||r[2]||r[1]||r[0])&&!t.length&&(n?n[A]=t:this._root=t),this):(this._root=s,this)}function _w(e){for(var r=0,t=e.length;r<t;++r)this.remove(e[r]);return this}function Ew(){return this._root}function xw(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}function Nw(e){var r=[],t,n=this._root,i,s,a,o,c,f,l;for(n&&r.push(new Oe(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=r.pop();)if(!e(n=t.node,s=t.x0,a=t.y0,o=t.z0,c=t.x1,f=t.y1,l=t.z1)&&n.length){var p=(s+c)/2,m=(a+f)/2,y=(o+l)/2;(i=n[7])&&r.push(new Oe(i,p,m,y,c,f,l)),(i=n[6])&&r.push(new Oe(i,s,m,y,p,f,l)),(i=n[5])&&r.push(new Oe(i,p,a,y,c,m,l)),(i=n[4])&&r.push(new Oe(i,s,a,y,p,m,l)),(i=n[3])&&r.push(new Oe(i,p,m,o,c,f,y)),(i=n[2])&&r.push(new Oe(i,s,m,o,p,f,y)),(i=n[1])&&r.push(new Oe(i,p,a,o,c,m,y)),(i=n[0])&&r.push(new Oe(i,s,a,o,p,m,y))}return this}function Mw(e){var r=[],t=[],n;for(this._root&&r.push(new Oe(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=r.pop();){var i=n.node;if(i.length){var s,a=n.x0,o=n.y0,c=n.z0,f=n.x1,l=n.y1,p=n.z1,m=(a+f)/2,y=(o+l)/2,x=(c+p)/2;(s=i[0])&&r.push(new Oe(s,a,o,c,m,y,x)),(s=i[1])&&r.push(new Oe(s,m,o,c,f,y,x)),(s=i[2])&&r.push(new Oe(s,a,y,c,m,l,x)),(s=i[3])&&r.push(new Oe(s,m,y,c,f,l,x)),(s=i[4])&&r.push(new Oe(s,a,o,x,m,y,p)),(s=i[5])&&r.push(new Oe(s,m,o,x,f,y,p)),(s=i[6])&&r.push(new Oe(s,a,y,x,m,l,p)),(s=i[7])&&r.push(new Oe(s,m,y,x,f,l,p))}t.push(n)}for(;n=t.pop();)e(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function Sw(e){return e[0]}function qw(e){return arguments.length?(this._x=e,this):this._x}function Rw(e){return e[1]}function Ow(e){return arguments.length?(this._y=e,this):this._y}function Aw(e){return e[2]}function Iw(e){return arguments.length?(this._z=e,this):this._z}function Ar(e,r,t,n){var i=new Tn(r==null?Sw:r,t==null?Rw:t,n==null?Aw:n,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Tn(e,r,t,n,i,s,a,o,c){this._x=e,this._y=r,this._z=t,this._x0=n,this._y0=i,this._z0=s,this._x1=a,this._y1=o,this._z1=c,this._root=void 0}function Of(e){for(var r={data:e.data},t=r;e=e.next;)t=t.next={data:e.data};return r}var Ke=Ar.prototype=Tn.prototype;Ke.copy=function(){var e=new Tn(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root,t,n;if(!r)return e;if(!r.length)return e._root=Of(r),e;for(t=[{source:r,target:e._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(8)}):r.target[i]=Of(n));return e},Ke.add=hw,Ke.addAll=dw,Ke.cover=gw,Ke.data=pw,Ke.extent=vw,Ke.find=mw,Ke.findAllWithinRadius=ww,Ke.remove=bw,Ke.removeAll=_w,Ke.root=Ew,Ke.size=xw,Ke.visit=Nw,Ke.visitAfter=Mw,Ke.x=qw,Ke.y=Ow,Ke.z=Iw;const Tw=.81,kn=.1;function kw(e,r,t,n,i=2){const s=r/t,a=e.getAllNodes(),o=a.map((l,p)=>{const{nodeStrength:m,x:y,y:x,z:_,size:b}=l.data;return{x:y,y:x,z:_,size:b,index:p,id:l.id,vx:0,vy:0,vz:0,weight:s*m}}),c=(i===2?Yt(o,l=>l.x,l=>l.y):Ar(o,l=>l.x,l=>l.y,l=>l.z)).visitAfter(jw),f=new Map;return o.forEach(l=>{f.set(l.id,l),Pw(l,c,i)}),o.map((l,p)=>{const{id:m,data:y}=a[p],{mass:x=1}=y;n[m]={x:l.vx/x,y:l.vy/x,z:l.vz/x}}),n}function jw(e){let r=0,t=0,n=0,i=0,s=0;const a=e.length;if(a){for(let o=0;o<a;o++){const c=e[o];c&&c.weight&&(r+=c.weight,t+=c.x*c.weight,n+=c.y*c.weight,i+=c.z*c.weight,s+=c.size*c.weight)}e.x=t/r,e.y=n/r,e.z=i/r,e.size=s/r,e.weight=r}else{const o=e;e.x=o.data.x,e.y=o.data.y,e.z=o.data.z,e.size=o.data.size,e.weight=o.data.weight}}const Cw=(e,r,t,n,i,s,a)=>{var o;if(((o=e.data)===null||o===void 0?void 0:o.id)===s.id)return;const c=[t,n,i][a-1],f=s.x-e.x||kn,l=s.y-e.y||kn,p=s.z-e.z||kn,m=[f,l,p],y=c-r;let x=0;for(let w=0;w<a;w++)x+=m[w]*m[w];const b=Math.sqrt(x)*x;if(y*y*Tw<x){const w=e.weight/b;return s.vx+=f*w,s.vy+=l*w,s.vz+=p*w,!0}if(e.length)return!1;if(e.data!==s){const w=e.data.weight/b;s.vx+=f*w,s.vy+=l*w,s.vz+=p*w}};function Pw(e,r,t){r.visit((n,i,s,a,o)=>Cw(n,i,s,a,o,e,t))}const Lw={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Af{constructor(r={}){this.options=r,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Lw),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericForceLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,r,t)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(r=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<r;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const t={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&t.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),t}genericForceLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),s=t.getAllNodes(),a=t.getAllEdges(),o=this.formatOptions(i,t),{dimensions:c,width:f,height:l,nodeSize:p,getMass:m,nodeStrength:y,edgeStrength:x,linkDistance:_}=o,b=s.map((I,D)=>Object.assign(Object.assign({},I),{data:Object.assign(Object.assign({},I.data),{x:me(I.data.x)?I.data.x:Math.random()*f,y:me(I.data.y)?I.data.y:Math.random()*l,z:me(I.data.z)?I.data.z:Math.random()*Math.sqrt(f*l),size:p(I)||30,mass:m(I),nodeStrength:y(I)})})),w=a.map(I=>Object.assign(Object.assign({},I),{data:Object.assign(Object.assign({},I.data),{edgeStrength:x(I),linkDistance:_(I,t.getNode(I.source),t.getNode(I.target))})}));if(!(s!=null&&s.length))return this.lastResult={nodes:[],edges:a},{nodes:[],edges:a};const E={};s.forEach((I,D)=>{E[I.id]={x:0,y:0,z:0}});const N=new Be({nodes:b,edges:w});this.formatCentripetal(o,N);const{maxIteration:S,minMovement:R,onTick:A}=o;if(this.lastLayoutNodes=b,this.lastLayoutEdges=w,this.lastAssign=r,this.lastGraph=t,this.lastCalcGraph=N,this.lastOptions=o,this.lastVelMap=E,typeof window=="undefined")return;let j=0;return new Promise(I=>{this.timeInterval=window.setInterval(()=>{(!s||!this.running)&&I({nodes:jn(t,b),edges:a}),this.runOneStep(N,t,j,E,o),this.updatePosition(t,N,E,o),r&&b.forEach(D=>t.mergeNodeData(D.id,{x:D.data.x,y:D.data.y,z:c===3?D.data.z:void 0})),A==null||A({nodes:jn(t,b),edges:a}),j++,(j>=S||this.judgingDistance<R)&&(window.clearInterval(this.timeInterval),I({nodes:jn(t,b),edges:a}))},0),this.running=!0})})}formatOptions(r,t){const n=Object.assign({},r),{width:i,height:s,getMass:a}=r;n.width=!i&&typeof window!="undefined"?window.innerWidth:i,n.height=!s&&typeof window!="undefined"?window.innerHeight:s,r.center||(n.center=[n.width/2,n.height/2]),a||(n.getMass=c=>{let f=1;me(c==null?void 0:c.data.mass)&&(f=c==null?void 0:c.data.mass);const l=t.getDegree(c.id,"both");return!l||l<5?f:l*5*f}),n.nodeSize=On(r.nodeSize,r.nodeSpacing);const o=r.linkDistance?Pt(1,r.linkDistance):c=>1+n.nodeSize(t.getNode(c.source))+n.nodeSize(t.getNode(c.target));return n.linkDistance=o,n.nodeStrength=Pt(1,r.nodeStrength),n.edgeStrength=Pt(1,r.edgeStrength),n}formatCentripetal(r,t){const{dimensions:n,centripetalOptions:i,center:s,clusterNodeStrength:a,leafCluster:o,clustering:c,nodeClusterBy:f}=r,l=t.getAllNodes(),p=i||{leaf:2,single:2,others:1,center:w=>({x:s[0],y:s[1],z:n===3?s[2]:void 0})};typeof a!="function"&&(r.clusterNodeStrength=w=>a);let m,y;if(o&&f&&(m=If(t,f),y=Array.from(new Set(l==null?void 0:l.map(w=>w.data[f])))||[],r.centripetalOptions=Object.assign(p,{single:100,leaf:w=>{const{siblingLeaves:E,sameTypeLeaves:N}=m[w.id]||{};return(N==null?void 0:N.length)===(E==null?void 0:E.length)||(y==null?void 0:y.length)===1?1:r.clusterNodeStrength(w)},others:1,center:w=>{const E=t.getDegree(w.id,"both");if(!E)return{x:100,y:100,z:0};let N;if(E===1){const{sameTypeLeaves:S=[]}=m[w.id]||{};S.length===1?N=void 0:S.length>1&&(N=Tf(S))}else N=void 0;return{x:N==null?void 0:N.x,y:N==null?void 0:N.y,z:N==null?void 0:N.z}}})),c&&f){m||(m=If(t,f)),y||(y=Array.from(new Set(l.map(E=>E.data[f])))),y=y.filter(E=>E!==void 0);const w={};y.forEach(E=>{const N=l.filter(S=>S.data[f]===E).map(S=>t.getNode(S.id));w[E]=Tf(N)}),r.centripetalOptions=Object.assign(p,{single:E=>r.clusterNodeStrength(E),leaf:E=>r.clusterNodeStrength(E),others:E=>r.clusterNodeStrength(E),center:E=>{const N=w[E.data[f]];return{x:N==null?void 0:N.x,y:N==null?void 0:N.y,z:N==null?void 0:N.z}}})}const{leaf:x,single:_,others:b}=r.centripetalOptions||{};x&&typeof x!="function"&&(r.centripetalOptions.leaf=()=>x),_&&typeof _!="function"&&(r.centripetalOptions.single=()=>_),b&&typeof b!="function"&&(r.centripetalOptions.others=()=>b)}runOneStep(r,t,n,i,s){const a={},o=r.getAllNodes(),c=r.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:f}=s;if(this.calRepulsive(r,a,s),c&&this.calAttractive(r,a,s),this.calGravity(r,t,a,s),this.updateVelocity(r,a,i,s),f){const l=this.calTotalEnergy(a,o);f({energy:l,nodes:t.getAllNodes(),edges:t.getAllEdges(),iterations:n})}}calTotalEnergy(r,t){if(!(t!=null&&t.length))return 0;let n=0;return t.forEach((i,s)=>{const a=r[i.id].x,o=r[i.id].y,c=this.options.dimensions===3?r[i.id].z:0,f=a*a+o*o+c*c,{mass:l=1}=i.data;n+=l*f*.5}),n}calRepulsive(r,t,n){const{dimensions:i,factor:s,coulombDisScale:a}=n;kw(r,s,a*a,t,i)}calAttractive(r,t,n){const{dimensions:i,nodeSize:s}=n;r.getAllEdges().forEach((a,o)=>{const{source:c,target:f}=a,l=r.getNode(c),p=r.getNode(f);if(!l||!p)return;let m=p.data.x-l.data.x,y=p.data.y-l.data.y,x=i===3?p.data.z-l.data.z:0;!m&&!y&&(m=Math.random()*.01,y=Math.random()*.01,i===3&&!x&&(x=Math.random()*.01));const _=Math.sqrt(m*m+y*y+x*x);if(_<s(l)+s(p))return;const b=m/_,w=y/_,E=x/_,{linkDistance:N=200,edgeStrength:S=200}=a.data||{},A=(N-_)*S,j=l.data.mass||1,I=p.data.mass||1,D=1/j,z=1/I,$=b*A,V=w*A,Y=E*A;t[c].x-=$*D,t[c].y-=V*D,t[c].z-=Y*D,t[f].x+=$*z,t[f].y+=V*z,t[f].z+=Y*z})}calGravity(r,t,n,i){const{getCenter:s}=i,a=r.getAllNodes(),o=t.getAllNodes(),c=t.getAllEdges(),{width:f,height:l,center:p,gravity:m,centripetalOptions:y}=i;a&&a.forEach(x=>{const{id:_,data:b}=x,{mass:w,x:E,y:N,z:S}=b,R=t.getNode(_);let A=0,j=0,I=0,D=m;const z=r.getDegree(_,"in"),$=r.getDegree(_,"out"),V=r.getDegree(_,"both"),Y=s==null?void 0:s(R,V);if(Y){const[ee,J,ue]=Y;A=E-ee,j=N-J,D=ue}else A=E-p[0],j=N-p[1],I=S-p[2];if(D&&(n[_].x-=D*A/w,n[_].y-=D*j/w,n[_].z-=D*I/w),y){const{leaf:ee,single:J,others:ue,center:be}=y,{x:Z,y:ce,z:pe,centerStrength:he}=(be==null?void 0:be(R,o,c,f,l))||{x:0,y:0,z:0,centerStrength:0};if(!me(Z)||!me(ce))return;const ie=(E-Z)/w,_e=(N-ce)/w,G=(S-pe)/w;if(he&&(n[_].x-=he*ie,n[_].y-=he*_e,n[_].z-=he*G),V===0){const X=J(R);if(!X)return;n[_].x-=X*ie,n[_].y-=X*_e,n[_].z-=X*G;return}if(z===0||$===0){const X=ee(R,o,c);if(!X)return;n[_].x-=X*ie,n[_].y-=X*_e,n[_].z-=X*G;return}const P=ue(R);if(!P)return;n[_].x-=P*ie,n[_].y-=P*_e,n[_].z-=P*G}})}updateVelocity(r,t,n,i){const{damping:s,maxSpeed:a,interval:o,dimensions:c}=i,f=r.getAllNodes();f!=null&&f.length&&f.forEach(l=>{const{id:p}=l;let m=(n[p].x+t[p].x*o)*s||.01,y=(n[p].y+t[p].y*o)*s||.01,x=c===3?(n[p].z+t[p].z*o)*s||.01:0;const _=Math.sqrt(m*m+y*y+x*x);if(_>a){const b=a/_;m=b*m,y=b*y,x=b*x}n[p]={x:m,y,z:x}})}updatePosition(r,t,n,i){const{distanceThresholdMode:s,interval:a,dimensions:o}=i,c=t.getAllNodes();if(!(c!=null&&c.length)){this.judgingDistance=0;return}let f=0;s==="max"?this.judgingDistance=-1/0:s==="min"&&(this.judgingDistance=1/0),c.forEach(l=>{const{id:p}=l,m=r.getNode(p);if(me(m.data.fx)&&me(m.data.fy)){t.mergeNodeData(p,{x:m.data.fx,y:m.data.fy,z:o===3?m.data.fz:void 0});return}const y=n[p].x*a,x=n[p].y*a,_=o===3?n[p].z*a:0;t.mergeNodeData(p,{x:l.data.x+y,y:l.data.y+x,z:l.data.z+_});const b=Math.sqrt(y*y+x*x+_*_);switch(s){case"max":this.judgingDistance<b&&(this.judgingDistance=b);break;case"min":this.judgingDistance>b&&(this.judgingDistance=b);break;default:f=f+b;break}}),(!s||s==="mean")&&(this.judgingDistance=f/c.length)}}const If=(e,r)=>{const t=e.getAllNodes();if(!(t!=null&&t.length))return{};const n={};return t.forEach((i,s)=>{e.getDegree(i.id,"both")===1&&(n[i.id]=Dw(e,"leaf",i,r))}),n},Dw=(e,r,t,n)=>{const i=e.getDegree(t.id,"in"),s=e.getDegree(t.id,"out");let a=t,o=[];i===0?(a=e.getSuccessors(t.id)[0],o=e.getNeighbors(a.id)):s===0&&(a=e.getPredecessors(t.id)[0],o=e.getNeighbors(a.id)),o=o.filter(f=>e.getDegree(f.id,"in")===0||e.getDegree(f.id,"out")===0);const c=zw(e,r,n,t,o);return{coreNode:a,siblingLeaves:o,sameTypeLeaves:c}},zw=(e,r,t,n,i)=>{const s=n.data[t]||"";let a=(i==null?void 0:i.filter(o=>o.data[t]===s))||[];return a=a.filter(o=>e.getDegree(o.id,"in")===0||e.getDegree(o.id,"out")===0),a},Tf=e=>{const r={x:0,y:0};e.forEach(n=>{const{x:i,y:s}=n.data;r.x+=i||0,r.y+=s||0});const t=e.length||1;return{x:r.x/t,y:r.y/t}},jn=(e,r)=>r.map(t=>{const{id:n,data:i}=t,s=e.getNode(n);return Object.assign(Object.assign({},s),{data:Object.assign(Object.assign({},s.data),{x:i.x,y:i.y,z:i.z})})});var Ir=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function kf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function jf(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var t=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),t}var we={};const Fw=Object.prototype.toString;function ur(e){const r=Fw.call(e);return r.endsWith("Array]")&&!r.includes("Big")}var Bw=Object.freeze({__proto__:null,isAnyArray:ur}),$w=jf(Bw);function Gw(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ur(e))throw new TypeError("input must be an array");if(e.length===0)throw new TypeError("input must not be empty");var t=r.fromIndex,n=t===void 0?0:t,i=r.toIndex,s=i===void 0?e.length:i;if(n<0||n>=e.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=n||s>e.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=e[n],o=n+1;o<s;o++)e[o]>a&&(a=e[o]);return a}function Uw(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ur(e))throw new TypeError("input must be an array");if(e.length===0)throw new TypeError("input must not be empty");var t=r.fromIndex,n=t===void 0?0:t,i=r.toIndex,s=i===void 0?e.length:i;if(n<0||n>=e.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(s<=n||s>e.length||!Number.isInteger(s))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=e[n],o=n+1;o<s;o++)e[o]<a&&(a=e[o]);return a}function Vw(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ur(e)){if(e.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(r.output!==void 0){if(!ur(r.output))throw new TypeError("output option must be an array if specified");t=r.output}else t=new Array(e.length);var n=Uw(e),i=Gw(e);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,a=s===void 0?r.autoMinMax?n:0:s,o=r.max,c=o===void 0?r.autoMinMax?i:1:o;if(a>=c)throw new RangeError("min option must be smaller than max option");for(var f=(c-a)/(i-n),l=0;l<e.length;l++)t[l]=(e[l]-n)*f+a;return t}var Ww=Object.freeze({__proto__:null,default:Vw}),Yw=jf(Ww),Cf;function Kw(){var _r,jc,He;if(Cf)return we;Cf=1,Object.defineProperty(we,"__esModule",{value:!0});var e=$w,r=Yw;const t=" ".repeat(2),n=" ".repeat(4);function i(){return s(this)}function s(M,g={}){const{maxRows:h=15,maxColumns:u=10,maxNumSize:d=8,padMinus:v="auto"}=g;return`${M.constructor.name} {
7
+ ${t}[
8
+ ${n}${a(M,h,u,d,v)}
9
+ ${t}]
10
+ ${t}rows: ${M.rows}
11
+ ${t}columns: ${M.columns}
12
+ }`}function a(M,g,h,u,d){const{rows:v,columns:q}=M,O=Math.min(v,g),T=Math.min(q,h),k=[];if(d==="auto"){d=!1;e:for(let B=0;B<O;B++)for(let C=0;C<T;C++)if(M.get(B,C)<0){d=!0;break e}}for(let B=0;B<O;B++){let C=[];for(let W=0;W<T;W++)C.push(o(M.get(B,W),u,d));k.push(`${C.join(" ")}`)}return T!==q&&(k[k.length-1]+=` ... ${q-h} more columns`),O!==v&&k.push(`... ${v-g} more rows`),k.join(`
13
+ ${n}`)}function o(M,g,h){return(M>=0&&h?` ${c(M,g-1)}`:c(M,g)).padEnd(g)}function c(M,g){let h=M.toString();if(h.length<=g)return h;let u=M.toFixed(g);if(u.length>g&&(u=M.toFixed(Math.max(0,g-(u.length-g)))),u.length<=g&&!u.startsWith("0.000")&&!u.startsWith("-0.000"))return u;let d=M.toExponential(g);return d.length>g&&(d=M.toExponential(Math.max(0,g-(d.length-g)))),d.slice(0)}function f(M,g){M.prototype.add=function(u){return typeof u=="number"?this.addS(u):this.addM(u)},M.prototype.addS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)+u);return this},M.prototype.addM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)+u.get(d,v));return this},M.add=function(u,d){return new g(u).add(d)},M.prototype.sub=function(u){return typeof u=="number"?this.subS(u):this.subM(u)},M.prototype.subS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)-u);return this},M.prototype.subM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)-u.get(d,v));return this},M.sub=function(u,d){return new g(u).sub(d)},M.prototype.subtract=M.prototype.sub,M.prototype.subtractS=M.prototype.subS,M.prototype.subtractM=M.prototype.subM,M.subtract=M.sub,M.prototype.mul=function(u){return typeof u=="number"?this.mulS(u):this.mulM(u)},M.prototype.mulS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)*u);return this},M.prototype.mulM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)*u.get(d,v));return this},M.mul=function(u,d){return new g(u).mul(d)},M.prototype.multiply=M.prototype.mul,M.prototype.multiplyS=M.prototype.mulS,M.prototype.multiplyM=M.prototype.mulM,M.multiply=M.mul,M.prototype.div=function(u){return typeof u=="number"?this.divS(u):this.divM(u)},M.prototype.divS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)/u);return this},M.prototype.divM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)/u.get(d,v));return this},M.div=function(u,d){return new g(u).div(d)},M.prototype.divide=M.prototype.div,M.prototype.divideS=M.prototype.divS,M.prototype.divideM=M.prototype.divM,M.divide=M.div,M.prototype.mod=function(u){return typeof u=="number"?this.modS(u):this.modM(u)},M.prototype.modS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)%u);return this},M.prototype.modM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)%u.get(d,v));return this},M.mod=function(u,d){return new g(u).mod(d)},M.prototype.modulus=M.prototype.mod,M.prototype.modulusS=M.prototype.modS,M.prototype.modulusM=M.prototype.modM,M.modulus=M.mod,M.prototype.and=function(u){return typeof u=="number"?this.andS(u):this.andM(u)},M.prototype.andS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)&u);return this},M.prototype.andM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)&u.get(d,v));return this},M.and=function(u,d){return new g(u).and(d)},M.prototype.or=function(u){return typeof u=="number"?this.orS(u):this.orM(u)},M.prototype.orS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)|u);return this},M.prototype.orM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)|u.get(d,v));return this},M.or=function(u,d){return new g(u).or(d)},M.prototype.xor=function(u){return typeof u=="number"?this.xorS(u):this.xorM(u)},M.prototype.xorS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)^u);return this},M.prototype.xorM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)^u.get(d,v));return this},M.xor=function(u,d){return new g(u).xor(d)},M.prototype.leftShift=function(u){return typeof u=="number"?this.leftShiftS(u):this.leftShiftM(u)},M.prototype.leftShiftS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)<<u);return this},M.prototype.leftShiftM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)<<u.get(d,v));return this},M.leftShift=function(u,d){return new g(u).leftShift(d)},M.prototype.signPropagatingRightShift=function(u){return typeof u=="number"?this.signPropagatingRightShiftS(u):this.signPropagatingRightShiftM(u)},M.prototype.signPropagatingRightShiftS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)>>u);return this},M.prototype.signPropagatingRightShiftM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)>>u.get(d,v));return this},M.signPropagatingRightShift=function(u,d){return new g(u).signPropagatingRightShift(d)},M.prototype.rightShift=function(u){return typeof u=="number"?this.rightShiftS(u):this.rightShiftM(u)},M.prototype.rightShiftS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)>>>u);return this},M.prototype.rightShiftM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,this.get(d,v)>>>u.get(d,v));return this},M.rightShift=function(u,d){return new g(u).rightShift(d)},M.prototype.zeroFillRightShift=M.prototype.rightShift,M.prototype.zeroFillRightShiftS=M.prototype.rightShiftS,M.prototype.zeroFillRightShiftM=M.prototype.rightShiftM,M.zeroFillRightShift=M.rightShift,M.prototype.not=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,~this.get(u,d));return this},M.not=function(u){return new g(u).not()},M.prototype.abs=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.abs(this.get(u,d)));return this},M.abs=function(u){return new g(u).abs()},M.prototype.acos=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.acos(this.get(u,d)));return this},M.acos=function(u){return new g(u).acos()},M.prototype.acosh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.acosh(this.get(u,d)));return this},M.acosh=function(u){return new g(u).acosh()},M.prototype.asin=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.asin(this.get(u,d)));return this},M.asin=function(u){return new g(u).asin()},M.prototype.asinh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.asinh(this.get(u,d)));return this},M.asinh=function(u){return new g(u).asinh()},M.prototype.atan=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.atan(this.get(u,d)));return this},M.atan=function(u){return new g(u).atan()},M.prototype.atanh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.atanh(this.get(u,d)));return this},M.atanh=function(u){return new g(u).atanh()},M.prototype.cbrt=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.cbrt(this.get(u,d)));return this},M.cbrt=function(u){return new g(u).cbrt()},M.prototype.ceil=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.ceil(this.get(u,d)));return this},M.ceil=function(u){return new g(u).ceil()},M.prototype.clz32=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.clz32(this.get(u,d)));return this},M.clz32=function(u){return new g(u).clz32()},M.prototype.cos=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.cos(this.get(u,d)));return this},M.cos=function(u){return new g(u).cos()},M.prototype.cosh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.cosh(this.get(u,d)));return this},M.cosh=function(u){return new g(u).cosh()},M.prototype.exp=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.exp(this.get(u,d)));return this},M.exp=function(u){return new g(u).exp()},M.prototype.expm1=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.expm1(this.get(u,d)));return this},M.expm1=function(u){return new g(u).expm1()},M.prototype.floor=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.floor(this.get(u,d)));return this},M.floor=function(u){return new g(u).floor()},M.prototype.fround=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.fround(this.get(u,d)));return this},M.fround=function(u){return new g(u).fround()},M.prototype.log=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.log(this.get(u,d)));return this},M.log=function(u){return new g(u).log()},M.prototype.log1p=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.log1p(this.get(u,d)));return this},M.log1p=function(u){return new g(u).log1p()},M.prototype.log10=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.log10(this.get(u,d)));return this},M.log10=function(u){return new g(u).log10()},M.prototype.log2=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.log2(this.get(u,d)));return this},M.log2=function(u){return new g(u).log2()},M.prototype.round=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.round(this.get(u,d)));return this},M.round=function(u){return new g(u).round()},M.prototype.sign=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.sign(this.get(u,d)));return this},M.sign=function(u){return new g(u).sign()},M.prototype.sin=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.sin(this.get(u,d)));return this},M.sin=function(u){return new g(u).sin()},M.prototype.sinh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.sinh(this.get(u,d)));return this},M.sinh=function(u){return new g(u).sinh()},M.prototype.sqrt=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.sqrt(this.get(u,d)));return this},M.sqrt=function(u){return new g(u).sqrt()},M.prototype.tan=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.tan(this.get(u,d)));return this},M.tan=function(u){return new g(u).tan()},M.prototype.tanh=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.tanh(this.get(u,d)));return this},M.tanh=function(u){return new g(u).tanh()},M.prototype.trunc=function(){for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.set(u,d,Math.trunc(this.get(u,d)));return this},M.trunc=function(u){return new g(u).trunc()},M.pow=function(u,d){return new g(u).pow(d)},M.prototype.pow=function(u){return typeof u=="number"?this.powS(u):this.powM(u)},M.prototype.powS=function(u){for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,Ot(this.get(d,v),u));return this},M.prototype.powM=function(u){if(u=g.checkMatrix(u),this.rows!==u.rows||this.columns!==u.columns)throw new RangeError("Matrices dimensions must be equal");for(let d=0;d<this.rows;d++)for(let v=0;v<this.columns;v++)this.set(d,v,Ot(this.get(d,v),u.get(d,v)));return this}}function l(M,g,h){let u=h?M.rows:M.rows-1;if(g<0||g>u)throw new RangeError("Row index out of range")}function p(M,g,h){let u=h?M.columns:M.columns-1;if(g<0||g>u)throw new RangeError("Column index out of range")}function m(M,g){if(g.to1DArray&&(g=g.to1DArray()),g.length!==M.columns)throw new RangeError("vector size must be the same as the number of columns");return g}function y(M,g){if(g.to1DArray&&(g=g.to1DArray()),g.length!==M.rows)throw new RangeError("vector size must be the same as the number of rows");return g}function x(M,g){if(!e.isAnyArray(g))throw new TypeError("row indices must be an array");for(let h=0;h<g.length;h++)if(g[h]<0||g[h]>=M.rows)throw new RangeError("row indices are out of range")}function _(M,g){if(!e.isAnyArray(g))throw new TypeError("column indices must be an array");for(let h=0;h<g.length;h++)if(g[h]<0||g[h]>=M.columns)throw new RangeError("column indices are out of range")}function b(M,g,h,u,d){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(E("startRow",g),E("endRow",h),E("startColumn",u),E("endColumn",d),g>h||u>d||g<0||g>=M.rows||h<0||h>=M.rows||u<0||u>=M.columns||d<0||d>=M.columns)throw new RangeError("Submatrix indices are out of range")}function w(M,g=0){let h=[];for(let u=0;u<M;u++)h.push(g);return h}function E(M,g){if(typeof g!="number")throw new TypeError(`${M} must be a number`)}function N(M){if(M.isEmpty())throw new Error("Empty matrix has no elements to index")}function S(M){let g=w(M.rows);for(let h=0;h<M.rows;++h)for(let u=0;u<M.columns;++u)g[h]+=M.get(h,u);return g}function R(M){let g=w(M.columns);for(let h=0;h<M.rows;++h)for(let u=0;u<M.columns;++u)g[u]+=M.get(h,u);return g}function A(M){let g=0;for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)g+=M.get(h,u);return g}function j(M){let g=w(M.rows,1);for(let h=0;h<M.rows;++h)for(let u=0;u<M.columns;++u)g[h]*=M.get(h,u);return g}function I(M){let g=w(M.columns,1);for(let h=0;h<M.rows;++h)for(let u=0;u<M.columns;++u)g[u]*=M.get(h,u);return g}function D(M){let g=1;for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)g*=M.get(h,u);return g}function z(M,g,h){const u=M.rows,d=M.columns,v=[];for(let q=0;q<u;q++){let O=0,T=0,k=0;for(let B=0;B<d;B++)k=M.get(q,B)-h[q],O+=k,T+=k*k;g?v.push((T-O*O/d)/(d-1)):v.push((T-O*O/d)/d)}return v}function $(M,g,h){const u=M.rows,d=M.columns,v=[];for(let q=0;q<d;q++){let O=0,T=0,k=0;for(let B=0;B<u;B++)k=M.get(B,q)-h[q],O+=k,T+=k*k;g?v.push((T-O*O/u)/(u-1)):v.push((T-O*O/u)/u)}return v}function V(M,g,h){const u=M.rows,d=M.columns,v=u*d;let q=0,O=0,T=0;for(let k=0;k<u;k++)for(let B=0;B<d;B++)T=M.get(k,B)-h,q+=T,O+=T*T;return g?(O-q*q/v)/(v-1):(O-q*q/v)/v}function Y(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)-g[h])}function ee(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)-g[u])}function J(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)-g)}function ue(M){const g=[];for(let h=0;h<M.rows;h++){let u=0;for(let d=0;d<M.columns;d++)u+=Ot(M.get(h,d),2)/(M.columns-1);g.push(Math.sqrt(u))}return g}function be(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)/g[h])}function Z(M){const g=[];for(let h=0;h<M.columns;h++){let u=0;for(let d=0;d<M.rows;d++)u+=Ot(M.get(d,h),2)/(M.rows-1);g.push(Math.sqrt(u))}return g}function ce(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)/g[u])}function pe(M){const g=M.size-1;let h=0;for(let u=0;u<M.columns;u++)for(let d=0;d<M.rows;d++)h+=Ot(M.get(d,u),2)/g;return Math.sqrt(h)}function he(M,g){for(let h=0;h<M.rows;h++)for(let u=0;u<M.columns;u++)M.set(h,u,M.get(h,u)/g)}class ie{static from1DArray(g,h,u){if(g*h!==u.length)throw new RangeError("data length does not match given dimensions");let v=new P(g,h);for(let q=0;q<g;q++)for(let O=0;O<h;O++)v.set(q,O,u[q*h+O]);return v}static rowVector(g){let h=new P(1,g.length);for(let u=0;u<g.length;u++)h.set(0,u,g[u]);return h}static columnVector(g){let h=new P(g.length,1);for(let u=0;u<g.length;u++)h.set(u,0,g[u]);return h}static zeros(g,h){return new P(g,h)}static ones(g,h){return new P(g,h).fill(1)}static rand(g,h,u={}){if(typeof u!="object")throw new TypeError("options must be an object");const{random:d=Math.random}=u;let v=new P(g,h);for(let q=0;q<g;q++)for(let O=0;O<h;O++)v.set(q,O,d());return v}static randInt(g,h,u={}){if(typeof u!="object")throw new TypeError("options must be an object");const{min:d=0,max:v=1e3,random:q=Math.random}=u;if(!Number.isInteger(d))throw new TypeError("min must be an integer");if(!Number.isInteger(v))throw new TypeError("max must be an integer");if(d>=v)throw new RangeError("min must be smaller than max");let O=v-d,T=new P(g,h);for(let k=0;k<g;k++)for(let B=0;B<h;B++){let C=d+Math.round(q()*O);T.set(k,B,C)}return T}static eye(g,h,u){h===void 0&&(h=g),u===void 0&&(u=1);let d=Math.min(g,h),v=this.zeros(g,h);for(let q=0;q<d;q++)v.set(q,q,u);return v}static diag(g,h,u){let d=g.length;h===void 0&&(h=d),u===void 0&&(u=h);let v=Math.min(d,h,u),q=this.zeros(h,u);for(let O=0;O<v;O++)q.set(O,O,g[O]);return q}static min(g,h){g=this.checkMatrix(g),h=this.checkMatrix(h);let u=g.rows,d=g.columns,v=new P(u,d);for(let q=0;q<u;q++)for(let O=0;O<d;O++)v.set(q,O,Math.min(g.get(q,O),h.get(q,O)));return v}static max(g,h){g=this.checkMatrix(g),h=this.checkMatrix(h);let u=g.rows,d=g.columns,v=new this(u,d);for(let q=0;q<u;q++)for(let O=0;O<d;O++)v.set(q,O,Math.max(g.get(q,O),h.get(q,O)));return v}static checkMatrix(g){return ie.isMatrix(g)?g:new P(g)}static isMatrix(g){return g!=null&&g.klass==="Matrix"}get size(){return this.rows*this.columns}apply(g){if(typeof g!="function")throw new TypeError("callback must be a function");for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)g.call(this,h,u);return this}to1DArray(){let g=[];for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)g.push(this.get(h,u));return g}to2DArray(){let g=[];for(let h=0;h<this.rows;h++){g.push([]);for(let u=0;u<this.columns;u++)g[h].push(this.get(h,u))}return g}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let g=0;g<this.rows;g++)for(let h=0;h<=g;h++)if(this.get(g,h)!==this.get(h,g))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let g=0;g<this.rows;g++)if(this.get(g,g)!==0)return!1;return!0}isEchelonForm(){let g=0,h=0,u=-1,d=!0,v=!1;for(;g<this.rows&&d;){for(h=0,v=!1;h<this.columns&&v===!1;)this.get(g,h)===0?h++:this.get(g,h)===1&&h>u?(v=!0,u=h):(d=!1,v=!0);g++}return d}isReducedEchelonForm(){let g=0,h=0,u=-1,d=!0,v=!1;for(;g<this.rows&&d;){for(h=0,v=!1;h<this.columns&&v===!1;)this.get(g,h)===0?h++:this.get(g,h)===1&&h>u?(v=!0,u=h):(d=!1,v=!0);for(let q=h+1;q<this.rows;q++)this.get(g,q)!==0&&(d=!1);g++}return d}echelonForm(){let g=this.clone(),h=0,u=0;for(;h<g.rows&&u<g.columns;){let d=h;for(let v=h;v<g.rows;v++)g.get(v,u)>g.get(d,u)&&(d=v);if(g.get(d,u)===0)u++;else{g.swapRows(h,d);let v=g.get(h,u);for(let q=u;q<g.columns;q++)g.set(h,q,g.get(h,q)/v);for(let q=h+1;q<g.rows;q++){let O=g.get(q,u)/g.get(h,u);g.set(q,u,0);for(let T=u+1;T<g.columns;T++)g.set(q,T,g.get(q,T)-g.get(h,T)*O)}h++,u++}}return g}reducedEchelonForm(){let g=this.echelonForm(),h=g.columns,u=g.rows,d=u-1;for(;d>=0;)if(g.maxRow(d)===0)d--;else{let v=0,q=!1;for(;v<u&&q===!1;)g.get(d,v)===1?q=!0:v++;for(let O=0;O<d;O++){let T=g.get(O,v);for(let k=v;k<h;k++){let B=g.get(O,k)-T*g.get(d,k);g.set(O,k,B)}}d--}return g}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(g={}){if(typeof g!="object")throw new TypeError("options must be an object");const{rows:h=1,columns:u=1}=g;if(!Number.isInteger(h)||h<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(u)||u<=0)throw new TypeError("columns must be a positive integer");let d=new P(this.rows*h,this.columns*u);for(let v=0;v<h;v++)for(let q=0;q<u;q++)d.setSubMatrix(this,this.rows*v,this.columns*q);return d}fill(g){for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,g);return this}neg(){return this.mulS(-1)}getRow(g){l(this,g);let h=[];for(let u=0;u<this.columns;u++)h.push(this.get(g,u));return h}getRowVector(g){return P.rowVector(this.getRow(g))}setRow(g,h){l(this,g),h=m(this,h);for(let u=0;u<this.columns;u++)this.set(g,u,h[u]);return this}swapRows(g,h){l(this,g),l(this,h);for(let u=0;u<this.columns;u++){let d=this.get(g,u);this.set(g,u,this.get(h,u)),this.set(h,u,d)}return this}getColumn(g){p(this,g);let h=[];for(let u=0;u<this.rows;u++)h.push(this.get(u,g));return h}getColumnVector(g){return P.columnVector(this.getColumn(g))}setColumn(g,h){p(this,g),h=y(this,h);for(let u=0;u<this.rows;u++)this.set(u,g,h[u]);return this}swapColumns(g,h){p(this,g),p(this,h);for(let u=0;u<this.rows;u++){let d=this.get(u,g);this.set(u,g,this.get(u,h)),this.set(u,h,d)}return this}addRowVector(g){g=m(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)+g[u]);return this}subRowVector(g){g=m(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)-g[u]);return this}mulRowVector(g){g=m(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)*g[u]);return this}divRowVector(g){g=m(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)/g[u]);return this}addColumnVector(g){g=y(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)+g[h]);return this}subColumnVector(g){g=y(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)-g[h]);return this}mulColumnVector(g){g=y(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)*g[h]);return this}divColumnVector(g){g=y(this,g);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)this.set(h,u,this.get(h,u)/g[h]);return this}mulRow(g,h){l(this,g);for(let u=0;u<this.columns;u++)this.set(g,u,this.get(g,u)*h);return this}mulColumn(g,h){p(this,g);for(let u=0;u<this.rows;u++)this.set(u,g,this.get(u,g)*h);return this}max(g){if(this.isEmpty())return NaN;switch(g){case"row":{const h=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)>h[u]&&(h[u]=this.get(u,d));return h}case"column":{const h=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)>h[d]&&(h[d]=this.get(u,d));return h}case void 0:{let h=this.get(0,0);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)>h&&(h=this.get(u,d));return h}default:throw new Error(`invalid option: ${g}`)}}maxIndex(){N(this);let g=this.get(0,0),h=[0,0];for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)>g&&(g=this.get(u,d),h[0]=u,h[1]=d);return h}min(g){if(this.isEmpty())return NaN;switch(g){case"row":{const h=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)<h[u]&&(h[u]=this.get(u,d));return h}case"column":{const h=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)<h[d]&&(h[d]=this.get(u,d));return h}case void 0:{let h=this.get(0,0);for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)<h&&(h=this.get(u,d));return h}default:throw new Error(`invalid option: ${g}`)}}minIndex(){N(this);let g=this.get(0,0),h=[0,0];for(let u=0;u<this.rows;u++)for(let d=0;d<this.columns;d++)this.get(u,d)<g&&(g=this.get(u,d),h[0]=u,h[1]=d);return h}maxRow(g){if(l(this,g),this.isEmpty())return NaN;let h=this.get(g,0);for(let u=1;u<this.columns;u++)this.get(g,u)>h&&(h=this.get(g,u));return h}maxRowIndex(g){l(this,g),N(this);let h=this.get(g,0),u=[g,0];for(let d=1;d<this.columns;d++)this.get(g,d)>h&&(h=this.get(g,d),u[1]=d);return u}minRow(g){if(l(this,g),this.isEmpty())return NaN;let h=this.get(g,0);for(let u=1;u<this.columns;u++)this.get(g,u)<h&&(h=this.get(g,u));return h}minRowIndex(g){l(this,g),N(this);let h=this.get(g,0),u=[g,0];for(let d=1;d<this.columns;d++)this.get(g,d)<h&&(h=this.get(g,d),u[1]=d);return u}maxColumn(g){if(p(this,g),this.isEmpty())return NaN;let h=this.get(0,g);for(let u=1;u<this.rows;u++)this.get(u,g)>h&&(h=this.get(u,g));return h}maxColumnIndex(g){p(this,g),N(this);let h=this.get(0,g),u=[0,g];for(let d=1;d<this.rows;d++)this.get(d,g)>h&&(h=this.get(d,g),u[0]=d);return u}minColumn(g){if(p(this,g),this.isEmpty())return NaN;let h=this.get(0,g);for(let u=1;u<this.rows;u++)this.get(u,g)<h&&(h=this.get(u,g));return h}minColumnIndex(g){p(this,g),N(this);let h=this.get(0,g),u=[0,g];for(let d=1;d<this.rows;d++)this.get(d,g)<h&&(h=this.get(d,g),u[0]=d);return u}diag(){let g=Math.min(this.rows,this.columns),h=[];for(let u=0;u<g;u++)h.push(this.get(u,u));return h}norm(g="frobenius"){switch(g){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${g}`)}}cumulativeSum(){let g=0;for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)g+=this.get(h,u),this.set(h,u,g);return this}dot(g){ie.isMatrix(g)&&(g=g.to1DArray());let h=this.to1DArray();if(h.length!==g.length)throw new RangeError("vectors do not have the same size");let u=0;for(let d=0;d<h.length;d++)u+=h[d]*g[d];return u}mmul(g){g=P.checkMatrix(g);let h=this.rows,u=this.columns,d=g.columns,v=new P(h,d),q=new Float64Array(u);for(let O=0;O<d;O++){for(let T=0;T<u;T++)q[T]=g.get(T,O);for(let T=0;T<h;T++){let k=0;for(let B=0;B<u;B++)k+=this.get(T,B)*q[B];v.set(T,O,k)}}return v}mpow(g){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(g)||g<0)throw new RangeError("Exponent must be a non-negative integer");let h=P.eye(this.rows),u=this;for(let d=g;d>=1;d/=2)(d&1)!==0&&(h=h.mmul(u)),u=u.mmul(u);return h}strassen2x2(g){g=P.checkMatrix(g);let h=new P(2,2);const u=this.get(0,0),d=g.get(0,0),v=this.get(0,1),q=g.get(0,1),O=this.get(1,0),T=g.get(1,0),k=this.get(1,1),B=g.get(1,1),C=(u+k)*(d+B),W=(O+k)*d,ne=u*(q-B),U=k*(T-d),K=(u+v)*B,oe=(O-u)*(d+q),L=(v-k)*(T+B),re=C+U-K+L,fe=ne+K,ve=W+U,ye=C-W+ne+oe;return h.set(0,0,re),h.set(0,1,fe),h.set(1,0,ve),h.set(1,1,ye),h}strassen3x3(g){g=P.checkMatrix(g);let h=new P(3,3);const u=this.get(0,0),d=this.get(0,1),v=this.get(0,2),q=this.get(1,0),O=this.get(1,1),T=this.get(1,2),k=this.get(2,0),B=this.get(2,1),C=this.get(2,2),W=g.get(0,0),ne=g.get(0,1),U=g.get(0,2),K=g.get(1,0),oe=g.get(1,1),L=g.get(1,2),re=g.get(2,0),fe=g.get(2,1),ve=g.get(2,2),ye=(u+d+v-q-O-B-C)*oe,je=(u-q)*(-ne+oe),de=O*(-W+ne+K-oe-L-re+ve),ge=(-u+q+O)*(W-ne+oe),Ae=(q+O)*(-W+ne),F=u*W,Q=(-u+k+B)*(W-U+L),ae=(-u+k)*(U-L),H=(k+B)*(-W+U),Ce=(u+d+v-O-T-k-B)*L,qe=B*(-W+U+K-oe-L-re+fe),Ie=(-v+B+C)*(oe+re-fe),Pe=(v-C)*(oe-fe),Xe=v*re,dt=(B+C)*(-re+fe),Ge=(-v+O+T)*(L+re-ve),yt=(v-T)*(L-ve),Rt=(O+T)*(-re+ve),Ne=d*K,Ze=T*fe,st=q*U,ot=k*ne,Ue=C*ve,Xx=F+Xe+Ne,Zx=ye+ge+Ae+F+Ie+Xe+dt,Jx=F+Q+H+Ce+Xe+Ge+Rt,Qx=je+de+ge+F+Xe+Ge+yt,Hx=je+ge+Ae+F+Ze,eN=Xe+Ge+yt+Rt+st,tN=F+Q+ae+qe+Ie+Pe+Xe,rN=Ie+Pe+Xe+dt+ot,nN=F+Q+ae+H+Ue;return h.set(0,0,Xx),h.set(0,1,Zx),h.set(0,2,Jx),h.set(1,0,Qx),h.set(1,1,Hx),h.set(1,2,eN),h.set(2,0,tN),h.set(2,1,rN),h.set(2,2,nN),h}mmulStrassen(g){g=P.checkMatrix(g);let h=this.clone(),u=h.rows,d=h.columns,v=g.rows,q=g.columns;d!==v&&console.warn(`Multiplying ${u} x ${d} and ${v} x ${q} matrix: dimensions do not match.`);function O(C,W,ne){let U=C.rows,K=C.columns;if(U===W&&K===ne)return C;{let oe=ie.zeros(W,ne);return oe=oe.setSubMatrix(C,0,0),oe}}let T=Math.max(u,v),k=Math.max(d,q);h=O(h,T,k),g=O(g,T,k);function B(C,W,ne,U){if(ne<=512||U<=512)return C.mmul(W);ne%2===1&&U%2===1?(C=O(C,ne+1,U+1),W=O(W,ne+1,U+1)):ne%2===1?(C=O(C,ne+1,U),W=O(W,ne+1,U)):U%2===1&&(C=O(C,ne,U+1),W=O(W,ne,U+1));let K=parseInt(C.rows/2,10),oe=parseInt(C.columns/2,10),L=C.subMatrix(0,K-1,0,oe-1),re=W.subMatrix(0,K-1,0,oe-1),fe=C.subMatrix(0,K-1,oe,C.columns-1),ve=W.subMatrix(0,K-1,oe,W.columns-1),ye=C.subMatrix(K,C.rows-1,0,oe-1),je=W.subMatrix(K,W.rows-1,0,oe-1),de=C.subMatrix(K,C.rows-1,oe,C.columns-1),ge=W.subMatrix(K,W.rows-1,oe,W.columns-1),Ae=B(ie.add(L,de),ie.add(re,ge),K,oe),F=B(ie.add(ye,de),re,K,oe),Q=B(L,ie.sub(ve,ge),K,oe),ae=B(de,ie.sub(je,re),K,oe),H=B(ie.add(L,fe),ge,K,oe),Ce=B(ie.sub(ye,L),ie.add(re,ve),K,oe),qe=B(ie.sub(fe,de),ie.add(je,ge),K,oe),Ie=ie.add(Ae,ae);Ie.sub(H),Ie.add(qe);let Pe=ie.add(Q,H),Xe=ie.add(F,ae),dt=ie.sub(Ae,F);dt.add(Q),dt.add(Ce);let Ge=ie.zeros(2*Ie.rows,2*Ie.columns);return Ge=Ge.setSubMatrix(Ie,0,0),Ge=Ge.setSubMatrix(Pe,Ie.rows,0),Ge=Ge.setSubMatrix(Xe,0,Ie.columns),Ge=Ge.setSubMatrix(dt,Ie.rows,Ie.columns),Ge.subMatrix(0,ne-1,0,U-1)}return B(h,g,T,k)}scaleRows(g={}){if(typeof g!="object")throw new TypeError("options must be an object");const{min:h=0,max:u=1}=g;if(!Number.isFinite(h))throw new TypeError("min must be a number");if(!Number.isFinite(u))throw new TypeError("max must be a number");if(h>=u)throw new RangeError("min must be smaller than max");let d=new P(this.rows,this.columns);for(let v=0;v<this.rows;v++){const q=this.getRow(v);q.length>0&&r(q,{min:h,max:u,output:q}),d.setRow(v,q)}return d}scaleColumns(g={}){if(typeof g!="object")throw new TypeError("options must be an object");const{min:h=0,max:u=1}=g;if(!Number.isFinite(h))throw new TypeError("min must be a number");if(!Number.isFinite(u))throw new TypeError("max must be a number");if(h>=u)throw new RangeError("min must be smaller than max");let d=new P(this.rows,this.columns);for(let v=0;v<this.columns;v++){const q=this.getColumn(v);q.length&&r(q,{min:h,max:u,output:q}),d.setColumn(v,q)}return d}flipRows(){const g=Math.ceil(this.columns/2);for(let h=0;h<this.rows;h++)for(let u=0;u<g;u++){let d=this.get(h,u),v=this.get(h,this.columns-1-u);this.set(h,u,v),this.set(h,this.columns-1-u,d)}return this}flipColumns(){const g=Math.ceil(this.rows/2);for(let h=0;h<this.columns;h++)for(let u=0;u<g;u++){let d=this.get(u,h),v=this.get(this.rows-1-u,h);this.set(u,h,v),this.set(this.rows-1-u,h,d)}return this}kroneckerProduct(g){g=P.checkMatrix(g);let h=this.rows,u=this.columns,d=g.rows,v=g.columns,q=new P(h*d,u*v);for(let O=0;O<h;O++)for(let T=0;T<u;T++)for(let k=0;k<d;k++)for(let B=0;B<v;B++)q.set(d*O+k,v*T+B,this.get(O,T)*g.get(k,B));return q}kroneckerSum(g){if(g=P.checkMatrix(g),!this.isSquare()||!g.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let h=this.rows,u=g.rows,d=this.kroneckerProduct(P.eye(u,u)),v=P.eye(h,h).kroneckerProduct(g);return d.add(v)}transpose(){let g=new P(this.columns,this.rows);for(let h=0;h<this.rows;h++)for(let u=0;u<this.columns;u++)g.set(u,h,this.get(h,u));return g}sortRows(g=_e){for(let h=0;h<this.rows;h++)this.setRow(h,this.getRow(h).sort(g));return this}sortColumns(g=_e){for(let h=0;h<this.columns;h++)this.setColumn(h,this.getColumn(h).sort(g));return this}subMatrix(g,h,u,d){b(this,g,h,u,d);let v=new P(h-g+1,d-u+1);for(let q=g;q<=h;q++)for(let O=u;O<=d;O++)v.set(q-g,O-u,this.get(q,O));return v}subMatrixRow(g,h,u){if(h===void 0&&(h=0),u===void 0&&(u=this.columns-1),h>u||h<0||h>=this.columns||u<0||u>=this.columns)throw new RangeError("Argument out of range");let d=new P(g.length,u-h+1);for(let v=0;v<g.length;v++)for(let q=h;q<=u;q++){if(g[v]<0||g[v]>=this.rows)throw new RangeError(`Row index out of range: ${g[v]}`);d.set(v,q-h,this.get(g[v],q))}return d}subMatrixColumn(g,h,u){if(h===void 0&&(h=0),u===void 0&&(u=this.rows-1),h>u||h<0||h>=this.rows||u<0||u>=this.rows)throw new RangeError("Argument out of range");let d=new P(u-h+1,g.length);for(let v=0;v<g.length;v++)for(let q=h;q<=u;q++){if(g[v]<0||g[v]>=this.columns)throw new RangeError(`Column index out of range: ${g[v]}`);d.set(q-h,v,this.get(q,g[v]))}return d}setSubMatrix(g,h,u){if(g=P.checkMatrix(g),g.isEmpty())return this;let d=h+g.rows-1,v=u+g.columns-1;b(this,h,d,u,v);for(let q=0;q<g.rows;q++)for(let O=0;O<g.columns;O++)this.set(h+q,u+O,g.get(q,O));return this}selection(g,h){x(this,g),_(this,h);let u=new P(g.length,h.length);for(let d=0;d<g.length;d++){let v=g[d];for(let q=0;q<h.length;q++){let O=h[q];u.set(d,q,this.get(v,O))}}return u}trace(){let g=Math.min(this.rows,this.columns),h=0;for(let u=0;u<g;u++)h+=this.get(u,u);return h}clone(){return this.constructor.copy(this,new P(this.rows,this.columns))}static copy(g,h){for(const[u,d,v]of g.entries())h.set(u,d,v);return h}sum(g){switch(g){case"row":return S(this);case"column":return R(this);case void 0:return A(this);default:throw new Error(`invalid option: ${g}`)}}product(g){switch(g){case"row":return j(this);case"column":return I(this);case void 0:return D(this);default:throw new Error(`invalid option: ${g}`)}}mean(g){const h=this.sum(g);switch(g){case"row":{for(let u=0;u<this.rows;u++)h[u]/=this.columns;return h}case"column":{for(let u=0;u<this.columns;u++)h[u]/=this.rows;return h}case void 0:return h/this.size;default:throw new Error(`invalid option: ${g}`)}}variance(g,h={}){if(typeof g=="object"&&(h=g,g=void 0),typeof h!="object")throw new TypeError("options must be an object");const{unbiased:u=!0,mean:d=this.mean(g)}=h;if(typeof u!="boolean")throw new TypeError("unbiased must be a boolean");switch(g){case"row":{if(!e.isAnyArray(d))throw new TypeError("mean must be an array");return z(this,u,d)}case"column":{if(!e.isAnyArray(d))throw new TypeError("mean must be an array");return $(this,u,d)}case void 0:{if(typeof d!="number")throw new TypeError("mean must be a number");return V(this,u,d)}default:throw new Error(`invalid option: ${g}`)}}standardDeviation(g,h){typeof g=="object"&&(h=g,g=void 0);const u=this.variance(g,h);if(g===void 0)return Math.sqrt(u);for(let d=0;d<u.length;d++)u[d]=Math.sqrt(u[d]);return u}center(g,h={}){if(typeof g=="object"&&(h=g,g=void 0),typeof h!="object")throw new TypeError("options must be an object");const{center:u=this.mean(g)}=h;switch(g){case"row":{if(!e.isAnyArray(u))throw new TypeError("center must be an array");return Y(this,u),this}case"column":{if(!e.isAnyArray(u))throw new TypeError("center must be an array");return ee(this,u),this}case void 0:{if(typeof u!="number")throw new TypeError("center must be a number");return J(this,u),this}default:throw new Error(`invalid option: ${g}`)}}scale(g,h={}){if(typeof g=="object"&&(h=g,g=void 0),typeof h!="object")throw new TypeError("options must be an object");let u=h.scale;switch(g){case"row":{if(u===void 0)u=ue(this);else if(!e.isAnyArray(u))throw new TypeError("scale must be an array");return be(this,u),this}case"column":{if(u===void 0)u=Z(this);else if(!e.isAnyArray(u))throw new TypeError("scale must be an array");return ce(this,u),this}case void 0:{if(u===void 0)u=pe(this);else if(typeof u!="number")throw new TypeError("scale must be a number");return he(this,u),this}default:throw new Error(`invalid option: ${g}`)}}toString(g){return s(this,g)}[Symbol.iterator](){return this.entries()}*entries(){for(let g=0;g<this.rows;g++)for(let h=0;h<this.columns;h++)yield[g,h,this.get(g,h)]}*values(){for(let g=0;g<this.rows;g++)for(let h=0;h<this.columns;h++)yield this.get(g,h)}}ie.prototype.klass="Matrix",typeof Symbol!="undefined"&&(ie.prototype[Symbol.for("nodejs.util.inspect.custom")]=i);function _e(M,g){return M-g}function G(M){return M.every(g=>typeof g=="number")}ie.random=ie.rand,ie.randomInt=ie.randInt,ie.diagonal=ie.diag,ie.prototype.diagonal=ie.prototype.diag,ie.identity=ie.eye,ie.prototype.negate=ie.prototype.neg,ie.prototype.tensorProduct=ie.prototype.kroneckerProduct;const fn=class fn extends ie{constructor(h,u){super();Tc(this,_r);Te(this,"data");if(fn.isMatrix(h))kc(this,_r,jc).call(this,h.rows,h.columns),fn.copy(h,this);else if(Number.isInteger(h)&&h>=0)kc(this,_r,jc).call(this,h,u);else if(e.isAnyArray(h)){const d=h;if(h=d.length,u=h?d[0].length:0,typeof u!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let v=0;v<h;v++){if(d[v].length!==u)throw new RangeError("Inconsistent array dimensions");if(!G(d[v]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(d[v]))}this.rows=h,this.columns=u}else throw new TypeError("First argument must be a positive number or an array")}set(h,u,d){return this.data[h][u]=d,this}get(h,u){return this.data[h][u]}removeRow(h){return l(this,h),this.data.splice(h,1),this.rows-=1,this}addRow(h,u){return u===void 0&&(u=h,h=this.rows),l(this,h,!0),u=Float64Array.from(m(this,u)),this.data.splice(h,0,u),this.rows+=1,this}removeColumn(h){p(this,h);for(let u=0;u<this.rows;u++){const d=new Float64Array(this.columns-1);for(let v=0;v<h;v++)d[v]=this.data[u][v];for(let v=h+1;v<this.columns;v++)d[v-1]=this.data[u][v];this.data[u]=d}return this.columns-=1,this}addColumn(h,u){typeof u=="undefined"&&(u=h,h=this.columns),p(this,h,!0),u=y(this,u);for(let d=0;d<this.rows;d++){const v=new Float64Array(this.columns+1);let q=0;for(;q<h;q++)v[q]=this.data[d][q];for(v[q++]=u[d];q<this.columns+1;q++)v[q]=this.data[d][q-1];this.data[d]=v}return this.columns+=1,this}};_r=new WeakSet,jc=function(h,u){if(this.data=[],Number.isInteger(u)&&u>=0)for(let d=0;d<h;d++)this.data.push(new Float64Array(u));else throw new TypeError("nColumns must be a positive integer");this.rows=h,this.columns=u};let P=fn;f(ie,P);const ln=class ln extends ie{constructor(h){super();Tc(this,He);if(P.isMatrix(h)){if(!h.isSymmetric())throw new TypeError("not symmetric data");hn(this,He,P.copy(h,new P(h.rows,h.rows)))}else if(Number.isInteger(h)&&h>=0)hn(this,He,new P(h,h));else if(hn(this,He,new P(h)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return gt(this,He).size}get rows(){return gt(this,He).rows}get columns(){return gt(this,He).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(h){return P.isMatrix(h)&&h.klassType==="SymmetricMatrix"}static zeros(h){return new this(h)}static ones(h){return new this(h).fill(1)}clone(){const h=new ln(this.diagonalSize);for(const[u,d,v]of this.upperRightEntries())h.set(u,d,v);return h}toMatrix(){return new P(this)}get(h,u){return gt(this,He).get(h,u)}set(h,u,d){return gt(this,He).set(h,u,d),gt(this,He).set(u,h,d),this}removeCross(h){return gt(this,He).removeRow(h),gt(this,He).removeColumn(h),this}addCross(h,u){u===void 0&&(u=h,h=this.diagonalSize);const d=u.slice();return d.splice(h,1),gt(this,He).addRow(h,d),gt(this,He).addColumn(h,u),this}applyMask(h){if(h.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const u=[];for(const[d,v]of h.entries())v||u.push(d);u.reverse();for(const d of u)this.removeCross(d);return this}toCompact(){const{diagonalSize:h}=this,u=new Array(h*(h+1)/2);for(let d=0,v=0,q=0;q<u.length;q++)u[q]=this.get(v,d),++d>=h&&(d=++v);return u}static fromCompact(h){const u=h.length,d=(Math.sqrt(8*u+1)-1)/2;if(!Number.isInteger(d))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(h)}`);const v=new ln(d);for(let q=0,O=0,T=0;T<u;T++)v.set(q,O,h[T]),++q>=d&&(q=++O);return v}*upperRightEntries(){for(let h=0,u=0;h<this.diagonalSize;void 0){const d=this.get(h,u);yield[h,u,d],++u>=this.diagonalSize&&(u=++h)}}*upperRightValues(){for(let h=0,u=0;h<this.diagonalSize;void 0)yield this.get(h,u),++u>=this.diagonalSize&&(u=++h)}};He=new WeakMap;let X=ln;X.prototype.klassType="SymmetricMatrix";class te extends X{static isDistanceMatrix(g){return X.isSymmetricMatrix(g)&&g.klassSubType==="DistanceMatrix"}constructor(g){if(super(g),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(g,h,u){return g===h&&(u=0),super.set(g,h,u)}addCross(g,h){return h===void 0&&(h=g,g=this.diagonalSize),h=h.slice(),h[g]=0,super.addCross(g,h)}toSymmetricMatrix(){return new X(this)}clone(){const g=new te(this.diagonalSize);for(const[h,u,d]of this.upperRightEntries())h!==u&&g.set(h,u,d);return g}toCompact(){const{diagonalSize:g}=this,h=(g-1)*g/2,u=new Array(h);for(let d=1,v=0,q=0;q<u.length;q++)u[q]=this.get(v,d),++d>=g&&(d=++v+1);return u}static fromCompact(g){const h=g.length;if(h===0)return new this(0);const u=(Math.sqrt(8*h+1)+1)/2;if(!Number.isInteger(u))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(g)}`);const d=new this(u);for(let v=1,q=0,O=0;O<h;O++)d.set(v,q,g[O]),++v>=u&&(v=++q+1);return d}}te.prototype.klassSubType="DistanceMatrix";class le extends ie{constructor(g,h,u){super(),this.matrix=g,this.rows=h,this.columns=u}}class xe extends le{constructor(g,h){p(g,h),super(g,g.rows,1),this.column=h}set(g,h,u){return this.matrix.set(g,this.column,u),this}get(g){return this.matrix.get(g,this.column)}}class De extends le{constructor(g,h){_(g,h),super(g,g.rows,h.length),this.columnIndices=h}set(g,h,u){return this.matrix.set(g,this.columnIndices[h],u),this}get(g,h){return this.matrix.get(g,this.columnIndices[h])}}class Je extends le{constructor(g){super(g,g.rows,g.columns)}set(g,h,u){return this.matrix.set(g,this.columns-h-1,u),this}get(g,h){return this.matrix.get(g,this.columns-h-1)}}class rr extends le{constructor(g){super(g,g.rows,g.columns)}set(g,h,u){return this.matrix.set(this.rows-g-1,h,u),this}get(g,h){return this.matrix.get(this.rows-g-1,h)}}class Qe extends le{constructor(g,h){l(g,h),super(g,1,g.columns),this.row=h}set(g,h,u){return this.matrix.set(this.row,h,u),this}get(g,h){return this.matrix.get(this.row,h)}}class Ve extends le{constructor(g,h){x(g,h),super(g,h.length,g.columns),this.rowIndices=h}set(g,h,u){return this.matrix.set(this.rowIndices[g],h,u),this}get(g,h){return this.matrix.get(this.rowIndices[g],h)}}class Ee extends le{constructor(g,h,u){x(g,h),_(g,u),super(g,h.length,u.length),this.rowIndices=h,this.columnIndices=u}set(g,h,u){return this.matrix.set(this.rowIndices[g],this.columnIndices[h],u),this}get(g,h){return this.matrix.get(this.rowIndices[g],this.columnIndices[h])}}class Mt extends le{constructor(g,h,u,d,v){b(g,h,u,d,v),super(g,u-h+1,v-d+1),this.startRow=h,this.startColumn=d}set(g,h,u){return this.matrix.set(this.startRow+g,this.startColumn+h,u),this}get(g,h){return this.matrix.get(this.startRow+g,this.startColumn+h)}}class Me extends le{constructor(g){super(g,g.columns,g.rows)}set(g,h,u){return this.matrix.set(h,g,u),this}get(g,h){return this.matrix.get(h,g)}}class St extends ie{constructor(g,h={}){const{rows:u=1}=h;if(g.length%u!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=u,this.columns=g.length/u,this.data=g}set(g,h,u){let d=this._calculateIndex(g,h);return this.data[d]=u,this}get(g,h){let u=this._calculateIndex(g,h);return this.data[u]}_calculateIndex(g,h){return g*this.columns+h}}class Fe extends ie{constructor(g){super(),this.data=g,this.rows=g.length,this.columns=g[0].length}set(g,h,u){return this.data[g][h]=u,this}get(g,h){return this.data[g][h]}}function qc(M,g){if(e.isAnyArray(M))return M[0]&&e.isAnyArray(M[0])?new Fe(M):new St(M,g);throw new Error("the argument is not an array")}class qt{constructor(g){g=Fe.checkMatrix(g);let h=g.clone(),u=h.rows,d=h.columns,v=new Float64Array(u),q=1,O,T,k,B,C,W,ne,U,K;for(O=0;O<u;O++)v[O]=O;for(U=new Float64Array(u),T=0;T<d;T++){for(O=0;O<u;O++)U[O]=h.get(O,T);for(O=0;O<u;O++){for(K=Math.min(O,T),C=0,k=0;k<K;k++)C+=h.get(O,k)*U[k];U[O]-=C,h.set(O,T,U[O])}for(B=T,O=T+1;O<u;O++)Math.abs(U[O])>Math.abs(U[B])&&(B=O);if(B!==T){for(k=0;k<d;k++)W=h.get(B,k),h.set(B,k,h.get(T,k)),h.set(T,k,W);ne=v[B],v[B]=v[T],v[T]=ne,q=-q}if(T<u&&h.get(T,T)!==0)for(O=T+1;O<u;O++)h.set(O,T,h.get(O,T)/h.get(T,T))}this.LU=h,this.pivotVector=v,this.pivotSign=q}isSingular(){let g=this.LU,h=g.columns;for(let u=0;u<h;u++)if(g.get(u,u)===0)return!0;return!1}solve(g){g=P.checkMatrix(g);let h=this.LU;if(h.rows!==g.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let d=g.columns,v=g.subMatrixRow(this.pivotVector,0,d-1),q=h.columns,O,T,k;for(k=0;k<q;k++)for(O=k+1;O<q;O++)for(T=0;T<d;T++)v.set(O,T,v.get(O,T)-v.get(k,T)*h.get(O,k));for(k=q-1;k>=0;k--){for(T=0;T<d;T++)v.set(k,T,v.get(k,T)/h.get(k,k));for(O=0;O<k;O++)for(T=0;T<d;T++)v.set(O,T,v.get(O,T)-v.get(k,T)*h.get(O,k))}return v}get determinant(){let g=this.LU;if(!g.isSquare())throw new Error("Matrix must be square");let h=this.pivotSign,u=g.columns;for(let d=0;d<u;d++)h*=g.get(d,d);return h}get lowerTriangularMatrix(){let g=this.LU,h=g.rows,u=g.columns,d=new P(h,u);for(let v=0;v<h;v++)for(let q=0;q<u;q++)v>q?d.set(v,q,g.get(v,q)):v===q?d.set(v,q,1):d.set(v,q,0);return d}get upperTriangularMatrix(){let g=this.LU,h=g.rows,u=g.columns,d=new P(h,u);for(let v=0;v<h;v++)for(let q=0;q<u;q++)v<=q?d.set(v,q,g.get(v,q)):d.set(v,q,0);return d}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function We(M,g){let h=0;return Math.abs(M)>Math.abs(g)?(h=g/M,Math.abs(M)*Math.sqrt(1+h*h)):g!==0?(h=M/g,Math.abs(g)*Math.sqrt(1+h*h)):0}class Ye{constructor(g){g=Fe.checkMatrix(g);let h=g.clone(),u=g.rows,d=g.columns,v=new Float64Array(d),q,O,T,k;for(T=0;T<d;T++){let B=0;for(q=T;q<u;q++)B=We(B,h.get(q,T));if(B!==0){for(h.get(T,T)<0&&(B=-B),q=T;q<u;q++)h.set(q,T,h.get(q,T)/B);for(h.set(T,T,h.get(T,T)+1),O=T+1;O<d;O++){for(k=0,q=T;q<u;q++)k+=h.get(q,T)*h.get(q,O);for(k=-k/h.get(T,T),q=T;q<u;q++)h.set(q,O,h.get(q,O)+k*h.get(q,T))}}v[T]=-B}this.QR=h,this.Rdiag=v}solve(g){g=P.checkMatrix(g);let h=this.QR,u=h.rows;if(g.rows!==u)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let d=g.columns,v=g.clone(),q=h.columns,O,T,k,B;for(k=0;k<q;k++)for(T=0;T<d;T++){for(B=0,O=k;O<u;O++)B+=h.get(O,k)*v.get(O,T);for(B=-B/h.get(k,k),O=k;O<u;O++)v.set(O,T,v.get(O,T)+B*h.get(O,k))}for(k=q-1;k>=0;k--){for(T=0;T<d;T++)v.set(k,T,v.get(k,T)/this.Rdiag[k]);for(O=0;O<k;O++)for(T=0;T<d;T++)v.set(O,T,v.get(O,T)-v.get(k,T)*h.get(O,k))}return v.subMatrix(0,q-1,0,d-1)}isFullRank(){let g=this.QR.columns;for(let h=0;h<g;h++)if(this.Rdiag[h]===0)return!1;return!0}get upperTriangularMatrix(){let g=this.QR,h=g.columns,u=new P(h,h),d,v;for(d=0;d<h;d++)for(v=0;v<h;v++)d<v?u.set(d,v,g.get(d,v)):d===v?u.set(d,v,this.Rdiag[d]):u.set(d,v,0);return u}get orthogonalMatrix(){let g=this.QR,h=g.rows,u=g.columns,d=new P(h,u),v,q,O,T;for(O=u-1;O>=0;O--){for(v=0;v<h;v++)d.set(v,O,0);for(d.set(O,O,1),q=O;q<u;q++)if(g.get(O,O)!==0){for(T=0,v=O;v<h;v++)T+=g.get(v,O)*d.get(v,q);for(T=-T/g.get(O,O),v=O;v<h;v++)d.set(v,q,d.get(v,q)+T*g.get(v,O))}}return d}}class ht{constructor(g,h={}){if(g=Fe.checkMatrix(g),g.isEmpty())throw new Error("Matrix must be non-empty");let u=g.rows,d=g.columns;const{computeLeftSingularVectors:v=!0,computeRightSingularVectors:q=!0,autoTranspose:O=!1}=h;let T=!!v,k=!!q,B=!1,C;if(u<d)if(!O)C=g.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{C=g.transpose(),u=C.rows,d=C.columns,B=!0;let F=T;T=k,k=F}else C=g.clone();let W=Math.min(u,d),ne=Math.min(u+1,d),U=new Float64Array(ne),K=new P(u,W),oe=new P(d,d),L=new Float64Array(d),re=new Float64Array(u),fe=new Float64Array(ne);for(let F=0;F<ne;F++)fe[F]=F;let ve=Math.min(u-1,d),ye=Math.max(0,Math.min(d-2,u)),je=Math.max(ve,ye);for(let F=0;F<je;F++){if(F<ve){U[F]=0;for(let Q=F;Q<u;Q++)U[F]=We(U[F],C.get(Q,F));if(U[F]!==0){C.get(F,F)<0&&(U[F]=-U[F]);for(let Q=F;Q<u;Q++)C.set(Q,F,C.get(Q,F)/U[F]);C.set(F,F,C.get(F,F)+1)}U[F]=-U[F]}for(let Q=F+1;Q<d;Q++){if(F<ve&&U[F]!==0){let ae=0;for(let H=F;H<u;H++)ae+=C.get(H,F)*C.get(H,Q);ae=-ae/C.get(F,F);for(let H=F;H<u;H++)C.set(H,Q,C.get(H,Q)+ae*C.get(H,F))}L[Q]=C.get(F,Q)}if(T&&F<ve)for(let Q=F;Q<u;Q++)K.set(Q,F,C.get(Q,F));if(F<ye){L[F]=0;for(let Q=F+1;Q<d;Q++)L[F]=We(L[F],L[Q]);if(L[F]!==0){L[F+1]<0&&(L[F]=0-L[F]);for(let Q=F+1;Q<d;Q++)L[Q]/=L[F];L[F+1]+=1}if(L[F]=-L[F],F+1<u&&L[F]!==0){for(let Q=F+1;Q<u;Q++)re[Q]=0;for(let Q=F+1;Q<u;Q++)for(let ae=F+1;ae<d;ae++)re[Q]+=L[ae]*C.get(Q,ae);for(let Q=F+1;Q<d;Q++){let ae=-L[Q]/L[F+1];for(let H=F+1;H<u;H++)C.set(H,Q,C.get(H,Q)+ae*re[H])}}if(k)for(let Q=F+1;Q<d;Q++)oe.set(Q,F,L[Q])}}let de=Math.min(d,u+1);if(ve<d&&(U[ve]=C.get(ve,ve)),u<de&&(U[de-1]=0),ye+1<de&&(L[ye]=C.get(ye,de-1)),L[de-1]=0,T){for(let F=ve;F<W;F++){for(let Q=0;Q<u;Q++)K.set(Q,F,0);K.set(F,F,1)}for(let F=ve-1;F>=0;F--)if(U[F]!==0){for(let Q=F+1;Q<W;Q++){let ae=0;for(let H=F;H<u;H++)ae+=K.get(H,F)*K.get(H,Q);ae=-ae/K.get(F,F);for(let H=F;H<u;H++)K.set(H,Q,K.get(H,Q)+ae*K.get(H,F))}for(let Q=F;Q<u;Q++)K.set(Q,F,-K.get(Q,F));K.set(F,F,1+K.get(F,F));for(let Q=0;Q<F-1;Q++)K.set(Q,F,0)}else{for(let Q=0;Q<u;Q++)K.set(Q,F,0);K.set(F,F,1)}}if(k)for(let F=d-1;F>=0;F--){if(F<ye&&L[F]!==0)for(let Q=F+1;Q<d;Q++){let ae=0;for(let H=F+1;H<d;H++)ae+=oe.get(H,F)*oe.get(H,Q);ae=-ae/oe.get(F+1,F);for(let H=F+1;H<d;H++)oe.set(H,Q,oe.get(H,Q)+ae*oe.get(H,F))}for(let Q=0;Q<d;Q++)oe.set(Q,F,0);oe.set(F,F,1)}let ge=de-1,Ae=Number.EPSILON;for(;de>0;){let F,Q;for(F=de-2;F>=-1&&F!==-1;F--){const ae=Number.MIN_VALUE+Ae*Math.abs(U[F]+Math.abs(U[F+1]));if(Math.abs(L[F])<=ae||Number.isNaN(L[F])){L[F]=0;break}}if(F===de-2)Q=4;else{let ae;for(ae=de-1;ae>=F&&ae!==F;ae--){let H=(ae!==de?Math.abs(L[ae]):0)+(ae!==F+1?Math.abs(L[ae-1]):0);if(Math.abs(U[ae])<=Ae*H){U[ae]=0;break}}ae===F?Q=3:ae===de-1?Q=1:(Q=2,F=ae)}switch(F++,Q){case 1:{let ae=L[de-2];L[de-2]=0;for(let H=de-2;H>=F;H--){let Ce=We(U[H],ae),qe=U[H]/Ce,Ie=ae/Ce;if(U[H]=Ce,H!==F&&(ae=-Ie*L[H-1],L[H-1]=qe*L[H-1]),k)for(let Pe=0;Pe<d;Pe++)Ce=qe*oe.get(Pe,H)+Ie*oe.get(Pe,de-1),oe.set(Pe,de-1,-Ie*oe.get(Pe,H)+qe*oe.get(Pe,de-1)),oe.set(Pe,H,Ce)}break}case 2:{let ae=L[F-1];L[F-1]=0;for(let H=F;H<de;H++){let Ce=We(U[H],ae),qe=U[H]/Ce,Ie=ae/Ce;if(U[H]=Ce,ae=-Ie*L[H],L[H]=qe*L[H],T)for(let Pe=0;Pe<u;Pe++)Ce=qe*K.get(Pe,H)+Ie*K.get(Pe,F-1),K.set(Pe,F-1,-Ie*K.get(Pe,H)+qe*K.get(Pe,F-1)),K.set(Pe,H,Ce)}break}case 3:{const ae=Math.max(Math.abs(U[de-1]),Math.abs(U[de-2]),Math.abs(L[de-2]),Math.abs(U[F]),Math.abs(L[F])),H=U[de-1]/ae,Ce=U[de-2]/ae,qe=L[de-2]/ae,Ie=U[F]/ae,Pe=L[F]/ae,Xe=((Ce+H)*(Ce-H)+qe*qe)/2,dt=H*qe*(H*qe);let Ge=0;(Xe!==0||dt!==0)&&(Xe<0?Ge=0-Math.sqrt(Xe*Xe+dt):Ge=Math.sqrt(Xe*Xe+dt),Ge=dt/(Xe+Ge));let yt=(Ie+H)*(Ie-H)+Ge,Rt=Ie*Pe;for(let Ne=F;Ne<de-1;Ne++){let Ze=We(yt,Rt);Ze===0&&(Ze=Number.MIN_VALUE);let st=yt/Ze,ot=Rt/Ze;if(Ne!==F&&(L[Ne-1]=Ze),yt=st*U[Ne]+ot*L[Ne],L[Ne]=st*L[Ne]-ot*U[Ne],Rt=ot*U[Ne+1],U[Ne+1]=st*U[Ne+1],k)for(let Ue=0;Ue<d;Ue++)Ze=st*oe.get(Ue,Ne)+ot*oe.get(Ue,Ne+1),oe.set(Ue,Ne+1,-ot*oe.get(Ue,Ne)+st*oe.get(Ue,Ne+1)),oe.set(Ue,Ne,Ze);if(Ze=We(yt,Rt),Ze===0&&(Ze=Number.MIN_VALUE),st=yt/Ze,ot=Rt/Ze,U[Ne]=Ze,yt=st*L[Ne]+ot*U[Ne+1],U[Ne+1]=-ot*L[Ne]+st*U[Ne+1],Rt=ot*L[Ne+1],L[Ne+1]=st*L[Ne+1],T&&Ne<u-1)for(let Ue=0;Ue<u;Ue++)Ze=st*K.get(Ue,Ne)+ot*K.get(Ue,Ne+1),K.set(Ue,Ne+1,-ot*K.get(Ue,Ne)+st*K.get(Ue,Ne+1)),K.set(Ue,Ne,Ze)}L[de-2]=yt;break}case 4:{if(U[F]<=0&&(U[F]=U[F]<0?-U[F]:0,k))for(let ae=0;ae<=ge;ae++)oe.set(ae,F,-oe.get(ae,F));for(;F<ge&&!(U[F]>=U[F+1]);){let ae=U[F];if(U[F]=U[F+1],U[F+1]=ae,k&&F<d-1)for(let H=0;H<d;H++)ae=oe.get(H,F+1),oe.set(H,F+1,oe.get(H,F)),oe.set(H,F,ae);if(T&&F<u-1)for(let H=0;H<u;H++)ae=K.get(H,F+1),K.set(H,F+1,K.get(H,F)),K.set(H,F,ae);F++}de--;break}}}if(B){let F=oe;oe=K,K=F}this.m=u,this.n=d,this.s=U,this.U=K,this.V=oe}solve(g){let h=g,u=this.threshold,d=this.s.length,v=P.zeros(d,d);for(let W=0;W<d;W++)Math.abs(this.s[W])<=u?v.set(W,W,0):v.set(W,W,1/this.s[W]);let q=this.U,O=this.rightSingularVectors,T=O.mmul(v),k=O.rows,B=q.rows,C=P.zeros(k,B);for(let W=0;W<k;W++)for(let ne=0;ne<B;ne++){let U=0;for(let K=0;K<d;K++)U+=T.get(W,K)*q.get(ne,K);C.set(W,ne,U)}return C.mmul(h)}solveForDiagonal(g){return this.solve(P.diag(g))}inverse(){let g=this.V,h=this.threshold,u=g.rows,d=g.columns,v=new P(u,this.s.length);for(let B=0;B<u;B++)for(let C=0;C<d;C++)Math.abs(this.s[C])>h&&v.set(B,C,g.get(B,C)/this.s[C]);let q=this.U,O=q.rows,T=q.columns,k=new P(u,O);for(let B=0;B<u;B++)for(let C=0;C<O;C++){let W=0;for(let ne=0;ne<T;ne++)W+=v.get(B,ne)*q.get(C,ne);k.set(B,C,W)}return k}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let g=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,h=0,u=this.s;for(let d=0,v=u.length;d<v;d++)u[d]>g&&h++;return h}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return P.diag(this.s)}}function nr(M,g=!1){return M=Fe.checkMatrix(M),g?new ht(M).inverse():sn(M,P.eye(M.rows))}function sn(M,g,h=!1){return M=Fe.checkMatrix(M),g=Fe.checkMatrix(g),h?new ht(M).solve(g):M.isSquare()?new qt(M).solve(g):new Ye(M).solve(g)}function Gt(M){if(M=P.checkMatrix(M),M.isSquare()){if(M.columns===0)return 1;let g,h,u,d;if(M.columns===2)return g=M.get(0,0),h=M.get(0,1),u=M.get(1,0),d=M.get(1,1),g*d-h*u;if(M.columns===3){let v,q,O;return v=new Ee(M,[1,2],[1,2]),q=new Ee(M,[1,2],[0,2]),O=new Ee(M,[1,2],[0,1]),g=M.get(0,0),h=M.get(0,1),u=M.get(0,2),g*Gt(v)-h*Gt(q)+u*Gt(O)}else return new qt(M).determinant}else throw Error("determinant can only be calculated for a square matrix")}function jt(M,g){let h=[];for(let u=0;u<M;u++)u!==g&&h.push(u);return h}function on(M,g,h,u=1e-9,d=1e-9){if(M>d)return new Array(g.rows+1).fill(0);{let v=g.addRow(h,[0]);for(let q=0;q<v.rows;q++)Math.abs(v.get(q,0))<u&&v.set(q,0,0);return v.to1DArray()}}function an(M,g={}){const{thresholdValue:h=1e-9,thresholdError:u=1e-9}=g;M=P.checkMatrix(M);let d=M.rows,v=new P(d,d);for(let q=0;q<d;q++){let O=P.columnVector(M.getRow(q)),T=M.subMatrixRow(jt(d,q)).transpose(),B=new ht(T).solve(O),C=P.sub(O,T.mmul(B)).abs().max();v.setRow(q,on(C,B,q,h,u))}return v}function Rc(M,g=Number.EPSILON){if(M=P.checkMatrix(M),M.isEmpty())return M.transpose();let h=new ht(M,{autoTranspose:!0}),u=h.leftSingularVectors,d=h.rightSingularVectors,v=h.diagonal;for(let q=0;q<v.length;q++)Math.abs(v[q])>g?v[q]=1/v[q]:v[q]=0;return d.mmul(P.diag(v).mmul(u.transpose()))}function un(M,g=M,h={}){M=new P(M);let u=!1;if(typeof g=="object"&&!P.isMatrix(g)&&!e.isAnyArray(g)?(h=g,g=M,u=!0):g=new P(g),M.rows!==g.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:d=!0}=h;d&&(M=M.center("column"),u||(g=g.center("column")));const v=M.transpose().mmul(g);for(let q=0;q<v.rows;q++)for(let O=0;O<v.columns;O++)v.set(q,O,v.get(q,O)*(1/(M.rows-1)));return v}function vt(M,g=M,h={}){M=new P(M);let u=!1;if(typeof g=="object"&&!P.isMatrix(g)&&!e.isAnyArray(g)?(h=g,g=M,u=!0):g=new P(g),M.rows!==g.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:d=!0,scale:v=!0}=h;d&&(M.center("column"),u||g.center("column")),v&&(M.scale("column"),u||g.scale("column"));const q=M.standardDeviation("column",{unbiased:!0}),O=u?q:g.standardDeviation("column",{unbiased:!0}),T=M.transpose().mmul(g);for(let k=0;k<T.rows;k++)for(let B=0;B<T.columns;B++)T.set(k,B,T.get(k,B)*(1/(q[k]*O[B]))*(1/(M.rows-1)));return T}class mt{constructor(g,h={}){const{assumeSymmetric:u=!1}=h;if(g=Fe.checkMatrix(g),!g.isSquare())throw new Error("Matrix is not a square matrix");if(g.isEmpty())throw new Error("Matrix must be non-empty");let d=g.columns,v=new P(d,d),q=new Float64Array(d),O=new Float64Array(d),T=g,k,B,C=!1;if(u?C=!0:C=g.isSymmetric(),C){for(k=0;k<d;k++)for(B=0;B<d;B++)v.set(k,B,T.get(k,B));Vx(d,O,q,v),Wx(d,O,q,v)}else{let W=new P(d,d),ne=new Float64Array(d);for(B=0;B<d;B++)for(k=0;k<d;k++)W.set(k,B,T.get(k,B));Yx(d,W,ne,v),Kx(d,O,q,v,W)}this.n=d,this.e=O,this.d=q,this.V=v}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let g=this.n,h=this.e,u=this.d,d=new P(g,g),v,q;for(v=0;v<g;v++){for(q=0;q<g;q++)d.set(v,q,0);d.set(v,v,u[v]),h[v]>0?d.set(v,v+1,h[v]):h[v]<0&&d.set(v,v-1,h[v])}return d}}function Vx(M,g,h,u){let d,v,q,O,T,k,B,C;for(T=0;T<M;T++)h[T]=u.get(M-1,T);for(O=M-1;O>0;O--){for(C=0,q=0,k=0;k<O;k++)C=C+Math.abs(h[k]);if(C===0)for(g[O]=h[O-1],T=0;T<O;T++)h[T]=u.get(O-1,T),u.set(O,T,0),u.set(T,O,0);else{for(k=0;k<O;k++)h[k]/=C,q+=h[k]*h[k];for(d=h[O-1],v=Math.sqrt(q),d>0&&(v=-v),g[O]=C*v,q=q-d*v,h[O-1]=d-v,T=0;T<O;T++)g[T]=0;for(T=0;T<O;T++){for(d=h[T],u.set(T,O,d),v=g[T]+u.get(T,T)*d,k=T+1;k<=O-1;k++)v+=u.get(k,T)*h[k],g[k]+=u.get(k,T)*d;g[T]=v}for(d=0,T=0;T<O;T++)g[T]/=q,d+=g[T]*h[T];for(B=d/(q+q),T=0;T<O;T++)g[T]-=B*h[T];for(T=0;T<O;T++){for(d=h[T],v=g[T],k=T;k<=O-1;k++)u.set(k,T,u.get(k,T)-(d*g[k]+v*h[k]));h[T]=u.get(O-1,T),u.set(O,T,0)}}h[O]=q}for(O=0;O<M-1;O++){if(u.set(M-1,O,u.get(O,O)),u.set(O,O,1),q=h[O+1],q!==0){for(k=0;k<=O;k++)h[k]=u.get(k,O+1)/q;for(T=0;T<=O;T++){for(v=0,k=0;k<=O;k++)v+=u.get(k,O+1)*u.get(k,T);for(k=0;k<=O;k++)u.set(k,T,u.get(k,T)-v*h[k])}}for(k=0;k<=O;k++)u.set(k,O+1,0)}for(T=0;T<M;T++)h[T]=u.get(M-1,T),u.set(M-1,T,0);u.set(M-1,M-1,1),g[0]=0}function Wx(M,g,h,u){let d,v,q,O,T,k,B,C,W,ne,U,K,oe,L,re,fe;for(q=1;q<M;q++)g[q-1]=g[q];g[M-1]=0;let ve=0,ye=0,je=Number.EPSILON;for(k=0;k<M;k++){for(ye=Math.max(ye,Math.abs(h[k])+Math.abs(g[k])),B=k;B<M&&!(Math.abs(g[B])<=je*ye);)B++;if(B>k)do{for(d=h[k],C=(h[k+1]-d)/(2*g[k]),W=We(C,1),C<0&&(W=-W),h[k]=g[k]/(C+W),h[k+1]=g[k]*(C+W),ne=h[k+1],v=d-h[k],q=k+2;q<M;q++)h[q]-=v;for(ve=ve+v,C=h[B],U=1,K=U,oe=U,L=g[k+1],re=0,fe=0,q=B-1;q>=k;q--)for(oe=K,K=U,fe=re,d=U*g[q],v=U*C,W=We(C,g[q]),g[q+1]=re*W,re=g[q]/W,U=C/W,C=U*h[q]-re*d,h[q+1]=v+re*(U*d+re*h[q]),T=0;T<M;T++)v=u.get(T,q+1),u.set(T,q+1,re*u.get(T,q)+U*v),u.set(T,q,U*u.get(T,q)-re*v);C=-re*fe*oe*L*g[k]/ne,g[k]=re*C,h[k]=U*C}while(Math.abs(g[k])>je*ye);h[k]=h[k]+ve,g[k]=0}for(q=0;q<M-1;q++){for(T=q,C=h[q],O=q+1;O<M;O++)h[O]<C&&(T=O,C=h[O]);if(T!==q)for(h[T]=h[q],h[q]=C,O=0;O<M;O++)C=u.get(O,q),u.set(O,q,u.get(O,T)),u.set(O,T,C)}}function Yx(M,g,h,u){let d=0,v=M-1,q,O,T,k,B,C,W;for(C=d+1;C<=v-1;C++){for(W=0,k=C;k<=v;k++)W=W+Math.abs(g.get(k,C-1));if(W!==0){for(T=0,k=v;k>=C;k--)h[k]=g.get(k,C-1)/W,T+=h[k]*h[k];for(O=Math.sqrt(T),h[C]>0&&(O=-O),T=T-h[C]*O,h[C]=h[C]-O,B=C;B<M;B++){for(q=0,k=v;k>=C;k--)q+=h[k]*g.get(k,B);for(q=q/T,k=C;k<=v;k++)g.set(k,B,g.get(k,B)-q*h[k])}for(k=0;k<=v;k++){for(q=0,B=v;B>=C;B--)q+=h[B]*g.get(k,B);for(q=q/T,B=C;B<=v;B++)g.set(k,B,g.get(k,B)-q*h[B])}h[C]=W*h[C],g.set(C,C-1,W*O)}}for(k=0;k<M;k++)for(B=0;B<M;B++)u.set(k,B,k===B?1:0);for(C=v-1;C>=d+1;C--)if(g.get(C,C-1)!==0){for(k=C+1;k<=v;k++)h[k]=g.get(k,C-1);for(B=C;B<=v;B++){for(O=0,k=C;k<=v;k++)O+=h[k]*u.get(k,B);for(O=O/h[C]/g.get(C,C-1),k=C;k<=v;k++)u.set(k,B,u.get(k,B)+O*h[k])}}}function Kx(M,g,h,u,d){let v=M-1,q=0,O=M-1,T=Number.EPSILON,k=0,B=0,C=0,W=0,ne=0,U=0,K=0,oe=0,L,re,fe,ve,ye,je,de,ge,Ae,F,Q,ae,H,Ce,qe;for(L=0;L<M;L++)for((L<q||L>O)&&(h[L]=d.get(L,L),g[L]=0),re=Math.max(L-1,0);re<M;re++)B=B+Math.abs(d.get(L,re));for(;v>=q;){for(ve=v;ve>q&&(U=Math.abs(d.get(ve-1,ve-1))+Math.abs(d.get(ve,ve)),U===0&&(U=B),!(Math.abs(d.get(ve,ve-1))<T*U));)ve--;if(ve===v)d.set(v,v,d.get(v,v)+k),h[v]=d.get(v,v),g[v]=0,v--,oe=0;else if(ve===v-1){if(de=d.get(v,v-1)*d.get(v-1,v),C=(d.get(v-1,v-1)-d.get(v,v))/2,W=C*C+de,K=Math.sqrt(Math.abs(W)),d.set(v,v,d.get(v,v)+k),d.set(v-1,v-1,d.get(v-1,v-1)+k),ge=d.get(v,v),W>=0){for(K=C>=0?C+K:C-K,h[v-1]=ge+K,h[v]=h[v-1],K!==0&&(h[v]=ge-de/K),g[v-1]=0,g[v]=0,ge=d.get(v,v-1),U=Math.abs(ge)+Math.abs(K),C=ge/U,W=K/U,ne=Math.sqrt(C*C+W*W),C=C/ne,W=W/ne,re=v-1;re<M;re++)K=d.get(v-1,re),d.set(v-1,re,W*K+C*d.get(v,re)),d.set(v,re,W*d.get(v,re)-C*K);for(L=0;L<=v;L++)K=d.get(L,v-1),d.set(L,v-1,W*K+C*d.get(L,v)),d.set(L,v,W*d.get(L,v)-C*K);for(L=q;L<=O;L++)K=u.get(L,v-1),u.set(L,v-1,W*K+C*u.get(L,v)),u.set(L,v,W*u.get(L,v)-C*K)}else h[v-1]=ge+C,h[v]=ge+C,g[v-1]=K,g[v]=-K;v=v-2,oe=0}else{if(ge=d.get(v,v),Ae=0,de=0,ve<v&&(Ae=d.get(v-1,v-1),de=d.get(v,v-1)*d.get(v-1,v)),oe===10){for(k+=ge,L=q;L<=v;L++)d.set(L,L,d.get(L,L)-ge);U=Math.abs(d.get(v,v-1))+Math.abs(d.get(v-1,v-2)),ge=Ae=.75*U,de=-.4375*U*U}if(oe===30&&(U=(Ae-ge)/2,U=U*U+de,U>0)){for(U=Math.sqrt(U),Ae<ge&&(U=-U),U=ge-de/((Ae-ge)/2+U),L=q;L<=v;L++)d.set(L,L,d.get(L,L)-U);k+=U,ge=Ae=de=.964}for(oe=oe+1,ye=v-2;ye>=ve&&(K=d.get(ye,ye),ne=ge-K,U=Ae-K,C=(ne*U-de)/d.get(ye+1,ye)+d.get(ye,ye+1),W=d.get(ye+1,ye+1)-K-ne-U,ne=d.get(ye+2,ye+1),U=Math.abs(C)+Math.abs(W)+Math.abs(ne),C=C/U,W=W/U,ne=ne/U,!(ye===ve||Math.abs(d.get(ye,ye-1))*(Math.abs(W)+Math.abs(ne))<T*(Math.abs(C)*(Math.abs(d.get(ye-1,ye-1))+Math.abs(K)+Math.abs(d.get(ye+1,ye+1))))));)ye--;for(L=ye+2;L<=v;L++)d.set(L,L-2,0),L>ye+2&&d.set(L,L-3,0);for(fe=ye;fe<=v-1&&(Ce=fe!==v-1,fe!==ye&&(C=d.get(fe,fe-1),W=d.get(fe+1,fe-1),ne=Ce?d.get(fe+2,fe-1):0,ge=Math.abs(C)+Math.abs(W)+Math.abs(ne),ge!==0&&(C=C/ge,W=W/ge,ne=ne/ge)),ge!==0);fe++)if(U=Math.sqrt(C*C+W*W+ne*ne),C<0&&(U=-U),U!==0){for(fe!==ye?d.set(fe,fe-1,-U*ge):ve!==ye&&d.set(fe,fe-1,-d.get(fe,fe-1)),C=C+U,ge=C/U,Ae=W/U,K=ne/U,W=W/C,ne=ne/C,re=fe;re<M;re++)C=d.get(fe,re)+W*d.get(fe+1,re),Ce&&(C=C+ne*d.get(fe+2,re),d.set(fe+2,re,d.get(fe+2,re)-C*K)),d.set(fe,re,d.get(fe,re)-C*ge),d.set(fe+1,re,d.get(fe+1,re)-C*Ae);for(L=0;L<=Math.min(v,fe+3);L++)C=ge*d.get(L,fe)+Ae*d.get(L,fe+1),Ce&&(C=C+K*d.get(L,fe+2),d.set(L,fe+2,d.get(L,fe+2)-C*ne)),d.set(L,fe,d.get(L,fe)-C),d.set(L,fe+1,d.get(L,fe+1)-C*W);for(L=q;L<=O;L++)C=ge*u.get(L,fe)+Ae*u.get(L,fe+1),Ce&&(C=C+K*u.get(L,fe+2),u.set(L,fe+2,u.get(L,fe+2)-C*ne)),u.set(L,fe,u.get(L,fe)-C),u.set(L,fe+1,u.get(L,fe+1)-C*W)}}}if(B!==0){for(v=M-1;v>=0;v--)if(C=h[v],W=g[v],W===0)for(ve=v,d.set(v,v,1),L=v-1;L>=0;L--){for(de=d.get(L,L)-C,ne=0,re=ve;re<=v;re++)ne=ne+d.get(L,re)*d.get(re,v);if(g[L]<0)K=de,U=ne;else if(ve=L,g[L]===0?d.set(L,v,de!==0?-ne/de:-ne/(T*B)):(ge=d.get(L,L+1),Ae=d.get(L+1,L),W=(h[L]-C)*(h[L]-C)+g[L]*g[L],je=(ge*U-K*ne)/W,d.set(L,v,je),d.set(L+1,v,Math.abs(ge)>Math.abs(K)?(-ne-de*je)/ge:(-U-Ae*je)/K)),je=Math.abs(d.get(L,v)),T*je*je>1)for(re=L;re<=v;re++)d.set(re,v,d.get(re,v)/je)}else if(W<0)for(ve=v-1,Math.abs(d.get(v,v-1))>Math.abs(d.get(v-1,v))?(d.set(v-1,v-1,W/d.get(v,v-1)),d.set(v-1,v,-(d.get(v,v)-C)/d.get(v,v-1))):(qe=cn(0,-d.get(v-1,v),d.get(v-1,v-1)-C,W),d.set(v-1,v-1,qe[0]),d.set(v-1,v,qe[1])),d.set(v,v-1,0),d.set(v,v,1),L=v-2;L>=0;L--){for(F=0,Q=0,re=ve;re<=v;re++)F=F+d.get(L,re)*d.get(re,v-1),Q=Q+d.get(L,re)*d.get(re,v);if(de=d.get(L,L)-C,g[L]<0)K=de,ne=F,U=Q;else if(ve=L,g[L]===0?(qe=cn(-F,-Q,de,W),d.set(L,v-1,qe[0]),d.set(L,v,qe[1])):(ge=d.get(L,L+1),Ae=d.get(L+1,L),ae=(h[L]-C)*(h[L]-C)+g[L]*g[L]-W*W,H=(h[L]-C)*2*W,ae===0&&H===0&&(ae=T*B*(Math.abs(de)+Math.abs(W)+Math.abs(ge)+Math.abs(Ae)+Math.abs(K))),qe=cn(ge*ne-K*F+W*Q,ge*U-K*Q-W*F,ae,H),d.set(L,v-1,qe[0]),d.set(L,v,qe[1]),Math.abs(ge)>Math.abs(K)+Math.abs(W)?(d.set(L+1,v-1,(-F-de*d.get(L,v-1)+W*d.get(L,v))/ge),d.set(L+1,v,(-Q-de*d.get(L,v)-W*d.get(L,v-1))/ge)):(qe=cn(-ne-Ae*d.get(L,v-1),-U-Ae*d.get(L,v),K,W),d.set(L+1,v-1,qe[0]),d.set(L+1,v,qe[1]))),je=Math.max(Math.abs(d.get(L,v-1)),Math.abs(d.get(L,v))),T*je*je>1)for(re=L;re<=v;re++)d.set(re,v-1,d.get(re,v-1)/je),d.set(re,v,d.get(re,v)/je)}for(L=0;L<M;L++)if(L<q||L>O)for(re=L;re<M;re++)u.set(L,re,d.get(L,re));for(re=M-1;re>=q;re--)for(L=q;L<=O;L++){for(K=0,fe=q;fe<=Math.min(re,O);fe++)K=K+u.get(L,fe)*d.get(fe,re);u.set(L,re,K)}}}function cn(M,g,h,u){let d,v;return Math.abs(h)>Math.abs(u)?(d=u/h,v=h+d*u,[(M+d*g)/v,(g-d*M)/v]):(d=h/u,v=u+d*h,[(d*M+g)/v,(d*g-M)/v])}class M0{constructor(g){if(g=Fe.checkMatrix(g),!g.isSymmetric())throw new Error("Matrix is not symmetric");let h=g,u=h.rows,d=new P(u,u),v=!0,q,O,T;for(O=0;O<u;O++){let k=0;for(T=0;T<O;T++){let B=0;for(q=0;q<T;q++)B+=d.get(T,q)*d.get(O,q);B=(h.get(O,T)-B)/d.get(T,T),d.set(O,T,B),k=k+B*B}for(k=h.get(O,O)-k,v&&(v=k>0),d.set(O,O,Math.sqrt(Math.max(k,0))),T=O+1;T<u;T++)d.set(O,T,0)}this.L=d,this.positiveDefinite=v}isPositiveDefinite(){return this.positiveDefinite}solve(g){g=Fe.checkMatrix(g);let h=this.L,u=h.rows;if(g.rows!==u)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let d=g.columns,v=g.clone(),q,O,T;for(T=0;T<u;T++)for(O=0;O<d;O++){for(q=0;q<T;q++)v.set(T,O,v.get(T,O)-v.get(q,O)*h.get(T,q));v.set(T,O,v.get(T,O)/h.get(T,T))}for(T=u-1;T>=0;T--)for(O=0;O<d;O++){for(q=T+1;q<u;q++)v.set(T,O,v.get(T,O)-v.get(q,O)*h.get(q,T));v.set(T,O,v.get(T,O)/h.get(T,T))}return v}get lowerTriangularMatrix(){return this.L}}class S0{constructor(g,h={}){g=Fe.checkMatrix(g);let{Y:u}=h;const{scaleScores:d=!1,maxIterations:v=1e3,terminationCriteria:q=1e-10}=h;let O;if(u){if(e.isAnyArray(u)&&typeof u[0]=="number"?u=P.columnVector(u):u=Fe.checkMatrix(u),u.rows!==g.rows)throw new Error("Y should have the same number of rows as X");O=u.getColumnVector(0)}else O=g.getColumnVector(0);let T=1,k,B,C,W;for(let ne=0;ne<v&&T>q;ne++)C=g.transpose().mmul(O).div(O.transpose().mmul(O).get(0,0)),C=C.div(C.norm()),k=g.mmul(C).div(C.transpose().mmul(C).get(0,0)),ne>0&&(T=k.clone().sub(W).pow(2).sum()),W=k.clone(),u?(B=u.transpose().mmul(k).div(k.transpose().mmul(k).get(0,0)),B=B.div(B.norm()),O=u.mmul(B).div(B.transpose().mmul(B).get(0,0))):O=k;if(u){let ne=g.transpose().mmul(k).div(k.transpose().mmul(k).get(0,0));ne=ne.div(ne.norm());let U=g.clone().sub(k.clone().mmul(ne.transpose())),K=O.transpose().mmul(k).div(k.transpose().mmul(k).get(0,0)),oe=u.clone().sub(k.clone().mulS(K.get(0,0)).mmul(B.transpose()));this.t=k,this.p=ne.transpose(),this.w=C.transpose(),this.q=B,this.u=O,this.s=k.transpose().mmul(k),this.xResidual=U,this.yResidual=oe,this.betas=K}else this.w=C.transpose(),this.s=k.transpose().mmul(k).sqrt(),d?this.t=k.clone().div(this.s.get(0,0)):this.t=k,this.xResidual=g.sub(k.mmul(C.transpose()))}}return we.AbstractMatrix=ie,we.CHO=M0,we.CholeskyDecomposition=M0,we.DistanceMatrix=te,we.EVD=mt,we.EigenvalueDecomposition=mt,we.LU=qt,we.LuDecomposition=qt,we.Matrix=P,we.MatrixColumnSelectionView=De,we.MatrixColumnView=xe,we.MatrixFlipColumnView=Je,we.MatrixFlipRowView=rr,we.MatrixRowSelectionView=Ve,we.MatrixRowView=Qe,we.MatrixSelectionView=Ee,we.MatrixSubView=Mt,we.MatrixTransposeView=Me,we.NIPALS=S0,we.Nipals=S0,we.QR=Ye,we.QrDecomposition=Ye,we.SVD=ht,we.SingularValueDecomposition=ht,we.SymmetricMatrix=X,we.WrapperMatrix1D=St,we.WrapperMatrix2D=Fe,we.correlation=vt,we.covariance=un,we.default=P,we.determinant=Gt,we.inverse=nr,we.linearDependencies=an,we.pseudoInverse=Rc,we.solve=sn,we.wrap=qc,we}var Tr=Kw(),Pf=kf(Tr);const It=Tr.Matrix,Lf=Tr.SingularValueDecomposition;Pf.Matrix?Pf.Matrix:Tr.Matrix;const Xw={center:[0,0],linkDistance:50};class Df{constructor(r={}){this.options=r,this.id="mds",this.options=Object.assign(Object.assign({},Xw),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,r,t)})}genericMDSLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:s=[0,0],linkDistance:a=50}=i,o=t.getAllNodes(),c=t.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return Lt(t,r,s);const f=xf({nodes:o,edges:c}),l=Ef(f);Zw(l);const p=Fy(l,a),m=Jw(p),y=[];return m.forEach((_,b)=>{const w=it(o[b]);w.data.x=_[0]+s[0],w.data.y=_[1]+s[1],y.push(w)}),r&&y.forEach(_=>t.mergeNodeData(_.id,{x:_.data.x,y:_.data.y})),{nodes:y,edges:c}})}}const Zw=e=>{let r=-999999;e.forEach(t=>{t.forEach(n=>{n!==1/0&&r<n&&(r=n)})}),e.forEach((t,n)=>{t.forEach((i,s)=>{i===1/0&&(e[n][s]=r)})})},Jw=e=>{const t=It.mul(It.pow(e,2),-.5),n=t.mean("row"),i=t.mean("column"),s=t.mean();t.add(s).subRowVector(n).subColumnVector(i);const a=new Lf(t),o=It.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map(c=>It.mul([c],[o]).toJSON()[0].splice(0,2))};function zf(e){return!!e.tick&&!!e.stop}const Qw={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Hw={center:[0,0],comboPadding:10,treeKey:"combo"};class e1{constructor(r={}){this.options=r,this.id="comboCombined",this.options=Object.assign(Object.assign({},Hw),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,r,t)})}genericComboCombinedLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:s,treeKey:a,outerLayout:o}=i,c=t.getAllNodes().filter(I=>!I.data._isCombo),f=t.getAllNodes().filter(I=>I.data._isCombo),l=t.getAllEdges(),p=c==null?void 0:c.length;if(!p||p===1)return Lt(t,r,s);const m=[],y=new Map;c.forEach(I=>{y.set(I.id,I)});const x=new Map;f.forEach(I=>{x.set(I.id,I)});const _=new Map,b=this.getInnerGraphs(t,a,y,x,l,i,_);yield Promise.all(b);const w=new Map,E=[],N=new Map;let S=!0;t.getRoots(a).forEach(I=>{const D=_.get(I.id),z=x.get(I.id)||y.get(I.id),$={id:I.id,data:Object.assign(Object.assign({},I.data),{x:D.data.x||z.data.x,y:D.data.y||z.data.y,fx:D.data.fx||z.data.fx,fy:D.data.fy||z.data.fy,mass:D.data.mass||z.data.mass,size:D.data.size})};E.push($),w.set(I.id,!0),!isNaN($.data.x)&&$.data.x!==0&&!isNaN($.data.y)&&$.data.y!==0?S=!1:($.data.x=Math.random()*100,$.data.y=Math.random()*100),Sn(t,[I],V=>{V.id!==I.id&&N.set(V.id,I.id)},"TB",a)});const R=[];l.forEach(I=>{const D=N.get(I.source)||I.source,z=N.get(I.target)||I.target;D!==z&&w.has(D)&&w.has(z)&&R.push({id:I.id,source:D,target:z,data:{}})});let A;if(E!=null&&E.length){if(E.length===1)E[0].data.x=s[0],E[0].data.y=s[1];else{const I=new Be({nodes:E,edges:R}),D=o||new Af;S&&Qw[D.id]&&(yield(E.length<100?new Df:new An).assign(I));const z=Object.assign({center:s,kg:5,preventOverlap:!0,animate:!1},D.id==="force"?{gravity:1,factor:4,linkDistance:($,V,Y)=>{const ee=Math.max(...V.data.size)||32,J=Math.max(...Y.data.size)||32;return ee/2+J/2+200}}:{});A=yield Ff(D,I,z)}_.forEach(I=>{var D;const z=A.nodes.find(Y=>Y.id===I.id);if(z){const{x:Y,y:ee}=z.data;I.data.visited=!0,I.data.x=Y,I.data.y=ee,m.push({id:I.id,data:{x:Y,y:ee}})}const{x:$,y:V}=I.data;(D=I.data.nodes)===null||D===void 0||D.forEach(Y=>{m.push({id:Y.id,data:{x:Y.data.x+$,y:Y.data.y+V}})})}),_.forEach(({data:I})=>{const{x:D,y:z,visited:$,nodes:V}=I;V==null||V.forEach(Y=>{if(!$){const ee=m.find(J=>J.id===Y.id);ee.data.x+=D||0,ee.data.y+=z||0}})})}return r&&m.forEach(I=>{t.mergeNodeData(I.id,{x:I.data.x,y:I.data.y})}),{nodes:m,edges:l}})}initVals(r){const t=Object.assign({},r),{nodeSize:n,spacing:i,comboPadding:s}=r;let a,o;if(me(i)?o=()=>i:wt(i)?o=i:o=()=>0,t.spacing=o,!n)a=f=>{const l=o(f);return f.size?bt(f.size)?((f.size[0]>f.size[1]?f.size[0]:f.size[1])+l)/2:Vt(f.size)?((f.size.width>f.size.height?f.size.width:f.size.height)+l)/2:(f.size+l)/2:32+l/2};else if(wt(n))a=f=>{const l=n(f),p=o(f);return bt(f.size)?((f.size[0]>f.size[1]?f.size[0]:f.size[1])+p)/2:((l||32)+p)/2};else if(bt(n)){const l=(n[0]>n[1]?n[0]:n[1])/2;a=p=>l+o(p)/2}else{const f=n/2;a=l=>f+o(l)/2}t.nodeSize=a;let c;return me(s)?c=()=>s:bt(s)?c=()=>Math.max.apply(null,s):wt(s)?c=s:c=()=>0,t.comboPadding=c,t}getInnerGraphs(r,t,n,i,s,a,o){const{nodeSize:c,comboPadding:f,spacing:l,innerLayout:p}=a,m=p||new An({}),y={center:[0,0],preventOverlap:!0,nodeSpacing:l},x=[],_=b=>{let w=(f==null?void 0:f(b))||10;return bt(w)&&(w=Math.max(...w)),{size:w?[w*2,w*2]:[30,30],padding:w}};return r.getRoots(t).forEach(b=>{o.set(b.id,{id:b.id,data:{nodes:[],size:_(b).size}});let w=Promise.resolve();Sn(r,[b],E=>{var N;if(!E.data._isCombo)return;const{size:S,padding:R}=_(E);if(!(!((N=r.getChildren(E.id,t))===null||N===void 0)&&N.length))o.set(E.id,{id:E.id,data:Object.assign(Object.assign({},E.data),{size:S})});else{const A=o.get(E.id);o.set(E.id,{id:E.id,data:Object.assign({nodes:[]},A==null?void 0:A.data)});const j=new Map,I=r.getChildren(E.id,t).map($=>{if($.data._isCombo)return o.has($.id)||o.set($.id,{id:$.id,data:Object.assign({},$.data)}),j.set($.id,!0),o.get($.id);const V=n.get($.id)||i.get($.id);return j.set($.id,!0),{id:$.id,data:Object.assign(Object.assign({},V.data),$.data)}}),D={nodes:I,edges:s.filter($=>j.has($.source)&&j.has($.target))};let z=1/0;I.forEach($=>{var V;let{size:Y}=$.data;Y||(Y=((V=o.get($.id))===null||V===void 0?void 0:V.data.size)||(c==null?void 0:c($))||[30,30]),me(Y)&&(Y=[Y,Y]);const[ee,J]=Y;z>ee&&(z=ee),z>J&&(z=J),$.data.size=Y}),w=w.then(()=>se(this,void 0,void 0,function*(){const $=new Be(D);yield Ff(m,$,y,!0);const{minX:V,minY:Y,maxX:ee,maxY:J}=By(I),ue={x:(ee+V)/2,y:(J+Y)/2};D.nodes.forEach(Z=>{Z.data.x-=ue.x,Z.data.y-=ue.y});const be=[Math.max(ee-V,z)+R*2,Math.max(J-Y,z)+R*2];o.get(E.id).data.size=be,o.get(E.id).data.nodes=I}))}return!0},"BT",t),x.push(w)}),x}}function Ff(e,r,t,n){var i;return se(this,void 0,void 0,function*(){return zf(e)?(e.execute(r,t),e.stop(),e.tick((i=t.iterations)!==null&&i!==void 0?i:300)):n?yield e.assign(r,t):yield e.execute(r,t)})}function t1(e,r){var t,n=1;e==null&&(e=0),r==null&&(r=0);function i(){var s,a=t.length,o,c=0,f=0;for(s=0;s<a;++s)o=t[s],c+=o.x,f+=o.y;for(c=(c/a-e)*n,f=(f/a-r)*n,s=0;s<a;++s)o=t[s],o.x-=c,o.y-=f}return i.initialize=function(s){t=s},i.x=function(s){return arguments.length?(e=+s,i):e},i.y=function(s){return arguments.length?(r=+s,i):r},i.strength=function(s){return arguments.length?(n=+s,i):n},i}function $e(e){return function(){return e}}function Tt(e){return(e()-.5)*1e-6}function r1(e){return e.x+e.vx}function n1(e){return e.y+e.vy}function i1(e){var r,t,n,i=1,s=1;typeof e!="function"&&(e=$e(e==null?1:+e));function a(){for(var f,l=r.length,p,m,y,x,_,b,w=0;w<s;++w)for(p=Yt(r,r1,n1).visitAfter(o),f=0;f<l;++f)m=r[f],_=t[m.index],b=_*_,y=m.x+m.vx,x=m.y+m.vy,p.visit(E);function E(N,S,R,A,j){var I=N.data,D=N.r,z=_+D;if(I){if(I.index>m.index){var $=y-I.x-I.vx,V=x-I.y-I.vy,Y=$*$+V*V;Y<z*z&&($===0&&($=Tt(n),Y+=$*$),V===0&&(V=Tt(n),Y+=V*V),Y=(z-(Y=Math.sqrt(Y)))/Y*i,m.vx+=($*=Y)*(z=(D*=D)/(b+D)),m.vy+=(V*=Y)*z,I.vx-=$*(z=1-z),I.vy-=V*z)}return}return S>y+z||A<y-z||R>x+z||j<x-z}}function o(f){if(f.data)return f.r=t[f.data.index];for(var l=f.r=0;l<4;++l)f[l]&&f[l].r>f.r&&(f.r=f[l].r)}function c(){if(r){var f,l=r.length,p;for(t=new Array(l),f=0;f<l;++f)p=r[f],t[p.index]=+e(p,f,r)}}return a.initialize=function(f,l){r=f,n=l,c()},a.iterations=function(f){return arguments.length?(s=+f,a):s},a.strength=function(f){return arguments.length?(i=+f,a):i},a.radius=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),c(),a):e},a}function s1(e){return e.index}function Bf(e,r){var t=e.get(r);if(!t)throw new Error("node not found: "+r);return t}function o1(e){var r=s1,t=p,n,i=$e(30),s,a,o,c,f,l=1;e==null&&(e=[]);function p(b){return 1/Math.min(o[b.source.index],o[b.target.index])}function m(b){for(var w=0,E=e.length;w<l;++w)for(var N=0,S,R,A,j,I,D,z;N<E;++N)S=e[N],R=S.source,A=S.target,j=A.x+A.vx-R.x-R.vx||Tt(f),I=A.y+A.vy-R.y-R.vy||Tt(f),D=Math.sqrt(j*j+I*I),D=(D-s[N])/D*b*n[N],j*=D,I*=D,A.vx-=j*(z=c[N]),A.vy-=I*z,R.vx+=j*(z=1-z),R.vy+=I*z}function y(){if(a){var b,w=a.length,E=e.length,N=new Map(a.map((R,A)=>[r(R,A,a),R])),S;for(b=0,o=new Array(w);b<E;++b)S=e[b],S.index=b,typeof S.source!="object"&&(S.source=Bf(N,S.source)),typeof S.target!="object"&&(S.target=Bf(N,S.target)),o[S.source.index]=(o[S.source.index]||0)+1,o[S.target.index]=(o[S.target.index]||0)+1;for(b=0,c=new Array(E);b<E;++b)S=e[b],c[b]=o[S.source.index]/(o[S.source.index]+o[S.target.index]);n=new Array(E),x(),s=new Array(E),_()}}function x(){if(a)for(var b=0,w=e.length;b<w;++b)n[b]=+t(e[b],b,e)}function _(){if(a)for(var b=0,w=e.length;b<w;++b)s[b]=+i(e[b],b,e)}return m.initialize=function(b,w){a=b,f=w,y()},m.links=function(b){return arguments.length?(e=b,y(),m):e},m.id=function(b){return arguments.length?(r=b,m):r},m.iterations=function(b){return arguments.length?(l=+b,m):l},m.strength=function(b){return arguments.length?(t=typeof b=="function"?b:$e(+b),x(),m):t},m.distance=function(b){return arguments.length?(i=typeof b=="function"?b:$e(+b),_(),m):i},m}var a1={value:()=>{}};function Cn(){for(var e=0,r=arguments.length,t={},n;e<r;++e){if(!(n=arguments[e]+"")||n in t||/[\s.]/.test(n))throw new Error("illegal type: "+n);t[n]=[]}return new kr(t)}function kr(e){this._=e}function u1(e,r){return e.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}kr.prototype=Cn.prototype={constructor:kr,on:function(e,r){var t=this._,n=u1(e+"",t),i,s=-1,a=n.length;if(arguments.length<2){for(;++s<a;)if((i=(e=n[s]).type)&&(i=c1(t[i],e.name)))return i;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++s<a;)if(i=(e=n[s]).type)t[i]=$f(t[i],e.name,r);else if(r==null)for(i in t)t[i]=$f(t[i],e.name,null);return this},copy:function(){var e={},r=this._;for(var t in r)e[t]=r[t].slice();return new kr(e)},call:function(e,r){if((i=arguments.length-2)>0)for(var t=new Array(i),n=0,i,s;n<i;++n)t[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],n=0,i=s.length;n<i;++n)s[n].value.apply(r,t)},apply:function(e,r,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,s=n.length;i<s;++i)n[i].value.apply(r,t)}};function c1(e,r){for(var t=0,n=e.length,i;t<n;++t)if((i=e[t]).name===r)return i.value}function $f(e,r,t){for(var n=0,i=e.length;n<i;++n)if(e[n].name===r){e[n]=a1,e=e.slice(0,n).concat(e.slice(n+1));break}return t!=null&&e.push({name:r,value:t}),e}var Kt=0,cr=0,fr=0,Gf=1e3,jr,lr,Cr=0,Dt=0,Pr=0,hr=typeof performance=="object"&&performance.now?performance:Date,Uf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vf(){return Dt||(Uf(f1),Dt=hr.now()+Pr)}function f1(){Dt=0}function Pn(){this._call=this._time=this._next=null}Pn.prototype=Ln.prototype={constructor:Pn,restart:function(e,r,t){if(typeof e!="function")throw new TypeError("callback is not a function");t=(t==null?Vf():+t)+(r==null?0:+r),!this._next&&lr!==this&&(lr?lr._next=this:jr=this,lr=this),this._call=e,this._time=t,Dn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dn())}};function Ln(e,r,t){var n=new Pn;return n.restart(e,r,t),n}function l1(){Vf(),++Kt;for(var e=jr,r;e;)(r=Dt-e._time)>=0&&e._call.call(void 0,r),e=e._next;--Kt}function Wf(){Dt=(Cr=hr.now())+Pr,Kt=cr=0;try{l1()}finally{Kt=0,d1(),Dt=0}}function h1(){var e=hr.now(),r=e-Cr;r>Gf&&(Pr-=r,Cr=e)}function d1(){for(var e,r=jr,t,n=1/0;r;)r._call?(n>r._time&&(n=r._time),e=r,r=r._next):(t=r._next,r._next=null,r=e?e._next=t:jr=t);lr=e,Dn(n)}function Dn(e){if(!Kt){cr&&(cr=clearTimeout(cr));var r=e-Dt;r>24?(e<1/0&&(cr=setTimeout(Wf,e-hr.now()-Pr)),fr&&(fr=clearInterval(fr))):(fr||(Cr=hr.now(),fr=setInterval(h1,Gf)),Kt=1,Uf(Wf))}}const g1=1664525,p1=1013904223,Yf=4294967296;function v1(){let e=1;return()=>(e=(g1*e+p1)%Yf)/Yf}function m1(e){return e.x}function y1(e){return e.y}var w1=10,b1=Math.PI*(3-Math.sqrt(5));function _1(e){var r,t=1,n=.001,i=1-Math.pow(n,1/300),s=0,a=.6,o=new Map,c=Ln(p),f=Cn("tick","end"),l=v1();e==null&&(e=[]);function p(){m(),f.call("tick",r),t<n&&(c.stop(),f.call("end",r))}function m(_){var b,w=e.length,E;_===void 0&&(_=1);for(var N=0;N<_;++N)for(t+=(s-t)*i,o.forEach(function(S){S(t)}),b=0;b<w;++b)E=e[b],E.fx==null?E.x+=E.vx*=a:(E.x=E.fx,E.vx=0),E.fy==null?E.y+=E.vy*=a:(E.y=E.fy,E.vy=0);return r}function y(){for(var _=0,b=e.length,w;_<b;++_){if(w=e[_],w.index=_,w.fx!=null&&(w.x=w.fx),w.fy!=null&&(w.y=w.fy),isNaN(w.x)||isNaN(w.y)){var E=w1*Math.sqrt(.5+_),N=_*b1;w.x=E*Math.cos(N),w.y=E*Math.sin(N)}(isNaN(w.vx)||isNaN(w.vy))&&(w.vx=w.vy=0)}}function x(_){return _.initialize&&_.initialize(e,l),_}return y(),r={tick:m,restart:function(){return c.restart(p),r},stop:function(){return c.stop(),r},nodes:function(_){return arguments.length?(e=_,y(),o.forEach(x),r):e},alpha:function(_){return arguments.length?(t=+_,r):t},alphaMin:function(_){return arguments.length?(n=+_,r):n},alphaDecay:function(_){return arguments.length?(i=+_,r):+i},alphaTarget:function(_){return arguments.length?(s=+_,r):s},velocityDecay:function(_){return arguments.length?(a=1-_,r):1-a},randomSource:function(_){return arguments.length?(l=_,o.forEach(x),r):l},force:function(_,b){return arguments.length>1?(b==null?o.delete(_):o.set(_,x(b)),r):o.get(_)},find:function(_,b,w){var E=0,N=e.length,S,R,A,j,I;for(w==null?w=1/0:w*=w,E=0;E<N;++E)j=e[E],S=_-j.x,R=b-j.y,A=S*S+R*R,A<w&&(I=j,w=A);return I},on:function(_,b){return arguments.length>1?(f.on(_,b),r):f.on(_)}}}function E1(){var e,r,t,n,i=$e(-30),s,a=1,o=1/0,c=.81;function f(y){var x,_=e.length,b=Yt(e,m1,y1).visitAfter(p);for(n=y,x=0;x<_;++x)r=e[x],b.visit(m)}function l(){if(e){var y,x=e.length,_;for(s=new Array(x),y=0;y<x;++y)_=e[y],s[_.index]=+i(_,y,e)}}function p(y){var x=0,_,b,w=0,E,N,S;if(y.length){for(E=N=S=0;S<4;++S)(_=y[S])&&(b=Math.abs(_.value))&&(x+=_.value,w+=b,E+=b*_.x,N+=b*_.y);y.x=E/w,y.y=N/w}else{_=y,_.x=_.data.x,_.y=_.data.y;do x+=s[_.data.index];while(_=_.next)}y.value=x}function m(y,x,_,b){if(!y.value)return!0;var w=y.x-r.x,E=y.y-r.y,N=b-x,S=w*w+E*E;if(N*N/c<S)return S<o&&(w===0&&(w=Tt(t),S+=w*w),E===0&&(E=Tt(t),S+=E*E),S<a&&(S=Math.sqrt(a*S)),r.vx+=w*y.value*n/S,r.vy+=E*y.value*n/S),!0;if(y.length||S>=o)return;(y.data!==r||y.next)&&(w===0&&(w=Tt(t),S+=w*w),E===0&&(E=Tt(t),S+=E*E),S<a&&(S=Math.sqrt(a*S)));do y.data!==r&&(N=s[y.data.index]*n/S,r.vx+=w*N,r.vy+=E*N);while(y=y.next)}return f.initialize=function(y,x){e=y,t=x,l()},f.strength=function(y){return arguments.length?(i=typeof y=="function"?y:$e(+y),l(),f):i},f.distanceMin=function(y){return arguments.length?(a=y*y,f):Math.sqrt(a)},f.distanceMax=function(y){return arguments.length?(o=y*y,f):Math.sqrt(o)},f.theta=function(y){return arguments.length?(c=y*y,f):Math.sqrt(c)},f}function x1(e,r,t){var n,i=$e(.1),s,a;typeof e!="function"&&(e=$e(+e)),r==null&&(r=0),t==null&&(t=0);function o(f){for(var l=0,p=n.length;l<p;++l){var m=n[l],y=m.x-r||1e-6,x=m.y-t||1e-6,_=Math.sqrt(y*y+x*x),b=(a[l]-_)*s[l]*f/_;m.vx+=y*b,m.vy+=x*b}}function c(){if(n){var f,l=n.length;for(s=new Array(l),a=new Array(l),f=0;f<l;++f)a[f]=+e(n[f],f,n),s[f]=isNaN(a[f])?0:+i(n[f],f,n)}}return o.initialize=function(f){n=f,c()},o.strength=function(f){return arguments.length?(i=typeof f=="function"?f:$e(+f),c(),o):i},o.radius=function(f){return arguments.length?(e=typeof f=="function"?f:$e(+f),c(),o):e},o.x=function(f){return arguments.length?(r=+f,o):r},o.y=function(f){return arguments.length?(t=+f,o):t},o}function N1(e){var r=$e(.1),t,n,i;typeof e!="function"&&(e=$e(e==null?0:+e));function s(o){for(var c=0,f=t.length,l;c<f;++c)l=t[c],l.vx+=(i[c]-l.x)*n[c]*o}function a(){if(t){var o,c=t.length;for(n=new Array(c),i=new Array(c),o=0;o<c;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(r=typeof o=="function"?o:$e(+o),a(),s):r},s.x=function(o){return arguments.length?(e=typeof o=="function"?o:$e(+o),a(),s):e},s}function M1(e){var r=$e(.1),t,n,i;typeof e!="function"&&(e=$e(e==null?0:+e));function s(o){for(var c=0,f=t.length,l;c<f;++c)l=t[c],l.vy+=(i[c]-l.y)*n[c]*o}function a(){if(t){var o,c=t.length;for(n=new Array(c),i=new Array(c),o=0;o<c;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(r=typeof o=="function"?o:$e(+o),a(),s):r},s.y=function(o){return arguments.length?(e=typeof o=="function"?o:$e(+o),a(),s):e},s}class Kf{constructor(r){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:o1,manyBody:E1,center:t1,collide:i1,radial:x1,x:N1,y:M1},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Uc(this.options,r),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericLayout(!0,r,t)})}stop(){this.simulation.stop()}tick(r){return this.simulation.tick(r),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(r,t){const n=this.context.nodes.find(i=>i.id===r);n&&t.forEach((i,s)=>{if(typeof i=="number"||i===null){const a=["fx","fy","fz"][s];n[a]=i}})}getOptions(r){var t,n;const i=Uc({},this.options,r);return i.collide&&((t=i.collide)===null||t===void 0?void 0:t.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(r,t,n){var i;return se(this,void 0,void 0,function*(){const s=this.getOptions(n),a=t.getAllNodes().map(({id:l,data:p})=>Object.assign(Object.assign({id:l},p),Vc(p.data,this.config.inputNodeAttrs))),o=t.getAllEdges().map(l=>Object.assign({},l));Object.assign(this.context,{assign:r,nodes:a,edges:o,graph:t});const c=new Promise(l=>{this.resolver=l}),f=this.setSimulation(s);return f.nodes(a),(i=f.force("link"))===null||i===void 0||i.links(o),c})}getResult(){const{assign:r,nodes:t,edges:n,graph:i}=this.context,s=t.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Vc(o,this.config.outputNodeAttrs))})),a=n.map(({id:o,source:c,target:f,data:l})=>({id:o,source:typeof c=="object"?c.id:c,target:typeof f=="object"?f.id:f,data:l}));return r&&s.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:s,edges:a}}initSimulation(){return _1()}setSimulation(r){const t=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=t.on("tick",()=>{var n;return(n=r.onTick)===null||n===void 0?void 0:n.call(r,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),Xf(t,this.config.simulationAttrs.map(n=>[n,r[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const s=n;if(r[n]){let a=t.force(s);a||(a=i(),t.force(s,a)),Xf(a,Object.entries(r[s]))}else t.force(s,null)}),t}}const Xf=(e,r)=>r.reduce((t,[n,i])=>!t[n]||i===void 0?t:t[n].call(e,i),e);function S1(e,r,t){var n,i=1;e==null&&(e=0),r==null&&(r=0),t==null&&(t=0);function s(){var a,o=n.length,c,f=0,l=0,p=0;for(a=0;a<o;++a)c=n[a],f+=c.x||0,l+=c.y||0,p+=c.z||0;for(f=(f/o-e)*i,l=(l/o-r)*i,p=(p/o-t)*i,a=0;a<o;++a)c=n[a],f&&(c.x-=f),l&&(c.y-=l),p&&(c.z-=p)}return s.initialize=function(a){n=a},s.x=function(a){return arguments.length?(e=+a,s):e},s.y=function(a){return arguments.length?(r=+a,s):r},s.z=function(a){return arguments.length?(t=+a,s):t},s.strength=function(a){return arguments.length?(i=+a,s):i},s}function q1(e){const r=+this._x.call(null,e);return Zf(this.cover(r),r,e)}function Zf(e,r,t){if(isNaN(r))return e;var n,i=e._root,s={data:t},a=e._x0,o=e._x1,c,f,l,p,m;if(!i)return e._root=s,e;for(;i.length;)if((l=r>=(c=(a+o)/2))?a=c:o=c,n=i,!(i=i[p=+l]))return n[p]=s,e;if(f=+e._x.call(null,i.data),r===f)return s.next=i,n?n[p]=s:e._root=s,e;do n=n?n[p]=new Array(2):e._root=new Array(2),(l=r>=(c=(a+o)/2))?a=c:o=c;while((p=+l)==(m=+(f>=c)));return n[m]=i,n[p]=s,e}function R1(e){Array.isArray(e)||(e=Array.from(e));const r=e.length,t=new Float64Array(r);let n=1/0,i=-1/0;for(let s=0,a;s<r;++s)isNaN(a=+this._x.call(null,e[s]))||(t[s]=a,a<n&&(n=a),a>i&&(i=a));if(n>i)return this;this.cover(n).cover(i);for(let s=0;s<r;++s)Zf(this,t[s],e[s]);return this}function O1(e){if(isNaN(e=+e))return this;var r=this._x0,t=this._x1;if(isNaN(r))t=(r=Math.floor(e))+1;else{for(var n=t-r||1,i=this._root,s,a;r>e||e>=t;)switch(a=+(e<r),s=new Array(2),s[a]=i,i=s,n*=2,a){case 0:t=r+n;break;case 1:r=t-n;break}this._root&&this._root.length&&(this._root=i)}return this._x0=r,this._x1=t,this}function A1(){var e=[];return this.visit(function(r){if(!r.length)do e.push(r.data);while(r=r.next)}),e}function I1(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function _t(e,r,t){this.node=e,this.x0=r,this.x1=t}function T1(e,r){var t,n=this._x0,i,s,a=this._x1,o=[],c=this._root,f,l;for(c&&o.push(new _t(c,n,a)),r==null?r=1/0:(n=e-r,a=e+r);f=o.pop();)if(!(!(c=f.node)||(i=f.x0)>a||(s=f.x1)<n))if(c.length){var p=(i+s)/2;o.push(new _t(c[1],p,s),new _t(c[0],i,p)),(l=+(e>=p))&&(f=o[o.length-1],o[o.length-1]=o[o.length-1-l],o[o.length-1-l]=f)}else{var m=Math.abs(e-+this._x.call(null,c.data));m<r&&(r=m,n=e-m,a=e+m,t=c.data)}return t}function k1(e){if(isNaN(c=+this._x.call(null,e)))return this;var r,t=this._root,n,i,s,a=this._x0,o=this._x1,c,f,l,p,m;if(!t)return this;if(t.length)for(;;){if((l=c>=(f=(a+o)/2))?a=f:o=f,r=t,!(t=t[p=+l]))return this;if(!t.length)break;r[p+1&1]&&(n=r,m=p)}for(;t.data!==e;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):r?(s?r[p]=s:delete r[p],(t=r[0]||r[1])&&t===(r[1]||r[0])&&!t.length&&(n?n[m]=t:this._root=t),this):(this._root=s,this)}function j1(e){for(var r=0,t=e.length;r<t;++r)this.remove(e[r]);return this}function C1(){return this._root}function P1(){var e=0;return this.visit(function(r){if(!r.length)do++e;while(r=r.next)}),e}function L1(e){var r=[],t,n=this._root,i,s,a;for(n&&r.push(new _t(n,this._x0,this._x1));t=r.pop();)if(!e(n=t.node,s=t.x0,a=t.x1)&&n.length){var o=(s+a)/2;(i=n[1])&&r.push(new _t(i,o,a)),(i=n[0])&&r.push(new _t(i,s,o))}return this}function D1(e){var r=[],t=[],n;for(this._root&&r.push(new _t(this._root,this._x0,this._x1));n=r.pop();){var i=n.node;if(i.length){var s,a=n.x0,o=n.x1,c=(a+o)/2;(s=i[0])&&r.push(new _t(s,a,c)),(s=i[1])&&r.push(new _t(s,c,o))}t.push(n)}for(;n=t.pop();)e(n.node,n.x0,n.x1);return this}function z1(e){return e[0]}function F1(e){return arguments.length?(this._x=e,this):this._x}function zn(e,r){var t=new Fn(r==null?z1:r,NaN,NaN);return e==null?t:t.addAll(e)}function Fn(e,r,t){this._x=e,this._x0=r,this._x1=t,this._root=void 0}function Jf(e){for(var r={data:e.data},t=r;e=e.next;)t=t.next={data:e.data};return r}var rt=zn.prototype=Fn.prototype;rt.copy=function(){var e=new Fn(this._x,this._x0,this._x1),r=this._root,t,n;if(!r)return e;if(!r.length)return e._root=Jf(r),e;for(t=[{source:r,target:e._root=new Array(2)}];r=t.pop();)for(var i=0;i<2;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(2)}):r.target[i]=Jf(n));return e},rt.add=q1,rt.addAll=R1,rt.cover=O1,rt.data=A1,rt.extent=I1,rt.find=T1,rt.remove=k1,rt.removeAll=j1,rt.root=C1,rt.size=P1,rt.visit=L1,rt.visitAfter=D1,rt.x=F1;function Le(e){return function(){return e}}function at(e){return(e()-.5)*1e-6}function Bn(e){return e.x+e.vx}function Qf(e){return e.y+e.vy}function B1(e){return e.z+e.vz}function $1(e){var r,t,n,i,s=1,a=1;typeof e!="function"&&(e=Le(e==null?1:+e));function o(){for(var l,p=r.length,m,y,x,_,b,w,E,N=0;N<a;++N)for(m=(t===1?zn(r,Bn):t===2?Yt(r,Bn,Qf):t===3?Ar(r,Bn,Qf,B1):null).visitAfter(c),l=0;l<p;++l)y=r[l],w=n[y.index],E=w*w,x=y.x+y.vx,t>1&&(_=y.y+y.vy),t>2&&(b=y.z+y.vz),m.visit(S);function S(R,A,j,I,D,z,$){var V=[A,j,I,D,z,$],Y=V[0],ee=V[1],J=V[2],ue=V[t],be=V[t+1],Z=V[t+2],ce=R.data,pe=R.r,he=w+pe;if(ce){if(ce.index>y.index){var ie=x-ce.x-ce.vx,_e=t>1?_-ce.y-ce.vy:0,G=t>2?b-ce.z-ce.vz:0,P=ie*ie+_e*_e+G*G;P<he*he&&(ie===0&&(ie=at(i),P+=ie*ie),t>1&&_e===0&&(_e=at(i),P+=_e*_e),t>2&&G===0&&(G=at(i),P+=G*G),P=(he-(P=Math.sqrt(P)))/P*s,y.vx+=(ie*=P)*(he=(pe*=pe)/(E+pe)),t>1&&(y.vy+=(_e*=P)*he),t>2&&(y.vz+=(G*=P)*he),ce.vx-=ie*(he=1-he),t>1&&(ce.vy-=_e*he),t>2&&(ce.vz-=G*he))}return}return Y>x+he||ue<x-he||t>1&&(ee>_+he||be<_-he)||t>2&&(J>b+he||Z<b-he)}}function c(l){if(l.data)return l.r=n[l.data.index];for(var p=l.r=0;p<Math.pow(2,t);++p)l[p]&&l[p].r>l.r&&(l.r=l[p].r)}function f(){if(r){var l,p=r.length,m;for(n=new Array(p),l=0;l<p;++l)m=r[l],n[m.index]=+e(m,l,r)}}return o.initialize=function(l,...p){r=l,i=p.find(m=>typeof m=="function")||Math.random,t=p.find(m=>[1,2,3].includes(m))||2,f()},o.iterations=function(l){return arguments.length?(a=+l,o):a},o.strength=function(l){return arguments.length?(s=+l,o):s},o.radius=function(l){return arguments.length?(e=typeof l=="function"?l:Le(+l),f(),o):e},o}function G1(e){return e.index}function Hf(e,r){var t=e.get(r);if(!t)throw new Error("node not found: "+r);return t}function U1(e){var r=G1,t=m,n,i=Le(30),s,a,o,c,f,l,p=1;e==null&&(e=[]);function m(w){return 1/Math.min(c[w.source.index],c[w.target.index])}function y(w){for(var E=0,N=e.length;E<p;++E)for(var S=0,R,A,j,I=0,D=0,z=0,$,V;S<N;++S)R=e[S],A=R.source,j=R.target,I=j.x+j.vx-A.x-A.vx||at(l),o>1&&(D=j.y+j.vy-A.y-A.vy||at(l)),o>2&&(z=j.z+j.vz-A.z-A.vz||at(l)),$=Math.sqrt(I*I+D*D+z*z),$=($-s[S])/$*w*n[S],I*=$,D*=$,z*=$,j.vx-=I*(V=f[S]),o>1&&(j.vy-=D*V),o>2&&(j.vz-=z*V),A.vx+=I*(V=1-V),o>1&&(A.vy+=D*V),o>2&&(A.vz+=z*V)}function x(){if(a){var w,E=a.length,N=e.length,S=new Map(a.map((A,j)=>[r(A,j,a),A])),R;for(w=0,c=new Array(E);w<N;++w)R=e[w],R.index=w,typeof R.source!="object"&&(R.source=Hf(S,R.source)),typeof R.target!="object"&&(R.target=Hf(S,R.target)),c[R.source.index]=(c[R.source.index]||0)+1,c[R.target.index]=(c[R.target.index]||0)+1;for(w=0,f=new Array(N);w<N;++w)R=e[w],f[w]=c[R.source.index]/(c[R.source.index]+c[R.target.index]);n=new Array(N),_(),s=new Array(N),b()}}function _(){if(a)for(var w=0,E=e.length;w<E;++w)n[w]=+t(e[w],w,e)}function b(){if(a)for(var w=0,E=e.length;w<E;++w)s[w]=+i(e[w],w,e)}return y.initialize=function(w,...E){a=w,l=E.find(N=>typeof N=="function")||Math.random,o=E.find(N=>[1,2,3].includes(N))||2,x()},y.links=function(w){return arguments.length?(e=w,x(),y):e},y.id=function(w){return arguments.length?(r=w,y):r},y.iterations=function(w){return arguments.length?(p=+w,y):p},y.strength=function(w){return arguments.length?(t=typeof w=="function"?w:Le(+w),_(),y):t},y.distance=function(w){return arguments.length?(i=typeof w=="function"?w:Le(+w),b(),y):i},y}const V1=1664525,W1=1013904223,el=4294967296;function Y1(){let e=1;return()=>(e=(V1*e+W1)%el)/el}var tl=3;function $n(e){return e.x}function rl(e){return e.y}function K1(e){return e.z}var X1=10,Z1=Math.PI*(3-Math.sqrt(5)),J1=Math.PI*20/(9+Math.sqrt(221));function Q1(e,r){r=r||2;var t=Math.min(tl,Math.max(1,Math.round(r))),n,i=1,s=.001,a=1-Math.pow(s,1/300),o=0,c=.6,f=new Map,l=Ln(y),p=Cn("tick","end"),m=Y1();e==null&&(e=[]);function y(){x(),p.call("tick",n),i<s&&(l.stop(),p.call("end",n))}function x(w){var E,N=e.length,S;w===void 0&&(w=1);for(var R=0;R<w;++R)for(i+=(o-i)*a,f.forEach(function(A){A(i)}),E=0;E<N;++E)S=e[E],S.fx==null?S.x+=S.vx*=c:(S.x=S.fx,S.vx=0),t>1&&(S.fy==null?S.y+=S.vy*=c:(S.y=S.fy,S.vy=0)),t>2&&(S.fz==null?S.z+=S.vz*=c:(S.z=S.fz,S.vz=0));return n}function _(){for(var w=0,E=e.length,N;w<E;++w){if(N=e[w],N.index=w,N.fx!=null&&(N.x=N.fx),N.fy!=null&&(N.y=N.fy),N.fz!=null&&(N.z=N.fz),isNaN(N.x)||t>1&&isNaN(N.y)||t>2&&isNaN(N.z)){var S=X1*(t>2?Math.cbrt(.5+w):t>1?Math.sqrt(.5+w):w),R=w*Z1,A=w*J1;t===1?N.x=S:t===2?(N.x=S*Math.cos(R),N.y=S*Math.sin(R)):(N.x=S*Math.sin(R)*Math.cos(A),N.y=S*Math.cos(R),N.z=S*Math.sin(R)*Math.sin(A))}(isNaN(N.vx)||t>1&&isNaN(N.vy)||t>2&&isNaN(N.vz))&&(N.vx=0,t>1&&(N.vy=0),t>2&&(N.vz=0))}}function b(w){return w.initialize&&w.initialize(e,m,t),w}return _(),n={tick:x,restart:function(){return l.restart(y),n},stop:function(){return l.stop(),n},numDimensions:function(w){return arguments.length?(t=Math.min(tl,Math.max(1,Math.round(w))),f.forEach(b),n):t},nodes:function(w){return arguments.length?(e=w,_(),f.forEach(b),n):e},alpha:function(w){return arguments.length?(i=+w,n):i},alphaMin:function(w){return arguments.length?(s=+w,n):s},alphaDecay:function(w){return arguments.length?(a=+w,n):+a},alphaTarget:function(w){return arguments.length?(o=+w,n):o},velocityDecay:function(w){return arguments.length?(c=1-w,n):1-c},randomSource:function(w){return arguments.length?(m=w,f.forEach(b),n):m},force:function(w,E){return arguments.length>1?(E==null?f.delete(w):f.set(w,b(E)),n):f.get(w)},find:function(){var w=Array.prototype.slice.call(arguments),E=w.shift()||0,N=(t>1?w.shift():null)||0,S=(t>2?w.shift():null)||0,R=w.shift()||1/0,A=0,j=e.length,I,D,z,$,V,Y;for(R*=R,A=0;A<j;++A)V=e[A],I=E-V.x,D=N-(V.y||0),z=S-(V.z||0),$=I*I+D*D+z*z,$<R&&(Y=V,R=$);return Y},on:function(w,E){return arguments.length>1?(p.on(w,E),n):p.on(w)}}}function H1(){var e,r,t,n,i,s=Le(-30),a,o=1,c=1/0,f=.81;function l(x){var _,b=e.length,w=(r===1?zn(e,$n):r===2?Yt(e,$n,rl):r===3?Ar(e,$n,rl,K1):null).visitAfter(m);for(i=x,_=0;_<b;++_)t=e[_],w.visit(y)}function p(){if(e){var x,_=e.length,b;for(a=new Array(_),x=0;x<_;++x)b=e[x],a[b.index]=+s(b,x,e)}}function m(x){var _=0,b,w,E=0,N,S,R,A,j=x.length;if(j){for(N=S=R=A=0;A<j;++A)(b=x[A])&&(w=Math.abs(b.value))&&(_+=b.value,E+=w,N+=w*(b.x||0),S+=w*(b.y||0),R+=w*(b.z||0));_*=Math.sqrt(4/j),x.x=N/E,r>1&&(x.y=S/E),r>2&&(x.z=R/E)}else{b=x,b.x=b.data.x,r>1&&(b.y=b.data.y),r>2&&(b.z=b.data.z);do _+=a[b.data.index];while(b=b.next)}x.value=_}function y(x,_,b,w,E){if(!x.value)return!0;var N=[b,w,E][r-1],S=x.x-t.x,R=r>1?x.y-t.y:0,A=r>2?x.z-t.z:0,j=N-_,I=S*S+R*R+A*A;if(j*j/f<I)return I<c&&(S===0&&(S=at(n),I+=S*S),r>1&&R===0&&(R=at(n),I+=R*R),r>2&&A===0&&(A=at(n),I+=A*A),I<o&&(I=Math.sqrt(o*I)),t.vx+=S*x.value*i/I,r>1&&(t.vy+=R*x.value*i/I),r>2&&(t.vz+=A*x.value*i/I)),!0;if(x.length||I>=c)return;(x.data!==t||x.next)&&(S===0&&(S=at(n),I+=S*S),r>1&&R===0&&(R=at(n),I+=R*R),r>2&&A===0&&(A=at(n),I+=A*A),I<o&&(I=Math.sqrt(o*I)));do x.data!==t&&(j=a[x.data.index]*i/I,t.vx+=S*j,r>1&&(t.vy+=R*j),r>2&&(t.vz+=A*j));while(x=x.next)}return l.initialize=function(x,..._){e=x,n=_.find(b=>typeof b=="function")||Math.random,r=_.find(b=>[1,2,3].includes(b))||2,p()},l.strength=function(x){return arguments.length?(s=typeof x=="function"?x:Le(+x),p(),l):s},l.distanceMin=function(x){return arguments.length?(o=x*x,l):Math.sqrt(o)},l.distanceMax=function(x){return arguments.length?(c=x*x,l):Math.sqrt(c)},l.theta=function(x){return arguments.length?(f=x*x,l):Math.sqrt(f)},l}function eb(e,r,t,n){var i,s,a=Le(.1),o,c;typeof e!="function"&&(e=Le(+e)),r==null&&(r=0),t==null&&(t=0),n==null&&(n=0);function f(p){for(var m=0,y=i.length;m<y;++m){var x=i[m],_=x.x-r||1e-6,b=(x.y||0)-t||1e-6,w=(x.z||0)-n||1e-6,E=Math.sqrt(_*_+b*b+w*w),N=(c[m]-E)*o[m]*p/E;x.vx+=_*N,s>1&&(x.vy+=b*N),s>2&&(x.vz+=w*N)}}function l(){if(i){var p,m=i.length;for(o=new Array(m),c=new Array(m),p=0;p<m;++p)c[p]=+e(i[p],p,i),o[p]=isNaN(c[p])?0:+a(i[p],p,i)}}return f.initialize=function(p,...m){i=p,s=m.find(y=>[1,2,3].includes(y))||2,l()},f.strength=function(p){return arguments.length?(a=typeof p=="function"?p:Le(+p),l(),f):a},f.radius=function(p){return arguments.length?(e=typeof p=="function"?p:Le(+p),l(),f):e},f.x=function(p){return arguments.length?(r=+p,f):r},f.y=function(p){return arguments.length?(t=+p,f):t},f.z=function(p){return arguments.length?(n=+p,f):n},f}function tb(e){var r=Le(.1),t,n,i;typeof e!="function"&&(e=Le(e==null?0:+e));function s(o){for(var c=0,f=t.length,l;c<f;++c)l=t[c],l.vx+=(i[c]-l.x)*n[c]*o}function a(){if(t){var o,c=t.length;for(n=new Array(c),i=new Array(c),o=0;o<c;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(r=typeof o=="function"?o:Le(+o),a(),s):r},s.x=function(o){return arguments.length?(e=typeof o=="function"?o:Le(+o),a(),s):e},s}function rb(e){var r=Le(.1),t,n,i;typeof e!="function"&&(e=Le(e==null?0:+e));function s(o){for(var c=0,f=t.length,l;c<f;++c)l=t[c],l.vy+=(i[c]-l.y)*n[c]*o}function a(){if(t){var o,c=t.length;for(n=new Array(c),i=new Array(c),o=0;o<c;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(r=typeof o=="function"?o:Le(+o),a(),s):r},s.y=function(o){return arguments.length?(e=typeof o=="function"?o:Le(+o),a(),s):e},s}function nb(e){var r=Le(.1),t,n,i;typeof e!="function"&&(e=Le(e==null?0:+e));function s(o){for(var c=0,f=t.length,l;c<f;++c)l=t[c],l.vz+=(i[c]-l.z)*n[c]*o}function a(){if(t){var o,c=t.length;for(n=new Array(c),i=new Array(c),o=0;o<c;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return s.initialize=function(o){t=o,a()},s.strength=function(o){return arguments.length?(r=typeof o=="function"?o:Le(+o),a(),s):r},s.z=function(o){return arguments.length?(e=typeof o=="function"?o:Le(+o),a(),s):e},s}class ib extends Kf{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:U1,manyBody:H1,center:S1,collide:$1,radial:eb,x:tb,y:rb,z:nb},this.options={numDimensions:3,link:{id:r=>r.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return Q1()}}function Gn(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Un,nl;function sb(){if(nl)return Un;nl=1;function e(){this.__data__=[],this.size=0}return Un=e,Un}var Vn,il;function Xt(){if(il)return Vn;il=1;function e(r,t){return r===t||r!==r&&t!==t}return Vn=e,Vn}var Wn,sl;function Lr(){if(sl)return Wn;sl=1;var e=Xt();function r(t,n){for(var i=t.length;i--;)if(e(t[i][0],n))return i;return-1}return Wn=r,Wn}var Yn,ol;function ob(){if(ol)return Yn;ol=1;var e=Lr(),r=Array.prototype,t=r.splice;function n(i){var s=this.__data__,a=e(s,i);if(a<0)return!1;var o=s.length-1;return a==o?s.pop():t.call(s,a,1),--this.size,!0}return Yn=n,Yn}var Kn,al;function ab(){if(al)return Kn;al=1;var e=Lr();function r(t){var n=this.__data__,i=e(n,t);return i<0?void 0:n[i][1]}return Kn=r,Kn}var Xn,ul;function ub(){if(ul)return Xn;ul=1;var e=Lr();function r(t){return e(this.__data__,t)>-1}return Xn=r,Xn}var Zn,cl;function cb(){if(cl)return Zn;cl=1;var e=Lr();function r(t,n){var i=this.__data__,s=e(i,t);return s<0?(++this.size,i.push([t,n])):i[s][1]=n,this}return Zn=r,Zn}var Jn,fl;function Dr(){if(fl)return Jn;fl=1;var e=sb(),r=ob(),t=ab(),n=ub(),i=cb();function s(a){var o=-1,c=a==null?0:a.length;for(this.clear();++o<c;){var f=a[o];this.set(f[0],f[1])}}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=t,s.prototype.has=n,s.prototype.set=i,Jn=s,Jn}var Qn,ll;function fb(){if(ll)return Qn;ll=1;var e=Dr();function r(){this.__data__=new e,this.size=0}return Qn=r,Qn}var Hn,hl;function lb(){if(hl)return Hn;hl=1;function e(r){var t=this.__data__,n=t.delete(r);return this.size=t.size,n}return Hn=e,Hn}var ei,dl;function hb(){if(dl)return ei;dl=1;function e(r){return this.__data__.get(r)}return ei=e,ei}var ti,gl;function db(){if(gl)return ti;gl=1;function e(r){return this.__data__.has(r)}return ti=e,ti}var ri,pl;function vl(){if(pl)return ri;pl=1;var e=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir;return ri=e,ri}var ni,ml;function ft(){if(ml)return ni;ml=1;var e=vl(),r=typeof self=="object"&&self&&self.Object===Object&&self,t=e||r||Function("return this")();return ni=t,ni}var ii,yl;function Zt(){if(yl)return ii;yl=1;var e=ft(),r=e.Symbol;return ii=r,ii}var si,wl;function gb(){if(wl)return si;wl=1;var e=Zt(),r=Object.prototype,t=r.hasOwnProperty,n=r.toString,i=e?e.toStringTag:void 0;function s(a){var o=t.call(a,i),c=a[i];try{a[i]=void 0;var f=!0}catch(p){}var l=n.call(a);return f&&(o?a[i]=c:delete a[i]),l}return si=s,si}var oi,bl;function pb(){if(bl)return oi;bl=1;var e=Object.prototype,r=e.toString;function t(n){return r.call(n)}return oi=t,oi}var ai,_l;function zt(){if(_l)return ai;_l=1;var e=Zt(),r=gb(),t=pb(),n="[object Null]",i="[object Undefined]",s=e?e.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?r(o):t(o)}return ai=a,ai}var ui,El;function ut(){if(El)return ui;El=1;function e(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}return ui=e,ui}var ci,xl;function dr(){if(xl)return ci;xl=1;var e=zt(),r=ut(),t="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function a(o){if(!r(o))return!1;var c=e(o);return c==n||c==i||c==t||c==s}return ci=a,ci}var fi,Nl;function vb(){if(Nl)return fi;Nl=1;var e=ft(),r=e["__core-js_shared__"];return fi=r,fi}var li,Ml;function mb(){if(Ml)return li;Ml=1;var e=vb(),r=function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function t(n){return!!r&&r in n}return li=t,li}var hi,Sl;function ql(){if(Sl)return hi;Sl=1;var e=Function.prototype,r=e.toString;function t(n){if(n!=null){try{return r.call(n)}catch(i){}try{return n+""}catch(i){}}return""}return hi=t,hi}var di,Rl;function yb(){if(Rl)return di;Rl=1;var e=dr(),r=mb(),t=ut(),n=ql(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,a=Function.prototype,o=Object.prototype,c=a.toString,f=o.hasOwnProperty,l=RegExp("^"+c.call(f).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){if(!t(m)||r(m))return!1;var y=e(m)?l:s;return y.test(n(m))}return di=p,di}var gi,Ol;function wb(){if(Ol)return gi;Ol=1;function e(r,t){return r==null?void 0:r[t]}return gi=e,gi}var pi,Al;function Ft(){if(Al)return pi;Al=1;var e=yb(),r=wb();function t(n,i){var s=r(n,i);return e(s)?s:void 0}return pi=t,pi}var vi,Il;function mi(){if(Il)return vi;Il=1;var e=Ft(),r=ft(),t=e(r,"Map");return vi=t,vi}var yi,Tl;function zr(){if(Tl)return yi;Tl=1;var e=Ft(),r=e(Object,"create");return yi=r,yi}var wi,kl;function bb(){if(kl)return wi;kl=1;var e=zr();function r(){this.__data__=e?e(null):{},this.size=0}return wi=r,wi}var bi,jl;function _b(){if(jl)return bi;jl=1;function e(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}return bi=e,bi}var _i,Cl;function Eb(){if(Cl)return _i;Cl=1;var e=zr(),r="__lodash_hash_undefined__",t=Object.prototype,n=t.hasOwnProperty;function i(s){var a=this.__data__;if(e){var o=a[s];return o===r?void 0:o}return n.call(a,s)?a[s]:void 0}return _i=i,_i}var Ei,Pl;function xb(){if(Pl)return Ei;Pl=1;var e=zr(),r=Object.prototype,t=r.hasOwnProperty;function n(i){var s=this.__data__;return e?s[i]!==void 0:t.call(s,i)}return Ei=n,Ei}var xi,Ll;function Nb(){if(Ll)return xi;Ll=1;var e=zr(),r="__lodash_hash_undefined__";function t(n,i){var s=this.__data__;return this.size+=this.has(n)?0:1,s[n]=e&&i===void 0?r:i,this}return xi=t,xi}var Ni,Dl;function Mb(){if(Dl)return Ni;Dl=1;var e=bb(),r=_b(),t=Eb(),n=xb(),i=Nb();function s(a){var o=-1,c=a==null?0:a.length;for(this.clear();++o<c;){var f=a[o];this.set(f[0],f[1])}}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=t,s.prototype.has=n,s.prototype.set=i,Ni=s,Ni}var Mi,zl;function Sb(){if(zl)return Mi;zl=1;var e=Mb(),r=Dr(),t=mi();function n(){this.size=0,this.__data__={hash:new e,map:new(t||r),string:new e}}return Mi=n,Mi}var Si,Fl;function qb(){if(Fl)return Si;Fl=1;function e(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}return Si=e,Si}var qi,Bl;function Fr(){if(Bl)return qi;Bl=1;var e=qb();function r(t,n){var i=t.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return qi=r,qi}var Ri,$l;function Rb(){if($l)return Ri;$l=1;var e=Fr();function r(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}return Ri=r,Ri}var Oi,Gl;function Ob(){if(Gl)return Oi;Gl=1;var e=Fr();function r(t){return e(this,t).get(t)}return Oi=r,Oi}var Ai,Ul;function Ab(){if(Ul)return Ai;Ul=1;var e=Fr();function r(t){return e(this,t).has(t)}return Ai=r,Ai}var Ii,Vl;function Ib(){if(Vl)return Ii;Vl=1;var e=Fr();function r(t,n){var i=e(this,t),s=i.size;return i.set(t,n),this.size+=i.size==s?0:1,this}return Ii=r,Ii}var Ti,Wl;function ki(){if(Wl)return Ti;Wl=1;var e=Sb(),r=Rb(),t=Ob(),n=Ab(),i=Ib();function s(a){var o=-1,c=a==null?0:a.length;for(this.clear();++o<c;){var f=a[o];this.set(f[0],f[1])}}return s.prototype.clear=e,s.prototype.delete=r,s.prototype.get=t,s.prototype.has=n,s.prototype.set=i,Ti=s,Ti}var ji,Yl;function Tb(){if(Yl)return ji;Yl=1;var e=Dr(),r=mi(),t=ki(),n=200;function i(s,a){var o=this.__data__;if(o instanceof e){var c=o.__data__;if(!r||c.length<n-1)return c.push([s,a]),this.size=++o.size,this;o=this.__data__=new t(c)}return o.set(s,a),this.size=o.size,this}return ji=i,ji}var Ci,Kl;function Br(){if(Kl)return Ci;Kl=1;var e=Dr(),r=fb(),t=lb(),n=hb(),i=db(),s=Tb();function a(o){var c=this.__data__=new e(o);this.size=c.size}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=i,a.prototype.set=s,Ci=a,Ci}var Pi,Xl;function Li(){if(Xl)return Pi;Xl=1;function e(r,t){for(var n=-1,i=r==null?0:r.length;++n<i&&t(r[n],n,r)!==!1;);return r}return Pi=e,Pi}var Di,Zl;function Jl(){if(Zl)return Di;Zl=1;var e=Ft(),r=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(n){}}();return Di=r,Di}var zi,Ql;function $r(){if(Ql)return zi;Ql=1;var e=Jl();function r(t,n,i){n=="__proto__"&&e?e(t,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[n]=i}return zi=r,zi}var Fi,Hl;function Gr(){if(Hl)return Fi;Hl=1;var e=$r(),r=Xt(),t=Object.prototype,n=t.hasOwnProperty;function i(s,a,o){var c=s[a];(!(n.call(s,a)&&r(c,o))||o===void 0&&!(a in s))&&e(s,a,o)}return Fi=i,Fi}var Bi,eh;function gr(){if(eh)return Bi;eh=1;var e=Gr(),r=$r();function t(n,i,s,a){var o=!s;s||(s={});for(var c=-1,f=i.length;++c<f;){var l=i[c],p=a?a(s[l],n[l],l,s,n):void 0;p===void 0&&(p=n[l]),o?r(s,l,p):e(s,l,p)}return s}return Bi=t,Bi}var $i,th;function kb(){if(th)return $i;th=1;function e(r,t){for(var n=-1,i=Array(r);++n<r;)i[n]=t(n);return i}return $i=e,$i}var Gi,rh;function pt(){if(rh)return Gi;rh=1;function e(r){return r!=null&&typeof r=="object"}return Gi=e,Gi}var Ui,nh;function jb(){if(nh)return Ui;nh=1;var e=zt(),r=pt(),t="[object Arguments]";function n(i){return r(i)&&e(i)==t}return Ui=n,Ui}var Vi,ih;function pr(){if(ih)return Vi;ih=1;var e=jb(),r=pt(),t=Object.prototype,n=t.hasOwnProperty,i=t.propertyIsEnumerable,s=e(function(){return arguments}())?e:function(a){return r(a)&&n.call(a,"callee")&&!i.call(a,"callee")};return Vi=s,Vi}var Wi,sh;function ze(){if(sh)return Wi;sh=1;var e=Array.isArray;return Wi=e,Wi}var vr={exports:{}},Yi,oh;function Cb(){if(oh)return Yi;oh=1;function e(){return!1}return Yi=e,Yi}vr.exports;var ah;function Jt(){return ah||(ah=1,function(e,r){var t=ft(),n=Cb(),i=r&&!r.nodeType&&r,s=i&&!0&&e&&!e.nodeType&&e,a=s&&s.exports===i,o=a?t.Buffer:void 0,c=o?o.isBuffer:void 0,f=c||n;e.exports=f}(vr,vr.exports)),vr.exports}var Ki,uh;function Ur(){if(uh)return Ki;uh=1;var e=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function t(n,i){var s=typeof n;return i=i==null?e:i,!!i&&(s=="number"||s!="symbol"&&r.test(n))&&n>-1&&n%1==0&&n<i}return Ki=t,Ki}var Xi,ch;function Zi(){if(ch)return Xi;ch=1;var e=9007199254740991;function r(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=e}return Xi=r,Xi}var Ji,fh;function Pb(){if(fh)return Ji;fh=1;var e=zt(),r=Zi(),t=pt(),n="[object Arguments]",i="[object Array]",s="[object Boolean]",a="[object Date]",o="[object Error]",c="[object Function]",f="[object Map]",l="[object Number]",p="[object Object]",m="[object RegExp]",y="[object Set]",x="[object String]",_="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",E="[object Float32Array]",N="[object Float64Array]",S="[object Int8Array]",R="[object Int16Array]",A="[object Int32Array]",j="[object Uint8Array]",I="[object Uint8ClampedArray]",D="[object Uint16Array]",z="[object Uint32Array]",$={};$[E]=$[N]=$[S]=$[R]=$[A]=$[j]=$[I]=$[D]=$[z]=!0,$[n]=$[i]=$[b]=$[s]=$[w]=$[a]=$[o]=$[c]=$[f]=$[l]=$[p]=$[m]=$[y]=$[x]=$[_]=!1;function V(Y){return t(Y)&&r(Y.length)&&!!$[e(Y)]}return Ji=V,Ji}var Qi,lh;function Vr(){if(lh)return Qi;lh=1;function e(r){return function(t){return r(t)}}return Qi=e,Qi}var mr={exports:{}};mr.exports;var hh;function Hi(){return hh||(hh=1,function(e,r){var t=vl(),n=r&&!r.nodeType&&r,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,a=s&&t.process,o=function(){try{var c=i&&i.require&&i.require("util").types;return c||a&&a.binding&&a.binding("util")}catch(f){}}();e.exports=o}(mr,mr.exports)),mr.exports}var es,dh;function yr(){if(dh)return es;dh=1;var e=Pb(),r=Vr(),t=Hi(),n=t&&t.isTypedArray,i=n?r(n):e;return es=i,es}var ts,gh;function ph(){if(gh)return ts;gh=1;var e=kb(),r=pr(),t=ze(),n=Jt(),i=Ur(),s=yr(),a=Object.prototype,o=a.hasOwnProperty;function c(f,l){var p=t(f),m=!p&&r(f),y=!p&&!m&&n(f),x=!p&&!m&&!y&&s(f),_=p||m||y||x,b=_?e(f.length,String):[],w=b.length;for(var E in f)(l||o.call(f,E))&&!(_&&(E=="length"||y&&(E=="offset"||E=="parent")||x&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,w)))&&b.push(E);return b}return ts=c,ts}var rs,vh;function Wr(){if(vh)return rs;vh=1;var e=Object.prototype;function r(t){var n=t&&t.constructor,i=typeof n=="function"&&n.prototype||e;return t===i}return rs=r,rs}var ns,mh;function yh(){if(mh)return ns;mh=1;function e(r,t){return function(n){return r(t(n))}}return ns=e,ns}var is,wh;function Lb(){if(wh)return is;wh=1;var e=yh(),r=e(Object.keys,Object);return is=r,is}var ss,bh;function os(){if(bh)return ss;bh=1;var e=Wr(),r=Lb(),t=Object.prototype,n=t.hasOwnProperty;function i(s){if(!e(s))return r(s);var a=[];for(var o in Object(s))n.call(s,o)&&o!="constructor"&&a.push(o);return a}return ss=i,ss}var as,_h;function Et(){if(_h)return as;_h=1;var e=dr(),r=Zi();function t(n){return n!=null&&r(n.length)&&!e(n)}return as=t,as}var us,Eh;function kt(){if(Eh)return us;Eh=1;var e=ph(),r=os(),t=Et();function n(i){return t(i)?e(i):r(i)}return us=n,us}var cs,xh;function Db(){if(xh)return cs;xh=1;var e=gr(),r=kt();function t(n,i){return n&&e(i,r(i),n)}return cs=t,cs}var fs,Nh;function zb(){if(Nh)return fs;Nh=1;function e(r){var t=[];if(r!=null)for(var n in Object(r))t.push(n);return t}return fs=e,fs}var ls,Mh;function Fb(){if(Mh)return ls;Mh=1;var e=ut(),r=Wr(),t=zb(),n=Object.prototype,i=n.hasOwnProperty;function s(a){if(!e(a))return t(a);var o=r(a),c=[];for(var f in a)f=="constructor"&&(o||!i.call(a,f))||c.push(f);return c}return ls=s,ls}var hs,Sh;function Bt(){if(Sh)return hs;Sh=1;var e=ph(),r=Fb(),t=Et();function n(i){return t(i)?e(i,!0):r(i)}return hs=n,hs}var ds,qh;function Bb(){if(qh)return ds;qh=1;var e=gr(),r=Bt();function t(n,i){return n&&e(i,r(i),n)}return ds=t,ds}var wr={exports:{}};wr.exports;var Rh;function Oh(){return Rh||(Rh=1,function(e,r){var t=ft(),n=r&&!r.nodeType&&r,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,a=s?t.Buffer:void 0,o=a?a.allocUnsafe:void 0;function c(f,l){if(l)return f.slice();var p=f.length,m=o?o(p):new f.constructor(p);return f.copy(m),m}e.exports=c}(wr,wr.exports)),wr.exports}var gs,Ah;function Ih(){if(Ah)return gs;Ah=1;function e(r,t){var n=-1,i=r.length;for(t||(t=Array(i));++n<i;)t[n]=r[n];return t}return gs=e,gs}var ps,Th;function kh(){if(Th)return ps;Th=1;function e(r,t){for(var n=-1,i=r==null?0:r.length,s=0,a=[];++n<i;){var o=r[n];t(o,n,r)&&(a[s++]=o)}return a}return ps=e,ps}var vs,jh;function Ch(){if(jh)return vs;jh=1;function e(){return[]}return vs=e,vs}var ms,Ph;function ys(){if(Ph)return ms;Ph=1;var e=kh(),r=Ch(),t=Object.prototype,n=t.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(a){return a==null?[]:(a=Object(a),e(i(a),function(o){return n.call(a,o)}))}:r;return ms=s,ms}var ws,Lh;function $b(){if(Lh)return ws;Lh=1;var e=gr(),r=ys();function t(n,i){return e(n,r(n),i)}return ws=t,ws}var bs,Dh;function _s(){if(Dh)return bs;Dh=1;function e(r,t){for(var n=-1,i=t.length,s=r.length;++n<i;)r[s+n]=t[n];return r}return bs=e,bs}var Es,zh;function Yr(){if(zh)return Es;zh=1;var e=yh(),r=e(Object.getPrototypeOf,Object);return Es=r,Es}var xs,Fh;function Bh(){if(Fh)return xs;Fh=1;var e=_s(),r=Yr(),t=ys(),n=Ch(),i=Object.getOwnPropertySymbols,s=i?function(a){for(var o=[];a;)e(o,t(a)),a=r(a);return o}:n;return xs=s,xs}var Ns,$h;function Gb(){if($h)return Ns;$h=1;var e=gr(),r=Bh();function t(n,i){return e(n,r(n),i)}return Ns=t,Ns}var Ms,Gh;function Uh(){if(Gh)return Ms;Gh=1;var e=_s(),r=ze();function t(n,i,s){var a=i(n);return r(n)?a:e(a,s(n))}return Ms=t,Ms}var Ss,Vh;function Wh(){if(Vh)return Ss;Vh=1;var e=Uh(),r=ys(),t=kt();function n(i){return e(i,t,r)}return Ss=n,Ss}var qs,Yh;function Ub(){if(Yh)return qs;Yh=1;var e=Uh(),r=Bh(),t=Bt();function n(i){return e(i,t,r)}return qs=n,qs}var Rs,Kh;function Vb(){if(Kh)return Rs;Kh=1;var e=Ft(),r=ft(),t=e(r,"DataView");return Rs=t,Rs}var Os,Xh;function Wb(){if(Xh)return Os;Xh=1;var e=Ft(),r=ft(),t=e(r,"Promise");return Os=t,Os}var As,Zh;function Jh(){if(Zh)return As;Zh=1;var e=Ft(),r=ft(),t=e(r,"Set");return As=t,As}var Is,Qh;function Yb(){if(Qh)return Is;Qh=1;var e=Ft(),r=ft(),t=e(r,"WeakMap");return Is=t,Is}var Ts,Hh;function Qt(){if(Hh)return Ts;Hh=1;var e=Vb(),r=mi(),t=Wb(),n=Jh(),i=Yb(),s=zt(),a=ql(),o="[object Map]",c="[object Object]",f="[object Promise]",l="[object Set]",p="[object WeakMap]",m="[object DataView]",y=a(e),x=a(r),_=a(t),b=a(n),w=a(i),E=s;return(e&&E(new e(new ArrayBuffer(1)))!=m||r&&E(new r)!=o||t&&E(t.resolve())!=f||n&&E(new n)!=l||i&&E(new i)!=p)&&(E=function(N){var S=s(N),R=S==c?N.constructor:void 0,A=R?a(R):"";if(A)switch(A){case y:return m;case x:return o;case _:return f;case b:return l;case w:return p}return S}),Ts=E,Ts}var ks,ed;function Kb(){if(ed)return ks;ed=1;var e=Object.prototype,r=e.hasOwnProperty;function t(n){var i=n.length,s=new n.constructor(i);return i&&typeof n[0]=="string"&&r.call(n,"index")&&(s.index=n.index,s.input=n.input),s}return ks=t,ks}var js,td;function rd(){if(td)return js;td=1;var e=ft(),r=e.Uint8Array;return js=r,js}var Cs,nd;function Ps(){if(nd)return Cs;nd=1;var e=rd();function r(t){var n=new t.constructor(t.byteLength);return new e(n).set(new e(t)),n}return Cs=r,Cs}var Ls,id;function Xb(){if(id)return Ls;id=1;var e=Ps();function r(t,n){var i=n?e(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}return Ls=r,Ls}var Ds,sd;function Zb(){if(sd)return Ds;sd=1;var e=/\w*$/;function r(t){var n=new t.constructor(t.source,e.exec(t));return n.lastIndex=t.lastIndex,n}return Ds=r,Ds}var zs,od;function Jb(){if(od)return zs;od=1;var e=Zt(),r=e?e.prototype:void 0,t=r?r.valueOf:void 0;function n(i){return t?Object(t.call(i)):{}}return zs=n,zs}var Fs,ad;function ud(){if(ad)return Fs;ad=1;var e=Ps();function r(t,n){var i=n?e(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}return Fs=r,Fs}var Bs,cd;function Qb(){if(cd)return Bs;cd=1;var e=Ps(),r=Xb(),t=Zb(),n=Jb(),i=ud(),s="[object Boolean]",a="[object Date]",o="[object Map]",c="[object Number]",f="[object RegExp]",l="[object Set]",p="[object String]",m="[object Symbol]",y="[object ArrayBuffer]",x="[object DataView]",_="[object Float32Array]",b="[object Float64Array]",w="[object Int8Array]",E="[object Int16Array]",N="[object Int32Array]",S="[object Uint8Array]",R="[object Uint8ClampedArray]",A="[object Uint16Array]",j="[object Uint32Array]";function I(D,z,$){var V=D.constructor;switch(z){case y:return e(D);case s:case a:return new V(+D);case x:return r(D,$);case _:case b:case w:case E:case N:case S:case R:case A:case j:return i(D,$);case o:return new V;case c:case p:return new V(D);case f:return t(D);case l:return new V;case m:return n(D)}}return Bs=I,Bs}var $s,fd;function ld(){if(fd)return $s;fd=1;var e=ut(),r=Object.create,t=function(){function n(){}return function(i){if(!e(i))return{};if(r)return r(i);n.prototype=i;var s=new n;return n.prototype=void 0,s}}();return $s=t,$s}var Gs,hd;function dd(){if(hd)return Gs;hd=1;var e=ld(),r=Yr(),t=Wr();function n(i){return typeof i.constructor=="function"&&!t(i)?e(r(i)):{}}return Gs=n,Gs}var Us,gd;function Hb(){if(gd)return Us;gd=1;var e=Qt(),r=pt(),t="[object Map]";function n(i){return r(i)&&e(i)==t}return Us=n,Us}var Vs,pd;function e_(){if(pd)return Vs;pd=1;var e=Hb(),r=Vr(),t=Hi(),n=t&&t.isMap,i=n?r(n):e;return Vs=i,Vs}var Ws,vd;function t_(){if(vd)return Ws;vd=1;var e=Qt(),r=pt(),t="[object Set]";function n(i){return r(i)&&e(i)==t}return Ws=n,Ws}var Ys,md;function r_(){if(md)return Ys;md=1;var e=t_(),r=Vr(),t=Hi(),n=t&&t.isSet,i=n?r(n):e;return Ys=i,Ys}var Ks,yd;function wd(){if(yd)return Ks;yd=1;var e=Br(),r=Li(),t=Gr(),n=Db(),i=Bb(),s=Oh(),a=Ih(),o=$b(),c=Gb(),f=Wh(),l=Ub(),p=Qt(),m=Kb(),y=Qb(),x=dd(),_=ze(),b=Jt(),w=e_(),E=ut(),N=r_(),S=kt(),R=Bt(),A=1,j=2,I=4,D="[object Arguments]",z="[object Array]",$="[object Boolean]",V="[object Date]",Y="[object Error]",ee="[object Function]",J="[object GeneratorFunction]",ue="[object Map]",be="[object Number]",Z="[object Object]",ce="[object RegExp]",pe="[object Set]",he="[object String]",ie="[object Symbol]",_e="[object WeakMap]",G="[object ArrayBuffer]",P="[object DataView]",X="[object Float32Array]",te="[object Float64Array]",le="[object Int8Array]",xe="[object Int16Array]",De="[object Int32Array]",Je="[object Uint8Array]",rr="[object Uint8ClampedArray]",Qe="[object Uint16Array]",Ve="[object Uint32Array]",Ee={};Ee[D]=Ee[z]=Ee[G]=Ee[P]=Ee[$]=Ee[V]=Ee[X]=Ee[te]=Ee[le]=Ee[xe]=Ee[De]=Ee[ue]=Ee[be]=Ee[Z]=Ee[ce]=Ee[pe]=Ee[he]=Ee[ie]=Ee[Je]=Ee[rr]=Ee[Qe]=Ee[Ve]=!0,Ee[Y]=Ee[ee]=Ee[_e]=!1;function Mt(Me,St,Fe,qc,qt,We){var Ye,ht=St&A,nr=St&j,sn=St&I;if(Fe&&(Ye=qt?Fe(Me,qc,qt,We):Fe(Me)),Ye!==void 0)return Ye;if(!E(Me))return Me;var Gt=_(Me);if(Gt){if(Ye=m(Me),!ht)return a(Me,Ye)}else{var jt=p(Me),on=jt==ee||jt==J;if(b(Me))return s(Me,ht);if(jt==Z||jt==D||on&&!qt){if(Ye=nr||on?{}:x(Me),!ht)return nr?c(Me,i(Ye,Me)):o(Me,n(Ye,Me))}else{if(!Ee[jt])return qt?Me:{};Ye=y(Me,jt,ht)}}We||(We=new e);var an=We.get(Me);if(an)return an;We.set(Me,Ye),N(Me)?Me.forEach(function(vt){Ye.add(Mt(vt,St,Fe,vt,Me,We))}):w(Me)&&Me.forEach(function(vt,mt){Ye.set(mt,Mt(vt,St,Fe,mt,Me,We))});var Rc=sn?nr?l:f:nr?R:S,un=Gt?void 0:Rc(Me);return r(un||Me,function(vt,mt){un&&(mt=vt,vt=Me[mt]),t(Ye,mt,Mt(vt,St,Fe,mt,Me,We))}),Ye}return Ks=Mt,Ks}var Xs,bd;function n_(){if(bd)return Xs;bd=1;var e=wd(),r=4;function t(n){return e(n,r)}return Xs=t,Xs}var Zs,_d;function Js(){if(_d)return Zs;_d=1;function e(r){return function(){return r}}return Zs=e,Zs}var Qs,Ed;function i_(){if(Ed)return Qs;Ed=1;function e(r){return function(t,n,i){for(var s=-1,a=Object(t),o=i(t),c=o.length;c--;){var f=o[r?c:++s];if(n(a[f],f,a)===!1)break}return t}}return Qs=e,Qs}var Hs,xd;function eo(){if(xd)return Hs;xd=1;var e=i_(),r=e();return Hs=r,Hs}var to,Nd;function ro(){if(Nd)return to;Nd=1;var e=eo(),r=kt();function t(n,i){return n&&e(n,i,r)}return to=t,to}var no,Md;function s_(){if(Md)return no;Md=1;var e=Et();function r(t,n){return function(i,s){if(i==null)return i;if(!e(i))return t(i,s);for(var a=i.length,o=n?a:-1,c=Object(i);(n?o--:++o<a)&&s(c[o],o,c)!==!1;);return i}}return no=r,no}var io,Sd;function Kr(){if(Sd)return io;Sd=1;var e=ro(),r=s_(),t=r(e);return io=t,io}var so,qd;function $t(){if(qd)return so;qd=1;function e(r){return r}return so=e,so}var oo,Rd;function Od(){if(Rd)return oo;Rd=1;var e=$t();function r(t){return typeof t=="function"?t:e}return oo=r,oo}var ao,Ad;function Id(){if(Ad)return ao;Ad=1;var e=Li(),r=Kr(),t=Od(),n=ze();function i(s,a){var o=n(s)?e:r;return o(s,t(a))}return ao=i,ao}var uo,Td;function kd(){return Td||(Td=1,uo=Id()),uo}var co,jd;function o_(){if(jd)return co;jd=1;var e=Kr();function r(t,n){var i=[];return e(t,function(s,a,o){n(s,a,o)&&i.push(s)}),i}return co=r,co}var fo,Cd;function a_(){if(Cd)return fo;Cd=1;var e="__lodash_hash_undefined__";function r(t){return this.__data__.set(t,e),this}return fo=r,fo}var lo,Pd;function u_(){if(Pd)return lo;Pd=1;function e(r){return this.__data__.has(r)}return lo=e,lo}var ho,Ld;function Dd(){if(Ld)return ho;Ld=1;var e=ki(),r=a_(),t=u_();function n(i){var s=-1,a=i==null?0:i.length;for(this.__data__=new e;++s<a;)this.add(i[s])}return n.prototype.add=n.prototype.push=r,n.prototype.has=t,ho=n,ho}var go,zd;function c_(){if(zd)return go;zd=1;function e(r,t){for(var n=-1,i=r==null?0:r.length;++n<i;)if(t(r[n],n,r))return!0;return!1}return go=e,go}var po,Fd;function Bd(){if(Fd)return po;Fd=1;function e(r,t){return r.has(t)}return po=e,po}var vo,$d;function Gd(){if($d)return vo;$d=1;var e=Dd(),r=c_(),t=Bd(),n=1,i=2;function s(a,o,c,f,l,p){var m=c&n,y=a.length,x=o.length;if(y!=x&&!(m&&x>y))return!1;var _=p.get(a),b=p.get(o);if(_&&b)return _==o&&b==a;var w=-1,E=!0,N=c&i?new e:void 0;for(p.set(a,o),p.set(o,a);++w<y;){var S=a[w],R=o[w];if(f)var A=m?f(R,S,w,o,a,p):f(S,R,w,a,o,p);if(A!==void 0){if(A)continue;E=!1;break}if(N){if(!r(o,function(j,I){if(!t(N,I)&&(S===j||l(S,j,c,f,p)))return N.push(I)})){E=!1;break}}else if(!(S===R||l(S,R,c,f,p))){E=!1;break}}return p.delete(a),p.delete(o),E}return vo=s,vo}var mo,Ud;function f_(){if(Ud)return mo;Ud=1;function e(r){var t=-1,n=Array(r.size);return r.forEach(function(i,s){n[++t]=[s,i]}),n}return mo=e,mo}var yo,Vd;function wo(){if(Vd)return yo;Vd=1;function e(r){var t=-1,n=Array(r.size);return r.forEach(function(i){n[++t]=i}),n}return yo=e,yo}var bo,Wd;function l_(){if(Wd)return bo;Wd=1;var e=Zt(),r=rd(),t=Xt(),n=Gd(),i=f_(),s=wo(),a=1,o=2,c="[object Boolean]",f="[object Date]",l="[object Error]",p="[object Map]",m="[object Number]",y="[object RegExp]",x="[object Set]",_="[object String]",b="[object Symbol]",w="[object ArrayBuffer]",E="[object DataView]",N=e?e.prototype:void 0,S=N?N.valueOf:void 0;function R(A,j,I,D,z,$,V){switch(I){case E:if(A.byteLength!=j.byteLength||A.byteOffset!=j.byteOffset)return!1;A=A.buffer,j=j.buffer;case w:return!(A.byteLength!=j.byteLength||!$(new r(A),new r(j)));case c:case f:case m:return t(+A,+j);case l:return A.name==j.name&&A.message==j.message;case y:case _:return A==j+"";case p:var Y=i;case x:var ee=D&a;if(Y||(Y=s),A.size!=j.size&&!ee)return!1;var J=V.get(A);if(J)return J==j;D|=o,V.set(A,j);var ue=n(Y(A),Y(j),D,z,$,V);return V.delete(A),ue;case b:if(S)return S.call(A)==S.call(j)}return!1}return bo=R,bo}var _o,Yd;function h_(){if(Yd)return _o;Yd=1;var e=Wh(),r=1,t=Object.prototype,n=t.hasOwnProperty;function i(s,a,o,c,f,l){var p=o&r,m=e(s),y=m.length,x=e(a),_=x.length;if(y!=_&&!p)return!1;for(var b=y;b--;){var w=m[b];if(!(p?w in a:n.call(a,w)))return!1}var E=l.get(s),N=l.get(a);if(E&&N)return E==a&&N==s;var S=!0;l.set(s,a),l.set(a,s);for(var R=p;++b<y;){w=m[b];var A=s[w],j=a[w];if(c)var I=p?c(j,A,w,a,s,l):c(A,j,w,s,a,l);if(!(I===void 0?A===j||f(A,j,o,c,l):I)){S=!1;break}R||(R=w=="constructor")}if(S&&!R){var D=s.constructor,z=a.constructor;D!=z&&"constructor"in s&&"constructor"in a&&!(typeof D=="function"&&D instanceof D&&typeof z=="function"&&z instanceof z)&&(S=!1)}return l.delete(s),l.delete(a),S}return _o=i,_o}var Eo,Kd;function d_(){if(Kd)return Eo;Kd=1;var e=Br(),r=Gd(),t=l_(),n=h_(),i=Qt(),s=ze(),a=Jt(),o=yr(),c=1,f="[object Arguments]",l="[object Array]",p="[object Object]",m=Object.prototype,y=m.hasOwnProperty;function x(_,b,w,E,N,S){var R=s(_),A=s(b),j=R?l:i(_),I=A?l:i(b);j=j==f?p:j,I=I==f?p:I;var D=j==p,z=I==p,$=j==I;if($&&a(_)){if(!a(b))return!1;R=!0,D=!1}if($&&!D)return S||(S=new e),R||o(_)?r(_,b,w,E,N,S):t(_,b,j,w,E,N,S);if(!(w&c)){var V=D&&y.call(_,"__wrapped__"),Y=z&&y.call(b,"__wrapped__");if(V||Y){var ee=V?_.value():_,J=Y?b.value():b;return S||(S=new e),N(ee,J,w,E,S)}}return $?(S||(S=new e),n(_,b,w,E,N,S)):!1}return Eo=x,Eo}var xo,Xd;function Zd(){if(Xd)return xo;Xd=1;var e=d_(),r=pt();function t(n,i,s,a,o){return n===i?!0:n==null||i==null||!r(n)&&!r(i)?n!==n&&i!==i:e(n,i,s,a,t,o)}return xo=t,xo}var No,Jd;function g_(){if(Jd)return No;Jd=1;var e=Br(),r=Zd(),t=1,n=2;function i(s,a,o,c){var f=o.length,l=f,p=!c;if(s==null)return!l;for(s=Object(s);f--;){var m=o[f];if(p&&m[2]?m[1]!==s[m[0]]:!(m[0]in s))return!1}for(;++f<l;){m=o[f];var y=m[0],x=s[y],_=m[1];if(p&&m[2]){if(x===void 0&&!(y in s))return!1}else{var b=new e;if(c)var w=c(x,_,y,s,a,b);if(!(w===void 0?r(_,x,t|n,c,b):w))return!1}}return!0}return No=i,No}var Mo,Qd;function Hd(){if(Qd)return Mo;Qd=1;var e=ut();function r(t){return t===t&&!e(t)}return Mo=r,Mo}var So,eg;function p_(){if(eg)return So;eg=1;var e=Hd(),r=kt();function t(n){for(var i=r(n),s=i.length;s--;){var a=i[s],o=n[a];i[s]=[a,o,e(o)]}return i}return So=t,So}var qo,tg;function rg(){if(tg)return qo;tg=1;function e(r,t){return function(n){return n==null?!1:n[r]===t&&(t!==void 0||r in Object(n))}}return qo=e,qo}var Ro,ng;function v_(){if(ng)return Ro;ng=1;var e=g_(),r=p_(),t=rg();function n(i){var s=r(i);return s.length==1&&s[0][2]?t(s[0][0],s[0][1]):function(a){return a===i||e(a,i,s)}}return Ro=n,Ro}var Oo,ig;function Ht(){if(ig)return Oo;ig=1;var e=zt(),r=pt(),t="[object Symbol]";function n(i){return typeof i=="symbol"||r(i)&&e(i)==t}return Oo=n,Oo}var Ao,sg;function Io(){if(sg)return Ao;sg=1;var e=ze(),r=Ht(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(s,a){if(e(s))return!1;var o=typeof s;return o=="number"||o=="symbol"||o=="boolean"||s==null||r(s)?!0:n.test(s)||!t.test(s)||a!=null&&s in Object(a)}return Ao=i,Ao}var To,og;function m_(){if(og)return To;og=1;var e=ki(),r="Expected a function";function t(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(r);var s=function(){var a=arguments,o=i?i.apply(this,a):a[0],c=s.cache;if(c.has(o))return c.get(o);var f=n.apply(this,a);return s.cache=c.set(o,f)||c,f};return s.cache=new(t.Cache||e),s}return t.Cache=e,To=t,To}var ko,ag;function y_(){if(ag)return ko;ag=1;var e=m_(),r=500;function t(n){var i=e(n,function(a){return s.size===r&&s.clear(),a}),s=i.cache;return i}return ko=t,ko}var jo,ug;function w_(){if(ug)return jo;ug=1;var e=y_(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,n=e(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(r,function(a,o,c,f){s.push(c?f.replace(t,"$1"):o||a)}),s});return jo=n,jo}var Co,cg;function Xr(){if(cg)return Co;cg=1;function e(r,t){for(var n=-1,i=r==null?0:r.length,s=Array(i);++n<i;)s[n]=t(r[n],n,r);return s}return Co=e,Co}var Po,fg;function b_(){if(fg)return Po;fg=1;var e=Zt(),r=Xr(),t=ze(),n=Ht(),i=e?e.prototype:void 0,s=i?i.toString:void 0;function a(o){if(typeof o=="string")return o;if(t(o))return r(o,a)+"";if(n(o))return s?s.call(o):"";var c=o+"";return c=="0"&&1/o==-1/0?"-0":c}return Po=a,Po}var Lo,lg;function hg(){if(lg)return Lo;lg=1;var e=b_();function r(t){return t==null?"":e(t)}return Lo=r,Lo}var Do,dg;function Zr(){if(dg)return Do;dg=1;var e=ze(),r=Io(),t=w_(),n=hg();function i(s,a){return e(s)?s:r(s,a)?[s]:t(n(s))}return Do=i,Do}var zo,gg;function br(){if(gg)return zo;gg=1;var e=Ht();function r(t){if(typeof t=="string"||e(t))return t;var n=t+"";return n=="0"&&1/t==-1/0?"-0":n}return zo=r,zo}var Fo,pg;function Jr(){if(pg)return Fo;pg=1;var e=Zr(),r=br();function t(n,i){i=e(i,n);for(var s=0,a=i.length;n!=null&&s<a;)n=n[r(i[s++])];return s&&s==a?n:void 0}return Fo=t,Fo}var Bo,vg;function __(){if(vg)return Bo;vg=1;var e=Jr();function r(t,n,i){var s=t==null?void 0:e(t,n);return s===void 0?i:s}return Bo=r,Bo}var $o,mg;function E_(){if(mg)return $o;mg=1;function e(r,t){return r!=null&&t in Object(r)}return $o=e,$o}var Go,yg;function wg(){if(yg)return Go;yg=1;var e=Zr(),r=pr(),t=ze(),n=Ur(),i=Zi(),s=br();function a(o,c,f){c=e(c,o);for(var l=-1,p=c.length,m=!1;++l<p;){var y=s(c[l]);if(!(m=o!=null&&f(o,y)))break;o=o[y]}return m||++l!=p?m:(p=o==null?0:o.length,!!p&&i(p)&&n(y,p)&&(t(o)||r(o)))}return Go=a,Go}var Uo,bg;function _g(){if(bg)return Uo;bg=1;var e=E_(),r=wg();function t(n,i){return n!=null&&r(n,i,e)}return Uo=t,Uo}var Vo,Eg;function x_(){if(Eg)return Vo;Eg=1;var e=Zd(),r=__(),t=_g(),n=Io(),i=Hd(),s=rg(),a=br(),o=1,c=2;function f(l,p){return n(l)&&i(p)?s(a(l),p):function(m){var y=r(m,l);return y===void 0&&y===p?t(m,l):e(p,y,o|c)}}return Vo=f,Vo}var Wo,xg;function Ng(){if(xg)return Wo;xg=1;function e(r){return function(t){return t==null?void 0:t[r]}}return Wo=e,Wo}var Yo,Mg;function N_(){if(Mg)return Yo;Mg=1;var e=Jr();function r(t){return function(n){return e(n,t)}}return Yo=r,Yo}var Ko,Sg;function M_(){if(Sg)return Ko;Sg=1;var e=Ng(),r=N_(),t=Io(),n=br();function i(s){return t(s)?e(n(s)):r(s)}return Ko=i,Ko}var Xo,qg;function xt(){if(qg)return Xo;qg=1;var e=v_(),r=x_(),t=$t(),n=ze(),i=M_();function s(a){return typeof a=="function"?a:a==null?t:typeof a=="object"?n(a)?r(a[0],a[1]):e(a):i(a)}return Xo=s,Xo}var Zo,Rg;function Og(){if(Rg)return Zo;Rg=1;var e=kh(),r=o_(),t=xt(),n=ze();function i(s,a){var o=n(s)?e:r;return o(s,t(a,3))}return Zo=i,Zo}var Jo,Ag;function S_(){if(Ag)return Jo;Ag=1;var e=Object.prototype,r=e.hasOwnProperty;function t(n,i){return n!=null&&r.call(n,i)}return Jo=t,Jo}var Qo,Ig;function Tg(){if(Ig)return Qo;Ig=1;var e=S_(),r=wg();function t(n,i){return n!=null&&r(n,i,e)}return Qo=t,Qo}var Ho,kg;function q_(){if(kg)return Ho;kg=1;var e=os(),r=Qt(),t=pr(),n=ze(),i=Et(),s=Jt(),a=Wr(),o=yr(),c="[object Map]",f="[object Set]",l=Object.prototype,p=l.hasOwnProperty;function m(y){if(y==null)return!0;if(i(y)&&(n(y)||typeof y=="string"||typeof y.splice=="function"||s(y)||o(y)||t(y)))return!y.length;var x=r(y);if(x==c||x==f)return!y.size;if(a(y))return!e(y).length;for(var _ in y)if(p.call(y,_))return!1;return!0}return Ho=m,Ho}var ea,jg;function Cg(){if(jg)return ea;jg=1;function e(r){return r===void 0}return ea=e,ea}var ta,Pg;function Lg(){if(Pg)return ta;Pg=1;var e=Kr(),r=Et();function t(n,i){var s=-1,a=r(n)?Array(n.length):[];return e(n,function(o,c,f){a[++s]=i(o,c,f)}),a}return ta=t,ta}var ra,Dg;function zg(){if(Dg)return ra;Dg=1;var e=Xr(),r=xt(),t=Lg(),n=ze();function i(s,a){var o=n(s)?e:t;return o(s,r(a,3))}return ra=i,ra}var na,Fg;function R_(){if(Fg)return na;Fg=1;function e(r,t,n,i){var s=-1,a=r==null?0:r.length;for(i&&a&&(n=r[++s]);++s<a;)n=t(n,r[s],s,r);return n}return na=e,na}var ia,Bg;function O_(){if(Bg)return ia;Bg=1;function e(r,t,n,i,s){return s(r,function(a,o,c){n=i?(i=!1,a):t(n,a,o,c)}),n}return ia=e,ia}var sa,$g;function Gg(){if($g)return sa;$g=1;var e=R_(),r=Kr(),t=xt(),n=O_(),i=ze();function s(a,o,c){var f=i(a)?e:n,l=arguments.length<3;return f(a,t(o,4),c,l,r)}return sa=s,sa}var oa,Ug;function A_(){if(Ug)return oa;Ug=1;var e=zt(),r=ze(),t=pt(),n="[object String]";function i(s){return typeof s=="string"||!r(s)&&t(s)&&e(s)==n}return oa=i,oa}var aa,Vg;function I_(){if(Vg)return aa;Vg=1;var e=Ng(),r=e("length");return aa=r,aa}var ua,Wg;function T_(){if(Wg)return ua;Wg=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=r+t+n,s="\\ufe0e\\ufe0f",a="\\u200d",o=RegExp("["+a+e+i+s+"]");function c(f){return o.test(f)}return ua=c,ua}var ca,Yg;function k_(){if(Yg)return ca;Yg=1;var e="\\ud800-\\udfff",r="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=r+t+n,s="\\ufe0e\\ufe0f",a="["+e+"]",o="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",f="(?:"+o+"|"+c+")",l="[^"+e+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",y="\\u200d",x=f+"?",_="["+s+"]?",b="(?:"+y+"(?:"+[l,p,m].join("|")+")"+_+x+")*",w=_+x+b,E="(?:"+[l+o+"?",o,p,m,a].join("|")+")",N=RegExp(c+"(?="+c+")|"+E+w,"g");function S(R){for(var A=N.lastIndex=0;N.test(R);)++A;return A}return ca=S,ca}var fa,Kg;function j_(){if(Kg)return fa;Kg=1;var e=I_(),r=T_(),t=k_();function n(i){return r(i)?t(i):e(i)}return fa=n,fa}var la,Xg;function C_(){if(Xg)return la;Xg=1;var e=os(),r=Qt(),t=Et(),n=A_(),i=j_(),s="[object Map]",a="[object Set]";function o(c){if(c==null)return 0;if(t(c))return n(c)?i(c):c.length;var f=r(c);return f==s||f==a?c.size:e(c).length}return la=o,la}var ha,Zg;function P_(){if(Zg)return ha;Zg=1;var e=Li(),r=ld(),t=ro(),n=xt(),i=Yr(),s=ze(),a=Jt(),o=dr(),c=ut(),f=yr();function l(p,m,y){var x=s(p),_=x||a(p)||f(p);if(m=n(m,4),y==null){var b=p&&p.constructor;_?y=x?new b:[]:c(p)?y=o(b)?r(i(p)):{}:y={}}return(_?e:t)(p,function(w,E,N){return m(y,w,E,N)}),y}return ha=l,ha}var da,Jg;function L_(){if(Jg)return da;Jg=1;var e=Zt(),r=pr(),t=ze(),n=e?e.isConcatSpreadable:void 0;function i(s){return t(s)||r(s)||!!(n&&s&&s[n])}return da=i,da}var ga,Qg;function pa(){if(Qg)return ga;Qg=1;var e=_s(),r=L_();function t(n,i,s,a,o){var c=-1,f=n.length;for(s||(s=r),o||(o=[]);++c<f;){var l=n[c];i>0&&s(l)?i>1?t(l,i-1,s,a,o):e(o,l):a||(o[o.length]=l)}return o}return ga=t,ga}var va,Hg;function D_(){if(Hg)return va;Hg=1;function e(r,t,n){switch(n.length){case 0:return r.call(t);case 1:return r.call(t,n[0]);case 2:return r.call(t,n[0],n[1]);case 3:return r.call(t,n[0],n[1],n[2])}return r.apply(t,n)}return va=e,va}var ma,ep;function tp(){if(ep)return ma;ep=1;var e=D_(),r=Math.max;function t(n,i,s){return i=r(i===void 0?n.length-1:i,0),function(){for(var a=arguments,o=-1,c=r(a.length-i,0),f=Array(c);++o<c;)f[o]=a[i+o];o=-1;for(var l=Array(i+1);++o<i;)l[o]=a[o];return l[i]=s(f),e(n,this,l)}}return ma=t,ma}var ya,rp;function z_(){if(rp)return ya;rp=1;var e=Js(),r=Jl(),t=$t(),n=r?function(i,s){return r(i,"toString",{configurable:!0,enumerable:!1,value:e(s),writable:!0})}:t;return ya=n,ya}var wa,np;function F_(){if(np)return wa;np=1;var e=800,r=16,t=Date.now;function n(i){var s=0,a=0;return function(){var o=t(),c=r-(o-a);if(a=o,c>0){if(++s>=e)return arguments[0]}else s=0;return i.apply(void 0,arguments)}}return wa=n,wa}var ba,ip;function sp(){if(ip)return ba;ip=1;var e=z_(),r=F_(),t=r(e);return ba=t,ba}var _a,op;function Qr(){if(op)return _a;op=1;var e=$t(),r=tp(),t=sp();function n(i,s){return t(r(i,s,e),i+"")}return _a=n,_a}var Ea,ap;function up(){if(ap)return Ea;ap=1;function e(r,t,n,i){for(var s=r.length,a=n+(i?1:-1);i?a--:++a<s;)if(t(r[a],a,r))return a;return-1}return Ea=e,Ea}var xa,cp;function B_(){if(cp)return xa;cp=1;function e(r){return r!==r}return xa=e,xa}var Na,fp;function $_(){if(fp)return Na;fp=1;function e(r,t,n){for(var i=n-1,s=r.length;++i<s;)if(r[i]===t)return i;return-1}return Na=e,Na}var Ma,lp;function G_(){if(lp)return Ma;lp=1;var e=up(),r=B_(),t=$_();function n(i,s,a){return s===s?t(i,s,a):e(i,r,a)}return Ma=n,Ma}var Sa,hp;function U_(){if(hp)return Sa;hp=1;var e=G_();function r(t,n){var i=t==null?0:t.length;return!!i&&e(t,n,0)>-1}return Sa=r,Sa}var qa,dp;function V_(){if(dp)return qa;dp=1;function e(r,t,n){for(var i=-1,s=r==null?0:r.length;++i<s;)if(n(t,r[i]))return!0;return!1}return qa=e,qa}var Ra,gp;function W_(){if(gp)return Ra;gp=1;function e(){}return Ra=e,Ra}var Oa,pp;function Y_(){if(pp)return Oa;pp=1;var e=Jh(),r=W_(),t=wo(),n=1/0,i=e&&1/t(new e([,-0]))[1]==n?function(s){return new e(s)}:r;return Oa=i,Oa}var Aa,vp;function K_(){if(vp)return Aa;vp=1;var e=Dd(),r=U_(),t=V_(),n=Bd(),i=Y_(),s=wo(),a=200;function o(c,f,l){var p=-1,m=r,y=c.length,x=!0,_=[],b=_;if(l)x=!1,m=t;else if(y>=a){var w=f?null:i(c);if(w)return s(w);x=!1,m=n,b=new e}else b=f?[]:_;e:for(;++p<y;){var E=c[p],N=f?f(E):E;if(E=l||E!==0?E:0,x&&N===N){for(var S=b.length;S--;)if(b[S]===N)continue e;f&&b.push(N),_.push(E)}else m(b,N,l)||(b!==_&&b.push(N),_.push(E))}return _}return Aa=o,Aa}var Ia,mp;function yp(){if(mp)return Ia;mp=1;var e=Et(),r=pt();function t(n){return r(n)&&e(n)}return Ia=t,Ia}var Ta,wp;function X_(){if(wp)return Ta;wp=1;var e=pa(),r=Qr(),t=K_(),n=yp(),i=r(function(s){return t(e(s,1,n,!0))});return Ta=i,Ta}var ka,bp;function Z_(){if(bp)return ka;bp=1;var e=Xr();function r(t,n){return e(n,function(i){return t[i]})}return ka=r,ka}var ja,_p;function Ep(){if(_p)return ja;_p=1;var e=Z_(),r=kt();function t(n){return n==null?[]:e(n,r(n))}return ja=t,ja}var Ca,xp;function ct(){if(xp)return Ca;xp=1;var e;if(typeof Gn=="function")try{e={clone:n_(),constant:Js(),each:kd(),filter:Og(),has:Tg(),isArray:ze(),isEmpty:q_(),isFunction:dr(),isUndefined:Cg(),keys:kt(),map:zg(),reduce:Gg(),size:C_(),transform:P_(),union:X_(),values:Ep()}}catch(r){}return e||(e=window._),Ca=e,Ca}var Pa,Np;function La(){if(Np)return Pa;Np=1;var e=ct();Pa=i;var r="\0",t="\0",n="";function i(l){this._isDirected=e.has(l,"directed")?l.directed:!0,this._isMultigraph=e.has(l,"multigraph")?l.multigraph:!1,this._isCompound=e.has(l,"compound")?l.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}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(l){return this._label=l,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(l){return e.isFunction(l)||(l=e.constant(l)),this._defaultNodeLabelFn=l,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var l=this;return e.filter(this.nodes(),function(p){return e.isEmpty(l._in[p])})},i.prototype.sinks=function(){var l=this;return e.filter(this.nodes(),function(p){return e.isEmpty(l._out[p])})},i.prototype.setNodes=function(l,p){var m=arguments,y=this;return e.each(l,function(x){m.length>1?y.setNode(x,p):y.setNode(x)}),this},i.prototype.setNode=function(l,p){return e.has(this._nodes,l)?(arguments.length>1&&(this._nodes[l]=p),this):(this._nodes[l]=arguments.length>1?p:this._defaultNodeLabelFn(l),this._isCompound&&(this._parent[l]=t,this._children[l]={},this._children[t][l]=!0),this._in[l]={},this._preds[l]={},this._out[l]={},this._sucs[l]={},++this._nodeCount,this)},i.prototype.node=function(l){return this._nodes[l]},i.prototype.hasNode=function(l){return e.has(this._nodes,l)},i.prototype.removeNode=function(l){var p=this;if(e.has(this._nodes,l)){var m=function(y){p.removeEdge(p._edgeObjs[y])};delete this._nodes[l],this._isCompound&&(this._removeFromParentsChildList(l),delete this._parent[l],e.each(this.children(l),function(y){p.setParent(y)}),delete this._children[l]),e.each(e.keys(this._in[l]),m),delete this._in[l],delete this._preds[l],e.each(e.keys(this._out[l]),m),delete this._out[l],delete this._sucs[l],--this._nodeCount}return this},i.prototype.setParent=function(l,p){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(p))p=t;else{p+="";for(var m=p;!e.isUndefined(m);m=this.parent(m))if(m===l)throw new Error("Setting "+p+" as parent of "+l+" would create a cycle");this.setNode(p)}return this.setNode(l),this._removeFromParentsChildList(l),this._parent[l]=p,this._children[p][l]=!0,this},i.prototype._removeFromParentsChildList=function(l){delete this._children[this._parent[l]][l]},i.prototype.parent=function(l){if(this._isCompound){var p=this._parent[l];if(p!==t)return p}},i.prototype.children=function(l){if(e.isUndefined(l)&&(l=t),this._isCompound){var p=this._children[l];if(p)return e.keys(p)}else{if(l===t)return this.nodes();if(this.hasNode(l))return[]}},i.prototype.predecessors=function(l){var p=this._preds[l];if(p)return e.keys(p)},i.prototype.successors=function(l){var p=this._sucs[l];if(p)return e.keys(p)},i.prototype.neighbors=function(l){var p=this.predecessors(l);if(p)return e.union(p,this.successors(l))},i.prototype.isLeaf=function(l){var p;return this.isDirected()?p=this.successors(l):p=this.neighbors(l),p.length===0},i.prototype.filterNodes=function(l){var p=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});p.setGraph(this.graph());var m=this;e.each(this._nodes,function(_,b){l(b)&&p.setNode(b,_)}),e.each(this._edgeObjs,function(_){p.hasNode(_.v)&&p.hasNode(_.w)&&p.setEdge(_,m.edge(_))});var y={};function x(_){var b=m.parent(_);return b===void 0||p.hasNode(b)?(y[_]=b,b):b in y?y[b]:x(b)}return this._isCompound&&e.each(p.nodes(),function(_){p.setParent(_,x(_))}),p},i.prototype.setDefaultEdgeLabel=function(l){return e.isFunction(l)||(l=e.constant(l)),this._defaultEdgeLabelFn=l,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(l,p){var m=this,y=arguments;return e.reduce(l,function(x,_){return y.length>1?m.setEdge(x,_,p):m.setEdge(x,_),_}),this},i.prototype.setEdge=function(){var l,p,m,y,x=!1,_=arguments[0];typeof _=="object"&&_!==null&&"v"in _?(l=_.v,p=_.w,m=_.name,arguments.length===2&&(y=arguments[1],x=!0)):(l=_,p=arguments[1],m=arguments[3],arguments.length>2&&(y=arguments[2],x=!0)),l=""+l,p=""+p,e.isUndefined(m)||(m=""+m);var b=o(this._isDirected,l,p,m);if(e.has(this._edgeLabels,b))return x&&(this._edgeLabels[b]=y),this;if(!e.isUndefined(m)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(p),this._edgeLabels[b]=x?y:this._defaultEdgeLabelFn(l,p,m);var w=c(this._isDirected,l,p,m);return l=w.v,p=w.w,Object.freeze(w),this._edgeObjs[b]=w,s(this._preds[p],l),s(this._sucs[l],p),this._in[p][b]=w,this._out[l][b]=w,this._edgeCount++,this},i.prototype.edge=function(l,p,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):o(this._isDirected,l,p,m);return this._edgeLabels[y]},i.prototype.hasEdge=function(l,p,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):o(this._isDirected,l,p,m);return e.has(this._edgeLabels,y)},i.prototype.removeEdge=function(l,p,m){var y=arguments.length===1?f(this._isDirected,arguments[0]):o(this._isDirected,l,p,m),x=this._edgeObjs[y];return x&&(l=x.v,p=x.w,delete this._edgeLabels[y],delete this._edgeObjs[y],a(this._preds[p],l),a(this._sucs[l],p),delete this._in[p][y],delete this._out[l][y],this._edgeCount--),this},i.prototype.inEdges=function(l,p){var m=this._in[l];if(m){var y=e.values(m);return p?e.filter(y,function(x){return x.v===p}):y}},i.prototype.outEdges=function(l,p){var m=this._out[l];if(m){var y=e.values(m);return p?e.filter(y,function(x){return x.w===p}):y}},i.prototype.nodeEdges=function(l,p){var m=this.inEdges(l,p);if(m)return m.concat(this.outEdges(l,p))};function s(l,p){l[p]?l[p]++:l[p]=1}function a(l,p){--l[p]||delete l[p]}function o(l,p,m,y){var x=""+p,_=""+m;if(!l&&x>_){var b=x;x=_,_=b}return x+n+_+n+(e.isUndefined(y)?r:y)}function c(l,p,m,y){var x=""+p,_=""+m;if(!l&&x>_){var b=x;x=_,_=b}var w={v:x,w:_};return y&&(w.name=y),w}function f(l,p){return o(l,p.v,p.w,p.name)}return Pa}var Da,Mp;function J_(){return Mp||(Mp=1,Da="2.1.8"),Da}var za,Sp;function Q_(){return Sp||(Sp=1,za={Graph:La(),version:J_()}),za}var Fa,qp;function H_(){if(qp)return Fa;qp=1;var e=ct(),r=La();Fa={write:t,read:s};function t(a){var o={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:n(a),edges:i(a)};return e.isUndefined(a.graph())||(o.value=e.clone(a.graph())),o}function n(a){return e.map(a.nodes(),function(o){var c=a.node(o),f=a.parent(o),l={v:o};return e.isUndefined(c)||(l.value=c),e.isUndefined(f)||(l.parent=f),l})}function i(a){return e.map(a.edges(),function(o){var c=a.edge(o),f={v:o.v,w:o.w};return e.isUndefined(o.name)||(f.name=o.name),e.isUndefined(c)||(f.value=c),f})}function s(a){var o=new r(a.options).setGraph(a.value);return e.each(a.nodes,function(c){o.setNode(c.v,c.value),c.parent&&o.setParent(c.v,c.parent)}),e.each(a.edges,function(c){o.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),o}return Fa}var Ba,Rp;function eE(){if(Rp)return Ba;Rp=1;var e=ct();Ba=r;function r(t){var n={},i=[],s;function a(o){e.has(n,o)||(n[o]=!0,s.push(o),e.each(t.successors(o),a),e.each(t.predecessors(o),a))}return e.each(t.nodes(),function(o){s=[],a(o),s.length&&i.push(s)}),i}return Ba}var $a,Op;function Ap(){if(Op)return $a;Op=1;var e=ct();$a=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(t){return t.key})},r.prototype.has=function(t){return e.has(this._keyIndices,t)},r.prototype.priority=function(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(t,n){var i=this._keyIndices;if(t=String(t),!e.has(i,t)){var s=this._arr,a=s.length;return i[t]=a,s.push({key:t,priority:n}),this._decrease(a),!0}return!1},r.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},r.prototype.decrease=function(t,n){var i=this._keyIndices[t];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},r.prototype._heapify=function(t){var n=this._arr,i=2*t,s=i+1,a=t;i<n.length&&(a=n[i].priority<n[a].priority?i:a,s<n.length&&(a=n[s].priority<n[a].priority?s:a),a!==t&&(this._swap(t,a),this._heapify(a)))},r.prototype._decrease=function(t){for(var n=this._arr,i=n[t].priority,s;t!==0&&(s=t>>1,!(n[s].priority<i));)this._swap(t,s),t=s},r.prototype._swap=function(t,n){var i=this._arr,s=this._keyIndices,a=i[t],o=i[n];i[t]=o,i[n]=a,s[o.key]=t,s[a.key]=n},$a}var Ga,Ip;function Tp(){if(Ip)return Ga;Ip=1;var e=ct(),r=Ap();Ga=n;var t=e.constant(1);function n(s,a,o,c){return i(s,String(a),o||t,c||function(f){return s.outEdges(f)})}function i(s,a,o,c){var f={},l=new r,p,m,y=function(x){var _=x.v!==p?x.v:x.w,b=f[_],w=o(x),E=m.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+x+" Weight: "+w);E<b.distance&&(b.distance=E,b.predecessor=p,l.decrease(_,E))};for(s.nodes().forEach(function(x){var _=x===a?0:Number.POSITIVE_INFINITY;f[x]={distance:_},l.add(x,_)});l.size()>0&&(p=l.removeMin(),m=f[p],m.distance!==Number.POSITIVE_INFINITY);)c(p).forEach(y);return f}return Ga}var Ua,kp;function tE(){if(kp)return Ua;kp=1;var e=Tp(),r=ct();Ua=t;function t(n,i,s){return r.transform(n.nodes(),function(a,o){a[o]=e(n,o,i,s)},{})}return Ua}var Va,jp;function Cp(){if(jp)return Va;jp=1;var e=ct();Va=r;function r(t){var n=0,i=[],s={},a=[];function o(c){var f=s[c]={onStack:!0,lowlink:n,index:n++};if(i.push(c),t.successors(c).forEach(function(m){e.has(s,m)?s[m].onStack&&(f.lowlink=Math.min(f.lowlink,s[m].index)):(o(m),f.lowlink=Math.min(f.lowlink,s[m].lowlink))}),f.lowlink===f.index){var l=[],p;do p=i.pop(),s[p].onStack=!1,l.push(p);while(c!==p);a.push(l)}}return t.nodes().forEach(function(c){e.has(s,c)||o(c)}),a}return Va}var Wa,Pp;function rE(){if(Pp)return Wa;Pp=1;var e=ct(),r=Cp();Wa=t;function t(n){return e.filter(r(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Wa}var Ya,Lp;function nE(){if(Lp)return Ya;Lp=1;var e=ct();Ya=t;var r=e.constant(1);function t(i,s,a){return n(i,s||r,a||function(o){return i.outEdges(o)})}function n(i,s,a){var o={},c=i.nodes();return c.forEach(function(f){o[f]={},o[f][f]={distance:0},c.forEach(function(l){f!==l&&(o[f][l]={distance:Number.POSITIVE_INFINITY})}),a(f).forEach(function(l){var p=l.v===f?l.w:l.v,m=s(l);o[f][p]={distance:m,predecessor:f}})}),c.forEach(function(f){var l=o[f];c.forEach(function(p){var m=o[p];c.forEach(function(y){var x=m[f],_=l[y],b=m[y],w=x.distance+_.distance;w<b.distance&&(b.distance=w,b.predecessor=_.predecessor)})})}),o}return Ya}var Ka,Dp;function zp(){if(Dp)return Ka;Dp=1;var e=ct();Ka=r,r.CycleException=t;function r(n){var i={},s={},a=[];function o(c){if(e.has(s,c))throw new t;e.has(i,c)||(s[c]=!0,i[c]=!0,e.each(n.predecessors(c),o),delete s[c],a.push(c))}if(e.each(n.sinks(),o),e.size(i)!==n.nodeCount())throw new t;return a}function t(){}return t.prototype=new Error,Ka}var Xa,Fp;function iE(){if(Fp)return Xa;Fp=1;var e=zp();Xa=r;function r(t){try{e(t)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}return Xa}var Za,Bp;function $p(){if(Bp)return Za;Bp=1;var e=ct();Za=r;function r(n,i,s){e.isArray(i)||(i=[i]);var a=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],c={};return e.each(i,function(f){if(!n.hasNode(f))throw new Error("Graph does not have node: "+f);t(n,f,s==="post",c,a,o)}),o}function t(n,i,s,a,o,c){e.has(a,i)||(a[i]=!0,s||c.push(i),e.each(o(i),function(f){t(n,f,s,a,o,c)}),s&&c.push(i))}return Za}var Ja,Gp;function sE(){if(Gp)return Ja;Gp=1;var e=$p();Ja=r;function r(t,n){return e(t,n,"post")}return Ja}var Qa,Up;function oE(){if(Up)return Qa;Up=1;var e=$p();Qa=r;function r(t,n){return e(t,n,"pre")}return Qa}var Ha,Vp;function aE(){if(Vp)return Ha;Vp=1;var e=ct(),r=La(),t=Ap();Ha=n;function n(i,s){var a=new r,o={},c=new t,f;function l(m){var y=m.v===f?m.w:m.v,x=c.priority(y);if(x!==void 0){var _=s(m);_<x&&(o[y]=f,c.decrease(y,_))}}if(i.nodeCount()===0)return a;e.each(i.nodes(),function(m){c.add(m,Number.POSITIVE_INFINITY),a.setNode(m)}),c.decrease(i.nodes()[0],0);for(var p=!1;c.size()>0;){if(f=c.removeMin(),e.has(o,f))a.setEdge(f,o[f]);else{if(p)throw new Error("Input graph is not connected: "+i);p=!0}i.nodeEdges(f).forEach(l)}return a}return Ha}var eu,Wp;function uE(){return Wp||(Wp=1,eu={components:eE(),dijkstra:Tp(),dijkstraAll:tE(),findCycles:rE(),floydWarshall:nE(),isAcyclic:iE(),postorder:sE(),preorder:oE(),prim:aE(),tarjan:Cp(),topsort:zp()}),eu}var tu,Yp;function cE(){if(Yp)return tu;Yp=1;var e=Q_();return tu={Graph:e.Graph,json:H_(),alg:uE(),version:e.version},tu}var ru,Kp;function lt(){if(Kp)return ru;Kp=1;var e;if(typeof Gn=="function")try{e=cE()}catch(r){}return e||(e=window.graphlib),ru=e,ru}var nu,Xp;function fE(){if(Xp)return nu;Xp=1;var e=wd(),r=1,t=4;function n(i){return e(i,r|t)}return nu=n,nu}var iu,Zp;function Hr(){if(Zp)return iu;Zp=1;var e=Xt(),r=Et(),t=Ur(),n=ut();function i(s,a,o){if(!n(o))return!1;var c=typeof a;return(c=="number"?r(o)&&t(a,o.length):c=="string"&&a in o)?e(o[a],s):!1}return iu=i,iu}var su,Jp;function lE(){if(Jp)return su;Jp=1;var e=Qr(),r=Xt(),t=Hr(),n=Bt(),i=Object.prototype,s=i.hasOwnProperty,a=e(function(o,c){o=Object(o);var f=-1,l=c.length,p=l>2?c[2]:void 0;for(p&&t(c[0],c[1],p)&&(l=1);++f<l;)for(var m=c[f],y=n(m),x=-1,_=y.length;++x<_;){var b=y[x],w=o[b];(w===void 0||r(w,i[b])&&!s.call(o,b))&&(o[b]=m[b])}return o});return su=a,su}var ou,Qp;function hE(){if(Qp)return ou;Qp=1;var e=xt(),r=Et(),t=kt();function n(i){return function(s,a,o){var c=Object(s);if(!r(s)){var f=e(a,3);s=t(s),a=function(p){return f(c[p],p,c)}}var l=i(s,a,o);return l>-1?c[f?s[l]:l]:void 0}}return ou=n,ou}var au,Hp;function dE(){if(Hp)return au;Hp=1;var e=/\s/;function r(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return au=r,au}var uu,ev;function gE(){if(ev)return uu;ev=1;var e=dE(),r=/^\s+/;function t(n){return n&&n.slice(0,e(n)+1).replace(r,"")}return uu=t,uu}var cu,tv;function pE(){if(tv)return cu;tv=1;var e=gE(),r=ut(),t=Ht(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function c(f){if(typeof f=="number")return f;if(t(f))return n;if(r(f)){var l=typeof f.valueOf=="function"?f.valueOf():f;f=r(l)?l+"":l}if(typeof f!="string")return f===0?f:+f;f=e(f);var p=s.test(f);return p||a.test(f)?o(f.slice(2),p?2:8):i.test(f)?n:+f}return cu=c,cu}var fu,rv;function nv(){if(rv)return fu;rv=1;var e=pE(),r=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===r||i===-1/0){var s=i<0?-1:1;return s*t}return i===i?i:0}return fu=n,fu}var lu,iv;function vE(){if(iv)return lu;iv=1;var e=nv();function r(t){var n=e(t),i=n%1;return n===n?i?n-i:n:0}return lu=r,lu}var hu,sv;function mE(){if(sv)return hu;sv=1;var e=up(),r=xt(),t=vE(),n=Math.max;function i(s,a,o){var c=s==null?0:s.length;if(!c)return-1;var f=o==null?0:t(o);return f<0&&(f=n(c+f,0)),e(s,r(a,3),f)}return hu=i,hu}var du,ov;function yE(){if(ov)return du;ov=1;var e=hE(),r=mE(),t=e(r);return du=t,du}var gu,av;function uv(){if(av)return gu;av=1;var e=pa();function r(t){var n=t==null?0:t.length;return n?e(t,1):[]}return gu=r,gu}var pu,cv;function wE(){if(cv)return pu;cv=1;var e=eo(),r=Od(),t=Bt();function n(i,s){return i==null?i:e(i,r(s),t)}return pu=n,pu}var vu,fv;function bE(){if(fv)return vu;fv=1;function e(r){var t=r==null?0:r.length;return t?r[t-1]:void 0}return vu=e,vu}var mu,lv;function _E(){if(lv)return mu;lv=1;var e=$r(),r=ro(),t=xt();function n(i,s){var a={};return s=t(s,3),r(i,function(o,c,f){e(a,c,s(o,c,f))}),a}return mu=n,mu}var yu,hv;function wu(){if(hv)return yu;hv=1;var e=Ht();function r(t,n,i){for(var s=-1,a=t.length;++s<a;){var o=t[s],c=n(o);if(c!=null&&(f===void 0?c===c&&!e(c):i(c,f)))var f=c,l=o}return l}return yu=r,yu}var bu,dv;function EE(){if(dv)return bu;dv=1;function e(r,t){return r>t}return bu=e,bu}var _u,gv;function xE(){if(gv)return _u;gv=1;var e=wu(),r=EE(),t=$t();function n(i){return i&&i.length?e(i,t,r):void 0}return _u=n,_u}var Eu,pv;function vv(){if(pv)return Eu;pv=1;var e=$r(),r=Xt();function t(n,i,s){(s!==void 0&&!r(n[i],s)||s===void 0&&!(i in n))&&e(n,i,s)}return Eu=t,Eu}var xu,mv;function NE(){if(mv)return xu;mv=1;var e=zt(),r=Yr(),t=pt(),n="[object Object]",i=Function.prototype,s=Object.prototype,a=i.toString,o=s.hasOwnProperty,c=a.call(Object);function f(l){if(!t(l)||e(l)!=n)return!1;var p=r(l);if(p===null)return!0;var m=o.call(p,"constructor")&&p.constructor;return typeof m=="function"&&m instanceof m&&a.call(m)==c}return xu=f,xu}var Nu,yv;function wv(){if(yv)return Nu;yv=1;function e(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}return Nu=e,Nu}var Mu,bv;function ME(){if(bv)return Mu;bv=1;var e=gr(),r=Bt();function t(n){return e(n,r(n))}return Mu=t,Mu}var Su,_v;function SE(){if(_v)return Su;_v=1;var e=vv(),r=Oh(),t=ud(),n=Ih(),i=dd(),s=pr(),a=ze(),o=yp(),c=Jt(),f=dr(),l=ut(),p=NE(),m=yr(),y=wv(),x=ME();function _(b,w,E,N,S,R,A){var j=y(b,E),I=y(w,E),D=A.get(I);if(D){e(b,E,D);return}var z=R?R(j,I,E+"",b,w,A):void 0,$=z===void 0;if($){var V=a(I),Y=!V&&c(I),ee=!V&&!Y&&m(I);z=I,V||Y||ee?a(j)?z=j:o(j)?z=n(j):Y?($=!1,z=r(I,!0)):ee?($=!1,z=t(I,!0)):z=[]:p(I)||s(I)?(z=j,s(j)?z=x(j):(!l(j)||f(j))&&(z=i(I))):$=!1}$&&(A.set(I,z),S(z,I,N,R,A),A.delete(I)),e(b,E,z)}return Su=_,Su}var qu,Ev;function qE(){if(Ev)return qu;Ev=1;var e=Br(),r=vv(),t=eo(),n=SE(),i=ut(),s=Bt(),a=wv();function o(c,f,l,p,m){c!==f&&t(f,function(y,x){if(m||(m=new e),i(y))n(c,f,x,l,o,p,m);else{var _=p?p(a(c,x),y,x+"",c,f,m):void 0;_===void 0&&(_=y),r(c,x,_)}},s)}return qu=o,qu}var Ru,xv;function RE(){if(xv)return Ru;xv=1;var e=Qr(),r=Hr();function t(n){return e(function(i,s){var a=-1,o=s.length,c=o>1?s[o-1]:void 0,f=o>2?s[2]:void 0;for(c=n.length>3&&typeof c=="function"?(o--,c):void 0,f&&r(s[0],s[1],f)&&(c=o<3?void 0:c,o=1),i=Object(i);++a<o;){var l=s[a];l&&n(i,l,a,c)}return i})}return Ru=t,Ru}var Ou,Nv;function OE(){if(Nv)return Ou;Nv=1;var e=qE(),r=RE(),t=r(function(n,i,s){e(n,i,s)});return Ou=t,Ou}var Au,Mv;function Sv(){if(Mv)return Au;Mv=1;function e(r,t){return r<t}return Au=e,Au}var Iu,qv;function AE(){if(qv)return Iu;qv=1;var e=wu(),r=Sv(),t=$t();function n(i){return i&&i.length?e(i,t,r):void 0}return Iu=n,Iu}var Tu,Rv;function IE(){if(Rv)return Tu;Rv=1;var e=wu(),r=xt(),t=Sv();function n(i,s){return i&&i.length?e(i,r(s,2),t):void 0}return Tu=n,Tu}var ku,Ov;function TE(){if(Ov)return ku;Ov=1;var e=ft(),r=function(){return e.Date.now()};return ku=r,ku}var ju,Av;function kE(){if(Av)return ju;Av=1;var e=Gr(),r=Zr(),t=Ur(),n=ut(),i=br();function s(a,o,c,f){if(!n(a))return a;o=r(o,a);for(var l=-1,p=o.length,m=p-1,y=a;y!=null&&++l<p;){var x=i(o[l]),_=c;if(x==="__proto__"||x==="constructor"||x==="prototype")return a;if(l!=m){var b=y[x];_=f?f(b,x,y):void 0,_===void 0&&(_=n(b)?b:t(o[l+1])?[]:{})}e(y,x,_),y=y[x]}return a}return ju=s,ju}var Cu,Iv;function jE(){if(Iv)return Cu;Iv=1;var e=Jr(),r=kE(),t=Zr();function n(i,s,a){for(var o=-1,c=s.length,f={};++o<c;){var l=s[o],p=e(i,l);a(p,l)&&r(f,t(l,i),p)}return f}return Cu=n,Cu}var Pu,Tv;function CE(){if(Tv)return Pu;Tv=1;var e=jE(),r=_g();function t(n,i){return e(n,i,function(s,a){return r(n,a)})}return Pu=t,Pu}var Lu,kv;function PE(){if(kv)return Lu;kv=1;var e=uv(),r=tp(),t=sp();function n(i){return t(r(i,void 0,e),i+"")}return Lu=n,Lu}var Du,jv;function LE(){if(jv)return Du;jv=1;var e=CE(),r=PE(),t=r(function(n,i){return n==null?{}:e(n,i)});return Du=t,Du}var zu,Cv;function DE(){if(Cv)return zu;Cv=1;var e=Math.ceil,r=Math.max;function t(n,i,s,a){for(var o=-1,c=r(e((i-n)/(s||1)),0),f=Array(c);c--;)f[a?c:++o]=n,n+=s;return f}return zu=t,zu}var Fu,Pv;function zE(){if(Pv)return Fu;Pv=1;var e=DE(),r=Hr(),t=nv();function n(i){return function(s,a,o){return o&&typeof o!="number"&&r(s,a,o)&&(a=o=void 0),s=t(s),a===void 0?(a=s,s=0):a=t(a),o=o===void 0?s<a?1:-1:t(o),e(s,a,o,i)}}return Fu=n,Fu}var Bu,Lv;function FE(){if(Lv)return Bu;Lv=1;var e=zE(),r=e();return Bu=r,Bu}var $u,Dv;function BE(){if(Dv)return $u;Dv=1;function e(r,t){var n=r.length;for(r.sort(t);n--;)r[n]=r[n].value;return r}return $u=e,$u}var Gu,zv;function $E(){if(zv)return Gu;zv=1;var e=Ht();function r(t,n){if(t!==n){var i=t!==void 0,s=t===null,a=t===t,o=e(t),c=n!==void 0,f=n===null,l=n===n,p=e(n);if(!f&&!p&&!o&&t>n||o&&c&&l&&!f&&!p||s&&c&&l||!i&&l||!a)return 1;if(!s&&!o&&!p&&t<n||p&&i&&a&&!s&&!o||f&&i&&a||!c&&a||!l)return-1}return 0}return Gu=r,Gu}var Uu,Fv;function GE(){if(Fv)return Uu;Fv=1;var e=$E();function r(t,n,i){for(var s=-1,a=t.criteria,o=n.criteria,c=a.length,f=i.length;++s<c;){var l=e(a[s],o[s]);if(l){if(s>=f)return l;var p=i[s];return l*(p=="desc"?-1:1)}}return t.index-n.index}return Uu=r,Uu}var Vu,Bv;function UE(){if(Bv)return Vu;Bv=1;var e=Xr(),r=Jr(),t=xt(),n=Lg(),i=BE(),s=Vr(),a=GE(),o=$t(),c=ze();function f(l,p,m){p.length?p=e(p,function(_){return c(_)?function(b){return r(b,_.length===1?_[0]:_)}:_}):p=[o];var y=-1;p=e(p,s(t));var x=n(l,function(_,b,w){var E=e(p,function(N){return N(_)});return{criteria:E,index:++y,value:_}});return i(x,function(_,b){return a(_,b,m)})}return Vu=f,Vu}var Wu,$v;function VE(){if($v)return Wu;$v=1;var e=pa(),r=UE(),t=Qr(),n=Hr(),i=t(function(s,a){if(s==null)return[];var o=a.length;return o>1&&n(s,a[0],a[1])?a=[]:o>2&&n(a[0],a[1],a[2])&&(a=[a[0]]),r(s,e(a,1),[])});return Wu=i,Wu}var Yu,Gv;function WE(){if(Gv)return Yu;Gv=1;var e=hg(),r=0;function t(n){var i=++r;return e(n)+i}return Yu=t,Yu}var Ku,Uv;function YE(){if(Uv)return Ku;Uv=1;function e(r,t,n){for(var i=-1,s=r.length,a=t.length,o={};++i<s;){var c=i<a?t[i]:void 0;n(o,r[i],c)}return o}return Ku=e,Ku}var Xu,Vv;function KE(){if(Vv)return Xu;Vv=1;var e=Gr(),r=YE();function t(n,i){return r(n||[],i||[],e)}return Xu=t,Xu}var Zu,Wv;function ke(){if(Wv)return Zu;Wv=1;var e;if(typeof Gn=="function")try{e={cloneDeep:fE(),constant:Js(),defaults:lE(),each:kd(),filter:Og(),find:yE(),flatten:uv(),forEach:Id(),forIn:wE(),has:Tg(),isUndefined:Cg(),last:bE(),map:zg(),mapValues:_E(),max:xE(),merge:OE(),min:AE(),minBy:IE(),now:TE(),pick:LE(),range:FE(),reduce:Gg(),sortBy:VE(),uniqueId:WE(),values:Ep(),zipObject:KE()}}catch(r){}return e||(e=window._),Zu=e,Zu}var Ju,Yv;function XE(){if(Yv)return Ju;Yv=1,Ju=e;function e(){var n={};n._next=n._prev=n,this._sentinel=n}e.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return r(i),i},e.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&r(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},e.prototype.toString=function(){for(var n=[],i=this._sentinel,s=i._prev;s!==i;)n.push(JSON.stringify(s,t)),s=s._prev;return"["+n.join(", ")+"]"};function r(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function t(n,i){if(n!=="_next"&&n!=="_prev")return i}return Ju}var Qu,Kv;function ZE(){if(Kv)return Qu;Kv=1;var e=ke(),r=lt().Graph,t=XE();Qu=i;var n=e.constant(1);function i(f,l){if(f.nodeCount()<=1)return[];var p=o(f,l||n),m=s(p.graph,p.buckets,p.zeroIdx);return e.flatten(e.map(m,function(y){return f.outEdges(y.v,y.w)}),!0)}function s(f,l,p){for(var m=[],y=l[l.length-1],x=l[0],_;f.nodeCount();){for(;_=x.dequeue();)a(f,l,p,_);for(;_=y.dequeue();)a(f,l,p,_);if(f.nodeCount()){for(var b=l.length-2;b>0;--b)if(_=l[b].dequeue(),_){m=m.concat(a(f,l,p,_,!0));break}}}return m}function a(f,l,p,m,y){var x=y?[]:void 0;return e.forEach(f.inEdges(m.v),function(_){var b=f.edge(_),w=f.node(_.v);y&&x.push({v:_.v,w:_.w}),w.out-=b,c(l,p,w)}),e.forEach(f.outEdges(m.v),function(_){var b=f.edge(_),w=_.w,E=f.node(w);E.in-=b,c(l,p,E)}),f.removeNode(m.v),x}function o(f,l){var p=new r,m=0,y=0;e.forEach(f.nodes(),function(b){p.setNode(b,{v:b,in:0,out:0})}),e.forEach(f.edges(),function(b){var w=p.edge(b.v,b.w)||0,E=l(b),N=w+E;p.setEdge(b.v,b.w,N),y=Math.max(y,p.node(b.v).out+=E),m=Math.max(m,p.node(b.w).in+=E)});var x=e.range(y+m+3).map(function(){return new t}),_=m+1;return e.forEach(p.nodes(),function(b){c(x,_,p.node(b))}),{graph:p,buckets:x,zeroIdx:_}}function c(f,l,p){p.out?p.in?f[p.out-p.in+l].enqueue(p):f[f.length-1].enqueue(p):f[0].enqueue(p)}return Qu}var Hu,Xv;function JE(){if(Xv)return Hu;Xv=1;var e=ke(),r=ZE();Hu={run:t,undo:i};function t(s){var a=s.graph().acyclicer==="greedy"?r(s,o(s)):n(s);e.forEach(a,function(c){var f=s.edge(c);s.removeEdge(c),f.forwardName=c.name,f.reversed=!0,s.setEdge(c.w,c.v,f,e.uniqueId("rev"))});function o(c){return function(f){return c.edge(f).weight}}}function n(s){var a=[],o={},c={};function f(l){e.has(c,l)||(c[l]=!0,o[l]=!0,e.forEach(s.outEdges(l),function(p){e.has(o,p.w)?a.push(p):f(p.w)}),delete o[l])}return e.forEach(s.nodes(),f),a}function i(s){e.forEach(s.edges(),function(a){var o=s.edge(a);if(o.reversed){s.removeEdge(a);var c=o.forwardName;delete o.reversed,delete o.forwardName,s.setEdge(a.w,a.v,o,c)}})}return Hu}var ec,Zv;function nt(){if(Zv)return ec;Zv=1;var e=ke(),r=lt().Graph;ec={addDummyNode:t,simplify:n,asNonCompoundGraph:i,successorWeights:s,predecessorWeights:a,intersectRect:o,buildLayerMatrix:c,normalizeRanks:f,removeEmptyRanks:l,addBorderNode:p,maxRank:m,partition:y,time:x,notime:_};function t(b,w,E,N){var S;do S=e.uniqueId(N);while(b.hasNode(S));return E.dummy=w,b.setNode(S,E),S}function n(b){var w=new r().setGraph(b.graph());return e.forEach(b.nodes(),function(E){w.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){var N=w.edge(E.v,E.w)||{weight:0,minlen:1},S=b.edge(E);w.setEdge(E.v,E.w,{weight:N.weight+S.weight,minlen:Math.max(N.minlen,S.minlen)})}),w}function i(b){var w=new r({multigraph:b.isMultigraph()}).setGraph(b.graph());return e.forEach(b.nodes(),function(E){b.children(E).length||w.setNode(E,b.node(E))}),e.forEach(b.edges(),function(E){w.setEdge(E,b.edge(E))}),w}function s(b){var w=e.map(b.nodes(),function(E){var N={};return e.forEach(b.outEdges(E),function(S){N[S.w]=(N[S.w]||0)+b.edge(S).weight}),N});return e.zipObject(b.nodes(),w)}function a(b){var w=e.map(b.nodes(),function(E){var N={};return e.forEach(b.inEdges(E),function(S){N[S.v]=(N[S.v]||0)+b.edge(S).weight}),N});return e.zipObject(b.nodes(),w)}function o(b,w){var E=b.x,N=b.y,S=w.x-E,R=w.y-N,A=b.width/2,j=b.height/2;if(!S&&!R)throw new Error("Not possible to find intersection inside of the rectangle");var I,D;return Math.abs(R)*A>Math.abs(S)*j?(R<0&&(j=-j),I=j*S/R,D=j):(S<0&&(A=-A),I=A,D=A*R/S),{x:E+I,y:N+D}}function c(b){var w=e.map(e.range(m(b)+1),function(){return[]});return e.forEach(b.nodes(),function(E){var N=b.node(E),S=N.rank;e.isUndefined(S)||(w[S][N.order]=E)}),w}function f(b){var w=e.min(e.map(b.nodes(),function(E){return b.node(E).rank}));e.forEach(b.nodes(),function(E){var N=b.node(E);e.has(N,"rank")&&(N.rank-=w)})}function l(b){var w=e.min(e.map(b.nodes(),function(R){return b.node(R).rank})),E=[];e.forEach(b.nodes(),function(R){var A=b.node(R).rank-w;E[A]||(E[A]=[]),E[A].push(R)});var N=0,S=b.graph().nodeRankFactor;e.forEach(E,function(R,A){e.isUndefined(R)&&A%S!==0?--N:N&&e.forEach(R,function(j){b.node(j).rank+=N})})}function p(b,w,E,N){var S={width:0,height:0};return arguments.length>=4&&(S.rank=E,S.order=N),t(b,"border",S,w)}function m(b){return e.max(e.map(b.nodes(),function(w){var E=b.node(w).rank;if(!e.isUndefined(E))return E}))}function y(b,w){var E={lhs:[],rhs:[]};return e.forEach(b,function(N){w(N)?E.lhs.push(N):E.rhs.push(N)}),E}function x(b,w){var E=e.now();try{return w()}finally{console.log(b+" time: "+(e.now()-E)+"ms")}}function _(b,w){return w()}return ec}var tc,Jv;function QE(){if(Jv)return tc;Jv=1;var e=ke(),r=nt();tc={run:t,undo:i};function t(s){s.graph().dummyChains=[],e.forEach(s.edges(),function(a){n(s,a)})}function n(s,a){var o=a.v,c=s.node(o).rank,f=a.w,l=s.node(f).rank,p=a.name,m=s.edge(a),y=m.labelRank;if(l!==c+1){s.removeEdge(a);var x,_,b;for(b=0,++c;c<l;++b,++c)m.points=[],_={width:0,height:0,edgeLabel:m,edgeObj:a,rank:c},x=r.addDummyNode(s,"edge",_,"_d"),c===y&&(_.width=m.width,_.height=m.height,_.dummy="edge-label",_.labelpos=m.labelpos),s.setEdge(o,x,{weight:m.weight},p),b===0&&s.graph().dummyChains.push(x),o=x;s.setEdge(o,f,{weight:m.weight},p)}}function i(s){e.forEach(s.graph().dummyChains,function(a){var o=s.node(a),c=o.edgeLabel,f;for(s.setEdge(o.edgeObj,c);o.dummy;)f=s.successors(a)[0],s.removeNode(a),c.points.push({x:o.x,y:o.y}),o.dummy==="edge-label"&&(c.x=o.x,c.y=o.y,c.width=o.width,c.height=o.height),a=f,o=s.node(a)})}return tc}var rc,Qv;function en(){if(Qv)return rc;Qv=1;var e=ke();rc={longestPath:r,slack:t};function r(n){var i={};function s(a){var o=n.node(a);if(e.has(i,a))return o.rank;i[a]=!0;var c=e.min(e.map(n.outEdges(a),function(f){return s(f.w)-n.edge(f).minlen}));return(c===Number.POSITIVE_INFINITY||c===void 0||c===null)&&(c=0),o.rank=c}e.forEach(n.sources(),s)}function t(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return rc}var nc,Hv;function e0(){if(Hv)return nc;Hv=1;var e=ke(),r=lt().Graph,t=en().slack;nc=n;function n(o){var c=new r({directed:!1}),f=o.nodes()[0],l=o.nodeCount();c.setNode(f,{});for(var p,m;i(c,o)<l;)p=s(c,o),m=c.hasNode(p.v)?t(o,p):-t(o,p),a(c,o,m);return c}function i(o,c){function f(l){e.forEach(c.nodeEdges(l),function(p){var m=p.v,y=l===m?p.w:m;!o.hasNode(y)&&!t(c,p)&&(o.setNode(y,{}),o.setEdge(l,y,{}),f(y))})}return e.forEach(o.nodes(),f),o.nodeCount()}function s(o,c){return e.minBy(c.edges(),function(f){if(o.hasNode(f.v)!==o.hasNode(f.w))return t(c,f)})}function a(o,c,f){e.forEach(o.nodes(),function(l){c.node(l).rank+=f})}return nc}var ic,t0;function HE(){if(t0)return ic;t0=1;var e=ke(),r=e0(),t=en().slack,n=en().longestPath,i=lt().alg.preorder,s=lt().alg.postorder,a=nt().simplify;ic=o,o.initLowLimValues=p,o.initCutValues=c,o.calcCutValue=l,o.leaveEdge=y,o.enterEdge=x,o.exchangeEdges=_;function o(N){N=a(N),n(N);var S=r(N);p(S),c(S,N);for(var R,A;R=y(S);)A=x(S,N,R),_(S,N,R,A)}function c(N,S){var R=s(N,N.nodes());R=R.slice(0,R.length-1),e.forEach(R,function(A){f(N,S,A)})}function f(N,S,R){var A=N.node(R),j=A.parent;N.edge(R,j).cutvalue=l(N,S,R)}function l(N,S,R){var A=N.node(R),j=A.parent,I=!0,D=S.edge(R,j),z=0;return D||(I=!1,D=S.edge(j,R)),z=D.weight,e.forEach(S.nodeEdges(R),function($){var V=$.v===R,Y=V?$.w:$.v;if(Y!==j){var ee=V===I,J=S.edge($).weight;if(z+=ee?J:-J,w(N,R,Y)){var ue=N.edge(R,Y).cutvalue;z+=ee?-ue:ue}}}),z}function p(N,S){arguments.length<2&&(S=N.nodes()[0]),m(N,{},1,S)}function m(N,S,R,A,j){var I=R,D=N.node(A);return S[A]=!0,e.forEach(N.neighbors(A),function(z){e.has(S,z)||(R=m(N,S,R,z,A))}),D.low=I,D.lim=R++,j?D.parent=j:delete D.parent,R}function y(N){return e.find(N.edges(),function(S){return N.edge(S).cutvalue<0})}function x(N,S,R){var A=R.v,j=R.w;S.hasEdge(A,j)||(A=R.w,j=R.v);var I=N.node(A),D=N.node(j),z=I,$=!1;I.lim>D.lim&&(z=D,$=!0);var V=e.filter(S.edges(),function(Y){return $===E(N,N.node(Y.v),z)&&$!==E(N,N.node(Y.w),z)});return e.minBy(V,function(Y){return t(S,Y)})}function _(N,S,R,A){var j=R.v,I=R.w;N.removeEdge(j,I),N.setEdge(A.v,A.w,{}),p(N),c(N,S),b(N,S)}function b(N,S){var R=e.find(N.nodes(),function(j){return!S.node(j).parent}),A=i(N,R);A=A.slice(1),e.forEach(A,function(j){var I=N.node(j).parent,D=S.edge(j,I),z=!1;D||(D=S.edge(I,j),z=!0),S.node(j).rank=S.node(I).rank+(z?D.minlen:-D.minlen)})}function w(N,S,R){return N.hasEdge(S,R)}function E(N,S,R){return R.low<=S.lim&&S.lim<=R.lim}return ic}var sc,r0;function ex(){if(r0)return sc;r0=1;var e=en(),r=e.longestPath,t=e0(),n=HE();sc=i;function i(c){switch(c.graph().ranker){case"network-simplex":o(c);break;case"tight-tree":a(c);break;case"longest-path":s(c);break;default:o(c)}}var s=r;function a(c){r(c),t(c)}function o(c){n(c)}return sc}var oc,n0;function tx(){if(n0)return oc;n0=1;var e=ke();oc=r;function r(i){var s=n(i);e.forEach(i.graph().dummyChains,function(a){for(var o=i.node(a),c=o.edgeObj,f=t(i,s,c.v,c.w),l=f.path,p=f.lca,m=0,y=l[m],x=!0;a!==c.w;){if(o=i.node(a),x){for(;(y=l[m])!==p&&i.node(y).maxRank<o.rank;)m++;y===p&&(x=!1)}if(!x){for(;m<l.length-1&&i.node(y=l[m+1]).minRank<=o.rank;)m++;y=l[m]}i.setParent(a,y),a=i.successors(a)[0]}})}function t(i,s,a,o){var c=[],f=[],l=Math.min(s[a].low,s[o].low),p=Math.max(s[a].lim,s[o].lim),m,y;m=a;do m=i.parent(m),c.push(m);while(m&&(s[m].low>l||p>s[m].lim));for(y=m,m=o;(m=i.parent(m))!==y;)f.push(m);return{path:c.concat(f.reverse()),lca:y}}function n(i){var s={},a=0;function o(c){var f=a;e.forEach(i.children(c),o),s[c]={low:f,lim:a++}}return e.forEach(i.children(),o),s}return oc}var ac,i0;function rx(){if(i0)return ac;i0=1;var e=ke(),r=nt();ac={run:t,cleanup:a};function t(o){var c=r.addDummyNode(o,"root",{},"_root"),f=i(o),l=e.max(e.values(f))-1,p=2*l+1;o.graph().nestingRoot=c,e.forEach(o.edges(),function(y){o.edge(y).minlen*=p});var m=s(o)+1;e.forEach(o.children(),function(y){n(o,c,p,m,l,f,y)}),o.graph().nodeRankFactor=p}function n(o,c,f,l,p,m,y){var x=o.children(y);if(!x.length){y!==c&&o.setEdge(c,y,{weight:0,minlen:f});return}var _=r.addBorderNode(o,"_bt"),b=r.addBorderNode(o,"_bb"),w=o.node(y);o.setParent(_,y),w.borderTop=_,o.setParent(b,y),w.borderBottom=b,e.forEach(x,function(E){n(o,c,f,l,p,m,E);var N=o.node(E),S=N.borderTop?N.borderTop:E,R=N.borderBottom?N.borderBottom:E,A=N.borderTop?l:2*l,j=S!==R?1:p-m[y]+1;o.setEdge(_,S,{weight:A,minlen:j,nestingEdge:!0}),o.setEdge(R,b,{weight:A,minlen:j,nestingEdge:!0})}),o.parent(y)||o.setEdge(c,_,{weight:0,minlen:p+m[y]})}function i(o){var c={};function f(l,p){var m=o.children(l);m&&m.length&&e.forEach(m,function(y){f(y,p+1)}),c[l]=p}return e.forEach(o.children(),function(l){f(l,1)}),c}function s(o){return e.reduce(o.edges(),function(c,f){return c+o.edge(f).weight},0)}function a(o){var c=o.graph();o.removeNode(c.nestingRoot),delete c.nestingRoot,e.forEach(o.edges(),function(f){var l=o.edge(f);l.nestingEdge&&o.removeEdge(f)})}return ac}var uc,s0;function nx(){if(s0)return uc;s0=1;var e=ke(),r=nt();uc=t;function t(i){function s(a){var o=i.children(a),c=i.node(a);if(o.length&&e.forEach(o,s),e.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var f=c.minRank,l=c.maxRank+1;f<l;++f)n(i,"borderLeft","_bl",a,c,f),n(i,"borderRight","_br",a,c,f)}}e.forEach(i.children(),s)}function n(i,s,a,o,c,f){var l={width:0,height:0,rank:f,borderType:s},p=c[s][f-1],m=r.addDummyNode(i,"border",l,a);c[s][f]=m,i.setParent(m,o),p&&i.setEdge(p,m,{weight:1})}return uc}var cc,o0;function ix(){if(o0)return cc;o0=1;var e=ke();cc={adjust:r,undo:t};function r(f){var l=f.graph().rankdir.toLowerCase();(l==="lr"||l==="rl")&&n(f)}function t(f){var l=f.graph().rankdir.toLowerCase();(l==="bt"||l==="rl")&&s(f),(l==="lr"||l==="rl")&&(o(f),n(f))}function n(f){e.forEach(f.nodes(),function(l){i(f.node(l))}),e.forEach(f.edges(),function(l){i(f.edge(l))})}function i(f){var l=f.width;f.width=f.height,f.height=l}function s(f){e.forEach(f.nodes(),function(l){a(f.node(l))}),e.forEach(f.edges(),function(l){var p=f.edge(l);e.forEach(p.points,a),e.has(p,"y")&&a(p)})}function a(f){f.y=-f.y}function o(f){e.forEach(f.nodes(),function(l){c(f.node(l))}),e.forEach(f.edges(),function(l){var p=f.edge(l);e.forEach(p.points,c),e.has(p,"x")&&c(p)})}function c(f){var l=f.x;f.x=f.y,f.y=l}return cc}var fc,a0;function sx(){if(a0)return fc;a0=1;var e=ke();fc=r;function r(t){var n={},i=e.filter(t.nodes(),function(f){return!t.children(f).length}),s=e.max(e.map(i,function(f){return t.node(f).rank})),a=e.map(e.range(s+1),function(){return[]});function o(f){if(!e.has(n,f)){n[f]=!0;var l=t.node(f);a[l.rank].push(f),e.forEach(t.successors(f),o)}}var c=e.sortBy(i,function(f){return t.node(f).rank});return e.forEach(c,o),a}return fc}var lc,u0;function ox(){if(u0)return lc;u0=1;var e=ke();lc=r;function r(n,i){for(var s=0,a=1;a<i.length;++a)s+=t(n,i[a-1],i[a]);return s}function t(n,i,s){for(var a=e.zipObject(s,e.map(s,function(m,y){return y})),o=e.flatten(e.map(i,function(m){return e.sortBy(e.map(n.outEdges(m),function(y){return{pos:a[y.w],weight:n.edge(y).weight}}),"pos")}),!0),c=1;c<s.length;)c<<=1;var f=2*c-1;c-=1;var l=e.map(new Array(f),function(){return 0}),p=0;return e.forEach(o.forEach(function(m){var y=m.pos+c;l[y]+=m.weight;for(var x=0;y>0;)y%2&&(x+=l[y+1]),y=y-1>>1,l[y]+=m.weight;p+=m.weight*x})),p}return lc}var hc,c0;function ax(){if(c0)return hc;c0=1;var e=ke();hc=r;function r(t,n){return e.map(n,function(i){var s=t.inEdges(i);if(s.length){var a=e.reduce(s,function(o,c){var f=t.edge(c),l=t.node(c.v);return{sum:o.sum+f.weight*l.order,weight:o.weight+f.weight}},{sum:0,weight:0});return{v:i,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:i}})}return hc}var dc,f0;function ux(){if(f0)return dc;f0=1;var e=ke();dc=r;function r(i,s){var a={};e.forEach(i,function(c,f){var l=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:f};e.isUndefined(c.barycenter)||(l.barycenter=c.barycenter,l.weight=c.weight)}),e.forEach(s.edges(),function(c){var f=a[c.v],l=a[c.w];!e.isUndefined(f)&&!e.isUndefined(l)&&(l.indegree++,f.out.push(a[c.w]))});var o=e.filter(a,function(c){return!c.indegree});return t(o)}function t(i){var s=[];function a(f){return function(l){l.merged||(e.isUndefined(l.barycenter)||e.isUndefined(f.barycenter)||l.barycenter>=f.barycenter)&&n(f,l)}}function o(f){return function(l){l.in.push(f),--l.indegree===0&&i.push(l)}}for(;i.length;){var c=i.pop();s.push(c),e.forEach(c.in.reverse(),a(c)),e.forEach(c.out,o(c))}return e.map(e.filter(s,function(f){return!f.merged}),function(f){return e.pick(f,["vs","i","barycenter","weight"])})}function n(i,s){var a=0,o=0;i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),s.weight&&(a+=s.barycenter*s.weight,o+=s.weight),i.vs=s.vs.concat(i.vs),i.barycenter=a/o,i.weight=o,i.i=Math.min(s.i,i.i),s.merged=!0}return dc}var gc,l0;function cx(){if(l0)return gc;l0=1;var e=ke(),r=nt();gc=t;function t(s,a){var o=r.partition(s,function(_){return e.has(_,"barycenter")}),c=o.lhs,f=e.sortBy(o.rhs,function(_){return-_.i}),l=[],p=0,m=0,y=0;c.sort(i(!!a)),y=n(l,f,y),e.forEach(c,function(_){y+=_.vs.length,l.push(_.vs),p+=_.barycenter*_.weight,m+=_.weight,y=n(l,f,y)});var x={vs:e.flatten(l,!0)};return m&&(x.barycenter=p/m,x.weight=m),x}function n(s,a,o){for(var c;a.length&&(c=e.last(a)).i<=o;)a.pop(),s.push(c.vs),o++;return o}function i(s){return function(a,o){return a.barycenter<o.barycenter?-1:a.barycenter>o.barycenter?1:s?o.i-a.i:a.i-o.i}}return gc}var pc,h0;function fx(){if(h0)return pc;h0=1;var e=ke(),r=ax(),t=ux(),n=cx();pc=i;function i(o,c,f,l){var p=o.children(c),m=o.node(c),y=m?m.borderLeft:void 0,x=m?m.borderRight:void 0,_={};y&&(p=e.filter(p,function(R){return R!==y&&R!==x}));var b=r(o,p);e.forEach(b,function(R){if(o.children(R.v).length){var A=i(o,R.v,f,l);_[R.v]=A,e.has(A,"barycenter")&&a(R,A)}});var w=t(b,f);s(w,_);var E=n(w,l);if(y&&(E.vs=e.flatten([y,E.vs,x],!0),o.predecessors(y).length)){var N=o.node(o.predecessors(y)[0]),S=o.node(o.predecessors(x)[0]);e.has(E,"barycenter")||(E.barycenter=0,E.weight=0),E.barycenter=(E.barycenter*E.weight+N.order+S.order)/(E.weight+2),E.weight+=2}return E}function s(o,c){e.forEach(o,function(f){f.vs=e.flatten(f.vs.map(function(l){return c[l]?c[l].vs:l}),!0)})}function a(o,c){e.isUndefined(o.barycenter)?(o.barycenter=c.barycenter,o.weight=c.weight):(o.barycenter=(o.barycenter*o.weight+c.barycenter*c.weight)/(o.weight+c.weight),o.weight+=c.weight)}return pc}var vc,d0;function lx(){if(d0)return vc;d0=1;var e=ke(),r=lt().Graph;vc=t;function t(i,s,a){var o=n(i),c=new r({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(f){return i.node(f)});return e.forEach(i.nodes(),function(f){var l=i.node(f),p=i.parent(f);(l.rank===s||l.minRank<=s&&s<=l.maxRank)&&(c.setNode(f),c.setParent(f,p||o),e.forEach(i[a](f),function(m){var y=m.v===f?m.w:m.v,x=c.edge(y,f),_=e.isUndefined(x)?0:x.weight;c.setEdge(y,f,{weight:i.edge(m).weight+_})}),e.has(l,"minRank")&&c.setNode(f,{borderLeft:l.borderLeft[s],borderRight:l.borderRight[s]}))}),c}function n(i){for(var s;i.hasNode(s=e.uniqueId("_root")););return s}return vc}var mc,g0;function hx(){if(g0)return mc;g0=1;var e=ke();mc=r;function r(t,n,i){var s={},a;e.forEach(i,function(o){for(var c=t.parent(o),f,l;c;){if(f=t.parent(c),f?(l=s[f],s[f]=c):(l=a,a=c),l&&l!==c){n.setEdge(l,c);return}c=f}})}return mc}var yc,p0;function dx(){if(p0)return yc;p0=1;var e=ke(),r=sx(),t=ox(),n=fx(),i=lx(),s=hx(),a=lt().Graph,o=nt();yc=c;function c(m){var y=o.maxRank(m),x=f(m,e.range(1,y+1),"inEdges"),_=f(m,e.range(y-1,-1,-1),"outEdges"),b=r(m);p(m,b);for(var w=Number.POSITIVE_INFINITY,E,N=0,S=0;S<4;++N,++S){l(N%2?x:_,N%4>=2),b=o.buildLayerMatrix(m);var R=t(m,b);R<w&&(S=0,E=e.cloneDeep(b),w=R)}p(m,E)}function f(m,y,x){return e.map(y,function(_){return i(m,_,x)})}function l(m,y){var x=new a;e.forEach(m,function(_){var b=_.graph().root,w=n(_,b,x,y);e.forEach(w.vs,function(E,N){_.node(E).order=N}),s(_,x,w.vs)})}function p(m,y){e.forEach(y,function(x){e.forEach(x,function(_,b){m.node(_).order=b})})}return yc}var wc,v0;function gx(){if(v0)return wc;v0=1;var e=ke(),r=lt().Graph,t=nt();wc={positionX:x,findType1Conflicts:n,findType2Conflicts:i,addConflict:a,hasConflict:o,verticalAlignment:c,horizontalCompaction:f,alignCoordinates:m,findSmallestWidthAlignment:p,balance:y};function n(w,E){var N={};function S(R,A){var j=0,I=0,D=R.length,z=e.last(A);return e.forEach(A,function($,V){var Y=s(w,$),ee=Y?w.node(Y).order:D;(Y||$===z)&&(e.forEach(A.slice(I,V+1),function(J){e.forEach(w.predecessors(J),function(ue){var be=w.node(ue),Z=be.order;(Z<j||ee<Z)&&!(be.dummy&&w.node(J).dummy)&&a(N,ue,J)})}),I=V+1,j=ee)}),A}return e.reduce(E,S),N}function i(w,E){var N={};function S(A,j,I,D,z){var $;e.forEach(e.range(j,I),function(V){$=A[V],w.node($).dummy&&e.forEach(w.predecessors($),function(Y){var ee=w.node(Y);ee.dummy&&(ee.order<D||ee.order>z)&&a(N,Y,$)})})}function R(A,j){var I=-1,D,z=0;return e.forEach(j,function($,V){if(w.node($).dummy==="border"){var Y=w.predecessors($);Y.length&&(D=w.node(Y[0]).order,S(j,z,V,I,D),z=V,I=D)}S(j,z,j.length,D,A.length)}),j}return e.reduce(E,R),N}function s(w,E){if(w.node(E).dummy)return e.find(w.predecessors(E),function(N){return w.node(N).dummy})}function a(w,E,N){if(E>N){var S=E;E=N,N=S}var R=w[E];R||(w[E]=R={}),R[N]=!0}function o(w,E,N){if(E>N){var S=E;E=N,N=S}return e.has(w[E],N)}function c(w,E,N,S){var R={},A={},j={};return e.forEach(E,function(I){e.forEach(I,function(D,z){R[D]=D,A[D]=D,j[D]=z})}),e.forEach(E,function(I){var D=-1;e.forEach(I,function(z){var $=S(z);if($.length){$=e.sortBy($,function(ue){return j[ue]});for(var V=($.length-1)/2,Y=Math.floor(V),ee=Math.ceil(V);Y<=ee;++Y){var J=$[Y];A[z]===z&&D<j[J]&&!o(N,z,J)&&(A[J]=z,A[z]=R[z]=R[J],D=j[J])}}})}),{root:R,align:A}}function f(w,E,N,S,R){var A={},j=l(w,E,N,R),I=R?"borderLeft":"borderRight";function D(V,Y){for(var ee=j.nodes(),J=ee.pop(),ue={};J;)ue[J]?V(J):(ue[J]=!0,ee.push(J),ee=ee.concat(Y(J))),J=ee.pop()}function z(V){A[V]=j.inEdges(V).reduce(function(Y,ee){return Math.max(Y,A[ee.v]+j.edge(ee))},0)}function $(V){var Y=j.outEdges(V).reduce(function(J,ue){return Math.min(J,A[ue.w]-j.edge(ue))},Number.POSITIVE_INFINITY),ee=w.node(V);Y!==Number.POSITIVE_INFINITY&&ee.borderType!==I&&(A[V]=Math.max(A[V],Y))}return D(z,j.predecessors.bind(j)),D($,j.successors.bind(j)),e.forEach(S,function(V){A[V]=A[N[V]]}),A}function l(w,E,N,S){var R=new r,A=w.graph(),j=_(A.nodesep,A.edgesep,S);return e.forEach(E,function(I){var D;e.forEach(I,function(z){var $=N[z];if(R.setNode($),D){var V=N[D],Y=R.edge(V,$);R.setEdge(V,$,Math.max(j(w,z,D),Y||0))}D=z})}),R}function p(w,E){return e.minBy(e.values(E),function(N){var S=Number.NEGATIVE_INFINITY,R=Number.POSITIVE_INFINITY;return e.forIn(N,function(A,j){var I=b(w,j)/2;S=Math.max(A+I,S),R=Math.min(A-I,R)}),S-R})}function m(w,E){var N=e.values(E),S=e.min(N),R=e.max(N);e.forEach(["u","d"],function(A){e.forEach(["l","r"],function(j){var I=A+j,D=w[I],z;if(D!==E){var $=e.values(D);z=j==="l"?S-e.min($):R-e.max($),z&&(w[I]=e.mapValues(D,function(V){return V+z}))}})})}function y(w,E){return e.mapValues(w.ul,function(N,S){if(E)return w[E.toLowerCase()][S];var R=e.sortBy(e.map(w,S));return(R[1]+R[2])/2})}function x(w){var E=t.buildLayerMatrix(w),N=e.merge(n(w,E),i(w,E)),S={},R;e.forEach(["u","d"],function(j){R=j==="u"?E:e.values(E).reverse(),e.forEach(["l","r"],function(I){I==="r"&&(R=e.map(R,function(V){return e.values(V).reverse()}));var D=(j==="u"?w.predecessors:w.successors).bind(w),z=c(w,R,N,D),$=f(w,R,z.root,z.align,I==="r");I==="r"&&($=e.mapValues($,function(V){return-V})),S[j+I]=$})});var A=p(w,S);return m(S,A),y(S,w.graph().align)}function _(w,E,N){return function(S,R,A){var j=S.node(R),I=S.node(A),D=0,z;if(D+=j.width/2,e.has(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":z=-j.width/2;break;case"r":z=j.width/2;break}if(z&&(D+=N?z:-z),z=0,D+=(j.dummy?E:w)/2,D+=(I.dummy?E:w)/2,D+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":z=I.width/2;break;case"r":z=-I.width/2;break}return z&&(D+=N?z:-z),z=0,D}}function b(w,E){return w.node(E).width}return wc}var bc,m0;function px(){if(m0)return bc;m0=1;var e=ke(),r=nt(),t=gx().positionX;bc=n;function n(s){s=r.asNonCompoundGraph(s),i(s),e.forEach(t(s),function(a,o){s.node(o).x=a})}function i(s){var a=r.buildLayerMatrix(s),o=s.graph().ranksep,c=0;e.forEach(a,function(f){var l=e.max(e.map(f,function(p){return s.node(p).height}));e.forEach(f,function(p){s.node(p).y=c+l/2}),c+=l+o})}return bc}var _c,y0;function vx(){if(y0)return _c;y0=1;var e=ke(),r=JE(),t=QE(),n=ex(),i=nt().normalizeRanks,s=tx(),a=nt().removeEmptyRanks,o=rx(),c=nx(),f=ix(),l=dx(),p=px(),m=nt(),y=lt().Graph;_c=x;function x(G,P){var X=P&&P.debugTiming?m.time:m.notime;X("layout",function(){var te=X(" buildLayoutGraph",function(){return D(G)});X(" runLayout",function(){_(te,X)}),X(" updateInputGraph",function(){b(G,te)})})}function _(G,P){P(" makeSpaceForEdgeLabels",function(){z(G)}),P(" removeSelfEdges",function(){ce(G)}),P(" acyclic",function(){r.run(G)}),P(" nestingGraph.run",function(){o.run(G)}),P(" rank",function(){n(m.asNonCompoundGraph(G))}),P(" injectEdgeLabelProxies",function(){$(G)}),P(" removeEmptyRanks",function(){a(G)}),P(" nestingGraph.cleanup",function(){o.cleanup(G)}),P(" normalizeRanks",function(){i(G)}),P(" assignRankMinMax",function(){V(G)}),P(" removeEdgeLabelProxies",function(){Y(G)}),P(" normalize.run",function(){t.run(G)}),P(" parentDummyChains",function(){s(G)}),P(" addBorderSegments",function(){c(G)}),P(" order",function(){l(G)}),P(" insertSelfEdges",function(){pe(G)}),P(" adjustCoordinateSystem",function(){f.adjust(G)}),P(" position",function(){p(G)}),P(" positionSelfEdges",function(){he(G)}),P(" removeBorderNodes",function(){Z(G)}),P(" normalize.undo",function(){t.undo(G)}),P(" fixupEdgeLabelCoords",function(){ue(G)}),P(" undoCoordinateSystem",function(){f.undo(G)}),P(" translateGraph",function(){ee(G)}),P(" assignNodeIntersects",function(){J(G)}),P(" reversePoints",function(){be(G)}),P(" acyclic.undo",function(){r.undo(G)})}function b(G,P){e.forEach(G.nodes(),function(X){var te=G.node(X),le=P.node(X);te&&(te.x=le.x,te.y=le.y,P.children(X).length&&(te.width=le.width,te.height=le.height))}),e.forEach(G.edges(),function(X){var te=G.edge(X),le=P.edge(X);te.points=le.points,e.has(le,"x")&&(te.x=le.x,te.y=le.y)}),G.graph().width=P.graph().width,G.graph().height=P.graph().height}var w=["nodesep","edgesep","ranksep","marginx","marginy"],E={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},N=["acyclicer","ranker","rankdir","align"],S=["width","height"],R={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],j={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function D(G){var P=new y({multigraph:!0,compound:!0}),X=_e(G.graph());return P.setGraph(e.merge({},E,ie(X,w),e.pick(X,N))),e.forEach(G.nodes(),function(te){var le=_e(G.node(te));P.setNode(te,e.defaults(ie(le,S),R)),P.setParent(te,G.parent(te))}),e.forEach(G.edges(),function(te){var le=_e(G.edge(te));P.setEdge(te,e.merge({},j,ie(le,A),e.pick(le,I)))}),P}function z(G){var P=G.graph();P.ranksep/=2,e.forEach(G.edges(),function(X){var te=G.edge(X);te.minlen*=2,te.labelpos.toLowerCase()!=="c"&&(P.rankdir==="TB"||P.rankdir==="BT"?te.width+=te.labeloffset:te.height+=te.labeloffset)})}function $(G){e.forEach(G.edges(),function(P){var X=G.edge(P);if(X.width&&X.height){var te=G.node(P.v),le=G.node(P.w),xe={rank:(le.rank-te.rank)/2+te.rank,e:P};m.addDummyNode(G,"edge-proxy",xe,"_ep")}})}function V(G){var P=0;e.forEach(G.nodes(),function(X){var te=G.node(X);te.borderTop&&(te.minRank=G.node(te.borderTop).rank,te.maxRank=G.node(te.borderBottom).rank,P=e.max(P,te.maxRank))}),G.graph().maxRank=P}function Y(G){e.forEach(G.nodes(),function(P){var X=G.node(P);X.dummy==="edge-proxy"&&(G.edge(X.e).labelRank=X.rank,G.removeNode(P))})}function ee(G){var P=Number.POSITIVE_INFINITY,X=0,te=Number.POSITIVE_INFINITY,le=0,xe=G.graph(),De=xe.marginx||0,Je=xe.marginy||0;function rr(Qe){var Ve=Qe.x,Ee=Qe.y,Mt=Qe.width,Me=Qe.height;P=Math.min(P,Ve-Mt/2),X=Math.max(X,Ve+Mt/2),te=Math.min(te,Ee-Me/2),le=Math.max(le,Ee+Me/2)}e.forEach(G.nodes(),function(Qe){rr(G.node(Qe))}),e.forEach(G.edges(),function(Qe){var Ve=G.edge(Qe);e.has(Ve,"x")&&rr(Ve)}),P-=De,te-=Je,e.forEach(G.nodes(),function(Qe){var Ve=G.node(Qe);Ve.x-=P,Ve.y-=te}),e.forEach(G.edges(),function(Qe){var Ve=G.edge(Qe);e.forEach(Ve.points,function(Ee){Ee.x-=P,Ee.y-=te}),e.has(Ve,"x")&&(Ve.x-=P),e.has(Ve,"y")&&(Ve.y-=te)}),xe.width=X-P+De,xe.height=le-te+Je}function J(G){e.forEach(G.edges(),function(P){var X=G.edge(P),te=G.node(P.v),le=G.node(P.w),xe,De;X.points?(xe=X.points[0],De=X.points[X.points.length-1]):(X.points=[],xe=le,De=te),X.points.unshift(m.intersectRect(te,xe)),X.points.push(m.intersectRect(le,De))})}function ue(G){e.forEach(G.edges(),function(P){var X=G.edge(P);if(e.has(X,"x"))switch((X.labelpos==="l"||X.labelpos==="r")&&(X.width-=X.labeloffset),X.labelpos){case"l":X.x-=X.width/2+X.labeloffset;break;case"r":X.x+=X.width/2+X.labeloffset;break}})}function be(G){e.forEach(G.edges(),function(P){var X=G.edge(P);X.reversed&&X.points.reverse()})}function Z(G){e.forEach(G.nodes(),function(P){if(G.children(P).length){var X=G.node(P),te=G.node(X.borderTop),le=G.node(X.borderBottom),xe=G.node(e.last(X.borderLeft)),De=G.node(e.last(X.borderRight));X.width=Math.abs(De.x-xe.x),X.height=Math.abs(le.y-te.y),X.x=xe.x+X.width/2,X.y=te.y+X.height/2}}),e.forEach(G.nodes(),function(P){G.node(P).dummy==="border"&&G.removeNode(P)})}function ce(G){e.forEach(G.edges(),function(P){if(P.v===P.w){var X=G.node(P.v);X.selfEdges||(X.selfEdges=[]),X.selfEdges.push({e:P,label:G.edge(P)}),G.removeEdge(P)}})}function pe(G){var P=m.buildLayerMatrix(G);e.forEach(P,function(X){var te=0;e.forEach(X,function(le,xe){var De=G.node(le);De.order=xe+te,e.forEach(De.selfEdges,function(Je){m.addDummyNode(G,"selfedge",{width:Je.label.width,height:Je.label.height,rank:De.rank,order:xe+ ++te,e:Je.e,label:Je.label},"_se")}),delete De.selfEdges})})}function he(G){e.forEach(G.nodes(),function(P){var X=G.node(P);if(X.dummy==="selfedge"){var te=G.node(X.e.v),le=te.x+te.width/2,xe=te.y,De=X.x-le,Je=te.height/2;G.setEdge(X.e,X.label),G.removeNode(P),X.label.points=[{x:le+2*De/3,y:xe-Je},{x:le+5*De/6,y:xe-Je},{x:le+De,y:xe},{x:le+5*De/6,y:xe+Je},{x:le+2*De/3,y:xe+Je}],X.label.x=X.x,X.label.y=X.y}})}function ie(G,P){return e.mapValues(e.pick(G,P),Number)}function _e(G){var P={};return e.forEach(G,function(X,te){P[te.toLowerCase()]=X}),P}return _c}var Ec,w0;function mx(){if(w0)return Ec;w0=1;var e=ke(),r=nt(),t=lt().Graph;Ec={debugOrdering:n};function n(i){var s=r.buildLayerMatrix(i),a=new t({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(o){a.setNode(o,{label:o}),a.setParent(o,"layer"+i.node(o).rank)}),e.forEach(i.edges(),function(o){a.setEdge(o.v,o.w,{},o.name)}),e.forEach(s,function(o,c){var f="layer"+c;a.setNode(f,{rank:"same"}),e.reduce(o,function(l,p){return a.setEdge(l,p,{style:"invis"}),p})}),a}return Ec}var xc,b0;function yx(){return b0||(b0=1,xc="0.8.5"),xc}var Nc,_0;function wx(){return _0||(_0=1,Nc={graphlib:lt(),layout:vx(),debug:mx(),util:{time:nt().time,notime:nt().notime},version:yx()}),Nc}var E0=wx(),bx=kf(E0);class tn{constructor(r){this.id="dagre",this.options={},Object.assign(this.options,tn.defaultOptions,r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,r,Object.assign(Object.assign({},this.options),t))})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,r,Object.assign(Object.assign({},this.options),t))})}genericDagreLayout(r,t,n){return se(this,void 0,void 0,function*(){const{nodeSize:i}=n,s=new E0.graphlib.Graph;s.setGraph(n),s.setDefaultEdgeLabel(()=>({}));const a=t.getAllNodes(),o=t.getAllEdges();[...a,...o].some(({id:f})=>me(f))&&console.error("Dagre layout only support string id, it will convert number to string."),t.getAllNodes().forEach(f=>{const{id:l}=f,p=Object.assign({},f.data);if(i!==void 0){const[m,y]=ar(wt(i)?i(f):i);Object.assign(p,{width:m,height:y})}s.setNode(l.toString(),p)}),t.getAllEdges().forEach(({id:f,source:l,target:p})=>{s.setEdge(l.toString(),p.toString(),{id:f})}),bx.layout(s);const c={nodes:[],edges:[]};return s.nodes().forEach(f=>{const l=s.node(f);c.nodes.push({id:f,data:l}),r&&t.mergeNodeData(f,l)}),s.edges().forEach(f=>{const l=s.edge(f),{id:p}=l,m=Se(l,["id"]),{v:y,w:x}=f;c.edges.push({id:p,source:y,target:x,data:m}),r&&t.mergeEdgeData(p,m)}),c})}}tn.defaultOptions={};class Mc{constructor(r){this.id=r.id||0,this.rx=r.rx,this.ry=r.ry,this.fx=0,this.fy=0,this.mass=r.mass,this.degree=r.degree,this.g=r.g||0}distanceTo(r){const t=this.rx-r.rx,n=this.ry-r.ry;return Math.hypot(t,n)}setPos(r,t){this.rx=r,this.ry=t}resetForce(){this.fx=0,this.fy=0}addForce(r){const t=r.rx-this.rx,n=r.ry-this.ry;let i=Math.hypot(t,n);i=i<1e-4?1e-4:i;const s=this.g*(this.degree+1)*(r.degree+1)/i;this.fx+=s*t/i,this.fy+=s*n/i}in(r){return r.contains(this.rx,this.ry)}add(r){const t=this.mass+r.mass,n=(this.rx*this.mass+r.rx*r.mass)/t,i=(this.ry*this.mass+r.ry*r.mass)/t,s=this.degree+r.degree,a={rx:n,ry:i,mass:t,degree:s};return new Mc(a)}}class er{constructor(r){this.xmid=r.xmid,this.ymid=r.ymid,this.length=r.length,this.massCenter=r.massCenter||[0,0],this.mass=r.mass||1}getLength(){return this.length}contains(r,t){const n=this.length/2;return r<=this.xmid+n&&r>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n}NW(){const r=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:r,ymid:t,length:n};return new er(i)}NE(){const r=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:r,ymid:t,length:n};return new er(i)}SW(){const r=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:r,ymid:t,length:n};return new er(i)}SE(){const r=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:r,ymid:t,length:n};return new er(i)}}class tr{constructor(r){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,r!=null&&(this.quad=r)}insert(r){if(this.body==null){this.body=r;return}this._isExternal()?(this.quad&&(this.NW=new tr(this.quad.NW()),this.NE=new tr(this.quad.NE()),this.SW=new tr(this.quad.SW()),this.SE=new tr(this.quad.SE())),this._putBody(this.body),this._putBody(r),this.body=this.body.add(r)):(this.body=this.body.add(r),this._putBody(r))}_putBody(r){this.quad&&(r.in(this.quad.NW())&&this.NW?this.NW.insert(r):r.in(this.quad.NE())&&this.NE?this.NE.insert(r):r.in(this.quad.SW())&&this.SW?this.SW.insert(r):r.in(this.quad.SE())&&this.SE&&this.SE.insert(r))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(r){if(!(this.body==null||r===this.body))if(this._isExternal())r.addForce(this.body);else{const t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(r);t/n<this.theta?r.addForce(this.body):(this.NW&&this.NW.updateForce(r),this.NE&&this.NE.updateForce(r),this.SW&&this.SW.updateForce(r),this.SE&&this.SE.updateForce(r))}}}const _x={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Ex{constructor(r={}){this.options=r,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},_x),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,r,t)})}genericForceAtlas2Layout(r,t,n){return se(this,void 0,void 0,function*(){const i=t.getAllEdges(),s=t.getAllNodes(),a=this.formatOptions(n,s.length),{width:o,height:c,prune:f,maxIteration:l,nodeSize:p,center:m}=a;if(!(s!=null&&s.length)||s.length===1)return Lt(t,r,m);const y=s.map(w=>it(w,[o,c])),x=i.filter(w=>{const{source:E,target:N}=w;return E!==N}),_=new Be({nodes:y,edges:x}),b=this.getSizes(_,p);if(this.run(_,t,l,b,r,a),f){for(let E=0;E<x.length;E+=1){const{source:N,target:S}=x[E],R=_.getDegree(N),A=_.getDegree(N);if(R<=1){const j=_.getNode(S);_.mergeNodeData(N,{x:j.data.x,y:j.data.y})}else if(A<=1){const j=_.getNode(N);_.mergeNodeData(S,{x:j.data.x,y:j.data.y})}}const w=Object.assign(Object.assign({},a),{prune:!1,barnesHut:!1});this.run(_,t,100,b,r,w)}return{nodes:y,edges:i}})}getSizes(r,t){const n=r.getAllNodes(),i={};for(let s=0;s<n.length;s+=1){const a=n[s];i[a.id]=On(t,void 0)(a)}return i}formatOptions(r={},t){const n=Object.assign(Object.assign({},this.options),r),{center:i,width:s,height:a,barnesHut:o,prune:c,maxIteration:f,kr:l,kg:p}=n;return n.width=!s&&typeof window!="undefined"?window.innerWidth:s,n.height=!a&&typeof window!="undefined"?window.innerHeight:a,n.center=i||[n.width/2,n.height/2],o===void 0&&t>250&&(n.barnesHut=!0),c===void 0&&t>100&&(n.prune=!0),f===0&&!c?(n.maxIteration=250,t<=200&&t>100?n.maxIteration=1e3:t>200&&(n.maxIteration=1200)):f===0&&c&&(n.maxIteration=100,t<=200&&t>100?n.maxIteration=500:t>200&&(n.maxIteration=950)),l||(n.kr=50,t>100&&t<=500?n.kr=20:t>500&&(n.kr=1)),p||(n.kg=20,t>100&&t<=500?n.kg=10:t>500&&(n.kg=1)),n}run(r,t,n,i,s,a){const{kr:o,barnesHut:c,onTick:f}=a,l=r.getAllNodes();let p=0,m=n;const y={},x={},_={};for(let b=0;b<l.length;b+=1){const{data:w,id:E}=l[b];if(y[E]=[0,0],c){const N={id:b,rx:w.x,ry:w.y,mass:1,g:o,degree:r.getDegree(E)};_[E]=new Mc(N)}}for(;m>0;)p=this.oneStep(r,{iter:m,preventOverlapIters:50,krPrime:100,sg:p,forces:y,preForces:x,bodies:_,sizes:i},a),m--,f==null||f({nodes:l,edges:t.getAllEdges()});return r}oneStep(r,t,n){const{iter:i,preventOverlapIters:s,krPrime:a,sg:o,preForces:c,bodies:f,sizes:l}=t;let{forces:p}=t;const{preventOverlap:m,barnesHut:y}=n,x=r.getAllNodes();for(let _=0;_<x.length;_+=1){const{id:b}=x[_];c[b]=[...p[b]],p[b]=[0,0]}return p=this.getAttrForces(r,i,s,l,p,n),y&&(m&&i>s||!m)?p=this.getOptRepGraForces(r,p,f,n):p=this.getRepGraForces(r,i,s,p,a,l,n),this.updatePos(r,p,c,o,n)}getAttrForces(r,t,n,i,s,a){const{preventOverlap:o,dissuadeHubs:c,mode:f,prune:l}=a,p=r.getAllEdges();for(let m=0;m<p.length;m+=1){const{source:y,target:x}=p[m],_=r.getNode(y),b=r.getNode(x),w=r.getDegree(y),E=r.getDegree(x);if(l&&(w<=1||E<=1))continue;const N=[b.data.x-_.data.x,b.data.y-_.data.y];let S=Math.hypot(N[0],N[1]);S=S<1e-4?1e-4:S,N[0]=N[0]/S,N[1]=N[1]/S,o&&t<n&&(S=S-i[y]-i[x]);let R=S,A=R;f==="linlog"&&(R=Math.log(1+S),A=R),c&&(R=S/w,A=S/E),o&&t<n&&S<=0?(R=0,A=0):o&&t<n&&S>0&&(R=S,A=S),s[y][0]+=R*N[0],s[x][0]-=A*N[0],s[y][1]+=R*N[1],s[x][1]-=A*N[1]}return s}getOptRepGraForces(r,t,n,i){const{kg:s,center:a,prune:o}=i,c=r.getAllNodes(),f=c.length;let l=9e10,p=-9e10,m=9e10,y=-9e10;for(let E=0;E<f;E+=1){const{id:N,data:S}=c[E];o&&r.getDegree(N)<=1||(n[N].setPos(S.x,S.y),S.x>=p&&(p=S.x),S.x<=l&&(l=S.x),S.y>=y&&(y=S.y),S.y<=m&&(m=S.y))}const x=Math.max(p-l,y-m),_={xmid:(p+l)/2,ymid:(y+m)/2,length:x,massCenter:a,mass:f},b=new er(_),w=new tr(b);for(let E=0;E<f;E+=1){const{id:N}=c[E];o&&r.getDegree(N)<=1||n[N].in(b)&&w.insert(n[N])}for(let E=0;E<f;E+=1){const{id:N,data:S}=c[E],R=r.getDegree(N);if(o&&R<=1)continue;n[N].resetForce(),w.updateForce(n[N]),t[N][0]-=n[N].fx,t[N][1]-=n[N].fy;const A=[S.x-a[0],S.y-a[1]];let j=Math.hypot(A[0],A[1]);j=j<1e-4?1e-4:j,A[0]=A[0]/j,A[1]=A[1]/j;const I=s*(R+1);t[N][0]-=I*A[0],t[N][1]-=I*A[1]}return t}getRepGraForces(r,t,n,i,s,a,o){const{preventOverlap:c,kr:f,kg:l,center:p,prune:m}=o,y=r.getAllNodes(),x=y.length;for(let _=0;_<x;_+=1){const b=y[_],w=r.getDegree(b.id);for(let R=_+1;R<x;R+=1){const A=y[R],j=r.getDegree(A.id);if(m&&(w<=1||j<=1))continue;const I=[A.data.x-b.data.x,A.data.y-b.data.y];let D=Math.hypot(I[0],I[1]);D=D<1e-4?1e-4:D,I[0]=I[0]/D,I[1]=I[1]/D,c&&t<n&&(D=D-a[b.id]-a[A.id]);let z=f*(w+1)*(j+1)/D;c&&t<n&&D<0?z=s*(w+1)*(j+1):c&&t<n&&D===0?z=0:c&&t<n&&D>0&&(z=f*(w+1)*(j+1)/D),i[b.id][0]-=z*I[0],i[A.id][0]+=z*I[0],i[b.id][1]-=z*I[1],i[A.id][1]+=z*I[1]}const E=[b.data.x-p[0],b.data.y-p[1]],N=Math.hypot(E[0],E[1]);E[0]=E[0]/N,E[1]=E[1]/N;const S=l*(w+1);i[b.id][0]-=S*E[0],i[b.id][1]-=S*E[1]}return i}updatePos(r,t,n,i,s){const{ks:a,tao:o,prune:c,ksmax:f}=s,l=r.getAllNodes(),p=l.length,m=[],y=[];let x=0,_=0,b=i;for(let E=0;E<p;E+=1){const{id:N}=l[E],S=r.getDegree(N);if(c&&S<=1)continue;const R=[t[N][0]-n[N][0],t[N][1]-n[N][1]],A=Math.hypot(R[0],R[1]),j=[t[N][0]+n[N][0],t[N][1]+n[N][1]],I=Math.hypot(j[0],j[1]);m[E]=A,y[E]=I/2,x+=(S+1)*m[E],_+=(S+1)*y[E]}const w=b;b=o*_/x,w!==0&&(b=b>1.5*w?1.5*w:b);for(let E=0;E<p;E+=1){const{id:N,data:S}=l[E],R=r.getDegree(N);if(c&&R<=1||me(S.fx)&&me(S.fy))continue;let A=a*b/(1+b*Math.sqrt(m[E])),j=Math.hypot(t[N][0],t[N][1]);j=j<1e-4?1e-4:j;const I=f/j;A=A>I?I:A;const D=A*t[N][0],z=A*t[N][1];r.mergeNodeData(N,{x:S.x+D,y:S.y+z})}return b}}const xx={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Nx=800;class Mx{constructor(r={}){this.options=r,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},xx),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,r,t)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(r=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<r;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const t={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&t.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),t}genericFruchtermanLayout(r,t,n){return se(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:s,width:a,height:o,center:c,clustering:f,nodeClusterBy:l,maxIteration:p,onTick:m}=i,y=t.getAllNodes(),x=t.getAllEdges();if(!(y!=null&&y.length)){const N={nodes:[],edges:x};return this.lastResult=N,N}if(y.length===1){r&&t.mergeNodeData(y[0].id,{x:c[0],y:c[1],z:s===3?c[2]:void 0});const N={nodes:[Object.assign(Object.assign({},y[0]),{data:Object.assign(Object.assign({},y[0].data),{x:c[0],y:c[1],z:s===3?c[2]:void 0})})],edges:x};return this.lastResult=N,N}const _=y.map(N=>it(N,[a,o])),b=new Be({nodes:_,edges:x}),w={};if(f&&_.forEach(N=>{const S=N.data[l];w[S]||(w[S]={name:S,cx:0,cy:0,count:0})}),this.lastLayoutNodes=_,this.lastLayoutEdges=x,this.lastAssign=r,this.lastGraph=b,this.lastOptions=i,this.lastClusterMap=w,typeof window=="undefined")return;let E=0;return new Promise(N=>{this.timeInterval=window.setInterval(()=>{if(!this.running){N({nodes:_,edges:x});return}this.runOneStep(b,w,i),r&&_.forEach(({id:S,data:R})=>t.mergeNodeData(S,{x:R.x,y:R.y,z:s===3?R.z:void 0})),m==null||m({nodes:_,edges:x}),E++,E>=p&&(window.clearInterval(this.timeInterval),N({nodes:_,edges:x}))},0),this.running=!0})})}formatOptions(r={}){const t=Object.assign(Object.assign({},this.options),r),{clustering:n,nodeClusterBy:i}=t,{center:s,width:a,height:o}=t;return t.width=!a&&typeof window!="undefined"?window.innerWidth:a,t.height=!o&&typeof window!="undefined"?window.innerHeight:o,t.center=s||[t.width/2,t.height/2],t.clustering=n&&!!i,t}runOneStep(r,t,n){const{dimensions:i,height:s,width:a,gravity:o,center:c,speed:f,clustering:l,nodeClusterBy:p,clusterGravity:m}=n,y=s*a,x=Math.sqrt(y)/10,_=r.getAllNodes(),b=y/(_.length+1),w=Math.sqrt(b),E={};if(this.applyCalculate(r,E,w,b),l){for(const S in t)t[S].cx=0,t[S].cy=0,t[S].count=0;_.forEach(S=>{const{data:R}=S,A=t[R[p]];me(R.x)&&(A.cx+=R.x),me(R.y)&&(A.cy+=R.y),A.count++});for(const S in t)t[S].cx/=t[S].count,t[S].cy/=t[S].count;const N=m||o;_.forEach((S,R)=>{const{id:A,data:j}=S;if(!me(j.x)||!me(j.y))return;const I=t[j[p]],D=Math.sqrt((j.x-I.cx)*(j.x-I.cx)+(j.y-I.cy)*(j.y-I.cy)),z=w*N;E[A].x-=z*(j.x-I.cx)/D,E[A].y-=z*(j.y-I.cy)/D})}_.forEach((N,S)=>{const{id:R,data:A}=N;if(!me(A.x)||!me(A.y))return;const j=.01*w*o;E[R].x-=j*(A.x-c[0]),E[R].y-=j*(A.y-c[1]),i===3&&(E[R].z-=j*(A.z-c[2]))}),_.forEach((N,S)=>{const{id:R,data:A}=N;if(me(A.fx)&&me(A.fy)){A.x=A.fx,A.y=A.fy,i===3&&(A.z=A.fz);return}if(!me(A.x)||!me(A.y))return;const j=Math.sqrt(E[R].x*E[R].x+E[R].y*E[R].y+(i===3?E[R].z*E[R].z:0));if(j>0){const I=Math.min(x*(f/Nx),j);r.mergeNodeData(R,{x:A.x+E[R].x/j*I,y:A.y+E[R].y/j*I,z:i===3?A.z+E[R].z/j*I:void 0})}})}applyCalculate(r,t,n,i){this.calRepulsive(r,t,i),this.calAttractive(r,t,n)}calRepulsive(r,t,n){const i=r.getAllNodes();i.forEach(({data:s,id:a},o)=>{t[a]={x:0,y:0,z:0},i.forEach(({data:c,id:f},l)=>{if(o<=l||!me(s.x)||!me(c.x)||!me(s.y)||!me(c.y))return;let p=s.x-c.x,m=s.y-c.y,y=this.options.dimensions===3?s.z-c.z:0,x=p*p+m*m+y*y;x===0&&(x=1,p=.01,m=.01,y=.01);const _=n/x,b=p*_,w=m*_,E=y*_;t[a].x+=b,t[a].y+=w,t[f].x-=b,t[f].y-=w,this.options.dimensions===3&&(t[a].z+=E,t[f].z-=E)})})}calAttractive(r,t,n){r.getAllEdges().forEach(s=>{const{source:a,target:o}=s;if(!a||!o||a===o)return;const{data:c}=r.getNode(a),{data:f}=r.getNode(o);if(!me(f.x)||!me(c.x)||!me(f.y)||!me(c.y))return;const l=f.x-c.x,p=f.y-c.y,m=this.options.dimensions===3?f.z-c.z:0,y=Math.sqrt(l*l+p*p+m*m)/n,x=l*y,_=p*y,b=m*y;t[a].x+=x,t[a].y+=_,t[o].x-=x,t[o].y-=_,this.options.dimensions===3&&(t[a].z+=b,t[o].z-=b)})}}const Sx={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 qx{constructor(r={}){this.options=r,this.id="grid",this.options=Object.assign(Object.assign({},Sx),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericGridLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,r,t)})}genericGridLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:s=[0,0],condense:a,preventOverlapPadding:o,preventOverlap:c,rows:f,cols:l,nodeSpacing:p,nodeSize:m,width:y,height:x,position:_}=i;let{sortBy:b}=i;const w=t.getAllNodes(),E=t.getAllEdges(),N=w==null?void 0:w.length;if(!N||N===1)return Lt(t,r,s);const S=w.map(J=>it(J));b!=="id"&&(!sr(b)||S[0].data[b]===void 0)&&(b="degree"),b==="degree"?S.sort((J,ue)=>t.getDegree(ue.id,"both")-t.getDegree(J.id,"both")):b==="id"?S.sort((J,ue)=>me(ue.id)&&me(J.id)?ue.id-J.id:`${J.id}`.localeCompare(`${ue.id}`)):S.sort((J,ue)=>ue.data[b]-J.data[b]);const R=!y&&typeof window!="undefined"?window.innerWidth:y,A=!x&&typeof window!="undefined"?window.innerHeight:x,j=N,I={rows:f,cols:l};if(f!=null&&l!=null)I.rows=f,I.cols=l;else if(f!=null&&l==null)I.rows=f,I.cols=Math.ceil(j/I.rows);else if(f==null&&l!=null)I.cols=l,I.rows=Math.ceil(j/I.cols);else{const J=Math.sqrt(j*A/R);I.rows=Math.round(J),I.cols=Math.round(R/A*J)}if(I.rows=Math.max(I.rows,1),I.cols=Math.max(I.cols,1),I.cols*I.rows>j){const J=rn(I),ue=nn(I);(J-1)*ue>=j?rn(I,J-1):(ue-1)*J>=j&&nn(I,ue-1)}else for(;I.cols*I.rows<j;){const J=rn(I),ue=nn(I);(ue+1)*J>=j?nn(I,ue+1):rn(I,J+1)}let D=a?0:R/I.cols,z=a?0:A/I.rows;if(c||p){const J=Pt(10,p),ue=Rn(30,m,!1);S.forEach(be=>{(!be.data.x||!be.data.y)&&(be.data.x=0,be.data.y=0);const Z=t.getNode(be.id),[ce,pe]=ar(ue(Z)||30),he=J!==void 0?J(be):o,ie=ce+he,_e=pe+he;D=Math.max(D,ie),z=Math.max(z,_e)})}const $={},V={row:0,col:0},Y={};for(let J=0;J<S.length;J++){const ue=S[J];let be;if(_&&(be=_(t.getNode(ue.id))),be&&(be.row!==void 0||be.col!==void 0)){const Z={row:be.row,col:be.col};if(Z.col===void 0)for(Z.col=0;Sc($,Z);)Z.col++;else if(Z.row===void 0)for(Z.row=0;Sc($,Z);)Z.row++;Y[ue.id]=Z,x0($,Z)}Rx(ue,s,D,z,Y,I,V,$)}const ee={nodes:S,edges:E};return r&&S.forEach(J=>{t.mergeNodeData(J.id,{x:J.data.x,y:J.data.y})}),ee})}}const rn=(e,r)=>{let t;const n=e.rows||5,i=e.cols||5;return r==null?t=Math.min(n,i):Math.min(n,i)===e.rows?e.rows=r:e.cols=r,t},nn=(e,r)=>{let t;const n=e.rows||5,i=e.cols||5;return r==null?t=Math.max(n,i):Math.max(n,i)===e.rows?e.rows=r:e.cols=r,t},Sc=(e,r)=>e[`c-${r.row}-${r.col}`]||!1,x0=(e,r)=>e[`c-${r.row}-${r.col}`]=!0,N0=(e,r)=>{const t=e.cols||5;r.col++,r.col>=t&&(r.col=0,r.row++)},Rx=(e,r,t,n,i,s,a,o)=>{let c,f;const l=i[e.id];if(l)c=l.col*t+t/2+r[0],f=l.row*n+n/2+r[1];else{for(;Sc(o,a);)N0(s,a);c=a.col*t+t/2+r[0],f=a.row*n+n/2+r[1],x0(o,a),N0(s,a)}e.data.x=c,e.data.y=f},Ox=(e,r,t)=>{try{const n=It.mul(It.pow(r,2),-.5),i=n.mean("row"),s=n.mean("column"),a=n.mean();n.add(a).subRowVector(i).subColumnVector(s);const o=new Lf(n),c=It.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(f=>It.mul([f],[c]).toJSON()[0].splice(0,e))}catch(n){const i=[];for(let s=0;s<r.length;s++){const a=Math.random()*t,o=Math.random()*t;i.push([a,o])}return i}},Ax=800,Ix={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Tx=(e,r)=>{const t=Object.assign(Object.assign({},Ix),r),{positions:n,iterations:i,width:s,k:a,speed:o=100,strictRadial:c,focusIdx:f,radii:l=[],nodeSizeFunc:p}=t,m=e.getAllNodes(),y=[],x=s/10;for(let _=0;_<i;_++)n.forEach((b,w)=>{y[w]={x:0,y:0}}),kx(m,n,y,a,l,p),jx(n,y,o,c,f,x,s,l);return n},kx=(e,r,t,n,i,s)=>{r.forEach((a,o)=>{t[o]={x:0,y:0},r.forEach((c,f)=>{if(o===f||i[o]!==i[f])return;let l=a.x-c.x,p=a.y-c.y,m=Math.sqrt(l*l+p*p);if(m===0){m=1;const y=o>f?1:-1;l=.01*y,p=.01*y}if(m<s(e[o])/2+s(e[f])/2){const y=n*n/m;t[o].x+=l/m*y,t[o].y+=p/m*y}})})},jx=(e,r,t,n,i,s,a,o)=>{const c=s||a/10;return n&&r.forEach((f,l)=>{const p=e[l].x-e[i].x,m=e[l].y-e[i].y,y=Math.sqrt(p*p+m*m);let x=m/y,_=-p/y;const b=Math.sqrt(f.x*f.x+f.y*f.y);let w=Math.acos((x*f.x+_*f.y)/b);w>Math.PI/2&&(w-=Math.PI/2,x*=-1,_*=-1);const E=Math.cos(w)*b;f.x=x*E,f.y=_*E}),e.forEach((f,l)=>{if(l===i)return;const p=Math.sqrt(r[l].x*r[l].x+r[l].y*r[l].y);if(p>0&&l!==i){const m=Math.min(c*(t/Ax),p);if(f.x+=r[l].x/p*m,f.y+=r[l].y/p*m,n){let y=f.x-e[i].x,x=f.y-e[i].y;const _=Math.sqrt(y*y+x*x);y=y/_*o[l],x=x/_*o[l],f.x=e[i].x+y,f.y=e[i].y+x}}}),e},Cx={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Px{constructor(r={}){this.options=r,this.id="radial",this.options=Object.assign(Object.assign({},Cx),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,r,t)})}genericRadialLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:s,height:a,center:o,focusNode:c,unitRadius:f,nodeSize:l,nodeSpacing:p,strictRadial:m,preventOverlap:y,maxPreventOverlapIteration:x,sortBy:_,linkDistance:b=50,sortStrength:w=10,maxIteration:E=1e3}=i,N=t.getAllNodes(),S=t.getAllEdges(),R=!s&&typeof window!="undefined"?window.innerWidth:s,A=!a&&typeof window!="undefined"?window.innerHeight:a,j=o||[R/2,A/2];if(!(N!=null&&N.length)||N.length===1)return Lt(t,r,j);let I=N[0];if(sr(c)){for(let te=0;te<N.length;te++)if(N[te].id===c){I=N[te];break}}else I=c||N[0];const D=zx(N,I.id),z=xf({nodes:N,edges:S}),$=Ef(z),V=Bx($,D);Fx($,D,V+1);const Y=$[D];let ee=R-j[0]>j[0]?j[0]:R-j[0],J=A-j[1]>j[1]?j[1]:A-j[1];ee===0&&(ee=R/2),J===0&&(J=A/2);const ue=Math.min(ee,J),be=Math.max(...Y),Z=[],ce=f||ue/be;Y.forEach((te,le)=>{Z[le]=te*ce});const pe=Lx(N,$,b,Z,ce,_,w),he=Dx(pe),ie=Ox(b,pe,b);let _e=ie.map(([te,le])=>({x:(isNaN(te)?Math.random()*b:te)-ie[D][0],y:(isNaN(le)?Math.random()*b:le)-ie[D][1]}));this.run(E,_e,he,pe,Z,D);let G;if(y){G=On(l,p);const te={nodes:N,nodeSizeFunc:G,positions:_e,radii:Z,height:A,width:R,strictRadial:!!m,focusIdx:D,iterations:x||200,k:_e.length/4.5};_e=Tx(t,te)}const P=[];return _e.forEach((te,le)=>{const xe=it(N[le]);xe.data.x=te.x+j[0],xe.data.y=te.y+j[1],P.push(xe)}),r&&P.forEach(te=>t.mergeNodeData(te.id,{x:te.data.x,y:te.data.y})),{nodes:P,edges:S}})}run(r,t,n,i,s,a){for(let o=0;o<=r;o++){const c=o/r;this.oneIteration(c,t,s,i,n,a)}}oneIteration(r,t,n,i,s,a){const o=1-r;t.forEach((c,f)=>{const l=Nf(c,{x:0,y:0}),p=l===0?0:1/l;if(f===a)return;let m=0,y=0,x=0;t.forEach((b,w)=>{if(f===w)return;const E=Nf(c,b),N=E===0?0:1/E,S=i[w][f];x+=s[f][w],m+=s[f][w]*(b.x+S*(c.x-b.x)*N),y+=s[f][w]*(b.y+S*(c.y-b.y)*N)});const _=n[f]===0?0:1/n[f];x*=o,x+=r*_*_,m*=o,m+=r*_*c.x*p,c.x=m/x,y*=o,y+=r*_*c.y*p,c.y=y/x})}}const Lx=(e,r,t,n,i,s,a)=>{if(!e)return[];const o=[];if(r){const c={};r.forEach((f,l)=>{const p=[];f.forEach((m,y)=>{var x,_;if(l===y)p.push(0);else if(n[l]===n[y])if(s==="data")p.push(m*(Math.abs(l-y)*a)/(n[l]/i));else if(s){let b,w;if(c[e[l].id])b=c[e[l].id];else{const E=(s==="id"?e[l].id:(x=e[l].data)===null||x===void 0?void 0:x[s])||0;sr(E)?b=E.charCodeAt(0):b=E,c[e[l].id]=b}if(c[e[y].id])w=c[e[y].id];else{const E=(s==="id"?e[y].id:(_=e[y].data)===null||_===void 0?void 0:_[s])||0;sr(E)?w=E.charCodeAt(0):w=E,c[e[y].id]=w}p.push(m*(Math.abs(b-w)*a)/(n[l]/i))}else p.push(m*t/(n[l]/i));else{const b=(t+i)/2;p.push(m*b)}}),o.push(p)})}return o},Dx=e=>{const r=e.length,t=e[0].length,n=[];for(let i=0;i<r;i++){const s=[];for(let a=0;a<t;a++)e[i][a]!==0?s.push(1/(e[i][a]*e[i][a])):s.push(0);n.push(s)}return n},zx=(e,r)=>{let t=-1;return e.forEach((n,i)=>{n.id===r&&(t=i)}),Math.max(t,0)},Fx=(e,r,t)=>{const n=e.length;for(let i=0;i<n;i++)if(e[r][i]===1/0){e[r][i]=t,e[i][r]=t;for(let s=0;s<n;s++)e[i][s]!==1/0&&e[r][s]===1/0&&(e[r][s]=t+e[i][s],e[s][r]=t+e[i][s])}for(let i=0;i<n;i++)if(i!==r){for(let s=0;s<n;s++)if(e[i][s]===1/0){let a=Math.abs(e[r][i]-e[r][s]);a=a===0?1:a,e[i][s]=a}}},Bx=(e,r)=>{let t=0;for(let n=0;n<e[r].length;n++)e[r][n]!==1/0&&(t=e[r][n]>t?e[r][n]:t);return t},$x={center:[0,0],width:300,height:300};class Gx{constructor(r={}){this.options=r,this.id="random",this.options=Object.assign(Object.assign({},$x),r)}execute(r,t){return se(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,r,t)})}assign(r,t){return se(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,r,t)})}genericRandomLayout(r,t,n){return se(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:s,width:a,height:o}=i,c=t.getAllNodes(),f=.9,l=!a&&typeof window!="undefined"?window.innerWidth:a,p=!o&&typeof window!="undefined"?window.innerHeight:o,m=s||[l/2,p/2],y=[];return c&&c.forEach(_=>{y.push({id:_.id,data:{x:(Math.random()-.5)*f*l+m[0],y:(Math.random()-.5)*f*p+m[1]}})}),r&&y.forEach(_=>t.mergeNodeData(_.id,{x:_.data.x,y:_.data.y})),{nodes:y,edges:t.getAllEdges()}})}}const Ux={circular:Wy,concentric:An,mds:Df,random:Gx,grid:qx,radial:Px,force:Af,d3force:Kf,"d3-force-3d":ib,fruchterman:Mx,forceAtlas2:Ex,dagre:tn,antvDagre:Gy,comboCombined:e1};let Nt;pn({stopLayout(){Nt!=null&&Nt.stop&&Nt.stop()},calculateLayout(e,r){return se(this,void 0,void 0,function*(){const{layout:{id:t,options:n,iterations:i},nodes:s,edges:a}=e,o=new Be({nodes:s,edges:a}),c=Ux[t];if(c)Nt=new c(n);else throw new Error(`Unknown layout id: ${t}`);let f=yield Nt.execute(o);return zf(Nt)&&(Nt.stop(),f=Nt.tick(i)),[f,r]})}})})();