iwmlib/pixi/lib/graphology.min.js
2019-03-21 09:57:27 +01:00

1 line
59 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.graphology=t():e.graphology=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=t.GraphError=function(e){function t(r,o){n(this,t);var a=i(this,e.call(this));return a.name="GraphError",a.message=r||"",a.data=o||{},a}return o(t,e),t}(Error);t.InvalidArgumentsGraphError=function(e){function t(r,o){n(this,t);var a=i(this,e.call(this,r,o));return a.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,t.prototype.constructor),a}return o(t,e),t}(a),t.NotFoundGraphError=function(e){function t(r,o){n(this,t);var a=i(this,e.call(this,r,o));return a.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,t.prototype.constructor),a}return o(t,e),t}(a),t.UsageGraphError=function(e){function t(r,o){n(this,t);var a=i(this,e.call(this,r,o));return a.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a,t.prototype.constructor),a}return o(t,e),t}(a)},function(e,t,r){"use strict";function n(){for(var e=arguments[0]||{},t=1,r=arguments.length;t<r;t++)if(arguments[t])for(var n in arguments[t])e[n]=arguments[t][n];return e}function i(e,t,r,n){var i=e._nodes.get(t),o=null;return i?o="mixed"===n?i.out&&i.out[r]||i.undirected&&i.undirected[r]:"directed"===n?i.out&&i.out[r]:i.undirected&&i.undirected[r]:o}function o(e){return null!==e&&"object"===(void 0===e?"undefined":p(e))&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode}function a(e){return"object"===(void 0===e?"undefined":p(e))&&null!==e&&e.constructor===Object}function d(e){for(var t=""+e,r="",n=0,i=t.length;n<i;n++){r=t[i-n-1]+r,(n-2)%3||n===i-1||(r=","+r)}return r}function u(e,t,r){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:r})}function s(e,t,r){var n={enumerable:!0,configurable:!0};"function"==typeof r?n.get=r:(n.value=r,n.writable=!1),Object.defineProperty(e,t,n)}function h(){var e=0;return function(){return"_geid"+e+++"_"}}Object.defineProperty(t,"__esModule",{value:!0});var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.assign=n,t.getMatchingEdge=i,t.isGraph=o,t.isPlainObject=a,t.prettyPrint=d,t.privateProperty=u,t.readOnlyProperty=s,t.incrementalId=h},function(e,t){function r(e){Object.defineProperty(this,"_next",{writable:!1,enumerable:!1,value:e}),this.done=!1}r.prototype.next=function(){if(this.done)return{done:!0};var e=this._next();return e.done&&(this.done=!0),e},"undefined"!=typeof Symbol&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},r.empty=function(){var e=new r(null);return e.done=!0,e},r.is=function(e){return e instanceof r||"object"==typeof e&&null!==e&&"function"==typeof e.next},e.exports=r},function(e,t,r){"use strict";function n(e,t){this.key=e,this.attributes=t,this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.directedSelfLoops=0,this.undirectedSelfLoops=0,this.in={},this.out={},this.undirected={}}function i(e,t){this.key=e,this.attributes=t||{},this.inDegree=0,this.outDegree=0,this.directedSelfLoops=0,this.in={},this.out={}}function o(e,t){this.key=e,this.attributes=t||{},this.undirectedDegree=0,this.undirectedSelfLoops=0,this.undirected={}}function a(e,t,r,n,i){this.key=e,this.attributes=i,this.source=r,this.target=n,this.generatedKey=t}function d(e,t,r,n,i){this.key=e,this.attributes=i,this.source=r,this.target=n,this.generatedKey=t}Object.defineProperty(t,"__esModule",{value:!0}),t.MixedNodeData=n,t.DirectedNodeData=i,t.UndirectedNodeData=o,t.DirectedEdgeData=a,t.UndirectedEdgeData=d,i.prototype.upgradeToMixed=function(){this.undirectedDegree=0,this.undirectedSelfLoops=0,this.undirected={}},o.prototype.upgradeToMixed=function(){this.inDegree=0,this.outDegree=0,this.directedSelfLoops=0,this.in={},this.out={}}},function(e,t){e.exports=function(e,t){for(var r,n=arguments.length>1?t:1/0,i=n!==1/0?new Array(n):[],o=0;;){if(o===n)return i;if(r=e.next(),r.done)return o!==t?i.slice(0,o):i;i[o++]=r.value}}},function(e,t,r){var n=r(2);e.exports=function(){var e,t=arguments,r=-1;return new n(function n(){if(!e){if(++r>=t.length)return{done:!0};e=t[r]}var i=e.next();return i.done?(e=null,n()):i})}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){e.from=function(t,r){var n=new e(r);return n.import(t),n}}var d=r(1),u=r(7),s=function(e){return e&&e.__esModule?e:{default:e}}(u),h=r(0),p=function(e){function t(r){return n(this,t),i(this,e.call(this,(0,d.assign)({type:"directed"},r)))}return o(t,e),t}(s.default),c=function(e){function t(r){return n(this,t),i(this,e.call(this,(0,d.assign)({type:"undirected"},r)))}return o(t,e),t}(s.default),f=function(e){function t(r){return n(this,t),i(this,e.call(this,(0,d.assign)({multi:!0,type:"directed"},r)))}return o(t,e),t}(s.default),g=function(e){function t(r){return n(this,t),i(this,e.call(this,(0,d.assign)({multi:!0,type:"undirected"},r)))}return o(t,e),t}(s.default);a(s.default),a(p),a(c),a(f),a(g),s.default.Graph=s.default,s.default.DirectedGraph=p,s.default.UndirectedGraph=c,s.default.MultiDirectedGraph=f,s.default.MultiUndirectedGraph=g,s.default.InvalidArgumentsGraphError=h.InvalidArgumentsGraphError,s.default.NotFoundGraphError=h.NotFoundGraphError,s.default.UsageGraphError=h.UsageGraphError,e.exports=s.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function d(e,t,r,n,i,o,a,d){if(!n&&"undirected"===e.type)throw new g.UsageGraphError("Graph."+t+": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.");if(n&&"directed"===e.type)throw new g.UsageGraphError("Graph."+t+": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.");if(d&&!(0,E.isPlainObject)(d))throw new g.InvalidArgumentsGraphError("Graph."+t+': invalid attributes. Expecting an object but got "'+d+'"');if(o=""+o,a=""+a,d=d||{},!e.allowSelfLoops&&o===a)throw new g.UsageGraphError("Graph."+t+': source & target are the same ("'+o+"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.");var u=e._nodes.get(o),s=e._nodes.get(a);if(!u)throw new g.NotFoundGraphError("Graph."+t+': source node "'+o+'" not found.');if(!s)throw new g.NotFoundGraphError("Graph."+t+': target node "'+a+'" not found.');var h={key:null,undirected:n,source:o,target:a,attributes:d};if(r&&(i=e._edgeKeyGenerator(h)),i=""+i,e._edges.has(i))throw new g.UsageGraphError("Graph."+t+': the "'+i+'" edge already exists in the graph.');if(!e.multi&&(n?void 0!==u.undirected[a]:void 0!==u.out[a]))throw new g.UsageGraphError("Graph."+t+': an edge linking "'+o+'" to "'+a+"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.");var p=n?l.UndirectedEdgeData:l.DirectedEdgeData,c=new p(i,r,u,s,d);return e._edges.set(i,c),o===a?n?u.undirectedSelfLoops++:u.directedSelfLoops++:n?(u.undirectedDegree++,s.undirectedDegree++):(u.outDegree++,s.inDegree++),(0,y.updateStructureIndex)(e,n,c,o,a,u,s),n?e._undirectedSize++:e._directedSize++,h.key=i,e.emit("edgeAdded",h),i}function u(e,t,r,n,i,o,a,d){if(!n&&"undirected"===e.type)throw new g.UsageGraphError("Graph."+t+": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.");if(n&&"directed"===e.type)throw new g.UsageGraphError("Graph."+t+": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.");if(d&&!(0,E.isPlainObject)(d))throw new g.InvalidArgumentsGraphError("Graph."+t+': invalid attributes. Expecting an object but got "'+d+'"');if(o=""+o,a=""+a,d=d||{},!e.allowSelfLoops&&o===a)throw new g.UsageGraphError("Graph."+t+': source & target are the same ("'+o+"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.");var u=e._nodes.get(o),s=e._nodes.get(a),h=void 0,p=null;if(!r&&(h=e._edges.get(i))){if(h.source!==o||h.target!==a||n&&(h.source!==a||h.target!==o))throw new g.UsageGraphError("Graph."+t+': inconsistency detected when attempting to merge the "'+i+'" edge with "'+o+'" source & "'+a+'" target vs. ('+h.source+", "+h.target+").");p=i}var c=void 0;if(p||e.multi||!u||(n?void 0===u.undirected[a]:void 0===u.out[a])||(c=(0,E.getMatchingEdge)(e,o,a,n?"undirected":"directed")),c)return d?((0,E.assign)(c.attributes,d),p):p;var f={key:null,undirected:n,source:o,target:a,attributes:d};if(r&&(i=e._edgeKeyGenerator(f)),i=""+i,e._edges.has(i))throw new g.UsageGraphError("Graph."+t+': the "'+i+'" edge already exists in the graph.');return u||(e.addNode(o),u=e._nodes.get(o),o===a&&(s=u)),s||(e.addNode(a),s=e._nodes.get(a)),h=new(n?l.UndirectedEdgeData:l.DirectedEdgeData)(i,r,u,s,d),e._edges.set(i,h),o===a?n?u.undirectedSelfLoops++:u.directedSelfLoops++:n?(u.undirectedDegree++,s.undirectedDegree++):(u.outDegree++,s.inDegree++),(0,y.updateStructureIndex)(e,n,h,o,a,u,s),n?e._undirectedSize++:e._directedSize++,f.key=i,e.emit("edgeAdded",f),i}Object.defineProperty(t,"__esModule",{value:!0});var s=r(8),h=r(2),p=n(h),c=r(4),f=n(c),g=r(0),l=r(3),y=r(9),v=r(10),b=r(11),w=r(12),m=r(13),E=r(1),G=new Set(["directed","undirected","mixed"]),_=new Set(["domain","_events","_eventsCount","_maxListeners"]),x=[{name:function(e){return e+"Edge"},generateKey:!0},{name:function(e){return e+"DirectedEdge"},generateKey:!0,type:"directed"},{name:function(e){return e+"UndirectedEdge"},generateKey:!0,type:"undirected"},{name:function(e){return e+"EdgeWithKey"}},{name:function(e){return e+"DirectedEdgeWithKey"},type:"directed"},{name:function(e){return e+"UndirectedEdgeWithKey"},type:"undirected"}],N={allowSelfLoops:!0,edgeKeyGenerator:null,multi:!1,type:"mixed"},k=function(e){function t(r){i(this,t);var n=o(this,e.call(this));if(r=(0,E.assign)({},N,r),r.edgeKeyGenerator&&"function"!=typeof r.edgeKeyGenerator)throw new g.InvalidArgumentsGraphError("Graph.constructor: invalid 'edgeKeyGenerator' option. Expecting a function but got \""+r.edgeKeyGenerator+'".');if("boolean"!=typeof r.multi)throw new g.InvalidArgumentsGraphError("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \""+r.multi+'".');if(!G.has(r.type))throw new g.InvalidArgumentsGraphError('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'+r.type+'".');if("boolean"!=typeof r.allowSelfLoops)throw new g.InvalidArgumentsGraphError("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \""+r.allowSelfLoops+'".');var a="mixed"===r.type?l.MixedNodeData:"directed"===r.type?l.DirectedNodeData:l.UndirectedNodeData;return(0,E.privateProperty)(n,"NodeDataClass",a),(0,E.privateProperty)(n,"_attributes",{}),(0,E.privateProperty)(n,"_nodes",new Map),(0,E.privateProperty)(n,"_edges",new Map),(0,E.privateProperty)(n,"_directedSize",0),(0,E.privateProperty)(n,"_undirectedSize",0),(0,E.privateProperty)(n,"_edgeKeyGenerator",r.edgeKeyGenerator||(0,E.incrementalId)()),(0,E.privateProperty)(n,"_options",r),_.forEach(function(e){return(0,E.privateProperty)(n,e,n[e])}),(0,E.readOnlyProperty)(n,"order",function(){return n._nodes.size}),(0,E.readOnlyProperty)(n,"size",function(){return n._edges.size}),(0,E.readOnlyProperty)(n,"directedSize",function(){return n._directedSize}),(0,E.readOnlyProperty)(n,"undirectedSize",function(){return n._undirectedSize}),(0,E.readOnlyProperty)(n,"multi",n._options.multi),(0,E.readOnlyProperty)(n,"type",n._options.type),(0,E.readOnlyProperty)(n,"allowSelfLoops",n._options.allowSelfLoops),n}return a(t,e),t.prototype.hasNode=function(e){return this._nodes.has(""+e)},t.prototype.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var r=""+e,n=this._edges.get(r);return!!n&&n instanceof l.DirectedEdgeData}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)return!1;var o=i.out[t];return!!o&&(!this.multi||!!o.size)}throw new g.InvalidArgumentsGraphError("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.")},t.prototype.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var r=""+e,n=this._edges.get(r);return!!n&&n instanceof l.UndirectedEdgeData}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);if(!i)return!1;var o=i.undirected[t];return!!o&&(!this.multi||!!o.size)}throw new g.InvalidArgumentsGraphError("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.")},t.prototype.hasEdge=function(e,t){if(1===arguments.length){var r=""+e;return this._edges.has(r)}if(2===arguments.length){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)return!1;var i=void 0!==n.out&&n.out[t];return i||(i=void 0!==n.undirected&&n.undirected[t]),!!i&&(!this.multi||!!i.size)}throw new g.InvalidArgumentsGraphError("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.")},t.prototype.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new g.UsageGraphError("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.directedEdge: could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new g.NotFoundGraphError('Graph.directedEdge: could not find the "'+t+'" target node in the graph.');var n=r.out&&r.out[t]||void 0;return n?n.key:void 0}},t.prototype.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new g.UsageGraphError("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.undirectedEdge: could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new g.NotFoundGraphError('Graph.undirectedEdge: could not find the "'+t+'" target node in the graph.');var n=r.undirected&&r.undirected[t]||void 0;return n?n.key:void 0}},t.prototype.edge=function(e,t){if(this.multi)throw new g.UsageGraphError("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.edge: could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new g.NotFoundGraphError('Graph.edge: could not find the "'+t+'" target node in the graph.');var n=r.out&&r.out[t]||r.undirected&&r.undirected[t]||void 0;if(n)return n.key},t.prototype.inDegree=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("boolean"!=typeof t)throw new g.InvalidArgumentsGraphError('Graph.inDegree: Expecting a boolean but got "'+t+'" for the second parameter (allowing self-loops to be counted).');e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.inDegree: could not find the "'+e+'" node in the graph.');if("undirected"===this.type)return 0;var n=t?r.directedSelfLoops:0;return r.inDegree+n},t.prototype.outDegree=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("boolean"!=typeof t)throw new g.InvalidArgumentsGraphError('Graph.outDegree: Expecting a boolean but got "'+t+'" for the second parameter (allowing self-loops to be counted).');e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.outDegree: could not find the "'+e+'" node in the graph.');if("undirected"===this.type)return 0;var n=t?r.directedSelfLoops:0;return r.outDegree+n},t.prototype.directedDegree=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("boolean"!=typeof t)throw new g.InvalidArgumentsGraphError('Graph.directedDegree: Expecting a boolean but got "'+t+'" for the second parameter (allowing self-loops to be counted).');if(e=""+e,!this.hasNode(e))throw new g.NotFoundGraphError('Graph.directedDegree: could not find the "'+e+'" node in the graph.');return"undirected"===this.type?0:this.inDegree(e,t)+this.outDegree(e,t)},t.prototype.undirectedDegree=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("boolean"!=typeof t)throw new g.InvalidArgumentsGraphError('Graph.undirectedDegree: Expecting a boolean but got "'+t+'" for the second parameter (allowing self-loops to be counted).');if(e=""+e,!this.hasNode(e))throw new g.NotFoundGraphError('Graph.undirectedDegree: could not find the "'+e+'" node in the graph.');if("directed"===this.type)return 0;var r=this._nodes.get(e),n=t?2*r.undirectedSelfLoops:0;return r.undirectedDegree+n},t.prototype.degree=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("boolean"!=typeof t)throw new g.InvalidArgumentsGraphError('Graph.degree: Expecting a boolean but got "'+t+'" for the second parameter (allowing self-loops to be counted).');if(e=""+e,!this.hasNode(e))throw new g.NotFoundGraphError('Graph.degree: could not find the "'+e+'" node in the graph.');var r=0;return"undirected"!==this.type&&(r+=this.directedDegree(e,t)),"directed"!==this.type&&(r+=this.undirectedDegree(e,t)),r},t.prototype.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.source: could not find the "'+e+'" edge in the graph.');return t.source.key},t.prototype.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.target: could not find the "'+e+'" edge in the graph.');return t.target.key},t.prototype.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.extremities: could not find the "'+e+'" edge in the graph.');return[t.source.key,t.target.key]},t.prototype.opposite=function(e,t){if(e=""+e,t=""+t,!this._nodes.has(e))throw new g.NotFoundGraphError('Graph.opposite: could not find the "'+e+'" node in the graph.');var r=this._edges.get(t);if(!r)throw new g.NotFoundGraphError('Graph.opposite: could not find the "'+t+'" edge in the graph.');var n=r.source,i=r.target,o=n.key,a=i.key;if(e!==o&&e!==a)throw new g.NotFoundGraphError('Graph.opposite: the "'+e+'" node is not attached to the "'+t+'" edge ('+o+", "+a+").");return e===o?a:o},t.prototype.undirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.undirected: could not find the "'+e+'" edge in the graph.');return t instanceof l.UndirectedEdgeData},t.prototype.directed=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.directed: could not find the "'+e+'" edge in the graph.');return t instanceof l.DirectedEdgeData},t.prototype.selfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.selfLoop: could not find the "'+e+'" edge in the graph.');return t.source===t.target},t.prototype.addNode=function(e,t){if(t&&!(0,E.isPlainObject)(t))throw new g.InvalidArgumentsGraphError('Graph.addNode: invalid attributes. Expecting an object but got "'+t+'"');if(e=""+e,t=t||{},this._nodes.has(e))throw new g.UsageGraphError('Graph.addNode: the "'+e+'" node already exist in the graph.');var r=new this.NodeDataClass(e,t);return this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:t}),e},t.prototype.mergeNode=function(e,t){if(t&&!(0,E.isPlainObject)(t))throw new g.InvalidArgumentsGraphError('Graph.mergeNode: invalid attributes. Expecting an object but got "'+t+'"');e=""+e,t=t||{};var r=this._nodes.get(e);return r?(t&&(0,E.assign)(r.attributes,t),e):(r=new this.NodeDataClass(e,t),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:t}),e)},t.prototype.dropNode=function(e){if(e=""+e,!this.hasNode(e))throw new g.NotFoundGraphError('Graph.dropNode: could not find the "'+e+'" node in the graph.');for(var t=this.edges(e),r=0,n=t.length;r<n;r++)this.dropEdge(t[r]);var i=this._nodes.get(e);this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:i.attributes})},t.prototype.dropEdge=function(e){var t=void 0;if(arguments.length>1){var r=""+arguments[0],n=""+arguments[1];if(!(t=(0,E.getMatchingEdge)(this,r,n,this.type)))throw new g.NotFoundGraphError('Graph.dropEdge: could not find the "'+r+'" -> "'+n+'" edge in the graph.')}else if(e=""+e,!(t=this._edges.get(e)))throw new g.NotFoundGraphError('Graph.dropEdge: could not find the "'+e+'" edge in the graph.');this._edges.delete(t.key);var i=t,o=i.source,a=i.target,d=i.attributes,u=t instanceof l.UndirectedEdgeData;return o===a?o.selfLoops--:u?(o.undirectedDegree--,a.undirectedDegree--):(o.outDegree--,a.inDegree--),(0,y.clearEdgeFromStructureIndex)(this,u,t),u?this._undirectedSize--:this._directedSize--,this.emit("edgeDropped",{key:e,attributes:d,source:o.key,target:a.key,undirected:u}),this},t.prototype.clear=function(){this._edges.clear(),this._nodes.clear(),this.emit("cleared")},t.prototype.clearEdges=function(){this._edges.clear(),this.clearIndex(),this.emit("edgesCleared")},t.prototype.getAttribute=function(e){return this._attributes[e]},t.prototype.getAttributes=function(){return this._attributes},t.prototype.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},t.prototype.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",meta:{name:e,value:t}}),this},t.prototype.updateAttribute=function(e,t){if("function"!=typeof t)throw new g.InvalidArgumentsGraphError("Graph.updateAttribute: updater should be a function.");return this._attributes[e]=t(this._attributes[e]),this.emit("attributesUpdated",{type:"set",meta:{name:e,value:this._attributes[e]}}),this},t.prototype.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",meta:{name:e}}),this},t.prototype.replaceAttributes=function(e){if(!(0,E.isPlainObject)(e))throw new g.InvalidArgumentsGraphError("Graph.replaceAttributes: provided attributes are not a plain object.");var t=this._attributes;return this._attributes=e,this.emit("attributesUpdated",{type:"replace",meta:{before:t,after:e}}),this},t.prototype.mergeAttributes=function(e){if(!(0,E.isPlainObject)(e))throw new g.InvalidArgumentsGraphError("Graph.mergeAttributes: provided attributes are not a plain object.");return this._attributes=(0,E.assign)(this._attributes,e),this.emit("attributesUpdated",{type:"merge",meta:{data:this._attributes}}),this},t.prototype.getNodeAttribute=function(e,t){e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.getNodeAttribute: could not find the "'+e+'" node in the graph.');return r.attributes[t]},t.prototype.getNodeAttributes=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new g.NotFoundGraphError('Graph.getNodeAttributes: could not find the "'+e+'" node in the graph.');return t.attributes},t.prototype.hasNodeAttribute=function(e,t){e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.hasNodeAttribute: could not find the "'+e+'" node in the graph.');return r.attributes.hasOwnProperty(t)},t.prototype.setNodeAttribute=function(e,t,r){e=""+e;var n=this._nodes.get(e);if(!n)throw new g.NotFoundGraphError('Graph.setNodeAttribute: could not find the "'+e+'" node in the graph.');if(arguments.length<3)throw new g.InvalidArgumentsGraphError("Graph.setNodeAttribute: not enough arguments. Either you forgot to pass the attribute's name or value, or you meant to use #.replaceNodeAttributes / #.mergeNodeAttributes instead.");return n.attributes[t]=r,this.emit("nodeAttributesUpdated",{key:e,type:"set",meta:{name:t,value:r}}),this},t.prototype.updateNodeAttribute=function(e,t,r){e=""+e;var n=this._nodes.get(e);if(!n)throw new g.NotFoundGraphError('Graph.updateNodeAttribute: could not find the "'+e+'" node in the graph.');if(arguments.length<3)throw new g.InvalidArgumentsGraphError("Graph.updateNodeAttribute: not enough arguments. Either you forgot to pass the attribute's name or updater, or you meant to use #.replaceNodeAttributes / #.mergeNodeAttributes instead.");if("function"!=typeof r)throw new g.InvalidArgumentsGraphError("Graph.updateAttribute: updater should be a function.");var i=n.attributes;return i[t]=r(i[t]),this.emit("nodeAttributesUpdated",{key:e,type:"set",meta:{name:t,value:i[t]}}),this},t.prototype.removeNodeAttribute=function(e,t){e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.hasNodeAttribute: could not find the "'+e+'" node in the graph.');return delete r.attributes[t],this.emit("nodeAttributesUpdated",{key:e,type:"remove",meta:{name:t}}),this},t.prototype.replaceNodeAttributes=function(e,t){e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.replaceNodeAttributes: could not find the "'+e+'" node in the graph.');if(!(0,E.isPlainObject)(t))throw new g.InvalidArgumentsGraphError("Graph.replaceNodeAttributes: provided attributes are not a plain object.");var n=r.attributes;return r.attributes=t,this.emit("nodeAttributesUpdated",{key:e,type:"replace",meta:{before:n,after:t}}),this},t.prototype.mergeNodeAttributes=function(e,t){e=""+e;var r=this._nodes.get(e);if(!r)throw new g.NotFoundGraphError('Graph.mergeNodeAttributes: could not find the "'+e+'" node in the graph.');if(!(0,E.isPlainObject)(t))throw new g.InvalidArgumentsGraphError("Graph.mergeNodeAttributes: provided attributes are not a plain object.");return(0,E.assign)(r.attributes,t),this.emit("nodeAttributesUpdated",{key:e,type:"merge",meta:{data:t}}),this},t.prototype.forEach=function(e){if("function"!=typeof e)throw new g.InvalidArgumentsGraphError("Graph.forEach: expecting a callback.");this._edges.forEach(function(t,r){var n=t.source,i=t.target;e(n.key,i.key,n.attributes,i.attributes,r,t.attributes)})},t.prototype.adjacency=function(){var e=this._edges.values();return new p.default(function(){var t=e.next();if(t.done)return t;var r=t.value,n=r.source,i=r.target;return{done:!1,value:[n.key,i.key,n.attributes,i.attributes,r.key,r.attributes]}})},t.prototype.nodes=function(){return(0,f.default)(this._nodes.keys(),this._nodes.size)},t.prototype.forEachNode=function(e){if("function"!=typeof e)throw new g.InvalidArgumentsGraphError("Graph.forEachNode: expecting a callback.");this._nodes.forEach(function(t,r){e(r,t.attributes)})},t.prototype.nodeEntries=function(){var e=this._nodes.values();return new p.default(function(){var t=e.next();if(t.done)return t;var r=t.value;return{value:[r.key,r.attributes],done:!1}})},t.prototype.exportNode=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new g.NotFoundGraphError('Graph.exportNode: could not find the "'+e+'" node in the graph.');return(0,m.serializeNode)(e,t)},t.prototype.exportEdge=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new g.NotFoundGraphError('Graph.exportEdge: could not find the "'+e+'" edge in the graph.');return(0,m.serializeEdge)(e,t)},t.prototype.export=function(){var e=new Array(this._nodes.size),t=0;this._nodes.forEach(function(r,n){e[t++]=(0,m.serializeNode)(n,r)});var r=new Array(this._edges.size);return t=0,this._edges.forEach(function(e,n){r[t++]=(0,m.serializeEdge)(n,e)}),{attributes:this.getAttributes(),nodes:e,edges:r}},t.prototype.importNode=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=(0,m.validateSerializedNode)(e);if(r){if("not-object"===r)throw new g.InvalidArgumentsGraphError('Graph.importNode: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if("no-key"===r)throw new g.InvalidArgumentsGraphError("Graph.importNode: no key provided.");if("invalid-attributes"===r)throw new g.InvalidArgumentsGraphError("Graph.importNode: invalid attributes. Attributes should be a plain object, null or omitted.")}var n=e.key,i=e.attributes,o=void 0===i?{}:i;return t?this.mergeNode(n,o):this.addNode(n,o),this},t.prototype.importEdge=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=(0,m.validateSerializedEdge)(e);if(r){if("not-object"===r)throw new g.InvalidArgumentsGraphError('Graph.importEdge: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if("no-source"===r)throw new g.InvalidArgumentsGraphError("Graph.importEdge: missing souce.");if("no-target"===r)throw new g.InvalidArgumentsGraphError("Graph.importEdge: missing target.");if("invalid-attributes"===r)throw new g.InvalidArgumentsGraphError("Graph.importEdge: invalid attributes. Attributes should be a plain object, null or omitted.");if("invalid-undirected"===r)throw new g.InvalidArgumentsGraphError("Graph.importEdge: invalid undirected. Undirected should be boolean or omitted.")}var n=e.source,i=e.target,o=e.attributes,a=void 0===o?{}:o,d=e.undirected,u=void 0!==d&&d,s=void 0;return"key"in e?(s=t?u?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:u?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,s.call(this,e.key,n,i,a)):(s=t?u?this.mergeUndirectedEdge:this.mergeDirectedEdge:u?this.addUndirectedEdge:this.addDirectedEdge,s.call(this,n,i,a)),this},t.prototype.import=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,E.isGraph)(e))return this.import(e.export(),r),this;if(!(0,E.isPlainObject)(e))throw new g.InvalidArgumentsGraphError("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!(0,E.isPlainObject)(e.attributes))throw new g.InvalidArgumentsGraphError("Graph.import: invalid attributes. Expecting a plain object.");r?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}return e.nodes&&e.nodes.forEach(function(e){return t.importNode(e,r)}),e.edges&&e.edges.forEach(function(e){return t.importEdge(e,r)}),this},t.prototype.emptyCopy=function(){return new t(this._options)},t.prototype.copy=function(){var e=new t(this._options);return e.import(this),e},t.prototype.upgradeToMixed=function(){return"mixed"===this.type?this:(this._nodes.forEach(function(e){return e.upgradeToMixed()}),this._options.type="mixed",(0,E.readOnlyProperty)(this,"type",this._options.type),(0,E.privateProperty)(this,"NodeDataClass",l.MixedNodeData),this)},t.prototype.upgradeToMulti=function(){return this.multi?this:(this._options.multi=!0,(0,E.readOnlyProperty)(this,"multi",!0),(0,y.upgradeStructureIndexToMulti)(this),this)},t.prototype.clearIndex=function(){return(0,y.clearStructureIndex)(this),this},t.prototype.toJSON=function(){return this.export()},t.prototype.toString=function(){var e=this.order>1||0===this.order,t=this.size>1||0===this.size;return"Graph<"+(0,E.prettyPrint)(this.order)+" node"+(e?"s":"")+", "+(0,E.prettyPrint)(this.size)+" edge"+(t?"s":"")+">"},t.prototype.inspect=function(){var e=this,t={};this._nodes.forEach(function(e,r){t[r]=e.attributes});var r={},n={};this._edges.forEach(function(t,i){var o=t instanceof l.UndirectedEdgeData?"--":"->",a="",d="("+t.source.key+")"+o+"("+t.target.key+")";t.generatedKey?e.multi&&(void 0===n[d]?n[d]=0:n[d]++,a+=n[d]+". "):a+="["+i+"]: ",a+=d,r[a]=t.attributes});var i={};for(var o in this)this.hasOwnProperty(o)&&!_.has(o)&&"function"!=typeof this[o]&&(i[o]=this[o]);return i.attributes=this._attributes,i.nodes=t,i.edges=r,(0,E.privateProperty)(i,"constructor",this.constructor),i},t}(s.EventEmitter);t.default=k,"undefined"!=typeof Symbol&&(k.prototype[Symbol.for("nodejs.util.inspect.custom")]=k.prototype.inspect),x.forEach(function(e){["add","merge"].forEach(function(t){var r=e.name(t),n="add"===t?d:u;e.generateKey?k.prototype[r]=function(t,i,o){return n(this,r,!0,"undirected"===(e.type||this.type),null,t,i,o)}:k.prototype[r]=function(t,i,o,a){return n(this,r,!1,"undirected"===(e.type||this.type),t,i,o,a)}})}),"undefined"!=typeof Symbol&&(k.prototype[Symbol.iterator]=k.prototype.adjacency),(0,v.attachAttributesMethods)(k),(0,b.attachEdgeIterationMethods)(k),(0,w.attachNeighborIterationMethods)(k)},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,d,u,s;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(r=this._events[e],a(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:d=Array.prototype.slice.call(arguments,1),r.apply(this,d)}else if(o(r))for(d=Array.prototype.slice.call(arguments,1),s=r.slice(),i=s.length,u=0;u<i;u++)s[u].apply(this,d);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,a,d;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(d=a;d-- >0;)if(r[d]===t||r[d].listener&&r[d].listener===t){i=d;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e,t,r,n,i,o,a){var d=e.multi,u=t?"undirected":"out",s=t?"undirected":"in",h=o[u][i];void 0===h&&(h=d?new Set:r,o[u][i]=h),d&&h.add(r),n!==i&&void 0===a[s][n]&&(a[s][n]=h)}function i(e,t,r){var n=e.multi,i=r.source,o=r.target,a=i.key,d=o.key,u=t?"undirected":"out",s=i[u],h=t?"undirected":"in";if(d in s)if(n){var p=s[d];1===p.size?(delete s[d],delete o[h][a]):p.delete(r)}else delete s[d];if(!n){delete o[h][a]}}function o(e){e._nodes.forEach(function(e){void 0!==e.in&&(e.in={},e.out={}),void 0!==e.undirected&&(e.undirected={})})}function a(e){e._nodes.forEach(function(t,r){if(t.out)for(var n in t.out){var i=new Set;i.add(t.out[n]),t.out[n]=i,e._nodes.get(n).in[r]=i}if(t.undirected)for(var o in t.undirected)if(!(o>r)){var a=new Set;a.add(t.undirected[o]),t.undirected[o]=a,e._nodes.get(o).undirected[r]=a}})}Object.defineProperty(t,"__esModule",{value:!0}),t.updateStructureIndex=n,t.clearEdgeFromStructureIndex=i,t.clearStructureIndex=o,t.upgradeStructureIndexToMulti=a},function(e,t,r){"use strict";function n(e,t,r,n){e.prototype[t]=function(e,i){var o=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>2){if(this.multi)throw new f.UsageGraphError("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.");var a=""+e,d=""+i;if(i=arguments[2],!(o=(0,c.getMatchingEdge)(this,a,d,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+a+'" - "'+d+'").')}else if(e=""+e,!(o=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("mixed"!==r&&!(o instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return o.attributes[i]}}function i(e,t,r,n){e.prototype[t]=function(e){var i=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>1){if(this.multi)throw new f.UsageGraphError("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.");var o=""+e,a=""+arguments[1];if(!(i=(0,c.getMatchingEdge)(this,o,a,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+o+'" - "'+a+'").')}else if(e=""+e,!(i=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("mixed"!==r&&!(i instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return i.attributes}}function o(e,t,r,n){e.prototype[t]=function(e,i){var o=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>2){if(this.multi)throw new f.UsageGraphError("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.");var a=""+e,d=""+i;if(i=arguments[2],!(o=(0,c.getMatchingEdge)(this,a,d,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+a+'" - "'+d+'").')}else if(e=""+e,!(o=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("mixed"!==r&&!(o instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return o.attributes.hasOwnProperty(i)}}function a(e,t,r,n){e.prototype[t]=function(e,i,o){var a=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>3){if(this.multi)throw new f.UsageGraphError("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.");var d=""+e,u=""+i;if(i=arguments[2],o=arguments[3],!(a=(0,c.getMatchingEdge)(this,d,u,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+d+'" - "'+u+'").')}else if(e=""+e,!(a=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("mixed"!==r&&!(a instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return a.attributes[i]=o,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",meta:{name:i,value:o}}),this}}function d(e,t,r,n){e.prototype[t]=function(e,i,o){var a=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>3){if(this.multi)throw new f.UsageGraphError("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.");var d=""+e,u=""+i;if(i=arguments[2],o=arguments[3],!(a=(0,c.getMatchingEdge)(this,d,u,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+d+'" - "'+u+'").')}else if(e=""+e,!(a=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("function"!=typeof o)throw new f.InvalidArgumentsGraphError("Graph."+t+": updater should be a function.");if("mixed"!==r&&!(a instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return a.attributes[i]=o(a.attributes[i]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",meta:{name:i,value:a.attributes[i]}}),this}}function u(e,t,r,n){e.prototype[t]=function(e,i){var o=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>2){if(this.multi)throw new f.UsageGraphError("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.");var a=""+e,d=""+i;if(i=arguments[2],!(o=(0,c.getMatchingEdge)(this,a,d,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+a+'" - "'+d+'").')}else if(e=""+e,!(o=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if("mixed"!==r&&!(o instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return delete o.attributes[i],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",meta:{name:i}}),this}}function s(e,t,r,n){e.prototype[t]=function(e,i){var o=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>2){if(this.multi)throw new f.UsageGraphError("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.");var a=""+e,d=""+i;if(i=arguments[2],!(o=(0,c.getMatchingEdge)(this,a,d,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+a+'" - "'+d+'").')}else if(e=""+e,!(o=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if(!(0,c.isPlainObject)(i))throw new f.InvalidArgumentsGraphError("Graph."+t+": provided attributes are not a plain object.");if("mixed"!==r&&!(o instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");var u=o.attributes;return o.attributes=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"replace",meta:{before:u,after:i}}),this}}function h(e,t,r,n){e.prototype[t]=function(e,i){var o=void 0;if("mixed"!==this.type&&"mixed"!==r&&r!==this.type)throw new f.UsageGraphError("Graph."+t+": cannot find this type of edges in your "+this.type+" graph.");if(arguments.length>2){if(this.multi)throw new f.UsageGraphError("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.");var a=""+e,d=""+i;if(i=arguments[2],!(o=(0,c.getMatchingEdge)(this,a,d,r)))throw new f.NotFoundGraphError("Graph."+t+': could not find an edge for the given path ("'+a+'" - "'+d+'").')}else if(e=""+e,!(o=this._edges.get(e)))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" edge in the graph.');if(!(0,c.isPlainObject)(i))throw new f.InvalidArgumentsGraphError("Graph."+t+": provided attributes are not a plain object.");if("mixed"!==r&&!(o instanceof n))throw new f.NotFoundGraphError("Graph."+t+': could not find the "'+e+'" '+r+" edge in the graph.");return(0,c.assign)(o.attributes,i),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",meta:{data:i}}),this}}function p(e){l.forEach(function(t){var r=t.name,n=t.attacher;n(e,r("Edge"),"mixed",g.DirectedEdgeData),n(e,r("DirectedEdge"),"directed",g.DirectedEdgeData),n(e,r("UndirectedEdge"),"undirected",g.UndirectedEdgeData)})}Object.defineProperty(t,"__esModule",{value:!0}),t.attachAttributesMethods=p;var c=r(1),f=r(0),g=r(3),l=[{name:function(e){return"get"+e+"Attribute"},attacher:n},{name:function(e){return"get"+e+"Attributes"},attacher:i},{name:function(e){return"has"+e+"Attribute"},attacher:o},{name:function(e){return"set"+e+"Attribute"},attacher:a},{name:function(e){return"update"+e+"Attribute"},attacher:d},{name:function(e){return"remove"+e+"Attribute"},attacher:u},{name:function(e){return"replace"+e+"Attributes"},attacher:s},{name:function(e){return"merge"+e+"Attributes"},attacher:h}]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){for(var r in t)t[r]instanceof Set?t[r].forEach(function(t){return e.push(t.key)}):e.push(t[r].key)}function o(e,t){for(var r in e)if(e[r]instanceof Set)e[r].forEach(function(e){return t(e.key,e.attributes,e.source.key,e.target.key,e.source.attributes,e.target.attributes)});else{var n=e[r];t(n.key,n.attributes,n.source.key,n.target.key,n.source.attributes,n.target.attributes)}}function a(e){var t=Object.keys(e),r=t.length,n=null,i=0;return new x.default(function o(){var a=void 0;if(n){var d=n.next();if(d.done)return n=null,i++,o();a=d.value}else{if(i>=r)return{done:!0};var u=t[i];if((a=e[u])instanceof Set)return n=a.values(),o();i++}return{done:!1,value:[a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes]}})}function d(e,t,r){r in t&&(t[r]instanceof Set?t[r].forEach(function(t){return e.push(t.key)}):e.push(t[r].key))}function u(e,t,r){if(t in e)if(e[t]instanceof Set)e[t].forEach(function(e){return r(e.key,e.attributes,e.source.key,e.target.key,e.source.attributes,e.target.attributes)});else{var n=e[t];r(n.key,n.attributes,n.source.key,n.target.key,n.source.attributes,n.target.attributes)}}function s(e,t){var r=e[t];if(r instanceof Set){var n=r.values();return new x.default(function(){var e=n.next();if(e.done)return e;var t=e.value;return{done:!1,value:[t.key,t.attributes,t.source.key,t.target.key,t.source.attributes,t.target.attributes]}})}return x.default.of([r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes])}function h(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return(0,D.default)(e._edges.keys(),e._edges.size);var r="undirected"===t?e.undirectedSize:e.directedSize,n=new Array(r),i="undirected"===t,o=0;return e._edges.forEach(function(e,t){e instanceof U.UndirectedEdgeData===i&&(n[o++]=t)}),n}function p(e,t,r){if(0!==e.size)if("mixed"===t||t===e.type)e._edges.forEach(function(e,t){var n=e.attributes,i=e.source,o=e.target;r(t,n,i.key,o.key,i.attributes,o.attributes)});else{var n="undirected"===t;e._edges.forEach(function(e,t){if(e instanceof U.UndirectedEdgeData===n){var i=e.attributes,o=e.source,a=e.target;r(t,i,o.key,a.key,o.attributes,a.attributes)}})}}function c(e,t){if(0===e.size)return x.default.empty();var r=void 0;return"mixed"===t?(r=e._edges.values(),new x.default(function(){var e=r.next();if(e.done)return e;var t=e.value;return{value:[t.key,t.attributes,t.source.key,t.target.key,t.source.attributes,t.target.attributes],done:!1}})):(r=e._edges.values(),new x.default(function e(){var n=r.next();if(n.done)return n;var i=n.value;if(i instanceof U.UndirectedEdgeData==("undirected"===t)){return{value:[i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes],done:!1}}return e()}))}function f(e,t,r){var n=[];return"undirected"!==e&&("out"!==t&&i(n,r.in),"in"!==t&&i(n,r.out)),"directed"!==e&&i(n,r.undirected),n}function g(e,t,r,n){"undirected"!==e&&("out"!==t&&o(r.in,n),"in"!==t&&o(r.out,n)),"directed"!==e&&o(r.undirected,n)}function l(e,t,r){var n=x.default.empty();return"undirected"!==e&&("out"!==t&&void 0!==r.in&&(n=(0,k.default)(n,a(r.in))),"in"!==t&&void 0!==r.out&&(n=(0,k.default)(n,a(r.out)))),"directed"!==e&&void 0!==r.undirected&&(n=(0,k.default)(n,a(r.undirected))),n}function y(e,t,r,n){var i=[];return"undirected"!==e&&(void 0!==r.in&&"out"!==t&&d(i,r.in,n),void 0!==r.out&&"in"!==t&&d(i,r.out,n)),"directed"!==e&&void 0!==r.undirected&&d(i,r.undirected,n),i}function v(e,t,r,n,i){"undirected"!==e&&(void 0!==r.in&&"out"!==t&&u(r.in,n,i),void 0!==r.out&&"in"!==t&&u(r.out,n,i)),"directed"!==e&&void 0!==r.undirected&&u(r.undirected,n,i)}function b(e,t,r,n){var i=x.default.empty();return"undirected"!==e&&(void 0!==r.in&&"out"!==t&&n in r.in&&(i=(0,k.default)(i,s(r.in,n))),void 0!==r.out&&"in"!==t&&n in r.out&&(i=(0,k.default)(i,s(r.out,n)))),"directed"!==e&&void 0!==r.undirected&&n in r.undirected&&(i=(0,k.default)(i,s(r.undirected,n))),i}function w(e,t){var r=t.name,n=t.type,i=t.direction;e.prototype[r]=function(e,t){if("mixed"!==n&&"mixed"!==this.type&&n!==this.type)return[];if(!arguments.length)return h(this,n);if(1===arguments.length){e=""+e;var o=this._nodes.get(e);if(void 0===o)throw new S.NotFoundGraphError("Graph."+r+': could not find the "'+e+'" node in the graph.');return f("mixed"===n?this.type:n,i,o)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new S.NotFoundGraphError("Graph."+r+': could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new S.NotFoundGraphError("Graph."+r+': could not find the "'+t+'" target node in the graph.');return y(n,i,a,t)}throw new S.InvalidArgumentsGraphError("Graph."+r+": too many arguments (expecting 0, 1 or 2 and got "+arguments.length+").")}}function m(e,t){var r=t.name,n=t.type,i=t.direction,o="forEach"+r[0].toUpperCase()+r.slice(1,-1);e.prototype[o]=function(e,t,r){if("mixed"===n||"mixed"===this.type||n===this.type){if(1===arguments.length)return r=e,p(this,n,r);if(2===arguments.length){e=""+e,r=t;var a=this._nodes.get(e);if(void 0===a)throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" node in the graph.');return g("mixed"===n?this.type:n,i,a,r)}if(3===arguments.length){e=""+e,t=""+t;var d=this._nodes.get(e);if(!d)throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+t+'" target node in the graph.');return v(n,i,d,t,r)}throw new S.InvalidArgumentsGraphError("Graph."+o+": too many arguments (expecting 1, 2 or 3 and got "+arguments.length+").")}}}function E(e,t){var r=t.name,n=t.type,i=t.direction,o=r.slice(0,-1)+"Entries";e.prototype[o]=function(e,t){if("mixed"!==n&&"mixed"!==this.type&&n!==this.type)return x.default.empty();if(!arguments.length)return c(this,n);if(1===arguments.length){e=""+e;var r=this._nodes.get(e);if(!r)throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" node in the graph.');return l(n,i,r)}if(2===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" source node in the graph.');if(!this._nodes.has(t))throw new S.NotFoundGraphError("Graph."+o+': could not find the "'+t+'" target node in the graph.');return b(n,i,a,t)}throw new S.InvalidArgumentsGraphError("Graph."+o+": too many arguments (expecting 0, 1 or 2 and got "+arguments.length+").")}}function G(e){j.forEach(function(t){w(e,t),m(e,t),E(e,t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.attachEdgeIteratorCreator=E,t.attachEdgeIterationMethods=G;var _=r(2),x=n(_),N=r(5),k=n(N),A=r(4),D=n(A),S=r(0),U=r(3),j=[{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(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(void 0!==t)for(var r in t)e.add(r)}function o(e,t,r){if("mixed"!==e){if("undirected"===e)return Object.keys(r.undirected);if("string"==typeof t)return Object.keys(r[t])}var n=new Set;return"undirected"!==e&&("out"!==t&&i(n,r.in),"in"!==t&&i(n,r.out)),"directed"!==e&&i(n,r.undirected),(0,G.default)(n.values(),n.size)}function a(e,t,r){for(var n in t){var i=t[n];i instanceof Set&&(i=i.values().next().value);var o=i.source,a=i.target,d=o===e?a:o;r(d.key,d.attributes)}}function d(e,t,r,n){for(var i in r){var o=r[i];o instanceof Set&&(o=o.values().next().value);var a=o.source,d=o.target,u=a===t?d:a;e.has(u.key)||(e.add(u.key),n(u.key,u.attributes))}}function u(e,t,r,n){if("mixed"!==e){if("undirected"===e)return a(r,r.undirected,n);if("string"==typeof t)return a(r,r[t],n)}var i=new Set;"undirected"!==e&&("out"!==t&&d(i,r,r.in,n),"in"!==t&&d(i,r,r.out,n)),"directed"!==e&&d(i,r,r.undirected,n)}function s(e,t){var r=Object.keys(t),n=r.length,i=0;return new b.default(function(){if(i>=n)return{done:!0};var o=t[r[i++]];o instanceof Set&&(o=o.values().next().value);var a=o.source,d=o.target,u=a===e?d:a;return{done:!1,value:[u.key,u.attributes]}})}function h(e,t,r){var n=Object.keys(r),i=n.length,o=0;return new b.default(function a(){if(o>=i)return{done:!0};var d=r[n[o++]];d instanceof Set&&(d=d.values().next().value);var u=d.source,s=d.target,h=u===t?s:u;return e.has(h.key)?a():(e.add(h.key),{done:!1,value:[h.key,h.attributes]})})}function p(e,t,r){if("mixed"!==e){if("undirected"===e)return s(r,r.undirected);if("string"==typeof t)return s(r,r[t])}var n=b.default.empty(),i=new Set;return"undirected"!==e&&("out"!==t&&(n=(0,m.default)(n,h(i,r,r.in))),"in"!==t&&(n=(0,m.default)(n,h(i,r,r.out)))),"directed"!==e&&(n=(0,m.default)(n,h(i,r,r.undirected))),n}function c(e,t,r,n,i){var o=e._nodes.get(n);if("undirected"!==t){if("out"!==r&&void 0!==o.in)for(var a in o.in)if(a===i)return!0;if("in"!==r&&void 0!==o.out)for(var d in o.out)if(d===i)return!0}if("directed"!==t&&void 0!==o.undirected)for(var u in o.undirected)if(u===i)return!0;return!1}function f(e,t){var r=t.name,n=t.type,i=t.direction;e.prototype[r]=function(e){if("mixed"!==n&&"mixed"!==this.type&&n!==this.type)return[];if(2===arguments.length){var t=""+arguments[0],a=""+arguments[1];if(!this._nodes.has(t))throw new _.NotFoundGraphError("Graph."+r+': could not find the "'+t+'" node in the graph.');if(!this._nodes.has(a))throw new _.NotFoundGraphError("Graph."+r+': could not find the "'+a+'" node in the graph.');return c(this,n,i,t,a)}if(1===arguments.length){e=""+e;var d=this._nodes.get(e);if(void 0===d)throw new _.NotFoundGraphError("Graph."+r+': could not find the "'+e+'" node in the graph.');return o("mixed"===n?this.type:n,i,d)}throw new _.InvalidArgumentsGraphError("Graph."+r+": invalid number of arguments (expecting 1 or 2 and got "+arguments.length+").")}}function g(e,t){var r=t.name,n=t.type,i=t.direction,o="forEach"+r[0].toUpperCase()+r.slice(1,-1);e.prototype[o]=function(e,t){if("mixed"===n||"mixed"===this.type||n===this.type){e=""+e;var r=this._nodes.get(e);if(void 0===r)throw new _.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" node in the graph.');u("mixed"===n?this.type:n,i,r,t)}}}function l(e,t){var r=t.name,n=t.type,i=t.direction,o=r.slice(0,-1)+"Entries";e.prototype[o]=function(e){if("mixed"!==n&&"mixed"!==this.type&&n!==this.type)return b.default.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new _.NotFoundGraphError("Graph."+o+': could not find the "'+e+'" node in the graph.');return p("mixed"===n?this.type:n,i,t)}}function y(e){x.forEach(function(t){f(e,t),g(e,t),l(e,t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.attachNeighborIterationMethods=y;var v=r(2),b=n(v),w=r(5),m=n(w),E=r(4),G=n(E),_=r(0),x=[{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,t,r){"use strict";function n(e,t){var r={key:e};return Object.keys(t.attributes).length&&(r.attributes=(0,u.assign)({},t.attributes)),r}function i(e,t){var r={source:t.source.key,target:t.target.key};return t.generatedKey||(r.key=e),Object.keys(t.attributes).length&&(r.attributes=(0,u.assign)({},t.attributes)),t instanceof d.UndirectedEdgeData&&(r.undirected=!0),r}function o(e){return(0,u.isPlainObject)(e)?"key"in e?"attributes"in e&&(!(0,u.isPlainObject)(e.attributes)||null===e.attributes)?"invalid-attributes":null:"no-key":"not-object"}function a(e){return(0,u.isPlainObject)(e)?"source"in e?"target"in e?"attributes"in e&&(!(0,u.isPlainObject)(e.attributes)||null===e.attributes)?"invalid-attributes":"undirected"in e&&"boolean"!=typeof e.undirected?"invalid-undirected":null:"no-target":"no-source":"not-object"}Object.defineProperty(t,"__esModule",{value:!0}),t.serializeNode=n,t.serializeEdge=i,t.validateSerializedNode=o,t.validateSerializedEdge=a;var d=r(3),u=r(1)}])});