1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{96834:function(e,t,i){let r;i.d(t,{UE:function(){return R},ZP:function(){return Z}});var n=i(89558);let o=function(){let e=arguments[0];for(let t=1,i=arguments.length;t<i;t++)if(arguments[t])for(let i in arguments[t])e[i]=arguments[t][i];return e};function d(e,t,i,r){let n=e._nodes.get(t),o=null;return n?o="mixed"===r?n.out&&n.out[i]||n.undirected&&n.undirected[i]:"directed"===r?n.out&&n.out[i]:n.undirected&&n.undirected[i]:o}function s(e){return"object"==typeof e&&null!==e}function a(e){let t;for(t in e)return!1;return!0}function h(e,t,i){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:i})}function u(e,t,i){let r={enumerable:!0,configurable:!0};"function"==typeof i?r.get=i:(r.value=i,r.writable=!1),Object.defineProperty(e,t,r)}function c(e){return!!(s(e)&&(!e.attributes||Array.isArray(e.attributes)))}function p(){let e=arguments,t=null,i=-1;return{[Symbol.iterator](){return this},next(){let r=null;for(;;){if(null===t){if(++i>=e.length)return{done:!0};t=e[i][Symbol.iterator]()}if((r=t.next()).done){t=null;continue}break}return r}}}function l(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(o=Object.assign);class g extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class f extends g{constructor(e){super(e),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,f.prototype.constructor)}}class y extends g{constructor(e){super(e),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.constructor)}}class w extends g{constructor(e){super(e),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,w.prototype.constructor)}}function b(e,t){this.key=e,this.attributes=t,this.clear()}function m(e,t){this.key=e,this.attributes=t,this.clear()}function $(e,t){this.key=e,this.attributes=t,this.clear()}function k(e,t,i,r,n){this.key=t,this.attributes=n,this.undirected=e,this.source=i,this.target=r}function G(e,t,i,r,n,o,d){let s,a,h,u;if(r=""+r,0===i){if(!(s=e._nodes.get(r)))throw new y(`Graph.${t}: could not find the "${r}" node in the graph.`);h=n,u=o}else if(3===i){if(n=""+n,!(a=e._edges.get(n)))throw new y(`Graph.${t}: could not find the "${n}" edge in the graph.`);let i=a.source.key,c=a.target.key;if(r===i)s=a.target;else if(r===c)s=a.source;else throw new y(`Graph.${t}: the "${r}" node is not attached to the "${n}" edge (${i}, ${c}).`);h=o,u=d}else{if(!(a=e._edges.get(r)))throw new y(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=1===i?a.source:a.target,h=n,u=o}return[s,h,u]}b.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},m.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},$.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},k.prototype.attach=function(){let e="out",t="in";this.undirected&&(e=t="undirected");let i=this.source.key,r=this.target.key;this.source[e][r]=this,this.undirected&&i===r||(this.target[t][i]=this)},k.prototype.attachMulti=function(){let e="out",t="in",i=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");let n=this.source[e],o=n[r];if(void 0===o){n[r]=this,this.undirected&&i===r||(this.target[t][i]=this);return}o.previous=this,this.next=o,n[r]=this,this.target[t][i]=this},k.prototype.detach=function(){let e=this.source.key,t=this.target.key,i="out",r="in";this.undirected&&(i=r="undirected"),delete this.source[i][t],delete this.target[r][e]},k.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,i="out",r="in";this.undirected&&(i=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[i][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[i][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};let _=[{name:e=>`get${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[o,d]=G(this,t,i,e,r,n);return o.attributes[d]}}},{name:e=>`get${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let[n]=G(this,t,i,e,r);return n.attributes}}},{name:e=>`has${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[o,d]=G(this,t,i,e,r,n);return o.attributes.hasOwnProperty(d)}}},{name:e=>`set${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n,o){let[d,s,a]=G(this,t,i,e,r,n,o);
1return d.attributes[s]=a,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:s}),this}}},{name:e=>`update${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n,o){let[d,s,a]=G(this,t,i,e,r,n,o);if("function"!=typeof a)throw new f(`Graph.${t}: updater should be a function.`);let h=d.attributes,u=a(h[s]);return h[s]=u,this.emit("nodeAttributesUpdated",{key:d.key,type:"set",attributes:d.attributes,name:s}),this}}},{name:e=>`remove${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[o,d]=G(this,t,i,e,r,n);return delete o.attributes[d],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:d}),this}}},{name:e=>`replace${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[o,d]=G(this,t,i,e,r,n);if(!s(d))throw new f(`Graph.${t}: provided attributes are not a plain object.`);return o.attributes=d,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:e=>`merge${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[d,a]=G(this,t,i,e,r,n);if(!s(a))throw new f(`Graph.${t}: provided attributes are not a plain object.`);return o(d.attributes,a),this.emit("nodeAttributesUpdated",{key:d.key,type:"merge",attributes:d.attributes,data:a}),this}}},{name:e=>`update${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let[o,d]=G(this,t,i,e,r,n);if("function"!=typeof d)throw new f(`Graph.${t}: provided updater is not a function.`);return o.attributes=d(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],v=[{name:e=>`get${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return n.attributes[r]}}},{name:e=>`get${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e){let r;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new w(`Graph.${t}: 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.`);let n=""+e,o=""+arguments[1];if(!(r=d(this,n,o,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${n}" - "${o}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(r=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}},{name:e=>`has${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return n.attributes.hasOwnProperty(r)}}},{name:e=>`set${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let o;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: 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.`);let s=""+e,a=""+r;if(r=arguments[2],n=arguments[3],!(o=d(this,s,a,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(o=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}
1return o.attributes[r]=n,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:e=>`update${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r,n){let o;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new w(`Graph.${t}: 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.`);let s=""+e,a=""+r;if(r=arguments[2],n=arguments[3],!(o=d(this,s,a,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(o=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if("function"!=typeof n)throw new f(`Graph.${t}: updater should be a function.`);return o.attributes[r]=n(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}},{name:e=>`remove${e}Attribute`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete n.attributes[r],this.emit("edgeAttributesUpdated",{key:n.key,type:"remove",attributes:n.attributes,name:r}),this}}},{name:e=>`replace${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!s(r))throw new f(`Graph.${t}: provided attributes are not a plain object.`);return n.attributes=r,this.emit("edgeAttributesUpdated",{key:n.key,type:"replace",attributes:n.attributes}),this}}},{name:e=>`merge${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!s(r))throw new f(`Graph.${t}: provided attributes are not a plain object.`);
1return o(n.attributes,r),this.emit("edgeAttributesUpdated",{key:n.key,type:"merge",attributes:n.attributes,data:r}),this}}},{name:e=>`update${e}Attributes`,attacher:function(e,t,i){e.prototype[t]=function(e,r){let n;if("mixed"!==this.type&&"mixed"!==i&&i!==this.type)throw new w(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new w(`Graph.${t}: 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.`);let o=""+e,s=""+r;if(r=arguments[2],!(n=d(this,o,s,i)))throw new y(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if("mixed"!==i)throw new w(`Graph.${t}: 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(e=""+e,!(n=this._edges.get(e)))throw new y(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if("function"!=typeof r)throw new f(`Graph.${t}: provided updater is not a function.`);return n.attributes=r(n.attributes),this.emit("edgeAttributesUpdated",{key:n.key,type:"update",attributes:n.attributes}),this}}}];function x(e,t,i,r){let n=!1;for(let o in t){if(o===r)continue;let d=t[o];if(n=i(d.key,d.attributes,d.source.key,d.target.key,d.source.attributes,d.target.attributes,d.undirected),e&&n)return d.key}}function E(e,t,i,r){let n,o,d;let s=!1;for(let a in t)if(a!==r){n=t[a];do{if(o=n.source,d=n.target,s=i(n.key,n.attributes,o.key,d.key,o.attributes,d.attributes,n.undirected),e&&s)return n.key;n=n.next}while(void 0!==n)}}function A(e,t){let i;let r=Object.keys(e),n=r.length,o=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(o>=n)return{done:!0};let d=r[o++];if(d===t){i=void 0;continue}i=e[d]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function D(e,t,i,r){let n=t[i];if(!n)return;let o=n.source,d=n.target;if(r(n.key,n.attributes,o.key,d.key,o.attributes,d.attributes,n.undirected)&&e)return n.key}function S(e,t,i,r){let n=t[i];if(!n)return;let o=!1;do{if(o=r(n.key,n.attributes,n.source.key,n.target.key,n.source.attributes,n.target.attributes,n.undirected),e&&o)return n.key;n=n.next}while(void 0!==n)}function U(e,t){let i=e[t];if(void 0!==i.next)return{[Symbol.iterator](){return this},next(){if(!i)return{done:!0};let e={edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected};return i=i.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next:()=>!0===r?{done:!0}:(r=!0,{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}})}}function L(e,t,i,r){let n,o;if(0===t.size)return;let d="mixed"!==i&&i!==t.type,s="undirected"===i,a=!1,h=t._edges.values();for(;!0!==(n=h.next()).done;){if(o=n.value,d&&o.undirected!==s)continue;let{key:t,attributes:i,source:h,target:u}=o;if(a=r(t,i,h.key,u.key,h.attributes,u.attributes,o.undirected),e&&a)return t}}function N(e,t,i,r,n,o){let d;let s=t?E:x;if("undirected"!==i&&("out"!==r&&(d=s(e,n.in,o),e&&d)||"in"!==r&&(d=s(e,n.out,o,r?void 0:n.key),e&&d))||"directed"!==i&&(d=s(e,n.undirected,o),e&&d))return d}function C(e,t,i,r,n,o,d){let s;let a=i?S:D;if("undirected"!==t&&(void 0!==n.in&&"out"!==r&&(s=a(e,n.in,o,d),e&&s)||void 0!==n.out&&"in"!==r&&(r||n.key!==o)&&(s=a(e,n.out,o,d),e&&s))||"directed"!==t&&void 0!==n.undirected&&(s=a(e,n.undirected,o,d),e&&s))return s}function j(){this.A=null,this.B=null}function z(e,t,i,r,n){for(let o in r){let d=r[o],s=d.source,a=d.target,h=s===i?a:s;if(t&&t.has(h.key))continue;let u=n(h.key,h.attributes);if(e&&u)return h.key}}function W(e,t,i,r,n){let o;if("mixed"!==t){if("undirected"===t)return z(e,null,r,r.undirected,n);if("string"==typeof i)return z(e,null,r,r[i],n)}let d=new j;
1if("undirected"!==t){if("out"!==i){if(o=z(e,null,r,r.in,n),e&&o)return o;d.wrap(r.in)}if("in"!==i){if(o=z(e,d,r,r.out,n),e&&o)return o;d.wrap(r.out)}}if("directed"!==t&&(o=z(e,d,r,r.undirected,n),e&&o))return o}function M(e,t,i){let r=Object.keys(i),n=r.length,o=0;return{[Symbol.iterator](){return this},next(){let d=null;do{if(o>=n)return e&&e.wrap(i),{done:!0};let s=i[r[o++]],a=s.source,h=s.target;if(d=a===t?h:a,e&&e.has(d.key)){d=null;continue}}while(null===d);return{done:!1,value:{neighbor:d.key,attributes:d.attributes}}}}}function O(e,t,i,r,n){let o,d,s,a,h,u,c;let p=r._nodes.values(),l=r.type;for(;!0!==(o=p.next()).done;){let r=!1;if(d=o.value,"undirected"!==l)for(s in a=d.out){h=a[s];do{if(u=h.target,r=!0,c=n(d.key,u.key,d.attributes,u.attributes,h.key,h.attributes,h.undirected),e&&c)return h;h=h.next}while(h)}if("directed"!==l){for(s in a=d.undirected)if(!t||!(d.key>s)){h=a[s];do{if((u=h.target).key!==s&&(u=h.source),r=!0,c=n(d.key,u.key,d.attributes,u.attributes,h.key,h.attributes,h.undirected),e&&c)return h;h=h.next}while(h)}}if(i&&!r&&(c=n(d.key,null,d.attributes,null,null,null,null),e&&c))return null}}j.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},j.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};let K=(r=255&Math.floor(256*Math.random()),()=>r++),P=new Set(["directed","undirected","mixed"]),I=new Set(["domain","_events","_eventsCount","_maxListeners"]),T={allowSelfLoops:!0,multi:!1,type:"mixed"};function Y(e,t,i){let r=new e.NodeDataClass(t,i);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:i}),r}function B(e,t,i,r,n,o,d,a){if(!r&&"undirected"===e.type)throw new w(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===e.type)throw new w(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!s(a))throw new f(`Graph.${t}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,d=""+d,a=a||{},!e.allowSelfLoops&&o===d)throw new w(`Graph.${t}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let h=e._nodes.get(o),u=e._nodes.get(d);if(!h)throw new y(`Graph.${t}: source node "${o}" not found.`);if(!u)throw new y(`Graph.${t}: target node "${d}" not found.`);let c={key:null,undirected:r,source:o,target:d,attributes:a};if(i)n=e._edgeKeyGenerator();else if(n=""+n,e._edges.has(n))throw new w(`Graph.${t}: the "${n}" edge already exists in the graph.`);if(!e.multi&&(r?void 0!==h.undirected[d]:void 0!==h.out[d]))throw new w(`Graph.${t}: an edge linking "${o}" to "${d}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let p=new k(r,n,h,u,a);e._edges.set(n,p);let l=o===d;return r?(h.undirectedDegree++,u.undirectedDegree++,l&&(h.undirectedLoops++,e._undirectedSelfLoopCount++)):(h.outDegree++,u.inDegree++,l&&(h.directedLoops++,e._directedSelfLoopCount++)),e.multi?p.attachMulti():p.attach(),r?e._undirectedSize++:e._directedSize++,c.key=n,e.emit("edgeAdded",c),n}function F(e,t,i,r,n,d,a,h,u){let c,p,l;if(!r&&"undirected"===e.type)throw new w(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&"directed"===e.type)throw new w(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(h){if(u){if("function"!=typeof h)throw new f(`Graph.${t}: invalid updater function. Expecting a function but got "${h}"`)}else if(!s(h))throw new f(`Graph.${t}: invalid attributes. Expecting an object but got "${h}"`)}if(d=""+d,a=""+a,u&&(c=h,h=void 0),!e.allowSelfLoops&&d===a)throw new w(`Graph.${t}: source & target are the same ("${d}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let g=e._nodes.get(d),y=e._nodes.get(a);if(!i&&(p=e._edges.get(n))){if((p.source.key!==d||p.target.key!==a)&&(!r||p.source.key!==a||p.target.key!==d))throw new w(`Graph.${t}: inconsistency detected when attempting to merge the "${n}" edge with "${d}" source & "${a}" target vs. ("${p.source.key}", "${p.target.key}").`);l=p}if(l||e.multi||!g||(l=r?g.undirected[a]:g.out[a]),l){let t=[l.key,!1,!1,
1!1];if(u?!c:!h)return t;if(u){let t=l.attributes;l.attributes=c(t),e.emit("edgeAttributesUpdated",{type:"replace",key:l.key,attributes:l.attributes})}else o(l.attributes,h),e.emit("edgeAttributesUpdated",{type:"merge",key:l.key,attributes:l.attributes,data:h});return t}h=h||{},u&&c&&(h=c(h));let b={key:null,undirected:r,source:d,target:a,attributes:h};if(i)n=e._edgeKeyGenerator();else if(n=""+n,e._edges.has(n))throw new w(`Graph.${t}: the "${n}" edge already exists in the graph.`);let m=!1,$=!1;g||(g=Y(e,d,{}),m=!0,d!==a||(y=g,$=!0)),y||(y=Y(e,a,{}),$=!0),p=new k(r,n,g,y,h),e._edges.set(n,p);let G=d===a;return r?(g.undirectedDegree++,y.undirectedDegree++,G&&(g.undirectedLoops++,e._undirectedSelfLoopCount++)):(g.outDegree++,y.inDegree++,G&&(g.directedLoops++,e._directedSelfLoopCount++)),e.multi?p.attachMulti():p.attach(),r?e._undirectedSize++:e._directedSize++,b.key=n,e.emit("edgeAdded",b),[n,!0,m,$]}function J(e,t){e._edges.delete(t.key);let{source:i,target:r,attributes:n}=t,o=t.undirected,d=i===r;o?(i.undirectedDegree--,r.undirectedDegree--,d&&(i.undirectedLoops--,e._undirectedSelfLoopCount--)):(i.outDegree--,r.inDegree--,d&&(i.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),o?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:n,source:i.key,target:r.key,undirected:o})}class Z extends n.EventEmitter{constructor(e){if(super(),"boolean"!=typeof(e=o({},T,e)).multi)throw new f(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!P.has(e.type))throw new f(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if("boolean"!=typeof e.allowSelfLoops)throw new f(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);h(this,"NodeDataClass","mixed"===e.type?b:"directed"===e.type?m:$);let t="geid_"+K()+"_",i=0;h(this,"_attributes",{}),h(this,"_nodes",new Map),h(this,"_edges",new Map),h(this,"_directedSize",0),h(this,"_undirectedSize",0),h(this,"_directedSelfLoopCount",0),h(this,"_undirectedSelfLoopCount",0),h(this,"_edgeKeyGenerator",()=>{let e;do e=t+i++;while(this._edges.has(e));return e}),h(this,"_options",e),I.forEach(e=>h(this,e,this[e])),u(this,"order",()=>this._nodes.size),u(this,"size",()=>this._edges.size),u(this,"directedSize",()=>this._directedSize),u(this,"undirectedSize",()=>this._undirectedSize),u(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),u(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),u(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),u(this,"multi",this._options.multi),u(this,"type",this._options.type),u(this,"allowSelfLoops",this._options.allowSelfLoops),u(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("undirected"===this.type)return!1;if(1==arguments.length){let t=""+e,i=this._edges.get(t);return!!i&&!i.undirected}if(2==arguments.length){e=""+e,t=""+t;let i=this._nodes.get(e);return!!i&&i.out.hasOwnProperty(t)}throw new f(`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("directed"===this.type)return!1;if(1==arguments.length){let t=""+e,i=this._edges.get(t);return!!i&&i.undirected}if(2==arguments.length){e=""+e,t=""+t;let i=this._nodes.get(e);return!!i&&i.undirected.hasOwnProperty(t)}throw new f(`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(1==arguments.length){let t=""+e;return this._edges.has(t)}if(2==arguments.length){e=""+e,t=""+t;let i=this._nodes.get(e);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(t)||void 0!==i.undirected&&i.undirected.hasOwnProperty(t))}throw new f(`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("undirected"===this.type)return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");let i=this._nodes.get(e);if(!i)throw new y(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=i.out&&i.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if("directed"===this.type)return;if(e=""+e,t=""+t,this.multi)throw new w("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");let i=this._nodes.get(e);if(!i)throw new y(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=i.undirected&&i.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new w("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&(t in i.in||t in i.out)}areOutNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return"directed"!==this.type&&t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&(t in i.in||t in i.out)||"directed"!==this.type&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in i.in||"directed"!==this.type&&t in i.undirected}
1areOutboundNeighbors(e,t){e=""+e,t=""+t;let i=this._nodes.get(e);if(!i)throw new y(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in i.out||"directed"!==this.type&&t in i.undirected}inDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.inDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree}outDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.outDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.outDegree}directedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return"directed"===this.type?0:t.undirectedDegree}inboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return"directed"!==this.type&&(i+=t.undirectedDegree),"undirected"!==this.type&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return"directed"!==this.type&&(i+=t.undirectedDegree),"undirected"!==this.type&&(i+=t.outDegree),i}degree(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return"directed"!==this.type&&(i+=t.undirectedDegree),"undirected"!==this.type&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops}undirectedDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops}inboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return"directed"!==this.type&&(i+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(i+=t.inDegree,r+=t.directedLoops),i-r}outboundDegreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return"directed"!==this.type&&(i+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(i+=t.outDegree,r+=t.directedLoops),i-r}degreeWithoutSelfLoops(e){e=""+e;let t=this._nodes.get(e);if(!t)throw new y(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return"directed"!==this.type&&(i+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(i+=t.inDegree+t.outDegree,r+=2*t.directedLoops),i-r}source(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`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;let i=this._edges.get(t);if(!i)throw new y(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=i.source.key,n=i.target.key;if(e===r)return n;if(e===n)return r;throw new y(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${n}).`)}hasExtremity(e,t){e=""+e,t=""+t;let i=this._edges.get(e);if(!i)throw new y(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;let t=this._edges.get(e);if(!t)throw new y(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return function(e,t,i){if(i&&!s(i))throw new f(`Graph.addNode: invalid attributes. Expecting an object but got "${i}"`);if(t=""+t,i=i||{},e._nodes.has(t))throw new w(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,i);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:i}),r}(this,e,t).key}mergeNode(e,t){if(t&&!s(t))throw new f(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);
1return i?(t&&(o(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&"function"!=typeof t)throw new f(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){let r=i.attributes;i.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}let r=t?t({}):{};return i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){let t;e=""+e;let i=this._nodes.get(e);if(!i)throw new y(`Graph.dropNode: could not find the "${e}" node in the graph.`);if("undirected"!==this.type){for(let e in i.out){t=i.out[e];do J(this,t),t=t.next;while(t)}for(let e in i.in){t=i.in[e];do J(this,t),t=t.next;while(t)}}if("directed"!==this.type)for(let e in i.undirected){t=i.undirected[e];do J(this,t),t=t.next;while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:i.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=""+arguments[0],i=""+arguments[1];if(!(t=d(this,e,i,this.type)))throw new y(`Graph.dropEdge: could not find the "${e}" -> "${i}" edge in the graph.`)}else if(e=""+e,!(t=this._edges.get(e)))throw new y(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return J(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new w("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 w("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.");let i=d(this,e=""+e,t=""+t,"directed");if(!i)throw new y(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return J(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new w("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 w("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.");let i=d(this,e,t,"undirected");if(!i)throw new y(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return J(this,i),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){let e;let t=this._nodes.values();for(;!0!==(e=t.next()).done;)e.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("function"!=typeof t)throw new f("Graph.updateAttribute: updater should be a function.");let i=this._attributes[e];return this._attributes[e]=t(i),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(!s(e))throw new f("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(!s(e))throw new f("Graph.mergeAttributes: provided attributes are not a plain object.");return o(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if("function"!=typeof e)throw new f("Graph.updateAttributes: provided updater is not a function.");
1return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){let i,r;if("function"!=typeof e)throw new f("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!c(t))throw new f("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let n=this._nodes.values();for(;!0!==(i=n.next()).done;)(r=i.value).attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){let i,r,n,o;if("function"!=typeof e)throw new f("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!c(t))throw new f("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");let d=this._edges.values();for(;!0!==(i=d.next()).done;)n=(r=i.value).source,o=r.target,r.attributes=e(r.key,r.attributes,n.key,o.key,n.attributes,o.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if("function"!=typeof e)throw new f("Graph.forEachAdjacencyEntry: expecting a callback.");O(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if("function"!=typeof e)throw new f("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");O(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if("function"!=typeof e)throw new f("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");O(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if("function"!=typeof e)throw new f("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");O(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){let t,i;if("function"!=typeof e)throw new f("Graph.forEachNode: expecting a callback.");let r=this._nodes.values();for(;!0!==(t=r.next()).done;)e((i=t.value).key,i.attributes)}findNode(e){let t,i;if("function"!=typeof e)throw new f("Graph.findNode: expecting a callback.");let r=this._nodes.values();for(;!0!==(t=r.next()).done;)if(e((i=t.value).key,i.attributes))return i.key}mapNodes(e){let t,i;if("function"!=typeof e)throw new f("Graph.mapNode: expecting a callback.");let r=this._nodes.values(),n=Array(this.order),o=0;for(;!0!==(t=r.next()).done;)i=t.value,n[o++]=e(i.key,i.attributes);return n}someNode(e){let t,i;if("function"!=typeof e)throw new f("Graph.someNode: expecting a callback.");let r=this._nodes.values();for(;!0!==(t=r.next()).done;)if(e((i=t.value).key,i.attributes))return!0;return!1}everyNode(e){let t,i;if("function"!=typeof e)throw new f("Graph.everyNode: expecting a callback.");let r=this._nodes.values();for(;!0!==(t=r.next()).done;)if(!e((i=t.value).key,i.attributes))return!1;return!0}filterNodes(e){let t,i;if("function"!=typeof e)throw new f("Graph.filterNodes: expecting a callback.");let r=this._nodes.values(),n=[];for(;!0!==(t=r.next()).done;)e((i=t.value).key,i.attributes)&&n.push(i.key);return n}reduceNodes(e,t){let i,r;if("function"!=typeof e)throw new f("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new f("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,o=this._nodes.values();for(;!0!==(i=o.next()).done;)n=e(n,(r=i.value).key,r.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((i,r)=>{e[t++]=function(e,t){let i={key:e};return a(t.attributes)||(i.attributes=o({},t.attributes)),i}(r,i)});let i=Array(this._edges.size);
1return t=0,this._edges.forEach((e,r)=>{i[t++]=function(e,t,i){let r={key:t,source:i.source.key,target:i.target.key};return a(i.attributes)||(r.attributes=o({},i.attributes)),"mixed"===e&&i.undirected&&(r.undirected=!0),r}(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){let i,r,n,o,d;if(e instanceof Z)return e.forEachNode((e,i)=>{t?this.mergeNode(e,i):this.addNode(e,i)}),e.forEachEdge((e,i,r,n,o,d,s)=>{t?s?this.mergeUndirectedEdgeWithKey(e,r,n,i):this.mergeDirectedEdgeWithKey(e,r,n,i):s?this.addUndirectedEdgeWithKey(e,r,n,i):this.addDirectedEdgeWithKey(e,r,n,i)}),this;if(!s(e))throw new f("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!s(e.attributes))throw new f("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(!Array.isArray(n=e.nodes))throw new f("Graph.import: invalid nodes. Expecting an array.");for(i=0,r=n.length;i<r;i++){!function(e){if(!s(e))throw new f('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new f("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!s(e.attributes)||null===e.attributes))throw new f("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}(o=n[i]);let{key:e,attributes:r}=o;t?this.mergeNode(e,r):this.addNode(e,r)}}if(e.edges){let o=!1;if("undirected"===this.type&&(o=!0),!Array.isArray(n=e.edges))throw new f("Graph.import: invalid edges. Expecting an array.");for(i=0,r=n.length;i<r;i++){!function(e){if(!s(e))throw new f('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new f("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new f("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!s(e.attributes)||null===e.attributes))throw new f("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new f("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}(d=n[i]);let{source:e,target:r,attributes:a,undirected:h=o}=d;"key"in d?(t?h?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:h?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,d.key,e,r,a):(t?h?this.mergeUndirectedEdge:this.mergeDirectedEdge:h?this.addUndirectedEdge:this.addDirectedEdge).call(this,e,r,a)}}return this}nullCopy(e){let t=new Z(o({},this._options,e));return t.replaceAttributes(o({},this.getAttributes())),t}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,i)=>{let r=o({},e.attributes);e=new t.NodeDataClass(i,r),t._nodes.set(i,e)}),t}copy(e){let t,i;if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new w(`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("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new w("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("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new w("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.");let r=this.emptyCopy(e),n=this._edges.values();for(;!0!==(t=n.next()).done;)B(r,"copy",!1,(i=t.value).undirected,i.key,i.source.key,i.target.key,o({},i.attributes));return r}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){let e={};this._nodes.forEach((t,i)=>{e[i]=t.attributes});let t={},i={};
1this._edges.forEach((e,r)=>{let n;let o=e.undirected?"--":"->",d="",s=e.source.key,a=e.target.key;e.undirected&&s>a&&(n=s,s=a,a=n);let h=`(${s})${o}(${a})`;r.startsWith("geid_")?this.multi&&(void 0===i[h]?i[h]=0:i[h]++,d+=`${i[h]}. `):d+=`[${r}]: `,t[d+=h]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!I.has(e)&&"function"!=typeof this[e]&&"symbol"!=typeof e&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,h(r,"constructor",this.constructor),r}}"undefined"!=typeof Symbol&&(Z.prototype[Symbol.for("nodejs.util.inspect.custom")]=Z.prototype.inspect),[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:"directed"},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:"directed"},{name:e=>`${e}UndirectedEdgeWithKey`,type:"undirected"}].forEach(e=>{["add","merge","update"].forEach(t=>{let i=e.name(t),r="add"===t?B:F;e.generateKey?Z.prototype[i]=function(n,o,d){return r(this,i,!0,"undirected"===(e.type||this.type),null,n,o,d,"update"===t)}:Z.prototype[i]=function(n,o,d,s){return r(this,i,!1,"undirected"===(e.type||this.type),n,o,d,s,"update"===t)}})}),_.forEach(function({name:e,attacher:t}){t(Z,e("Node"),0),t(Z,e("Source"),1),t(Z,e("Target"),2),t(Z,e("Opposite"),3)}),v.forEach(function({name:e,attacher:t}){t(Z,e("Edge"),"mixed"),t(Z,e("DirectedEdge"),"directed"),t(Z,e("UndirectedEdge"),"undirected")}),[{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"}].forEach(e=>{(function(e,t){let{name:i,type:r,direction:n}=t;e.prototype[i]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(e,t){let i,r;if(0===e.size)return[];if("mixed"===t||t===e.type)return Array.from(e._edges.keys());let n=Array("undirected"===t?e.undirectedSize:e.directedSize),o="undirected"===t,d=e._edges.values(),s=0;for(;!0!==(i=d.next()).done;)(r=i.value).undirected===o&&(n[s++]=r.key);return n}(this,r);if(1==arguments.length){e=""+e;let t=this._nodes.get(e);if(void 0===t)throw new y(`Graph.${i}: could not find the "${e}" node in the graph.`);return function(e,t,i,r){let n=[];return N(!1,e,t,i,r,function(e){n.push(e)}),n}(this.multi,"mixed"===r?this.type:r,n,t)}if(2==arguments.length){e=""+e,t=""+t;let o=this._nodes.get(e);if(!o)throw new y(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${i}: could not find the "${t}" target node in the graph.`);return function(e,t,i,r,n){let o=[];return C(!1,e,t,i,r,n,function(e){o.push(e)}),o}(r,this.multi,n,o,t)}throw new f(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}})(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o="forEach"+i[0].toUpperCase()+i.slice(1,-1);e.prototype[o]=function(e,t,i){if("mixed"===r||"mixed"===this.type||r===this.type){if(1==arguments.length)return L(!1,this,r,i=e);if(2==arguments.length){e=""+e,i=t;let d=this._nodes.get(e);if(void 0===d)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);return N(!1,this.multi,"mixed"===r?this.type:r,n,d,i)}if(3==arguments.length){e=""+e,t=""+t;let d=this._nodes.get(e);if(!d)throw new y(`Graph.${o}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${o}: could not find the "${t}" target node in the graph.`);return C(!1,r,this.multi,n,d,t,i)}throw new f(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let d="map"+i[0].toUpperCase()+i.slice(1);e.prototype[d]=function(){let e;let t=Array.prototype.slice.call(arguments),i=t.pop();if(0===t.length){let n=0;"directed"!==r&&(n+=this.undirectedSize),"undirected"!==r&&(n+=this.directedSize),e=Array(n);let o=0;t.push((t,r,n,d,s,a,h)=>{e[o++]=i(t,r,n,d,s,a,h)})}
1else e=[],t.push((t,r,n,o,d,s,a)=>{e.push(i(t,r,n,o,d,s,a))});return this[o].apply(this,t),e};let s="filter"+i[0].toUpperCase()+i.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),i=[];return e.push((e,r,n,o,d,s,a)=>{t(e,r,n,o,d,s,a)&&i.push(e)}),this[o].apply(this,e),i};let a="reduce"+i[0].toUpperCase()+i.slice(1);e.prototype[a]=function(){let e,t,i=Array.prototype.slice.call(arguments);if(i.length<2||i.length>4)throw new f(`Graph.${a}: invalid number of arguments (expecting 2, 3 or 4 and got ${i.length}).`);if("function"==typeof i[i.length-1]&&"function"!=typeof i[i.length-2])throw new f(`Graph.${a}: 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.`);2===i.length?(e=i[0],t=i[1],i=[]):3===i.length?(e=i[1],t=i[2],i=[i[0]]):4===i.length&&(e=i[2],t=i[3],i=[i[0],i[1]]);let r=t;return i.push((t,i,n,o,d,s,a)=>{r=e(r,t,i,n,o,d,s,a)}),this[o].apply(this,i),r}}(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o="find"+i[0].toUpperCase()+i.slice(1,-1);e.prototype[o]=function(e,t,i){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1==arguments.length)return L(!0,this,r,i=e);if(2==arguments.length){e=""+e,i=t;let d=this._nodes.get(e);if(void 0===d)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);return N(!0,this.multi,"mixed"===r?this.type:r,n,d,i)}if(3==arguments.length){e=""+e,t=""+t;let d=this._nodes.get(e);if(!d)throw new y(`Graph.${o}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${o}: could not find the "${t}" target node in the graph.`);return C(!0,r,this.multi,n,d,t,i)}throw new f(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let d="some"+i[0].toUpperCase()+i.slice(1,-1);e.prototype[d]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,i,r,n,o,d,s)=>t(e,i,r,n,o,d,s)),!!this[o].apply(this,e)};let s="every"+i[0].toUpperCase()+i.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,i,r,n,o,d,s)=>!t(e,i,r,n,o,d,s)),!this[o].apply(this,e)}}(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o=i.slice(0,-1)+"Entries";e.prototype[o]=function(e,t){var i;if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return l();if(!arguments.length)return function(e,t){if(0===e.size)return l();let i="mixed"!==t&&t!==e.type,r="undirected"===t,n=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if((e=n.next()).done)return e;if(t=e.value,!i||t.undirected===r)break}return{value:{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},done:!1}}}}(this,r);if(1==arguments.length){let t;e=""+e;let i=this._nodes.get(e);if(!i)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);return t=l(),"undirected"!==r&&("out"!==n&&void 0!==i.in&&(t=p(t,A(i.in))),"in"!==n&&void 0!==i.out&&(t=p(t,A(i.out,n?void 0:i.key)))),"directed"!==r&&void 0!==i.undirected&&(t=p(t,A(i.undirected))),t}if(2==arguments.length){let d;e=""+e,t=""+t;let s=this._nodes.get(e);if(!s)throw new y(`Graph.${o}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new y(`Graph.${o}: could not find the "${t}" target node in the graph.`);return i=t,d=l(),"undirected"!==r&&(void 0!==s.in&&"out"!==n&&i in s.in&&(d=p(d,U(s.in,i))),void 0!==s.out&&"in"!==n&&i in s.out&&(n||s.key!==i)&&(d=p(d,U(s.out,i)))),"directed"!==r&&void 0!==s.undirected&&i in s.undirected&&(d=p(d,U(s.undirected,i))),d}throw new f(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}(Z,e)}),[{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"}
1].forEach(e=>{(function(e,t){let{name:i,type:r,direction:n}=t;e.prototype[i]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];e=""+e;let t=this._nodes.get(e);if(void 0===t)throw new y(`Graph.${i}: could not find the "${e}" node in the graph.`);return function(e,t,i){if("mixed"!==e){if("undirected"===e)return Object.keys(i.undirected);if("string"==typeof t)return Object.keys(i[t])}let r=[];return W(!1,e,t,i,function(e){r.push(e)}),r}("mixed"===r?this.type:r,n,t)}})(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o="forEach"+i[0].toUpperCase()+i.slice(1,-1);e.prototype[o]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;e=""+e;let i=this._nodes.get(e);if(void 0===i)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);W(!1,"mixed"===r?this.type:r,n,i,t)};let d="map"+i[0].toUpperCase()+i.slice(1);e.prototype[d]=function(e,t){let i=[];return this[o](e,(e,r)=>{i.push(t(e,r))}),i};let s="filter"+i[0].toUpperCase()+i.slice(1);e.prototype[s]=function(e,t){let i=[];return this[o](e,(e,r)=>{t(e,r)&&i.push(e)}),i};let a="reduce"+i[0].toUpperCase()+i.slice(1);e.prototype[a]=function(e,t,i){if(arguments.length<3)throw new f(`Graph.${a}: 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 r=i;return this[o](e,(e,i)=>{r=t(r,e,i)}),r}}(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o=i[0].toUpperCase()+i.slice(1,-1),d="find"+o;e.prototype[d]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return;e=""+e;let i=this._nodes.get(e);if(void 0===i)throw new y(`Graph.${d}: could not find the "${e}" node in the graph.`);return W(!0,"mixed"===r?this.type:r,n,i,t)},e.prototype["some"+o]=function(e,t){return!!this[d](e,t)},e.prototype["every"+o]=function(e,t){return!this[d](e,(e,i)=>!t(e,i))}}(Z,e),function(e,t){let{name:i,type:r,direction:n}=t,o=i.slice(0,-1)+"Entries";e.prototype[o]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return l();e=""+e;let t=this._nodes.get(e);if(void 0===t)throw new y(`Graph.${o}: could not find the "${e}" node in the graph.`);return function(e,t,i){if("mixed"!==e){if("undirected"===e)return M(null,i,i.undirected);if("string"==typeof t)return M(null,i,i[t])}let r=l(),n=new j;return"undirected"!==e&&("out"!==t&&(r=p(r,M(n,i,i.in))),"in"!==t&&(r=p(r,M(n,i,i.out)))),"directed"!==e&&(r=p(r,M(n,i,i.undirected))),r}("mixed"===r?this.type:r,n,t)}}(Z,e)});class q extends Z{constructor(e){let t=o({type:"directed"},e);if("multi"in t&&!1!==t.multi)throw new f("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==t.type)throw new f('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class H extends Z{constructor(e){let t=o({type:"undirected"},e);if("multi"in t&&!1!==t.multi)throw new f("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==t.type)throw new f('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Q extends Z{constructor(e){let t=o({multi:!0},e);if("multi"in t&&!0!==t.multi)throw new f("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class R extends Z{constructor(e){let t=o({type:"directed",multi:!0},e);if("multi"in t&&!0!==t.multi)throw new f("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==t.type)throw new f('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class V extends Z{constructor(e){let t=o({type:"undirected",multi:!0},e);if("multi"in t&&!0!==t.multi)throw new f("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==t.type)throw new f('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function X(e){e.from=function(t,i){let r=new e(o({},t.options,i));return r.import(t),r}}X(Z),X(q),X(H),X(Q),X(R),X(V),Z.Graph=Z,Z.DirectedGraph=q,Z.UndirectedGraph=H,Z.MultiGraph=Q,Z.MultiDirectedGraph=R,Z.MultiUndirectedGraph=V,Z.InvalidArgumentsGraphError=f,Z.NotFoundGra
1phError=y,Z.UsageGraphError=w}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.