@reqvire-org/reqvire 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/reqvire-darwin-arm64.tar.gz +0 -0
- package/artifacts/reqvire-darwin-x86_64.tar.gz +0 -0
- package/artifacts/reqvire-linux-x86_64.tar.gz +0 -0
- package/bin/reqvire.js +34 -13
- package/explorer-dist/.gitkeep +0 -0
- package/explorer-dist/assets/explorer.css +1 -1
- package/explorer-dist/assets/explorer.js +129 -129
- package/explorer-dist/assets/flowLayout.worker-BgEwn2y-.js +24 -0
- package/explorer-dist/assets/forceAtlasLayout.worker-B5LN30lH.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";function Ee(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var _e={exports:{}},Qe;function Lt(){if(Qe)return _e.exports;Qe=1;var i=typeof Reflect=="object"?Reflect:null,e=i&&typeof i.apply=="function"?i.apply:function(g,E,G){return Function.prototype.apply.call(g,E,G)},t;i&&typeof i.ownKeys=="function"?t=i.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function n(w){console&&console.warn&&console.warn(w)}var r=Number.isNaN||function(g){return g!==g};function o(){o.init.call(this)}_e.exports=o,_e.exports.once=z,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function u(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(w){if(typeof w!="number"||w<0||r(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");s=w}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||r(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function h(w){return w._maxListeners===void 0?o.defaultMaxListeners:w._maxListeners}o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(g){for(var E=[],G=1;G<arguments.length;G++)E.push(arguments[G]);var S=g==="error",L=this._events;if(L!==void 0)S=S&&L.error===void 0;else if(!S)return!1;if(S){var R;if(E.length>0&&(R=E[0]),R instanceof Error)throw R;var J=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw J.context=R,J}var T=L[g];if(T===void 0)return!1;if(typeof T=="function")e(T,this,E);else for(var d=T.length,ce=U(T,d),G=0;G<d;++G)e(ce[G],this,E);return!0};function a(w,g,E,G){var S,L,R;if(u(E),L=w._events,L===void 0?(L=w._events=Object.create(null),w._eventsCount=0):(L.newListener!==void 0&&(w.emit("newListener",g,E.listener?E.listener:E),L=w._events),R=L[g]),R===void 0)R=L[g]=E,++w._eventsCount;else if(typeof R=="function"?R=L[g]=G?[E,R]:[R,E]:G?R.unshift(E):R.push(E),S=h(w),S>0&&R.length>S&&!R.warned){R.warned=!0;var J=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");J.name="MaxListenersExceededWarning",J.emitter=w,J.type=g,J.count=R.length,n(J)}return w}o.prototype.addListener=function(g,E){return a(this,g,E,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(g,E){return a(this,g,E,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(w,g,E){var G={fired:!1,wrapFn:void 0,target:w,type:g,listener:E},S=f.bind(G);return S.listener=E,G.wrapFn=S,S}o.prototype.once=function(g,E){return u(E),this.on(g,l(this,g,E)),this},o.prototype.prependOnceListener=function(g,E){return u(E),this.prependListener(g,l(this,g,E)),this},o.prototype.removeListener=function(g,E){var G,S,L,R,J;if(u(E),S=this._events,S===void 0)return this;if(G=S[g],G===void 0)return this;if(G===E||G.listener===E)--this._eventsCount===0?this._events=Object.create(null):(delete S[g],S.removeListener&&this.emit("removeListener",g,G.listener||E));else if(typeof G!="function"){for(L=-1,R=G.length-1;R>=0;R--)if(G[R]===E||G[R].listener===E){J=G[R].listener,L=R;break}if(L<0)return this;L===0?G.shift():O(G,L),G.length===1&&(S[g]=G[0]),S.removeListener!==void 0&&this.emit("removeListener",g,J||E)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(g){var E,G,S;if(G=this._events,G===void 0)return this;if(G.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):G[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete G[g]),this;if(arguments.length===0){var L=Object.keys(G),R;for(S=0;S<L.length;++S)R=L[S],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(E=G[g],typeof E=="function")this.removeListener(g,E);else if(E!==void 0)for(S=E.length-1;S>=0;S--)this.removeListener(g,E[S]);return this};function y(w,g,E){var G=w._events;if(G===void 0)return[];var S=G[g];return S===void 0?[]:typeof S=="function"?E?[S.listener||S]:[S]:E?C(S):U(S,S.length)}o.prototype.listeners=function(g){return y(this,g,!0)},o.prototype.rawListeners=function(g){return y(this,g,!1)},o.listenerCount=function(w,g){return typeof w.listenerCount=="function"?w.listenerCount(g):v.call(w,g)},o.prototype.listenerCount=v;function v(w){var g=this._events;if(g!==void 0){var E=g[w];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function U(w,g){for(var E=new Array(g),G=0;G<g;++G)E[G]=w[G];return E}function O(w,g){for(;g+1<w.length;g++)w[g]=w[g+1];w.pop()}function C(w){for(var g=new Array(w.length),E=0;E<g.length;++E)g[E]=w[E].listener||w[E];return g}function z(w,g){return new Promise(function(E,G){function S(R){w.removeListener(g,L),G(R)}function L(){typeof w.removeListener=="function"&&w.removeListener("error",S),E([].slice.call(arguments))}x(w,g,L,{once:!0}),g!=="error"&&I(w,S,{once:!0})})}function I(w,g,E){typeof w.on=="function"&&x(w,"error",g,E)}function x(w,g,E,G){if(typeof w.on=="function")G.once?w.once(g,E):w.on(g,E);else if(typeof w.addEventListener=="function")w.addEventListener(g,function S(L){G.once&&w.removeEventListener(g,S),E(L)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return _e.exports}var Ut=Lt(),Ie,Xe;function Ce(){if(Xe)return Ie;Xe=1;function i(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(i.prototype[Symbol.iterator]=function(){return this}),i.of=function(){var e=arguments,t=e.length,n=0;return new i(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},i.empty=function(){var e=new i(function(){return{done:!0}});return e},i.fromSequence=function(e){var t=0,n=e.length;return new i(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},i.is=function(e){return e instanceof i?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},Ie=i,Ie}var Ot=Ce(),Y=Ee(Ot),Ge={},Me;function Rt(){return Me||(Me=1,Ge.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Ge.SYMBOL_SUPPORT=typeof Symbol<"u"),Ge}var ze,et;function tt(){if(et)return ze;et=1;var i=Ce(),e=Rt(),t=e.ARRAY_BUFFER_SUPPORT,n=e.SYMBOL_SUPPORT;function r(o){return typeof o=="string"||Array.isArray(o)||t&&ArrayBuffer.isView(o)?i.fromSequence(o):typeof o!="object"||o===null?null:n&&typeof o[Symbol.iterator]=="function"?o[Symbol.iterator]():typeof o.next=="function"?o:null}return ze=function(s){var u=r(s);if(!u)throw new Error("obliterator: target is not iterable nor a valid iterator.");return u},ze}var Te,nt;function It(){if(nt)return Te;nt=1;var i=tt();return Te=function(t,n){for(var r=arguments.length>1?n:1/0,o=r!==1/0?new Array(r):[],s,u=0,h=i(t);;){if(u===r)return o;if(s=h.next(),s.done)return u!==n&&(o.length=u),o;o[u++]=s.value}},Te}var Ct=It(),rt=Ee(Ct),je,it;function zt(){if(it)return je;it=1;var i=Ce(),e=tt();return je=function(){var n=arguments,r=null,o=-1;return new i(function(){var u=null;do{if(r===null){if(o++,o>=n.length)return{done:!0};r=e(n[o])}if(u=r.next(),u.done===!0){r=null;continue}break}while(!0);return u})},je}var Tt=zt(),ee=Ee(Tt);function jt(){const i=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const n in arguments[e])i[n]=arguments[e][n];return i}let q=jt;typeof Object.assign=="function"&&(q=Object.assign);function V(i,e,t,n){const r=i._nodes.get(e);let o=null;return r&&(n==="mixed"?o=r.out&&r.out[t]||r.undirected&&r.undirected[t]:n==="directed"?o=r.out&&r.out[t]:o=r.undirected&&r.undirected[t]),o}function H(i){return typeof i=="object"&&i!==null}function ot(i){let e;for(e in i)return!1;return!0}function Z(i,e,t){Object.defineProperty(i,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function X(i,e,t){const n={enumerable:!0,configurable:!0};typeof t=="function"?n.get=t:(n.value=t,n.writable=!1),Object.defineProperty(i,e,n)}function st(i){return!(!H(i)||i.attributes&&!Array.isArray(i.attributes))}function Pt(){let i=Math.floor(Math.random()*256)&255;return()=>i++}class Pe extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class _ extends Pe{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,_.prototype.constructor)}}class b extends Pe{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,b.prototype.constructor)}}class $ extends Pe{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$.prototype.constructor)}}function ut(i,e){this.key=i,this.attributes=e,this.clear()}ut.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function at(i,e){this.key=i,this.attributes=e,this.clear()}at.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function ht(i,e){this.key=i,this.attributes=e,this.clear()}ht.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function ae(i,e,t,n,r){this.key=e,this.attributes=r,this.undirected=i,this.source=t,this.target=n}ae.prototype.attach=function(){let i="out",e="in";this.undirected&&(i=e="undirected");const t=this.source.key,n=this.target.key;this.source[i][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)},ae.prototype.attachMulti=function(){let i="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(i=e="undirected");const r=this.source[i],o=r[n];if(typeof o>"u"){r[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}o.previous=this,this.next=o,r[n]=this,this.target[e][t]=this},ae.prototype.detach=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][i]},ae.prototype.detachMulti=function(){const i=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][i]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][i]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const dt=0,ct=1,Wt=2,ft=3;function te(i,e,t,n,r,o,s){let u,h,a,f;if(n=""+n,t===dt){if(u=i._nodes.get(n),!u)throw new b(`Graph.${e}: could not find the "${n}" node in the graph.`);a=r,f=o}else if(t===ft){if(r=""+r,h=i._edges.get(r),!h)throw new b(`Graph.${e}: could not find the "${r}" edge in the graph.`);const l=h.source.key,y=h.target.key;if(n===l)u=h.target;else if(n===y)u=h.source;else throw new b(`Graph.${e}: the "${n}" node is not attached to the "${r}" edge (${l}, ${y}).`);a=o,f=s}else{if(h=i._edges.get(n),!h)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===ct?u=h.source:u=h.target,a=r,f=o}return[u,a,f]}function xt(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);return s.attributes[u]}}function Ft(i,e,t){i.prototype[e]=function(n,r){const[o]=te(this,e,t,n,r);return o.attributes}}function Kt(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);return s.attributes.hasOwnProperty(u)}}function Bt(i,e,t){i.prototype[e]=function(n,r,o,s){const[u,h,a]=te(this,e,t,n,r,o,s);return u.attributes[h]=a,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:h}),this}}function qt(i,e,t){i.prototype[e]=function(n,r,o,s){const[u,h,a]=te(this,e,t,n,r,o,s);if(typeof a!="function")throw new _(`Graph.${e}: updater should be a function.`);const f=u.attributes,l=a(f[h]);return f[h]=l,this.emit("nodeAttributesUpdated",{key:u.key,type:"set",attributes:u.attributes,name:h}),this}}function Ht(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);return delete s.attributes[u],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:u}),this}}function Nt(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);if(!H(u))throw new _(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=u,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Yt(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);if(!H(u))throw new _(`Graph.${e}: provided attributes are not a plain object.`);return q(s.attributes,u),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:u}),this}}function Vt(i,e,t){i.prototype[e]=function(n,r,o){const[s,u]=te(this,e,t,n,r,o);if(typeof u!="function")throw new _(`Graph.${e}: provided updater is not a function.`);return s.attributes=u(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const Zt=[{name:i=>`get${i}Attribute`,attacher:xt},{name:i=>`get${i}Attributes`,attacher:Ft},{name:i=>`has${i}Attribute`,attacher:Kt},{name:i=>`set${i}Attribute`,attacher:Bt},{name:i=>`update${i}Attribute`,attacher:qt},{name:i=>`remove${i}Attribute`,attacher:Ht},{name:i=>`replace${i}Attributes`,attacher:Nt},{name:i=>`merge${i}Attributes`,attacher:Yt},{name:i=>`update${i}Attributes`,attacher:Vt}];function Jt(i){Zt.forEach(function({name:e,attacher:t}){t(i,e("Node"),dt),t(i,e("Source"),ct),t(i,e("Target"),Wt),t(i,e("Opposite"),ft)})}function Qt(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes[r]}}function Xt(i,e,t){i.prototype[e]=function(n){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,s=""+arguments[1];if(r=V(this,o,s,t),!r)throw new b(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,r=this._edges.get(n),!r)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return r.attributes}}function Mt(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes.hasOwnProperty(r)}}function en(i,e,t){i.prototype[e]=function(n,r,o){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const u=""+n,h=""+r;if(r=arguments[2],o=arguments[3],s=V(this,u,h,t),!s)throw new b(`Graph.${e}: could not find an edge for the given path ("${u}" - "${h}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[r]=o,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}function tn(i,e,t){i.prototype[e]=function(n,r,o){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const u=""+n,h=""+r;if(r=arguments[2],o=arguments[3],s=V(this,u,h,t),!s)throw new b(`Graph.${e}: could not find an edge for the given path ("${u}" - "${h}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof o!="function")throw new _(`Graph.${e}: updater should be a function.`);return s.attributes[r]=o(s.attributes[r]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}function nn(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete o.attributes[r],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:r}),this}}function rn(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!H(r))throw new _(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function on(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!H(r))throw new _(`Graph.${e}: provided attributes are not a plain object.`);return q(o.attributes,r),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:r}),this}}function sn(i,e,t){i.prototype[e]=function(n,r){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new $(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new $(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,u=""+r;if(r=arguments[2],o=V(this,s,u,t),!o)throw new b(`Graph.${e}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new $(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new b(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof r!="function")throw new _(`Graph.${e}: provided updater is not a function.`);return o.attributes=r(o.attributes),this.emit("edgeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const un=[{name:i=>`get${i}Attribute`,attacher:Qt},{name:i=>`get${i}Attributes`,attacher:Xt},{name:i=>`has${i}Attribute`,attacher:Mt},{name:i=>`set${i}Attribute`,attacher:en},{name:i=>`update${i}Attribute`,attacher:tn},{name:i=>`remove${i}Attribute`,attacher:nn},{name:i=>`replace${i}Attributes`,attacher:rn},{name:i=>`merge${i}Attributes`,attacher:on},{name:i=>`update${i}Attributes`,attacher:sn}];function an(i){un.forEach(function({name:e,attacher:t}){t(i,e("Edge"),"mixed"),t(i,e("DirectedEdge"),"directed"),t(i,e("UndirectedEdge"),"undirected")})}const hn=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function dn(i,e,t,n){let r=!1;for(const o in e){if(o===n)continue;const s=e[o];if(r=t(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),i&&r)return s.key}}function cn(i,e,t,n){let r,o,s,u=!1;for(const h in e)if(h!==n){r=e[h];do{if(o=r.source,s=r.target,u=t(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected),i&&u)return r.key;r=r.next}while(r!==void 0)}}function We(i,e){const t=Object.keys(i),n=t.length;let r,o=0;return new Y(function(){do if(r)r=r.next;else{if(o>=n)return{done:!0};const u=t[o++];if(u===e){r=void 0;continue}r=i[u]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}})}function fn(i,e,t,n){const r=e[t];if(!r)return;const o=r.source,s=r.target;if(n(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected)&&i)return r.key}function ln(i,e,t,n){let r=e[t];if(!r)return;let o=!1;do{if(o=n(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),i&&o)return r.key;r=r.next}while(r!==void 0)}function xe(i,e){let t=i[e];return t.next!==void 0?new Y(function(){if(!t)return{done:!0};const n={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:n}}):Y.of({edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected})}function pn(i,e){if(i.size===0)return[];if(e==="mixed"||e===i.type)return typeof Array.from=="function"?Array.from(i._edges.keys()):rt(i._edges.keys(),i._edges.size);const t=e==="undirected"?i.undirectedSize:i.directedSize,n=new Array(t),r=e==="undirected",o=i._edges.values();let s=0,u,h;for(;u=o.next(),u.done!==!0;)h=u.value,h.undirected===r&&(n[s++]=h.key);return n}function lt(i,e,t,n){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,o=t==="undirected";let s,u,h=!1;const a=e._edges.values();for(;s=a.next(),s.done!==!0;){if(u=s.value,r&&u.undirected!==o)continue;const{key:f,attributes:l,source:y,target:v}=u;if(h=n(f,l,y.key,v.key,y.attributes,v.attributes,u.undirected),i&&h)return f}}function gn(i,e){if(i.size===0)return Y.empty();const t=e!=="mixed"&&e!==i.type,n=e==="undirected",r=i._edges.values();return new Y(function(){let s,u;for(;;){if(s=r.next(),s.done)return s;if(u=s.value,!(t&&u.undirected!==n))break}return{value:{edge:u.key,attributes:u.attributes,source:u.source.key,target:u.target.key,sourceAttributes:u.source.attributes,targetAttributes:u.target.attributes,undirected:u.undirected},done:!1}})}function Fe(i,e,t,n,r,o){const s=e?cn:dn;let u;if(t!=="undirected"&&(n!=="out"&&(u=s(i,r.in,o),i&&u)||n!=="in"&&(u=s(i,r.out,o,n?void 0:r.key),i&&u))||t!=="directed"&&(u=s(i,r.undirected,o),i&&u))return u}function yn(i,e,t,n){const r=[];return Fe(!1,i,e,t,n,function(o){r.push(o)}),r}function wn(i,e,t){let n=Y.empty();return i!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=ee(n,We(t.in))),e!=="in"&&typeof t.out<"u"&&(n=ee(n,We(t.out,e?void 0:t.key)))),i!=="directed"&&typeof t.undirected<"u"&&(n=ee(n,We(t.undirected))),n}function Ke(i,e,t,n,r,o,s){const u=t?ln:fn;let h;if(e!=="undirected"&&(typeof r.in<"u"&&n!=="out"&&(h=u(i,r.in,o,s),i&&h)||typeof r.out<"u"&&n!=="in"&&(n||r.key!==o)&&(h=u(i,r.out,o,s),i&&h))||e!=="directed"&&typeof r.undirected<"u"&&(h=u(i,r.undirected,o,s),i&&h))return h}function bn(i,e,t,n,r){const o=[];return Ke(!1,i,e,t,n,r,function(s){o.push(s)}),o}function mn(i,e,t,n){let r=Y.empty();return i!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(r=ee(r,xe(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(r=ee(r,xe(t.out,n)))),i!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(r=ee(r,xe(t.undirected,n))),r}function vn(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(o,s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return pn(this,n);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(typeof u>"u")throw new b(`Graph.${t}: could not find the "${o}" node in the graph.`);return yn(this.multi,n==="mixed"?this.type:n,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new b(`Graph.${t}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new b(`Graph.${t}: could not find the "${s}" target node in the graph.`);return bn(n,this.multi,r,u,s)}throw new _(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function En(i,e){const{name:t,type:n,direction:r}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[o]=function(a,f,l){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return l=a,lt(!1,this,n,l);if(arguments.length===2){a=""+a,l=f;const y=this._nodes.get(a);if(typeof y>"u")throw new b(`Graph.${o}: could not find the "${a}" node in the graph.`);return Fe(!1,this.multi,n==="mixed"?this.type:n,r,y,l)}if(arguments.length===3){a=""+a,f=""+f;const y=this._nodes.get(a);if(!y)throw new b(`Graph.${o}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(f))throw new b(`Graph.${o}: could not find the "${f}" target node in the graph.`);return Ke(!1,n,this.multi,r,y,f,l)}throw new _(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+t[0].toUpperCase()+t.slice(1);i.prototype[s]=function(){const a=Array.prototype.slice.call(arguments),f=a.pop();let l;if(a.length===0){let y=0;n!=="directed"&&(y+=this.undirectedSize),n!=="undirected"&&(y+=this.directedSize),l=new Array(y);let v=0;a.push((U,O,C,z,I,x,w)=>{l[v++]=f(U,O,C,z,I,x,w)})}else l=[],a.push((y,v,U,O,C,z,I)=>{l.push(f(y,v,U,O,C,z,I))});return this[o].apply(this,a),l};const u="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[u]=function(){const a=Array.prototype.slice.call(arguments),f=a.pop(),l=[];return a.push((y,v,U,O,C,z,I)=>{f(y,v,U,O,C,z,I)&&l.push(y)}),this[o].apply(this,a),l};const h="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[h]=function(){let a=Array.prototype.slice.call(arguments);if(a.length<2||a.length>4)throw new _(`Graph.${h}: invalid number of arguments (expecting 2, 3 or 4 and got ${a.length}).`);if(typeof a[a.length-1]=="function"&&typeof a[a.length-2]!="function")throw new _(`Graph.${h}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f,l;a.length===2?(f=a[0],l=a[1],a=[]):a.length===3?(f=a[1],l=a[2],a=[a[0]]):a.length===4&&(f=a[2],l=a[3],a=[a[0],a[1]]);let y=l;return a.push((v,U,O,C,z,I,x)=>{y=f(y,v,U,O,C,z,I,x)}),this[o].apply(this,a),y}}function _n(i,e){const{name:t,type:n,direction:r}=e,o="find"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[o]=function(h,a,f){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return f=h,lt(!0,this,n,f);if(arguments.length===2){h=""+h,f=a;const l=this._nodes.get(h);if(typeof l>"u")throw new b(`Graph.${o}: could not find the "${h}" node in the graph.`);return Fe(!0,this.multi,n==="mixed"?this.type:n,r,l,f)}if(arguments.length===3){h=""+h,a=""+a;const l=this._nodes.get(h);if(!l)throw new b(`Graph.${o}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(a))throw new b(`Graph.${o}: could not find the "${a}" target node in the graph.`);return Ke(!0,n,this.multi,r,l,a,f)}throw new _(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),a=h.pop();return h.push((l,y,v,U,O,C,z)=>a(l,y,v,U,O,C,z)),!!this[o].apply(this,h)};const u="every"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[u]=function(){const h=Array.prototype.slice.call(arguments),a=h.pop();return h.push((l,y,v,U,O,C,z)=>!a(l,y,v,U,O,C,z)),!this[o].apply(this,h)}}function Gn(i,e){const{name:t,type:n,direction:r}=e,o=t.slice(0,-1)+"Entries";i.prototype[o]=function(s,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Y.empty();if(!arguments.length)return gn(this,n);if(arguments.length===1){s=""+s;const h=this._nodes.get(s);if(!h)throw new b(`Graph.${o}: could not find the "${s}" node in the graph.`);return wn(n,r,h)}if(arguments.length===2){s=""+s,u=""+u;const h=this._nodes.get(s);if(!h)throw new b(`Graph.${o}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(u))throw new b(`Graph.${o}: could not find the "${u}" target node in the graph.`);return mn(n,r,h,u)}throw new _(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function $n(i){hn.forEach(e=>{vn(i,e),En(i,e),_n(i,e),Gn(i,e)})}const kn=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function $e(){this.A=null,this.B=null}$e.prototype.wrap=function(i){this.A===null?this.A=i:this.B===null&&(this.B=i)},$e.prototype.has=function(i){return this.A!==null&&i in this.A||this.B!==null&&i in this.B};function ye(i,e,t,n,r){for(const o in n){const s=n[o],u=s.source,h=s.target,a=u===t?h:u;if(e&&e.has(a.key))continue;const f=r(a.key,a.attributes);if(i&&f)return a.key}}function Be(i,e,t,n,r){if(e!=="mixed"){if(e==="undirected")return ye(i,null,n,n.undirected,r);if(typeof t=="string")return ye(i,null,n,n[t],r)}const o=new $e;let s;if(e!=="undirected"){if(t!=="out"){if(s=ye(i,null,n,n.in,r),i&&s)return s;o.wrap(n.in)}if(t!=="in"){if(s=ye(i,o,n,n.out,r),i&&s)return s;o.wrap(n.out)}}if(e!=="directed"&&(s=ye(i,o,n,n.undirected,r),i&&s))return s}function Dn(i,e,t){if(i!=="mixed"){if(i==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return Be(!1,i,e,t,function(r){n.push(r)}),n}function we(i,e,t){const n=Object.keys(t),r=n.length;let o=0;return new Y(function(){let u=null;do{if(o>=r)return i&&i.wrap(t),{done:!0};const h=t[n[o++]],a=h.source,f=h.target;if(u=a===e?f:a,i&&i.has(u.key)){u=null;continue}}while(u===null);return{done:!1,value:{neighbor:u.key,attributes:u.attributes}}})}function An(i,e,t){if(i!=="mixed"){if(i==="undirected")return we(null,t,t.undirected);if(typeof e=="string")return we(null,t,t[e])}let n=Y.empty();const r=new $e;return i!=="undirected"&&(e!=="out"&&(n=ee(n,we(r,t,t.in))),e!=="in"&&(n=ee(n,we(r,t,t.out)))),i!=="directed"&&(n=ee(n,we(r,t,t.undirected))),n}function Sn(i,e){const{name:t,type:n,direction:r}=e;i.prototype[t]=function(o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new b(`Graph.${t}: could not find the "${o}" node in the graph.`);return Dn(n==="mixed"?this.type:n,r,s)}}function Ln(i,e){const{name:t,type:n,direction:r}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);i.prototype[o]=function(a,f){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;a=""+a;const l=this._nodes.get(a);if(typeof l>"u")throw new b(`Graph.${o}: could not find the "${a}" node in the graph.`);Be(!1,n==="mixed"?this.type:n,r,l,f)};const s="map"+t[0].toUpperCase()+t.slice(1);i.prototype[s]=function(a,f){const l=[];return this[o](a,(y,v)=>{l.push(f(y,v))}),l};const u="filter"+t[0].toUpperCase()+t.slice(1);i.prototype[u]=function(a,f){const l=[];return this[o](a,(y,v)=>{f(y,v)&&l.push(y)}),l};const h="reduce"+t[0].toUpperCase()+t.slice(1);i.prototype[h]=function(a,f,l){if(arguments.length<3)throw new _(`Graph.${h}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let y=l;return this[o](a,(v,U)=>{y=f(y,v,U)}),y}}function Un(i,e){const{name:t,type:n,direction:r}=e,o=t[0].toUpperCase()+t.slice(1,-1),s="find"+o;i.prototype[s]=function(a,f){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;a=""+a;const l=this._nodes.get(a);if(typeof l>"u")throw new b(`Graph.${s}: could not find the "${a}" node in the graph.`);return Be(!0,n==="mixed"?this.type:n,r,l,f)};const u="some"+o;i.prototype[u]=function(a,f){return!!this[s](a,f)};const h="every"+o;i.prototype[h]=function(a,f){return!this[s](a,(y,v)=>!f(y,v))}}function On(i,e){const{name:t,type:n,direction:r}=e,o=t.slice(0,-1)+"Entries";i.prototype[o]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Y.empty();s=""+s;const u=this._nodes.get(s);if(typeof u>"u")throw new b(`Graph.${o}: could not find the "${s}" node in the graph.`);return An(n==="mixed"?this.type:n,r,u)}}function Rn(i){kn.forEach(e=>{Sn(i,e),Ln(i,e),Un(i,e),On(i,e)})}function ke(i,e,t,n,r){const o=n._nodes.values(),s=n.type;let u,h,a,f,l,y;for(;u=o.next(),u.done!==!0;){let v=!1;if(h=u.value,s!=="undirected"){f=h.out;for(a in f){l=f[a];do y=l.target,v=!0,r(h.key,y.key,h.attributes,y.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(s!=="directed"){f=h.undirected;for(a in f)if(!(e&&h.key>a)){l=f[a];do y=l.target,y.key!==a&&(y=l.source),v=!0,r(h.key,y.key,h.attributes,y.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!v&&r(h.key,null,h.attributes,null,null,null,null)}}function In(i,e){const t={key:i};return ot(e.attributes)||(t.attributes=q({},e.attributes)),t}function Cn(i,e,t){const n={key:e,source:t.source.key,target:t.target.key};return ot(t.attributes)||(n.attributes=q({},t.attributes)),i==="mixed"&&t.undirected&&(n.undirected=!0),n}function zn(i){if(!H(i))throw new _('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in i))throw new _("Graph.import: serialized node is missing its key.");if("attributes"in i&&(!H(i.attributes)||i.attributes===null))throw new _("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function Tn(i){if(!H(i))throw new _('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in i))throw new _("Graph.import: serialized edge is missing its source.");if(!("target"in i))throw new _("Graph.import: serialized edge is missing its target.");if("attributes"in i&&(!H(i.attributes)||i.attributes===null))throw new _("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in i&&typeof i.undirected!="boolean")throw new _("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const jn=Pt(),Pn=new Set(["directed","undirected","mixed"]),pt=new Set(["domain","_events","_eventsCount","_maxListeners"]),Wn=[{name:i=>`${i}Edge`,generateKey:!0},{name:i=>`${i}DirectedEdge`,generateKey:!0,type:"directed"},{name:i=>`${i}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:i=>`${i}EdgeWithKey`},{name:i=>`${i}DirectedEdgeWithKey`,type:"directed"},{name:i=>`${i}UndirectedEdgeWithKey`,type:"undirected"}],xn={allowSelfLoops:!0,multi:!1,type:"mixed"};function Fn(i,e,t){if(t&&!H(t))throw new _(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},i._nodes.has(e))throw new $(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function gt(i,e,t){const n=new i.NodeDataClass(e,t);return i._nodes.set(e,n),i.emit("nodeAdded",{key:e,attributes:t}),n}function yt(i,e,t,n,r,o,s,u){if(!n&&i.type==="undirected")throw new $(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new $(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(u&&!H(u))throw new _(`Graph.${e}: invalid attributes. Expecting an object but got "${u}"`);if(o=""+o,s=""+s,u=u||{},!i.allowSelfLoops&&o===s)throw new $(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const h=i._nodes.get(o),a=i._nodes.get(s);if(!h)throw new b(`Graph.${e}: source node "${o}" not found.`);if(!a)throw new b(`Graph.${e}: target node "${s}" not found.`);const f={key:null,undirected:n,source:o,target:s,attributes:u};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new $(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!i.multi&&(n?typeof h.undirected[s]<"u":typeof h.out[s]<"u"))throw new $(`Graph.${e}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new ae(n,r,h,a,u);i._edges.set(r,l);const y=o===s;return n?(h.undirectedDegree++,a.undirectedDegree++,y&&(h.undirectedLoops++,i._undirectedSelfLoopCount++)):(h.outDegree++,a.inDegree++,y&&(h.directedLoops++,i._directedSelfLoopCount++)),i.multi?l.attachMulti():l.attach(),n?i._undirectedSize++:i._directedSize++,f.key=r,i.emit("edgeAdded",f),r}function Kn(i,e,t,n,r,o,s,u,h){if(!n&&i.type==="undirected")throw new $(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&i.type==="directed")throw new $(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(u){if(h){if(typeof u!="function")throw new _(`Graph.${e}: invalid updater function. Expecting a function but got "${u}"`)}else if(!H(u))throw new _(`Graph.${e}: invalid attributes. Expecting an object but got "${u}"`)}o=""+o,s=""+s;let a;if(h&&(a=u,u=void 0),!i.allowSelfLoops&&o===s)throw new $(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let f=i._nodes.get(o),l=i._nodes.get(s),y,v;if(!t&&(y=i._edges.get(r),y)){if((y.source.key!==o||y.target.key!==s)&&(!n||y.source.key!==s||y.target.key!==o))throw new $(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${o}" source & "${s}" target vs. ("${y.source.key}", "${y.target.key}").`);v=y}if(!v&&!i.multi&&f&&(v=n?f.undirected[s]:f.out[s]),v){const I=[v.key,!1,!1,!1];if(h?!a:!u)return I;if(h){const x=v.attributes;v.attributes=a(x),i.emit("edgeAttributesUpdated",{type:"replace",key:v.key,attributes:v.attributes})}else q(v.attributes,u),i.emit("edgeAttributesUpdated",{type:"merge",key:v.key,attributes:v.attributes,data:u});return I}u=u||{},h&&a&&(u=a(u));const U={key:null,undirected:n,source:o,target:s,attributes:u};if(t)r=i._edgeKeyGenerator();else if(r=""+r,i._edges.has(r))throw new $(`Graph.${e}: the "${r}" edge already exists in the graph.`);let O=!1,C=!1;f||(f=gt(i,o,{}),O=!0,o===s&&(l=f,C=!0)),l||(l=gt(i,s,{}),C=!0),y=new ae(n,r,f,l,u),i._edges.set(r,y);const z=o===s;return n?(f.undirectedDegree++,l.undirectedDegree++,z&&(f.undirectedLoops++,i._undirectedSelfLoopCount++)):(f.outDegree++,l.inDegree++,z&&(f.directedLoops++,i._directedSelfLoopCount++)),i.multi?y.attachMulti():y.attach(),n?i._undirectedSize++:i._directedSize++,U.key=r,i.emit("edgeAdded",U),[r,!0,O,C]}function he(i,e){i._edges.delete(e.key);const{source:t,target:n,attributes:r}=e,o=e.undirected,s=t===n;o?(t.undirectedDegree--,n.undirectedDegree--,s&&(t.undirectedLoops--,i._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,s&&(t.directedLoops--,i._directedSelfLoopCount--)),i.multi?e.detachMulti():e.detach(),o?i._undirectedSize--:i._directedSize--,i.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:n.key,undirected:o})}class W extends Ut.EventEmitter{constructor(e){if(super(),e=q({},xn,e),typeof e.multi!="boolean")throw new _(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Pn.has(e.type))throw new _(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new _(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?ut:e.type==="directed"?at:ht;Z(this,"NodeDataClass",t);const n="geid_"+jn()+"_";let r=0;const o=()=>{let s;do s=n+r++;while(this._edges.has(s));return s};Z(this,"_attributes",{}),Z(this,"_nodes",new Map),Z(this,"_edges",new Map),Z(this,"_directedSize",0),Z(this,"_undirectedSize",0),Z(this,"_directedSelfLoopCount",0),Z(this,"_undirectedSelfLoopCount",0),Z(this,"_edgeKeyGenerator",o),Z(this,"_options",e),pt.forEach(s=>Z(this,s,this[s])),X(this,"order",()=>this._nodes.size),X(this,"size",()=>this._edges.size),X(this,"directedSize",()=>this._directedSize),X(this,"undirectedSize",()=>this._undirectedSize),X(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),X(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),X(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),X(this,"multi",this._options.multi),X(this,"type",this._options.type),X(this,"allowSelfLoops",this._options.allowSelfLoops),X(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new _(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,r=this._edges.get(n);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new _(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new _(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new $("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new b(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new b(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new $("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new b(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new b(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new $("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new b(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new b(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!=="directed"&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new b(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=n.source.key,o=n.target.key;if(e===r)return o;if(e===o)return r;throw new b(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new b(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new b(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Fn(this,e,t).key}mergeNode(e,t){if(t&&!H(t))throw new _(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(q(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new _(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const o=n.attributes;n.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new b(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const r in t.out){n=t.out[r];do he(this,n),n=n.next;while(n)}for(const r in t.in){n=t.in[r];do he(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const r in t.undirected){n=t.undirected[r];do he(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],r=""+arguments[1];if(t=V(this,n,r,this.type),!t)throw new b(`Graph.dropEdge: could not find the "${n}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new b(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return he(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new $("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new $("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const n=V(this,e,t,"directed");if(!n)throw new b(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return he(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new $("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new $("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=V(this,e,t,"undirected");if(!n)throw new b(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return he(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new _("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!H(e))throw new _("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!H(e))throw new _("Graph.mergeAttributes: provided attributes are not a plain object.");return q(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new _("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new _("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!st(t))throw new _("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let r,o;for(;r=n.next(),r.done!==!0;)o=r.value,o.attributes=e(o.key,o.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new _("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!st(t))throw new _("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let r,o,s,u;for(;r=n.next(),r.done!==!0;)o=r.value,s=o.source,u=o.target,o.attributes=e(o.key,o.attributes,s.key,u.key,s.attributes,u.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new _("Graph.forEachAdjacencyEntry: expecting a callback.");ke(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new _("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");ke(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new _("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");ke(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new _("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");ke(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):rt(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new _("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new _("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new _("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,r;const o=new Array(this.order);let s=0;for(;n=t.next(),n.done!==!0;)r=n.value,o[s++]=e(r.key,r.attributes);return o}someNode(e){if(typeof e!="function")throw new _("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new _("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new _("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,r;const o=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&o.push(r.key);return o}reduceNodes(e,t){if(typeof e!="function")throw new _("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new _("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const r=this._nodes.values();let o,s;for(;o=r.next(),o.done!==!0;)s=o.value,n=e(n,s.key,s.attributes);return n}nodeEntries(){const e=this._nodes.values();return new Y(()=>{const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,o)=>{e[t++]=In(o,r)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((r,o)=>{n[t++]=Cn(this.type,o,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof W)return e.forEachNode((h,a)=>{t?this.mergeNode(h,a):this.addNode(h,a)}),e.forEachEdge((h,a,f,l,y,v,U)=>{t?U?this.mergeUndirectedEdgeWithKey(h,f,l,a):this.mergeDirectedEdgeWithKey(h,f,l,a):U?this.addUndirectedEdgeWithKey(h,f,l,a):this.addDirectedEdgeWithKey(h,f,l,a)}),this;if(!H(e))throw new _("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!H(e.attributes))throw new _("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,r,o,s,u;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new _("Graph.import: invalid nodes. Expecting an array.");for(n=0,r=o.length;n<r;n++){s=o[n],zn(s);const{key:h,attributes:a}=s;t?this.mergeNode(h,a):this.addNode(h,a)}}if(e.edges){let h=!1;if(this.type==="undirected"&&(h=!0),o=e.edges,!Array.isArray(o))throw new _("Graph.import: invalid edges. Expecting an array.");for(n=0,r=o.length;n<r;n++){u=o[n],Tn(u);const{source:a,target:f,attributes:l,undirected:y=h}=u;let v;"key"in u?(v=t?y?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:y?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,v.call(this,u.key,a,f,l)):(v=t?y?this.mergeUndirectedEdge:this.mergeDirectedEdge:y?this.addUndirectedEdge:this.addDirectedEdge,v.call(this,a,f,l))}}return this}nullCopy(e){const t=new W(q({},this._options,e));return t.replaceAttributes(q({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((n,r)=>{const o=q({},n.attributes);n=new t.NodeDataClass(r,o),t._nodes.set(r,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new $(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new $("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new $("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let r,o;for(;r=n.next(),r.done!==!0;)o=r.value,yt(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,q({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((o,s)=>{e[s]=o.attributes});const t={},n={};this._edges.forEach((o,s)=>{const u=o.undirected?"--":"->";let h="",a=o.source.key,f=o.target.key,l;o.undirected&&a>f&&(l=a,a=f,f=l);const y=`(${a})${u}(${f})`;s.startsWith("geid_")?this.multi&&(typeof n[y]>"u"?n[y]=0:n[y]++,h+=`${n[y]}. `):h+=`[${s}]: `,h+=y,t[h]=o.attributes});const r={};for(const o in this)this.hasOwnProperty(o)&&!pt.has(o)&&typeof this[o]!="function"&&typeof o!="symbol"&&(r[o]=this[o]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Z(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(W.prototype[Symbol.for("nodejs.util.inspect.custom")]=W.prototype.inspect),Wn.forEach(i=>{["add","merge","update"].forEach(e=>{const t=i.name(e),n=e==="add"?yt:Kn;i.generateKey?W.prototype[t]=function(r,o,s){return n(this,t,!0,(i.type||this.type)==="undirected",null,r,o,s,e==="update")}:W.prototype[t]=function(r,o,s,u){return n(this,t,!1,(i.type||this.type)==="undirected",r,o,s,u,e==="update")}})}),Jt(W),an(W),$n(W),Rn(W);class wt extends W{constructor(e){const t=q({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new _("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new _('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class bt extends W{constructor(e){const t=q({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new _("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new _('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class mt extends W{constructor(e){const t=q({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new _("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class vt extends W{constructor(e){const t=q({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new _("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new _('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Et extends W{constructor(e){const t=q({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new _("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new _('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function de(i){i.from=function(e,t){const n=q({},e.options,t),r=new i(n);return r.import(e),r}}de(W),de(wt),de(bt),de(mt),de(vt),de(Et),W.Graph=W,W.DirectedGraph=wt,W.UndirectedGraph=bt,W.MultiGraph=mt,W.MultiDirectedGraph=vt,W.MultiUndirectedGraph=Et,W.InvalidArgumentsGraphError=_,W.NotFoundGraphError=b,W.UsageGraphError=$;var qe,_t;function Bn(){return _t||(_t=1,qe=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}),qe}var be={},Gt;function qn(){if(Gt)return be;Gt=1;function i(n){return typeof n!="number"||isNaN(n)?1:n}function e(n,r){var o={},s=function(a){return typeof a>"u"?r:a};typeof r=="function"&&(s=r);var u=function(a){return s(a[n])},h=function(){return s(void 0)};return typeof n=="string"?(o.fromAttributes=u,o.fromGraph=function(a,f){return u(a.getNodeAttributes(f))},o.fromEntry=function(a,f){return u(f)}):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(a,f){return s(n(f,a.getNodeAttributes(f)))},o.fromEntry=function(a,f){return s(n(a,f))}):(o.fromAttributes=h,o.fromGraph=h,o.fromEntry=h),o}function t(n,r){var o={},s=function(a){return typeof a>"u"?r:a};typeof r=="function"&&(s=r);var u=function(a){return s(a[n])},h=function(){return s(void 0)};return typeof n=="string"?(o.fromAttributes=u,o.fromGraph=function(a,f){return u(a.getEdgeAttributes(f))},o.fromEntry=function(a,f){return u(f)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(a,f){var l=a.extremities(f);return s(n(f,a.getEdgeAttributes(f),l[0],l[1],a.getNodeAttributes(l[0]),a.getNodeAttributes(l[1]),a.isUndirected(f)))},o.fromEntry=function(a,f,l,y,v,U,O){return s(n(a,f,l,y,v,U,O))},o.fromPartialEntry=function(a,f,l,y){return s(n(a,f,l,y))},o.fromMinimalEntry=function(a,f){return s(n(a,f))}):(o.fromAttributes=h,o.fromGraph=h,o.fromEntry=h,o.fromMinimalEntry=h),o}return be.createNodeValueGetter=e,be.createEdgeValueGetter=t,be.createEdgeWeightGetter=function(n){return t(n,i)},be}var He,$t;function Hn(){if($t)return He;$t=1;var i=0,e=1,t=2,n=3,r=4,o=5,s=6,u=7,h=8,a=9,f=0,l=1,y=2,v=0,U=1,O=2,C=3,z=4,I=5,x=6,w=7,g=8,E=3,G=10,S=3,L=9,R=10;return He=function(T,d,ce){var Ve,m,c,F,B,ie,fe,N,A,Ze,M=d.length,Xn=ce.length,me=T.adjustSizes,Mn=T.barnesHutTheta*T.barnesHutTheta,De,K,j,P,re,D,k,p=[];for(c=0;c<M;c+=G)d[c+r]=d[c+t],d[c+o]=d[c+n],d[c+t]=0,d[c+n]=0;if(T.outboundAttractionDistribution){for(De=0,c=0;c<M;c+=G)De+=d[c+s];De/=M/G}if(T.barnesHutOptimize){var oe=1/0,le=-1/0,se=1/0,pe=-1/0,Q,ge,Je;for(c=0;c<M;c+=G)oe=Math.min(oe,d[c+i]),le=Math.max(le,d[c+i]),se=Math.min(se,d[c+e]),pe=Math.max(pe,d[c+e]);var Ae=le-oe,Se=pe-se;for(Ae>Se?(se-=(Ae-Se)/2,pe=se+Ae):(oe-=(Se-Ae)/2,le=oe+Se),p[0+v]=-1,p[0+U]=(oe+le)/2,p[0+O]=(se+pe)/2,p[0+C]=Math.max(le-oe,pe-se),p[0+z]=-1,p[0+I]=-1,p[0+x]=0,p[0+w]=0,p[0+g]=0,Ve=1,c=0;c<M;c+=G)for(m=0,Je=E;;)if(p[m+I]>=0){d[c+i]<p[m+U]?d[c+e]<p[m+O]?Q=p[m+I]:Q=p[m+I]+L:d[c+e]<p[m+O]?Q=p[m+I]+L*2:Q=p[m+I]+L*3,p[m+w]=(p[m+w]*p[m+x]+d[c+i]*d[c+s])/(p[m+x]+d[c+s]),p[m+g]=(p[m+g]*p[m+x]+d[c+e]*d[c+s])/(p[m+x]+d[c+s]),p[m+x]+=d[c+s],m=Q;continue}else if(p[m+v]<0){p[m+v]=c;break}else{if(p[m+I]=Ve*L,N=p[m+C]/2,A=p[m+I],p[A+v]=-1,p[A+U]=p[m+U]-N,p[A+O]=p[m+O]-N,p[A+C]=N,p[A+z]=A+L,p[A+I]=-1,p[A+x]=0,p[A+w]=0,p[A+g]=0,A+=L,p[A+v]=-1,p[A+U]=p[m+U]-N,p[A+O]=p[m+O]+N,p[A+C]=N,p[A+z]=A+L,p[A+I]=-1,p[A+x]=0,p[A+w]=0,p[A+g]=0,A+=L,p[A+v]=-1,p[A+U]=p[m+U]+N,p[A+O]=p[m+O]-N,p[A+C]=N,p[A+z]=A+L,p[A+I]=-1,p[A+x]=0,p[A+w]=0,p[A+g]=0,A+=L,p[A+v]=-1,p[A+U]=p[m+U]+N,p[A+O]=p[m+O]+N,p[A+C]=N,p[A+z]=p[m+z],p[A+I]=-1,p[A+x]=0,p[A+w]=0,p[A+g]=0,Ve+=4,d[p[m+v]+i]<p[m+U]?d[p[m+v]+e]<p[m+O]?Q=p[m+I]:Q=p[m+I]+L:d[p[m+v]+e]<p[m+O]?Q=p[m+I]+L*2:Q=p[m+I]+L*3,p[m+x]=d[p[m+v]+s],p[m+w]=d[p[m+v]+i],p[m+g]=d[p[m+v]+e],p[Q+v]=p[m+v],p[m+v]=-1,d[c+i]<p[m+U]?d[c+e]<p[m+O]?ge=p[m+I]:ge=p[m+I]+L:d[c+e]<p[m+O]?ge=p[m+I]+L*2:ge=p[m+I]+L*3,Q===ge)if(Je--){m=Q;continue}else{Je=E;break}p[ge+v]=c;break}}if(T.barnesHutOptimize)for(K=T.scalingRatio,c=0;c<M;c+=G)for(m=0;;)if(p[m+I]>=0)if(D=Math.pow(d[c+i]-p[m+w],2)+Math.pow(d[c+e]-p[m+g],2),Ze=p[m+C],4*Ze*Ze/D<Mn){if(j=d[c+i]-p[m+w],P=d[c+e]-p[m+g],me===!0?D>0?(k=K*d[c+s]*p[m+x]/D,d[c+t]+=j*k,d[c+n]+=P*k):D<0&&(k=-K*d[c+s]*p[m+x]/Math.sqrt(D),d[c+t]+=j*k,d[c+n]+=P*k):D>0&&(k=K*d[c+s]*p[m+x]/D,d[c+t]+=j*k,d[c+n]+=P*k),m=p[m+z],m<0)break;continue}else{m=p[m+I];continue}else{if(ie=p[m+v],ie>=0&&ie!==c&&(j=d[c+i]-d[ie+i],P=d[c+e]-d[ie+e],D=j*j+P*P,me===!0?D>0?(k=K*d[c+s]*d[ie+s]/D,d[c+t]+=j*k,d[c+n]+=P*k):D<0&&(k=-K*d[c+s]*d[ie+s]/Math.sqrt(D),d[c+t]+=j*k,d[c+n]+=P*k):D>0&&(k=K*d[c+s]*d[ie+s]/D,d[c+t]+=j*k,d[c+n]+=P*k)),m=p[m+z],m<0)break;continue}else for(K=T.scalingRatio,F=0;F<M;F+=G)for(B=0;B<F;B+=G)j=d[F+i]-d[B+i],P=d[F+e]-d[B+e],me===!0?(D=Math.sqrt(j*j+P*P)-d[F+h]-d[B+h],D>0?(k=K*d[F+s]*d[B+s]/D/D,d[F+t]+=j*k,d[F+n]+=P*k,d[B+t]-=j*k,d[B+n]-=P*k):D<0&&(k=100*K*d[F+s]*d[B+s],d[F+t]+=j*k,d[F+n]+=P*k,d[B+t]-=j*k,d[B+n]-=P*k)):(D=Math.sqrt(j*j+P*P),D>0&&(k=K*d[F+s]*d[B+s]/D/D,d[F+t]+=j*k,d[F+n]+=P*k,d[B+t]-=j*k,d[B+n]-=P*k));for(A=T.gravity/T.scalingRatio,K=T.scalingRatio,c=0;c<M;c+=G)k=0,j=d[c+i],P=d[c+e],D=Math.sqrt(Math.pow(j,2)+Math.pow(P,2)),T.strongGravityMode?D>0&&(k=K*d[c+s]*A):D>0&&(k=K*d[c+s]*A/D),d[c+t]-=j*k,d[c+n]-=P*k;for(K=1*(T.outboundAttractionDistribution?De:1),fe=0;fe<Xn;fe+=S)F=ce[fe+f],B=ce[fe+l],N=ce[fe+y],re=Math.pow(N,T.edgeWeightInfluence),j=d[F+i]-d[B+i],P=d[F+e]-d[B+e],me===!0?(D=Math.sqrt(j*j+P*P)-d[F+h]-d[B+h],T.linLogMode?T.outboundAttractionDistribution?D>0&&(k=-K*re*Math.log(1+D)/D/d[F+s]):D>0&&(k=-K*re*Math.log(1+D)/D):T.outboundAttractionDistribution?D>0&&(k=-K*re/d[F+s]):D>0&&(k=-K*re)):(D=Math.sqrt(Math.pow(j,2)+Math.pow(P,2)),T.linLogMode?T.outboundAttractionDistribution?D>0&&(k=-K*re*Math.log(1+D)/D/d[F+s]):D>0&&(k=-K*re*Math.log(1+D)/D):T.outboundAttractionDistribution?(D=1,k=-K*re/d[F+s]):(D=1,k=-K*re)),D>0&&(d[F+t]+=j*k,d[F+n]+=P*k,d[B+t]-=j*k,d[B+n]-=P*k);var Le,ve,Ue,ue,Oe,Re;if(me===!0)for(c=0;c<M;c+=G)d[c+a]!==1&&(Le=Math.sqrt(Math.pow(d[c+t],2)+Math.pow(d[c+n],2)),Le>R&&(d[c+t]=d[c+t]*R/Le,d[c+n]=d[c+n]*R/Le),ve=d[c+s]*Math.sqrt((d[c+r]-d[c+t])*(d[c+r]-d[c+t])+(d[c+o]-d[c+n])*(d[c+o]-d[c+n])),Ue=Math.sqrt((d[c+r]+d[c+t])*(d[c+r]+d[c+t])+(d[c+o]+d[c+n])*(d[c+o]+d[c+n]))/2,ue=.1*Math.log(1+Ue)/(1+Math.sqrt(ve)),Oe=d[c+i]+d[c+t]*(ue/T.slowDown),d[c+i]=Oe,Re=d[c+e]+d[c+n]*(ue/T.slowDown),d[c+e]=Re);else for(c=0;c<M;c+=G)d[c+a]!==1&&(ve=d[c+s]*Math.sqrt((d[c+r]-d[c+t])*(d[c+r]-d[c+t])+(d[c+o]-d[c+n])*(d[c+o]-d[c+n])),Ue=Math.sqrt((d[c+r]+d[c+t])*(d[c+r]+d[c+t])+(d[c+o]+d[c+n])*(d[c+o]+d[c+n]))/2,ue=d[c+u]*Math.log(1+Ue)/(1+Math.sqrt(ve)),d[c+u]=Math.min(1,Math.sqrt(ue*(Math.pow(d[c+t],2)+Math.pow(d[c+n],2))/(1+Math.sqrt(ve)))),Oe=d[c+i]+d[c+t]*(ue/T.slowDown),d[c+i]=Oe,Re=d[c+e]+d[c+n]*(ue/T.slowDown),d[c+e]=Re);return{}},He}var ne={},kt;function Nn(){if(kt)return ne;kt=1;var i=10,e=3;return ne.assign=function(t){t=t||{};var n=Array.prototype.slice.call(arguments).slice(1),r,o,s;for(r=0,s=n.length;r<s;r++)if(n[r])for(o in n[r])t[o]=n[r][o];return t},ne.validateSettings=function(t){return"linLogMode"in t&&typeof t.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&typeof t.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&typeof t.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&typeof t.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in t&&!(typeof t.scalingRatio=="number"&&t.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},ne.graphToByteArrays=function(t,n){var r=t.order,o=t.size,s={},u,h=new Float32Array(r*i),a=new Float32Array(o*e);return u=0,t.forEachNode(function(f,l){s[f]=u,h[u]=l.x,h[u+1]=l.y,h[u+2]=0,h[u+3]=0,h[u+4]=0,h[u+5]=0,h[u+6]=1,h[u+7]=1,h[u+8]=l.size||1,h[u+9]=l.fixed?1:0,u+=i}),u=0,t.forEachEdge(function(f,l,y,v,U,O,C){var z=s[y],I=s[v],x=n(f,l,y,v,U,O,C);h[z+6]+=x,h[I+6]+=x,a[u]=z,a[u+1]=I,a[u+2]=x,u+=e}),{nodes:h,edges:a}},ne.assignLayoutChanges=function(t,n,r){var o=0;t.updateEachNodeAttributes(function(s,u){return u.x=n[o],u.y=n[o+1],o+=i,r?r(s,u):u})},ne.readGraphPositions=function(t,n){var r=0;t.forEachNode(function(o,s){n[r]=s.x,n[r+1]=s.y,r+=i})},ne.collectLayoutChanges=function(t,n,r){for(var o=t.nodes(),s={},u=0,h=0,a=n.length;u<a;u+=i){if(r){var f=Object.assign({},t.getNodeAttributes(o[h]));f.x=n[u],f.y=n[u+1],f=r(o[h],f),s[o[h]]={x:f.x,y:f.y}}else s[o[h]]={x:n[u],y:n[u+1]};h++}return s},ne.createWorker=function(n){var r=window.URL||window.webkitURL,o=n.toString(),s=r.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),u=new Worker(s);return r.revokeObjectURL(s),u},ne}var Ne,Dt;function Yn(){return Dt||(Dt=1,Ne={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),Ne}var Ye,At;function Vn(){if(At)return Ye;At=1;var i=Bn(),e=qn().createEdgeWeightGetter,t=Hn(),n=Nn(),r=Yn();function o(h,a,f){if(!i(a))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof f=="number"&&(f={iterations:f});var l=f.iterations;if(typeof l!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(l<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var y=e("getEdgeWeight"in f?f.getEdgeWeight:"weight").fromEntry,v=typeof f.outputReducer=="function"?f.outputReducer:null,U=n.assign({},r,f.settings),O=n.validateSettings(U);if(O)throw new Error("graphology-layout-forceatlas2: "+O.message);var C=n.graphToByteArrays(a,y),z;for(z=0;z<l;z++)t(U,C.nodes,C.edges);if(h){n.assignLayoutChanges(a,C.nodes,v);return}return n.collectLayoutChanges(a,C.nodes)}function s(h){var a=typeof h=="number"?h:h.order;return{barnesHutOptimize:a>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(a)}}var u=o.bind(null,!1);return u.assign=o.bind(null,!0),u.inferSettings=s,Ye=u,Ye}var Zn=Vn(),St=Ee(Zn);function Jn(i,e,t){const n=(u,h,a)=>Math.max(h,Math.min(a,u)),r=Math.max(1,i),o=e/r,s=n((t-6)/10,0,1.4);return{iterations:r>650?170:r>350?180:200,gravity:n(1.45+Math.log10(Math.max(10,r))*.48+Math.min(o,8)*.04,1.5,3.2),scalingRatio:n(5+Math.sqrt(r)*.14+s*1.5-Math.min(o,8)*.35,5,13),slowDown:r>650?2.3:2}}function Qn(i){const e=new W({type:"directed",multi:!0,allowSelfLoops:!0});let t=0;for(const r of i.nodes){if(typeof r.id!="string"||![r.x,r.y,r.size].every(Number.isFinite)||r.size<0)throw new Error("Invalid ForceAtlas node");e.addNode(r.id,{x:r.x,y:r.y,size:r.size}),t+=r.size}for(const r of i.edges)e.addDirectedEdgeWithKey(r.id,r.source,r.target);const n=Jn(e.order,e.size,e.order?t/e.order:0);return St.assign(e,{iterations:n.iterations,settings:{...St.inferSettings(e),adjustSizes:!0,barnesHutOptimize:!0,gravity:n.gravity,scalingRatio:n.scalingRatio,slowDown:n.slowDown}}),e.mapNodes((r,{x:o,y:s})=>{if(!Number.isFinite(o)||!Number.isFinite(s))throw new Error("Non-finite ForceAtlas result");return{id:r,x:o,y:s}})}self.onmessage=i=>{try{self.postMessage({ok:!0,positions:Qn(i.data)})}catch(e){self.postMessage({ok:!1,error:e instanceof Error?e.message:String(e)})}}})();
|
package/package.json
CHANGED