graphgarden-web 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/utils.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/events/events.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/obliterator/iterator.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/obliterator/support.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/obliterator/iter.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/obliterator/take.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/errors.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/data.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/attributes/nodes.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/attributes/edges.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/obliterator/chain.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/iteration/edges.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/iteration/neighbors.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/iteration/adjacency.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/serialization.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/graph.js", "../../../node_modules/.pnpm/graphology@0.25.4_graphology-types@0.24.8/node_modules/graphology/src/classes.js", "../../../node_modules/.pnpm/graphology-utils@2.5.2_graphology-types@0.24.8/node_modules/graphology-utils/is-graph.js", "../../../node_modules/.pnpm/graphology-utils@2.5.2_graphology-types@0.24.8/node_modules/graphology-utils/getters.js", "../../../node_modules/.pnpm/graphology-layout-forceatlas2@0.10.1_graphology-types@0.24.8/node_modules/graphology-layout-forceatlas2/iterate.js", "../../../node_modules/.pnpm/graphology-layout-forceatlas2@0.10.1_graphology-types@0.24.8/node_modules/graphology-layout-forceatlas2/helpers.js", "../../../node_modules/.pnpm/graphology-layout-forceatlas2@0.10.1_graphology-types@0.24.8/node_modules/graphology-layout-forceatlas2/defaults.js", "../../../node_modules/.pnpm/graphology-layout-forceatlas2@0.10.1_graphology-types@0.24.8/node_modules/graphology-layout-forceatlas2/index.js", "../../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js", "../src/index.ts", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/inherits-d1a1e29b.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/colors-beb06eb2.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/index-236c62ad.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/types/dist/sigma-types.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/normalization-be445518.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/data-11df7124.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/settings/dist/sigma-settings.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/dist/sigma.esm.js", "../../../node_modules/.pnpm/sigma@3.0.2_graphology-types@0.24.8/node_modules/sigma/rendering/dist/sigma-rendering.esm.js"],
4
+ "sourcesContent": ["/**\n * Graphology Utilities\n * =====================\n *\n * Collection of helpful functions used by the implementation.\n */\n\n/**\n * Object.assign-like polyfill.\n *\n * @param {object} target - First object.\n * @param {object} [...objects] - Objects to merge.\n * @return {object}\n */\nfunction assignPolyfill() {\n const target = arguments[0];\n\n for (let i = 1, l = arguments.length; i < l; i++) {\n if (!arguments[i]) continue;\n\n for (const k in arguments[i]) target[k] = arguments[i][k];\n }\n\n return target;\n}\n\nlet assign = assignPolyfill;\n\nif (typeof Object.assign === 'function') assign = Object.assign;\n\nexport {assign};\n\n/**\n * Function returning the first matching edge for given path.\n * Note: this function does not check the existence of source & target. This\n * must be performed by the caller.\n *\n * @param {Graph} graph - Target graph.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {string} type - Type of the edge (mixed, directed or undirected).\n * @return {string|null}\n */\nexport function getMatchingEdge(graph, source, target, type) {\n const sourceData = graph._nodes.get(source);\n\n let edge = null;\n\n if (!sourceData) return edge;\n\n if (type === 'mixed') {\n edge =\n (sourceData.out && sourceData.out[target]) ||\n (sourceData.undirected && sourceData.undirected[target]);\n } else if (type === 'directed') {\n edge = sourceData.out && sourceData.out[target];\n } else {\n edge = sourceData.undirected && sourceData.undirected[target];\n }\n\n return edge;\n}\n\n/**\n * Checks whether the given value is a plain object.\n *\n * @param {mixed} value - Target value.\n * @return {boolean}\n */\nexport function isPlainObject(value) {\n // NOTE: as per https://github.com/graphology/graphology/issues/149\n // this function has been loosened not to reject object instances\n // coming from other JavaScript contexts. It has also been chosen\n // not to improve it to avoid obvious false positives and avoid\n // taking a performance hit. People should really use TypeScript\n // if they want to avoid feeding subtly irrelvant attribute objects.\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Checks whether the given object is empty.\n *\n * @param {object} o - Target Object.\n * @return {boolean}\n */\nexport function isEmpty(o) {\n let k;\n\n for (k in o) return false;\n\n return true;\n}\n\n/**\n * Creates a \"private\" property for the given member name by concealing it\n * using the `enumerable` option.\n *\n * @param {object} target - Target object.\n * @param {string} name - Member name.\n */\nexport function privateProperty(target, name, value) {\n Object.defineProperty(target, name, {\n enumerable: false,\n configurable: false,\n writable: true,\n value\n });\n}\n\n/**\n * Creates a read-only property for the given member name & the given getter.\n *\n * @param {object} target - Target object.\n * @param {string} name - Member name.\n * @param {mixed} value - The attached getter or fixed value.\n */\nexport function readOnlyProperty(target, name, value) {\n const descriptor = {\n enumerable: true,\n configurable: true\n };\n\n if (typeof value === 'function') {\n descriptor.get = value;\n } else {\n descriptor.value = value;\n descriptor.writable = false;\n }\n\n Object.defineProperty(target, name, descriptor);\n}\n\n/**\n * Returns whether the given object constitute valid hints.\n *\n * @param {object} hints - Target object.\n */\nexport function validateHints(hints) {\n if (!isPlainObject(hints)) return false;\n\n if (hints.attributes && !Array.isArray(hints.attributes)) return false;\n\n return true;\n}\n\n/**\n * Creates a function generating incremental ids for edges.\n *\n * @return {function}\n */\nexport function incrementalIdStartingFromRandomByte() {\n let i = Math.floor(Math.random() * 256) & 0xff;\n\n return () => {\n return i++;\n };\n}\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n", "/**\n * Obliterator Iterator Class\n * ===========================\n *\n * Simple class representing the library's iterators.\n */\n\n/**\n * Iterator class.\n *\n * @constructor\n * @param {function} next - Next function.\n */\nfunction Iterator(next) {\n if (typeof next !== 'function')\n throw new Error('obliterator/iterator: expecting a function!');\n\n this.next = next;\n}\n\n/**\n * If symbols are supported, we add `next` to `Symbol.iterator`.\n */\nif (typeof Symbol !== 'undefined')\n Iterator.prototype[Symbol.iterator] = function () {\n return this;\n };\n\n/**\n * Returning an iterator of the given values.\n *\n * @param {any...} values - Values.\n * @return {Iterator}\n */\nIterator.of = function () {\n var args = arguments,\n l = args.length,\n i = 0;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: args[i++]};\n });\n};\n\n/**\n * Returning an empty iterator.\n *\n * @return {Iterator}\n */\nIterator.empty = function () {\n var iterator = new Iterator(function () {\n return {done: true};\n });\n\n return iterator;\n};\n\n/**\n * Returning an iterator over the given indexed sequence.\n *\n * @param {string|Array} sequence - Target sequence.\n * @return {Iterator}\n */\nIterator.fromSequence = function (sequence) {\n var i = 0,\n l = sequence.length;\n\n return new Iterator(function () {\n if (i >= l) return {done: true};\n\n return {done: false, value: sequence[i++]};\n });\n};\n\n/**\n * Returning whether the given value is an iterator.\n *\n * @param {any} value - Value.\n * @return {boolean}\n */\nIterator.is = function (value) {\n if (value instanceof Iterator) return true;\n\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof value.next === 'function'\n );\n};\n\n/**\n * Exporting.\n */\nmodule.exports = Iterator;\n", "exports.ARRAY_BUFFER_SUPPORT = typeof ArrayBuffer !== 'undefined';\nexports.SYMBOL_SUPPORT = typeof Symbol !== 'undefined';\n", "/**\n * Obliterator Iter Function\n * ==========================\n *\n * Function coercing values to an iterator. It can be quite useful when needing\n * to handle iterables and iterators the same way.\n */\nvar Iterator = require('./iterator.js');\nvar support = require('./support.js');\n\nvar ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;\nvar SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;\n\nfunction iterOrNull(target) {\n // Indexed sequence\n if (\n typeof target === 'string' ||\n Array.isArray(target) ||\n (ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(target))\n )\n return Iterator.fromSequence(target);\n\n // Invalid value\n if (typeof target !== 'object' || target === null) return null;\n\n // Iterable\n if (SYMBOL_SUPPORT && typeof target[Symbol.iterator] === 'function')\n return target[Symbol.iterator]();\n\n // Iterator duck-typing\n if (typeof target.next === 'function') return target;\n\n // Invalid object\n return null;\n}\n\nmodule.exports = function iter(target) {\n var iterator = iterOrNull(target);\n\n if (!iterator)\n throw new Error(\n 'obliterator: target is not iterable nor a valid iterator.'\n );\n\n return iterator;\n};\n", "/* eslint no-constant-condition: 0 */\n/**\n * Obliterator Take Function\n * ==========================\n *\n * Function taking n or every value of the given iterator and returns them\n * into an array.\n */\nvar iter = require('./iter.js');\n\n/**\n * Take.\n *\n * @param {Iterable} iterable - Target iterable.\n * @param {number} [n] - Optional number of items to take.\n * @return {array}\n */\nmodule.exports = function take(iterable, n) {\n var l = arguments.length > 1 ? n : Infinity,\n array = l !== Infinity ? new Array(l) : [],\n step,\n i = 0;\n\n var iterator = iter(iterable);\n\n while (true) {\n if (i === l) return array;\n\n step = iterator.next();\n\n if (step.done) {\n if (i !== n) array.length = i;\n\n return array;\n }\n\n array[i++] = step.value;\n }\n};\n", "/**\n * Graphology Custom Errors\n * =========================\n *\n * Defining custom errors for ease of use & easy unit tests across\n * implementations (normalized typology rather than relying on error\n * messages to check whether the correct error was found).\n */\nexport class GraphError extends Error {\n constructor(message) {\n super();\n this.name = 'GraphError';\n this.message = message;\n }\n}\n\nexport class InvalidArgumentsGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'InvalidArgumentsGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(\n this,\n InvalidArgumentsGraphError.prototype.constructor\n );\n }\n}\n\nexport class NotFoundGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'NotFoundGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(this, NotFoundGraphError.prototype.constructor);\n }\n}\n\nexport class UsageGraphError extends GraphError {\n constructor(message) {\n super(message);\n this.name = 'UsageGraphError';\n\n // This is V8 specific to enhance stack readability\n if (typeof Error.captureStackTrace === 'function')\n Error.captureStackTrace(this, UsageGraphError.prototype.constructor);\n }\n}\n", "/**\n * Graphology Internal Data Classes\n * =================================\n *\n * Internal classes hopefully reduced to structs by engines & storing\n * necessary information for nodes & edges.\n *\n * Note that those classes don't rely on the `class` keyword to avoid some\n * cruft introduced by most of ES2015 transpilers.\n */\n\n/**\n * MixedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nexport function MixedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nMixedNodeData.prototype.clear = function () {\n // Degrees\n this.inDegree = 0;\n this.outDegree = 0;\n this.undirectedDegree = 0;\n this.undirectedLoops = 0;\n this.directedLoops = 0;\n\n // Indices\n this.in = {};\n this.out = {};\n this.undirected = {};\n};\n\n/**\n * DirectedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nexport function DirectedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nDirectedNodeData.prototype.clear = function () {\n // Degrees\n this.inDegree = 0;\n this.outDegree = 0;\n this.directedLoops = 0;\n\n // Indices\n this.in = {};\n this.out = {};\n};\n\n/**\n * UndirectedNodeData class.\n *\n * @constructor\n * @param {string} string - The node's key.\n * @param {object} attributes - Node's attributes.\n */\nexport function UndirectedNodeData(key, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n\n this.clear();\n}\n\nUndirectedNodeData.prototype.clear = function () {\n // Degrees\n this.undirectedDegree = 0;\n this.undirectedLoops = 0;\n\n // Indices\n this.undirected = {};\n};\n\n/**\n * EdgeData class.\n *\n * @constructor\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {string} string - The edge's key.\n * @param {string} source - Source of the edge.\n * @param {string} target - Target of the edge.\n * @param {object} attributes - Edge's attributes.\n */\nexport function EdgeData(undirected, key, source, target, attributes) {\n // Attributes\n this.key = key;\n this.attributes = attributes;\n this.undirected = undirected;\n\n // Extremities\n this.source = source;\n this.target = target;\n}\n\nEdgeData.prototype.attach = function () {\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n const source = this.source.key;\n const target = this.target.key;\n\n // Handling source\n this.source[outKey][target] = this;\n\n if (this.undirected && source === target) return;\n\n // Handling target\n this.target[inKey][source] = this;\n};\n\nEdgeData.prototype.attachMulti = function () {\n let outKey = 'out';\n let inKey = 'in';\n\n const source = this.source.key;\n const target = this.target.key;\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n // Handling source\n const adj = this.source[outKey];\n const head = adj[target];\n\n if (typeof head === 'undefined') {\n adj[target] = this;\n\n // Self-loop optimization\n if (!(this.undirected && source === target)) {\n // Handling target\n this.target[inKey][source] = this;\n }\n\n return;\n }\n\n // Prepending to doubly-linked list\n head.previous = this;\n this.next = head;\n\n // Pointing to new head\n // NOTE: use mutating swap later to avoid lookup?\n adj[target] = this;\n this.target[inKey][source] = this;\n};\n\nEdgeData.prototype.detach = function () {\n const source = this.source.key;\n const target = this.target.key;\n\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n delete this.source[outKey][target];\n\n // No-op delete in case of undirected self-loop\n delete this.target[inKey][source];\n};\n\nEdgeData.prototype.detachMulti = function () {\n const source = this.source.key;\n const target = this.target.key;\n\n let outKey = 'out';\n let inKey = 'in';\n\n if (this.undirected) outKey = inKey = 'undirected';\n\n // Deleting from doubly-linked list\n if (this.previous === undefined) {\n // We are dealing with the head\n\n // Should we delete the adjacency entry because it is now empty?\n if (this.next === undefined) {\n delete this.source[outKey][target];\n\n // No-op delete in case of undirected self-loop\n delete this.target[inKey][source];\n } else {\n // Detaching\n this.next.previous = undefined;\n\n // NOTE: could avoid the lookups by creating a #.become mutating method\n this.source[outKey][target] = this.next;\n\n // No-op delete in case of undirected self-loop\n this.target[inKey][source] = this.next;\n }\n } else {\n // We are dealing with another list node\n this.previous.next = this.next;\n\n // If not last\n if (this.next !== undefined) {\n this.next.previous = this.previous;\n }\n }\n};\n", "/**\n * Graphology Node Attributes methods\n * ===================================\n */\nimport {assign, isPlainObject} from '../utils';\n\nimport {InvalidArgumentsGraphError, NotFoundGraphError} from '../errors';\n\nconst NODE = 0;\nconst SOURCE = 1;\nconst TARGET = 2;\nconst OPPOSITE = 3;\n\nfunction findRelevantNodeData(\n graph,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n) {\n let nodeData, edgeData, arg1, arg2;\n\n nodeOrEdge = '' + nodeOrEdge;\n\n if (mode === NODE) {\n nodeData = graph._nodes.get(nodeOrEdge);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nodeOrEdge}\" node in the graph.`\n );\n\n arg1 = nameOrEdge;\n arg2 = add1;\n } else if (mode === OPPOSITE) {\n nameOrEdge = '' + nameOrEdge;\n\n edgeData = graph._edges.get(nameOrEdge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nameOrEdge}\" edge in the graph.`\n );\n\n const source = edgeData.source.key;\n const target = edgeData.target.key;\n\n if (nodeOrEdge === source) {\n nodeData = edgeData.target;\n } else if (nodeOrEdge === target) {\n nodeData = edgeData.source;\n } else {\n throw new NotFoundGraphError(\n `Graph.${method}: the \"${nodeOrEdge}\" node is not attached to the \"${nameOrEdge}\" edge (${source}, ${target}).`\n );\n }\n\n arg1 = add1;\n arg2 = add2;\n } else {\n edgeData = graph._edges.get(nodeOrEdge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${nodeOrEdge}\" edge in the graph.`\n );\n\n if (mode === SOURCE) {\n nodeData = edgeData.source;\n } else {\n nodeData = edgeData.target;\n }\n\n arg1 = nameOrEdge;\n arg2 = add1;\n }\n\n return [nodeData, arg1, arg2];\n}\n\nfunction attachNodeAttributeGetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n return data.attributes[name];\n };\n}\n\nfunction attachNodeAttributesGetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge) {\n const [data] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge\n );\n\n return data.attributes;\n };\n}\n\nfunction attachNodeAttributeChecker(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n return data.attributes.hasOwnProperty(name);\n };\n}\n\nfunction attachNodeAttributeSetter(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1, add2) {\n const [data, name, value] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n );\n\n data.attributes[name] = value;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributeUpdater(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1, add2) {\n const [data, name, updater] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1,\n add2\n );\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: updater should be a function.`\n );\n\n const attributes = data.attributes;\n const value = updater(attributes[name]);\n\n attributes[name] = value;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributeRemover(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, name] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n delete data.attributes[name];\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'remove',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesReplacer(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, attributes] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n data.attributes = attributes;\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'replace',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesMerger(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, attributes] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n assign(data.attributes, attributes);\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'merge',\n attributes: data.attributes,\n data: attributes\n });\n\n return this;\n };\n}\n\nfunction attachNodeAttributesUpdater(Class, method, mode) {\n Class.prototype[method] = function (nodeOrEdge, nameOrEdge, add1) {\n const [data, updater] = findRelevantNodeData(\n this,\n method,\n mode,\n nodeOrEdge,\n nameOrEdge,\n add1\n );\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided updater is not a function.`\n );\n\n data.attributes = updater(data.attributes);\n\n // Emitting\n this.emit('nodeAttributesUpdated', {\n key: data.key,\n type: 'update',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * List of methods to attach.\n */\nconst NODE_ATTRIBUTES_METHODS = [\n {\n name: element => `get${element}Attribute`,\n attacher: attachNodeAttributeGetter\n },\n {\n name: element => `get${element}Attributes`,\n attacher: attachNodeAttributesGetter\n },\n {\n name: element => `has${element}Attribute`,\n attacher: attachNodeAttributeChecker\n },\n {\n name: element => `set${element}Attribute`,\n attacher: attachNodeAttributeSetter\n },\n {\n name: element => `update${element}Attribute`,\n attacher: attachNodeAttributeUpdater\n },\n {\n name: element => `remove${element}Attribute`,\n attacher: attachNodeAttributeRemover\n },\n {\n name: element => `replace${element}Attributes`,\n attacher: attachNodeAttributesReplacer\n },\n {\n name: element => `merge${element}Attributes`,\n attacher: attachNodeAttributesMerger\n },\n {\n name: element => `update${element}Attributes`,\n attacher: attachNodeAttributesUpdater\n }\n];\n\n/**\n * Attach every attributes-related methods to a Graph class.\n *\n * @param {function} Graph - Target class.\n */\nexport default function attachNodeAttributesMethods(Graph) {\n NODE_ATTRIBUTES_METHODS.forEach(function ({name, attacher}) {\n // For nodes\n attacher(Graph, name('Node'), NODE);\n\n // For sources\n attacher(Graph, name('Source'), SOURCE);\n\n // For targets\n attacher(Graph, name('Target'), TARGET);\n\n // For opposites\n attacher(Graph, name('Opposite'), OPPOSITE);\n });\n}\n", "/**\n * Graphology Edge Attributes methods\n * ===================================\n */\nimport {assign, isPlainObject, getMatchingEdge} from '../utils';\n\nimport {\n InvalidArgumentsGraphError,\n NotFoundGraphError,\n UsageGraphError\n} from '../errors';\n\n/**\n * Attach an attribute getter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeGetter(Class, method, type) {\n /**\n * Get the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {mixed} - The attribute's value.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes[name];\n };\n}\n\n/**\n * Attach an attributes getter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesGetter(Class, method, type) {\n /**\n * Retrieves all the target element's attributes.\n *\n * Arity 2:\n * @param {any} element - Target element.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n *\n * @return {object} - The element's attributes.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 1) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element,\n target = '' + arguments[1];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes;\n };\n}\n\n/**\n * Attach an attribute checker method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeChecker(Class, method, type) {\n /**\n * Checks whether the desired attribute is set for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n return data.attributes.hasOwnProperty(name);\n };\n}\n\n/**\n * Attach an attribute setter method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeSetter(Class, method, type) {\n /**\n * Set the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n * @param {mixed} value - New attribute value.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n * @param {mixed} value - New attribute value.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name, value) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 3) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n value = arguments[3];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n data.attributes[name] = value;\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute updater method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeUpdater(Class, method, type) {\n /**\n * Update the desired attribute for the given element (node or edge) using\n * the provided function.\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n * @param {function} updater - Updater function.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n * @param {function} updater - Updater function.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name, updater) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 3) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n updater = arguments[3];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: updater should be a function.`\n );\n\n data.attributes[name] = updater(data.attributes[name]);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'set',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute remover method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributeRemover(Class, method, type) {\n /**\n * Remove the desired attribute for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {string} name - Attribute's name.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {string} name - Attribute's name.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, name) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element;\n const target = '' + name;\n\n name = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n delete data.attributes[name];\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'remove',\n attributes: data.attributes,\n name\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute replacer method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesReplacer(Class, method, type) {\n /**\n * Replace the attributes for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {object} attributes - New attributes.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {object} attributes - New attributes.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, attributes) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element,\n target = '' + attributes;\n\n attributes = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n data.attributes = attributes;\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'replace',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute merger method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesMerger(Class, method, type) {\n /**\n * Merge the attributes for the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {object} attributes - Attributes to merge.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {object} attributes - Attributes to merge.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, attributes) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element,\n target = '' + attributes;\n\n attributes = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided attributes are not a plain object.`\n );\n\n assign(data.attributes, attributes);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'merge',\n attributes: data.attributes,\n data: attributes\n });\n\n return this;\n };\n}\n\n/**\n * Attach an attribute updater method onto the provided class.\n *\n * @param {function} Class - Target class.\n * @param {string} method - Method name.\n * @param {string} type - Type of the edge to find.\n */\nfunction attachEdgeAttributesUpdater(Class, method, type) {\n /**\n * Update the attributes of the given element (node or edge).\n *\n * Arity 2:\n * @param {any} element - Target element.\n * @param {function} updater - Updater function.\n *\n * Arity 3 (only for edges):\n * @param {any} source - Source element.\n * @param {any} target - Target element.\n * @param {function} updater - Updater function.\n *\n * @return {Graph} - Returns itself for chaining.\n *\n * @throws {Error} - Will throw if too many arguments are provided.\n * @throws {Error} - Will throw if any of the elements is not found.\n */\n Class.prototype[method] = function (element, updater) {\n let data;\n\n if (this.type !== 'mixed' && type !== 'mixed' && type !== this.type)\n throw new UsageGraphError(\n `Graph.${method}: cannot find this type of edges in your ${this.type} graph.`\n );\n\n if (arguments.length > 2) {\n if (this.multi)\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n const source = '' + element,\n target = '' + updater;\n\n updater = arguments[2];\n\n data = getMatchingEdge(this, source, target, type);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find an edge for the given path (\"${source}\" - \"${target}\").`\n );\n } else {\n if (type !== 'mixed')\n throw new UsageGraphError(\n `Graph.${method}: 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.`\n );\n\n element = '' + element;\n data = this._edges.get(element);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.${method}: could not find the \"${element}\" edge in the graph.`\n );\n }\n\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${method}: provided updater is not a function.`\n );\n\n data.attributes = updater(data.attributes);\n\n // Emitting\n this.emit('edgeAttributesUpdated', {\n key: data.key,\n type: 'update',\n attributes: data.attributes\n });\n\n return this;\n };\n}\n\n/**\n * List of methods to attach.\n */\nconst EDGE_ATTRIBUTES_METHODS = [\n {\n name: element => `get${element}Attribute`,\n attacher: attachEdgeAttributeGetter\n },\n {\n name: element => `get${element}Attributes`,\n attacher: attachEdgeAttributesGetter\n },\n {\n name: element => `has${element}Attribute`,\n attacher: attachEdgeAttributeChecker\n },\n {\n name: element => `set${element}Attribute`,\n attacher: attachEdgeAttributeSetter\n },\n {\n name: element => `update${element}Attribute`,\n attacher: attachEdgeAttributeUpdater\n },\n {\n name: element => `remove${element}Attribute`,\n attacher: attachEdgeAttributeRemover\n },\n {\n name: element => `replace${element}Attributes`,\n attacher: attachEdgeAttributesReplacer\n },\n {\n name: element => `merge${element}Attributes`,\n attacher: attachEdgeAttributesMerger\n },\n {\n name: element => `update${element}Attributes`,\n attacher: attachEdgeAttributesUpdater\n }\n];\n\n/**\n * Attach every attributes-related methods to a Graph class.\n *\n * @param {function} Graph - Target class.\n */\nexport default function attachEdgeAttributesMethods(Graph) {\n EDGE_ATTRIBUTES_METHODS.forEach(function ({name, attacher}) {\n // For edges\n attacher(Graph, name('Edge'), 'mixed');\n\n // For directed edges\n attacher(Graph, name('DirectedEdge'), 'directed');\n\n // For undirected edges\n attacher(Graph, name('UndirectedEdge'), 'undirected');\n });\n}\n", "/**\n * Obliterator Chain Function\n * ===========================\n *\n * Variadic function combining the given iterables.\n */\nvar Iterator = require('./iterator.js');\nvar iter = require('./iter.js');\n\n/**\n * Chain.\n *\n * @param {...Iterator} iterables - Target iterables.\n * @return {Iterator}\n */\nmodule.exports = function chain() {\n var iterables = arguments;\n var current = null;\n var i = -1;\n\n /* eslint-disable no-constant-condition */\n return new Iterator(function next() {\n var step = null;\n\n do {\n if (current === null) {\n i++;\n\n if (i >= iterables.length) return {done: true};\n\n current = iter(iterables[i]);\n }\n\n step = current.next();\n\n if (step.done === true) {\n current = null;\n continue;\n }\n\n break;\n } while (true);\n\n return step;\n });\n};\n", "/**\n * Graphology Edge Iteration\n * ==========================\n *\n * Attaching some methods to the Graph class to be able to iterate over a\n * graph's edges.\n */\nimport Iterator from 'obliterator/iterator';\nimport chain from 'obliterator/chain';\nimport take from 'obliterator/take';\n\nimport {InvalidArgumentsGraphError, NotFoundGraphError} from '../errors';\n\n/**\n * Definitions.\n */\nconst EDGES_ITERATION = [\n {\n name: 'edges',\n type: 'mixed'\n },\n {\n name: 'inEdges',\n type: 'directed',\n direction: 'in'\n },\n {\n name: 'outEdges',\n type: 'directed',\n direction: 'out'\n },\n {\n name: 'inboundEdges',\n type: 'mixed',\n direction: 'in'\n },\n {\n name: 'outboundEdges',\n type: 'mixed',\n direction: 'out'\n },\n {\n name: 'directedEdges',\n type: 'directed'\n },\n {\n name: 'undirectedEdges',\n type: 'undirected'\n }\n];\n\n/**\n * Function iterating over edges from the given object to match one of them.\n *\n * @param {object} object - Target object.\n * @param {function} callback - Function to call.\n */\nfunction forEachSimple(breakable, object, callback, avoid) {\n let shouldBreak = false;\n\n for (const k in object) {\n if (k === avoid) continue;\n\n const edgeData = object[k];\n\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n edgeData.source.key,\n edgeData.target.key,\n edgeData.source.attributes,\n edgeData.target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n }\n\n return;\n}\n\nfunction forEachMulti(breakable, object, callback, avoid) {\n let edgeData, source, target;\n\n let shouldBreak = false;\n\n for (const k in object) {\n if (k === avoid) continue;\n\n edgeData = object[k];\n\n do {\n source = edgeData.source;\n target = edgeData.target;\n\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n source.key,\n target.key,\n source.attributes,\n target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n\n edgeData = edgeData.next;\n } while (edgeData !== undefined);\n }\n\n return;\n}\n\n/**\n * Function returning an iterator over edges from the given object.\n *\n * @param {object} object - Target object.\n * @return {Iterator}\n */\nfunction createIterator(object, avoid) {\n const keys = Object.keys(object);\n const l = keys.length;\n\n let edgeData;\n let i = 0;\n\n return new Iterator(function next() {\n do {\n if (!edgeData) {\n if (i >= l) return {done: true};\n\n const k = keys[i++];\n\n if (k === avoid) {\n edgeData = undefined;\n continue;\n }\n\n edgeData = object[k];\n } else {\n edgeData = edgeData.next;\n }\n } while (!edgeData);\n\n return {\n done: false,\n value: {\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n }\n };\n });\n}\n\n/**\n * Function iterating over the egdes from the object at given key to match\n * one of them.\n *\n * @param {object} object - Target object.\n * @param {mixed} k - Neighbor key.\n * @param {function} callback - Callback to use.\n */\nfunction forEachForKeySimple(breakable, object, k, callback) {\n const edgeData = object[k];\n\n if (!edgeData) return;\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n if (\n callback(\n edgeData.key,\n edgeData.attributes,\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.undirected\n ) &&\n breakable\n )\n return edgeData.key;\n}\n\nfunction forEachForKeyMulti(breakable, object, k, callback) {\n let edgeData = object[k];\n\n if (!edgeData) return;\n\n let shouldBreak = false;\n\n do {\n shouldBreak = callback(\n edgeData.key,\n edgeData.attributes,\n edgeData.source.key,\n edgeData.target.key,\n edgeData.source.attributes,\n edgeData.target.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData.key;\n\n edgeData = edgeData.next;\n } while (edgeData !== undefined);\n\n return;\n}\n\n/**\n * Function returning an iterator over the egdes from the object at given key.\n *\n * @param {object} object - Target object.\n * @param {mixed} k - Neighbor key.\n * @return {Iterator}\n */\nfunction createIteratorForKey(object, k) {\n let edgeData = object[k];\n\n if (edgeData.next !== undefined) {\n return new Iterator(function () {\n if (!edgeData) return {done: true};\n\n const value = {\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n };\n\n edgeData = edgeData.next;\n\n return {\n done: false,\n value\n };\n });\n }\n\n return Iterator.of({\n edge: edgeData.key,\n attributes: edgeData.attributes,\n source: edgeData.source.key,\n target: edgeData.target.key,\n sourceAttributes: edgeData.source.attributes,\n targetAttributes: edgeData.target.attributes,\n undirected: edgeData.undirected\n });\n}\n\n/**\n * Function creating an array of edges for the given type.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArray(graph, type) {\n if (graph.size === 0) return [];\n\n if (type === 'mixed' || type === graph.type) {\n if (typeof Array.from === 'function')\n return Array.from(graph._edges.keys());\n\n return take(graph._edges.keys(), graph._edges.size);\n }\n\n const size =\n type === 'undirected' ? graph.undirectedSize : graph.directedSize;\n\n const list = new Array(size),\n mask = type === 'undirected';\n\n const iterator = graph._edges.values();\n\n let i = 0;\n let step, data;\n\n while (((step = iterator.next()), step.done !== true)) {\n data = step.value;\n\n if (data.undirected === mask) list[i++] = data.key;\n }\n\n return list;\n}\n\n/**\n * Function iterating over a graph's edges using a callback to match one of\n * them.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdge(breakable, graph, type, callback) {\n if (graph.size === 0) return;\n\n const shouldFilter = type !== 'mixed' && type !== graph.type;\n const mask = type === 'undirected';\n\n let step, data;\n let shouldBreak = false;\n const iterator = graph._edges.values();\n\n while (((step = iterator.next()), step.done !== true)) {\n data = step.value;\n\n if (shouldFilter && data.undirected !== mask) continue;\n\n const {key, attributes, source, target} = data;\n\n shouldBreak = callback(\n key,\n attributes,\n source.key,\n target.key,\n source.attributes,\n target.attributes,\n data.undirected\n );\n\n if (breakable && shouldBreak) return key;\n }\n\n return;\n}\n\n/**\n * Function creating an iterator of edges for the given type.\n *\n * @param {Graph} graph - Target Graph instance.\n * @param {string} type - Type of edges to retrieve.\n * @return {Iterator}\n */\nfunction createEdgeIterator(graph, type) {\n if (graph.size === 0) return Iterator.empty();\n\n const shouldFilter = type !== 'mixed' && type !== graph.type;\n const mask = type === 'undirected';\n\n const iterator = graph._edges.values();\n\n return new Iterator(function next() {\n let step, data;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n step = iterator.next();\n\n if (step.done) return step;\n\n data = step.value;\n\n if (shouldFilter && data.undirected !== mask) continue;\n\n break;\n }\n\n const value = {\n edge: data.key,\n attributes: data.attributes,\n source: data.source.key,\n target: data.target.key,\n sourceAttributes: data.source.attributes,\n targetAttributes: data.target.attributes,\n undirected: data.undirected\n };\n\n return {value, done: false};\n });\n}\n\n/**\n * Function iterating over a node's edges using a callback to match one of them.\n *\n * @param {boolean} multi - Whether the graph is multi or not.\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdgeForNode(\n breakable,\n multi,\n type,\n direction,\n nodeData,\n callback\n) {\n const fn = multi ? forEachMulti : forEachSimple;\n\n let found;\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n found = fn(breakable, nodeData.in, callback);\n\n if (breakable && found) return found;\n }\n if (direction !== 'in') {\n found = fn(\n breakable,\n nodeData.out,\n callback,\n !direction ? nodeData.key : undefined\n );\n\n if (breakable && found) return found;\n }\n }\n\n if (type !== 'directed') {\n found = fn(breakable, nodeData.undirected, callback);\n\n if (breakable && found) return found;\n }\n\n return;\n}\n\n/**\n * Function creating an array of edges for the given type & the given node.\n *\n * @param {boolean} multi - Whether the graph is multi or not.\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArrayForNode(multi, type, direction, nodeData) {\n const edges = []; // TODO: possibility to know size beforehand or factorize with map\n\n forEachEdgeForNode(false, multi, type, direction, nodeData, function (key) {\n edges.push(key);\n });\n\n return edges;\n}\n\n/**\n * Function iterating over a node's edges using a callback.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {any} nodeData - Target node's data.\n * @return {Iterator}\n */\nfunction createEdgeIteratorForNode(type, direction, nodeData) {\n let iterator = Iterator.empty();\n\n if (type !== 'undirected') {\n if (direction !== 'out' && typeof nodeData.in !== 'undefined')\n iterator = chain(iterator, createIterator(nodeData.in));\n if (direction !== 'in' && typeof nodeData.out !== 'undefined')\n iterator = chain(\n iterator,\n createIterator(nodeData.out, !direction ? nodeData.key : undefined)\n );\n }\n\n if (type !== 'directed' && typeof nodeData.undirected !== 'undefined') {\n iterator = chain(iterator, createIterator(nodeData.undirected));\n }\n\n return iterator;\n}\n\n/**\n * Function iterating over edges for the given path using a callback to match\n * one of them.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {boolean} multi - Whether the graph is multi.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {string} target - Target node.\n * @param {function} callback - Function to call.\n */\nfunction forEachEdgeForPath(\n breakable,\n type,\n multi,\n direction,\n sourceData,\n target,\n callback\n) {\n const fn = multi ? forEachForKeyMulti : forEachForKeySimple;\n\n let found;\n\n if (type !== 'undirected') {\n if (typeof sourceData.in !== 'undefined' && direction !== 'out') {\n found = fn(breakable, sourceData.in, target, callback);\n\n if (breakable && found) return found;\n }\n\n if (\n typeof sourceData.out !== 'undefined' &&\n direction !== 'in' &&\n (direction || sourceData.key !== target)\n ) {\n found = fn(breakable, sourceData.out, target, callback);\n\n if (breakable && found) return found;\n }\n }\n\n if (type !== 'directed') {\n if (typeof sourceData.undirected !== 'undefined') {\n found = fn(breakable, sourceData.undirected, target, callback);\n\n if (breakable && found) return found;\n }\n }\n\n return;\n}\n\n/**\n * Function creating an array of edges for the given path.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {boolean} multi - Whether the graph is multi.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {any} target - Target node.\n * @return {array} - Array of edges.\n */\nfunction createEdgeArrayForPath(type, multi, direction, sourceData, target) {\n const edges = []; // TODO: possibility to know size beforehand or factorize with map\n\n forEachEdgeForPath(\n false,\n type,\n multi,\n direction,\n sourceData,\n target,\n function (key) {\n edges.push(key);\n }\n );\n\n return edges;\n}\n\n/**\n * Function returning an iterator over edges for the given path.\n *\n * @param {string} type - Type of edges to retrieve.\n * @param {string} direction - In or out?\n * @param {NodeData} sourceData - Source node's data.\n * @param {string} target - Target node.\n * @param {function} callback - Function to call.\n */\nfunction createEdgeIteratorForPath(type, direction, sourceData, target) {\n let iterator = Iterator.empty();\n\n if (type !== 'undirected') {\n if (\n typeof sourceData.in !== 'undefined' &&\n direction !== 'out' &&\n target in sourceData.in\n )\n iterator = chain(iterator, createIteratorForKey(sourceData.in, target));\n\n if (\n typeof sourceData.out !== 'undefined' &&\n direction !== 'in' &&\n target in sourceData.out &&\n (direction || sourceData.key !== target)\n )\n iterator = chain(iterator, createIteratorForKey(sourceData.out, target));\n }\n\n if (type !== 'directed') {\n if (\n typeof sourceData.undirected !== 'undefined' &&\n target in sourceData.undirected\n )\n iterator = chain(\n iterator,\n createIteratorForKey(sourceData.undirected, target)\n );\n }\n\n return iterator;\n}\n\n/**\n * Function attaching an edge array creator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachEdgeArrayCreator(Class, description) {\n const {name, type, direction} = description;\n\n /**\n * Function returning an array of certain edges.\n *\n * Arity 0: Return all the relevant edges.\n *\n * Arity 1: Return all of a node's relevant edges.\n * @param {any} node - Target node.\n *\n * Arity 2: Return the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {array|number} - The edges or the number of edges.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[name] = function (source, target) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return [];\n\n if (!arguments.length) return createEdgeArray(this, type);\n\n if (arguments.length === 1) {\n source = '' + source;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n return createEdgeArrayForNode(\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return createEdgeArrayForPath(\n type,\n this.multi,\n direction,\n sourceData,\n target\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`\n );\n };\n}\n\n/**\n * Function attaching a edge callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachForEachEdge(Class, description) {\n const {name, type, direction} = description;\n\n const forEachName = 'forEach' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over the graph's relevant edges by applying the given\n * callback.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[forEachName] = function (source, target, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n if (arguments.length === 1) {\n callback = source;\n return forEachEdge(false, this, type, callback);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n callback = target;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n // TODO: maybe attach the sub method to the instance dynamically?\n return forEachEdgeForNode(\n false,\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n }\n\n if (arguments.length === 3) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return forEachEdgeForPath(\n false,\n type,\n this.multi,\n direction,\n sourceData,\n target,\n callback\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${forEachName}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`\n );\n };\n\n /**\n * Function mapping the graph's relevant edges by applying the given\n * callback.\n *\n * Arity 1: Map all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Map all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Map the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const mapName = 'map' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[mapName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n let result;\n\n // We know the result length beforehand\n if (args.length === 0) {\n let length = 0;\n\n if (type !== 'directed') length += this.undirectedSize;\n if (type !== 'undirected') length += this.directedSize;\n\n result = new Array(length);\n\n let i = 0;\n\n args.push((e, ea, s, t, sa, ta, u) => {\n result[i++] = callback(e, ea, s, t, sa, ta, u);\n });\n }\n\n // We don't know the result length beforehand\n // TODO: we can in some instances of simple graphs, knowing degree\n else {\n result = [];\n\n args.push((e, ea, s, t, sa, ta, u) => {\n result.push(callback(e, ea, s, t, sa, ta, u));\n });\n }\n\n this[forEachName].apply(this, args);\n\n return result;\n };\n\n /**\n * Function filtering the graph's relevant edges using the provided predicate\n * function.\n *\n * Arity 1: Filter all the relevant edges.\n * @param {function} predicate - Predicate to use.\n *\n * Arity 2: Filter all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} predicate - Predicate to use.\n *\n * Arity 3: Filter the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} predicate - Predicate to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const filterName = 'filter' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[filterName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n const result = [];\n\n args.push((e, ea, s, t, sa, ta, u) => {\n if (callback(e, ea, s, t, sa, ta, u)) result.push(e);\n });\n\n this[forEachName].apply(this, args);\n\n return result;\n };\n\n /**\n * Function reducing the graph's relevant edges using the provided accumulator\n * function.\n *\n * Arity 1: Reduce all the relevant edges.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * Arity 2: Reduce all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * Arity 3: Reduce the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} accumulator - Accumulator to use.\n * @param {any} initialValue - Initial value.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const reduceName = 'reduce' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[reduceName] = function () {\n let args = Array.prototype.slice.call(arguments);\n\n if (args.length < 2 || args.length > 4) {\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: invalid number of arguments (expecting 2, 3 or 4 and got ${args.length}).`\n );\n }\n\n if (\n typeof args[args.length - 1] === 'function' &&\n typeof args[args.length - 2] !== 'function'\n ) {\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: 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.`\n );\n }\n\n let callback;\n let initialValue;\n\n if (args.length === 2) {\n callback = args[0];\n initialValue = args[1];\n args = [];\n } else if (args.length === 3) {\n callback = args[1];\n initialValue = args[2];\n args = [args[0]];\n } else if (args.length === 4) {\n callback = args[2];\n initialValue = args[3];\n args = [args[0], args[1]];\n }\n\n let accumulator = initialValue;\n\n args.push((e, ea, s, t, sa, ta, u) => {\n accumulator = callback(accumulator, e, ea, s, t, sa, ta, u);\n });\n\n this[forEachName].apply(this, args);\n\n return accumulator;\n };\n}\n\n/**\n * Function attaching a breakable edge callback iterator method to the Graph\n * prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachFindEdge(Class, description) {\n const {name, type, direction} = description;\n\n const findEdgeName = 'find' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over the graph's relevant edges in order to match\n * one of them using the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[findEdgeName] = function (source, target, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return false;\n\n if (arguments.length === 1) {\n callback = source;\n return forEachEdge(true, this, type, callback);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n callback = target;\n\n const nodeData = this._nodes.get(source);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n // TODO: maybe attach the sub method to the instance dynamically?\n return forEachEdgeForNode(\n true,\n this.multi,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n }\n\n if (arguments.length === 3) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${findEdgeName}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return forEachEdgeForPath(\n true,\n type,\n this.multi,\n direction,\n sourceData,\n target,\n callback\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${findEdgeName}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`\n );\n };\n\n /**\n * Function iterating over the graph's relevant edges in order to assert\n * whether any one of them matches the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const someName = 'some' + name[0].toUpperCase() + name.slice(1, -1);\n\n Class.prototype[someName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n args.push((e, ea, s, t, sa, ta, u) => {\n return callback(e, ea, s, t, sa, ta, u);\n });\n\n const found = this[findEdgeName].apply(this, args);\n\n if (found) return true;\n\n return false;\n };\n\n /**\n * Function iterating over the graph's relevant edges in order to assert\n * whether all of them matche the provided predicate function.\n *\n * Arity 1: Iterate over all the relevant edges.\n * @param {function} callback - Callback to use.\n *\n * Arity 2: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * Arity 3: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n * @param {function} callback - Callback to use.\n *\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const everyName = 'every' + name[0].toUpperCase() + name.slice(1, -1);\n\n Class.prototype[everyName] = function () {\n const args = Array.prototype.slice.call(arguments);\n const callback = args.pop();\n\n args.push((e, ea, s, t, sa, ta, u) => {\n return !callback(e, ea, s, t, sa, ta, u);\n });\n\n const found = this[findEdgeName].apply(this, args);\n\n if (found) return false;\n\n return true;\n };\n}\n\n/**\n * Function attaching an edge iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachEdgeIteratorCreator(Class, description) {\n const {name: originalName, type, direction} = description;\n\n const name = originalName.slice(0, -1) + 'Entries';\n\n /**\n * Function returning an iterator over the graph's edges.\n *\n * Arity 0: Iterate over all the relevant edges.\n *\n * Arity 1: Iterate over all of a node's relevant edges.\n * @param {any} node - Target node.\n *\n * Arity 2: Iterate over the relevant edges across the given path.\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {array|number} - The edges or the number of edges.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[name] = function (source, target) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return Iterator.empty();\n\n if (!arguments.length) return createEdgeIterator(this, type);\n\n if (arguments.length === 1) {\n source = '' + source;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" node in the graph.`\n );\n\n // Iterating over a node's edges\n return createEdgeIteratorForNode(type, direction, sourceData);\n }\n\n if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${target}\" target node in the graph.`\n );\n\n // Iterating over the edges between source & target\n return createEdgeIteratorForPath(type, direction, sourceData, target);\n }\n\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`\n );\n };\n}\n\n/**\n * Function attaching every edge iteration method to the Graph class.\n *\n * @param {function} Graph - Graph class.\n */\nexport default function attachEdgeIterationMethods(Graph) {\n EDGES_ITERATION.forEach(description => {\n attachEdgeArrayCreator(Graph, description);\n attachForEachEdge(Graph, description);\n attachFindEdge(Graph, description);\n attachEdgeIteratorCreator(Graph, description);\n });\n}\n", "/**\n * Graphology Neighbor Iteration\n * ==============================\n *\n * Attaching some methods to the Graph class to be able to iterate over\n * neighbors.\n */\nimport Iterator from 'obliterator/iterator';\nimport chain from 'obliterator/chain';\n\nimport {NotFoundGraphError, InvalidArgumentsGraphError} from '../errors';\n\n/**\n * Definitions.\n */\nconst NEIGHBORS_ITERATION = [\n {\n name: 'neighbors',\n type: 'mixed'\n },\n {\n name: 'inNeighbors',\n type: 'directed',\n direction: 'in'\n },\n {\n name: 'outNeighbors',\n type: 'directed',\n direction: 'out'\n },\n {\n name: 'inboundNeighbors',\n type: 'mixed',\n direction: 'in'\n },\n {\n name: 'outboundNeighbors',\n type: 'mixed',\n direction: 'out'\n },\n {\n name: 'directedNeighbors',\n type: 'directed'\n },\n {\n name: 'undirectedNeighbors',\n type: 'undirected'\n }\n];\n\n/**\n * Helpers.\n */\nfunction CompositeSetWrapper() {\n this.A = null;\n this.B = null;\n}\n\nCompositeSetWrapper.prototype.wrap = function (set) {\n if (this.A === null) this.A = set;\n else if (this.B === null) this.B = set;\n};\n\nCompositeSetWrapper.prototype.has = function (key) {\n if (this.A !== null && key in this.A) return true;\n if (this.B !== null && key in this.B) return true;\n return false;\n};\n\n/**\n * Function iterating over the given node's relevant neighbors to match\n * one of them using a predicated function.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @param {function} callback - Callback to use.\n */\nfunction forEachInObjectOnce(breakable, visited, nodeData, object, callback) {\n for (const k in object) {\n const edgeData = object[k];\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n const neighborData = sourceData === nodeData ? targetData : sourceData;\n\n if (visited && visited.has(neighborData.key)) continue;\n\n const shouldBreak = callback(neighborData.key, neighborData.attributes);\n\n if (breakable && shouldBreak) return neighborData.key;\n }\n\n return;\n}\n\nfunction forEachNeighbor(breakable, type, direction, nodeData, callback) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected')\n return forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData.undirected,\n callback\n );\n\n if (typeof direction === 'string')\n return forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData[direction],\n callback\n );\n }\n\n // Else we need to keep a set of neighbors not to return duplicates\n // We cheat by querying the other adjacencies\n const visited = new CompositeSetWrapper();\n\n let found;\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n found = forEachInObjectOnce(\n breakable,\n null,\n nodeData,\n nodeData.in,\n callback\n );\n\n if (breakable && found) return found;\n\n visited.wrap(nodeData.in);\n }\n if (direction !== 'in') {\n found = forEachInObjectOnce(\n breakable,\n visited,\n nodeData,\n nodeData.out,\n callback\n );\n\n if (breakable && found) return found;\n\n visited.wrap(nodeData.out);\n }\n }\n\n if (type !== 'directed') {\n found = forEachInObjectOnce(\n breakable,\n visited,\n nodeData,\n nodeData.undirected,\n callback\n );\n\n if (breakable && found) return found;\n }\n\n return;\n}\n\n/**\n * Function creating an array of relevant neighbors for the given node.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @return {Array} - The list of neighbors.\n */\nfunction createNeighborArrayForNode(type, direction, nodeData) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected') return Object.keys(nodeData.undirected);\n\n if (typeof direction === 'string') return Object.keys(nodeData[direction]);\n }\n\n const neighbors = [];\n\n forEachNeighbor(false, type, direction, nodeData, function (key) {\n neighbors.push(key);\n });\n\n return neighbors;\n}\n\n/**\n * Function returning an iterator over the given node's relevant neighbors.\n *\n * @param {string} type - Type of neighbors.\n * @param {string} direction - Direction.\n * @param {any} nodeData - Target node's data.\n * @return {Iterator}\n */\nfunction createDedupedObjectIterator(visited, nodeData, object) {\n const keys = Object.keys(object);\n const l = keys.length;\n\n let i = 0;\n\n return new Iterator(function next() {\n let neighborData = null;\n\n do {\n if (i >= l) {\n if (visited) visited.wrap(object);\n return {done: true};\n }\n\n const edgeData = object[keys[i++]];\n\n const sourceData = edgeData.source;\n const targetData = edgeData.target;\n\n neighborData = sourceData === nodeData ? targetData : sourceData;\n\n if (visited && visited.has(neighborData.key)) {\n neighborData = null;\n continue;\n }\n } while (neighborData === null);\n\n return {\n done: false,\n value: {neighbor: neighborData.key, attributes: neighborData.attributes}\n };\n });\n}\n\nfunction createNeighborIterator(type, direction, nodeData) {\n // If we want only undirected or in or out, we can roll some optimizations\n if (type !== 'mixed') {\n if (type === 'undirected')\n return createDedupedObjectIterator(null, nodeData, nodeData.undirected);\n\n if (typeof direction === 'string')\n return createDedupedObjectIterator(null, nodeData, nodeData[direction]);\n }\n\n let iterator = Iterator.empty();\n\n // Else we need to keep a set of neighbors not to return duplicates\n // We cheat by querying the other adjacencies\n const visited = new CompositeSetWrapper();\n\n if (type !== 'undirected') {\n if (direction !== 'out') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.in)\n );\n }\n if (direction !== 'in') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.out)\n );\n }\n }\n\n if (type !== 'directed') {\n iterator = chain(\n iterator,\n createDedupedObjectIterator(visited, nodeData, nodeData.undirected)\n );\n }\n\n return iterator;\n}\n\n/**\n * Function attaching a neighbors array creator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachNeighborArrayCreator(Class, description) {\n const {name, type, direction} = description;\n\n /**\n * Function returning an array of certain neighbors.\n *\n * @param {any} node - Target node.\n * @return {array} - The neighbors of neighbors.\n *\n * @throws {Error} - Will throw if node is not found in the graph.\n */\n Class.prototype[name] = function (node) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return [];\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${name}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return createNeighborArrayForNode(\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n };\n}\n\n/**\n * Function attaching a neighbors callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachForEachNeighbor(Class, description) {\n const {name, type, direction} = description;\n\n const forEachName = 'forEach' + name[0].toUpperCase() + name.slice(1, -1);\n\n /**\n * Function iterating over all the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[forEachName] = function (node, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${forEachName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n forEachNeighbor(\n false,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n };\n\n /**\n * Function mapping the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const mapName = 'map' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[mapName] = function (node, callback) {\n // TODO: optimize when size is known beforehand\n const result = [];\n\n this[forEachName](node, (n, a) => {\n result.push(callback(n, a));\n });\n\n return result;\n };\n\n /**\n * Function filtering the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const filterName = 'filter' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[filterName] = function (node, callback) {\n const result = [];\n\n this[forEachName](node, (n, a) => {\n if (callback(n, a)) result.push(n);\n });\n\n return result;\n };\n\n /**\n * Function reducing the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const reduceName = 'reduce' + name[0].toUpperCase() + name.slice(1);\n\n Class.prototype[reduceName] = function (node, callback, initialValue) {\n if (arguments.length < 3)\n throw new InvalidArgumentsGraphError(\n `Graph.${reduceName}: 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.`\n );\n\n let accumulator = initialValue;\n\n this[forEachName](node, (n, a) => {\n accumulator = callback(accumulator, n, a);\n });\n\n return accumulator;\n };\n}\n\n/**\n * Function attaching a breakable neighbors callback iterator method to the\n * Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachFindNeighbor(Class, description) {\n const {name, type, direction} = description;\n\n const capitalizedSingular = name[0].toUpperCase() + name.slice(1, -1);\n\n const findName = 'find' + capitalizedSingular;\n\n /**\n * Function iterating over all the relevant neighbors using a callback.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {undefined}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[findName] = function (node, callback) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type) return;\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${findName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return forEachNeighbor(\n true,\n type === 'mixed' ? this.type : type,\n direction,\n nodeData,\n callback\n );\n };\n\n /**\n * Function iterating over all the relevant neighbors to find if any of them\n * matches the given predicate.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const someName = 'some' + capitalizedSingular;\n\n Class.prototype[someName] = function (node, callback) {\n const found = this[findName](node, callback);\n\n if (found) return true;\n\n return false;\n };\n\n /**\n * Function iterating over all the relevant neighbors to find if all of them\n * matche the given predicate.\n *\n * @param {any} node - Target node.\n * @param {function} callback - Callback to use.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n const everyName = 'every' + capitalizedSingular;\n\n Class.prototype[everyName] = function (node, callback) {\n const found = this[findName](node, (n, a) => {\n return !callback(n, a);\n });\n\n if (found) return false;\n\n return true;\n };\n}\n\n/**\n * Function attaching a neighbors callback iterator method to the Graph prototype.\n *\n * @param {function} Class - Target class.\n * @param {object} description - Method description.\n */\nfunction attachNeighborIteratorCreator(Class, description) {\n const {name, type, direction} = description;\n\n const iteratorName = name.slice(0, -1) + 'Entries';\n\n /**\n * Function returning an iterator over all the relevant neighbors.\n *\n * @param {any} node - Target node.\n * @return {Iterator}\n *\n * @throws {Error} - Will throw if there are too many arguments.\n */\n Class.prototype[iteratorName] = function (node) {\n // Early termination\n if (type !== 'mixed' && this.type !== 'mixed' && type !== this.type)\n return Iterator.empty();\n\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (typeof nodeData === 'undefined')\n throw new NotFoundGraphError(\n `Graph.${iteratorName}: could not find the \"${node}\" node in the graph.`\n );\n\n // Here, we want to iterate over a node's relevant neighbors\n return createNeighborIterator(\n type === 'mixed' ? this.type : type,\n direction,\n nodeData\n );\n };\n}\n\n/**\n * Function attaching every neighbor iteration method to the Graph class.\n *\n * @param {function} Graph - Graph class.\n */\nexport default function attachNeighborIterationMethods(Graph) {\n NEIGHBORS_ITERATION.forEach(description => {\n attachNeighborArrayCreator(Graph, description);\n attachForEachNeighbor(Graph, description);\n attachFindNeighbor(Graph, description);\n attachNeighborIteratorCreator(Graph, description);\n });\n}\n", "/**\n * Graphology Adjacency Iteration\n * ===============================\n *\n * Attaching some methods to the Graph class to be able to iterate over a\n * graph's adjacency.\n */\n\n/**\n * Function iterating over a simple graph's adjacency using a callback.\n *\n * @param {boolean} breakable - Can we break?\n * @param {boolean} assymetric - Whether to emit undirected edges only once.\n * @param {boolean} disconnectedNodes - Whether to emit disconnected nodes.\n * @param {Graph} graph - Target Graph instance.\n * @param {callback} function - Iteration callback.\n */\nexport function forEachAdjacency(\n breakable,\n assymetric,\n disconnectedNodes,\n graph,\n callback\n) {\n const iterator = graph._nodes.values();\n\n const type = graph.type;\n\n let step, sourceData, neighbor, adj, edgeData, targetData, shouldBreak;\n\n while (((step = iterator.next()), step.done !== true)) {\n let hasEdges = false;\n\n sourceData = step.value;\n\n if (type !== 'undirected') {\n adj = sourceData.out;\n\n for (neighbor in adj) {\n edgeData = adj[neighbor];\n\n do {\n targetData = edgeData.target;\n\n hasEdges = true;\n shouldBreak = callback(\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.key,\n edgeData.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData;\n\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (type !== 'directed') {\n adj = sourceData.undirected;\n\n for (neighbor in adj) {\n if (assymetric && sourceData.key > neighbor) continue;\n\n edgeData = adj[neighbor];\n\n do {\n targetData = edgeData.target;\n\n if (targetData.key !== neighbor) targetData = edgeData.source;\n\n hasEdges = true;\n shouldBreak = callback(\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.key,\n edgeData.attributes,\n edgeData.undirected\n );\n\n if (breakable && shouldBreak) return edgeData;\n\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (disconnectedNodes && !hasEdges) {\n shouldBreak = callback(\n sourceData.key,\n null,\n sourceData.attributes,\n null,\n null,\n null,\n null\n );\n\n if (breakable && shouldBreak) return null;\n }\n }\n\n return;\n}\n", "/**\n * Graphology Serialization Utilities\n * ===================================\n *\n * Collection of functions used by the graph serialization schemes.\n */\nimport {InvalidArgumentsGraphError} from './errors';\nimport {assign, isPlainObject, isEmpty} from './utils';\n\n/**\n * Formats internal node data into a serialized node.\n *\n * @param {any} key - The node's key.\n * @param {object} data - Internal node's data.\n * @return {array} - The serialized node.\n */\nexport function serializeNode(key, data) {\n const serialized = {key};\n\n if (!isEmpty(data.attributes))\n serialized.attributes = assign({}, data.attributes);\n\n return serialized;\n}\n\n/**\n * Formats internal edge data into a serialized edge.\n *\n * @param {string} type - The graph's type.\n * @param {any} key - The edge's key.\n * @param {object} data - Internal edge's data.\n * @return {array} - The serialized edge.\n */\nexport function serializeEdge(type, key, data) {\n const serialized = {\n key,\n source: data.source.key,\n target: data.target.key\n };\n\n if (!isEmpty(data.attributes))\n serialized.attributes = assign({}, data.attributes);\n\n if (type === 'mixed' && data.undirected) serialized.undirected = true;\n\n return serialized;\n}\n\n/**\n * Checks whether the given value is a serialized node.\n *\n * @param {mixed} value - Target value.\n * @return {string|null}\n */\nexport function validateSerializedNode(value) {\n if (!isPlainObject(value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid serialized node. A serialized node should be a plain object with at least a \"key\" property.'\n );\n\n if (!('key' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized node is missing its key.'\n );\n\n if (\n 'attributes' in value &&\n (!isPlainObject(value.attributes) || value.attributes === null)\n )\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.'\n );\n}\n\n/**\n * Checks whether the given value is a serialized edge.\n *\n * @param {mixed} value - Target value.\n * @return {string|null}\n */\nexport function validateSerializedEdge(value) {\n if (!isPlainObject(value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a \"source\" & \"target\" property.'\n );\n\n if (!('source' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized edge is missing its source.'\n );\n\n if (!('target' in value))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: serialized edge is missing its target.'\n );\n\n if (\n 'attributes' in value &&\n (!isPlainObject(value.attributes) || value.attributes === null)\n )\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.'\n );\n\n if ('undirected' in value && typeof value.undirected !== 'boolean')\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.'\n );\n}\n", "/* eslint no-nested-ternary: 0 */\n/**\n * Graphology Reference Implementation\n * ====================================\n *\n * Reference implementation of the graphology specs.\n */\nimport {EventEmitter} from 'events';\nimport Iterator from 'obliterator/iterator';\nimport take from 'obliterator/take';\n\nimport {\n InvalidArgumentsGraphError,\n NotFoundGraphError,\n UsageGraphError\n} from './errors';\n\nimport {\n MixedNodeData,\n DirectedNodeData,\n UndirectedNodeData,\n EdgeData\n} from './data';\n\nimport attachNodeAttributesMethods from './attributes/nodes';\nimport attachEdgeAttributesMethods from './attributes/edges';\nimport attachEdgeIterationMethods from './iteration/edges';\nimport attachNeighborIterationMethods from './iteration/neighbors';\nimport {forEachAdjacency} from './iteration/adjacency';\n\nimport {\n serializeNode,\n serializeEdge,\n validateSerializedNode,\n validateSerializedEdge\n} from './serialization';\n\nimport {\n assign,\n getMatchingEdge,\n isPlainObject,\n privateProperty,\n readOnlyProperty,\n incrementalIdStartingFromRandomByte,\n validateHints\n} from './utils';\n\n/**\n * Constants.\n */\nconst INSTANCE_ID = incrementalIdStartingFromRandomByte();\n\n/**\n * Enums.\n */\nconst TYPES = new Set(['directed', 'undirected', 'mixed']);\n\nconst EMITTER_PROPS = new Set([\n 'domain',\n '_events',\n '_eventsCount',\n '_maxListeners'\n]);\n\nconst EDGE_ADD_METHODS = [\n {\n name: verb => `${verb}Edge`,\n generateKey: true\n },\n {\n name: verb => `${verb}DirectedEdge`,\n generateKey: true,\n type: 'directed'\n },\n {\n name: verb => `${verb}UndirectedEdge`,\n generateKey: true,\n type: 'undirected'\n },\n {\n name: verb => `${verb}EdgeWithKey`\n },\n {\n name: verb => `${verb}DirectedEdgeWithKey`,\n type: 'directed'\n },\n {\n name: verb => `${verb}UndirectedEdgeWithKey`,\n type: 'undirected'\n }\n];\n\n/**\n * Default options.\n */\nconst DEFAULTS = {\n allowSelfLoops: true,\n multi: false,\n type: 'mixed'\n};\n\n/**\n * Abstract functions used by the Graph class for various methods.\n */\n\n/**\n * Internal method used to add a node to the given graph\n *\n * @param {Graph} graph - Target graph.\n * @param {any} node - The node's key.\n * @param {object} [attributes] - Optional attributes.\n * @return {NodeData} - Created node data.\n */\nfunction addNode(graph, node, attributes) {\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.addNode: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // String coercion\n node = '' + node;\n attributes = attributes || {};\n\n if (graph._nodes.has(node))\n throw new UsageGraphError(\n `Graph.addNode: the \"${node}\" node already exist in the graph.`\n );\n\n const data = new graph.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n graph._nodes.set(node, data);\n\n // Emitting\n graph.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return data;\n}\n\n/**\n * Same as the above but without sanity checks because we call this in contexts\n * where necessary checks were already done.\n */\nfunction unsafeAddNode(graph, node, attributes) {\n const data = new graph.NodeDataClass(node, attributes);\n\n graph._nodes.set(node, data);\n\n graph.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return data;\n}\n\n/**\n * Internal method used to add an arbitrary edge to the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {string} name - Name of the child method for errors.\n * @param {boolean} mustGenerateKey - Should the graph generate an id?\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {any} edge - The edge's key.\n * @param {any} source - The source node.\n * @param {any} target - The target node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The edge.\n *\n * @throws {Error} - Will throw if the graph is of the wrong type.\n * @throws {Error} - Will throw if the given attributes are not an object.\n * @throws {Error} - Will throw if source or target doesn't exist.\n * @throws {Error} - Will throw if the edge already exist.\n */\nfunction addEdge(\n graph,\n name,\n mustGenerateKey,\n undirected,\n edge,\n source,\n target,\n attributes\n) {\n // Checking validity of operation\n if (!undirected && graph.type === 'undirected')\n throw new UsageGraphError(\n `Graph.${name}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`\n );\n\n if (undirected && graph.type === 'directed')\n throw new UsageGraphError(\n `Graph.${name}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`\n );\n\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // Coercion of source & target:\n source = '' + source;\n target = '' + target;\n attributes = attributes || {};\n\n if (!graph.allowSelfLoops && source === target)\n throw new UsageGraphError(\n `Graph.${name}: source & target are the same (\"${source}\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`\n );\n\n const sourceData = graph._nodes.get(source),\n targetData = graph._nodes.get(target);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.${name}: source node \"${source}\" not found.`\n );\n\n if (!targetData)\n throw new NotFoundGraphError(\n `Graph.${name}: target node \"${target}\" not found.`\n );\n\n // Must the graph generate an id for this edge?\n const eventData = {\n key: null,\n undirected,\n source,\n target,\n attributes\n };\n\n if (mustGenerateKey) {\n // NOTE: in this case we can guarantee that the key does not already\n // exist and is already correctly casted as a string\n edge = graph._edgeKeyGenerator();\n } else {\n // Coercion of edge key\n edge = '' + edge;\n\n // Here, we have a key collision\n if (graph._edges.has(edge))\n throw new UsageGraphError(\n `Graph.${name}: the \"${edge}\" edge already exists in the graph.`\n );\n }\n\n // Here, we might have a source / target collision\n if (\n !graph.multi &&\n (undirected\n ? typeof sourceData.undirected[target] !== 'undefined'\n : typeof sourceData.out[target] !== 'undefined')\n ) {\n throw new UsageGraphError(\n `Graph.${name}: an edge linking \"${source}\" to \"${target}\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`\n );\n }\n\n // Storing some data\n const edgeData = new EdgeData(\n undirected,\n edge,\n sourceData,\n targetData,\n attributes\n );\n\n // Adding the edge to the internal register\n graph._edges.set(edge, edgeData);\n\n // Incrementing node degree counters\n const isSelfLoop = source === target;\n\n if (undirected) {\n sourceData.undirectedDegree++;\n targetData.undirectedDegree++;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops++;\n graph._undirectedSelfLoopCount++;\n }\n } else {\n sourceData.outDegree++;\n targetData.inDegree++;\n\n if (isSelfLoop) {\n sourceData.directedLoops++;\n graph._directedSelfLoopCount++;\n }\n }\n\n // Updating relevant index\n if (graph.multi) edgeData.attachMulti();\n else edgeData.attach();\n\n if (undirected) graph._undirectedSize++;\n else graph._directedSize++;\n\n // Emitting\n eventData.key = edge;\n\n graph.emit('edgeAdded', eventData);\n\n return edge;\n}\n\n/**\n * Internal method used to add an arbitrary edge to the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {string} name - Name of the child method for errors.\n * @param {boolean} mustGenerateKey - Should the graph generate an id?\n * @param {boolean} undirected - Whether the edge is undirected.\n * @param {any} edge - The edge's key.\n * @param {any} source - The source node.\n * @param {any} target - The target node.\n * @param {object} [attributes] - Optional attributes.\n * @param {boolean} [asUpdater] - Are we updating or merging?\n * @return {any} - The edge.\n *\n * @throws {Error} - Will throw if the graph is of the wrong type.\n * @throws {Error} - Will throw if the given attributes are not an object.\n * @throws {Error} - Will throw if source or target doesn't exist.\n * @throws {Error} - Will throw if the edge already exist.\n */\nfunction mergeEdge(\n graph,\n name,\n mustGenerateKey,\n undirected,\n edge,\n source,\n target,\n attributes,\n asUpdater\n) {\n // Checking validity of operation\n if (!undirected && graph.type === 'undirected')\n throw new UsageGraphError(\n `Graph.${name}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`\n );\n\n if (undirected && graph.type === 'directed')\n throw new UsageGraphError(\n `Graph.${name}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`\n );\n\n if (attributes) {\n if (asUpdater) {\n if (typeof attributes !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid updater function. Expecting a function but got \"${attributes}\"`\n );\n } else {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.${name}: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n }\n }\n\n // Coercion of source & target:\n source = '' + source;\n target = '' + target;\n\n let updater;\n\n if (asUpdater) {\n updater = attributes;\n attributes = undefined;\n }\n\n if (!graph.allowSelfLoops && source === target)\n throw new UsageGraphError(\n `Graph.${name}: source & target are the same (\"${source}\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`\n );\n\n let sourceData = graph._nodes.get(source);\n let targetData = graph._nodes.get(target);\n let edgeData;\n\n // Do we need to handle duplicate?\n let alreadyExistingEdgeData;\n\n if (!mustGenerateKey) {\n edgeData = graph._edges.get(edge);\n\n if (edgeData) {\n // Here, we need to ensure, if the user gave a key, that source & target\n // are consistent\n if (edgeData.source.key !== source || edgeData.target.key !== target) {\n // If source or target inconsistent\n if (\n !undirected ||\n edgeData.source.key !== target ||\n edgeData.target.key !== source\n ) {\n // If directed, or source/target aren't flipped\n throw new UsageGraphError(\n `Graph.${name}: inconsistency detected when attempting to merge the \"${edge}\" edge with \"${source}\" source & \"${target}\" target vs. (\"${edgeData.source.key}\", \"${edgeData.target.key}\").`\n );\n }\n }\n\n alreadyExistingEdgeData = edgeData;\n }\n }\n\n // Here, we might have a source / target collision\n if (!alreadyExistingEdgeData && !graph.multi && sourceData) {\n alreadyExistingEdgeData = undirected\n ? sourceData.undirected[target]\n : sourceData.out[target];\n }\n\n // Handling duplicates\n if (alreadyExistingEdgeData) {\n const info = [alreadyExistingEdgeData.key, false, false, false];\n\n // We can skip the attribute merging part if the user did not provide them\n if (asUpdater ? !updater : !attributes) return info;\n\n // Updating the attributes\n if (asUpdater) {\n const oldAttributes = alreadyExistingEdgeData.attributes;\n alreadyExistingEdgeData.attributes = updater(oldAttributes);\n\n graph.emit('edgeAttributesUpdated', {\n type: 'replace',\n key: alreadyExistingEdgeData.key,\n attributes: alreadyExistingEdgeData.attributes\n });\n }\n\n // Merging the attributes\n else {\n assign(alreadyExistingEdgeData.attributes, attributes);\n\n graph.emit('edgeAttributesUpdated', {\n type: 'merge',\n key: alreadyExistingEdgeData.key,\n attributes: alreadyExistingEdgeData.attributes,\n data: attributes\n });\n }\n\n return info;\n }\n\n attributes = attributes || {};\n\n if (asUpdater && updater) attributes = updater(attributes);\n\n // Must the graph generate an id for this edge?\n const eventData = {\n key: null,\n undirected,\n source,\n target,\n attributes\n };\n\n if (mustGenerateKey) {\n // NOTE: in this case we can guarantee that the key does not already\n // exist and is already correctly casted as a string\n edge = graph._edgeKeyGenerator();\n } else {\n // Coercion of edge key\n edge = '' + edge;\n\n // Here, we have a key collision\n if (graph._edges.has(edge))\n throw new UsageGraphError(\n `Graph.${name}: the \"${edge}\" edge already exists in the graph.`\n );\n }\n\n let sourceWasAdded = false;\n let targetWasAdded = false;\n\n if (!sourceData) {\n sourceData = unsafeAddNode(graph, source, {});\n sourceWasAdded = true;\n\n if (source === target) {\n targetData = sourceData;\n targetWasAdded = true;\n }\n }\n if (!targetData) {\n targetData = unsafeAddNode(graph, target, {});\n targetWasAdded = true;\n }\n\n // Storing some data\n edgeData = new EdgeData(undirected, edge, sourceData, targetData, attributes);\n\n // Adding the edge to the internal register\n graph._edges.set(edge, edgeData);\n\n // Incrementing node degree counters\n const isSelfLoop = source === target;\n\n if (undirected) {\n sourceData.undirectedDegree++;\n targetData.undirectedDegree++;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops++;\n graph._undirectedSelfLoopCount++;\n }\n } else {\n sourceData.outDegree++;\n targetData.inDegree++;\n\n if (isSelfLoop) {\n sourceData.directedLoops++;\n graph._directedSelfLoopCount++;\n }\n }\n\n // Updating relevant index\n if (graph.multi) edgeData.attachMulti();\n else edgeData.attach();\n\n if (undirected) graph._undirectedSize++;\n else graph._directedSize++;\n\n // Emitting\n eventData.key = edge;\n\n graph.emit('edgeAdded', eventData);\n\n return [edge, true, sourceWasAdded, targetWasAdded];\n}\n\n/**\n * Internal method used to drop an edge.\n *\n * @param {Graph} graph - Target graph.\n * @param {EdgeData} edgeData - Data of the edge to drop.\n */\nfunction dropEdgeFromData(graph, edgeData) {\n // Dropping the edge from the register\n graph._edges.delete(edgeData.key);\n\n // Updating related degrees\n const {source: sourceData, target: targetData, attributes} = edgeData;\n\n const undirected = edgeData.undirected;\n\n const isSelfLoop = sourceData === targetData;\n\n if (undirected) {\n sourceData.undirectedDegree--;\n targetData.undirectedDegree--;\n\n if (isSelfLoop) {\n sourceData.undirectedLoops--;\n graph._undirectedSelfLoopCount--;\n }\n } else {\n sourceData.outDegree--;\n targetData.inDegree--;\n\n if (isSelfLoop) {\n sourceData.directedLoops--;\n graph._directedSelfLoopCount--;\n }\n }\n\n // Clearing index\n if (graph.multi) edgeData.detachMulti();\n else edgeData.detach();\n\n if (undirected) graph._undirectedSize--;\n else graph._directedSize--;\n\n // Emitting\n graph.emit('edgeDropped', {\n key: edgeData.key,\n attributes,\n source: sourceData.key,\n target: targetData.key,\n undirected\n });\n}\n\n/**\n * Graph class\n *\n * @constructor\n * @param {object} [options] - Options:\n * @param {boolean} [allowSelfLoops] - Allow self loops?\n * @param {string} [type] - Type of the graph.\n * @param {boolean} [map] - Allow references as keys?\n * @param {boolean} [multi] - Allow parallel edges?\n *\n * @throws {Error} - Will throw if the arguments are not valid.\n */\nexport default class Graph extends EventEmitter {\n constructor(options) {\n super();\n\n //-- Solving options\n options = assign({}, DEFAULTS, options);\n\n // Enforcing options validity\n if (typeof options.multi !== 'boolean')\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"${options.multi}\".`\n );\n\n if (!TYPES.has(options.type))\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'type' option. Should be one of \"mixed\", \"directed\" or \"undirected\" but got \"${options.type}\".`\n );\n\n if (typeof options.allowSelfLoops !== 'boolean')\n throw new InvalidArgumentsGraphError(\n `Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"${options.allowSelfLoops}\".`\n );\n\n //-- Private properties\n\n // Utilities\n const NodeDataClass =\n options.type === 'mixed'\n ? MixedNodeData\n : options.type === 'directed'\n ? DirectedNodeData\n : UndirectedNodeData;\n\n privateProperty(this, 'NodeDataClass', NodeDataClass);\n\n // Internal edge key generator\n\n // NOTE: this internal generator produce keys that are strings\n // composed of a weird prefix, an incremental instance id starting from\n // a random byte and finally an internal instance incremental id.\n // All this to avoid intra-frame and cross-frame adversarial inputs\n // that can force a single #.addEdge call to degenerate into a O(n)\n // available key search loop.\n\n // It also ensures that automatically generated edge keys are unlikely\n // to produce collisions with arbitrary keys given by users.\n const instancePrefix = 'geid_' + INSTANCE_ID() + '_';\n let edgeId = 0;\n\n const edgeKeyGenerator = () => {\n let availableEdgeKey;\n\n do {\n availableEdgeKey = instancePrefix + edgeId++;\n } while (this._edges.has(availableEdgeKey));\n\n return availableEdgeKey;\n };\n\n // Indexes\n privateProperty(this, '_attributes', {});\n privateProperty(this, '_nodes', new Map());\n privateProperty(this, '_edges', new Map());\n privateProperty(this, '_directedSize', 0);\n privateProperty(this, '_undirectedSize', 0);\n privateProperty(this, '_directedSelfLoopCount', 0);\n privateProperty(this, '_undirectedSelfLoopCount', 0);\n privateProperty(this, '_edgeKeyGenerator', edgeKeyGenerator);\n\n // Options\n privateProperty(this, '_options', options);\n\n // Emitter properties\n EMITTER_PROPS.forEach(prop => privateProperty(this, prop, this[prop]));\n\n //-- Properties readers\n readOnlyProperty(this, 'order', () => this._nodes.size);\n readOnlyProperty(this, 'size', () => this._edges.size);\n readOnlyProperty(this, 'directedSize', () => this._directedSize);\n readOnlyProperty(this, 'undirectedSize', () => this._undirectedSize);\n readOnlyProperty(\n this,\n 'selfLoopCount',\n () => this._directedSelfLoopCount + this._undirectedSelfLoopCount\n );\n readOnlyProperty(\n this,\n 'directedSelfLoopCount',\n () => this._directedSelfLoopCount\n );\n readOnlyProperty(\n this,\n 'undirectedSelfLoopCount',\n () => this._undirectedSelfLoopCount\n );\n readOnlyProperty(this, 'multi', this._options.multi);\n readOnlyProperty(this, 'type', this._options.type);\n readOnlyProperty(this, 'allowSelfLoops', this._options.allowSelfLoops);\n readOnlyProperty(this, 'implementation', () => 'graphology');\n }\n\n _resetInstanceCounters() {\n this._directedSize = 0;\n this._undirectedSize = 0;\n this._directedSelfLoopCount = 0;\n this._undirectedSelfLoopCount = 0;\n }\n\n /**---------------------------------------------------------------------------\n * Read\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning whether the given node is found in the graph.\n *\n * @param {any} node - The node.\n * @return {boolean}\n */\n hasNode(node) {\n return this._nodes.has('' + node);\n }\n\n /**\n * Method returning whether the given directed edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasDirectedEdge(source, target) {\n // Early termination\n if (this.type === 'undirected') return false;\n\n if (arguments.length === 1) {\n const edge = '' + source;\n\n const edgeData = this._edges.get(edge);\n\n return !!edgeData && !edgeData.undirected;\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return nodeData.out.hasOwnProperty(target);\n }\n\n throw new InvalidArgumentsGraphError(\n `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.`\n );\n }\n\n /**\n * Method returning whether the given undirected edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasUndirectedEdge(source, target) {\n // Early termination\n if (this.type === 'directed') return false;\n\n if (arguments.length === 1) {\n const edge = '' + source;\n\n const edgeData = this._edges.get(edge);\n\n return !!edgeData && edgeData.undirected;\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return nodeData.undirected.hasOwnProperty(target);\n }\n\n throw new InvalidArgumentsGraphError(\n `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.`\n );\n }\n\n /**\n * Method returning whether the given edge is found in the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge's key.\n *\n * Arity 2:\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the arguments are invalid.\n */\n hasEdge(source, target) {\n if (arguments.length === 1) {\n const edge = '' + source;\n\n return this._edges.has(edge);\n } else if (arguments.length === 2) {\n source = '' + source;\n target = '' + target;\n\n // If the node source or the target is not in the graph we break\n const nodeData = this._nodes.get(source);\n\n if (!nodeData) return false;\n\n // Is there a directed edge pointing toward target?\n return (\n (typeof nodeData.out !== 'undefined' &&\n nodeData.out.hasOwnProperty(target)) ||\n (typeof nodeData.undirected !== 'undefined' &&\n nodeData.undirected.hasOwnProperty(target))\n );\n }\n\n throw new InvalidArgumentsGraphError(\n `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.`\n );\n }\n\n /**\n * Method returning the edge matching source & target in a directed fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n directedEdge(source, target) {\n if (this.type === 'undirected') return;\n\n source = '' + source;\n target = '' + target;\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.'\n );\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.directedEdge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.directedEdge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData = (sourceData.out && sourceData.out[target]) || undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning the edge matching source & target in a undirected fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n undirectedEdge(source, target) {\n if (this.type === 'directed') return;\n\n source = '' + source;\n target = '' + target;\n\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.'\n );\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.undirectedEdge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.undirectedEdge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData =\n (sourceData.undirected && sourceData.undirected[target]) || undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning the edge matching source & target in a mixed fashion.\n *\n * @param {any} source - The edge's source.\n * @param {any} target - The edge's target.\n *\n * @return {any|undefined}\n *\n * @throws {Error} - Will throw if the graph is multi.\n * @throws {Error} - Will throw if source or target doesn't exist.\n */\n edge(source, target) {\n if (this.multi)\n throw new UsageGraphError(\n 'Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.'\n );\n\n source = '' + source;\n target = '' + target;\n\n const sourceData = this._nodes.get(source);\n\n if (!sourceData)\n throw new NotFoundGraphError(\n `Graph.edge: could not find the \"${source}\" source node in the graph.`\n );\n\n if (!this._nodes.has(target))\n throw new NotFoundGraphError(\n `Graph.edge: could not find the \"${target}\" target node in the graph.`\n );\n\n const edgeData =\n (sourceData.out && sourceData.out[target]) ||\n (sourceData.undirected && sourceData.undirected[target]) ||\n undefined;\n\n if (edgeData) return edgeData.key;\n }\n\n /**\n * Method returning whether two nodes are directed neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areDirectedNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areDirectedNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.in || neighbor in nodeData.out;\n }\n\n /**\n * Method returning whether two nodes are out neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areOutNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areOutNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.out;\n }\n\n /**\n * Method returning whether two nodes are in neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areInNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areInNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return false;\n\n return neighbor in nodeData.in;\n }\n\n /**\n * Method returning whether two nodes are undirected neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areUndirectedNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areUndirectedNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return false;\n\n return neighbor in nodeData.undirected;\n }\n\n /**\n * Method returning whether two nodes are neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.in || neighbor in nodeData.out) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether two nodes are inbound neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areInboundNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areInboundNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.in) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether two nodes are outbound neighbors.\n *\n * @param {any} node - The node's key.\n * @param {any} neighbor - The neighbor's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n areOutboundNeighbors(node, neighbor) {\n node = '' + node;\n neighbor = '' + neighbor;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.areOutboundNeighbors: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type !== 'undirected') {\n if (neighbor in nodeData.out) return true;\n }\n\n if (this.type !== 'directed') {\n if (neighbor in nodeData.undirected) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning the given node's in degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree;\n }\n\n /**\n * Method returning the given node's out degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.outDegree;\n }\n\n /**\n * Method returning the given node's directed degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n directedDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.directedDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree + nodeData.outDegree;\n }\n\n /**\n * Method returning the given node's undirected degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n undirectedDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.undirectedDegree: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return 0;\n\n return nodeData.undirectedDegree;\n }\n\n /**\n * Method returning the given node's inbound degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's inbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inboundDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inboundDegree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's outbound degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's outbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outboundDegree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outboundDegree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.outDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's directed degree.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n degree(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.degree: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree + nodeData.outDegree;\n }\n\n return degree;\n }\n\n /**\n * Method returning the given node's in degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree - nodeData.directedLoops;\n }\n\n /**\n * Method returning the given node's out degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.outDegree - nodeData.directedLoops;\n }\n\n /**\n * Method returning the given node's directed degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n directedDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.directedDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'undirected') return 0;\n\n return nodeData.inDegree + nodeData.outDegree - nodeData.directedLoops * 2;\n }\n\n /**\n * Method returning the given node's undirected degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's in degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n undirectedDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.undirectedDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n if (this.type === 'directed') return 0;\n\n return nodeData.undirectedDegree - nodeData.undirectedLoops * 2;\n }\n\n /**\n * Method returning the given node's inbound degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's inbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n inboundDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.inboundDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree;\n loops += nodeData.directedLoops;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given node's outbound degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's outbound degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n outboundDegreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.outboundDegreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.outDegree;\n loops += nodeData.directedLoops;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given node's directed degree without considering self loops.\n *\n * @param {any} node - The node's key.\n * @return {number} - The node's degree.\n *\n * @throws {Error} - Will throw if the node isn't in the graph.\n */\n degreeWithoutSelfLoops(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.degreeWithoutSelfLoops: could not find the \"${node}\" node in the graph.`\n );\n\n let degree = 0;\n let loops = 0;\n\n if (this.type !== 'directed') {\n degree += nodeData.undirectedDegree;\n loops += nodeData.undirectedLoops * 2;\n }\n\n if (this.type !== 'undirected') {\n degree += nodeData.inDegree + nodeData.outDegree;\n loops += nodeData.directedLoops * 2;\n }\n\n return degree - loops;\n }\n\n /**\n * Method returning the given edge's source.\n *\n * @param {any} edge - The edge's key.\n * @return {any} - The edge's source.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n source(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.source: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source.key;\n }\n\n /**\n * Method returning the given edge's target.\n *\n * @param {any} edge - The edge's key.\n * @return {any} - The edge's target.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n target(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.target: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.target.key;\n }\n\n /**\n * Method returning the given edge's extremities.\n *\n * @param {any} edge - The edge's key.\n * @return {array} - The edge's extremities.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n extremities(edge) {\n edge = '' + edge;\n\n const edgeData = this._edges.get(edge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.extremities: could not find the \"${edge}\" edge in the graph.`\n );\n\n return [edgeData.source.key, edgeData.target.key];\n }\n\n /**\n * Given a node & an edge, returns the other extremity of the edge.\n *\n * @param {any} node - The node's key.\n * @param {any} edge - The edge's key.\n * @return {any} - The related node.\n *\n * @throws {Error} - Will throw if the edge isn't in the graph or if the\n * edge & node are not related.\n */\n opposite(node, edge) {\n node = '' + node;\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.opposite: could not find the \"${edge}\" edge in the graph.`\n );\n\n const source = data.source.key;\n const target = data.target.key;\n\n if (node === source) return target;\n if (node === target) return source;\n\n throw new NotFoundGraphError(\n `Graph.opposite: the \"${node}\" node is not attached to the \"${edge}\" edge (${source}, ${target}).`\n );\n }\n\n /**\n * Returns whether the given edge has the given node as extremity.\n *\n * @param {any} edge - The edge's key.\n * @param {any} node - The node's key.\n * @return {boolean} - The related node.\n *\n * @throws {Error} - Will throw if either the node or the edge isn't in the graph.\n */\n hasExtremity(edge, node) {\n edge = '' + edge;\n node = '' + node;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.hasExtremity: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source.key === node || data.target.key === node;\n }\n\n /**\n * Method returning whether the given edge is undirected.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isUndirected(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isUndirected: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.undirected;\n }\n\n /**\n * Method returning whether the given edge is directed.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isDirected(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isDirected: could not find the \"${edge}\" edge in the graph.`\n );\n\n return !data.undirected;\n }\n\n /**\n * Method returning whether the given edge is a self loop.\n *\n * @param {any} edge - The edge's key.\n * @return {boolean}\n *\n * @throws {Error} - Will throw if the edge isn't in the graph.\n */\n isSelfLoop(edge) {\n edge = '' + edge;\n\n const data = this._edges.get(edge);\n\n if (!data)\n throw new NotFoundGraphError(\n `Graph.isSelfLoop: could not find the \"${edge}\" edge in the graph.`\n );\n\n return data.source === data.target;\n }\n\n /**---------------------------------------------------------------------------\n * Mutation\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used to add a node to the graph.\n *\n * @param {any} node - The node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The node.\n *\n * @throws {Error} - Will throw if the given node already exist.\n * @throws {Error} - Will throw if the given attributes are not an object.\n */\n addNode(node, attributes) {\n const nodeData = addNode(this, node, attributes);\n\n return nodeData.key;\n }\n\n /**\n * Method used to merge a node into the graph.\n *\n * @param {any} node - The node.\n * @param {object} [attributes] - Optional attributes.\n * @return {any} - The node.\n */\n mergeNode(node, attributes) {\n if (attributes && !isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n `Graph.mergeNode: invalid attributes. Expecting an object but got \"${attributes}\"`\n );\n\n // String coercion\n node = '' + node;\n attributes = attributes || {};\n\n // If the node already exists, we merge the attributes\n let data = this._nodes.get(node);\n\n if (data) {\n if (attributes) {\n assign(data.attributes, attributes);\n\n this.emit('nodeAttributesUpdated', {\n type: 'merge',\n key: node,\n attributes: data.attributes,\n data: attributes\n });\n }\n return [node, false];\n }\n\n data = new this.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n this._nodes.set(node, data);\n\n // Emitting\n this.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return [node, true];\n }\n\n /**\n * Method used to add a node if it does not exist in the graph or else to\n * update its attributes using a function.\n *\n * @param {any} node - The node.\n * @param {function} [updater] - Optional updater function.\n * @return {any} - The node.\n */\n updateNode(node, updater) {\n if (updater && typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n `Graph.updateNode: invalid updater function. Expecting a function but got \"${updater}\"`\n );\n\n // String coercion\n node = '' + node;\n\n // If the node already exists, we update the attributes\n let data = this._nodes.get(node);\n\n if (data) {\n if (updater) {\n const oldAttributes = data.attributes;\n data.attributes = updater(oldAttributes);\n\n this.emit('nodeAttributesUpdated', {\n type: 'replace',\n key: node,\n attributes: data.attributes\n });\n }\n return [node, false];\n }\n\n const attributes = updater ? updater({}) : {};\n\n data = new this.NodeDataClass(node, attributes);\n\n // Adding the node to internal register\n this._nodes.set(node, data);\n\n // Emitting\n this.emit('nodeAdded', {\n key: node,\n attributes\n });\n\n return [node, true];\n }\n\n /**\n * Method used to drop a single node & all its attached edges from the graph.\n *\n * @param {any} node - The node.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the node doesn't exist.\n */\n dropNode(node) {\n node = '' + node;\n\n const nodeData = this._nodes.get(node);\n\n if (!nodeData)\n throw new NotFoundGraphError(\n `Graph.dropNode: could not find the \"${node}\" node in the graph.`\n );\n\n let edgeData;\n\n // Removing attached edges\n // NOTE: we could be faster here, but this is such a pain to maintain\n if (this.type !== 'undirected') {\n for (const neighbor in nodeData.out) {\n edgeData = nodeData.out[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n\n for (const neighbor in nodeData.in) {\n edgeData = nodeData.in[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n if (this.type !== 'directed') {\n for (const neighbor in nodeData.undirected) {\n edgeData = nodeData.undirected[neighbor];\n\n do {\n dropEdgeFromData(this, edgeData);\n edgeData = edgeData.next;\n } while (edgeData);\n }\n }\n\n // Dropping the node from the register\n this._nodes.delete(node);\n\n // Emitting\n this.emit('nodeDropped', {\n key: node,\n attributes: nodeData.attributes\n });\n }\n\n /**\n * Method used to drop a single edge from the graph.\n *\n * Arity 1:\n * @param {any} edge - The edge.\n *\n * Arity 2:\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropEdge(edge) {\n let edgeData;\n\n if (arguments.length > 1) {\n const source = '' + arguments[0];\n const target = '' + arguments[1];\n\n edgeData = getMatchingEdge(this, source, target, this.type);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropEdge: could not find the \"${source}\" -> \"${target}\" edge in the graph.`\n );\n } else {\n edge = '' + edge;\n\n edgeData = this._edges.get(edge);\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropEdge: could not find the \"${edge}\" edge in the graph.`\n );\n }\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to drop a single directed edge from the graph.\n *\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropDirectedEdge(source, target) {\n if (arguments.length < 2)\n throw new UsageGraphError(\n '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.'\n );\n\n if (this.multi)\n throw new UsageGraphError(\n '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.'\n );\n\n source = '' + source;\n target = '' + target;\n\n const edgeData = getMatchingEdge(this, source, target, 'directed');\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropDirectedEdge: could not find a \"${source}\" -> \"${target}\" edge in the graph.`\n );\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to drop a single undirected edge from the graph.\n *\n * @param {any} source - Source node.\n * @param {any} target - Target node.\n *\n * @return {Graph}\n *\n * @throws {Error} - Will throw if the edge doesn't exist.\n */\n dropUndirectedEdge(source, target) {\n if (arguments.length < 2)\n throw new UsageGraphError(\n '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.'\n );\n\n if (this.multi)\n throw new UsageGraphError(\n '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.'\n );\n\n const edgeData = getMatchingEdge(this, source, target, 'undirected');\n\n if (!edgeData)\n throw new NotFoundGraphError(\n `Graph.dropUndirectedEdge: could not find a \"${source}\" -> \"${target}\" edge in the graph.`\n );\n\n dropEdgeFromData(this, edgeData);\n\n return this;\n }\n\n /**\n * Method used to remove every edge & every node from the graph.\n *\n * @return {Graph}\n */\n clear() {\n // Clearing edges\n this._edges.clear();\n\n // Clearing nodes\n this._nodes.clear();\n\n // Reset counters\n this._resetInstanceCounters();\n\n // Emitting\n this.emit('cleared');\n }\n\n /**\n * Method used to remove every edge from the graph.\n *\n * @return {Graph}\n */\n clearEdges() {\n // Clearing structure index\n const iterator = this._nodes.values();\n\n let step;\n\n while (((step = iterator.next()), step.done !== true)) {\n step.value.clear();\n }\n\n // Clearing edges\n this._edges.clear();\n\n // Reset counters\n this._resetInstanceCounters();\n\n // Emitting\n this.emit('edgesCleared');\n }\n\n /**---------------------------------------------------------------------------\n * Attributes-related methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {any}\n */\n getAttribute(name) {\n return this._attributes[name];\n }\n\n /**\n * Method returning the graph's attributes.\n *\n * @return {object}\n */\n getAttributes() {\n return this._attributes;\n }\n\n /**\n * Method returning whether the graph has the desired attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {boolean}\n */\n hasAttribute(name) {\n return this._attributes.hasOwnProperty(name);\n }\n\n /**\n * Method setting a value for the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @param {any} value - Value for the attribute.\n * @return {Graph}\n */\n setAttribute(name, value) {\n this._attributes[name] = value;\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'set',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method using a function to update the desired graph's attribute's value.\n *\n * @param {string} name - Name of the attribute.\n * @param {function} updater - Function use to update the attribute's value.\n * @return {Graph}\n */\n updateAttribute(name, updater) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateAttribute: updater should be a function.'\n );\n\n const value = this._attributes[name];\n\n this._attributes[name] = updater(value);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'set',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method removing the desired graph's attribute.\n *\n * @param {string} name - Name of the attribute.\n * @return {Graph}\n */\n removeAttribute(name) {\n delete this._attributes[name];\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'remove',\n attributes: this._attributes,\n name\n });\n\n return this;\n }\n\n /**\n * Method replacing the graph's attributes.\n *\n * @param {object} attributes - New attributes.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given attributes are not a plain object.\n */\n replaceAttributes(attributes) {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.replaceAttributes: provided attributes are not a plain object.'\n );\n\n this._attributes = attributes;\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'replace',\n attributes: this._attributes\n });\n\n return this;\n }\n\n /**\n * Method merging the graph's attributes.\n *\n * @param {object} attributes - Attributes to merge.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given attributes are not a plain object.\n */\n mergeAttributes(attributes) {\n if (!isPlainObject(attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.mergeAttributes: provided attributes are not a plain object.'\n );\n\n assign(this._attributes, attributes);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'merge',\n attributes: this._attributes,\n data: attributes\n });\n\n return this;\n }\n\n /**\n * Method updating the graph's attributes.\n *\n * @param {function} updater - Function used to update the attributes.\n * @return {Graph}\n *\n * @throws {Error} - Will throw if given updater is not a function.\n */\n updateAttributes(updater) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateAttributes: provided updater is not a function.'\n );\n\n this._attributes = updater(this._attributes);\n\n // Emitting\n this.emit('attributesUpdated', {\n type: 'update',\n attributes: this._attributes\n });\n\n return this;\n }\n\n /**\n * Method used to update each node's attributes using the given function.\n *\n * @param {function} updater - Updater function to use.\n * @param {object} [hints] - Optional hints.\n */\n updateEachNodeAttributes(updater, hints) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachNodeAttributes: expecting an updater function.'\n );\n\n if (hints && !validateHints(hints))\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n nodeData.attributes = updater(nodeData.key, nodeData.attributes);\n }\n\n this.emit('eachNodeAttributesUpdated', {\n hints: hints ? hints : null\n });\n }\n\n /**\n * Method used to update each edge's attributes using the given function.\n *\n * @param {function} updater - Updater function to use.\n * @param {object} [hints] - Optional hints.\n */\n updateEachEdgeAttributes(updater, hints) {\n if (typeof updater !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachEdgeAttributes: expecting an updater function.'\n );\n\n if (hints && !validateHints(hints))\n throw new InvalidArgumentsGraphError(\n 'Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}'\n );\n\n const iterator = this._edges.values();\n\n let step, edgeData, sourceData, targetData;\n\n while (((step = iterator.next()), step.done !== true)) {\n edgeData = step.value;\n sourceData = edgeData.source;\n targetData = edgeData.target;\n\n edgeData.attributes = updater(\n edgeData.key,\n edgeData.attributes,\n sourceData.key,\n targetData.key,\n sourceData.attributes,\n targetData.attributes,\n edgeData.undirected\n );\n }\n\n this.emit('eachEdgeAttributesUpdated', {\n hints: hints ? hints : null\n });\n }\n\n /**---------------------------------------------------------------------------\n * Iteration-related methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method iterating over the graph's adjacency using the given callback.\n *\n * @param {function} callback - Callback to use.\n */\n forEachAdjacencyEntry(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAdjacencyEntry: expecting a callback.'\n );\n\n forEachAdjacency(false, false, false, this, callback);\n }\n forEachAdjacencyEntryWithOrphans(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.'\n );\n\n forEachAdjacency(false, false, true, this, callback);\n }\n\n /**\n * Method iterating over the graph's assymetric adjacency using the given callback.\n *\n * @param {function} callback - Callback to use.\n */\n forEachAssymetricAdjacencyEntry(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAssymetricAdjacencyEntry: expecting a callback.'\n );\n\n forEachAdjacency(false, true, false, this, callback);\n }\n forEachAssymetricAdjacencyEntryWithOrphans(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.'\n );\n\n forEachAdjacency(false, true, true, this, callback);\n }\n\n /**\n * Method returning the list of the graph's nodes.\n *\n * @return {array} - The nodes.\n */\n nodes() {\n if (typeof Array.from === 'function') return Array.from(this._nodes.keys());\n\n return take(this._nodes.keys(), this._nodes.size);\n }\n\n /**\n * Method iterating over the graph's nodes using the given callback.\n *\n * @param {function} callback - Callback (key, attributes, index).\n */\n forEachNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.forEachNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n callback(nodeData.key, nodeData.attributes);\n }\n }\n\n /**\n * Method iterating attempting to find a node matching the given predicate\n * function.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n findNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.findNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes)) return nodeData.key;\n }\n\n return;\n }\n\n /**\n * Method mapping nodes.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n mapNodes(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.mapNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n const result = new Array(this.order);\n let i = 0;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n result[i++] = callback(nodeData.key, nodeData.attributes);\n }\n\n return result;\n }\n\n /**\n * Method returning whether some node verify the given predicate.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n someNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.someNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes)) return true;\n }\n\n return false;\n }\n\n /**\n * Method returning whether all node verify the given predicate.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n everyNode(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.everyNode: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (!callback(nodeData.key, nodeData.attributes)) return false;\n }\n\n return true;\n }\n\n /**\n * Method filtering nodes.\n *\n * @param {function} callback - Callback (key, attributes).\n */\n filterNodes(callback) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.filterNodes: expecting a callback.'\n );\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n const result = [];\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n\n if (callback(nodeData.key, nodeData.attributes))\n result.push(nodeData.key);\n }\n\n return result;\n }\n\n /**\n * Method reducing nodes.\n *\n * @param {function} callback - Callback (accumulator, key, attributes).\n */\n reduceNodes(callback, initialValue) {\n if (typeof callback !== 'function')\n throw new InvalidArgumentsGraphError(\n 'Graph.reduceNodes: expecting a callback.'\n );\n\n if (arguments.length < 2)\n throw new InvalidArgumentsGraphError(\n '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.'\n );\n\n let accumulator = initialValue;\n\n const iterator = this._nodes.values();\n\n let step, nodeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n nodeData = step.value;\n accumulator = callback(accumulator, nodeData.key, nodeData.attributes);\n }\n\n return accumulator;\n }\n\n /**\n * Method returning an iterator over the graph's node entries.\n *\n * @return {Iterator}\n */\n nodeEntries() {\n const iterator = this._nodes.values();\n\n return new Iterator(() => {\n const step = iterator.next();\n\n if (step.done) return step;\n\n const data = step.value;\n\n return {\n value: {node: data.key, attributes: data.attributes},\n done: false\n };\n });\n }\n\n /**---------------------------------------------------------------------------\n * Serialization\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used to export the whole graph.\n *\n * @return {object} - The serialized graph.\n */\n export() {\n const nodes = new Array(this._nodes.size);\n\n let i = 0;\n\n this._nodes.forEach((data, key) => {\n nodes[i++] = serializeNode(key, data);\n });\n\n const edges = new Array(this._edges.size);\n\n i = 0;\n\n this._edges.forEach((data, key) => {\n edges[i++] = serializeEdge(this.type, key, data);\n });\n\n return {\n options: {\n type: this.type,\n multi: this.multi,\n allowSelfLoops: this.allowSelfLoops\n },\n attributes: this.getAttributes(),\n nodes,\n edges\n };\n }\n\n /**\n * Method used to import a serialized graph.\n *\n * @param {object|Graph} data - The serialized graph.\n * @param {boolean} merge - Whether to merge data.\n * @return {Graph} - Returns itself for chaining.\n */\n import(data, merge = false) {\n // Importing a Graph instance directly\n if (data instanceof Graph) {\n // Nodes\n data.forEachNode((n, a) => {\n if (merge) this.mergeNode(n, a);\n else this.addNode(n, a);\n });\n\n // Edges\n data.forEachEdge((e, a, s, t, _sa, _ta, u) => {\n if (merge) {\n if (u) this.mergeUndirectedEdgeWithKey(e, s, t, a);\n else this.mergeDirectedEdgeWithKey(e, s, t, a);\n } else {\n if (u) this.addUndirectedEdgeWithKey(e, s, t, a);\n else this.addDirectedEdgeWithKey(e, s, t, a);\n }\n });\n\n return this;\n }\n\n // Importing a serialized graph\n if (!isPlainObject(data))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.'\n );\n\n if (data.attributes) {\n if (!isPlainObject(data.attributes))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid attributes. Expecting a plain object.'\n );\n\n if (merge) this.mergeAttributes(data.attributes);\n else this.replaceAttributes(data.attributes);\n }\n\n let i, l, list, node, edge;\n\n if (data.nodes) {\n list = data.nodes;\n\n if (!Array.isArray(list))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid nodes. Expecting an array.'\n );\n\n for (i = 0, l = list.length; i < l; i++) {\n node = list[i];\n\n // Validating\n validateSerializedNode(node);\n\n // Adding the node\n const {key, attributes} = node;\n\n if (merge) this.mergeNode(key, attributes);\n else this.addNode(key, attributes);\n }\n }\n\n if (data.edges) {\n let undirectedByDefault = false;\n\n if (this.type === 'undirected') {\n undirectedByDefault = true;\n }\n\n list = data.edges;\n\n if (!Array.isArray(list))\n throw new InvalidArgumentsGraphError(\n 'Graph.import: invalid edges. Expecting an array.'\n );\n\n for (i = 0, l = list.length; i < l; i++) {\n edge = list[i];\n\n // Validating\n validateSerializedEdge(edge);\n\n // Adding the edge\n const {\n source,\n target,\n attributes,\n undirected = undirectedByDefault\n } = edge;\n\n let method;\n\n if ('key' in edge) {\n method = merge\n ? undirected\n ? this.mergeUndirectedEdgeWithKey\n : this.mergeDirectedEdgeWithKey\n : undirected\n ? this.addUndirectedEdgeWithKey\n : this.addDirectedEdgeWithKey;\n\n method.call(this, edge.key, source, target, attributes);\n } else {\n method = merge\n ? undirected\n ? this.mergeUndirectedEdge\n : this.mergeDirectedEdge\n : undirected\n ? this.addUndirectedEdge\n : this.addDirectedEdge;\n\n method.call(this, source, target, attributes);\n }\n }\n }\n\n return this;\n }\n\n /**---------------------------------------------------------------------------\n * Utils\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method returning a null copy of the graph, i.e. a graph without nodes\n * & edges but with the exact same options.\n *\n * @param {object} options - Options to merge with the current ones.\n * @return {Graph} - The null copy.\n */\n nullCopy(options) {\n const graph = new Graph(assign({}, this._options, options));\n graph.replaceAttributes(assign({}, this.getAttributes()));\n return graph;\n }\n\n /**\n * Method returning an empty copy of the graph, i.e. a graph without edges but\n * with the exact same options.\n *\n * @param {object} options - Options to merge with the current ones.\n * @return {Graph} - The empty copy.\n */\n emptyCopy(options) {\n const graph = this.nullCopy(options);\n\n this._nodes.forEach((nodeData, key) => {\n const attributes = assign({}, nodeData.attributes);\n\n // NOTE: no need to emit events since user cannot access the instance yet\n nodeData = new graph.NodeDataClass(key, attributes);\n graph._nodes.set(key, nodeData);\n });\n\n return graph;\n }\n\n /**\n * Method returning an exact copy of the graph.\n *\n * @param {object} options - Upgrade options.\n * @return {Graph} - The copy.\n */\n copy(options) {\n options = options || {};\n\n if (\n typeof options.type === 'string' &&\n options.type !== this.type &&\n options.type !== 'mixed'\n )\n throw new UsageGraphError(\n `Graph.copy: cannot create an incompatible copy from \"${this.type}\" type to \"${options.type}\" because this would mean losing information about the current graph.`\n );\n\n if (\n typeof options.multi === 'boolean' &&\n options.multi !== this.multi &&\n options.multi !== true\n )\n throw new UsageGraphError(\n '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.'\n );\n\n if (\n typeof options.allowSelfLoops === 'boolean' &&\n options.allowSelfLoops !== this.allowSelfLoops &&\n options.allowSelfLoops !== true\n )\n throw new UsageGraphError(\n '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.'\n );\n\n const graph = this.emptyCopy(options);\n\n const iterator = this._edges.values();\n\n let step, edgeData;\n\n while (((step = iterator.next()), step.done !== true)) {\n edgeData = step.value;\n\n // NOTE: no need to emit events since user cannot access the instance yet\n addEdge(\n graph,\n 'copy',\n false,\n edgeData.undirected,\n edgeData.key,\n edgeData.source.key,\n edgeData.target.key,\n assign({}, edgeData.attributes)\n );\n }\n\n return graph;\n }\n\n /**---------------------------------------------------------------------------\n * Known methods\n **---------------------------------------------------------------------------\n */\n\n /**\n * Method used by JavaScript to perform JSON serialization.\n *\n * @return {object} - The serialized graph.\n */\n toJSON() {\n return this.export();\n }\n\n /**\n * Method returning [object Graph].\n */\n toString() {\n return '[object Graph]';\n }\n\n /**\n * Method used internally by node's console to display a custom object.\n *\n * @return {object} - Formatted object representation of the graph.\n */\n inspect() {\n const nodes = {};\n this._nodes.forEach((data, key) => {\n nodes[key] = data.attributes;\n });\n\n const edges = {},\n multiIndex = {};\n\n this._edges.forEach((data, key) => {\n const direction = data.undirected ? '--' : '->';\n\n let label = '';\n\n let source = data.source.key;\n let target = data.target.key;\n let tmp;\n\n if (data.undirected && source > target) {\n tmp = source;\n source = target;\n target = tmp;\n }\n\n const desc = `(${source})${direction}(${target})`;\n\n if (!key.startsWith('geid_')) {\n label += `[${key}]: `;\n } else if (this.multi) {\n if (typeof multiIndex[desc] === 'undefined') {\n multiIndex[desc] = 0;\n } else {\n multiIndex[desc]++;\n }\n\n label += `${multiIndex[desc]}. `;\n }\n\n label += desc;\n\n edges[label] = data.attributes;\n });\n\n const dummy = {};\n\n for (const k in this) {\n if (\n this.hasOwnProperty(k) &&\n !EMITTER_PROPS.has(k) &&\n typeof this[k] !== 'function' &&\n typeof k !== 'symbol'\n )\n dummy[k] = this[k];\n }\n\n dummy.attributes = this._attributes;\n dummy.nodes = nodes;\n dummy.edges = edges;\n\n privateProperty(dummy, 'constructor', this.constructor);\n\n return dummy;\n }\n}\n\n/**\n * Attaching methods to the prototype.\n *\n * Here, we are attaching a wide variety of methods to the Graph class'\n * prototype when those are very numerous and when their creation is\n * abstracted.\n */\n\n/**\n * Attaching custom inspect method for node >= 10.\n */\nif (typeof Symbol !== 'undefined')\n Graph.prototype[Symbol.for('nodejs.util.inspect.custom')] =\n Graph.prototype.inspect;\n\n/**\n * Related to edge addition.\n */\nEDGE_ADD_METHODS.forEach(method => {\n ['add', 'merge', 'update'].forEach(verb => {\n const name = method.name(verb);\n const fn = verb === 'add' ? addEdge : mergeEdge;\n\n if (method.generateKey) {\n Graph.prototype[name] = function (source, target, attributes) {\n return fn(\n this,\n name,\n true,\n (method.type || this.type) === 'undirected',\n null,\n source,\n target,\n attributes,\n verb === 'update'\n );\n };\n } else {\n Graph.prototype[name] = function (edge, source, target, attributes) {\n return fn(\n this,\n name,\n false,\n (method.type || this.type) === 'undirected',\n edge,\n source,\n target,\n attributes,\n verb === 'update'\n );\n };\n }\n });\n});\n\n/**\n * Attributes-related.\n */\nattachNodeAttributesMethods(Graph);\nattachEdgeAttributesMethods(Graph);\n\n/**\n * Edge iteration-related.\n */\nattachEdgeIterationMethods(Graph);\n\n/**\n * Neighbor iteration-related.\n */\nattachNeighborIterationMethods(Graph);\n", "/**\n * Graphology Helper Classes\n * ==========================\n *\n * Building some higher-order classes instantiating the graph with\n * predefinite options.\n */\nimport {assign} from './utils';\nimport Graph from './graph';\n\nimport {\n InvalidArgumentsGraphError,\n NotFoundGraphError,\n UsageGraphError\n} from './errors';\n\n/**\n * Alternative constructors.\n */\nclass DirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'directed'}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== false)\n throw new InvalidArgumentsGraphError(\n 'DirectedGraph.from: inconsistent indication that the graph should be multi in given options!'\n );\n\n if (finalOptions.type !== 'directed')\n throw new InvalidArgumentsGraphError(\n 'DirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass UndirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'undirected'}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== false)\n throw new InvalidArgumentsGraphError(\n 'UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!'\n );\n\n if (finalOptions.type !== 'undirected')\n throw new InvalidArgumentsGraphError(\n 'UndirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiDirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'directed', multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n if (finalOptions.type !== 'directed')\n throw new InvalidArgumentsGraphError(\n 'MultiDirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\nclass MultiUndirectedGraph extends Graph {\n constructor(options) {\n const finalOptions = assign({type: 'undirected', multi: true}, options);\n\n if ('multi' in finalOptions && finalOptions.multi !== true)\n throw new InvalidArgumentsGraphError(\n 'MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!'\n );\n\n if (finalOptions.type !== 'undirected')\n throw new InvalidArgumentsGraphError(\n 'MultiUndirectedGraph.from: inconsistent \"' +\n finalOptions.type +\n '\" type in given options!'\n );\n\n super(finalOptions);\n }\n}\n\n/**\n * Attaching static #.from method to each of the constructors.\n */\nfunction attachStaticFromMethod(Class) {\n /**\n * Builds a graph from serialized data or another graph's data.\n *\n * @param {Graph|SerializedGraph} data - Hydratation data.\n * @param {object} [options] - Options.\n * @return {Class}\n */\n Class.from = function (data, options) {\n // Merging given options with serialized ones\n const finalOptions = assign({}, data.options, options);\n\n const instance = new Class(finalOptions);\n instance.import(data);\n\n return instance;\n };\n}\n\nattachStaticFromMethod(Graph);\nattachStaticFromMethod(DirectedGraph);\nattachStaticFromMethod(UndirectedGraph);\nattachStaticFromMethod(MultiGraph);\nattachStaticFromMethod(MultiDirectedGraph);\nattachStaticFromMethod(MultiUndirectedGraph);\n\nGraph.Graph = Graph;\nGraph.DirectedGraph = DirectedGraph;\nGraph.UndirectedGraph = UndirectedGraph;\nGraph.MultiGraph = MultiGraph;\nGraph.MultiDirectedGraph = MultiDirectedGraph;\nGraph.MultiUndirectedGraph = MultiUndirectedGraph;\n\nGraph.InvalidArgumentsGraphError = InvalidArgumentsGraphError;\nGraph.NotFoundGraphError = NotFoundGraphError;\nGraph.UsageGraphError = UsageGraphError;\n\nexport {\n Graph,\n DirectedGraph,\n UndirectedGraph,\n MultiGraph,\n MultiDirectedGraph,\n MultiUndirectedGraph\n};\n", "/**\n * Graphology isGraph\n * ===================\n *\n * Very simple function aiming at ensuring the given variable is a\n * graphology instance.\n */\n\n/**\n * Checking the value is a graphology instance.\n *\n * @param {any} value - Target value.\n * @return {boolean}\n */\nmodule.exports = function isGraph(value) {\n return (\n value !== null &&\n typeof value === 'object' &&\n typeof value.addUndirectedEdgeWithKey === 'function' &&\n typeof value.dropNode === 'function' &&\n typeof value.multi === 'boolean'\n );\n};\n", "/**\n * Graphology Weight Getter\n * =========================\n *\n * Function creating weight getters.\n */\nfunction coerceWeight(value) {\n // Ensuring target value is a correct number\n if (typeof value !== 'number' || isNaN(value)) return 1;\n\n return value;\n}\n\nfunction createNodeValueGetter(nameOrFunction, defaultValue) {\n var getter = {};\n\n var coerceToDefault = function (v) {\n if (typeof v === 'undefined') return defaultValue;\n\n return v;\n };\n\n if (typeof defaultValue === 'function') coerceToDefault = defaultValue;\n\n var get = function (attributes) {\n return coerceToDefault(attributes[nameOrFunction]);\n };\n\n var returnDefault = function () {\n return coerceToDefault(undefined);\n };\n\n if (typeof nameOrFunction === 'string') {\n getter.fromAttributes = get;\n getter.fromGraph = function (graph, node) {\n return get(graph.getNodeAttributes(node));\n };\n getter.fromEntry = function (node, attributes) {\n return get(attributes);\n };\n } else if (typeof nameOrFunction === 'function') {\n getter.fromAttributes = function () {\n throw new Error(\n 'graphology-utils/getters/createNodeValueGetter: irrelevant usage.'\n );\n };\n getter.fromGraph = function (graph, node) {\n return coerceToDefault(\n nameOrFunction(node, graph.getNodeAttributes(node))\n );\n };\n getter.fromEntry = function (node, attributes) {\n return coerceToDefault(nameOrFunction(node, attributes));\n };\n } else {\n getter.fromAttributes = returnDefault;\n getter.fromGraph = returnDefault;\n getter.fromEntry = returnDefault;\n }\n\n return getter;\n}\n\nfunction createEdgeValueGetter(nameOrFunction, defaultValue) {\n var getter = {};\n\n var coerceToDefault = function (v) {\n if (typeof v === 'undefined') return defaultValue;\n\n return v;\n };\n\n if (typeof defaultValue === 'function') coerceToDefault = defaultValue;\n\n var get = function (attributes) {\n return coerceToDefault(attributes[nameOrFunction]);\n };\n\n var returnDefault = function () {\n return coerceToDefault(undefined);\n };\n\n if (typeof nameOrFunction === 'string') {\n getter.fromAttributes = get;\n getter.fromGraph = function (graph, edge) {\n return get(graph.getEdgeAttributes(edge));\n };\n getter.fromEntry = function (edge, attributes) {\n return get(attributes);\n };\n getter.fromPartialEntry = getter.fromEntry;\n getter.fromMinimalEntry = getter.fromEntry;\n } else if (typeof nameOrFunction === 'function') {\n getter.fromAttributes = function () {\n throw new Error(\n 'graphology-utils/getters/createEdgeValueGetter: irrelevant usage.'\n );\n };\n getter.fromGraph = function (graph, edge) {\n // TODO: we can do better, check #310\n var extremities = graph.extremities(edge);\n return coerceToDefault(\n nameOrFunction(\n edge,\n graph.getEdgeAttributes(edge),\n extremities[0],\n extremities[1],\n graph.getNodeAttributes(extremities[0]),\n graph.getNodeAttributes(extremities[1]),\n graph.isUndirected(edge)\n )\n );\n };\n getter.fromEntry = function (e, a, s, t, sa, ta, u) {\n return coerceToDefault(nameOrFunction(e, a, s, t, sa, ta, u));\n };\n getter.fromPartialEntry = function (e, a, s, t) {\n return coerceToDefault(nameOrFunction(e, a, s, t));\n };\n getter.fromMinimalEntry = function (e, a) {\n return coerceToDefault(nameOrFunction(e, a));\n };\n } else {\n getter.fromAttributes = returnDefault;\n getter.fromGraph = returnDefault;\n getter.fromEntry = returnDefault;\n getter.fromMinimalEntry = returnDefault;\n }\n\n return getter;\n}\n\nexports.createNodeValueGetter = createNodeValueGetter;\nexports.createEdgeValueGetter = createEdgeValueGetter;\nexports.createEdgeWeightGetter = function (name) {\n return createEdgeValueGetter(name, coerceWeight);\n};\n", "/* eslint no-constant-condition: 0 */\n/**\n * Graphology ForceAtlas2 Iteration\n * =================================\n *\n * Function used to perform a single iteration of the algorithm.\n */\n\n/**\n * Matrices properties accessors.\n */\nvar NODE_X = 0;\nvar NODE_Y = 1;\nvar NODE_DX = 2;\nvar NODE_DY = 3;\nvar NODE_OLD_DX = 4;\nvar NODE_OLD_DY = 5;\nvar NODE_MASS = 6;\nvar NODE_CONVERGENCE = 7;\nvar NODE_SIZE = 8;\nvar NODE_FIXED = 9;\n\nvar EDGE_SOURCE = 0;\nvar EDGE_TARGET = 1;\nvar EDGE_WEIGHT = 2;\n\nvar REGION_NODE = 0;\nvar REGION_CENTER_X = 1;\nvar REGION_CENTER_Y = 2;\nvar REGION_SIZE = 3;\nvar REGION_NEXT_SIBLING = 4;\nvar REGION_FIRST_CHILD = 5;\nvar REGION_MASS = 6;\nvar REGION_MASS_CENTER_X = 7;\nvar REGION_MASS_CENTER_Y = 8;\n\nvar SUBDIVISION_ATTEMPTS = 3;\n\n/**\n * Constants.\n */\nvar PPN = 10;\nvar PPE = 3;\nvar PPR = 9;\n\nvar MAX_FORCE = 10;\n\n/**\n * Function used to perform a single interation of the algorithm.\n *\n * @param {object} options - Layout options.\n * @param {Float32Array} NodeMatrix - Node data.\n * @param {Float32Array} EdgeMatrix - Edge data.\n * @return {object} - Some metadata.\n */\nmodule.exports = function iterate(options, NodeMatrix, EdgeMatrix) {\n // Initializing variables\n var l, r, n, n1, n2, rn, e, w, g, s;\n\n var order = NodeMatrix.length,\n size = EdgeMatrix.length;\n\n var adjustSizes = options.adjustSizes;\n\n var thetaSquared = options.barnesHutTheta * options.barnesHutTheta;\n\n var outboundAttCompensation, coefficient, xDist, yDist, ewc, distance, factor;\n\n var RegionMatrix = [];\n\n // 1) Initializing layout data\n //-----------------------------\n\n // Resetting positions & computing max values\n for (n = 0; n < order; n += PPN) {\n NodeMatrix[n + NODE_OLD_DX] = NodeMatrix[n + NODE_DX];\n NodeMatrix[n + NODE_OLD_DY] = NodeMatrix[n + NODE_DY];\n NodeMatrix[n + NODE_DX] = 0;\n NodeMatrix[n + NODE_DY] = 0;\n }\n\n // If outbound attraction distribution, compensate\n if (options.outboundAttractionDistribution) {\n outboundAttCompensation = 0;\n for (n = 0; n < order; n += PPN) {\n outboundAttCompensation += NodeMatrix[n + NODE_MASS];\n }\n\n outboundAttCompensation /= order / PPN;\n }\n\n // 1.bis) Barnes-Hut computation\n //------------------------------\n\n if (options.barnesHutOptimize) {\n // Setting up\n var minX = Infinity,\n maxX = -Infinity,\n minY = Infinity,\n maxY = -Infinity,\n q,\n q2,\n subdivisionAttempts;\n\n // Computing min and max values\n for (n = 0; n < order; n += PPN) {\n minX = Math.min(minX, NodeMatrix[n + NODE_X]);\n maxX = Math.max(maxX, NodeMatrix[n + NODE_X]);\n minY = Math.min(minY, NodeMatrix[n + NODE_Y]);\n maxY = Math.max(maxY, NodeMatrix[n + NODE_Y]);\n }\n\n // squarify bounds, it's a quadtree\n var dx = maxX - minX,\n dy = maxY - minY;\n if (dx > dy) {\n minY -= (dx - dy) / 2;\n maxY = minY + dx;\n } else {\n minX -= (dy - dx) / 2;\n maxX = minX + dy;\n }\n\n // Build the Barnes Hut root region\n RegionMatrix[0 + REGION_NODE] = -1;\n RegionMatrix[0 + REGION_CENTER_X] = (minX + maxX) / 2;\n RegionMatrix[0 + REGION_CENTER_Y] = (minY + maxY) / 2;\n RegionMatrix[0 + REGION_SIZE] = Math.max(maxX - minX, maxY - minY);\n RegionMatrix[0 + REGION_NEXT_SIBLING] = -1;\n RegionMatrix[0 + REGION_FIRST_CHILD] = -1;\n RegionMatrix[0 + REGION_MASS] = 0;\n RegionMatrix[0 + REGION_MASS_CENTER_X] = 0;\n RegionMatrix[0 + REGION_MASS_CENTER_Y] = 0;\n\n // Add each node in the tree\n l = 1;\n for (n = 0; n < order; n += PPN) {\n // Current region, starting with root\n r = 0;\n subdivisionAttempts = SUBDIVISION_ATTEMPTS;\n\n while (true) {\n // Are there sub-regions?\n\n // We look at first child index\n if (RegionMatrix[r + REGION_FIRST_CHILD] >= 0) {\n // There are sub-regions\n\n // We just iterate to find a \"leaf\" of the tree\n // that is an empty region or a region with a single node\n // (see next case)\n\n // Find the quadrant of n\n if (NodeMatrix[n + NODE_X] < RegionMatrix[r + REGION_CENTER_X]) {\n if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {\n // Top Left quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD];\n } else {\n // Bottom Left quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;\n }\n } else {\n if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {\n // Top Right quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;\n } else {\n // Bottom Right quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;\n }\n }\n\n // Update center of mass and mass (we only do it for non-leave regions)\n RegionMatrix[r + REGION_MASS_CENTER_X] =\n (RegionMatrix[r + REGION_MASS_CENTER_X] *\n RegionMatrix[r + REGION_MASS] +\n NodeMatrix[n + NODE_X] * NodeMatrix[n + NODE_MASS]) /\n (RegionMatrix[r + REGION_MASS] + NodeMatrix[n + NODE_MASS]);\n\n RegionMatrix[r + REGION_MASS_CENTER_Y] =\n (RegionMatrix[r + REGION_MASS_CENTER_Y] *\n RegionMatrix[r + REGION_MASS] +\n NodeMatrix[n + NODE_Y] * NodeMatrix[n + NODE_MASS]) /\n (RegionMatrix[r + REGION_MASS] + NodeMatrix[n + NODE_MASS]);\n\n RegionMatrix[r + REGION_MASS] += NodeMatrix[n + NODE_MASS];\n\n // Iterate on the right quadrant\n r = q;\n continue;\n } else {\n // There are no sub-regions: we are in a \"leaf\"\n\n // Is there a node in this leave?\n if (RegionMatrix[r + REGION_NODE] < 0) {\n // There is no node in region:\n // we record node n and go on\n RegionMatrix[r + REGION_NODE] = n;\n break;\n } else {\n // There is a node in this region\n\n // We will need to create sub-regions, stick the two\n // nodes (the old one r[0] and the new one n) in two\n // subregions. If they fall in the same quadrant,\n // we will iterate.\n\n // Create sub-regions\n RegionMatrix[r + REGION_FIRST_CHILD] = l * PPR;\n w = RegionMatrix[r + REGION_SIZE] / 2; // new size (half)\n\n // NOTE: we use screen coordinates\n // from Top Left to Bottom Right\n\n // Top Left sub-region\n g = RegionMatrix[r + REGION_FIRST_CHILD];\n\n RegionMatrix[g + REGION_NODE] = -1;\n RegionMatrix[g + REGION_CENTER_X] =\n RegionMatrix[r + REGION_CENTER_X] - w;\n RegionMatrix[g + REGION_CENTER_Y] =\n RegionMatrix[r + REGION_CENTER_Y] - w;\n RegionMatrix[g + REGION_SIZE] = w;\n RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;\n RegionMatrix[g + REGION_FIRST_CHILD] = -1;\n RegionMatrix[g + REGION_MASS] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_X] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;\n\n // Bottom Left sub-region\n g += PPR;\n RegionMatrix[g + REGION_NODE] = -1;\n RegionMatrix[g + REGION_CENTER_X] =\n RegionMatrix[r + REGION_CENTER_X] - w;\n RegionMatrix[g + REGION_CENTER_Y] =\n RegionMatrix[r + REGION_CENTER_Y] + w;\n RegionMatrix[g + REGION_SIZE] = w;\n RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;\n RegionMatrix[g + REGION_FIRST_CHILD] = -1;\n RegionMatrix[g + REGION_MASS] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_X] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;\n\n // Top Right sub-region\n g += PPR;\n RegionMatrix[g + REGION_NODE] = -1;\n RegionMatrix[g + REGION_CENTER_X] =\n RegionMatrix[r + REGION_CENTER_X] + w;\n RegionMatrix[g + REGION_CENTER_Y] =\n RegionMatrix[r + REGION_CENTER_Y] - w;\n RegionMatrix[g + REGION_SIZE] = w;\n RegionMatrix[g + REGION_NEXT_SIBLING] = g + PPR;\n RegionMatrix[g + REGION_FIRST_CHILD] = -1;\n RegionMatrix[g + REGION_MASS] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_X] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;\n\n // Bottom Right sub-region\n g += PPR;\n RegionMatrix[g + REGION_NODE] = -1;\n RegionMatrix[g + REGION_CENTER_X] =\n RegionMatrix[r + REGION_CENTER_X] + w;\n RegionMatrix[g + REGION_CENTER_Y] =\n RegionMatrix[r + REGION_CENTER_Y] + w;\n RegionMatrix[g + REGION_SIZE] = w;\n RegionMatrix[g + REGION_NEXT_SIBLING] =\n RegionMatrix[r + REGION_NEXT_SIBLING];\n RegionMatrix[g + REGION_FIRST_CHILD] = -1;\n RegionMatrix[g + REGION_MASS] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_X] = 0;\n RegionMatrix[g + REGION_MASS_CENTER_Y] = 0;\n\n l += 4;\n\n // Now the goal is to find two different sub-regions\n // for the two nodes: the one previously recorded (r[0])\n // and the one we want to add (n)\n\n // Find the quadrant of the old node\n if (\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_X] <\n RegionMatrix[r + REGION_CENTER_X]\n ) {\n if (\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y] <\n RegionMatrix[r + REGION_CENTER_Y]\n ) {\n // Top Left quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD];\n } else {\n // Bottom Left quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;\n }\n } else {\n if (\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y] <\n RegionMatrix[r + REGION_CENTER_Y]\n ) {\n // Top Right quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;\n } else {\n // Bottom Right quarter\n q = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;\n }\n }\n\n // We remove r[0] from the region r, add its mass to r and record it in q\n RegionMatrix[r + REGION_MASS] =\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_MASS];\n RegionMatrix[r + REGION_MASS_CENTER_X] =\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_X];\n RegionMatrix[r + REGION_MASS_CENTER_Y] =\n NodeMatrix[RegionMatrix[r + REGION_NODE] + NODE_Y];\n\n RegionMatrix[q + REGION_NODE] = RegionMatrix[r + REGION_NODE];\n RegionMatrix[r + REGION_NODE] = -1;\n\n // Find the quadrant of n\n if (NodeMatrix[n + NODE_X] < RegionMatrix[r + REGION_CENTER_X]) {\n if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {\n // Top Left quarter\n q2 = RegionMatrix[r + REGION_FIRST_CHILD];\n } else {\n // Bottom Left quarter\n q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR;\n }\n } else {\n if (NodeMatrix[n + NODE_Y] < RegionMatrix[r + REGION_CENTER_Y]) {\n // Top Right quarter\n q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 2;\n } else {\n // Bottom Right quarter\n q2 = RegionMatrix[r + REGION_FIRST_CHILD] + PPR * 3;\n }\n }\n\n if (q === q2) {\n // If both nodes are in the same quadrant,\n // we have to try it again on this quadrant\n if (subdivisionAttempts--) {\n r = q;\n continue; // while\n } else {\n // we are out of precision here, and we cannot subdivide anymore\n // but we have to break the loop anyway\n subdivisionAttempts = SUBDIVISION_ATTEMPTS;\n break; // while\n }\n }\n\n // If both quadrants are different, we record n\n // in its quadrant\n RegionMatrix[q2 + REGION_NODE] = n;\n break;\n }\n }\n }\n }\n }\n\n // 2) Repulsion\n //--------------\n // NOTES: adjustSizes = antiCollision & scalingRatio = coefficient\n\n if (options.barnesHutOptimize) {\n coefficient = options.scalingRatio;\n\n // Applying repulsion through regions\n for (n = 0; n < order; n += PPN) {\n // Computing leaf quad nodes iteration\n\n r = 0; // Starting with root region\n while (true) {\n if (RegionMatrix[r + REGION_FIRST_CHILD] >= 0) {\n // The region has sub-regions\n\n // We run the Barnes Hut test to see if we are at the right distance\n distance =\n Math.pow(\n NodeMatrix[n + NODE_X] - RegionMatrix[r + REGION_MASS_CENTER_X],\n 2\n ) +\n Math.pow(\n NodeMatrix[n + NODE_Y] - RegionMatrix[r + REGION_MASS_CENTER_Y],\n 2\n );\n\n s = RegionMatrix[r + REGION_SIZE];\n\n if ((4 * s * s) / distance < thetaSquared) {\n // We treat the region as a single body, and we repulse\n\n xDist =\n NodeMatrix[n + NODE_X] - RegionMatrix[r + REGION_MASS_CENTER_X];\n yDist =\n NodeMatrix[n + NODE_Y] - RegionMatrix[r + REGION_MASS_CENTER_Y];\n\n if (adjustSizes === true) {\n //-- Linear Anti-collision Repulsion\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n + NODE_MASS] *\n RegionMatrix[r + REGION_MASS]) /\n distance;\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n } else if (distance < 0) {\n factor =\n (-coefficient *\n NodeMatrix[n + NODE_MASS] *\n RegionMatrix[r + REGION_MASS]) /\n Math.sqrt(distance);\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n }\n } else {\n //-- Linear Repulsion\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n + NODE_MASS] *\n RegionMatrix[r + REGION_MASS]) /\n distance;\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n }\n }\n\n // When this is done, we iterate. We have to look at the next sibling.\n r = RegionMatrix[r + REGION_NEXT_SIBLING];\n if (r < 0) break; // No next sibling: we have finished the tree\n\n continue;\n } else {\n // The region is too close and we have to look at sub-regions\n r = RegionMatrix[r + REGION_FIRST_CHILD];\n continue;\n }\n } else {\n // The region has no sub-region\n // If there is a node r[0] and it is not n, then repulse\n rn = RegionMatrix[r + REGION_NODE];\n\n if (rn >= 0 && rn !== n) {\n xDist = NodeMatrix[n + NODE_X] - NodeMatrix[rn + NODE_X];\n yDist = NodeMatrix[n + NODE_Y] - NodeMatrix[rn + NODE_Y];\n\n distance = xDist * xDist + yDist * yDist;\n\n if (adjustSizes === true) {\n //-- Linear Anti-collision Repulsion\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n + NODE_MASS] *\n NodeMatrix[rn + NODE_MASS]) /\n distance;\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n } else if (distance < 0) {\n factor =\n (-coefficient *\n NodeMatrix[n + NODE_MASS] *\n NodeMatrix[rn + NODE_MASS]) /\n Math.sqrt(distance);\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n }\n } else {\n //-- Linear Repulsion\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n + NODE_MASS] *\n NodeMatrix[rn + NODE_MASS]) /\n distance;\n\n NodeMatrix[n + NODE_DX] += xDist * factor;\n NodeMatrix[n + NODE_DY] += yDist * factor;\n }\n }\n }\n\n // When this is done, we iterate. We have to look at the next sibling.\n r = RegionMatrix[r + REGION_NEXT_SIBLING];\n\n if (r < 0) break; // No next sibling: we have finished the tree\n\n continue;\n }\n }\n }\n } else {\n coefficient = options.scalingRatio;\n\n // Square iteration\n for (n1 = 0; n1 < order; n1 += PPN) {\n for (n2 = 0; n2 < n1; n2 += PPN) {\n // Common to both methods\n xDist = NodeMatrix[n1 + NODE_X] - NodeMatrix[n2 + NODE_X];\n yDist = NodeMatrix[n1 + NODE_Y] - NodeMatrix[n2 + NODE_Y];\n\n if (adjustSizes === true) {\n //-- Anticollision Linear Repulsion\n distance =\n Math.sqrt(xDist * xDist + yDist * yDist) -\n NodeMatrix[n1 + NODE_SIZE] -\n NodeMatrix[n2 + NODE_SIZE];\n\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n1 + NODE_MASS] *\n NodeMatrix[n2 + NODE_MASS]) /\n distance /\n distance;\n\n // Updating nodes' dx and dy\n NodeMatrix[n1 + NODE_DX] += xDist * factor;\n NodeMatrix[n1 + NODE_DY] += yDist * factor;\n\n NodeMatrix[n2 + NODE_DX] -= xDist * factor;\n NodeMatrix[n2 + NODE_DY] -= yDist * factor;\n } else if (distance < 0) {\n factor =\n 100 *\n coefficient *\n NodeMatrix[n1 + NODE_MASS] *\n NodeMatrix[n2 + NODE_MASS];\n\n // Updating nodes' dx and dy\n NodeMatrix[n1 + NODE_DX] += xDist * factor;\n NodeMatrix[n1 + NODE_DY] += yDist * factor;\n\n NodeMatrix[n2 + NODE_DX] -= xDist * factor;\n NodeMatrix[n2 + NODE_DY] -= yDist * factor;\n }\n } else {\n //-- Linear Repulsion\n distance = Math.sqrt(xDist * xDist + yDist * yDist);\n\n if (distance > 0) {\n factor =\n (coefficient *\n NodeMatrix[n1 + NODE_MASS] *\n NodeMatrix[n2 + NODE_MASS]) /\n distance /\n distance;\n\n // Updating nodes' dx and dy\n NodeMatrix[n1 + NODE_DX] += xDist * factor;\n NodeMatrix[n1 + NODE_DY] += yDist * factor;\n\n NodeMatrix[n2 + NODE_DX] -= xDist * factor;\n NodeMatrix[n2 + NODE_DY] -= yDist * factor;\n }\n }\n }\n }\n }\n\n // 3) Gravity\n //------------\n g = options.gravity / options.scalingRatio;\n coefficient = options.scalingRatio;\n for (n = 0; n < order; n += PPN) {\n factor = 0;\n\n // Common to both methods\n xDist = NodeMatrix[n + NODE_X];\n yDist = NodeMatrix[n + NODE_Y];\n distance = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2));\n\n if (options.strongGravityMode) {\n //-- Strong gravity\n if (distance > 0) factor = coefficient * NodeMatrix[n + NODE_MASS] * g;\n } else {\n //-- Linear Anti-collision Repulsion n\n if (distance > 0)\n factor = (coefficient * NodeMatrix[n + NODE_MASS] * g) / distance;\n }\n\n // Updating node's dx and dy\n NodeMatrix[n + NODE_DX] -= xDist * factor;\n NodeMatrix[n + NODE_DY] -= yDist * factor;\n }\n\n // 4) Attraction\n //---------------\n coefficient =\n 1 * (options.outboundAttractionDistribution ? outboundAttCompensation : 1);\n\n // TODO: simplify distance\n // TODO: coefficient is always used as -c --> optimize?\n for (e = 0; e < size; e += PPE) {\n n1 = EdgeMatrix[e + EDGE_SOURCE];\n n2 = EdgeMatrix[e + EDGE_TARGET];\n w = EdgeMatrix[e + EDGE_WEIGHT];\n\n // Edge weight influence\n ewc = Math.pow(w, options.edgeWeightInfluence);\n\n // Common measures\n xDist = NodeMatrix[n1 + NODE_X] - NodeMatrix[n2 + NODE_X];\n yDist = NodeMatrix[n1 + NODE_Y] - NodeMatrix[n2 + NODE_Y];\n\n // Applying attraction to nodes\n if (adjustSizes === true) {\n distance =\n Math.sqrt(xDist * xDist + yDist * yDist) -\n NodeMatrix[n1 + NODE_SIZE] -\n NodeMatrix[n2 + NODE_SIZE];\n\n if (options.linLogMode) {\n if (options.outboundAttractionDistribution) {\n //-- LinLog Degree Distributed Anti-collision Attraction\n if (distance > 0) {\n factor =\n (-coefficient * ewc * Math.log(1 + distance)) /\n distance /\n NodeMatrix[n1 + NODE_MASS];\n }\n } else {\n //-- LinLog Anti-collision Attraction\n if (distance > 0) {\n factor = (-coefficient * ewc * Math.log(1 + distance)) / distance;\n }\n }\n } else {\n if (options.outboundAttractionDistribution) {\n //-- Linear Degree Distributed Anti-collision Attraction\n if (distance > 0) {\n factor = (-coefficient * ewc) / NodeMatrix[n1 + NODE_MASS];\n }\n } else {\n //-- Linear Anti-collision Attraction\n if (distance > 0) {\n factor = -coefficient * ewc;\n }\n }\n }\n } else {\n distance = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2));\n\n if (options.linLogMode) {\n if (options.outboundAttractionDistribution) {\n //-- LinLog Degree Distributed Attraction\n if (distance > 0) {\n factor =\n (-coefficient * ewc * Math.log(1 + distance)) /\n distance /\n NodeMatrix[n1 + NODE_MASS];\n }\n } else {\n //-- LinLog Attraction\n if (distance > 0)\n factor = (-coefficient * ewc * Math.log(1 + distance)) / distance;\n }\n } else {\n if (options.outboundAttractionDistribution) {\n //-- Linear Attraction Mass Distributed\n // NOTE: Distance is set to 1 to override next condition\n distance = 1;\n factor = (-coefficient * ewc) / NodeMatrix[n1 + NODE_MASS];\n } else {\n //-- Linear Attraction\n // NOTE: Distance is set to 1 to override next condition\n distance = 1;\n factor = -coefficient * ewc;\n }\n }\n }\n\n // Updating nodes' dx and dy\n // TODO: if condition or factor = 1?\n if (distance > 0) {\n // Updating nodes' dx and dy\n NodeMatrix[n1 + NODE_DX] += xDist * factor;\n NodeMatrix[n1 + NODE_DY] += yDist * factor;\n\n NodeMatrix[n2 + NODE_DX] -= xDist * factor;\n NodeMatrix[n2 + NODE_DY] -= yDist * factor;\n }\n }\n\n // 5) Apply Forces\n //-----------------\n var force, swinging, traction, nodespeed, newX, newY;\n\n // MATH: sqrt and square distances\n if (adjustSizes === true) {\n for (n = 0; n < order; n += PPN) {\n if (NodeMatrix[n + NODE_FIXED] !== 1) {\n force = Math.sqrt(\n Math.pow(NodeMatrix[n + NODE_DX], 2) +\n Math.pow(NodeMatrix[n + NODE_DY], 2)\n );\n\n if (force > MAX_FORCE) {\n NodeMatrix[n + NODE_DX] =\n (NodeMatrix[n + NODE_DX] * MAX_FORCE) / force;\n NodeMatrix[n + NODE_DY] =\n (NodeMatrix[n + NODE_DY] * MAX_FORCE) / force;\n }\n\n swinging =\n NodeMatrix[n + NODE_MASS] *\n Math.sqrt(\n (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) *\n (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) +\n (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY]) *\n (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY])\n );\n\n traction =\n Math.sqrt(\n (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) *\n (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) +\n (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY]) *\n (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY])\n ) / 2;\n\n nodespeed = (0.1 * Math.log(1 + traction)) / (1 + Math.sqrt(swinging));\n\n // Updating node's positon\n newX =\n NodeMatrix[n + NODE_X] +\n NodeMatrix[n + NODE_DX] * (nodespeed / options.slowDown);\n NodeMatrix[n + NODE_X] = newX;\n\n newY =\n NodeMatrix[n + NODE_Y] +\n NodeMatrix[n + NODE_DY] * (nodespeed / options.slowDown);\n NodeMatrix[n + NODE_Y] = newY;\n }\n }\n } else {\n for (n = 0; n < order; n += PPN) {\n if (NodeMatrix[n + NODE_FIXED] !== 1) {\n swinging =\n NodeMatrix[n + NODE_MASS] *\n Math.sqrt(\n (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) *\n (NodeMatrix[n + NODE_OLD_DX] - NodeMatrix[n + NODE_DX]) +\n (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY]) *\n (NodeMatrix[n + NODE_OLD_DY] - NodeMatrix[n + NODE_DY])\n );\n\n traction =\n Math.sqrt(\n (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) *\n (NodeMatrix[n + NODE_OLD_DX] + NodeMatrix[n + NODE_DX]) +\n (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY]) *\n (NodeMatrix[n + NODE_OLD_DY] + NodeMatrix[n + NODE_DY])\n ) / 2;\n\n nodespeed =\n (NodeMatrix[n + NODE_CONVERGENCE] * Math.log(1 + traction)) /\n (1 + Math.sqrt(swinging));\n\n // Updating node convergence\n NodeMatrix[n + NODE_CONVERGENCE] = Math.min(\n 1,\n Math.sqrt(\n (nodespeed *\n (Math.pow(NodeMatrix[n + NODE_DX], 2) +\n Math.pow(NodeMatrix[n + NODE_DY], 2))) /\n (1 + Math.sqrt(swinging))\n )\n );\n\n // Updating node's positon\n newX =\n NodeMatrix[n + NODE_X] +\n NodeMatrix[n + NODE_DX] * (nodespeed / options.slowDown);\n NodeMatrix[n + NODE_X] = newX;\n\n newY =\n NodeMatrix[n + NODE_Y] +\n NodeMatrix[n + NODE_DY] * (nodespeed / options.slowDown);\n NodeMatrix[n + NODE_Y] = newY;\n }\n }\n }\n\n // We return the information about the layout (no need to return the matrices)\n return {};\n};\n", "/**\n * Graphology ForceAtlas2 Helpers\n * ===============================\n *\n * Miscellaneous helper functions.\n */\n\n/**\n * Constants.\n */\nvar PPN = 10;\nvar PPE = 3;\n\n/**\n * Very simple Object.assign-like function.\n *\n * @param {object} target - First object.\n * @param {object} [...objects] - Objects to merge.\n * @return {object}\n */\nexports.assign = function (target) {\n target = target || {};\n\n var objects = Array.prototype.slice.call(arguments).slice(1),\n i,\n k,\n l;\n\n for (i = 0, l = objects.length; i < l; i++) {\n if (!objects[i]) continue;\n\n for (k in objects[i]) target[k] = objects[i][k];\n }\n\n return target;\n};\n\n/**\n * Function used to validate the given settings.\n *\n * @param {object} settings - Settings to validate.\n * @return {object|null}\n */\nexports.validateSettings = function (settings) {\n if ('linLogMode' in settings && typeof settings.linLogMode !== 'boolean')\n return {message: 'the `linLogMode` setting should be a boolean.'};\n\n if (\n 'outboundAttractionDistribution' in settings &&\n typeof settings.outboundAttractionDistribution !== 'boolean'\n )\n return {\n message:\n 'the `outboundAttractionDistribution` setting should be a boolean.'\n };\n\n if ('adjustSizes' in settings && typeof settings.adjustSizes !== 'boolean')\n return {message: 'the `adjustSizes` setting should be a boolean.'};\n\n if (\n 'edgeWeightInfluence' in settings &&\n typeof settings.edgeWeightInfluence !== 'number'\n )\n return {\n message: 'the `edgeWeightInfluence` setting should be a number.'\n };\n\n if (\n 'scalingRatio' in settings &&\n !(typeof settings.scalingRatio === 'number' && settings.scalingRatio >= 0)\n )\n return {message: 'the `scalingRatio` setting should be a number >= 0.'};\n\n if (\n 'strongGravityMode' in settings &&\n typeof settings.strongGravityMode !== 'boolean'\n )\n return {message: 'the `strongGravityMode` setting should be a boolean.'};\n\n if (\n 'gravity' in settings &&\n !(typeof settings.gravity === 'number' && settings.gravity >= 0)\n )\n return {message: 'the `gravity` setting should be a number >= 0.'};\n\n if (\n 'slowDown' in settings &&\n !(typeof settings.slowDown === 'number' || settings.slowDown >= 0)\n )\n return {message: 'the `slowDown` setting should be a number >= 0.'};\n\n if (\n 'barnesHutOptimize' in settings &&\n typeof settings.barnesHutOptimize !== 'boolean'\n )\n return {message: 'the `barnesHutOptimize` setting should be a boolean.'};\n\n if (\n 'barnesHutTheta' in settings &&\n !(\n typeof settings.barnesHutTheta === 'number' &&\n settings.barnesHutTheta >= 0\n )\n )\n return {message: 'the `barnesHutTheta` setting should be a number >= 0.'};\n\n return null;\n};\n\n/**\n * Function generating a flat matrix for both nodes & edges of the given graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {function} getEdgeWeight - Edge weight getter function.\n * @return {object} - Both matrices.\n */\nexports.graphToByteArrays = function (graph, getEdgeWeight) {\n var order = graph.order;\n var size = graph.size;\n var index = {};\n var j;\n\n // NOTE: float32 could lead to issues if edge array needs to index large\n // number of nodes.\n var NodeMatrix = new Float32Array(order * PPN);\n var EdgeMatrix = new Float32Array(size * PPE);\n\n // Iterate through nodes\n j = 0;\n graph.forEachNode(function (node, attr) {\n // Node index\n index[node] = j;\n\n // Populating byte array\n NodeMatrix[j] = attr.x;\n NodeMatrix[j + 1] = attr.y;\n NodeMatrix[j + 2] = 0; // dx\n NodeMatrix[j + 3] = 0; // dy\n NodeMatrix[j + 4] = 0; // old_dx\n NodeMatrix[j + 5] = 0; // old_dy\n NodeMatrix[j + 6] = 1; // mass\n NodeMatrix[j + 7] = 1; // convergence\n NodeMatrix[j + 8] = attr.size || 1;\n NodeMatrix[j + 9] = attr.fixed ? 1 : 0;\n j += PPN;\n });\n\n // Iterate through edges\n j = 0;\n graph.forEachEdge(function (edge, attr, source, target, sa, ta, u) {\n var sj = index[source];\n var tj = index[target];\n\n var weight = getEdgeWeight(edge, attr, source, target, sa, ta, u);\n\n // Incrementing mass to be a node's weighted degree\n NodeMatrix[sj + 6] += weight;\n NodeMatrix[tj + 6] += weight;\n\n // Populating byte array\n EdgeMatrix[j] = sj;\n EdgeMatrix[j + 1] = tj;\n EdgeMatrix[j + 2] = weight;\n j += PPE;\n });\n\n return {\n nodes: NodeMatrix,\n edges: EdgeMatrix\n };\n};\n\n/**\n * Function applying the layout back to the graph.\n *\n * @param {Graph} graph - Target graph.\n * @param {Float32Array} NodeMatrix - Node matrix.\n * @param {function|null} outputReducer - A node reducer.\n */\nexports.assignLayoutChanges = function (graph, NodeMatrix, outputReducer) {\n var i = 0;\n\n graph.updateEachNodeAttributes(function (node, attr) {\n attr.x = NodeMatrix[i];\n attr.y = NodeMatrix[i + 1];\n\n i += PPN;\n\n return outputReducer ? outputReducer(node, attr) : attr;\n });\n};\n\n/**\n * Function reading the positions (only) from the graph, to write them in the matrix.\n *\n * @param {Graph} graph - Target graph.\n * @param {Float32Array} NodeMatrix - Node matrix.\n */\nexports.readGraphPositions = function (graph, NodeMatrix) {\n var i = 0;\n\n graph.forEachNode(function (node, attr) {\n NodeMatrix[i] = attr.x;\n NodeMatrix[i + 1] = attr.y;\n\n i += PPN;\n });\n};\n\n/**\n * Function collecting the layout positions.\n *\n * @param {Graph} graph - Target graph.\n * @param {Float32Array} NodeMatrix - Node matrix.\n * @param {function|null} outputReducer - A nodes reducer.\n * @return {object} - Map to node positions.\n */\nexports.collectLayoutChanges = function (graph, NodeMatrix, outputReducer) {\n var nodes = graph.nodes(),\n positions = {};\n\n for (var i = 0, j = 0, l = NodeMatrix.length; i < l; i += PPN) {\n if (outputReducer) {\n var newAttr = Object.assign({}, graph.getNodeAttributes(nodes[j]));\n newAttr.x = NodeMatrix[i];\n newAttr.y = NodeMatrix[i + 1];\n newAttr = outputReducer(nodes[j], newAttr);\n positions[nodes[j]] = {\n x: newAttr.x,\n y: newAttr.y\n };\n } else {\n positions[nodes[j]] = {\n x: NodeMatrix[i],\n y: NodeMatrix[i + 1]\n };\n }\n\n j++;\n }\n\n return positions;\n};\n\n/**\n * Function returning a web worker from the given function.\n *\n * @param {function} fn - Function for the worker.\n * @return {DOMString}\n */\nexports.createWorker = function createWorker(fn) {\n var xURL = window.URL || window.webkitURL;\n var code = fn.toString();\n var objectUrl = xURL.createObjectURL(\n new Blob(['(' + code + ').call(this);'], {type: 'text/javascript'})\n );\n var worker = new Worker(objectUrl);\n xURL.revokeObjectURL(objectUrl);\n\n return worker;\n};\n", "/**\n * Graphology ForceAtlas2 Layout Default Settings\n * ===============================================\n */\nmodule.exports = {\n linLogMode: false,\n outboundAttractionDistribution: false,\n adjustSizes: false,\n edgeWeightInfluence: 1,\n scalingRatio: 1,\n strongGravityMode: false,\n gravity: 1,\n slowDown: 1,\n barnesHutOptimize: false,\n barnesHutTheta: 0.5\n};\n", "/**\n * Graphology ForceAtlas2 Layout\n * ==============================\n *\n * Library endpoint.\n */\nvar isGraph = require('graphology-utils/is-graph');\nvar createEdgeWeightGetter =\n require('graphology-utils/getters').createEdgeWeightGetter;\nvar iterate = require('./iterate.js');\nvar helpers = require('./helpers.js');\n\nvar DEFAULT_SETTINGS = require('./defaults.js');\n\n/**\n * Asbtract function used to run a certain number of iterations.\n *\n * @param {boolean} assign - Whether to assign positions.\n * @param {Graph} graph - Target graph.\n * @param {object|number} params - If number, params.iterations, else:\n * @param {function} getWeight - Edge weight getter function.\n * @param {number} iterations - Number of iterations.\n * @param {function|null} outputReducer - A node reducer\n * @param {object} [settings] - Settings.\n * @return {object|undefined}\n */\nfunction abstractSynchronousLayout(assign, graph, params) {\n if (!isGraph(graph))\n throw new Error(\n 'graphology-layout-forceatlas2: the given graph is not a valid graphology instance.'\n );\n\n if (typeof params === 'number') params = {iterations: params};\n\n var iterations = params.iterations;\n\n if (typeof iterations !== 'number')\n throw new Error(\n 'graphology-layout-forceatlas2: invalid number of iterations.'\n );\n\n if (iterations <= 0)\n throw new Error(\n 'graphology-layout-forceatlas2: you should provide a positive number of iterations.'\n );\n\n var getEdgeWeight = createEdgeWeightGetter(\n 'getEdgeWeight' in params ? params.getEdgeWeight : 'weight'\n ).fromEntry;\n\n var outputReducer =\n typeof params.outputReducer === 'function' ? params.outputReducer : null;\n\n // Validating settings\n var settings = helpers.assign({}, DEFAULT_SETTINGS, params.settings);\n var validationError = helpers.validateSettings(settings);\n\n if (validationError)\n throw new Error(\n 'graphology-layout-forceatlas2: ' + validationError.message\n );\n\n // Building matrices\n var matrices = helpers.graphToByteArrays(graph, getEdgeWeight);\n\n var i;\n\n // Iterating\n for (i = 0; i < iterations; i++)\n iterate(settings, matrices.nodes, matrices.edges);\n\n // Applying\n if (assign) {\n helpers.assignLayoutChanges(graph, matrices.nodes, outputReducer);\n return;\n }\n\n return helpers.collectLayoutChanges(graph, matrices.nodes);\n}\n\n/**\n * Function returning sane layout settings for the given graph.\n *\n * @param {Graph|number} graph - Target graph or graph order.\n * @return {object}\n */\nfunction inferSettings(graph) {\n var order = typeof graph === 'number' ? graph : graph.order;\n\n return {\n barnesHutOptimize: order > 2000,\n strongGravityMode: true,\n gravity: 0.05,\n scalingRatio: 10,\n slowDown: 1 + Math.log(order)\n };\n}\n\n/**\n * Exporting.\n */\nvar synchronousLayout = abstractSynchronousLayout.bind(null, false);\nsynchronousLayout.assign = abstractSynchronousLayout.bind(null, true);\nsynchronousLayout.inferSettings = inferSettings;\n\nmodule.exports = synchronousLayout;\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n", "import Graph from \"graphology\";\nimport forceAtlas2 from \"graphology-layout-forceatlas2\";\nimport Sigma from \"sigma\";\nimport { EdgeLineProgram } from \"sigma/rendering\";\n\nconst WELL_KNOWN_PATH = \"/.well-known/graphgarden.json\";\n\nexport interface GraphGardenConfig {\n\tlocalNodeColor: string;\n\tfriendNodeColor: string;\n\tinternalEdgeColor: string;\n\tfriendEdgeColor: string;\n\tlabelColor: string;\n\tnodeSize: number;\n\tedgeSize: number;\n\tlabelSize: number;\n\titerations: number;\n}\n\nexport const DEFAULT_CONFIG: GraphGardenConfig = {\n\tlocalNodeColor: \"#6366f1\",\n\tfriendNodeColor: \"#f59e0b\",\n\tinternalEdgeColor: \"#94a3b8\",\n\tfriendEdgeColor: \"#fbbf24\",\n\tlabelColor: \"#334155\",\n\tnodeSize: 4,\n\tedgeSize: 0.5,\n\tlabelSize: 12,\n\titerations: 200,\n};\n\nexport interface GraphGardenNode {\n\turl: string;\n\ttitle: string;\n}\n\nexport interface GraphGardenEdge {\n\tsource: string;\n\ttarget: string;\n\ttype: \"internal\" | \"friend\";\n}\n\nexport interface GraphGardenSite {\n\ttitle: string;\n\tdescription?: string;\n\tlanguage?: string;\n}\n\n/** The top-level shape of a `graphgarden.json` file. */\nexport interface GraphGardenFile {\n\tversion: string;\n\tgenerated_at: string;\n\tbase_url: string;\n\tsite: GraphGardenSite;\n\tnodes: GraphGardenNode[];\n\tedges: GraphGardenEdge[];\n}\n\nfunction isNode(v: unknown): v is GraphGardenNode {\n\treturn (\n\t\ttypeof v === \"object\" &&\n\t\tv !== null &&\n\t\ttypeof (v as Record<string, unknown>).url === \"string\" &&\n\t\ttypeof (v as Record<string, unknown>).title === \"string\"\n\t);\n}\n\nfunction isEdge(v: unknown): v is GraphGardenEdge {\n\treturn (\n\t\ttypeof v === \"object\" &&\n\t\tv !== null &&\n\t\ttypeof (v as Record<string, unknown>).source === \"string\" &&\n\t\ttypeof (v as Record<string, unknown>).target === \"string\" &&\n\t\t((v as Record<string, unknown>).type === \"internal\" ||\n\t\t\t(v as Record<string, unknown>).type === \"friend\")\n\t);\n}\n\n/** Runtime check that `value` matches the {@link GraphGardenFile} shape. */\nexport function isGraphGardenFile(value: unknown): value is GraphGardenFile {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst obj = value as Record<string, unknown>;\n\n\tif (typeof obj.version !== \"string\") return false;\n\tif (typeof obj.generated_at !== \"string\") return false;\n\tif (typeof obj.base_url !== \"string\") return false;\n\n\tif (typeof obj.site !== \"object\" || obj.site === null) return false;\n\tconst site = obj.site as Record<string, unknown>;\n\tif (typeof site.title !== \"string\") return false;\n\tif (site.description !== undefined && typeof site.description !== \"string\") return false;\n\tif (site.language !== undefined && typeof site.language !== \"string\") return false;\n\n\tif (!Array.isArray(obj.nodes) || !obj.nodes.every(isNode)) return false;\n\tif (!Array.isArray(obj.edges) || !obj.edges.every(isEdge)) return false;\n\n\treturn true;\n}\n\n/** Build a graphology `Graph` from a parsed {@link GraphGardenFile}. */\nexport function buildGraph(file: GraphGardenFile, config: GraphGardenConfig): Graph {\n\tconst graph = new Graph();\n\n\tgraph.replaceAttributes({\n\t\tbase_url: file.base_url,\n\t\tsite: file.site,\n\t});\n\n\tfor (const node of file.nodes) {\n\t\tconst absoluteUrl = new URL(node.url, file.base_url).href;\n\t\tgraph.mergeNode(absoluteUrl, {\n\t\t\ttitle: node.title,\n\t\t\tlabel: node.title,\n\t\t\tsize: config.nodeSize,\n\t\t\tcolor: config.localNodeColor,\n\t\t});\n\t}\n\n\t// Friend-edge targets are external URLs not present in the nodes\n\t// array; mergeNode ensures they exist before the edge is added.\n\tfor (const edge of file.edges) {\n\t\tconst absoluteSource = new URL(edge.source, file.base_url).href;\n\t\tconst absoluteTarget = new URL(edge.target, file.base_url).href;\n\t\tgraph.mergeNode(absoluteSource, { size: config.nodeSize });\n\t\tgraph.mergeNode(absoluteTarget, {\n\t\t\tsize: config.nodeSize,\n\t\t\t...(edge.type === \"friend\" && { color: config.friendNodeColor }),\n\t\t});\n\n\t\tconst edgeColor = edge.type === \"friend\" ? config.friendEdgeColor : config.internalEdgeColor;\n\t\tgraph.mergeDirectedEdge(absoluteSource, absoluteTarget, {\n\t\t\ttype: edge.type,\n\t\t\tcolor: edgeColor,\n\t\t\tsize: config.edgeSize,\n\t\t});\n\t}\n\n\treturn graph;\n}\n\n/**\n * Assign random initial positions then run ForceAtlas2 to compute\n * a stable layout. Mutates node `x`/`y` attributes in place.\n */\nexport function assignLayout(graph: Graph, iterations: number): void {\n\tif (graph.order === 0) return;\n\n\t// ForceAtlas2 requires initial positions\n\tgraph.forEachNode((node) => {\n\t\tgraph.mergeNodeAttributes(node, {\n\t\t\tx: Math.random() * 100,\n\t\t\ty: Math.random() * 100,\n\t\t});\n\t});\n\n\tforceAtlas2.assign(graph, {\n\t\titerations,\n\t\tsettings: forceAtlas2.inferSettings(graph),\n\t});\n}\n\n/** Fetch friend sites' graphs and merge their nodes and edges into `graph`. */\nexport async function fetchFriendGraphs(graph: Graph, config: GraphGardenConfig): Promise<Graph> {\n\tconst origins = new Set<string>();\n\tgraph.forEachEdge((_edge, attributes, _source, target) => {\n\t\tif (attributes.type === \"friend\") {\n\t\t\ttry {\n\t\t\t\torigins.add(new URL(target).origin);\n\t\t\t} catch {\n\t\t\t\tconsole.warn(`fetchFriendGraphs: invalid friend target URL: ${target}`);\n\t\t\t}\n\t\t}\n\t});\n\n\tconst results = await Promise.allSettled(\n\t\t[...origins].map(async (origin) => {\n\t\t\tconst response = await fetch(`${origin}${WELL_KNOWN_PATH}`);\n\t\t\tif (!response.ok) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`fetchFriendGraphs: ${origin} responded ${response.status} ${response.statusText}`,\n\t\t\t\t);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst data: unknown = await response.json();\n\t\t\tif (!isGraphGardenFile(data)) {\n\t\t\t\tconsole.warn(`fetchFriendGraphs: ${origin} returned an invalid GraphGarden file`);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn data;\n\t\t}),\n\t);\n\n\tfor (const result of results) {\n\t\tif (result.status === \"rejected\") {\n\t\t\tconsole.warn(\"fetchFriendGraphs: fetch failed:\", result.reason);\n\t\t\tcontinue;\n\t\t}\n\t\tconst friendFile = result.value;\n\t\tif (!friendFile) continue;\n\n\t\ttry {\n\t\t\tfor (const node of friendFile.nodes) {\n\t\t\t\tconst absoluteUrl = new URL(node.url, friendFile.base_url).href;\n\t\t\t\tgraph.mergeNode(absoluteUrl, {\n\t\t\t\t\ttitle: node.title,\n\t\t\t\t\tlabel: node.title,\n\t\t\t\t\tsize: config.nodeSize,\n\t\t\t\t\tcolor: config.friendNodeColor,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor (const edge of friendFile.edges) {\n\t\t\t\tconst absoluteSource = new URL(edge.source, friendFile.base_url).href;\n\t\t\t\tconst absoluteTarget = new URL(edge.target, friendFile.base_url).href;\n\t\t\t\tgraph.mergeNode(absoluteSource, { size: config.nodeSize });\n\t\t\t\tgraph.mergeNode(absoluteTarget, {\n\t\t\t\t\tsize: config.nodeSize,\n\t\t\t\t\t...(edge.type === \"friend\" && { color: config.friendNodeColor }),\n\t\t\t\t});\n\n\t\t\t\tconst edgeColor =\n\t\t\t\t\tedge.type === \"friend\" ? config.friendEdgeColor : config.internalEdgeColor;\n\t\t\t\tgraph.mergeDirectedEdge(absoluteSource, absoluteTarget, {\n\t\t\t\t\ttype: edge.type,\n\t\t\t\t\tcolor: edgeColor,\n\t\t\t\t\tsize: config.edgeSize,\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.warn(\n\t\t\t\t`fetchFriendGraphs: failed to merge friend file (base_url: ${friendFile.base_url}):`,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn graph;\n}\n\n/**\n * `<graph-garden>` custom element \u2014 fetches the site's own\n * `graphgarden.json`, builds a graphology `Graph`, merges friend\n * graphs, and renders an interactive force-directed visualisation\n * via Sigma.js.\n */\nexport class GraphGarden extends HTMLElement {\n\tstatic readonly tagName = \"graph-garden\" as const;\n\n\t/** The local graph built from the protocol file, or `null` before loading. */\n\tgraph: Graph | null = null;\n\n\t/** The Sigma renderer instance, or `null` before rendering. */\n\trenderer: Sigma | null = null;\n\n\t/** Shadow DOM container for the Sigma canvas. */\n\tprivate container: HTMLDivElement | null = null;\n\n\tasync connectedCallback(): Promise<void> {\n\t\tconst shadow = this.shadowRoot ?? this.attachShadow({ mode: \"open\" });\n\n\t\tconst style = document.createElement(\"style\");\n\t\tstyle.textContent = `\n\t\t\t:host { display: block; }\n\t\t\tdiv { width: 100%; height: 100%; position: relative; }\n\t\t`;\n\t\tshadow.appendChild(style);\n\n\t\tthis.container = document.createElement(\"div\");\n\t\tshadow.appendChild(this.container);\n\n\t\ttry {\n\t\t\tconst response = await fetch(WELL_KNOWN_PATH);\n\t\t\tif (!response.ok) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`<graph-garden> failed to fetch ${WELL_KNOWN_PATH}: ${response.status} ${response.statusText}`,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data: unknown = await response.json();\n\t\t\tif (!isGraphGardenFile(data)) {\n\t\t\t\tconsole.error(\"<graph-garden> fetched file does not match the GraphGarden protocol shape\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst config = this.resolveConfig();\n\t\t\tthis.graph = buildGraph(data, config);\n\t\t\tawait fetchFriendGraphs(this.graph, config);\n\t\t\tassignLayout(this.graph, config.iterations);\n\t\t\tthis.initRenderer(config);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"<graph-garden> error during initialization:\", error);\n\t\t}\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tthis.renderer?.kill();\n\t\tthis.renderer = null;\n\n\t\tthis.graph?.clear();\n\t\tthis.graph = null;\n\n\t\tif (this.shadowRoot) {\n\t\t\tthis.shadowRoot.innerHTML = \"\";\n\t\t}\n\t\tthis.container = null;\n\t}\n\n\tprivate resolveConfig(): GraphGardenConfig {\n\t\tconst css = (prop: string, fallback: string): string =>\n\t\t\tgetComputedStyle(this).getPropertyValue(prop).trim() || fallback;\n\n\t\tconst attr = (name: string, fallback: number): number => {\n\t\t\tconst raw = this.getAttribute(name);\n\t\t\tif (raw === null) return fallback;\n\t\t\tconst n = Number(raw);\n\t\t\treturn Number.isFinite(n) && n > 0 ? n : fallback;\n\t\t};\n\n\t\treturn {\n\t\t\tlocalNodeColor: css(\"--gg-local-node-color\", DEFAULT_CONFIG.localNodeColor),\n\t\t\tfriendNodeColor: css(\"--gg-friend-node-color\", DEFAULT_CONFIG.friendNodeColor),\n\t\t\tinternalEdgeColor: css(\"--gg-internal-edge-color\", DEFAULT_CONFIG.internalEdgeColor),\n\t\t\tfriendEdgeColor: css(\"--gg-friend-edge-color\", DEFAULT_CONFIG.friendEdgeColor),\n\t\t\tlabelColor: css(\"--gg-label-color\", DEFAULT_CONFIG.labelColor),\n\t\t\tnodeSize: attr(\"node-size\", DEFAULT_CONFIG.nodeSize),\n\t\t\tedgeSize: attr(\"edge-size\", DEFAULT_CONFIG.edgeSize),\n\t\t\tlabelSize: attr(\"label-size\", DEFAULT_CONFIG.labelSize),\n\t\t\titerations: attr(\"iterations\", DEFAULT_CONFIG.iterations),\n\t\t};\n\t}\n\n\tprivate initRenderer(config: GraphGardenConfig): void {\n\t\tif (!this.graph || !this.container) return;\n\n\t\t// Sigma needs a container with actual dimensions; skip if not visible.\n\t\t// This also guards against happy-dom / test environments without WebGL.\n\t\ttry {\n\t\t\tthis.renderer = new Sigma(this.graph, this.container, {\n\t\t\t\tedgeProgramClasses: {\n\t\t\t\t\tinternal: EdgeLineProgram,\n\t\t\t\t\tfriend: EdgeLineProgram,\n\t\t\t\t},\n\t\t\t\tdefaultEdgeColor: config.internalEdgeColor,\n\t\t\t\tlabelColor: { color: config.labelColor },\n\t\t\t\tlabelSize: config.labelSize,\n\t\t\t\trenderEdgeLabels: false,\n\t\t\t});\n\n\t\t\tthis.renderer.on(\"clickNode\", ({ node }) => {\n\t\t\t\twindow.location.href = node;\n\t\t\t});\n\n\t\t\tthis.renderer.on(\"enterNode\", () => {\n\t\t\t\tif (this.container) this.container.style.cursor = \"pointer\";\n\t\t\t});\n\n\t\t\tthis.renderer.on(\"leaveNode\", () => {\n\t\t\t\tif (this.container) this.container.style.cursor = \"default\";\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"<graph-garden> could not initialize Sigma renderer:\", error);\n\t\t}\n\t}\n}\n\nif (!customElements.get(GraphGarden.tagName)) {\n\tcustomElements.define(GraphGarden.tagName, GraphGarden);\n}\n", "function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\n\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\n\nfunction _classCallCheck(a, n) {\n if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\");\n}\n\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\n\nfunction _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n}\n\nfunction _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function () {\n return !!t;\n })();\n}\n\nfunction _assertThisInitialized(e) {\n if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return e;\n}\n\nfunction _possibleConstructorReturn(t, e) {\n if (e && (\"object\" == typeof e || \"function\" == typeof e)) return e;\n if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return _assertThisInitialized(t);\n}\n\nfunction _callSuper(t, o, e) {\n return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));\n}\n\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\n\nfunction _inherits(t, e) {\n if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\");\n t.prototype = Object.create(e && e.prototype, {\n constructor: {\n value: t,\n writable: !0,\n configurable: !0\n }\n }), Object.defineProperty(t, \"prototype\", {\n writable: !1\n }), e && _setPrototypeOf(t, e);\n}\n\nexport { _inherits as _, _createClass as a, _classCallCheck as b, _callSuper as c, _toPropertyKey as d, _getPrototypeOf as e };\n", "function _arrayWithHoles(r) {\n if (Array.isArray(r)) return r;\n}\n\nfunction _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\n\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _slicedToArray(r, e) {\n return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();\n}\n\nvar HTML_COLORS = {\n black: \"#000000\",\n silver: \"#C0C0C0\",\n gray: \"#808080\",\n grey: \"#808080\",\n white: \"#FFFFFF\",\n maroon: \"#800000\",\n red: \"#FF0000\",\n purple: \"#800080\",\n fuchsia: \"#FF00FF\",\n green: \"#008000\",\n lime: \"#00FF00\",\n olive: \"#808000\",\n yellow: \"#FFFF00\",\n navy: \"#000080\",\n blue: \"#0000FF\",\n teal: \"#008080\",\n aqua: \"#00FFFF\",\n darkblue: \"#00008B\",\n mediumblue: \"#0000CD\",\n darkgreen: \"#006400\",\n darkcyan: \"#008B8B\",\n deepskyblue: \"#00BFFF\",\n darkturquoise: \"#00CED1\",\n mediumspringgreen: \"#00FA9A\",\n springgreen: \"#00FF7F\",\n cyan: \"#00FFFF\",\n midnightblue: \"#191970\",\n dodgerblue: \"#1E90FF\",\n lightseagreen: \"#20B2AA\",\n forestgreen: \"#228B22\",\n seagreen: \"#2E8B57\",\n darkslategray: \"#2F4F4F\",\n darkslategrey: \"#2F4F4F\",\n limegreen: \"#32CD32\",\n mediumseagreen: \"#3CB371\",\n turquoise: \"#40E0D0\",\n royalblue: \"#4169E1\",\n steelblue: \"#4682B4\",\n darkslateblue: \"#483D8B\",\n mediumturquoise: \"#48D1CC\",\n indigo: \"#4B0082\",\n darkolivegreen: \"#556B2F\",\n cadetblue: \"#5F9EA0\",\n cornflowerblue: \"#6495ED\",\n rebeccapurple: \"#663399\",\n mediumaquamarine: \"#66CDAA\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n slateblue: \"#6A5ACD\",\n olivedrab: \"#6B8E23\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n mediumslateblue: \"#7B68EE\",\n lawngreen: \"#7CFC00\",\n chartreuse: \"#7FFF00\",\n aquamarine: \"#7FFFD4\",\n skyblue: \"#87CEEB\",\n lightskyblue: \"#87CEFA\",\n blueviolet: \"#8A2BE2\",\n darkred: \"#8B0000\",\n darkmagenta: \"#8B008B\",\n saddlebrown: \"#8B4513\",\n darkseagreen: \"#8FBC8F\",\n lightgreen: \"#90EE90\",\n mediumpurple: \"#9370DB\",\n darkviolet: \"#9400D3\",\n palegreen: \"#98FB98\",\n darkorchid: \"#9932CC\",\n yellowgreen: \"#9ACD32\",\n sienna: \"#A0522D\",\n brown: \"#A52A2A\",\n darkgray: \"#A9A9A9\",\n darkgrey: \"#A9A9A9\",\n lightblue: \"#ADD8E6\",\n greenyellow: \"#ADFF2F\",\n paleturquoise: \"#AFEEEE\",\n lightsteelblue: \"#B0C4DE\",\n powderblue: \"#B0E0E6\",\n firebrick: \"#B22222\",\n darkgoldenrod: \"#B8860B\",\n mediumorchid: \"#BA55D3\",\n rosybrown: \"#BC8F8F\",\n darkkhaki: \"#BDB76B\",\n mediumvioletred: \"#C71585\",\n indianred: \"#CD5C5C\",\n peru: \"#CD853F\",\n chocolate: \"#D2691E\",\n tan: \"#D2B48C\",\n lightgray: \"#D3D3D3\",\n lightgrey: \"#D3D3D3\",\n thistle: \"#D8BFD8\",\n orchid: \"#DA70D6\",\n goldenrod: \"#DAA520\",\n palevioletred: \"#DB7093\",\n crimson: \"#DC143C\",\n gainsboro: \"#DCDCDC\",\n plum: \"#DDA0DD\",\n burlywood: \"#DEB887\",\n lightcyan: \"#E0FFFF\",\n lavender: \"#E6E6FA\",\n darksalmon: \"#E9967A\",\n violet: \"#EE82EE\",\n palegoldenrod: \"#EEE8AA\",\n lightcoral: \"#F08080\",\n khaki: \"#F0E68C\",\n aliceblue: \"#F0F8FF\",\n honeydew: \"#F0FFF0\",\n azure: \"#F0FFFF\",\n sandybrown: \"#F4A460\",\n wheat: \"#F5DEB3\",\n beige: \"#F5F5DC\",\n whitesmoke: \"#F5F5F5\",\n mintcream: \"#F5FFFA\",\n ghostwhite: \"#F8F8FF\",\n salmon: \"#FA8072\",\n antiquewhite: \"#FAEBD7\",\n linen: \"#FAF0E6\",\n lightgoldenrodyellow: \"#FAFAD2\",\n oldlace: \"#FDF5E6\",\n magenta: \"#FF00FF\",\n deeppink: \"#FF1493\",\n orangered: \"#FF4500\",\n tomato: \"#FF6347\",\n hotpink: \"#FF69B4\",\n coral: \"#FF7F50\",\n darkorange: \"#FF8C00\",\n lightsalmon: \"#FFA07A\",\n orange: \"#FFA500\",\n lightpink: \"#FFB6C1\",\n pink: \"#FFC0CB\",\n gold: \"#FFD700\",\n peachpuff: \"#FFDAB9\",\n navajowhite: \"#FFDEAD\",\n moccasin: \"#FFE4B5\",\n bisque: \"#FFE4C4\",\n mistyrose: \"#FFE4E1\",\n blanchedalmond: \"#FFEBCD\",\n papayawhip: \"#FFEFD5\",\n lavenderblush: \"#FFF0F5\",\n seashell: \"#FFF5EE\",\n cornsilk: \"#FFF8DC\",\n lemonchiffon: \"#FFFACD\",\n floralwhite: \"#FFFAF0\",\n snow: \"#FFFAFA\",\n lightyellow: \"#FFFFE0\",\n ivory: \"#FFFFF0\"\n};\n\n/**\n * Function extracting the color at the given pixel.\n */\nfunction extractPixel(gl, x, y, array) {\n var data = array || new Uint8Array(4);\n gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, data);\n return data;\n}\n\n/**\n * Memoized function returning a float-encoded color from various string\n * formats describing colors.\n */\nvar INT8 = new Int8Array(4);\nvar INT32 = new Int32Array(INT8.buffer, 0, 1);\nvar FLOAT32 = new Float32Array(INT8.buffer, 0, 1);\nvar RGBA_TEST_REGEX = /^\\s*rgba?\\s*\\(/;\nvar RGBA_EXTRACT_REGEX = /^\\s*rgba?\\s*\\(\\s*([0-9]*)\\s*,\\s*([0-9]*)\\s*,\\s*([0-9]*)(?:\\s*,\\s*(.*)?)?\\)\\s*$/;\nfunction parseColor(val) {\n var r = 0; // byte\n var g = 0; // byte\n var b = 0; // byte\n var a = 1; // float\n\n // Handling hexadecimal notation\n if (val[0] === \"#\") {\n if (val.length === 4) {\n r = parseInt(val.charAt(1) + val.charAt(1), 16);\n g = parseInt(val.charAt(2) + val.charAt(2), 16);\n b = parseInt(val.charAt(3) + val.charAt(3), 16);\n } else {\n r = parseInt(val.charAt(1) + val.charAt(2), 16);\n g = parseInt(val.charAt(3) + val.charAt(4), 16);\n b = parseInt(val.charAt(5) + val.charAt(6), 16);\n }\n if (val.length === 9) {\n a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255;\n }\n }\n\n // Handling rgb notation\n else if (RGBA_TEST_REGEX.test(val)) {\n var match = val.match(RGBA_EXTRACT_REGEX);\n if (match) {\n r = +match[1];\n g = +match[2];\n b = +match[3];\n if (match[4]) a = +match[4];\n }\n }\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n}\nvar FLOAT_COLOR_CACHE = {};\nfor (var htmlColor in HTML_COLORS) {\n FLOAT_COLOR_CACHE[htmlColor] = floatColor(HTML_COLORS[htmlColor]);\n // Replicating cache for hex values for free\n FLOAT_COLOR_CACHE[HTML_COLORS[htmlColor]] = FLOAT_COLOR_CACHE[htmlColor];\n}\nfunction rgbaToFloat(r, g, b, a, masking) {\n INT32[0] = a << 24 | b << 16 | g << 8 | r;\n if (masking) INT32[0] = INT32[0] & 0xfeffffff;\n return FLOAT32[0];\n}\nfunction floatColor(val) {\n // The html color names are case-insensitive\n val = val.toLowerCase();\n\n // If the color is already computed, we yield it\n if (typeof FLOAT_COLOR_CACHE[val] !== \"undefined\") return FLOAT_COLOR_CACHE[val];\n var parsed = parseColor(val);\n var r = parsed.r,\n g = parsed.g,\n b = parsed.b;\n var a = parsed.a;\n a = a * 255 | 0;\n var color = rgbaToFloat(r, g, b, a, true);\n FLOAT_COLOR_CACHE[val] = color;\n return color;\n}\nfunction colorToArray(val, masking) {\n FLOAT32[0] = floatColor(val);\n var intValue = INT32[0];\n if (masking) {\n intValue = intValue | 0x01000000;\n }\n var r = intValue & 0xff;\n var g = intValue >> 8 & 0xff;\n var b = intValue >> 16 & 0xff;\n var a = intValue >> 24 & 0xff;\n return [r, g, b, a];\n}\nvar FLOAT_INDEX_CACHE = {};\nfunction indexToColor(index) {\n // If the index is already computed, we yield it\n if (typeof FLOAT_INDEX_CACHE[index] !== \"undefined\") return FLOAT_INDEX_CACHE[index];\n\n // To address issue #1397, one strategy is to keep encoding 4 bytes colors,\n // but with alpha hard-set to 1.0 (or 255):\n var r = (index & 0x00ff0000) >>> 16;\n var g = (index & 0x0000ff00) >>> 8;\n var b = index & 0x000000ff;\n var a = 0x000000ff;\n\n // The original 4 bytes color encoding was the following:\n // const r = (index & 0xff000000) >>> 24;\n // const g = (index & 0x00ff0000) >>> 16;\n // const b = (index & 0x0000ff00) >>> 8;\n // const a = index & 0x000000ff;\n\n var color = rgbaToFloat(r, g, b, a, true);\n FLOAT_INDEX_CACHE[index] = color;\n return color;\n}\nfunction colorToIndex(r, g, b, _a) {\n // As for the function indexToColor, because of #1397 and the \"alpha is always\n // 1.0\" strategy, we need to fix this function as well:\n return b + (g << 8) + (r << 16);\n\n // The original 4 bytes color decoding is the following:\n // return a + (b << 8) + (g << 16) + (r << 24);\n}\nfunction getPixelColor(gl, frameBuffer, x, y, pixelRatio, downSizingRatio) {\n var bufferX = Math.floor(x / downSizingRatio * pixelRatio);\n var bufferY = Math.floor(gl.drawingBufferHeight / downSizingRatio - y / downSizingRatio * pixelRatio);\n var pixel = new Uint8Array(4);\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.readPixels(bufferX, bufferY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);\n var _pixel = _slicedToArray(pixel, 4),\n r = _pixel[0],\n g = _pixel[1],\n b = _pixel[2],\n a = _pixel[3];\n return [r, g, b, a];\n}\n\nexport { HTML_COLORS as H, _slicedToArray as _, _arrayLikeToArray as a, _unsupportedIterableToArray as b, colorToIndex as c, colorToArray as d, extractPixel as e, floatColor as f, getPixelColor as g, indexToColor as i, parseColor as p, rgbaToFloat as r };\n", "import { d as _toPropertyKey, e as _getPrototypeOf, a as _createClass, b as _classCallCheck, _ as _inherits, c as _callSuper } from './inherits-d1a1e29b.esm.js';\nimport { i as indexToColor, f as floatColor } from './colors-beb06eb2.esm.js';\n\nfunction _defineProperty(e, r, t) {\n return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\n\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\n\nfunction _superPropBase(t, o) {\n for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););\n return t;\n}\n\nfunction _get() {\n return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {\n var p = _superPropBase(e, t);\n if (p) {\n var n = Object.getOwnPropertyDescriptor(p, t);\n return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;\n }\n }, _get.apply(null, arguments);\n}\n\nfunction _superPropGet(t, o, e, r) {\n var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);\n return 2 & r && \"function\" == typeof p ? function (t) {\n return p.apply(e, t);\n } : p;\n}\n\nfunction getAttributeItemsCount(attr) {\n return attr.normalized ? 1 : attr.size;\n}\nfunction getAttributesItemsCount(attrs) {\n var res = 0;\n attrs.forEach(function (attr) {\n return res += getAttributeItemsCount(attr);\n });\n return res;\n}\nfunction loadShader(type, gl, source) {\n var glType = type === \"VERTEX\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER;\n\n // Creating the shader\n var shader = gl.createShader(glType);\n if (shader === null) {\n throw new Error(\"loadShader: error while creating the shader\");\n }\n\n // Loading source\n gl.shaderSource(shader, source);\n\n // Compiling the shader\n gl.compileShader(shader);\n\n // Retrieving compilation status\n var successfullyCompiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n // Throwing if something went awry\n if (!successfullyCompiled) {\n var infoLog = gl.getShaderInfoLog(shader);\n gl.deleteShader(shader);\n throw new Error(\"loadShader: error while compiling the shader:\\n\".concat(infoLog, \"\\n\").concat(source));\n }\n return shader;\n}\nfunction loadVertexShader(gl, source) {\n return loadShader(\"VERTEX\", gl, source);\n}\nfunction loadFragmentShader(gl, source) {\n return loadShader(\"FRAGMENT\", gl, source);\n}\n\n/**\n * Function used to load a program.\n */\nfunction loadProgram(gl, shaders) {\n var program = gl.createProgram();\n if (program === null) {\n throw new Error(\"loadProgram: error while creating the program.\");\n }\n var i, l;\n\n // Attaching the shaders\n for (i = 0, l = shaders.length; i < l; i++) gl.attachShader(program, shaders[i]);\n gl.linkProgram(program);\n\n // Checking status\n var successfullyLinked = gl.getProgramParameter(program, gl.LINK_STATUS);\n if (!successfullyLinked) {\n gl.deleteProgram(program);\n throw new Error(\"loadProgram: error while linking the program.\");\n }\n return program;\n}\nfunction killProgram(_ref) {\n var gl = _ref.gl,\n buffer = _ref.buffer,\n program = _ref.program,\n vertexShader = _ref.vertexShader,\n fragmentShader = _ref.fragmentShader;\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n gl.deleteProgram(program);\n gl.deleteBuffer(buffer);\n}\n\n/**\n * Function use to print a float for inserting in a GLSL program.\n */\nfunction numberToGLSLFloat(n) {\n return n % 1 === 0 ? n.toFixed(1) : n.toString();\n}\n\nvar PICKING_PREFIX = \"#define PICKING_MODE\\n\";\nvar SIZE_FACTOR_PER_ATTRIBUTE_TYPE = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, WebGL2RenderingContext.BOOL, 1), WebGL2RenderingContext.BYTE, 1), WebGL2RenderingContext.UNSIGNED_BYTE, 1), WebGL2RenderingContext.SHORT, 2), WebGL2RenderingContext.UNSIGNED_SHORT, 2), WebGL2RenderingContext.INT, 4), WebGL2RenderingContext.UNSIGNED_INT, 4), WebGL2RenderingContext.FLOAT, 4);\nvar AbstractProgram = /*#__PURE__*/_createClass(function AbstractProgram(_gl, _pickGl, _renderer) {\n _classCallCheck(this, AbstractProgram);\n});\nvar Program = /*#__PURE__*/function () {\n function Program(gl, pickingBuffer, renderer) {\n _classCallCheck(this, Program);\n // GLenum\n _defineProperty(this, \"array\", new Float32Array());\n _defineProperty(this, \"constantArray\", new Float32Array());\n _defineProperty(this, \"capacity\", 0);\n _defineProperty(this, \"verticesCount\", 0);\n // Reading and caching program definition\n var def = this.getDefinition();\n this.VERTICES = def.VERTICES;\n this.VERTEX_SHADER_SOURCE = def.VERTEX_SHADER_SOURCE;\n this.FRAGMENT_SHADER_SOURCE = def.FRAGMENT_SHADER_SOURCE;\n this.UNIFORMS = def.UNIFORMS;\n this.ATTRIBUTES = def.ATTRIBUTES;\n this.METHOD = def.METHOD;\n this.CONSTANT_ATTRIBUTES = \"CONSTANT_ATTRIBUTES\" in def ? def.CONSTANT_ATTRIBUTES : [];\n this.CONSTANT_DATA = \"CONSTANT_DATA\" in def ? def.CONSTANT_DATA : [];\n this.isInstanced = \"CONSTANT_ATTRIBUTES\" in def;\n\n // Computing stride\n this.ATTRIBUTES_ITEMS_COUNT = getAttributesItemsCount(this.ATTRIBUTES);\n this.STRIDE = this.VERTICES * this.ATTRIBUTES_ITEMS_COUNT;\n\n // Members\n this.renderer = renderer;\n this.normalProgram = this.getProgramInfo(\"normal\", gl, def.VERTEX_SHADER_SOURCE, def.FRAGMENT_SHADER_SOURCE, null);\n this.pickProgram = pickingBuffer ? this.getProgramInfo(\"pick\", gl, PICKING_PREFIX + def.VERTEX_SHADER_SOURCE, PICKING_PREFIX + def.FRAGMENT_SHADER_SOURCE, pickingBuffer) : null;\n\n // For instanced programs:\n if (this.isInstanced) {\n var constantAttributesItemsCount = getAttributesItemsCount(this.CONSTANT_ATTRIBUTES);\n if (this.CONSTANT_DATA.length !== this.VERTICES) throw new Error(\"Program: error while getting constant data (expected \".concat(this.VERTICES, \" items, received \").concat(this.CONSTANT_DATA.length, \" instead)\"));\n this.constantArray = new Float32Array(this.CONSTANT_DATA.length * constantAttributesItemsCount);\n for (var i = 0; i < this.CONSTANT_DATA.length; i++) {\n var vector = this.CONSTANT_DATA[i];\n if (vector.length !== constantAttributesItemsCount) throw new Error(\"Program: error while getting constant data (one vector has \".concat(vector.length, \" items instead of \").concat(constantAttributesItemsCount, \")\"));\n for (var j = 0; j < vector.length; j++) this.constantArray[i * constantAttributesItemsCount + j] = vector[j];\n }\n this.STRIDE = this.ATTRIBUTES_ITEMS_COUNT;\n }\n }\n return _createClass(Program, [{\n key: \"kill\",\n value: function kill() {\n killProgram(this.normalProgram);\n if (this.pickProgram) {\n killProgram(this.pickProgram);\n this.pickProgram = null;\n }\n }\n }, {\n key: \"getProgramInfo\",\n value: function getProgramInfo(name, gl, vertexShaderSource, fragmentShaderSource, frameBuffer) {\n var def = this.getDefinition();\n\n // WebGL buffers\n var buffer = gl.createBuffer();\n if (buffer === null) throw new Error(\"Program: error while creating the WebGL buffer.\");\n\n // Shaders and program\n var vertexShader = loadVertexShader(gl, vertexShaderSource);\n var fragmentShader = loadFragmentShader(gl, fragmentShaderSource);\n var program = loadProgram(gl, [vertexShader, fragmentShader]);\n\n // Initializing locations\n var uniformLocations = {};\n def.UNIFORMS.forEach(function (uniformName) {\n var location = gl.getUniformLocation(program, uniformName);\n if (location) uniformLocations[uniformName] = location;\n });\n var attributeLocations = {};\n def.ATTRIBUTES.forEach(function (attr) {\n attributeLocations[attr.name] = gl.getAttribLocation(program, attr.name);\n });\n\n // For instanced programs:\n var constantBuffer;\n if (\"CONSTANT_ATTRIBUTES\" in def) {\n def.CONSTANT_ATTRIBUTES.forEach(function (attr) {\n attributeLocations[attr.name] = gl.getAttribLocation(program, attr.name);\n });\n constantBuffer = gl.createBuffer();\n if (constantBuffer === null) throw new Error(\"Program: error while creating the WebGL constant buffer.\");\n }\n return {\n name: name,\n program: program,\n gl: gl,\n frameBuffer: frameBuffer,\n buffer: buffer,\n constantBuffer: constantBuffer || {},\n uniformLocations: uniformLocations,\n attributeLocations: attributeLocations,\n isPicking: name === \"pick\",\n vertexShader: vertexShader,\n fragmentShader: fragmentShader\n };\n }\n }, {\n key: \"bindProgram\",\n value: function bindProgram(program) {\n var _this = this;\n var offset = 0;\n var gl = program.gl,\n buffer = program.buffer;\n if (!this.isInstanced) {\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n offset = 0;\n this.ATTRIBUTES.forEach(function (attr) {\n return offset += _this.bindAttribute(attr, program, offset);\n });\n gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW);\n } else {\n // Handle constant data (things that remain unchanged for all items):\n gl.bindBuffer(gl.ARRAY_BUFFER, program.constantBuffer);\n offset = 0;\n this.CONSTANT_ATTRIBUTES.forEach(function (attr) {\n return offset += _this.bindAttribute(attr, program, offset, false);\n });\n gl.bufferData(gl.ARRAY_BUFFER, this.constantArray, gl.STATIC_DRAW);\n\n // Handle \"instance specific\" data (things that vary for each item):\n gl.bindBuffer(gl.ARRAY_BUFFER, program.buffer);\n offset = 0;\n this.ATTRIBUTES.forEach(function (attr) {\n return offset += _this.bindAttribute(attr, program, offset, true);\n });\n gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW);\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n }\n }, {\n key: \"unbindProgram\",\n value: function unbindProgram(program) {\n var _this2 = this;\n if (!this.isInstanced) {\n this.ATTRIBUTES.forEach(function (attr) {\n return _this2.unbindAttribute(attr, program);\n });\n } else {\n this.CONSTANT_ATTRIBUTES.forEach(function (attr) {\n return _this2.unbindAttribute(attr, program, false);\n });\n this.ATTRIBUTES.forEach(function (attr) {\n return _this2.unbindAttribute(attr, program, true);\n });\n }\n }\n }, {\n key: \"bindAttribute\",\n value: function bindAttribute(attr, program, offset, setDivisor) {\n var sizeFactor = SIZE_FACTOR_PER_ATTRIBUTE_TYPE[attr.type];\n if (typeof sizeFactor !== \"number\") throw new Error(\"Program.bind: yet unsupported attribute type \\\"\".concat(attr.type, \"\\\"\"));\n var location = program.attributeLocations[attr.name];\n var gl = program.gl;\n if (location !== -1) {\n gl.enableVertexAttribArray(location);\n var stride = !this.isInstanced ? this.ATTRIBUTES_ITEMS_COUNT * Float32Array.BYTES_PER_ELEMENT : (setDivisor ? this.ATTRIBUTES_ITEMS_COUNT : getAttributesItemsCount(this.CONSTANT_ATTRIBUTES)) * Float32Array.BYTES_PER_ELEMENT;\n gl.vertexAttribPointer(location, attr.size, attr.type, attr.normalized || false, stride, offset);\n if (this.isInstanced && setDivisor) {\n if (gl instanceof WebGL2RenderingContext) {\n gl.vertexAttribDivisor(location, 1);\n } else {\n var ext = gl.getExtension(\"ANGLE_instanced_arrays\");\n if (ext) ext.vertexAttribDivisorANGLE(location, 1);\n }\n }\n }\n return attr.size * sizeFactor;\n }\n }, {\n key: \"unbindAttribute\",\n value: function unbindAttribute(attr, program, unsetDivisor) {\n var location = program.attributeLocations[attr.name];\n var gl = program.gl;\n if (location !== -1) {\n gl.disableVertexAttribArray(location);\n if (this.isInstanced && unsetDivisor) {\n if (gl instanceof WebGL2RenderingContext) {\n gl.vertexAttribDivisor(location, 0);\n } else {\n var ext = gl.getExtension(\"ANGLE_instanced_arrays\");\n if (ext) ext.vertexAttribDivisorANGLE(location, 0);\n }\n }\n }\n }\n }, {\n key: \"reallocate\",\n value: function reallocate(capacity) {\n // If desired capacity has not changed we do nothing\n // NOTE: it's possible here to implement more subtle reallocation schemes\n // when the number of rendered items increase or decrease\n if (capacity === this.capacity) return;\n this.capacity = capacity;\n this.verticesCount = this.VERTICES * capacity;\n this.array = new Float32Array(!this.isInstanced ? this.verticesCount * this.ATTRIBUTES_ITEMS_COUNT : this.capacity * this.ATTRIBUTES_ITEMS_COUNT);\n }\n }, {\n key: \"hasNothingToRender\",\n value: function hasNothingToRender() {\n return this.verticesCount === 0;\n }\n }, {\n key: \"renderProgram\",\n value: function renderProgram(params, programInfo) {\n var gl = programInfo.gl,\n program = programInfo.program;\n\n // With the current fix for #1397, the alpha blending is enabled for the\n // picking layer:\n gl.enable(gl.BLEND);\n\n // Original code:\n // if (!isPicking) gl.enable(gl.BLEND);\n // else gl.disable(gl.BLEND);\n\n gl.useProgram(program);\n this.setUniforms(params, programInfo);\n this.drawWebGL(this.METHOD, programInfo);\n }\n }, {\n key: \"render\",\n value: function render(params) {\n if (this.hasNothingToRender()) return;\n if (this.pickProgram) {\n this.pickProgram.gl.viewport(0, 0, params.width * params.pixelRatio / params.downSizingRatio, params.height * params.pixelRatio / params.downSizingRatio);\n this.bindProgram(this.pickProgram);\n this.renderProgram(_objectSpread2(_objectSpread2({}, params), {}, {\n pixelRatio: params.pixelRatio / params.downSizingRatio\n }), this.pickProgram);\n this.unbindProgram(this.pickProgram);\n }\n this.normalProgram.gl.viewport(0, 0, params.width * params.pixelRatio, params.height * params.pixelRatio);\n this.bindProgram(this.normalProgram);\n this.renderProgram(params, this.normalProgram);\n this.unbindProgram(this.normalProgram);\n }\n }, {\n key: \"drawWebGL\",\n value: function drawWebGL(method, _ref) {\n var gl = _ref.gl,\n frameBuffer = _ref.frameBuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n if (!this.isInstanced) {\n gl.drawArrays(method, 0, this.verticesCount);\n } else {\n if (gl instanceof WebGL2RenderingContext) {\n gl.drawArraysInstanced(method, 0, this.VERTICES, this.capacity);\n } else {\n var ext = gl.getExtension(\"ANGLE_instanced_arrays\");\n if (ext) ext.drawArraysInstancedANGLE(method, 0, this.VERTICES, this.capacity);\n }\n }\n }\n }]);\n}();\n\nvar AbstractNodeProgram = /*#__PURE__*/function (_AbstractProgram) {\n function AbstractNodeProgram() {\n _classCallCheck(this, AbstractNodeProgram);\n return _callSuper(this, AbstractNodeProgram, arguments);\n }\n _inherits(AbstractNodeProgram, _AbstractProgram);\n return _createClass(AbstractNodeProgram);\n}(AbstractProgram);\nvar NodeProgram = /*#__PURE__*/function (_ref) {\n function NodeProgram() {\n _classCallCheck(this, NodeProgram);\n return _callSuper(this, NodeProgram, arguments);\n }\n _inherits(NodeProgram, _ref);\n return _createClass(NodeProgram, [{\n key: \"kill\",\n value: function kill() {\n _superPropGet(NodeProgram, \"kill\", this, 3)([]);\n }\n }, {\n key: \"process\",\n value: function process(nodeIndex, offset, data) {\n var i = offset * this.STRIDE;\n // NOTE: dealing with hidden items automatically\n if (data.hidden) {\n for (var l = i + this.STRIDE; i < l; i++) {\n this.array[i] = 0;\n }\n return;\n }\n return this.processVisibleItem(indexToColor(nodeIndex), i, data);\n }\n }]);\n}(Program);\n/**\n * Helper function combining two or more programs into a single compound one.\n * Note that this is more a quick & easy way to combine program than a really\n * performant option. More performant programs can be written entirely.\n *\n * @param {array} programClasses - Program classes to combine.\n * @param {function} drawLabel - An optional node \"draw label\" function.\n * @param {function} drawHover - An optional node \"draw hover\" function.\n * @return {function}\n */\nfunction createNodeCompoundProgram(programClasses, drawLabel, drawHover) {\n return /*#__PURE__*/function () {\n function NodeCompoundProgram(gl, pickingBuffer, renderer) {\n _classCallCheck(this, NodeCompoundProgram);\n _defineProperty(this, \"drawLabel\", drawLabel);\n _defineProperty(this, \"drawHover\", drawHover);\n this.programs = programClasses.map(function (Program) {\n return new Program(gl, pickingBuffer, renderer);\n });\n }\n return _createClass(NodeCompoundProgram, [{\n key: \"reallocate\",\n value: function reallocate(capacity) {\n this.programs.forEach(function (program) {\n return program.reallocate(capacity);\n });\n }\n }, {\n key: \"process\",\n value: function process(nodeIndex, offset, data) {\n this.programs.forEach(function (program) {\n return program.process(nodeIndex, offset, data);\n });\n }\n }, {\n key: \"render\",\n value: function render(params) {\n this.programs.forEach(function (program) {\n return program.render(params);\n });\n }\n }, {\n key: \"kill\",\n value: function kill() {\n this.programs.forEach(function (program) {\n return program.kill();\n });\n }\n }]);\n }();\n}\n\nvar AbstractEdgeProgram = /*#__PURE__*/function (_AbstractProgram) {\n function AbstractEdgeProgram() {\n _classCallCheck(this, AbstractEdgeProgram);\n return _callSuper(this, AbstractEdgeProgram, arguments);\n }\n _inherits(AbstractEdgeProgram, _AbstractProgram);\n return _createClass(AbstractEdgeProgram);\n}(AbstractProgram);\nvar EdgeProgram = /*#__PURE__*/function (_ref) {\n function EdgeProgram() {\n var _this;\n _classCallCheck(this, EdgeProgram);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, EdgeProgram, [].concat(args));\n _defineProperty(_this, \"drawLabel\", undefined);\n return _this;\n }\n _inherits(EdgeProgram, _ref);\n return _createClass(EdgeProgram, [{\n key: \"kill\",\n value: function kill() {\n _superPropGet(EdgeProgram, \"kill\", this, 3)([]);\n }\n }, {\n key: \"process\",\n value: function process(edgeIndex, offset, sourceData, targetData, data) {\n var i = offset * this.STRIDE;\n // NOTE: dealing with hidden items automatically\n if (data.hidden || sourceData.hidden || targetData.hidden) {\n for (var l = i + this.STRIDE; i < l; i++) {\n this.array[i] = 0;\n }\n return;\n }\n return this.processVisibleItem(indexToColor(edgeIndex), i, sourceData, targetData, data);\n }\n }]);\n}(Program);\n/**\n * Helper function combining two or more programs into a single compound one.\n * Note that this is more a quick & easy way to combine program than a really\n * performant option. More performant programs can be written entirely.\n *\n * @param {array} programClasses - Program classes to combine.\n * @param {function} drawLabel - An optional edge \"draw label\" function.\n * @return {function}\n */\nfunction createEdgeCompoundProgram(programClasses, drawLabel) {\n return /*#__PURE__*/function () {\n function EdgeCompoundProgram(gl, pickingBuffer, renderer) {\n _classCallCheck(this, EdgeCompoundProgram);\n _defineProperty(this, \"drawLabel\", drawLabel);\n this.programs = programClasses.map(function (Program) {\n return new Program(gl, pickingBuffer, renderer);\n });\n }\n return _createClass(EdgeCompoundProgram, [{\n key: \"reallocate\",\n value: function reallocate(capacity) {\n this.programs.forEach(function (program) {\n return program.reallocate(capacity);\n });\n }\n }, {\n key: \"process\",\n value: function process(edgeIndex, offset, sourceData, targetData, data) {\n this.programs.forEach(function (program) {\n return program.process(edgeIndex, offset, sourceData, targetData, data);\n });\n }\n }, {\n key: \"render\",\n value: function render(params) {\n this.programs.forEach(function (program) {\n return program.render(params);\n });\n }\n }, {\n key: \"kill\",\n value: function kill() {\n this.programs.forEach(function (program) {\n return program.kill();\n });\n }\n }]);\n }();\n}\n\nfunction drawStraightEdgeLabel(context, edgeData, sourceData, targetData, settings) {\n var size = settings.edgeLabelSize,\n font = settings.edgeLabelFont,\n weight = settings.edgeLabelWeight,\n color = settings.edgeLabelColor.attribute ? edgeData[settings.edgeLabelColor.attribute] || settings.edgeLabelColor.color || \"#000\" : settings.edgeLabelColor.color;\n var label = edgeData.label;\n if (!label) return;\n context.fillStyle = color;\n context.font = \"\".concat(weight, \" \").concat(size, \"px \").concat(font);\n\n // Computing positions without considering nodes sizes:\n var sSize = sourceData.size;\n var tSize = targetData.size;\n var sx = sourceData.x;\n var sy = sourceData.y;\n var tx = targetData.x;\n var ty = targetData.y;\n var cx = (sx + tx) / 2;\n var cy = (sy + ty) / 2;\n var dx = tx - sx;\n var dy = ty - sy;\n var d = Math.sqrt(dx * dx + dy * dy);\n if (d < sSize + tSize) return;\n\n // Adding nodes sizes:\n sx += dx * sSize / d;\n sy += dy * sSize / d;\n tx -= dx * tSize / d;\n ty -= dy * tSize / d;\n cx = (sx + tx) / 2;\n cy = (sy + ty) / 2;\n dx = tx - sx;\n dy = ty - sy;\n d = Math.sqrt(dx * dx + dy * dy);\n\n // Handling ellipsis\n var textLength = context.measureText(label).width;\n if (textLength > d) {\n var ellipsis = \"\u2026\";\n label = label + ellipsis;\n textLength = context.measureText(label).width;\n while (textLength > d && label.length > 1) {\n label = label.slice(0, -2) + ellipsis;\n textLength = context.measureText(label).width;\n }\n if (label.length < 4) return;\n }\n var angle;\n if (dx > 0) {\n if (dy > 0) angle = Math.acos(dx / d);else angle = Math.asin(dy / d);\n } else {\n if (dy > 0) angle = Math.acos(dx / d) + Math.PI;else angle = Math.asin(dx / d) + Math.PI / 2;\n }\n context.save();\n context.translate(cx, cy);\n context.rotate(angle);\n context.fillText(label, -textLength / 2, edgeData.size / 2 + size);\n context.restore();\n}\n\nfunction drawDiscNodeLabel(context, data, settings) {\n if (!data.label) return;\n var size = settings.labelSize,\n font = settings.labelFont,\n weight = settings.labelWeight,\n color = settings.labelColor.attribute ? data[settings.labelColor.attribute] || settings.labelColor.color || \"#000\" : settings.labelColor.color;\n context.fillStyle = color;\n context.font = \"\".concat(weight, \" \").concat(size, \"px \").concat(font);\n context.fillText(data.label, data.x + data.size + 3, data.y + size / 3);\n}\n\n/**\n * Draw an hovered node.\n * - if there is no label => display a shadow on the node\n * - if the label box is bigger than node size => display a label box that contains the node with a shadow\n * - else node with shadow and the label box\n */\nfunction drawDiscNodeHover(context, data, settings) {\n var size = settings.labelSize,\n font = settings.labelFont,\n weight = settings.labelWeight;\n context.font = \"\".concat(weight, \" \").concat(size, \"px \").concat(font);\n\n // Then we draw the label background\n context.fillStyle = \"#FFF\";\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.shadowBlur = 8;\n context.shadowColor = \"#000\";\n var PADDING = 2;\n if (typeof data.label === \"string\") {\n var textWidth = context.measureText(data.label).width,\n boxWidth = Math.round(textWidth + 5),\n boxHeight = Math.round(size + 2 * PADDING),\n radius = Math.max(data.size, size / 2) + PADDING;\n var angleRadian = Math.asin(boxHeight / 2 / radius);\n var xDeltaCoord = Math.sqrt(Math.abs(Math.pow(radius, 2) - Math.pow(boxHeight / 2, 2)));\n context.beginPath();\n context.moveTo(data.x + xDeltaCoord, data.y + boxHeight / 2);\n context.lineTo(data.x + radius + boxWidth, data.y + boxHeight / 2);\n context.lineTo(data.x + radius + boxWidth, data.y - boxHeight / 2);\n context.lineTo(data.x + xDeltaCoord, data.y - boxHeight / 2);\n context.arc(data.x, data.y, radius, angleRadian, -angleRadian);\n context.closePath();\n context.fill();\n } else {\n context.beginPath();\n context.arc(data.x, data.y, data.size + PADDING, 0, Math.PI * 2);\n context.closePath();\n context.fill();\n }\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n context.shadowBlur = 0;\n\n // And finally we draw the label\n drawDiscNodeLabel(context, data, settings);\n}\n\n// language=GLSL\nvar SHADER_SOURCE$6 = /*glsl*/\"\\nprecision highp float;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_diffVector;\\nvarying float v_radius;\\n\\nuniform float u_correctionRatio;\\n\\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\\n\\nvoid main(void) {\\n float border = u_correctionRatio * 2.0;\\n float dist = length(v_diffVector) - v_radius + border;\\n\\n // No antialiasing for picking mode:\\n #ifdef PICKING_MODE\\n if (dist > border)\\n gl_FragColor = transparent;\\n else\\n gl_FragColor = v_color;\\n\\n #else\\n float t = 0.0;\\n if (dist > border)\\n t = 1.0;\\n else if (dist > 0.0)\\n t = dist / border;\\n\\n gl_FragColor = mix(v_color, transparent, t);\\n #endif\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$6;\n\n// language=GLSL\nvar SHADER_SOURCE$5 = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_position;\\nattribute float a_size;\\nattribute float a_angle;\\n\\nuniform mat3 u_matrix;\\nuniform float u_sizeRatio;\\nuniform float u_correctionRatio;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_diffVector;\\nvarying float v_radius;\\nvarying float v_border;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;\\n vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));\\n vec2 position = a_position + diffVector;\\n gl_Position = vec4(\\n (u_matrix * vec3(position, 1)).xy,\\n 0,\\n 1\\n );\\n\\n v_diffVector = diffVector;\\n v_radius = size / 2.0;\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$3 = SHADER_SOURCE$5;\n\nvar _WebGLRenderingContex$3 = WebGLRenderingContext,\n UNSIGNED_BYTE$3 = _WebGLRenderingContex$3.UNSIGNED_BYTE,\n FLOAT$3 = _WebGLRenderingContex$3.FLOAT;\nvar UNIFORMS$3 = [\"u_sizeRatio\", \"u_correctionRatio\", \"u_matrix\"];\nvar NodeCircleProgram = /*#__PURE__*/function (_NodeProgram) {\n function NodeCircleProgram() {\n _classCallCheck(this, NodeCircleProgram);\n return _callSuper(this, NodeCircleProgram, arguments);\n }\n _inherits(NodeCircleProgram, _NodeProgram);\n return _createClass(NodeCircleProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 3,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$3,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$2,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS$3,\n ATTRIBUTES: [{\n name: \"a_position\",\n size: 2,\n type: FLOAT$3\n }, {\n name: \"a_size\",\n size: 1,\n type: FLOAT$3\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$3,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$3,\n normalized: true\n }],\n CONSTANT_ATTRIBUTES: [{\n name: \"a_angle\",\n size: 1,\n type: FLOAT$3\n }],\n CONSTANT_DATA: [[NodeCircleProgram.ANGLE_1], [NodeCircleProgram.ANGLE_2], [NodeCircleProgram.ANGLE_3]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(nodeIndex, startIndex, data) {\n var array = this.array;\n var color = floatColor(data.color);\n array[startIndex++] = data.x;\n array[startIndex++] = data.y;\n array[startIndex++] = data.size;\n array[startIndex++] = color;\n array[startIndex++] = nodeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_sizeRatio = uniformLocations.u_sizeRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_matrix = uniformLocations.u_matrix;\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n }\n }]);\n}(NodeProgram);\n_defineProperty(NodeCircleProgram, \"ANGLE_1\", 0);\n_defineProperty(NodeCircleProgram, \"ANGLE_2\", 2 * Math.PI / 3);\n_defineProperty(NodeCircleProgram, \"ANGLE_3\", 4 * Math.PI / 3);\n\n// language=GLSL\nvar SHADER_SOURCE$4 = /*glsl*/\"\\nprecision mediump float;\\n\\nvarying vec4 v_color;\\n\\nvoid main(void) {\\n gl_FragColor = v_color;\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE$1 = SHADER_SOURCE$4;\n\n// language=GLSL\nvar SHADER_SOURCE$3 = /*glsl*/\"\\nattribute vec2 a_position;\\nattribute vec2 a_normal;\\nattribute float a_radius;\\nattribute vec3 a_barycentric;\\n\\n#ifdef PICKING_MODE\\nattribute vec4 a_id;\\n#else\\nattribute vec4 a_color;\\n#endif\\n\\nuniform mat3 u_matrix;\\nuniform float u_sizeRatio;\\nuniform float u_correctionRatio;\\nuniform float u_minEdgeThickness;\\nuniform float u_lengthToThicknessRatio;\\nuniform float u_widenessToThicknessRatio;\\n\\nvarying vec4 v_color;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n float minThickness = u_minEdgeThickness;\\n\\n float normalLength = length(a_normal);\\n vec2 unitNormal = a_normal / normalLength;\\n\\n // These first computations are taken from edge.vert.glsl and\\n // edge.clamped.vert.glsl. Please read it to get better comments on what's\\n // happening:\\n float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);\\n float webGLThickness = pixelsThickness * u_correctionRatio;\\n float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;\\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\\n float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;\\n\\n float da = a_barycentric.x;\\n float db = a_barycentric.y;\\n float dc = a_barycentric.z;\\n\\n vec2 delta = vec2(\\n da * (webGLNodeRadius * unitNormal.y)\\n + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)\\n + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),\\n\\n da * (-webGLNodeRadius * unitNormal.x)\\n + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)\\n + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)\\n );\\n\\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\\n\\n gl_Position = vec4(position, 0, 1);\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$3;\n\nvar _WebGLRenderingContex$2 = WebGLRenderingContext,\n UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,\n FLOAT$2 = _WebGLRenderingContex$2.FLOAT;\nvar UNIFORMS$2 = [\"u_matrix\", \"u_sizeRatio\", \"u_correctionRatio\", \"u_minEdgeThickness\", \"u_lengthToThicknessRatio\", \"u_widenessToThicknessRatio\"];\nvar DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS = {\n extremity: \"target\",\n lengthToThicknessRatio: 2.5,\n widenessToThicknessRatio: 2\n};\nfunction createEdgeArrowHeadProgram(inputOptions) {\n var options = _objectSpread2(_objectSpread2({}, DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS), inputOptions || {});\n return /*#__PURE__*/function (_EdgeProgram) {\n function EdgeArrowHeadProgram() {\n _classCallCheck(this, EdgeArrowHeadProgram);\n return _callSuper(this, EdgeArrowHeadProgram, arguments);\n }\n _inherits(EdgeArrowHeadProgram, _EdgeProgram);\n return _createClass(EdgeArrowHeadProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 3,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$1,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS$2,\n ATTRIBUTES: [{\n name: \"a_position\",\n size: 2,\n type: FLOAT$2\n }, {\n name: \"a_normal\",\n size: 2,\n type: FLOAT$2\n }, {\n name: \"a_radius\",\n size: 1,\n type: FLOAT$2\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$2,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$2,\n normalized: true\n }],\n CONSTANT_ATTRIBUTES: [{\n name: \"a_barycentric\",\n size: 3,\n type: FLOAT$2\n }],\n CONSTANT_DATA: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n if (options.extremity === \"source\") {\n var _ref = [targetData, sourceData];\n sourceData = _ref[0];\n targetData = _ref[1];\n }\n var thickness = data.size || 1;\n var radius = targetData.size || 1;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // Computing normals\n var dx = x2 - x1;\n var dy = y2 - y1;\n var len = dx * dx + dy * dy;\n var n1 = 0;\n var n2 = 0;\n if (len) {\n len = 1 / Math.sqrt(len);\n n1 = -dy * len * thickness;\n n2 = dx * len * thickness;\n }\n var array = this.array;\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = -n1;\n array[startIndex++] = -n2;\n array[startIndex++] = radius;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref2) {\n var gl = _ref2.gl,\n uniformLocations = _ref2.uniformLocations;\n var u_matrix = uniformLocations.u_matrix,\n u_sizeRatio = uniformLocations.u_sizeRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_minEdgeThickness = uniformLocations.u_minEdgeThickness,\n u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio,\n u_widenessToThicknessRatio = uniformLocations.u_widenessToThicknessRatio;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);\n gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);\n gl.uniform1f(u_widenessToThicknessRatio, options.widenessToThicknessRatio);\n }\n }]);\n }(EdgeProgram);\n}\nvar EdgeArrowHeadProgram = createEdgeArrowHeadProgram();\nvar EdgeArrowHeadProgram$1 = EdgeArrowHeadProgram;\n\n// language=GLSL\nvar SHADER_SOURCE$2 = /*glsl*/\"\\nprecision mediump float;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_normal;\\nvarying float v_thickness;\\nvarying float v_feather;\\n\\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\\n\\nvoid main(void) {\\n // We only handle antialiasing for normal mode:\\n #ifdef PICKING_MODE\\n gl_FragColor = v_color;\\n #else\\n float dist = length(v_normal) * v_thickness;\\n\\n float t = smoothstep(\\n v_thickness - v_feather,\\n v_thickness,\\n dist\\n );\\n\\n gl_FragColor = mix(v_color, transparent, t);\\n #endif\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE = SHADER_SOURCE$2;\n\n// language=GLSL\nvar SHADER_SOURCE$1 = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_normal;\\nattribute float a_normalCoef;\\nattribute vec2 a_positionStart;\\nattribute vec2 a_positionEnd;\\nattribute float a_positionCoef;\\nattribute float a_radius;\\nattribute float a_radiusCoef;\\n\\nuniform mat3 u_matrix;\\nuniform float u_zoomRatio;\\nuniform float u_sizeRatio;\\nuniform float u_pixelRatio;\\nuniform float u_correctionRatio;\\nuniform float u_minEdgeThickness;\\nuniform float u_lengthToThicknessRatio;\\nuniform float u_feather;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_normal;\\nvarying float v_thickness;\\nvarying float v_feather;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n float minThickness = u_minEdgeThickness;\\n\\n float radius = a_radius * a_radiusCoef;\\n vec2 normal = a_normal * a_normalCoef;\\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\\n\\n float normalLength = length(normal);\\n vec2 unitNormal = normal / normalLength;\\n\\n // These first computations are taken from edge.vert.glsl. Please read it to\\n // get better comments on what's happening:\\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\\n\\n // Here, we move the point to leave space for the arrow head:\\n float direction = sign(radius);\\n float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;\\n float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\\n\\n vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);\\n\\n // Here is the proper position of the vertex\\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);\\n\\n v_thickness = webGLThickness / u_zoomRatio;\\n\\n v_normal = unitNormal;\\n\\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$1 = SHADER_SOURCE$1;\n\nvar _WebGLRenderingContex$1 = WebGLRenderingContext,\n UNSIGNED_BYTE$1 = _WebGLRenderingContex$1.UNSIGNED_BYTE,\n FLOAT$1 = _WebGLRenderingContex$1.FLOAT;\nvar UNIFORMS$1 = [\"u_matrix\", \"u_zoomRatio\", \"u_sizeRatio\", \"u_correctionRatio\", \"u_pixelRatio\", \"u_feather\", \"u_minEdgeThickness\", \"u_lengthToThicknessRatio\"];\nvar DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS = {\n lengthToThicknessRatio: DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS.lengthToThicknessRatio\n};\nfunction createEdgeClampedProgram(inputOptions) {\n var options = _objectSpread2(_objectSpread2({}, DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS), inputOptions || {});\n return /*#__PURE__*/function (_EdgeProgram) {\n function EdgeClampedProgram() {\n _classCallCheck(this, EdgeClampedProgram);\n return _callSuper(this, EdgeClampedProgram, arguments);\n }\n _inherits(EdgeClampedProgram, _EdgeProgram);\n return _createClass(EdgeClampedProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 6,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$1,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS$1,\n ATTRIBUTES: [{\n name: \"a_positionStart\",\n size: 2,\n type: FLOAT$1\n }, {\n name: \"a_positionEnd\",\n size: 2,\n type: FLOAT$1\n }, {\n name: \"a_normal\",\n size: 2,\n type: FLOAT$1\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$1,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$1,\n normalized: true\n }, {\n name: \"a_radius\",\n size: 1,\n type: FLOAT$1\n }],\n CONSTANT_ATTRIBUTES: [\n // If 0, then position will be a_positionStart\n // If 1, then position will be a_positionEnd\n {\n name: \"a_positionCoef\",\n size: 1,\n type: FLOAT$1\n }, {\n name: \"a_normalCoef\",\n size: 1,\n type: FLOAT$1\n }, {\n name: \"a_radiusCoef\",\n size: 1,\n type: FLOAT$1\n }],\n CONSTANT_DATA: [[0, 1, 0], [0, -1, 0], [1, 1, 1], [1, 1, 1], [0, -1, 0], [1, -1, -1]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n var thickness = data.size || 1;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // Computing normals\n var dx = x2 - x1;\n var dy = y2 - y1;\n var radius = targetData.size || 1;\n var len = dx * dx + dy * dy;\n var n1 = 0;\n var n2 = 0;\n if (len) {\n len = 1 / Math.sqrt(len);\n n1 = -dy * len * thickness;\n n2 = dx * len * thickness;\n }\n var array = this.array;\n array[startIndex++] = x1;\n array[startIndex++] = y1;\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = n1;\n array[startIndex++] = n2;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n array[startIndex++] = radius;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_matrix = uniformLocations.u_matrix,\n u_zoomRatio = uniformLocations.u_zoomRatio,\n u_feather = uniformLocations.u_feather,\n u_pixelRatio = uniformLocations.u_pixelRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_sizeRatio = uniformLocations.u_sizeRatio,\n u_minEdgeThickness = uniformLocations.u_minEdgeThickness,\n u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n gl.uniform1f(u_zoomRatio, params.zoomRatio);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_pixelRatio, params.pixelRatio);\n gl.uniform1f(u_feather, params.antiAliasingFeather);\n gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);\n gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);\n }\n }]);\n }(EdgeProgram);\n}\nvar EdgeClampedProgram = createEdgeClampedProgram();\nvar EdgeClampedProgram$1 = EdgeClampedProgram;\n\nfunction createEdgeArrowProgram(inputOptions) {\n return createEdgeCompoundProgram([createEdgeClampedProgram(inputOptions), createEdgeArrowHeadProgram(inputOptions)]);\n}\nvar EdgeArrowProgram = createEdgeArrowProgram();\nvar EdgeArrowProgram$1 = EdgeArrowProgram;\n\n// language=GLSL\nvar SHADER_SOURCE = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_normal;\\nattribute float a_normalCoef;\\nattribute vec2 a_positionStart;\\nattribute vec2 a_positionEnd;\\nattribute float a_positionCoef;\\n\\nuniform mat3 u_matrix;\\nuniform float u_sizeRatio;\\nuniform float u_zoomRatio;\\nuniform float u_pixelRatio;\\nuniform float u_correctionRatio;\\nuniform float u_minEdgeThickness;\\nuniform float u_feather;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_normal;\\nvarying float v_thickness;\\nvarying float v_feather;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n float minThickness = u_minEdgeThickness;\\n\\n vec2 normal = a_normal * a_normalCoef;\\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\\n\\n float normalLength = length(normal);\\n vec2 unitNormal = normal / normalLength;\\n\\n // We require edges to be at least \\\"minThickness\\\" pixels thick *on screen*\\n // (so we need to compensate the size ratio):\\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\\n\\n // Then, we need to retrieve the normalized thickness of the edge in the WebGL\\n // referential (in a ([0, 1], [0, 1]) space), using our \\\"magic\\\" correction\\n // ratio:\\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\\n\\n // Here is the proper position of the vertex\\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);\\n\\n // For the fragment shader though, we need a thickness that takes the \\\"magic\\\"\\n // correction ratio into account (as in webGLThickness), but so that the\\n // antialiasing effect does not depend on the zoom level. So here's yet\\n // another thickness version:\\n v_thickness = webGLThickness / u_zoomRatio;\\n\\n v_normal = unitNormal;\\n\\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE = SHADER_SOURCE;\n\nvar _WebGLRenderingContex = WebGLRenderingContext,\n UNSIGNED_BYTE = _WebGLRenderingContex.UNSIGNED_BYTE,\n FLOAT = _WebGLRenderingContex.FLOAT;\nvar UNIFORMS = [\"u_matrix\", \"u_zoomRatio\", \"u_sizeRatio\", \"u_correctionRatio\", \"u_pixelRatio\", \"u_feather\", \"u_minEdgeThickness\"];\nvar EdgeRectangleProgram = /*#__PURE__*/function (_EdgeProgram) {\n function EdgeRectangleProgram() {\n _classCallCheck(this, EdgeRectangleProgram);\n return _callSuper(this, EdgeRectangleProgram, arguments);\n }\n _inherits(EdgeRectangleProgram, _EdgeProgram);\n return _createClass(EdgeRectangleProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 6,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS,\n ATTRIBUTES: [{\n name: \"a_positionStart\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_positionEnd\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_normal\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE,\n normalized: true\n }],\n CONSTANT_ATTRIBUTES: [\n // If 0, then position will be a_positionStart\n // If 2, then position will be a_positionEnd\n {\n name: \"a_positionCoef\",\n size: 1,\n type: FLOAT\n }, {\n name: \"a_normalCoef\",\n size: 1,\n type: FLOAT\n }],\n CONSTANT_DATA: [[0, 1], [0, -1], [1, 1], [1, 1], [0, -1], [1, -1]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n var thickness = data.size || 1;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // Computing normals\n var dx = x2 - x1;\n var dy = y2 - y1;\n var len = dx * dx + dy * dy;\n var n1 = 0;\n var n2 = 0;\n if (len) {\n len = 1 / Math.sqrt(len);\n n1 = -dy * len * thickness;\n n2 = dx * len * thickness;\n }\n var array = this.array;\n array[startIndex++] = x1;\n array[startIndex++] = y1;\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = n1;\n array[startIndex++] = n2;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_matrix = uniformLocations.u_matrix,\n u_zoomRatio = uniformLocations.u_zoomRatio,\n u_feather = uniformLocations.u_feather,\n u_pixelRatio = uniformLocations.u_pixelRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_sizeRatio = uniformLocations.u_sizeRatio,\n u_minEdgeThickness = uniformLocations.u_minEdgeThickness;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n gl.uniform1f(u_zoomRatio, params.zoomRatio);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_pixelRatio, params.pixelRatio);\n gl.uniform1f(u_feather, params.antiAliasingFeather);\n gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);\n }\n }]);\n}(EdgeProgram);\n\nexport { AbstractNodeProgram as A, DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS as D, EdgeArrowProgram$1 as E, FRAGMENT_SHADER_SOURCE as F, NodeCircleProgram as N, Program as P, _objectSpread2 as _, _defineProperty as a, drawDiscNodeLabel as b, drawDiscNodeHover as c, drawStraightEdgeLabel as d, EdgeRectangleProgram as e, NodeProgram as f, EdgeProgram as g, createEdgeCompoundProgram as h, createEdgeArrowHeadProgram as i, createNodeCompoundProgram as j, AbstractEdgeProgram as k, AbstractProgram as l, EdgeArrowHeadProgram$1 as m, EdgeClampedProgram$1 as n, createEdgeClampedProgram as o, DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS as p, createEdgeArrowProgram as q, getAttributeItemsCount as r, getAttributesItemsCount as s, loadVertexShader as t, loadFragmentShader as u, loadProgram as v, killProgram as w, numberToGLSLFloat as x };\n", "import { _ as _inherits, a as _createClass, b as _classCallCheck, c as _callSuper } from '../../dist/inherits-d1a1e29b.esm.js';\nimport { EventEmitter } from 'events';\n\n/**\n * Util type to represent maps of typed elements, but implemented with\n * JavaScript objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n/**\n * Returns a type similar to T, but with the K set of properties of the type\n * T *required*, and the rest optional.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n/**\n * Returns a type similar to Partial<T>, but with at least one key set.\n */\n\n/**\n * Custom event emitter types.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\nvar TypedEventEmitter = /*#__PURE__*/function (_ref) {\n function TypedEventEmitter() {\n var _this;\n _classCallCheck(this, TypedEventEmitter);\n _this = _callSuper(this, TypedEventEmitter);\n _this.rawEmitter = _this;\n return _this;\n }\n _inherits(TypedEventEmitter, _ref);\n return _createClass(TypedEventEmitter);\n}(EventEmitter);\n\n/**\n * Event types.\n */\n\n/**\n * Export various other types:\n */\n\nexport { TypedEventEmitter };\n", "import isGraph from 'graphology-utils/is-graph';\nimport { _ as _slicedToArray } from './colors-beb06eb2.esm.js';\n\nvar linear = function linear(k) {\n return k;\n};\nvar quadraticIn = function quadraticIn(k) {\n return k * k;\n};\nvar quadraticOut = function quadraticOut(k) {\n return k * (2 - k);\n};\nvar quadraticInOut = function quadraticInOut(k) {\n if ((k *= 2) < 1) return 0.5 * k * k;\n return -0.5 * (--k * (k - 2) - 1);\n};\nvar cubicIn = function cubicIn(k) {\n return k * k * k;\n};\nvar cubicOut = function cubicOut(k) {\n return --k * k * k + 1;\n};\nvar cubicInOut = function cubicInOut(k) {\n if ((k *= 2) < 1) return 0.5 * k * k * k;\n return 0.5 * ((k -= 2) * k * k + 2);\n};\nvar easings = {\n linear: linear,\n quadraticIn: quadraticIn,\n quadraticOut: quadraticOut,\n quadraticInOut: quadraticInOut,\n cubicIn: cubicIn,\n cubicOut: cubicOut,\n cubicInOut: cubicInOut\n};\n\n/**\n * Defaults.\n */\n\nvar ANIMATE_DEFAULTS = {\n easing: \"quadraticInOut\",\n duration: 150\n};\n\n/**\n * Function used to animate the nodes.\n */\nfunction animateNodes(graph, targets, opts, callback) {\n var options = Object.assign({}, ANIMATE_DEFAULTS, opts);\n var easing = typeof options.easing === \"function\" ? options.easing : easings[options.easing];\n var start = Date.now();\n var startPositions = {};\n for (var node in targets) {\n var attrs = targets[node];\n startPositions[node] = {};\n for (var _k in attrs) startPositions[node][_k] = graph.getNodeAttribute(node, _k);\n }\n var frame = null;\n var _step = function step() {\n frame = null;\n var p = (Date.now() - start) / options.duration;\n if (p >= 1) {\n // Animation is done\n for (var _node in targets) {\n var _attrs = targets[_node];\n\n // We use given values to avoid precision issues and for convenience\n for (var _k2 in _attrs) graph.setNodeAttribute(_node, _k2, _attrs[_k2]);\n }\n if (typeof callback === \"function\") callback();\n return;\n }\n p = easing(p);\n for (var _node2 in targets) {\n var _attrs2 = targets[_node2];\n var s = startPositions[_node2];\n for (var _k3 in _attrs2) graph.setNodeAttribute(_node2, _k3, _attrs2[_k3] * p + s[_k3] * (1 - p));\n }\n frame = requestAnimationFrame(_step);\n };\n _step();\n return function () {\n if (frame) cancelAnimationFrame(frame);\n };\n}\n\nfunction identity() {\n return Float32Array.of(1, 0, 0, 0, 1, 0, 0, 0, 1);\n}\n\n// TODO: optimize\nfunction scale(m, x, y) {\n m[0] = x;\n m[4] = typeof y === \"number\" ? y : x;\n return m;\n}\nfunction rotate(m, r) {\n var s = Math.sin(r),\n c = Math.cos(r);\n m[0] = c;\n m[1] = s;\n m[3] = -s;\n m[4] = c;\n return m;\n}\nfunction translate(m, x, y) {\n m[6] = x;\n m[7] = y;\n return m;\n}\nfunction multiply(a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n a[0] = b00 * a00 + b01 * a10 + b02 * a20;\n a[1] = b00 * a01 + b01 * a11 + b02 * a21;\n a[2] = b00 * a02 + b01 * a12 + b02 * a22;\n a[3] = b10 * a00 + b11 * a10 + b12 * a20;\n a[4] = b10 * a01 + b11 * a11 + b12 * a21;\n a[5] = b10 * a02 + b11 * a12 + b12 * a22;\n a[6] = b20 * a00 + b21 * a10 + b22 * a20;\n a[7] = b20 * a01 + b21 * a11 + b22 * a21;\n a[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return a;\n}\nfunction multiplyVec2(a, b) {\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var a00 = a[0];\n var a01 = a[1];\n var a10 = a[3];\n var a11 = a[4];\n var a20 = a[6];\n var a21 = a[7];\n var b0 = b.x;\n var b1 = b.y;\n return {\n x: b0 * a00 + b1 * a10 + a20 * z,\n y: b0 * a01 + b1 * a11 + a21 * z\n };\n}\n\n/**\n * In sigma, the graph is normalized into a [0, 1], [0, 1] square, before being given to the various renderers. This\n * helps to deal with quadtree in particular.\n * But at some point, we need to rescale it so that it takes the best place in the screen, i.e. we always want to see two\n * nodes \"touching\" opposite sides of the graph, with the camera being at its default state.\n *\n * This function determines this ratio.\n */\nfunction getCorrectionRatio(viewportDimensions, graphDimensions) {\n var viewportRatio = viewportDimensions.height / viewportDimensions.width;\n var graphRatio = graphDimensions.height / graphDimensions.width;\n\n // If the stage and the graphs are in different directions (such as the graph being wider that tall while the stage\n // is taller than wide), we can stop here to have indeed nodes touching opposite sides:\n if (viewportRatio < 1 && graphRatio > 1 || viewportRatio > 1 && graphRatio < 1) {\n return 1;\n }\n\n // Else, we need to fit the graph inside the stage:\n // 1. If the graph is \"squarer\" (i.e. with a ratio closer to 1), we need to make the largest sides touch;\n // 2. If the stage is \"squarer\", we need to make the smallest sides touch.\n return Math.min(Math.max(graphRatio, 1 / graphRatio), Math.max(1 / viewportRatio, viewportRatio));\n}\n\n/**\n * Function returning a matrix from the current state of the camera.\n */\nfunction matrixFromCamera(state, viewportDimensions, graphDimensions, padding, inverse) {\n // TODO: it's possible to optimize this drastically!\n var angle = state.angle,\n ratio = state.ratio,\n x = state.x,\n y = state.y;\n var width = viewportDimensions.width,\n height = viewportDimensions.height;\n var matrix = identity();\n var smallestDimension = Math.min(width, height) - 2 * padding;\n var correctionRatio = getCorrectionRatio(viewportDimensions, graphDimensions);\n if (!inverse) {\n multiply(matrix, scale(identity(), 2 * (smallestDimension / width) * correctionRatio, 2 * (smallestDimension / height) * correctionRatio));\n multiply(matrix, rotate(identity(), -angle));\n multiply(matrix, scale(identity(), 1 / ratio));\n multiply(matrix, translate(identity(), -x, -y));\n } else {\n multiply(matrix, translate(identity(), x, y));\n multiply(matrix, scale(identity(), ratio));\n multiply(matrix, rotate(identity(), angle));\n multiply(matrix, scale(identity(), width / smallestDimension / 2 / correctionRatio, height / smallestDimension / 2 / correctionRatio));\n }\n return matrix;\n}\n\n/**\n * All these transformations we apply on the matrix to get it rescale the graph\n * as we want make it very hard to get pixel-perfect distances in WebGL. This\n * function returns a factor that properly cancels the matrix effect on lengths.\n *\n * [jacomyal]\n * To be fully honest, I can't really explain happens here... I notice that the\n * following ratio works (i.e. it correctly compensates the matrix impact on all\n * camera states I could try):\n * > `R = size(V) / size(M * V) / W`\n * as long as `M * V` is in the direction of W (ie. parallel to (Ox)). It works\n * as well with H and a vector that transforms into something parallel to (Oy).\n *\n * Also, note that we use `angle` and not `-angle` (that would seem logical,\n * since we want to anticipate the rotation), because the image is vertically\n * swapped in WebGL.\n */\nfunction getMatrixImpact(matrix, cameraState, viewportDimensions) {\n var _multiplyVec = multiplyVec2(matrix, {\n x: Math.cos(cameraState.angle),\n y: Math.sin(cameraState.angle)\n }, 0),\n x = _multiplyVec.x,\n y = _multiplyVec.y;\n return 1 / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) / viewportDimensions.width;\n}\n\n/**\n * Function returning the graph's node extent in x & y.\n */\nfunction graphExtent(graph) {\n if (!graph.order) return {\n x: [0, 1],\n y: [0, 1]\n };\n var xMin = Infinity;\n var xMax = -Infinity;\n var yMin = Infinity;\n var yMax = -Infinity;\n graph.forEachNode(function (_, attr) {\n var x = attr.x,\n y = attr.y;\n if (x < xMin) xMin = x;\n if (x > xMax) xMax = x;\n if (y < yMin) yMin = y;\n if (y > yMax) yMax = y;\n });\n return {\n x: [xMin, xMax],\n y: [yMin, yMax]\n };\n}\n\n/**\n * Check if the graph variable is a valid graph, and if sigma can render it.\n */\nfunction validateGraph(graph) {\n // check if it's a valid graphology instance\n if (!isGraph(graph)) throw new Error(\"Sigma: invalid graph instance.\");\n\n // check if nodes have x/y attributes\n graph.forEachNode(function (key, attributes) {\n if (!Number.isFinite(attributes.x) || !Number.isFinite(attributes.y)) {\n throw new Error(\"Sigma: Coordinates of node \".concat(key, \" are invalid. A node must have a numeric 'x' and 'y' attribute.\"));\n }\n });\n}\n\n/**\n * Function used to create DOM elements easily.\n */\nfunction createElement(tag, style, attributes) {\n var element = document.createElement(tag);\n if (style) {\n for (var k in style) {\n element.style[k] = style[k];\n }\n }\n if (attributes) {\n for (var _k in attributes) {\n element.setAttribute(_k, attributes[_k]);\n }\n }\n return element;\n}\n\n/**\n * Function returning the browser's pixel ratio.\n */\nfunction getPixelRatio() {\n if (typeof window.devicePixelRatio !== \"undefined\") return window.devicePixelRatio;\n return 1;\n}\n\n/**\n * Function ordering the given elements in reverse z-order so they drawn\n * the correct way.\n */\nfunction zIndexOrdering(_extent, getter, elements) {\n // If k is > n, we'll use a standard sort\n return elements.sort(function (a, b) {\n var zA = getter(a) || 0,\n zB = getter(b) || 0;\n if (zA < zB) return -1;\n if (zA > zB) return 1;\n return 0;\n });\n\n // TODO: counting sort optimization\n}\n\n/**\n * Factory returning a function normalizing the given node's position & size.\n */\n\nfunction createNormalizationFunction(extent) {\n var _extent$x = _slicedToArray(extent.x, 2),\n minX = _extent$x[0],\n maxX = _extent$x[1],\n _extent$y = _slicedToArray(extent.y, 2),\n minY = _extent$y[0],\n maxY = _extent$y[1];\n var ratio = Math.max(maxX - minX, maxY - minY),\n dX = (maxX + minX) / 2,\n dY = (maxY + minY) / 2;\n if (ratio === 0 || Math.abs(ratio) === Infinity || isNaN(ratio)) ratio = 1;\n if (isNaN(dX)) dX = 0;\n if (isNaN(dY)) dY = 0;\n var fn = function fn(data) {\n return {\n x: 0.5 + (data.x - dX) / ratio,\n y: 0.5 + (data.y - dY) / ratio\n };\n };\n\n // TODO: possibility to apply this in batch over array of indices\n fn.applyTo = function (data) {\n data.x = 0.5 + (data.x - dX) / ratio;\n data.y = 0.5 + (data.y - dY) / ratio;\n };\n fn.inverse = function (data) {\n return {\n x: dX + ratio * (data.x - 0.5),\n y: dY + ratio * (data.y - 0.5)\n };\n };\n fn.ratio = ratio;\n return fn;\n}\n\nexport { ANIMATE_DEFAULTS as A, getMatrixImpact as a, createElement as b, createNormalizationFunction as c, getPixelRatio as d, easings as e, multiplyVec2 as f, graphExtent as g, animateNodes as h, identity as i, getCorrectionRatio as j, quadraticOut as k, linear as l, matrixFromCamera as m, quadraticInOut as n, cubicIn as o, cubicOut as p, quadraticIn as q, cubicInOut as r, scale as s, rotate as t, translate as u, validateGraph as v, multiply as w, zIndexOrdering as z };\n", "function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\n\n/**\n * Extends the target array with the given values.\n */\nfunction extend(array, values) {\n var l2 = values.size;\n if (l2 === 0) return;\n var l1 = array.length;\n array.length += l2;\n var i = 0;\n values.forEach(function (value) {\n array[l1 + i] = value;\n i++;\n });\n}\n\n/**\n * Checks whether the given value is a plain object.\n */\nfunction isPlainObject(value) {\n return _typeof(value) === \"object\" && value !== null && value.constructor === Object;\n}\n\n/**\n * Helper to use `Object.assign` with more than two objects.\n */\nfunction assign(target) {\n target = target || {};\n for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {\n var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];\n if (!o) continue;\n Object.assign(target, o);\n }\n return target;\n}\n\n/**\n * Very simple recursive `Object.assign` like function.\n */\nfunction assignDeep(target) {\n target = target || {};\n for (var i = 0, l = arguments.length <= 1 ? 0 : arguments.length - 1; i < l; i++) {\n var o = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];\n if (!o) continue;\n for (var k in o) {\n if (isPlainObject(o[k])) {\n target[k] = assignDeep(target[k], o[k]);\n } else {\n target[k] = o[k];\n }\n }\n }\n return target;\n}\n\nexport { _typeof as _, assign as a, assignDeep as b, extend as e, isPlainObject as i };\n", "import { d as drawStraightEdgeLabel, b as drawDiscNodeLabel, c as drawDiscNodeHover, N as NodeCircleProgram, E as EdgeArrowProgram, e as EdgeRectangleProgram } from '../../dist/index-236c62ad.esm.js';\nimport { a as assign } from '../../dist/data-11df7124.esm.js';\nimport '../../dist/inherits-d1a1e29b.esm.js';\nimport '../../dist/colors-beb06eb2.esm.js';\n\n/**\n * Sigma.js Settings\n * =================================\n *\n * The list of settings and some handy functions.\n * @module\n */\n\n/**\n * Sigma.js settings\n * =================================\n */\n\nvar DEFAULT_SETTINGS = {\n // Performance\n hideEdgesOnMove: false,\n hideLabelsOnMove: false,\n renderLabels: true,\n renderEdgeLabels: false,\n enableEdgeEvents: false,\n // Component rendering\n defaultNodeColor: \"#999\",\n defaultNodeType: \"circle\",\n defaultEdgeColor: \"#ccc\",\n defaultEdgeType: \"line\",\n labelFont: \"Arial\",\n labelSize: 14,\n labelWeight: \"normal\",\n labelColor: {\n color: \"#000\"\n },\n edgeLabelFont: \"Arial\",\n edgeLabelSize: 14,\n edgeLabelWeight: \"normal\",\n edgeLabelColor: {\n attribute: \"color\"\n },\n stagePadding: 30,\n defaultDrawEdgeLabel: drawStraightEdgeLabel,\n defaultDrawNodeLabel: drawDiscNodeLabel,\n defaultDrawNodeHover: drawDiscNodeHover,\n minEdgeThickness: 1.7,\n antiAliasingFeather: 1,\n // Mouse and touch settings\n dragTimeout: 100,\n draggedEventsTolerance: 3,\n inertiaDuration: 200,\n inertiaRatio: 3,\n zoomDuration: 250,\n zoomingRatio: 1.7,\n doubleClickTimeout: 300,\n doubleClickZoomingRatio: 2.2,\n doubleClickZoomingDuration: 200,\n tapMoveTolerance: 10,\n // Size and scaling\n zoomToSizeRatioFunction: Math.sqrt,\n itemSizesReference: \"screen\",\n autoRescale: true,\n autoCenter: true,\n // Labels\n labelDensity: 1,\n labelGridCellSize: 100,\n labelRenderedSizeThreshold: 6,\n // Reducers\n nodeReducer: null,\n edgeReducer: null,\n // Features\n zIndex: false,\n minCameraRatio: null,\n maxCameraRatio: null,\n enableCameraZooming: true,\n enableCameraPanning: true,\n enableCameraRotation: true,\n cameraPanBoundaries: null,\n // Lifecycle\n allowInvalidContainer: false,\n // Program classes\n nodeProgramClasses: {},\n nodeHoverProgramClasses: {},\n edgeProgramClasses: {}\n};\nvar DEFAULT_NODE_PROGRAM_CLASSES = {\n circle: NodeCircleProgram\n};\nvar DEFAULT_EDGE_PROGRAM_CLASSES = {\n arrow: EdgeArrowProgram,\n line: EdgeRectangleProgram\n};\nfunction validateSettings(settings) {\n if (typeof settings.labelDensity !== \"number\" || settings.labelDensity < 0) {\n throw new Error(\"Settings: invalid `labelDensity`. Expecting a positive number.\");\n }\n var minCameraRatio = settings.minCameraRatio,\n maxCameraRatio = settings.maxCameraRatio;\n if (typeof minCameraRatio === \"number\" && typeof maxCameraRatio === \"number\" && maxCameraRatio < minCameraRatio) {\n throw new Error(\"Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.\");\n }\n}\nfunction resolveSettings(settings) {\n var resolvedSettings = assign({}, DEFAULT_SETTINGS, settings);\n resolvedSettings.nodeProgramClasses = assign({}, DEFAULT_NODE_PROGRAM_CLASSES, resolvedSettings.nodeProgramClasses);\n resolvedSettings.edgeProgramClasses = assign({}, DEFAULT_EDGE_PROGRAM_CLASSES, resolvedSettings.edgeProgramClasses);\n return resolvedSettings;\n}\n\nexport { DEFAULT_EDGE_PROGRAM_CLASSES, DEFAULT_NODE_PROGRAM_CLASSES, DEFAULT_SETTINGS, resolveSettings, validateSettings };\n", "import { _ as _objectSpread2, a as _defineProperty } from './index-236c62ad.esm.js';\nimport { _ as _inherits, a as _createClass, b as _classCallCheck, c as _callSuper, d as _toPropertyKey } from './inherits-d1a1e29b.esm.js';\nimport { TypedEventEmitter } from '../types/dist/sigma-types.esm.js';\nimport { A as ANIMATE_DEFAULTS, e as easings, g as graphExtent, c as createNormalizationFunction, m as matrixFromCamera, z as zIndexOrdering, a as getMatrixImpact, b as createElement, d as getPixelRatio, f as multiplyVec2, i as identity, v as validateGraph } from './normalization-be445518.esm.js';\nimport { DEFAULT_SETTINGS, validateSettings, resolveSettings } from '../settings/dist/sigma-settings.esm.js';\nimport { _ as _slicedToArray, a as _arrayLikeToArray, b as _unsupportedIterableToArray, g as getPixelColor, c as colorToIndex } from './colors-beb06eb2.esm.js';\nimport { _ as _typeof, e as extend } from './data-11df7124.esm.js';\nimport 'events';\nimport 'graphology-utils/is-graph';\n\n/**\n * Defaults.\n */\nvar DEFAULT_ZOOMING_RATIO = 1.5;\n\n/**\n * Event types.\n */\n/**\n * Camera class\n */\nvar Camera = /*#__PURE__*/function (_TypedEventEmitter) {\n function Camera() {\n var _this;\n _classCallCheck(this, Camera);\n _this = _callSuper(this, Camera);\n\n // State\n _defineProperty(_this, \"x\", 0.5);\n _defineProperty(_this, \"y\", 0.5);\n _defineProperty(_this, \"angle\", 0);\n _defineProperty(_this, \"ratio\", 1);\n _defineProperty(_this, \"minRatio\", null);\n _defineProperty(_this, \"maxRatio\", null);\n _defineProperty(_this, \"enabledZooming\", true);\n _defineProperty(_this, \"enabledPanning\", true);\n _defineProperty(_this, \"enabledRotation\", true);\n _defineProperty(_this, \"clean\", null);\n _defineProperty(_this, \"nextFrame\", null);\n _defineProperty(_this, \"previousState\", null);\n _defineProperty(_this, \"enabled\", true);\n _this.previousState = _this.getState();\n return _this;\n }\n\n /**\n * Static method used to create a Camera object with a given state.\n */\n _inherits(Camera, _TypedEventEmitter);\n return _createClass(Camera, [{\n key: \"enable\",\n value:\n /**\n * Method used to enable the camera.\n */\n function enable() {\n this.enabled = true;\n return this;\n }\n\n /**\n * Method used to disable the camera.\n */\n }, {\n key: \"disable\",\n value: function disable() {\n this.enabled = false;\n return this;\n }\n\n /**\n * Method used to retrieve the camera's current state.\n */\n }, {\n key: \"getState\",\n value: function getState() {\n return {\n x: this.x,\n y: this.y,\n angle: this.angle,\n ratio: this.ratio\n };\n }\n\n /**\n * Method used to check whether the camera has the given state.\n */\n }, {\n key: \"hasState\",\n value: function hasState(state) {\n return this.x === state.x && this.y === state.y && this.ratio === state.ratio && this.angle === state.angle;\n }\n\n /**\n * Method used to retrieve the camera's previous state.\n */\n }, {\n key: \"getPreviousState\",\n value: function getPreviousState() {\n var state = this.previousState;\n if (!state) return null;\n return {\n x: state.x,\n y: state.y,\n angle: state.angle,\n ratio: state.ratio\n };\n }\n\n /**\n * Method used to check minRatio and maxRatio values.\n */\n }, {\n key: \"getBoundedRatio\",\n value: function getBoundedRatio(ratio) {\n var r = ratio;\n if (typeof this.minRatio === \"number\") r = Math.max(r, this.minRatio);\n if (typeof this.maxRatio === \"number\") r = Math.min(r, this.maxRatio);\n return r;\n }\n\n /**\n * Method used to check various things to return a legit state candidate.\n */\n }, {\n key: \"validateState\",\n value: function validateState(state) {\n var validatedState = {};\n if (this.enabledPanning && typeof state.x === \"number\") validatedState.x = state.x;\n if (this.enabledPanning && typeof state.y === \"number\") validatedState.y = state.y;\n if (this.enabledZooming && typeof state.ratio === \"number\") validatedState.ratio = this.getBoundedRatio(state.ratio);\n if (this.enabledRotation && typeof state.angle === \"number\") validatedState.angle = state.angle;\n return this.clean ? this.clean(_objectSpread2(_objectSpread2({}, this.getState()), validatedState)) : validatedState;\n }\n\n /**\n * Method used to check whether the camera is currently being animated.\n */\n }, {\n key: \"isAnimated\",\n value: function isAnimated() {\n return !!this.nextFrame;\n }\n\n /**\n * Method used to set the camera's state.\n */\n }, {\n key: \"setState\",\n value: function setState(state) {\n if (!this.enabled) return this;\n\n // Keeping track of last state\n this.previousState = this.getState();\n var validState = this.validateState(state);\n if (typeof validState.x === \"number\") this.x = validState.x;\n if (typeof validState.y === \"number\") this.y = validState.y;\n if (typeof validState.ratio === \"number\") this.ratio = validState.ratio;\n if (typeof validState.angle === \"number\") this.angle = validState.angle;\n\n // Emitting\n if (!this.hasState(this.previousState)) this.emit(\"updated\", this.getState());\n return this;\n }\n\n /**\n * Method used to update the camera's state using a function.\n */\n }, {\n key: \"updateState\",\n value: function updateState(updater) {\n this.setState(updater(this.getState()));\n return this;\n }\n\n /**\n * Method used to animate the camera.\n */\n }, {\n key: \"animate\",\n value: function animate(state) {\n var _this2 = this;\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n if (!callback) return new Promise(function (resolve) {\n return _this2.animate(state, opts, resolve);\n });\n if (!this.enabled) return;\n var options = _objectSpread2(_objectSpread2({}, ANIMATE_DEFAULTS), opts);\n var validState = this.validateState(state);\n var easing = typeof options.easing === \"function\" ? options.easing : easings[options.easing];\n\n // State\n var start = Date.now(),\n initialState = this.getState();\n\n // Function performing the animation\n var _fn = function fn() {\n var t = (Date.now() - start) / options.duration;\n\n // The animation is over:\n if (t >= 1) {\n _this2.nextFrame = null;\n _this2.setState(validState);\n if (_this2.animationCallback) {\n _this2.animationCallback.call(null);\n _this2.animationCallback = undefined;\n }\n return;\n }\n var coefficient = easing(t);\n var newState = {};\n if (typeof validState.x === \"number\") newState.x = initialState.x + (validState.x - initialState.x) * coefficient;\n if (typeof validState.y === \"number\") newState.y = initialState.y + (validState.y - initialState.y) * coefficient;\n if (_this2.enabledRotation && typeof validState.angle === \"number\") newState.angle = initialState.angle + (validState.angle - initialState.angle) * coefficient;\n if (typeof validState.ratio === \"number\") newState.ratio = initialState.ratio + (validState.ratio - initialState.ratio) * coefficient;\n _this2.setState(newState);\n _this2.nextFrame = requestAnimationFrame(_fn);\n };\n if (this.nextFrame) {\n cancelAnimationFrame(this.nextFrame);\n if (this.animationCallback) this.animationCallback.call(null);\n this.nextFrame = requestAnimationFrame(_fn);\n } else {\n _fn();\n }\n this.animationCallback = callback;\n }\n\n /**\n * Method used to zoom the camera.\n */\n }, {\n key: \"animatedZoom\",\n value: function animatedZoom(factorOrOptions) {\n if (!factorOrOptions) return this.animate({\n ratio: this.ratio / DEFAULT_ZOOMING_RATIO\n });\n if (typeof factorOrOptions === \"number\") return this.animate({\n ratio: this.ratio / factorOrOptions\n });\n return this.animate({\n ratio: this.ratio / (factorOrOptions.factor || DEFAULT_ZOOMING_RATIO)\n }, factorOrOptions);\n }\n\n /**\n * Method used to unzoom the camera.\n */\n }, {\n key: \"animatedUnzoom\",\n value: function animatedUnzoom(factorOrOptions) {\n if (!factorOrOptions) return this.animate({\n ratio: this.ratio * DEFAULT_ZOOMING_RATIO\n });\n if (typeof factorOrOptions === \"number\") return this.animate({\n ratio: this.ratio * factorOrOptions\n });\n return this.animate({\n ratio: this.ratio * (factorOrOptions.factor || DEFAULT_ZOOMING_RATIO)\n }, factorOrOptions);\n }\n\n /**\n * Method used to reset the camera.\n */\n }, {\n key: \"animatedReset\",\n value: function animatedReset(options) {\n return this.animate({\n x: 0.5,\n y: 0.5,\n ratio: 1,\n angle: 0\n }, options);\n }\n\n /**\n * Returns a new Camera instance, with the same state as the current camera.\n */\n }, {\n key: \"copy\",\n value: function copy() {\n return Camera.from(this.getState());\n }\n }], [{\n key: \"from\",\n value: function from(state) {\n var camera = new Camera();\n return camera.setState(state);\n }\n }]);\n}(TypedEventEmitter);\n\n/**\n * Captor utils functions\n * ======================\n */\n\n/**\n * Extract the local X and Y coordinates from a mouse event or touch object. If\n * a DOM element is given, it uses this element's offset to compute the position\n * (this allows using events that are not bound to the container itself and\n * still have a proper position).\n *\n * @param {event} e - A mouse event or touch object.\n * @param {HTMLElement} dom - A DOM element to compute offset relatively to.\n * @return {number} The local Y value of the mouse.\n */\nfunction getPosition(e, dom) {\n var bbox = dom.getBoundingClientRect();\n return {\n x: e.clientX - bbox.left,\n y: e.clientY - bbox.top\n };\n}\n\n/**\n * Convert mouse coords to sigma coords.\n *\n * @param {event} e - A mouse event or touch object.\n * @param {HTMLElement} dom - A DOM element to compute offset relatively to.\n * @return {object}\n */\nfunction getMouseCoords(e, dom) {\n var res = _objectSpread2(_objectSpread2({}, getPosition(e, dom)), {}, {\n sigmaDefaultPrevented: false,\n preventSigmaDefault: function preventSigmaDefault() {\n res.sigmaDefaultPrevented = true;\n },\n original: e\n });\n return res;\n}\n\n/**\n * Takes a touch coords or a mouse coords, and always returns a clean mouse coords object.\n */\nfunction cleanMouseCoords(e) {\n var res = \"x\" in e ? e : _objectSpread2(_objectSpread2({}, e.touches[0] || e.previousTouches[0]), {}, {\n original: e.original,\n sigmaDefaultPrevented: e.sigmaDefaultPrevented,\n preventSigmaDefault: function preventSigmaDefault() {\n e.sigmaDefaultPrevented = true;\n res.sigmaDefaultPrevented = true;\n }\n });\n return res;\n}\n\n/**\n * Convert mouse wheel event coords to sigma coords.\n *\n * @param {event} e - A wheel mouse event.\n * @param {HTMLElement} dom - A DOM element to compute offset relatively to.\n * @return {object}\n */\nfunction getWheelCoords(e, dom) {\n return _objectSpread2(_objectSpread2({}, getMouseCoords(e, dom)), {}, {\n delta: getWheelDelta(e)\n });\n}\nvar MAX_TOUCHES = 2;\nfunction getTouchesArray(touches) {\n var arr = [];\n for (var i = 0, l = Math.min(touches.length, MAX_TOUCHES); i < l; i++) arr.push(touches[i]);\n return arr;\n}\n\n/**\n * Convert touch coords to sigma coords.\n *\n * @param {event} e - A touch event.\n * @param {Touch[]} previousTouches - An array of the previously stored touches.\n * @param {HTMLElement} dom - A DOM element to compute offset relatively to.\n * @return {object}\n */\nfunction getTouchCoords(e, previousTouches, dom) {\n var res = {\n touches: getTouchesArray(e.touches).map(function (touch) {\n return getPosition(touch, dom);\n }),\n previousTouches: previousTouches.map(function (touch) {\n return getPosition(touch, dom);\n }),\n sigmaDefaultPrevented: false,\n preventSigmaDefault: function preventSigmaDefault() {\n res.sigmaDefaultPrevented = true;\n },\n original: e\n };\n return res;\n}\n\n/**\n * Extract the wheel delta from a mouse event or touch object.\n *\n * @param {event} e - A mouse event or touch object.\n * @return {number} The wheel delta of the mouse.\n */\nfunction getWheelDelta(e) {\n // TODO: check those ratios again to ensure a clean Chrome/Firefox compat\n if (typeof e.deltaY !== \"undefined\") return e.deltaY * -3 / 360;\n if (typeof e.detail !== \"undefined\") return e.detail / -9;\n throw new Error(\"Captor: could not extract delta from event.\");\n}\n\n/**\n * Abstract class representing a captor like the user's mouse or touch controls.\n */\nvar Captor = /*#__PURE__*/function (_TypedEventEmitter) {\n function Captor(container, renderer) {\n var _this;\n _classCallCheck(this, Captor);\n _this = _callSuper(this, Captor);\n // Properties\n _this.container = container;\n _this.renderer = renderer;\n return _this;\n }\n _inherits(Captor, _TypedEventEmitter);\n return _createClass(Captor);\n}(TypedEventEmitter);\n\nvar MOUSE_SETTINGS_KEYS = [\"doubleClickTimeout\", \"doubleClickZoomingDuration\", \"doubleClickZoomingRatio\", \"dragTimeout\", \"draggedEventsTolerance\", \"inertiaDuration\", \"inertiaRatio\", \"zoomDuration\", \"zoomingRatio\"];\nvar DEFAULT_MOUSE_SETTINGS = MOUSE_SETTINGS_KEYS.reduce(function (iter, key) {\n return _objectSpread2(_objectSpread2({}, iter), {}, _defineProperty({}, key, DEFAULT_SETTINGS[key]));\n}, {});\n\n/**\n * Event types.\n */\n/**\n * Mouse captor class.\n *\n * @constructor\n */\nvar MouseCaptor = /*#__PURE__*/function (_Captor) {\n function MouseCaptor(container, renderer) {\n var _this;\n _classCallCheck(this, MouseCaptor);\n _this = _callSuper(this, MouseCaptor, [container, renderer]);\n\n // Binding methods\n // State\n _defineProperty(_this, \"enabled\", true);\n _defineProperty(_this, \"draggedEvents\", 0);\n _defineProperty(_this, \"downStartTime\", null);\n _defineProperty(_this, \"lastMouseX\", null);\n _defineProperty(_this, \"lastMouseY\", null);\n _defineProperty(_this, \"isMouseDown\", false);\n _defineProperty(_this, \"isMoving\", false);\n _defineProperty(_this, \"movingTimeout\", null);\n _defineProperty(_this, \"startCameraState\", null);\n _defineProperty(_this, \"clicks\", 0);\n _defineProperty(_this, \"doubleClickTimeout\", null);\n _defineProperty(_this, \"currentWheelDirection\", 0);\n _defineProperty(_this, \"settings\", DEFAULT_MOUSE_SETTINGS);\n _this.handleClick = _this.handleClick.bind(_this);\n _this.handleRightClick = _this.handleRightClick.bind(_this);\n _this.handleDown = _this.handleDown.bind(_this);\n _this.handleUp = _this.handleUp.bind(_this);\n _this.handleMove = _this.handleMove.bind(_this);\n _this.handleWheel = _this.handleWheel.bind(_this);\n _this.handleLeave = _this.handleLeave.bind(_this);\n _this.handleEnter = _this.handleEnter.bind(_this);\n\n // Binding events\n container.addEventListener(\"click\", _this.handleClick, {\n capture: false\n });\n container.addEventListener(\"contextmenu\", _this.handleRightClick, {\n capture: false\n });\n container.addEventListener(\"mousedown\", _this.handleDown, {\n capture: false\n });\n container.addEventListener(\"wheel\", _this.handleWheel, {\n capture: false\n });\n container.addEventListener(\"mouseleave\", _this.handleLeave, {\n capture: false\n });\n container.addEventListener(\"mouseenter\", _this.handleEnter, {\n capture: false\n });\n document.addEventListener(\"mousemove\", _this.handleMove, {\n capture: false\n });\n document.addEventListener(\"mouseup\", _this.handleUp, {\n capture: false\n });\n return _this;\n }\n _inherits(MouseCaptor, _Captor);\n return _createClass(MouseCaptor, [{\n key: \"kill\",\n value: function kill() {\n var container = this.container;\n container.removeEventListener(\"click\", this.handleClick);\n container.removeEventListener(\"contextmenu\", this.handleRightClick);\n container.removeEventListener(\"mousedown\", this.handleDown);\n container.removeEventListener(\"wheel\", this.handleWheel);\n container.removeEventListener(\"mouseleave\", this.handleLeave);\n container.removeEventListener(\"mouseenter\", this.handleEnter);\n document.removeEventListener(\"mousemove\", this.handleMove);\n document.removeEventListener(\"mouseup\", this.handleUp);\n }\n }, {\n key: \"handleClick\",\n value: function handleClick(e) {\n var _this2 = this;\n if (!this.enabled) return;\n this.clicks++;\n if (this.clicks === 2) {\n this.clicks = 0;\n if (typeof this.doubleClickTimeout === \"number\") {\n clearTimeout(this.doubleClickTimeout);\n this.doubleClickTimeout = null;\n }\n return this.handleDoubleClick(e);\n }\n setTimeout(function () {\n _this2.clicks = 0;\n _this2.doubleClickTimeout = null;\n }, this.settings.doubleClickTimeout);\n\n // NOTE: this is here to prevent click events on drag\n if (this.draggedEvents < this.settings.draggedEventsTolerance) this.emit(\"click\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleRightClick\",\n value: function handleRightClick(e) {\n if (!this.enabled) return;\n this.emit(\"rightClick\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleDoubleClick\",\n value: function handleDoubleClick(e) {\n if (!this.enabled) return;\n e.preventDefault();\n e.stopPropagation();\n var mouseCoords = getMouseCoords(e, this.container);\n this.emit(\"doubleClick\", mouseCoords);\n if (mouseCoords.sigmaDefaultPrevented) return;\n\n // default behavior\n var camera = this.renderer.getCamera();\n var newRatio = camera.getBoundedRatio(camera.getState().ratio / this.settings.doubleClickZoomingRatio);\n camera.animate(this.renderer.getViewportZoomedState(getPosition(e, this.container), newRatio), {\n easing: \"quadraticInOut\",\n duration: this.settings.doubleClickZoomingDuration\n });\n }\n }, {\n key: \"handleDown\",\n value: function handleDown(e) {\n if (!this.enabled) return;\n\n // We only start dragging on left button\n if (e.button === 0) {\n this.startCameraState = this.renderer.getCamera().getState();\n var _getPosition = getPosition(e, this.container),\n x = _getPosition.x,\n y = _getPosition.y;\n this.lastMouseX = x;\n this.lastMouseY = y;\n this.draggedEvents = 0;\n this.downStartTime = Date.now();\n this.isMouseDown = true;\n }\n this.emit(\"mousedown\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleUp\",\n value: function handleUp(e) {\n var _this3 = this;\n if (!this.enabled || !this.isMouseDown) return;\n var camera = this.renderer.getCamera();\n this.isMouseDown = false;\n if (typeof this.movingTimeout === \"number\") {\n clearTimeout(this.movingTimeout);\n this.movingTimeout = null;\n }\n var _getPosition2 = getPosition(e, this.container),\n x = _getPosition2.x,\n y = _getPosition2.y;\n var cameraState = camera.getState(),\n previousCameraState = camera.getPreviousState() || {\n x: 0,\n y: 0\n };\n if (this.isMoving) {\n camera.animate({\n x: cameraState.x + this.settings.inertiaRatio * (cameraState.x - previousCameraState.x),\n y: cameraState.y + this.settings.inertiaRatio * (cameraState.y - previousCameraState.y)\n }, {\n duration: this.settings.inertiaDuration,\n easing: \"quadraticOut\"\n });\n } else if (this.lastMouseX !== x || this.lastMouseY !== y) {\n camera.setState({\n x: cameraState.x,\n y: cameraState.y\n });\n }\n this.isMoving = false;\n setTimeout(function () {\n var shouldRefresh = _this3.draggedEvents > 0;\n _this3.draggedEvents = 0;\n\n // NOTE: this refresh is here to make sure `hideEdgesOnMove` can work\n // when someone releases camera pan drag after having stopped moving.\n // See commit: https://github.com/jacomyal/sigma.js/commit/cfd9197f70319109db6b675dd7c82be493ca95a2\n // See also issue: https://github.com/jacomyal/sigma.js/issues/1290\n // It could be possible to render instead of scheduling a refresh but for\n // now it seems good enough.\n if (shouldRefresh && _this3.renderer.getSetting(\"hideEdgesOnMove\")) _this3.renderer.refresh();\n }, 0);\n this.emit(\"mouseup\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleMove\",\n value: function handleMove(e) {\n var _this4 = this;\n if (!this.enabled) return;\n var mouseCoords = getMouseCoords(e, this.container);\n\n // Always trigger a \"mousemovebody\" event, so that it is possible to develop\n // a drag-and-drop effect that works even when the mouse is out of the\n // container:\n this.emit(\"mousemovebody\", mouseCoords);\n\n // Only trigger the \"mousemove\" event when the mouse is actually hovering\n // the container, to avoid weirdly hovering nodes and/or edges when the\n // mouse is not hover the container:\n if (e.target === this.container || e.composedPath()[0] === this.container) {\n this.emit(\"mousemove\", mouseCoords);\n }\n if (mouseCoords.sigmaDefaultPrevented) return;\n\n // Handle the case when \"isMouseDown\" all the time, to allow dragging the\n // stage while the mouse is not hover the container:\n if (this.isMouseDown) {\n this.isMoving = true;\n this.draggedEvents++;\n if (typeof this.movingTimeout === \"number\") {\n clearTimeout(this.movingTimeout);\n }\n this.movingTimeout = window.setTimeout(function () {\n _this4.movingTimeout = null;\n _this4.isMoving = false;\n }, this.settings.dragTimeout);\n var camera = this.renderer.getCamera();\n var _getPosition3 = getPosition(e, this.container),\n eX = _getPosition3.x,\n eY = _getPosition3.y;\n var lastMouse = this.renderer.viewportToFramedGraph({\n x: this.lastMouseX,\n y: this.lastMouseY\n });\n var mouse = this.renderer.viewportToFramedGraph({\n x: eX,\n y: eY\n });\n var offsetX = lastMouse.x - mouse.x,\n offsetY = lastMouse.y - mouse.y;\n var cameraState = camera.getState();\n var x = cameraState.x + offsetX,\n y = cameraState.y + offsetY;\n camera.setState({\n x: x,\n y: y\n });\n this.lastMouseX = eX;\n this.lastMouseY = eY;\n e.preventDefault();\n e.stopPropagation();\n }\n }\n }, {\n key: \"handleLeave\",\n value: function handleLeave(e) {\n this.emit(\"mouseleave\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleEnter\",\n value: function handleEnter(e) {\n this.emit(\"mouseenter\", getMouseCoords(e, this.container));\n }\n }, {\n key: \"handleWheel\",\n value: function handleWheel(e) {\n var _this5 = this;\n var camera = this.renderer.getCamera();\n if (!this.enabled || !camera.enabledZooming) return;\n var delta = getWheelDelta(e);\n if (!delta) return;\n var wheelCoords = getWheelCoords(e, this.container);\n this.emit(\"wheel\", wheelCoords);\n if (wheelCoords.sigmaDefaultPrevented) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n // Default behavior\n var currentRatio = camera.getState().ratio;\n var ratioDiff = delta > 0 ? 1 / this.settings.zoomingRatio : this.settings.zoomingRatio;\n var newRatio = camera.getBoundedRatio(currentRatio * ratioDiff);\n var wheelDirection = delta > 0 ? 1 : -1;\n var now = Date.now();\n\n // Exit early without preventing default behavior when ratio doesn't change:\n if (currentRatio === newRatio) return;\n e.preventDefault();\n e.stopPropagation();\n\n // Cancel events that are too close each other and in the same direction:\n if (this.currentWheelDirection === wheelDirection && this.lastWheelTriggerTime && now - this.lastWheelTriggerTime < this.settings.zoomDuration / 5) {\n return;\n }\n camera.animate(this.renderer.getViewportZoomedState(getPosition(e, this.container), newRatio), {\n easing: \"quadraticOut\",\n duration: this.settings.zoomDuration\n }, function () {\n _this5.currentWheelDirection = 0;\n });\n this.currentWheelDirection = wheelDirection;\n this.lastWheelTriggerTime = now;\n }\n }, {\n key: \"setSettings\",\n value: function setSettings(settings) {\n this.settings = settings;\n }\n }]);\n}(Captor);\n\nvar TOUCH_SETTINGS_KEYS = [\"dragTimeout\", \"inertiaDuration\", \"inertiaRatio\", \"doubleClickTimeout\", \"doubleClickZoomingRatio\", \"doubleClickZoomingDuration\", \"tapMoveTolerance\"];\nvar DEFAULT_TOUCH_SETTINGS = TOUCH_SETTINGS_KEYS.reduce(function (iter, key) {\n return _objectSpread2(_objectSpread2({}, iter), {}, _defineProperty({}, key, DEFAULT_SETTINGS[key]));\n}, {});\n\n/**\n * Event types.\n */\n/**\n * Touch captor class.\n *\n * @constructor\n */\nvar TouchCaptor = /*#__PURE__*/function (_Captor) {\n function TouchCaptor(container, renderer) {\n var _this;\n _classCallCheck(this, TouchCaptor);\n _this = _callSuper(this, TouchCaptor, [container, renderer]);\n\n // Binding methods:\n _defineProperty(_this, \"enabled\", true);\n _defineProperty(_this, \"isMoving\", false);\n _defineProperty(_this, \"hasMoved\", false);\n _defineProperty(_this, \"touchMode\", 0);\n _defineProperty(_this, \"startTouchesPositions\", []);\n _defineProperty(_this, \"lastTouches\", []);\n _defineProperty(_this, \"lastTap\", null);\n _defineProperty(_this, \"settings\", DEFAULT_TOUCH_SETTINGS);\n _this.handleStart = _this.handleStart.bind(_this);\n _this.handleLeave = _this.handleLeave.bind(_this);\n _this.handleMove = _this.handleMove.bind(_this);\n\n // Binding events\n container.addEventListener(\"touchstart\", _this.handleStart, {\n capture: false\n });\n container.addEventListener(\"touchcancel\", _this.handleLeave, {\n capture: false\n });\n document.addEventListener(\"touchend\", _this.handleLeave, {\n capture: false,\n passive: false\n });\n document.addEventListener(\"touchmove\", _this.handleMove, {\n capture: false,\n passive: false\n });\n return _this;\n }\n _inherits(TouchCaptor, _Captor);\n return _createClass(TouchCaptor, [{\n key: \"kill\",\n value: function kill() {\n var container = this.container;\n container.removeEventListener(\"touchstart\", this.handleStart);\n container.removeEventListener(\"touchcancel\", this.handleLeave);\n document.removeEventListener(\"touchend\", this.handleLeave);\n document.removeEventListener(\"touchmove\", this.handleMove);\n }\n }, {\n key: \"getDimensions\",\n value: function getDimensions() {\n return {\n width: this.container.offsetWidth,\n height: this.container.offsetHeight\n };\n }\n }, {\n key: \"handleStart\",\n value: function handleStart(e) {\n var _this2 = this;\n if (!this.enabled) return;\n e.preventDefault();\n var touches = getTouchesArray(e.touches);\n this.touchMode = touches.length;\n this.startCameraState = this.renderer.getCamera().getState();\n this.startTouchesPositions = touches.map(function (touch) {\n return getPosition(touch, _this2.container);\n });\n\n // When there are two touches down, let's record distance and angle as well:\n if (this.touchMode === 2) {\n var _this$startTouchesPos = _slicedToArray(this.startTouchesPositions, 2),\n _this$startTouchesPos2 = _this$startTouchesPos[0],\n x0 = _this$startTouchesPos2.x,\n y0 = _this$startTouchesPos2.y,\n _this$startTouchesPos3 = _this$startTouchesPos[1],\n x1 = _this$startTouchesPos3.x,\n y1 = _this$startTouchesPos3.y;\n this.startTouchesAngle = Math.atan2(y1 - y0, x1 - x0);\n this.startTouchesDistance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n }\n this.emit(\"touchdown\", getTouchCoords(e, this.lastTouches, this.container));\n this.lastTouches = touches;\n this.lastTouchesPositions = this.startTouchesPositions;\n }\n }, {\n key: \"handleLeave\",\n value: function handleLeave(e) {\n if (!this.enabled || !this.startTouchesPositions.length) return;\n if (e.cancelable) e.preventDefault();\n if (this.movingTimeout) {\n this.isMoving = false;\n clearTimeout(this.movingTimeout);\n }\n switch (this.touchMode) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n case 2:\n if (e.touches.length === 1) {\n this.handleStart(e);\n e.preventDefault();\n break;\n }\n /* falls through */\n case 1:\n if (this.isMoving) {\n var camera = this.renderer.getCamera();\n var cameraState = camera.getState(),\n previousCameraState = camera.getPreviousState() || {\n x: 0,\n y: 0\n };\n camera.animate({\n x: cameraState.x + this.settings.inertiaRatio * (cameraState.x - previousCameraState.x),\n y: cameraState.y + this.settings.inertiaRatio * (cameraState.y - previousCameraState.y)\n }, {\n duration: this.settings.inertiaDuration,\n easing: \"quadraticOut\"\n });\n }\n this.hasMoved = false;\n this.isMoving = false;\n this.touchMode = 0;\n break;\n }\n this.emit(\"touchup\", getTouchCoords(e, this.lastTouches, this.container));\n\n // When the last touch ends and there hasn't been too much movement, trigger a \"tap\" or \"doubletap\" event:\n if (!e.touches.length) {\n var position = getPosition(this.lastTouches[0], this.container);\n var downPosition = this.startTouchesPositions[0];\n var dSquare = Math.pow(position.x - downPosition.x, 2) + Math.pow(position.y - downPosition.y, 2);\n if (!e.touches.length && dSquare < Math.pow(this.settings.tapMoveTolerance, 2)) {\n // Only trigger \"doubletap\" when the last tap is recent enough:\n if (this.lastTap && Date.now() - this.lastTap.time < this.settings.doubleClickTimeout) {\n var touchCoords = getTouchCoords(e, this.lastTouches, this.container);\n this.emit(\"doubletap\", touchCoords);\n this.lastTap = null;\n if (!touchCoords.sigmaDefaultPrevented) {\n var _camera = this.renderer.getCamera();\n var newRatio = _camera.getBoundedRatio(_camera.getState().ratio / this.settings.doubleClickZoomingRatio);\n _camera.animate(this.renderer.getViewportZoomedState(position, newRatio), {\n easing: \"quadraticInOut\",\n duration: this.settings.doubleClickZoomingDuration\n });\n }\n }\n // Else, trigger a normal \"tap\" event:\n else {\n var _touchCoords = getTouchCoords(e, this.lastTouches, this.container);\n this.emit(\"tap\", _touchCoords);\n this.lastTap = {\n time: Date.now(),\n position: _touchCoords.touches[0] || _touchCoords.previousTouches[0]\n };\n }\n }\n }\n this.lastTouches = getTouchesArray(e.touches);\n this.startTouchesPositions = [];\n }\n }, {\n key: \"handleMove\",\n value: function handleMove(e) {\n var _this3 = this;\n if (!this.enabled || !this.startTouchesPositions.length) return;\n e.preventDefault();\n var touches = getTouchesArray(e.touches);\n var touchesPositions = touches.map(function (touch) {\n return getPosition(touch, _this3.container);\n });\n var lastTouches = this.lastTouches;\n this.lastTouches = touches;\n this.lastTouchesPositions = touchesPositions;\n var touchCoords = getTouchCoords(e, lastTouches, this.container);\n this.emit(\"touchmove\", touchCoords);\n if (touchCoords.sigmaDefaultPrevented) return;\n\n // If a move was initiated at some point, and we get back to start point,\n // we should still consider that we did move (which also happens after a\n // multiple touch when only one touch remains in which case handleStart\n // is recalled within handleLeave).\n // Now, some mobile browsers report zero-distance moves so we also check that\n // one of the touches did actually move from the origin position.\n this.hasMoved || (this.hasMoved = touchesPositions.some(function (position, idx) {\n var startPosition = _this3.startTouchesPositions[idx];\n return startPosition && (position.x !== startPosition.x || position.y !== startPosition.y);\n }));\n\n // If there was no move, do not trigger touch moves behavior\n if (!this.hasMoved) {\n return;\n }\n this.isMoving = true;\n if (this.movingTimeout) clearTimeout(this.movingTimeout);\n this.movingTimeout = window.setTimeout(function () {\n _this3.isMoving = false;\n }, this.settings.dragTimeout);\n var camera = this.renderer.getCamera();\n var startCameraState = this.startCameraState;\n var padding = this.renderer.getSetting(\"stagePadding\");\n switch (this.touchMode) {\n case 1:\n {\n var _this$renderer$viewpo = this.renderer.viewportToFramedGraph((this.startTouchesPositions || [])[0]),\n xStart = _this$renderer$viewpo.x,\n yStart = _this$renderer$viewpo.y;\n var _this$renderer$viewpo2 = this.renderer.viewportToFramedGraph(touchesPositions[0]),\n x = _this$renderer$viewpo2.x,\n y = _this$renderer$viewpo2.y;\n camera.setState({\n x: startCameraState.x + xStart - x,\n y: startCameraState.y + yStart - y\n });\n break;\n }\n case 2:\n {\n /**\n * Here is the thinking here:\n *\n * 1. We can find the new angle and ratio, by comparing the vector from \"touch one\" to \"touch two\" at the start\n * of the d'n'd and now\n *\n * 2. We can use `Camera#viewportToGraph` inside formula to retrieve the new camera position, using the graph\n * position of a touch at the beginning of the d'n'd (using `startCamera.viewportToGraph`) and the viewport\n * position of this same touch now\n */\n var newCameraState = {\n x: 0.5,\n y: 0.5,\n angle: 0,\n ratio: 1\n };\n var _touchesPositions$ = touchesPositions[0],\n x0 = _touchesPositions$.x,\n y0 = _touchesPositions$.y;\n var _touchesPositions$2 = touchesPositions[1],\n x1 = _touchesPositions$2.x,\n y1 = _touchesPositions$2.y;\n var angleDiff = Math.atan2(y1 - y0, x1 - x0) - this.startTouchesAngle;\n var ratioDiff = Math.hypot(y1 - y0, x1 - x0) / this.startTouchesDistance;\n\n // 1.\n var newRatio = camera.getBoundedRatio(startCameraState.ratio / ratioDiff);\n newCameraState.ratio = newRatio;\n newCameraState.angle = startCameraState.angle + angleDiff;\n\n // 2.\n var dimensions = this.getDimensions();\n var touchGraphPosition = this.renderer.viewportToFramedGraph((this.startTouchesPositions || [])[0], {\n cameraState: startCameraState\n });\n var smallestDimension = Math.min(dimensions.width, dimensions.height) - 2 * padding;\n var dx = smallestDimension / dimensions.width;\n var dy = smallestDimension / dimensions.height;\n var ratio = newRatio / smallestDimension;\n\n // Align with center of the graph:\n var _x = x0 - smallestDimension / 2 / dx;\n var _y = y0 - smallestDimension / 2 / dy;\n\n // Rotate:\n var _ref = [_x * Math.cos(-newCameraState.angle) - _y * Math.sin(-newCameraState.angle), _y * Math.cos(-newCameraState.angle) + _x * Math.sin(-newCameraState.angle)];\n _x = _ref[0];\n _y = _ref[1];\n newCameraState.x = touchGraphPosition.x - _x * ratio;\n newCameraState.y = touchGraphPosition.y + _y * ratio;\n camera.setState(newCameraState);\n break;\n }\n }\n }\n }, {\n key: \"setSettings\",\n value: function setSettings(settings) {\n this.settings = settings;\n }\n }]);\n}(Captor);\n\nfunction _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return _arrayLikeToArray(r);\n}\n\nfunction _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nfunction _toConsumableArray(r) {\n return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();\n}\n\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\n\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = _objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var n = Object.getOwnPropertySymbols(e);\n for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\n\n/**\n * Sigma.js Labels Heuristics\n * ===========================\n *\n * Miscellaneous heuristics related to label display.\n * @module\n */\n/**\n * Class representing a single candidate for the label grid selection.\n *\n * It also describes a deterministic way to compare two candidates to assess\n * which one is better.\n */\nvar LabelCandidate = /*#__PURE__*/function () {\n function LabelCandidate(key, size) {\n _classCallCheck(this, LabelCandidate);\n this.key = key;\n this.size = size;\n }\n return _createClass(LabelCandidate, null, [{\n key: \"compare\",\n value: function compare(first, second) {\n // First we compare by size\n if (first.size > second.size) return -1;\n if (first.size < second.size) return 1;\n\n // Then since no two nodes can have the same key, we use it to\n // deterministically tie-break by key\n if (first.key > second.key) return 1;\n\n // NOTE: this comparator cannot return 0\n return -1;\n }\n }]);\n}();\n/**\n * Class representing a 2D spatial grid divided into constant-size cells.\n */\nvar LabelGrid = /*#__PURE__*/function () {\n function LabelGrid() {\n _classCallCheck(this, LabelGrid);\n _defineProperty(this, \"width\", 0);\n _defineProperty(this, \"height\", 0);\n _defineProperty(this, \"cellSize\", 0);\n _defineProperty(this, \"columns\", 0);\n _defineProperty(this, \"rows\", 0);\n _defineProperty(this, \"cells\", {});\n }\n return _createClass(LabelGrid, [{\n key: \"resizeAndClear\",\n value: function resizeAndClear(dimensions, cellSize) {\n this.width = dimensions.width;\n this.height = dimensions.height;\n this.cellSize = cellSize;\n this.columns = Math.ceil(dimensions.width / cellSize);\n this.rows = Math.ceil(dimensions.height / cellSize);\n this.cells = {};\n }\n }, {\n key: \"getIndex\",\n value: function getIndex(pos) {\n var xIndex = Math.floor(pos.x / this.cellSize);\n var yIndex = Math.floor(pos.y / this.cellSize);\n return yIndex * this.columns + xIndex;\n }\n }, {\n key: \"add\",\n value: function add(key, size, pos) {\n var candidate = new LabelCandidate(key, size);\n var index = this.getIndex(pos);\n var cell = this.cells[index];\n if (!cell) {\n cell = [];\n this.cells[index] = cell;\n }\n cell.push(candidate);\n }\n }, {\n key: \"organize\",\n value: function organize() {\n for (var k in this.cells) {\n var cell = this.cells[k];\n cell.sort(LabelCandidate.compare);\n }\n }\n }, {\n key: \"getLabelsToDisplay\",\n value: function getLabelsToDisplay(ratio, density) {\n // TODO: work on visible nodes to optimize? ^ -> threshold outside so that memoization works?\n // TODO: adjust threshold lower, but increase cells a bit?\n // TODO: hunt for geom issue in disguise\n // TODO: memoize while ratio does not move. method to force recompute\n var cellArea = this.cellSize * this.cellSize;\n var scaledCellArea = cellArea / ratio / ratio;\n var scaledDensity = scaledCellArea * density / cellArea;\n var labelsToDisplayPerCell = Math.ceil(scaledDensity);\n var labels = [];\n for (var k in this.cells) {\n var cell = this.cells[k];\n for (var i = 0; i < Math.min(labelsToDisplayPerCell, cell.length); i++) {\n labels.push(cell[i].key);\n }\n }\n return labels;\n }\n }]);\n}();\n\n/**\n * Label heuristic selecting edge labels to display, based on displayed node\n * labels\n *\n * @param {object} params - Parameters:\n * @param {Set} displayedNodeLabels - Currently displayed node labels.\n * @param {Set} highlightedNodes - Highlighted nodes.\n * @param {Graph} graph - The rendered graph.\n * @param {string} hoveredNode - Hovered node (optional)\n * @return {Array} - The selected labels.\n */\nfunction edgeLabelsToDisplayFromNodes(params) {\n var graph = params.graph,\n hoveredNode = params.hoveredNode,\n highlightedNodes = params.highlightedNodes,\n displayedNodeLabels = params.displayedNodeLabels;\n var worthyEdges = [];\n\n // TODO: the code below can be optimized using #.forEach and batching the code per adj\n\n // We should display an edge's label if:\n // - Any of its extremities is highlighted or hovered\n // - Both of its extremities has its label shown\n graph.forEachEdge(function (edge, _, source, target) {\n if (source === hoveredNode || target === hoveredNode || highlightedNodes.has(source) || highlightedNodes.has(target) || displayedNodeLabels.has(source) && displayedNodeLabels.has(target)) {\n worthyEdges.push(edge);\n }\n });\n return worthyEdges;\n}\n\n/**\n * Constants.\n */\nvar X_LABEL_MARGIN = 150;\nvar Y_LABEL_MARGIN = 50;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * Important functions.\n */\nfunction applyNodeDefaults(settings, key, data) {\n if (!hasOwnProperty.call(data, \"x\") || !hasOwnProperty.call(data, \"y\")) throw new Error(\"Sigma: could not find a valid position (x, y) for node \\\"\".concat(key, \"\\\". All your nodes must have a number \\\"x\\\" and \\\"y\\\". Maybe your forgot to apply a layout or your \\\"nodeReducer\\\" is not returning the correct data?\"));\n if (!data.color) data.color = settings.defaultNodeColor;\n if (!data.label && data.label !== \"\") data.label = null;\n if (data.label !== undefined && data.label !== null) data.label = \"\" + data.label;else data.label = null;\n if (!data.size) data.size = 2;\n if (!hasOwnProperty.call(data, \"hidden\")) data.hidden = false;\n if (!hasOwnProperty.call(data, \"highlighted\")) data.highlighted = false;\n if (!hasOwnProperty.call(data, \"forceLabel\")) data.forceLabel = false;\n if (!data.type || data.type === \"\") data.type = settings.defaultNodeType;\n if (!data.zIndex) data.zIndex = 0;\n return data;\n}\nfunction applyEdgeDefaults(settings, _key, data) {\n if (!data.color) data.color = settings.defaultEdgeColor;\n if (!data.label) data.label = \"\";\n if (!data.size) data.size = 0.5;\n if (!hasOwnProperty.call(data, \"hidden\")) data.hidden = false;\n if (!hasOwnProperty.call(data, \"forceLabel\")) data.forceLabel = false;\n if (!data.type || data.type === \"\") data.type = settings.defaultEdgeType;\n if (!data.zIndex) data.zIndex = 0;\n return data;\n}\n\n/**\n * Main class.\n *\n * @constructor\n * @param {Graph} graph - Graph to render.\n * @param {HTMLElement} container - DOM container in which to render.\n * @param {object} settings - Optional settings.\n */\nvar Sigma$1 = /*#__PURE__*/function (_TypedEventEmitter) {\n function Sigma(graph, container) {\n var _this;\n var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n _classCallCheck(this, Sigma);\n _this = _callSuper(this, Sigma);\n\n // Resolving settings\n _defineProperty(_this, \"elements\", {});\n _defineProperty(_this, \"canvasContexts\", {});\n _defineProperty(_this, \"webGLContexts\", {});\n _defineProperty(_this, \"pickingLayers\", new Set());\n _defineProperty(_this, \"textures\", {});\n _defineProperty(_this, \"frameBuffers\", {});\n _defineProperty(_this, \"activeListeners\", {});\n _defineProperty(_this, \"labelGrid\", new LabelGrid());\n _defineProperty(_this, \"nodeDataCache\", {});\n _defineProperty(_this, \"edgeDataCache\", {});\n // Indices to keep track of the index of the item inside programs\n _defineProperty(_this, \"nodeProgramIndex\", {});\n _defineProperty(_this, \"edgeProgramIndex\", {});\n _defineProperty(_this, \"nodesWithForcedLabels\", new Set());\n _defineProperty(_this, \"edgesWithForcedLabels\", new Set());\n _defineProperty(_this, \"nodeExtent\", {\n x: [0, 1],\n y: [0, 1]\n });\n _defineProperty(_this, \"nodeZExtent\", [Infinity, -Infinity]);\n _defineProperty(_this, \"edgeZExtent\", [Infinity, -Infinity]);\n _defineProperty(_this, \"matrix\", identity());\n _defineProperty(_this, \"invMatrix\", identity());\n _defineProperty(_this, \"correctionRatio\", 1);\n _defineProperty(_this, \"customBBox\", null);\n _defineProperty(_this, \"normalizationFunction\", createNormalizationFunction({\n x: [0, 1],\n y: [0, 1]\n }));\n // Cache:\n _defineProperty(_this, \"graphToViewportRatio\", 1);\n _defineProperty(_this, \"itemIDsIndex\", {});\n _defineProperty(_this, \"nodeIndices\", {});\n _defineProperty(_this, \"edgeIndices\", {});\n // Starting dimensions and pixel ratio\n _defineProperty(_this, \"width\", 0);\n _defineProperty(_this, \"height\", 0);\n _defineProperty(_this, \"pixelRatio\", getPixelRatio());\n _defineProperty(_this, \"pickingDownSizingRatio\", 2 * _this.pixelRatio);\n // Graph State\n _defineProperty(_this, \"displayedNodeLabels\", new Set());\n _defineProperty(_this, \"displayedEdgeLabels\", new Set());\n _defineProperty(_this, \"highlightedNodes\", new Set());\n _defineProperty(_this, \"hoveredNode\", null);\n _defineProperty(_this, \"hoveredEdge\", null);\n // Internal states\n _defineProperty(_this, \"renderFrame\", null);\n _defineProperty(_this, \"renderHighlightedNodesFrame\", null);\n _defineProperty(_this, \"needToProcess\", false);\n _defineProperty(_this, \"checkEdgesEventsFrame\", null);\n // Programs\n _defineProperty(_this, \"nodePrograms\", {});\n _defineProperty(_this, \"nodeHoverPrograms\", {});\n _defineProperty(_this, \"edgePrograms\", {});\n _this.settings = resolveSettings(settings);\n\n // Validating\n validateSettings(_this.settings);\n validateGraph(graph);\n if (!(container instanceof HTMLElement)) throw new Error(\"Sigma: container should be an html element.\");\n\n // Properties\n _this.graph = graph;\n _this.container = container;\n\n // Initializing contexts\n _this.createWebGLContext(\"edges\", {\n picking: settings.enableEdgeEvents\n });\n _this.createCanvasContext(\"edgeLabels\");\n _this.createWebGLContext(\"nodes\", {\n picking: true\n });\n _this.createCanvasContext(\"labels\");\n _this.createCanvasContext(\"hovers\");\n _this.createWebGLContext(\"hoverNodes\");\n _this.createCanvasContext(\"mouse\", {\n style: {\n touchAction: \"none\",\n userSelect: \"none\"\n }\n });\n\n // Initial resize\n _this.resize();\n\n // Loading programs\n for (var type in _this.settings.nodeProgramClasses) {\n _this.registerNodeProgram(type, _this.settings.nodeProgramClasses[type], _this.settings.nodeHoverProgramClasses[type]);\n }\n for (var _type in _this.settings.edgeProgramClasses) {\n _this.registerEdgeProgram(_type, _this.settings.edgeProgramClasses[_type]);\n }\n\n // Initializing the camera\n _this.camera = new Camera();\n\n // Binding camera events\n _this.bindCameraHandlers();\n\n // Initializing captors\n _this.mouseCaptor = new MouseCaptor(_this.elements.mouse, _this);\n _this.mouseCaptor.setSettings(_this.settings);\n _this.touchCaptor = new TouchCaptor(_this.elements.mouse, _this);\n _this.touchCaptor.setSettings(_this.settings);\n\n // Binding event handlers\n _this.bindEventHandlers();\n\n // Binding graph handlers\n _this.bindGraphHandlers();\n\n // Trigger eventual settings-related things\n _this.handleSettingsUpdate();\n\n // Processing data for the first time & render\n _this.refresh();\n return _this;\n }\n\n /**---------------------------------------------------------------------------\n * Internal methods.\n **---------------------------------------------------------------------------\n */\n\n /**\n * Internal function used to register a node program\n *\n * @param {string} key - The program's key, matching the related nodes \"type\" values.\n * @param {NodeProgramType} NodeProgramClass - A nodes program class.\n * @param {NodeProgramType?} NodeHoverProgram - A nodes program class to render hovered nodes (optional).\n * @return {Sigma}\n */\n _inherits(Sigma, _TypedEventEmitter);\n return _createClass(Sigma, [{\n key: \"registerNodeProgram\",\n value: function registerNodeProgram(key, NodeProgramClass, NodeHoverProgram) {\n if (this.nodePrograms[key]) this.nodePrograms[key].kill();\n if (this.nodeHoverPrograms[key]) this.nodeHoverPrograms[key].kill();\n this.nodePrograms[key] = new NodeProgramClass(this.webGLContexts.nodes, this.frameBuffers.nodes, this);\n this.nodeHoverPrograms[key] = new (NodeHoverProgram || NodeProgramClass)(this.webGLContexts.hoverNodes, null, this);\n return this;\n }\n\n /**\n * Internal function used to register an edge program\n *\n * @param {string} key - The program's key, matching the related edges \"type\" values.\n * @param {EdgeProgramType} EdgeProgramClass - An edges program class.\n * @return {Sigma}\n */\n }, {\n key: \"registerEdgeProgram\",\n value: function registerEdgeProgram(key, EdgeProgramClass) {\n if (this.edgePrograms[key]) this.edgePrograms[key].kill();\n this.edgePrograms[key] = new EdgeProgramClass(this.webGLContexts.edges, this.frameBuffers.edges, this);\n return this;\n }\n\n /**\n * Internal function used to unregister a node program\n *\n * @param {string} key - The program's key, matching the related nodes \"type\" values.\n * @return {Sigma}\n */\n }, {\n key: \"unregisterNodeProgram\",\n value: function unregisterNodeProgram(key) {\n if (this.nodePrograms[key]) {\n var _this$nodePrograms = this.nodePrograms,\n program = _this$nodePrograms[key],\n programs = _objectWithoutProperties(_this$nodePrograms, [key].map(_toPropertyKey));\n program.kill();\n this.nodePrograms = programs;\n }\n if (this.nodeHoverPrograms[key]) {\n var _this$nodeHoverProgra = this.nodeHoverPrograms,\n _program = _this$nodeHoverProgra[key],\n _programs = _objectWithoutProperties(_this$nodeHoverProgra, [key].map(_toPropertyKey));\n _program.kill();\n this.nodePrograms = _programs;\n }\n return this;\n }\n\n /**\n * Internal function used to unregister an edge program\n *\n * @param {string} key - The program's key, matching the related edges \"type\" values.\n * @return {Sigma}\n */\n }, {\n key: \"unregisterEdgeProgram\",\n value: function unregisterEdgeProgram(key) {\n if (this.edgePrograms[key]) {\n var _this$edgePrograms = this.edgePrograms,\n program = _this$edgePrograms[key],\n programs = _objectWithoutProperties(_this$edgePrograms, [key].map(_toPropertyKey));\n program.kill();\n this.edgePrograms = programs;\n }\n return this;\n }\n\n /**\n * Method (re)binding WebGL texture (for picking).\n *\n * @return {Sigma}\n */\n }, {\n key: \"resetWebGLTexture\",\n value: function resetWebGLTexture(id) {\n var gl = this.webGLContexts[id];\n var frameBuffer = this.frameBuffers[id];\n var currentTexture = this.textures[id];\n if (currentTexture) gl.deleteTexture(currentTexture);\n var pickingTexture = gl.createTexture();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.bindTexture(gl.TEXTURE_2D, pickingTexture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, pickingTexture, 0);\n this.textures[id] = pickingTexture;\n return this;\n }\n\n /**\n * Method binding camera handlers.\n *\n * @return {Sigma}\n */\n }, {\n key: \"bindCameraHandlers\",\n value: function bindCameraHandlers() {\n var _this2 = this;\n this.activeListeners.camera = function () {\n _this2.scheduleRender();\n };\n this.camera.on(\"updated\", this.activeListeners.camera);\n return this;\n }\n\n /**\n * Method unbinding camera handlers.\n *\n * @return {Sigma}\n */\n }, {\n key: \"unbindCameraHandlers\",\n value: function unbindCameraHandlers() {\n this.camera.removeListener(\"updated\", this.activeListeners.camera);\n return this;\n }\n\n /**\n * Method that returns the closest node to a given position.\n */\n }, {\n key: \"getNodeAtPosition\",\n value: function getNodeAtPosition(position) {\n var x = position.x,\n y = position.y;\n var color = getPixelColor(this.webGLContexts.nodes, this.frameBuffers.nodes, x, y, this.pixelRatio, this.pickingDownSizingRatio);\n var index = colorToIndex.apply(void 0, _toConsumableArray(color));\n var itemAt = this.itemIDsIndex[index];\n return itemAt && itemAt.type === \"node\" ? itemAt.id : null;\n }\n\n /**\n * Method binding event handlers.\n *\n * @return {Sigma}\n */\n }, {\n key: \"bindEventHandlers\",\n value: function bindEventHandlers() {\n var _this3 = this;\n // Handling window resize\n this.activeListeners.handleResize = function () {\n // need to call a refresh to rebuild the labelgrid\n _this3.scheduleRefresh();\n };\n window.addEventListener(\"resize\", this.activeListeners.handleResize);\n\n // Handling mouse move\n this.activeListeners.handleMove = function (e) {\n var event = cleanMouseCoords(e);\n var baseEvent = {\n event: event,\n preventSigmaDefault: function preventSigmaDefault() {\n event.preventSigmaDefault();\n }\n };\n var nodeToHover = _this3.getNodeAtPosition(event);\n if (nodeToHover && _this3.hoveredNode !== nodeToHover && !_this3.nodeDataCache[nodeToHover].hidden) {\n // Handling passing from one node to the other directly\n if (_this3.hoveredNode) _this3.emit(\"leaveNode\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n node: _this3.hoveredNode\n }));\n _this3.hoveredNode = nodeToHover;\n _this3.emit(\"enterNode\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n node: nodeToHover\n }));\n _this3.scheduleHighlightedNodesRender();\n return;\n }\n\n // Checking if the hovered node is still hovered\n if (_this3.hoveredNode) {\n if (_this3.getNodeAtPosition(event) !== _this3.hoveredNode) {\n var node = _this3.hoveredNode;\n _this3.hoveredNode = null;\n _this3.emit(\"leaveNode\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n node: node\n }));\n _this3.scheduleHighlightedNodesRender();\n return;\n }\n }\n if (_this3.settings.enableEdgeEvents) {\n var edgeToHover = _this3.hoveredNode ? null : _this3.getEdgeAtPoint(baseEvent.event.x, baseEvent.event.y);\n if (edgeToHover !== _this3.hoveredEdge) {\n if (_this3.hoveredEdge) _this3.emit(\"leaveEdge\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n edge: _this3.hoveredEdge\n }));\n if (edgeToHover) _this3.emit(\"enterEdge\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n edge: edgeToHover\n }));\n _this3.hoveredEdge = edgeToHover;\n }\n }\n };\n\n // Handling mouse move over body (only to dispatch the proper event):\n this.activeListeners.handleMoveBody = function (e) {\n var event = cleanMouseCoords(e);\n _this3.emit(\"moveBody\", {\n event: event,\n preventSigmaDefault: function preventSigmaDefault() {\n event.preventSigmaDefault();\n }\n });\n };\n\n // Handling mouse leave stage:\n this.activeListeners.handleLeave = function (e) {\n var event = cleanMouseCoords(e);\n var baseEvent = {\n event: event,\n preventSigmaDefault: function preventSigmaDefault() {\n event.preventSigmaDefault();\n }\n };\n if (_this3.hoveredNode) {\n _this3.emit(\"leaveNode\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n node: _this3.hoveredNode\n }));\n _this3.scheduleHighlightedNodesRender();\n }\n if (_this3.settings.enableEdgeEvents && _this3.hoveredEdge) {\n _this3.emit(\"leaveEdge\", _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n edge: _this3.hoveredEdge\n }));\n _this3.scheduleHighlightedNodesRender();\n }\n _this3.emit(\"leaveStage\", _objectSpread2({}, baseEvent));\n };\n\n // Handling mouse enter stage:\n this.activeListeners.handleEnter = function (e) {\n var event = cleanMouseCoords(e);\n var baseEvent = {\n event: event,\n preventSigmaDefault: function preventSigmaDefault() {\n event.preventSigmaDefault();\n }\n };\n _this3.emit(\"enterStage\", _objectSpread2({}, baseEvent));\n };\n\n // Handling click\n var createInteractionListener = function createInteractionListener(eventType) {\n return function (e) {\n var event = cleanMouseCoords(e);\n var baseEvent = {\n event: event,\n preventSigmaDefault: function preventSigmaDefault() {\n event.preventSigmaDefault();\n }\n };\n var nodeAtPosition = _this3.getNodeAtPosition(event);\n if (nodeAtPosition) return _this3.emit(\"\".concat(eventType, \"Node\"), _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n node: nodeAtPosition\n }));\n if (_this3.settings.enableEdgeEvents) {\n var edge = _this3.getEdgeAtPoint(event.x, event.y);\n if (edge) return _this3.emit(\"\".concat(eventType, \"Edge\"), _objectSpread2(_objectSpread2({}, baseEvent), {}, {\n edge: edge\n }));\n }\n return _this3.emit(\"\".concat(eventType, \"Stage\"), baseEvent);\n };\n };\n this.activeListeners.handleClick = createInteractionListener(\"click\");\n this.activeListeners.handleRightClick = createInteractionListener(\"rightClick\");\n this.activeListeners.handleDoubleClick = createInteractionListener(\"doubleClick\");\n this.activeListeners.handleWheel = createInteractionListener(\"wheel\");\n this.activeListeners.handleDown = createInteractionListener(\"down\");\n this.activeListeners.handleUp = createInteractionListener(\"up\");\n this.mouseCaptor.on(\"mousemove\", this.activeListeners.handleMove);\n this.mouseCaptor.on(\"mousemovebody\", this.activeListeners.handleMoveBody);\n this.mouseCaptor.on(\"click\", this.activeListeners.handleClick);\n this.mouseCaptor.on(\"rightClick\", this.activeListeners.handleRightClick);\n this.mouseCaptor.on(\"doubleClick\", this.activeListeners.handleDoubleClick);\n this.mouseCaptor.on(\"wheel\", this.activeListeners.handleWheel);\n this.mouseCaptor.on(\"mousedown\", this.activeListeners.handleDown);\n this.mouseCaptor.on(\"mouseup\", this.activeListeners.handleUp);\n this.mouseCaptor.on(\"mouseleave\", this.activeListeners.handleLeave);\n this.mouseCaptor.on(\"mouseenter\", this.activeListeners.handleEnter);\n this.touchCaptor.on(\"touchdown\", this.activeListeners.handleDown);\n this.touchCaptor.on(\"touchdown\", this.activeListeners.handleMove);\n this.touchCaptor.on(\"touchup\", this.activeListeners.handleUp);\n this.touchCaptor.on(\"touchmove\", this.activeListeners.handleMove);\n this.touchCaptor.on(\"tap\", this.activeListeners.handleClick);\n this.touchCaptor.on(\"doubletap\", this.activeListeners.handleDoubleClick);\n this.touchCaptor.on(\"touchmove\", this.activeListeners.handleMoveBody);\n return this;\n }\n\n /**\n * Method binding graph handlers\n *\n * @return {Sigma}\n */\n }, {\n key: \"bindGraphHandlers\",\n value: function bindGraphHandlers() {\n var _this4 = this;\n var graph = this.graph;\n var LAYOUT_IMPACTING_FIELDS = new Set([\"x\", \"y\", \"zIndex\", \"type\"]);\n this.activeListeners.eachNodeAttributesUpdatedGraphUpdate = function (e) {\n var _e$hints;\n var updatedFields = (_e$hints = e.hints) === null || _e$hints === void 0 ? void 0 : _e$hints.attributes;\n // we process all nodes\n _this4.graph.forEachNode(function (node) {\n return _this4.updateNode(node);\n });\n\n // if coord, type or zIndex have changed, we need to schedule a render\n // (zIndex for the programIndex)\n var layoutChanged = !updatedFields || updatedFields.some(function (f) {\n return LAYOUT_IMPACTING_FIELDS.has(f);\n });\n _this4.refresh({\n partialGraph: {\n nodes: graph.nodes()\n },\n skipIndexation: !layoutChanged,\n schedule: true\n });\n };\n this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate = function (e) {\n var _e$hints2;\n var updatedFields = (_e$hints2 = e.hints) === null || _e$hints2 === void 0 ? void 0 : _e$hints2.attributes;\n // we process all edges\n _this4.graph.forEachEdge(function (edge) {\n return _this4.updateEdge(edge);\n });\n var layoutChanged = updatedFields && [\"zIndex\", \"type\"].some(function (f) {\n return updatedFields === null || updatedFields === void 0 ? void 0 : updatedFields.includes(f);\n });\n _this4.refresh({\n partialGraph: {\n edges: graph.edges()\n },\n skipIndexation: !layoutChanged,\n schedule: true\n });\n };\n\n // On add node, we add the node in indices and then call for a render\n this.activeListeners.addNodeGraphUpdate = function (payload) {\n var node = payload.key;\n // we process the node\n _this4.addNode(node);\n // schedule a render for the node\n _this4.refresh({\n partialGraph: {\n nodes: [node]\n },\n skipIndexation: false,\n schedule: true\n });\n };\n\n // On update node, we update indices and then call for a render\n this.activeListeners.updateNodeGraphUpdate = function (payload) {\n var node = payload.key;\n // schedule a render for the node\n _this4.refresh({\n partialGraph: {\n nodes: [node]\n },\n skipIndexation: false,\n schedule: true\n });\n };\n\n // On drop node, we remove the node from indices and then call for a refresh\n this.activeListeners.dropNodeGraphUpdate = function (payload) {\n var node = payload.key;\n // we process the node\n _this4.removeNode(node);\n // schedule a render for everything\n _this4.refresh({\n schedule: true\n });\n };\n\n // On add edge, we remove the edge from indices and then call for a refresh\n this.activeListeners.addEdgeGraphUpdate = function (payload) {\n var edge = payload.key;\n // we process the edge\n _this4.addEdge(edge);\n // schedule a render for the edge\n _this4.refresh({\n partialGraph: {\n edges: [edge]\n },\n schedule: true\n });\n };\n\n // On update edge, we update indices and then call for a refresh\n this.activeListeners.updateEdgeGraphUpdate = function (payload) {\n var edge = payload.key;\n // schedule a repaint for the edge\n _this4.refresh({\n partialGraph: {\n edges: [edge]\n },\n skipIndexation: false,\n schedule: true\n });\n };\n\n // On drop edge, we remove the edge from indices and then call for a refresh\n this.activeListeners.dropEdgeGraphUpdate = function (payload) {\n var edge = payload.key;\n // we process the edge\n _this4.removeEdge(edge);\n // schedule a render for all edges\n _this4.refresh({\n schedule: true\n });\n };\n\n // On clear edges, we clear the edge indices and then call for a refresh\n this.activeListeners.clearEdgesGraphUpdate = function () {\n // we clear the edge data structures\n _this4.clearEdgeState();\n _this4.clearEdgeIndices();\n // schedule a render for all edges\n _this4.refresh({\n schedule: true\n });\n };\n\n // On graph clear, we clear indices and then call for a refresh\n this.activeListeners.clearGraphUpdate = function () {\n // clear graph state\n _this4.clearEdgeState();\n _this4.clearNodeState();\n\n // clear graph indices\n _this4.clearEdgeIndices();\n _this4.clearNodeIndices();\n\n // schedule a render for all\n _this4.refresh({\n schedule: true\n });\n };\n graph.on(\"nodeAdded\", this.activeListeners.addNodeGraphUpdate);\n graph.on(\"nodeDropped\", this.activeListeners.dropNodeGraphUpdate);\n graph.on(\"nodeAttributesUpdated\", this.activeListeners.updateNodeGraphUpdate);\n graph.on(\"eachNodeAttributesUpdated\", this.activeListeners.eachNodeAttributesUpdatedGraphUpdate);\n graph.on(\"edgeAdded\", this.activeListeners.addEdgeGraphUpdate);\n graph.on(\"edgeDropped\", this.activeListeners.dropEdgeGraphUpdate);\n graph.on(\"edgeAttributesUpdated\", this.activeListeners.updateEdgeGraphUpdate);\n graph.on(\"eachEdgeAttributesUpdated\", this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate);\n graph.on(\"edgesCleared\", this.activeListeners.clearEdgesGraphUpdate);\n graph.on(\"cleared\", this.activeListeners.clearGraphUpdate);\n return this;\n }\n\n /**\n * Method used to unbind handlers from the graph.\n *\n * @return {undefined}\n */\n }, {\n key: \"unbindGraphHandlers\",\n value: function unbindGraphHandlers() {\n var graph = this.graph;\n graph.removeListener(\"nodeAdded\", this.activeListeners.addNodeGraphUpdate);\n graph.removeListener(\"nodeDropped\", this.activeListeners.dropNodeGraphUpdate);\n graph.removeListener(\"nodeAttributesUpdated\", this.activeListeners.updateNodeGraphUpdate);\n graph.removeListener(\"eachNodeAttributesUpdated\", this.activeListeners.eachNodeAttributesUpdatedGraphUpdate);\n graph.removeListener(\"edgeAdded\", this.activeListeners.addEdgeGraphUpdate);\n graph.removeListener(\"edgeDropped\", this.activeListeners.dropEdgeGraphUpdate);\n graph.removeListener(\"edgeAttributesUpdated\", this.activeListeners.updateEdgeGraphUpdate);\n graph.removeListener(\"eachEdgeAttributesUpdated\", this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate);\n graph.removeListener(\"edgesCleared\", this.activeListeners.clearEdgesGraphUpdate);\n graph.removeListener(\"cleared\", this.activeListeners.clearGraphUpdate);\n }\n\n /**\n * Method looking for an edge colliding with a given point at (x, y). Returns\n * the key of the edge if any, or null else.\n */\n }, {\n key: \"getEdgeAtPoint\",\n value: function getEdgeAtPoint(x, y) {\n var color = getPixelColor(this.webGLContexts.edges, this.frameBuffers.edges, x, y, this.pixelRatio, this.pickingDownSizingRatio);\n var index = colorToIndex.apply(void 0, _toConsumableArray(color));\n var itemAt = this.itemIDsIndex[index];\n return itemAt && itemAt.type === \"edge\" ? itemAt.id : null;\n }\n\n /**\n * Method used to process the whole graph's data.\n * - extent\n * - normalizationFunction\n * - compute node's coordinate\n * - labelgrid\n * - program data allocation\n * @return {Sigma}\n */\n }, {\n key: \"process\",\n value: function process() {\n var _this5 = this;\n this.emit(\"beforeProcess\");\n var graph = this.graph;\n var settings = this.settings;\n var dimensions = this.getDimensions();\n\n //\n // NODES\n //\n this.nodeExtent = graphExtent(this.graph);\n if (!this.settings.autoRescale) {\n var width = dimensions.width,\n height = dimensions.height;\n var _this$nodeExtent = this.nodeExtent,\n x = _this$nodeExtent.x,\n y = _this$nodeExtent.y;\n this.nodeExtent = {\n x: [(x[0] + x[1]) / 2 - width / 2, (x[0] + x[1]) / 2 + width / 2],\n y: [(y[0] + y[1]) / 2 - height / 2, (y[0] + y[1]) / 2 + height / 2]\n };\n }\n this.normalizationFunction = createNormalizationFunction(this.customBBox || this.nodeExtent);\n\n // NOTE: it is important to compute this matrix after computing the node's extent\n // because #.getGraphDimensions relies on it\n var nullCamera = new Camera();\n var nullCameraMatrix = matrixFromCamera(nullCamera.getState(), dimensions, this.getGraphDimensions(), this.getStagePadding());\n // Resetting the label grid\n // TODO: it's probably better to do this explicitly or on resizes for layout and anims\n this.labelGrid.resizeAndClear(dimensions, settings.labelGridCellSize);\n var nodesPerPrograms = {};\n var nodeIndices = {};\n var edgeIndices = {};\n var itemIDsIndex = {};\n var incrID = 1;\n var nodes = graph.nodes();\n\n // Do some indexation on the whole graph\n for (var i = 0, l = nodes.length; i < l; i++) {\n var node = nodes[i];\n var data = this.nodeDataCache[node];\n\n // Get initial coordinates\n var attrs = graph.getNodeAttributes(node);\n data.x = attrs.x;\n data.y = attrs.y;\n this.normalizationFunction.applyTo(data);\n\n // labelgrid\n if (typeof data.label === \"string\" && !data.hidden) this.labelGrid.add(node, data.size, this.framedGraphToViewport(data, {\n matrix: nullCameraMatrix\n }));\n\n // update count per program\n nodesPerPrograms[data.type] = (nodesPerPrograms[data.type] || 0) + 1;\n }\n this.labelGrid.organize();\n\n // Allocate memory to programs\n for (var type in this.nodePrograms) {\n if (!hasOwnProperty.call(this.nodePrograms, type)) {\n throw new Error(\"Sigma: could not find a suitable program for node type \\\"\".concat(type, \"\\\"!\"));\n }\n this.nodePrograms[type].reallocate(nodesPerPrograms[type] || 0);\n // We reset that count here, so that we can reuse it while calling the Program#process methods:\n nodesPerPrograms[type] = 0;\n }\n\n // Order nodes by zIndex before to add them to program\n if (this.settings.zIndex && this.nodeZExtent[0] !== this.nodeZExtent[1]) nodes = zIndexOrdering(this.nodeZExtent, function (node) {\n return _this5.nodeDataCache[node].zIndex;\n }, nodes);\n\n // Add data to programs\n for (var _i = 0, _l = nodes.length; _i < _l; _i++) {\n var _node = nodes[_i];\n nodeIndices[_node] = incrID;\n itemIDsIndex[nodeIndices[_node]] = {\n type: \"node\",\n id: _node\n };\n incrID++;\n var _data = this.nodeDataCache[_node];\n this.addNodeToProgram(_node, nodeIndices[_node], nodesPerPrograms[_data.type]++);\n }\n\n //\n // EDGES\n //\n\n var edgesPerPrograms = {};\n var edges = graph.edges();\n\n // Allocate memory to programs\n for (var _i2 = 0, _l2 = edges.length; _i2 < _l2; _i2++) {\n var edge = edges[_i2];\n var _data2 = this.edgeDataCache[edge];\n edgesPerPrograms[_data2.type] = (edgesPerPrograms[_data2.type] || 0) + 1;\n }\n\n // Order edges by zIndex before to add them to program\n if (this.settings.zIndex && this.edgeZExtent[0] !== this.edgeZExtent[1]) edges = zIndexOrdering(this.edgeZExtent, function (edge) {\n return _this5.edgeDataCache[edge].zIndex;\n }, edges);\n for (var _type2 in this.edgePrograms) {\n if (!hasOwnProperty.call(this.edgePrograms, _type2)) {\n throw new Error(\"Sigma: could not find a suitable program for edge type \\\"\".concat(_type2, \"\\\"!\"));\n }\n this.edgePrograms[_type2].reallocate(edgesPerPrograms[_type2] || 0);\n // We reset that count here, so that we can reuse it while calling the Program#process methods:\n edgesPerPrograms[_type2] = 0;\n }\n\n // Add data to programs\n for (var _i3 = 0, _l3 = edges.length; _i3 < _l3; _i3++) {\n var _edge = edges[_i3];\n edgeIndices[_edge] = incrID;\n itemIDsIndex[edgeIndices[_edge]] = {\n type: \"edge\",\n id: _edge\n };\n incrID++;\n var _data3 = this.edgeDataCache[_edge];\n this.addEdgeToProgram(_edge, edgeIndices[_edge], edgesPerPrograms[_data3.type]++);\n }\n this.itemIDsIndex = itemIDsIndex;\n this.nodeIndices = nodeIndices;\n this.edgeIndices = edgeIndices;\n this.emit(\"afterProcess\");\n return this;\n }\n\n /**\n * Method that backports potential settings updates where it's needed.\n * @private\n */\n }, {\n key: \"handleSettingsUpdate\",\n value: function handleSettingsUpdate(oldSettings) {\n var _this6 = this;\n var settings = this.settings;\n this.camera.minRatio = settings.minCameraRatio;\n this.camera.maxRatio = settings.maxCameraRatio;\n this.camera.enabledZooming = settings.enableCameraZooming;\n this.camera.enabledPanning = settings.enableCameraPanning;\n this.camera.enabledRotation = settings.enableCameraRotation;\n if (settings.cameraPanBoundaries) {\n this.camera.clean = function (state) {\n return _this6.cleanCameraState(state, settings.cameraPanBoundaries && _typeof(settings.cameraPanBoundaries) === \"object\" ? settings.cameraPanBoundaries : {});\n };\n } else {\n this.camera.clean = null;\n }\n this.camera.setState(this.camera.validateState(this.camera.getState()));\n if (oldSettings) {\n // Check edge programs:\n if (oldSettings.edgeProgramClasses !== settings.edgeProgramClasses) {\n for (var type in settings.edgeProgramClasses) {\n if (settings.edgeProgramClasses[type] !== oldSettings.edgeProgramClasses[type]) {\n this.registerEdgeProgram(type, settings.edgeProgramClasses[type]);\n }\n }\n for (var _type3 in oldSettings.edgeProgramClasses) {\n if (!settings.edgeProgramClasses[_type3]) this.unregisterEdgeProgram(_type3);\n }\n }\n\n // Check node programs:\n if (oldSettings.nodeProgramClasses !== settings.nodeProgramClasses || oldSettings.nodeHoverProgramClasses !== settings.nodeHoverProgramClasses) {\n for (var _type4 in settings.nodeProgramClasses) {\n if (settings.nodeProgramClasses[_type4] !== oldSettings.nodeProgramClasses[_type4] || settings.nodeHoverProgramClasses[_type4] !== oldSettings.nodeHoverProgramClasses[_type4]) {\n this.registerNodeProgram(_type4, settings.nodeProgramClasses[_type4], settings.nodeHoverProgramClasses[_type4]);\n }\n }\n for (var _type5 in oldSettings.nodeProgramClasses) {\n if (!settings.nodeProgramClasses[_type5]) this.unregisterNodeProgram(_type5);\n }\n }\n }\n\n // Update captors settings:\n this.mouseCaptor.setSettings(this.settings);\n this.touchCaptor.setSettings(this.settings);\n return this;\n }\n }, {\n key: \"cleanCameraState\",\n value: function cleanCameraState(state) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$tolerance = _ref.tolerance,\n tolerance = _ref$tolerance === void 0 ? 0 : _ref$tolerance,\n boundaries = _ref.boundaries;\n var newState = _objectSpread2({}, state);\n\n // Extract necessary properties\n var _ref2 = boundaries || this.nodeExtent,\n _ref2$x = _slicedToArray(_ref2.x, 2),\n xMinGraph = _ref2$x[0],\n xMaxGraph = _ref2$x[1],\n _ref2$y = _slicedToArray(_ref2.y, 2),\n yMinGraph = _ref2$y[0],\n yMaxGraph = _ref2$y[1];\n\n // Transform the four corners of the graph rectangle using the provided camera state\n var corners = [this.graphToViewport({\n x: xMinGraph,\n y: yMinGraph\n }, {\n cameraState: state\n }), this.graphToViewport({\n x: xMaxGraph,\n y: yMinGraph\n }, {\n cameraState: state\n }), this.graphToViewport({\n x: xMinGraph,\n y: yMaxGraph\n }, {\n cameraState: state\n }), this.graphToViewport({\n x: xMaxGraph,\n y: yMaxGraph\n }, {\n cameraState: state\n })];\n\n // Look for new extents, based on these four corners\n var xMin = Infinity,\n xMax = -Infinity,\n yMin = Infinity,\n yMax = -Infinity;\n corners.forEach(function (_ref3) {\n var x = _ref3.x,\n y = _ref3.y;\n xMin = Math.min(xMin, x);\n xMax = Math.max(xMax, x);\n yMin = Math.min(yMin, y);\n yMax = Math.max(yMax, y);\n });\n\n // For each dimension, constraint the smaller element (camera or graph) to fit in the larger one:\n var graphWidth = xMax - xMin;\n var graphHeight = yMax - yMin;\n var _this$getDimensions = this.getDimensions(),\n width = _this$getDimensions.width,\n height = _this$getDimensions.height;\n var dx = 0;\n var dy = 0;\n if (graphWidth >= width) {\n if (xMax < width - tolerance) dx = xMax - (width - tolerance);else if (xMin > tolerance) dx = xMin - tolerance;\n } else {\n if (xMax > width + tolerance) dx = xMax - (width + tolerance);else if (xMin < -tolerance) dx = xMin + tolerance;\n }\n if (graphHeight >= height) {\n if (yMax < height - tolerance) dy = yMax - (height - tolerance);else if (yMin > tolerance) dy = yMin - tolerance;\n } else {\n if (yMax > height + tolerance) dy = yMax - (height + tolerance);else if (yMin < -tolerance) dy = yMin + tolerance;\n }\n if (dx || dy) {\n // Transform [dx, dy] from viewport to graph (using two different point to transform that vector):\n var origin = this.viewportToFramedGraph({\n x: 0,\n y: 0\n }, {\n cameraState: state\n });\n var delta = this.viewportToFramedGraph({\n x: dx,\n y: dy\n }, {\n cameraState: state\n });\n dx = delta.x - origin.x;\n dy = delta.y - origin.y;\n newState.x += dx;\n newState.y += dy;\n }\n return newState;\n }\n\n /**\n * Method used to render labels.\n *\n * @return {Sigma}\n */\n }, {\n key: \"renderLabels\",\n value: function renderLabels() {\n if (!this.settings.renderLabels) return this;\n var cameraState = this.camera.getState();\n\n // Selecting labels to draw\n var labelsToDisplay = this.labelGrid.getLabelsToDisplay(cameraState.ratio, this.settings.labelDensity);\n extend(labelsToDisplay, this.nodesWithForcedLabels);\n this.displayedNodeLabels = new Set();\n\n // Drawing labels\n var context = this.canvasContexts.labels;\n for (var i = 0, l = labelsToDisplay.length; i < l; i++) {\n var node = labelsToDisplay[i];\n var data = this.nodeDataCache[node];\n\n // If the node was already drawn (like if it is eligible AND has\n // `forceLabel`), we don't want to draw it again\n // NOTE: we can do better probably\n if (this.displayedNodeLabels.has(node)) continue;\n\n // If the node is hidden, we don't need to display its label obviously\n if (data.hidden) continue;\n var _this$framedGraphToVi = this.framedGraphToViewport(data),\n x = _this$framedGraphToVi.x,\n y = _this$framedGraphToVi.y;\n\n // NOTE: we can cache the labels we need to render until the camera's ratio changes\n var size = this.scaleSize(data.size);\n\n // Is node big enough?\n if (!data.forceLabel && size < this.settings.labelRenderedSizeThreshold) continue;\n\n // Is node actually on screen (with some margin)\n // NOTE: we used to rely on the quadtree for this, but the coordinates\n // conversion make it unreliable and at that point we already converted\n // to viewport coordinates and since the label grid already culls the\n // number of potential labels to display this looks like a good\n // performance compromise.\n // NOTE: labelGrid.getLabelsToDisplay could probably optimize by not\n // considering cells obviously outside of the range of the current\n // view rectangle.\n if (x < -X_LABEL_MARGIN || x > this.width + X_LABEL_MARGIN || y < -Y_LABEL_MARGIN || y > this.height + Y_LABEL_MARGIN) continue;\n\n // Because displayed edge labels depend directly on actually rendered node\n // labels, we need to only add to this.displayedNodeLabels nodes whose label\n // is rendered.\n // This makes this.displayedNodeLabels depend on viewport, which might become\n // an issue once we start memoizing getLabelsToDisplay.\n this.displayedNodeLabels.add(node);\n var defaultDrawNodeLabel = this.settings.defaultDrawNodeLabel;\n var nodeProgram = this.nodePrograms[data.type];\n var drawLabel = (nodeProgram === null || nodeProgram === void 0 ? void 0 : nodeProgram.drawLabel) || defaultDrawNodeLabel;\n drawLabel(context, _objectSpread2(_objectSpread2({\n key: node\n }, data), {}, {\n size: size,\n x: x,\n y: y\n }), this.settings);\n }\n return this;\n }\n\n /**\n * Method used to render edge labels, based on which node labels were\n * rendered.\n *\n * @return {Sigma}\n */\n }, {\n key: \"renderEdgeLabels\",\n value: function renderEdgeLabels() {\n if (!this.settings.renderEdgeLabels) return this;\n var context = this.canvasContexts.edgeLabels;\n\n // Clearing\n context.clearRect(0, 0, this.width, this.height);\n var edgeLabelsToDisplay = edgeLabelsToDisplayFromNodes({\n graph: this.graph,\n hoveredNode: this.hoveredNode,\n displayedNodeLabels: this.displayedNodeLabels,\n highlightedNodes: this.highlightedNodes\n });\n extend(edgeLabelsToDisplay, this.edgesWithForcedLabels);\n var displayedLabels = new Set();\n for (var i = 0, l = edgeLabelsToDisplay.length; i < l; i++) {\n var edge = edgeLabelsToDisplay[i],\n extremities = this.graph.extremities(edge),\n sourceData = this.nodeDataCache[extremities[0]],\n targetData = this.nodeDataCache[extremities[1]],\n edgeData = this.edgeDataCache[edge];\n\n // If the edge was already drawn (like if it is eligible AND has\n // `forceLabel`), we don't want to draw it again\n if (displayedLabels.has(edge)) continue;\n\n // If the edge is hidden we don't need to display its label\n // NOTE: the test on sourceData & targetData is probably paranoid at this point?\n if (edgeData.hidden || sourceData.hidden || targetData.hidden) {\n continue;\n }\n var defaultDrawEdgeLabel = this.settings.defaultDrawEdgeLabel;\n var edgeProgram = this.edgePrograms[edgeData.type];\n var drawLabel = (edgeProgram === null || edgeProgram === void 0 ? void 0 : edgeProgram.drawLabel) || defaultDrawEdgeLabel;\n drawLabel(context, _objectSpread2(_objectSpread2({\n key: edge\n }, edgeData), {}, {\n size: this.scaleSize(edgeData.size)\n }), _objectSpread2(_objectSpread2(_objectSpread2({\n key: extremities[0]\n }, sourceData), this.framedGraphToViewport(sourceData)), {}, {\n size: this.scaleSize(sourceData.size)\n }), _objectSpread2(_objectSpread2(_objectSpread2({\n key: extremities[1]\n }, targetData), this.framedGraphToViewport(targetData)), {}, {\n size: this.scaleSize(targetData.size)\n }), this.settings);\n displayedLabels.add(edge);\n }\n this.displayedEdgeLabels = displayedLabels;\n return this;\n }\n\n /**\n * Method used to render the highlighted nodes.\n *\n * @return {Sigma}\n */\n }, {\n key: \"renderHighlightedNodes\",\n value: function renderHighlightedNodes() {\n var _this7 = this;\n var context = this.canvasContexts.hovers;\n\n // Clearing\n context.clearRect(0, 0, this.width, this.height);\n\n // Rendering\n var render = function render(node) {\n var data = _this7.nodeDataCache[node];\n var _this7$framedGraphToV = _this7.framedGraphToViewport(data),\n x = _this7$framedGraphToV.x,\n y = _this7$framedGraphToV.y;\n var size = _this7.scaleSize(data.size);\n var defaultDrawNodeHover = _this7.settings.defaultDrawNodeHover;\n var nodeProgram = _this7.nodePrograms[data.type];\n var drawHover = (nodeProgram === null || nodeProgram === void 0 ? void 0 : nodeProgram.drawHover) || defaultDrawNodeHover;\n drawHover(context, _objectSpread2(_objectSpread2({\n key: node\n }, data), {}, {\n size: size,\n x: x,\n y: y\n }), _this7.settings);\n };\n var nodesToRender = [];\n if (this.hoveredNode && !this.nodeDataCache[this.hoveredNode].hidden) {\n nodesToRender.push(this.hoveredNode);\n }\n this.highlightedNodes.forEach(function (node) {\n // The hovered node has already been highlighted\n if (node !== _this7.hoveredNode) nodesToRender.push(node);\n });\n\n // Draw labels:\n nodesToRender.forEach(function (node) {\n return render(node);\n });\n\n // Draw WebGL nodes on top of the labels:\n var nodesPerPrograms = {};\n\n // 1. Count nodes per type:\n nodesToRender.forEach(function (node) {\n var type = _this7.nodeDataCache[node].type;\n nodesPerPrograms[type] = (nodesPerPrograms[type] || 0) + 1;\n });\n // 2. Allocate for each type for the proper number of nodes\n for (var type in this.nodeHoverPrograms) {\n this.nodeHoverPrograms[type].reallocate(nodesPerPrograms[type] || 0);\n // Also reset count, to use when rendering:\n nodesPerPrograms[type] = 0;\n }\n // 3. Process all nodes to render:\n nodesToRender.forEach(function (node) {\n var data = _this7.nodeDataCache[node];\n _this7.nodeHoverPrograms[data.type].process(0, nodesPerPrograms[data.type]++, data);\n });\n // 4. Clear hovered nodes layer:\n this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);\n // 5. Render:\n var renderParams = this.getRenderParams();\n for (var _type6 in this.nodeHoverPrograms) {\n var program = this.nodeHoverPrograms[_type6];\n program.render(renderParams);\n }\n }\n\n /**\n * Method used to schedule a hover render.\n *\n */\n }, {\n key: \"scheduleHighlightedNodesRender\",\n value: function scheduleHighlightedNodesRender() {\n var _this8 = this;\n if (this.renderHighlightedNodesFrame || this.renderFrame) return;\n this.renderHighlightedNodesFrame = requestAnimationFrame(function () {\n // Resetting state\n _this8.renderHighlightedNodesFrame = null;\n\n // Rendering\n _this8.renderHighlightedNodes();\n _this8.renderEdgeLabels();\n });\n }\n\n /**\n * Method used to render.\n *\n * @return {Sigma}\n */\n }, {\n key: \"render\",\n value: function render() {\n var _this9 = this;\n this.emit(\"beforeRender\");\n var exitRender = function exitRender() {\n _this9.emit(\"afterRender\");\n return _this9;\n };\n\n // If a render was scheduled, we cancel it\n if (this.renderFrame) {\n cancelAnimationFrame(this.renderFrame);\n this.renderFrame = null;\n }\n\n // First we need to resize\n this.resize();\n\n // Do we need to reprocess data?\n if (this.needToProcess) this.process();\n this.needToProcess = false;\n\n // Clearing the canvases\n this.clear();\n\n // Prepare the textures\n this.pickingLayers.forEach(function (layer) {\n return _this9.resetWebGLTexture(layer);\n });\n\n // If we have no nodes we can stop right there\n if (!this.graph.order) return exitRender();\n\n // TODO: improve this heuristic or move to the captor itself?\n // TODO: deal with the touch captor here as well\n var mouseCaptor = this.mouseCaptor;\n var moving = this.camera.isAnimated() || mouseCaptor.isMoving || mouseCaptor.draggedEvents || mouseCaptor.currentWheelDirection;\n\n // Then we need to extract a matrix from the camera\n var cameraState = this.camera.getState();\n var viewportDimensions = this.getDimensions();\n var graphDimensions = this.getGraphDimensions();\n var padding = this.getStagePadding();\n this.matrix = matrixFromCamera(cameraState, viewportDimensions, graphDimensions, padding);\n this.invMatrix = matrixFromCamera(cameraState, viewportDimensions, graphDimensions, padding, true);\n this.correctionRatio = getMatrixImpact(this.matrix, cameraState, viewportDimensions);\n this.graphToViewportRatio = this.getGraphToViewportRatio();\n\n // [jacomyal]\n // This comment is related to the one above the `getMatrixImpact` definition:\n // - `this.correctionRatio` is somehow not completely explained\n // - `this.graphToViewportRatio` is the ratio of a distance in the viewport divided by the same distance in the\n // graph\n // - `this.normalizationFunction.ratio` is basically `Math.max(graphDX, graphDY)`\n // And now, I observe that if I multiply these three ratios, I have something constant, which value remains 2, even\n // when I change the graph, the viewport or the camera. It might be useful later, so I prefer to let this comment:\n // console.log(this.graphToViewportRatio * this.correctionRatio * this.normalizationFunction.ratio * 2);\n\n var params = this.getRenderParams();\n\n // Drawing nodes\n for (var type in this.nodePrograms) {\n var program = this.nodePrograms[type];\n program.render(params);\n }\n\n // Drawing edges\n if (!this.settings.hideEdgesOnMove || !moving) {\n for (var _type7 in this.edgePrograms) {\n var _program2 = this.edgePrograms[_type7];\n _program2.render(params);\n }\n }\n\n // Do not display labels on move per setting\n if (this.settings.hideLabelsOnMove && moving) return exitRender();\n this.renderLabels();\n this.renderEdgeLabels();\n this.renderHighlightedNodes();\n return exitRender();\n }\n\n /**\n * Add a node in the internal data structures.\n * @private\n * @param key The node's graphology ID\n */\n }, {\n key: \"addNode\",\n value: function addNode(key) {\n // Node display data resolution:\n // 1. First we get the node's attributes\n // 2. We optionally reduce them using the function provided by the user\n // Note that this function must return a total object and won't be merged\n // 3. We apply our defaults, while running some vital checks\n // 4. We apply the normalization function\n // We shallow copy node data to avoid dangerous behaviors from reducers\n var attr = Object.assign({}, this.graph.getNodeAttributes(key));\n if (this.settings.nodeReducer) attr = this.settings.nodeReducer(key, attr);\n var data = applyNodeDefaults(this.settings, key, attr);\n this.nodeDataCache[key] = data;\n\n // Label:\n // We delete and add if needed because this function is also used from\n // update\n this.nodesWithForcedLabels[\"delete\"](key);\n if (data.forceLabel && !data.hidden) this.nodesWithForcedLabels.add(key);\n\n // Highlighted:\n // We remove and re add if needed because this function is also used from\n // update\n this.highlightedNodes[\"delete\"](key);\n if (data.highlighted && !data.hidden) this.highlightedNodes.add(key);\n\n // zIndex\n if (this.settings.zIndex) {\n if (data.zIndex < this.nodeZExtent[0]) this.nodeZExtent[0] = data.zIndex;\n if (data.zIndex > this.nodeZExtent[1]) this.nodeZExtent[1] = data.zIndex;\n }\n }\n\n /**\n * Update a node the internal data structures.\n * @private\n * @param key The node's graphology ID\n */\n }, {\n key: \"updateNode\",\n value: function updateNode(key) {\n this.addNode(key);\n\n // Re-apply normalization on the node\n var data = this.nodeDataCache[key];\n this.normalizationFunction.applyTo(data);\n }\n\n /**\n * Remove a node from the internal data structures.\n * @private\n * @param key The node's graphology ID\n */\n }, {\n key: \"removeNode\",\n value: function removeNode(key) {\n // Remove from node cache\n delete this.nodeDataCache[key];\n // Remove from node program index\n delete this.nodeProgramIndex[key];\n // Remove from higlighted nodes\n this.highlightedNodes[\"delete\"](key);\n // Remove from hovered\n if (this.hoveredNode === key) this.hoveredNode = null;\n // Remove from forced label\n this.nodesWithForcedLabels[\"delete\"](key);\n }\n\n /**\n * Add an edge into the internal data structures.\n * @private\n * @param key The edge's graphology ID\n */\n }, {\n key: \"addEdge\",\n value: function addEdge(key) {\n // Edge display data resolution:\n // 1. First we get the edge's attributes\n // 2. We optionally reduce them using the function provided by the user\n // 3. Note that this function must return a total object and won't be merged\n // 4. We apply our defaults, while running some vital checks\n // We shallow copy edge data to avoid dangerous behaviors from reducers\n var attr = Object.assign({}, this.graph.getEdgeAttributes(key));\n if (this.settings.edgeReducer) attr = this.settings.edgeReducer(key, attr);\n var data = applyEdgeDefaults(this.settings, key, attr);\n this.edgeDataCache[key] = data;\n\n // Forced label\n // we filter and re push if needed because this function is also used from\n // update\n this.edgesWithForcedLabels[\"delete\"](key);\n if (data.forceLabel && !data.hidden) this.edgesWithForcedLabels.add(key);\n\n // Check zIndex\n if (this.settings.zIndex) {\n if (data.zIndex < this.edgeZExtent[0]) this.edgeZExtent[0] = data.zIndex;\n if (data.zIndex > this.edgeZExtent[1]) this.edgeZExtent[1] = data.zIndex;\n }\n }\n\n /**\n * Update an edge in the internal data structures.\n * @private\n * @param key The edge's graphology ID\n */\n }, {\n key: \"updateEdge\",\n value: function updateEdge(key) {\n this.addEdge(key);\n }\n\n /**\n * Remove an edge from the internal data structures.\n * @private\n * @param key The edge's graphology ID\n */\n }, {\n key: \"removeEdge\",\n value: function removeEdge(key) {\n // Remove from edge cache\n delete this.edgeDataCache[key];\n // Remove from programId index\n delete this.edgeProgramIndex[key];\n // Remove from hovered\n if (this.hoveredEdge === key) this.hoveredEdge = null;\n // Remove from forced label\n this.edgesWithForcedLabels[\"delete\"](key);\n }\n\n /**\n * Clear all indices related to nodes.\n * @private\n */\n }, {\n key: \"clearNodeIndices\",\n value: function clearNodeIndices() {\n // LabelGrid & nodeExtent are only manage/populated in the process function\n this.labelGrid = new LabelGrid();\n this.nodeExtent = {\n x: [0, 1],\n y: [0, 1]\n };\n this.nodeDataCache = {};\n this.edgeProgramIndex = {};\n this.nodesWithForcedLabels = new Set();\n this.nodeZExtent = [Infinity, -Infinity];\n this.highlightedNodes = new Set();\n }\n\n /**\n * Clear all indices related to edges.\n * @private\n */\n }, {\n key: \"clearEdgeIndices\",\n value: function clearEdgeIndices() {\n this.edgeDataCache = {};\n this.edgeProgramIndex = {};\n this.edgesWithForcedLabels = new Set();\n this.edgeZExtent = [Infinity, -Infinity];\n }\n\n /**\n * Clear all indices.\n * @private\n */\n }, {\n key: \"clearIndices\",\n value: function clearIndices() {\n this.clearEdgeIndices();\n this.clearNodeIndices();\n }\n\n /**\n * Clear all graph state related to nodes.\n * @private\n */\n }, {\n key: \"clearNodeState\",\n value: function clearNodeState() {\n this.displayedNodeLabels = new Set();\n this.highlightedNodes = new Set();\n this.hoveredNode = null;\n }\n\n /**\n * Clear all graph state related to edges.\n * @private\n */\n }, {\n key: \"clearEdgeState\",\n value: function clearEdgeState() {\n this.displayedEdgeLabels = new Set();\n this.highlightedNodes = new Set();\n this.hoveredEdge = null;\n }\n\n /**\n * Clear all graph state.\n * @private\n */\n }, {\n key: \"clearState\",\n value: function clearState() {\n this.clearEdgeState();\n this.clearNodeState();\n }\n\n /**\n * Add the node data to its program.\n * @private\n * @param node The node's graphology ID\n * @param fingerprint A fingerprint used to identity the node with picking\n * @param position The index where to place the node in the program\n */\n }, {\n key: \"addNodeToProgram\",\n value: function addNodeToProgram(node, fingerprint, position) {\n var data = this.nodeDataCache[node];\n var nodeProgram = this.nodePrograms[data.type];\n if (!nodeProgram) throw new Error(\"Sigma: could not find a suitable program for node type \\\"\".concat(data.type, \"\\\"!\"));\n nodeProgram.process(fingerprint, position, data);\n // Saving program index\n this.nodeProgramIndex[node] = position;\n }\n\n /**\n * Add the edge data to its program.\n * @private\n * @param edge The edge's graphology ID\n * @param fingerprint A fingerprint used to identity the edge with picking\n * @param position The index where to place the edge in the program\n */\n }, {\n key: \"addEdgeToProgram\",\n value: function addEdgeToProgram(edge, fingerprint, position) {\n var data = this.edgeDataCache[edge];\n var edgeProgram = this.edgePrograms[data.type];\n if (!edgeProgram) throw new Error(\"Sigma: could not find a suitable program for edge type \\\"\".concat(data.type, \"\\\"!\"));\n var extremities = this.graph.extremities(edge),\n sourceData = this.nodeDataCache[extremities[0]],\n targetData = this.nodeDataCache[extremities[1]];\n edgeProgram.process(fingerprint, position, sourceData, targetData, data);\n // Saving program index\n this.edgeProgramIndex[edge] = position;\n }\n\n /**---------------------------------------------------------------------------\n * Public API.\n **---------------------------------------------------------------------------\n */\n\n /**\n * Function used to get the render params.\n *\n * @return {RenderParams}\n */\n }, {\n key: \"getRenderParams\",\n value: function getRenderParams() {\n return {\n matrix: this.matrix,\n invMatrix: this.invMatrix,\n width: this.width,\n height: this.height,\n pixelRatio: this.pixelRatio,\n zoomRatio: this.camera.ratio,\n cameraAngle: this.camera.angle,\n sizeRatio: 1 / this.scaleSize(),\n correctionRatio: this.correctionRatio,\n downSizingRatio: this.pickingDownSizingRatio,\n minEdgeThickness: this.settings.minEdgeThickness,\n antiAliasingFeather: this.settings.antiAliasingFeather\n };\n }\n\n /**\n * Function used to retrieve the actual stage padding value.\n *\n * @return {number}\n */\n }, {\n key: \"getStagePadding\",\n value: function getStagePadding() {\n var _this$settings = this.settings,\n stagePadding = _this$settings.stagePadding,\n autoRescale = _this$settings.autoRescale;\n return autoRescale ? stagePadding || 0 : 0;\n }\n\n /**\n * Function used to create a layer element.\n *\n * @param {string} id - Context's id.\n * @param {string} tag - The HTML tag to use.\n * @param options\n * @return {Sigma}\n */\n }, {\n key: \"createLayer\",\n value: function createLayer(id, tag) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (this.elements[id]) throw new Error(\"Sigma: a layer named \\\"\".concat(id, \"\\\" already exists\"));\n var element = createElement(tag, {\n position: \"absolute\"\n }, {\n \"class\": \"sigma-\".concat(id)\n });\n if (options.style) Object.assign(element.style, options.style);\n this.elements[id] = element;\n if (\"beforeLayer\" in options && options.beforeLayer) {\n this.elements[options.beforeLayer].before(element);\n } else if (\"afterLayer\" in options && options.afterLayer) {\n this.elements[options.afterLayer].after(element);\n } else {\n this.container.appendChild(element);\n }\n return element;\n }\n\n /**\n * Function used to create a canvas element.\n *\n * @param {string} id - Context's id.\n * @param options\n * @return {Sigma}\n */\n }, {\n key: \"createCanvas\",\n value: function createCanvas(id) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this.createLayer(id, \"canvas\", options);\n }\n\n /**\n * Function used to create a canvas context and add the relevant DOM elements.\n *\n * @param {string} id - Context's id.\n * @param options\n * @return {Sigma}\n */\n }, {\n key: \"createCanvasContext\",\n value: function createCanvasContext(id) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var canvas = this.createCanvas(id, options);\n var contextOptions = {\n preserveDrawingBuffer: false,\n antialias: false\n };\n this.canvasContexts[id] = canvas.getContext(\"2d\", contextOptions);\n return this;\n }\n\n /**\n * Function used to create a WebGL context and add the relevant DOM\n * elements.\n *\n * @param {string} id - Context's id.\n * @param {object?} options - #getContext params to override (optional)\n * @return {WebGLRenderingContext}\n */\n }, {\n key: \"createWebGLContext\",\n value: function createWebGLContext(id) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var canvas = (options === null || options === void 0 ? void 0 : options.canvas) || this.createCanvas(id, options);\n if (options.hidden) canvas.remove();\n var contextOptions = _objectSpread2({\n preserveDrawingBuffer: false,\n antialias: false\n }, options);\n var context;\n\n // First we try webgl2 for an easy performance boost\n context = canvas.getContext(\"webgl2\", contextOptions);\n\n // Else we fall back to webgl\n if (!context) context = canvas.getContext(\"webgl\", contextOptions);\n\n // Edge, I am looking right at you...\n if (!context) context = canvas.getContext(\"experimental-webgl\", contextOptions);\n var gl = context;\n this.webGLContexts[id] = gl;\n\n // Blending:\n gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);\n\n // Prepare frame buffer for picking layers:\n if (options.picking) {\n this.pickingLayers.add(id);\n var newFrameBuffer = gl.createFramebuffer();\n if (!newFrameBuffer) throw new Error(\"Sigma: cannot create a new frame buffer for layer \".concat(id));\n this.frameBuffers[id] = newFrameBuffer;\n }\n return gl;\n }\n\n /**\n * Function used to properly kill a layer.\n *\n * @param {string} id - Layer id.\n * @return {Sigma}\n */\n }, {\n key: \"killLayer\",\n value: function killLayer(id) {\n var element = this.elements[id];\n if (!element) throw new Error(\"Sigma: cannot kill layer \".concat(id, \", which does not exist\"));\n if (this.webGLContexts[id]) {\n var _gl$getExtension;\n var gl = this.webGLContexts[id];\n (_gl$getExtension = gl.getExtension(\"WEBGL_lose_context\")) === null || _gl$getExtension === void 0 || _gl$getExtension.loseContext();\n delete this.webGLContexts[id];\n } else if (this.canvasContexts[id]) {\n delete this.canvasContexts[id];\n }\n\n // Delete layer element\n element.remove();\n delete this.elements[id];\n return this;\n }\n\n /**\n * Method returning the renderer's camera.\n *\n * @return {Camera}\n */\n }, {\n key: \"getCamera\",\n value: function getCamera() {\n return this.camera;\n }\n\n /**\n * Method setting the renderer's camera.\n *\n * @param {Camera} camera - New camera.\n * @return {Sigma}\n */\n }, {\n key: \"setCamera\",\n value: function setCamera(camera) {\n this.unbindCameraHandlers();\n this.camera = camera;\n this.bindCameraHandlers();\n }\n\n /**\n * Method returning the container DOM element.\n *\n * @return {HTMLElement}\n */\n }, {\n key: \"getContainer\",\n value: function getContainer() {\n return this.container;\n }\n\n /**\n * Method returning the renderer's graph.\n *\n * @return {Graph}\n */\n }, {\n key: \"getGraph\",\n value: function getGraph() {\n return this.graph;\n }\n\n /**\n * Method used to set the renderer's graph.\n *\n * @return {Graph}\n */\n }, {\n key: \"setGraph\",\n value: function setGraph(graph) {\n if (graph === this.graph) return;\n\n // Check hoveredNode and hoveredEdge\n if (this.hoveredNode && !graph.hasNode(this.hoveredNode)) this.hoveredNode = null;\n if (this.hoveredEdge && !graph.hasEdge(this.hoveredEdge)) this.hoveredEdge = null;\n\n // Unbinding handlers on the current graph\n this.unbindGraphHandlers();\n if (this.checkEdgesEventsFrame !== null) {\n cancelAnimationFrame(this.checkEdgesEventsFrame);\n this.checkEdgesEventsFrame = null;\n }\n\n // Installing new graph\n this.graph = graph;\n\n // Binding new handlers\n this.bindGraphHandlers();\n\n // Re-rendering now to avoid discrepancies from now to next frame\n this.refresh();\n }\n\n /**\n * Method returning the mouse captor.\n *\n * @return {MouseCaptor}\n */\n }, {\n key: \"getMouseCaptor\",\n value: function getMouseCaptor() {\n return this.mouseCaptor;\n }\n\n /**\n * Method returning the touch captor.\n *\n * @return {TouchCaptor}\n */\n }, {\n key: \"getTouchCaptor\",\n value: function getTouchCaptor() {\n return this.touchCaptor;\n }\n\n /**\n * Method returning the current renderer's dimensions.\n *\n * @return {Dimensions}\n */\n }, {\n key: \"getDimensions\",\n value: function getDimensions() {\n return {\n width: this.width,\n height: this.height\n };\n }\n\n /**\n * Method returning the current graph's dimensions.\n *\n * @return {Dimensions}\n */\n }, {\n key: \"getGraphDimensions\",\n value: function getGraphDimensions() {\n var extent = this.customBBox || this.nodeExtent;\n return {\n width: extent.x[1] - extent.x[0] || 1,\n height: extent.y[1] - extent.y[0] || 1\n };\n }\n\n /**\n * Method used to get all the sigma node attributes.\n * It's useful for example to get the position of a node\n * and to get values that are set by the nodeReducer\n *\n * @param {string} key - The node's key.\n * @return {NodeDisplayData | undefined} A copy of the desired node's attribute or undefined if not found\n */\n }, {\n key: \"getNodeDisplayData\",\n value: function getNodeDisplayData(key) {\n var node = this.nodeDataCache[key];\n return node ? Object.assign({}, node) : undefined;\n }\n\n /**\n * Method used to get all the sigma edge attributes.\n * It's useful for example to get values that are set by the edgeReducer.\n *\n * @param {string} key - The edge's key.\n * @return {EdgeDisplayData | undefined} A copy of the desired edge's attribute or undefined if not found\n */\n }, {\n key: \"getEdgeDisplayData\",\n value: function getEdgeDisplayData(key) {\n var edge = this.edgeDataCache[key];\n return edge ? Object.assign({}, edge) : undefined;\n }\n\n /**\n * Method used to get the set of currently displayed node labels.\n *\n * @return {Set<string>} A set of node keys whose label is displayed.\n */\n }, {\n key: \"getNodeDisplayedLabels\",\n value: function getNodeDisplayedLabels() {\n return new Set(this.displayedNodeLabels);\n }\n\n /**\n * Method used to get the set of currently displayed edge labels.\n *\n * @return {Set<string>} A set of edge keys whose label is displayed.\n */\n }, {\n key: \"getEdgeDisplayedLabels\",\n value: function getEdgeDisplayedLabels() {\n return new Set(this.displayedEdgeLabels);\n }\n\n /**\n * Method returning a copy of the settings collection.\n *\n * @return {Settings} A copy of the settings collection.\n */\n }, {\n key: \"getSettings\",\n value: function getSettings() {\n return _objectSpread2({}, this.settings);\n }\n\n /**\n * Method returning the current value for a given setting key.\n *\n * @param {string} key - The setting key to get.\n * @return {any} The value attached to this setting key or undefined if not found\n */\n }, {\n key: \"getSetting\",\n value: function getSetting(key) {\n return this.settings[key];\n }\n\n /**\n * Method setting the value of a given setting key. Note that this will schedule\n * a new render next frame.\n *\n * @param {string} key - The setting key to set.\n * @param {any} value - The value to set.\n * @return {Sigma}\n */\n }, {\n key: \"setSetting\",\n value: function setSetting(key, value) {\n var oldValues = _objectSpread2({}, this.settings);\n this.settings[key] = value;\n validateSettings(this.settings);\n this.handleSettingsUpdate(oldValues);\n this.scheduleRefresh();\n return this;\n }\n\n /**\n * Method updating the value of a given setting key using the provided function.\n * Note that this will schedule a new render next frame.\n *\n * @param {string} key - The setting key to set.\n * @param {function} updater - The update function.\n * @return {Sigma}\n */\n }, {\n key: \"updateSetting\",\n value: function updateSetting(key, updater) {\n this.setSetting(key, updater(this.settings[key]));\n return this;\n }\n\n /**\n * Method setting multiple settings at once.\n *\n * @param {Partial<Settings>} settings - The settings to set.\n * @return {Sigma}\n */\n }, {\n key: \"setSettings\",\n value: function setSettings(settings) {\n var oldValues = _objectSpread2({}, this.settings);\n this.settings = _objectSpread2(_objectSpread2({}, this.settings), settings);\n validateSettings(this.settings);\n this.handleSettingsUpdate(oldValues);\n this.scheduleRefresh();\n return this;\n }\n\n /**\n * Method used to resize the renderer.\n *\n * @param {boolean} force - If true, then resize is processed even if size is unchanged (optional).\n * @return {Sigma}\n */\n }, {\n key: \"resize\",\n value: function resize(force) {\n var previousWidth = this.width,\n previousHeight = this.height;\n this.width = this.container.offsetWidth;\n this.height = this.container.offsetHeight;\n this.pixelRatio = getPixelRatio();\n if (this.width === 0) {\n if (this.settings.allowInvalidContainer) this.width = 1;else throw new Error(\"Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.\");\n }\n if (this.height === 0) {\n if (this.settings.allowInvalidContainer) this.height = 1;else throw new Error(\"Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.\");\n }\n\n // If nothing has changed, we can stop right here\n if (!force && previousWidth === this.width && previousHeight === this.height) return this;\n\n // Sizing dom elements\n for (var id in this.elements) {\n var element = this.elements[id];\n element.style.width = this.width + \"px\";\n element.style.height = this.height + \"px\";\n }\n\n // Sizing canvas contexts\n for (var _id in this.canvasContexts) {\n this.elements[_id].setAttribute(\"width\", this.width * this.pixelRatio + \"px\");\n this.elements[_id].setAttribute(\"height\", this.height * this.pixelRatio + \"px\");\n if (this.pixelRatio !== 1) this.canvasContexts[_id].scale(this.pixelRatio, this.pixelRatio);\n }\n\n // Sizing WebGL contexts\n for (var _id2 in this.webGLContexts) {\n this.elements[_id2].setAttribute(\"width\", this.width * this.pixelRatio + \"px\");\n this.elements[_id2].setAttribute(\"height\", this.height * this.pixelRatio + \"px\");\n var gl = this.webGLContexts[_id2];\n gl.viewport(0, 0, this.width * this.pixelRatio, this.height * this.pixelRatio);\n\n // Clear picking texture if needed\n if (this.pickingLayers.has(_id2)) {\n var currentTexture = this.textures[_id2];\n if (currentTexture) gl.deleteTexture(currentTexture);\n }\n }\n this.emit(\"resize\");\n return this;\n }\n\n /**\n * Method used to clear all the canvases.\n *\n * @return {Sigma}\n */\n }, {\n key: \"clear\",\n value: function clear() {\n this.emit(\"beforeClear\");\n this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER, null);\n this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);\n this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER, null);\n this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);\n this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);\n this.canvasContexts.labels.clearRect(0, 0, this.width, this.height);\n this.canvasContexts.hovers.clearRect(0, 0, this.width, this.height);\n this.canvasContexts.edgeLabels.clearRect(0, 0, this.width, this.height);\n this.emit(\"afterClear\");\n return this;\n }\n\n /**\n * Method used to refresh, i.e. force the renderer to reprocess graph\n * data and render, but keep the state.\n * - if a partialGraph is provided, we only reprocess those nodes & edges.\n * - if schedule is TRUE, we schedule a render instead of sync render\n * - if skipIndexation is TRUE, then labelGrid & program indexation are skipped (can be used if you haven't modify x, y, zIndex & size)\n *\n * @return {Sigma}\n */\n }, {\n key: \"refresh\",\n value: function refresh(opts) {\n var _this10 = this;\n var skipIndexation = (opts === null || opts === void 0 ? void 0 : opts.skipIndexation) !== undefined ? opts === null || opts === void 0 ? void 0 : opts.skipIndexation : false;\n var schedule = (opts === null || opts === void 0 ? void 0 : opts.schedule) !== undefined ? opts.schedule : false;\n var fullRefresh = !opts || !opts.partialGraph;\n if (fullRefresh) {\n // Re-index graph data\n this.clearEdgeIndices();\n this.clearNodeIndices();\n this.graph.forEachNode(function (node) {\n return _this10.addNode(node);\n });\n this.graph.forEachEdge(function (edge) {\n return _this10.addEdge(edge);\n });\n } else {\n var _opts$partialGraph, _opts$partialGraph2;\n var nodes = ((_opts$partialGraph = opts.partialGraph) === null || _opts$partialGraph === void 0 ? void 0 : _opts$partialGraph.nodes) || [];\n for (var i = 0, l = (nodes === null || nodes === void 0 ? void 0 : nodes.length) || 0; i < l; i++) {\n var node = nodes[i];\n // Recompute node's data (ie. apply reducer)\n this.updateNode(node);\n // Add node to the program if layout is unchanged.\n // otherwise it will be done in the process function\n if (skipIndexation) {\n var programIndex = this.nodeProgramIndex[node];\n if (programIndex === undefined) throw new Error(\"Sigma: node \\\"\".concat(node, \"\\\" can't be repaint\"));\n this.addNodeToProgram(node, this.nodeIndices[node], programIndex);\n }\n }\n var edges = (opts === null || opts === void 0 || (_opts$partialGraph2 = opts.partialGraph) === null || _opts$partialGraph2 === void 0 ? void 0 : _opts$partialGraph2.edges) || [];\n for (var _i4 = 0, _l4 = edges.length; _i4 < _l4; _i4++) {\n var edge = edges[_i4];\n // Recompute edge's data (ie. apply reducer)\n this.updateEdge(edge);\n // Add edge to the program\n // otherwise it will be done in the process function\n if (skipIndexation) {\n var _programIndex = this.edgeProgramIndex[edge];\n if (_programIndex === undefined) throw new Error(\"Sigma: edge \\\"\".concat(edge, \"\\\" can't be repaint\"));\n this.addEdgeToProgram(edge, this.edgeIndices[edge], _programIndex);\n }\n }\n }\n\n // Do we need to call the process function ?\n if (fullRefresh || !skipIndexation) this.needToProcess = true;\n if (schedule) this.scheduleRender();else this.render();\n return this;\n }\n\n /**\n * Method used to schedule a render at the next available frame.\n * This method can be safely called on a same frame because it basically\n * debounces refresh to the next frame.\n *\n * @return {Sigma}\n */\n }, {\n key: \"scheduleRender\",\n value: function scheduleRender() {\n var _this11 = this;\n if (!this.renderFrame) {\n this.renderFrame = requestAnimationFrame(function () {\n _this11.render();\n });\n }\n return this;\n }\n\n /**\n * Method used to schedule a refresh (i.e. fully reprocess graph data and render)\n * at the next available frame.\n * This method can be safely called on a same frame because it basically\n * debounces refresh to the next frame.\n *\n * @return {Sigma}\n */\n }, {\n key: \"scheduleRefresh\",\n value: function scheduleRefresh(opts) {\n return this.refresh(_objectSpread2(_objectSpread2({}, opts), {}, {\n schedule: true\n }));\n }\n\n /**\n * Method used to (un)zoom, while preserving the position of a viewport point.\n * Used for instance to zoom \"on the mouse cursor\".\n *\n * @param viewportTarget\n * @param newRatio\n * @return {CameraState}\n */\n }, {\n key: \"getViewportZoomedState\",\n value: function getViewportZoomedState(viewportTarget, newRatio) {\n var _this$camera$getState = this.camera.getState(),\n ratio = _this$camera$getState.ratio,\n angle = _this$camera$getState.angle,\n x = _this$camera$getState.x,\n y = _this$camera$getState.y;\n var _this$settings2 = this.settings,\n minCameraRatio = _this$settings2.minCameraRatio,\n maxCameraRatio = _this$settings2.maxCameraRatio;\n if (typeof maxCameraRatio === \"number\") newRatio = Math.min(newRatio, maxCameraRatio);\n if (typeof minCameraRatio === \"number\") newRatio = Math.max(newRatio, minCameraRatio);\n var ratioDiff = newRatio / ratio;\n var center = {\n x: this.width / 2,\n y: this.height / 2\n };\n var graphMousePosition = this.viewportToFramedGraph(viewportTarget);\n var graphCenterPosition = this.viewportToFramedGraph(center);\n return {\n angle: angle,\n x: (graphMousePosition.x - graphCenterPosition.x) * (1 - ratioDiff) + x,\n y: (graphMousePosition.y - graphCenterPosition.y) * (1 - ratioDiff) + y,\n ratio: newRatio\n };\n }\n\n /**\n * Method returning the abstract rectangle containing the graph according\n * to the camera's state.\n *\n * @return {object} - The view's rectangle.\n */\n }, {\n key: \"viewRectangle\",\n value: function viewRectangle() {\n var p1 = this.viewportToFramedGraph({\n x: 0,\n y: 0\n }),\n p2 = this.viewportToFramedGraph({\n x: this.width,\n y: 0\n }),\n h = this.viewportToFramedGraph({\n x: 0,\n y: this.height\n });\n return {\n x1: p1.x,\n y1: p1.y,\n x2: p2.x,\n y2: p2.y,\n height: p2.y - h.y\n };\n }\n\n /**\n * Method returning the coordinates of a point from the framed graph system to the viewport system. It allows\n * overriding anything that is used to get the translation matrix, or even the matrix itself.\n *\n * Be careful if overriding dimensions, padding or cameraState, as the computation of the matrix is not the lightest\n * of computations.\n */\n }, {\n key: \"framedGraphToViewport\",\n value: function framedGraphToViewport(coordinates) {\n var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var recomputeMatrix = !!override.cameraState || !!override.viewportDimensions || !!override.graphDimensions;\n var matrix = override.matrix ? override.matrix : recomputeMatrix ? matrixFromCamera(override.cameraState || this.camera.getState(), override.viewportDimensions || this.getDimensions(), override.graphDimensions || this.getGraphDimensions(), override.padding || this.getStagePadding()) : this.matrix;\n var viewportPos = multiplyVec2(matrix, coordinates);\n return {\n x: (1 + viewportPos.x) * this.width / 2,\n y: (1 - viewportPos.y) * this.height / 2\n };\n }\n\n /**\n * Method returning the coordinates of a point from the viewport system to the framed graph system. It allows\n * overriding anything that is used to get the translation matrix, or even the matrix itself.\n *\n * Be careful if overriding dimensions, padding or cameraState, as the computation of the matrix is not the lightest\n * of computations.\n */\n }, {\n key: \"viewportToFramedGraph\",\n value: function viewportToFramedGraph(coordinates) {\n var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var recomputeMatrix = !!override.cameraState || !!override.viewportDimensions || !override.graphDimensions;\n var invMatrix = override.matrix ? override.matrix : recomputeMatrix ? matrixFromCamera(override.cameraState || this.camera.getState(), override.viewportDimensions || this.getDimensions(), override.graphDimensions || this.getGraphDimensions(), override.padding || this.getStagePadding(), true) : this.invMatrix;\n var res = multiplyVec2(invMatrix, {\n x: coordinates.x / this.width * 2 - 1,\n y: 1 - coordinates.y / this.height * 2\n });\n if (isNaN(res.x)) res.x = 0;\n if (isNaN(res.y)) res.y = 0;\n return res;\n }\n\n /**\n * Method used to translate a point's coordinates from the viewport system (pixel distance from the top-left of the\n * stage) to the graph system (the reference system of data as they are in the given graph instance).\n *\n * This method accepts an optional camera which can be useful if you need to translate coordinates\n * based on a different view than the one being currently being displayed on screen.\n *\n * @param {Coordinates} viewportPoint\n * @param {CoordinateConversionOverride} override\n */\n }, {\n key: \"viewportToGraph\",\n value: function viewportToGraph(viewportPoint) {\n var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this.normalizationFunction.inverse(this.viewportToFramedGraph(viewportPoint, override));\n }\n\n /**\n * Method used to translate a point's coordinates from the graph system (the reference system of data as they are in\n * the given graph instance) to the viewport system (pixel distance from the top-left of the stage).\n *\n * This method accepts an optional camera which can be useful if you need to translate coordinates\n * based on a different view than the one being currently being displayed on screen.\n *\n * @param {Coordinates} graphPoint\n * @param {CoordinateConversionOverride} override\n */\n }, {\n key: \"graphToViewport\",\n value: function graphToViewport(graphPoint) {\n var override = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return this.framedGraphToViewport(this.normalizationFunction(graphPoint), override);\n }\n\n /**\n * Method returning the distance multiplier between the graph system and the\n * viewport system.\n */\n }, {\n key: \"getGraphToViewportRatio\",\n value: function getGraphToViewportRatio() {\n var graphP1 = {\n x: 0,\n y: 0\n };\n var graphP2 = {\n x: 1,\n y: 1\n };\n var graphD = Math.sqrt(Math.pow(graphP1.x - graphP2.x, 2) + Math.pow(graphP1.y - graphP2.y, 2));\n var viewportP1 = this.graphToViewport(graphP1);\n var viewportP2 = this.graphToViewport(graphP2);\n var viewportD = Math.sqrt(Math.pow(viewportP1.x - viewportP2.x, 2) + Math.pow(viewportP1.y - viewportP2.y, 2));\n return viewportD / graphD;\n }\n\n /**\n * Method returning the graph's bounding box.\n *\n * @return {{ x: Extent, y: Extent }}\n */\n }, {\n key: \"getBBox\",\n value: function getBBox() {\n return this.nodeExtent;\n }\n\n /**\n * Method returning the graph's custom bounding box, if any.\n *\n * @return {{ x: Extent, y: Extent } | null}\n */\n }, {\n key: \"getCustomBBox\",\n value: function getCustomBBox() {\n return this.customBBox;\n }\n\n /**\n * Method used to override the graph's bounding box with a custom one. Give `null` as the argument to stop overriding.\n *\n * @return {Sigma}\n */\n }, {\n key: \"setCustomBBox\",\n value: function setCustomBBox(customBBox) {\n this.customBBox = customBBox;\n this.scheduleRender();\n return this;\n }\n\n /**\n * Method used to shut the container & release event listeners.\n *\n * @return {undefined}\n */\n }, {\n key: \"kill\",\n value: function kill() {\n // Emitting \"kill\" events so that plugins and such can cleanup\n this.emit(\"kill\");\n\n // Releasing events\n this.removeAllListeners();\n\n // Releasing camera handlers\n this.unbindCameraHandlers();\n\n // Releasing DOM events & captors\n window.removeEventListener(\"resize\", this.activeListeners.handleResize);\n this.mouseCaptor.kill();\n this.touchCaptor.kill();\n\n // Releasing graph handlers\n this.unbindGraphHandlers();\n\n // Releasing cache & state\n this.clearIndices();\n this.clearState();\n this.nodeDataCache = {};\n this.edgeDataCache = {};\n this.highlightedNodes.clear();\n\n // Clearing frames\n if (this.renderFrame) {\n cancelAnimationFrame(this.renderFrame);\n this.renderFrame = null;\n }\n if (this.renderHighlightedNodesFrame) {\n cancelAnimationFrame(this.renderHighlightedNodesFrame);\n this.renderHighlightedNodesFrame = null;\n }\n\n // Destroying canvases\n var container = this.container;\n while (container.firstChild) container.removeChild(container.firstChild);\n\n // Kill programs:\n for (var type in this.nodePrograms) {\n this.nodePrograms[type].kill();\n }\n for (var _type8 in this.nodeHoverPrograms) {\n this.nodeHoverPrograms[_type8].kill();\n }\n for (var _type9 in this.edgePrograms) {\n this.edgePrograms[_type9].kill();\n }\n this.nodePrograms = {};\n this.nodeHoverPrograms = {};\n this.edgePrograms = {};\n\n // Kill all canvas/WebGL contexts\n for (var id in this.elements) {\n this.killLayer(id);\n }\n\n // Destroying remaining collections\n this.canvasContexts = {};\n this.webGLContexts = {};\n this.elements = {};\n }\n\n /**\n * Method used to scale the given size according to the camera's ratio, i.e.\n * zooming state.\n *\n * @param {number?} size - The size to scale (node size, edge thickness etc.).\n * @param {number?} cameraRatio - A camera ratio (defaults to the actual camera ratio).\n * @return {number} - The scaled size.\n */\n }, {\n key: \"scaleSize\",\n value: function scaleSize() {\n var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var cameraRatio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.camera.ratio;\n return size / this.settings.zoomToSizeRatioFunction(cameraRatio) * (this.getSetting(\"itemSizesReference\") === \"positions\" ? cameraRatio * this.graphToViewportRatio : 1);\n }\n\n /**\n * Method that returns the collection of all used canvases.\n * At the moment, the instantiated canvases are the following, and in the\n * following order in the DOM:\n * - `edges`\n * - `nodes`\n * - `edgeLabels`\n * - `labels`\n * - `hovers`\n * - `hoverNodes`\n * - `mouse`\n *\n * @return {PlainObject<HTMLCanvasElement>} - The collection of canvases.\n */\n }, {\n key: \"getCanvases\",\n value: function getCanvases() {\n var res = {};\n for (var layer in this.elements) if (this.elements[layer] instanceof HTMLCanvasElement) res[layer] = this.elements[layer];\n return res;\n }\n }]);\n}(TypedEventEmitter);\n\n/**\n * Sigma.js Library Endpoint\n * =========================\n *\n * The library endpoint.\n * @module\n */\nvar Sigma = Sigma$1;\n\nexport { Camera, MouseCaptor, Sigma$1 as Sigma, TouchCaptor, Sigma as default };\n", "import { f as NodeProgram, D as DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, _ as _objectSpread2, F as FRAGMENT_SHADER_SOURCE$3, g as EdgeProgram, h as createEdgeCompoundProgram, i as createEdgeArrowHeadProgram } from '../../dist/index-236c62ad.esm.js';\nexport { k as AbstractEdgeProgram, A as AbstractNodeProgram, l as AbstractProgram, D as DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, p as DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, m as EdgeArrowHeadProgram, E as EdgeArrowProgram, n as EdgeClampedProgram, g as EdgeProgram, e as EdgeRectangleProgram, N as NodeCircleProgram, f as NodeProgram, P as Program, i as createEdgeArrowHeadProgram, q as createEdgeArrowProgram, o as createEdgeClampedProgram, h as createEdgeCompoundProgram, j as createNodeCompoundProgram, c as drawDiscNodeHover, b as drawDiscNodeLabel, d as drawStraightEdgeLabel, r as getAttributeItemsCount, s as getAttributesItemsCount, w as killProgram, u as loadFragmentShader, v as loadProgram, t as loadVertexShader, x as numberToGLSLFloat } from '../../dist/index-236c62ad.esm.js';\nimport { _ as _inherits, a as _createClass, b as _classCallCheck, c as _callSuper } from '../../dist/inherits-d1a1e29b.esm.js';\nimport { f as floatColor } from '../../dist/colors-beb06eb2.esm.js';\n\n// language=GLSL\nvar SHADER_SOURCE$6 = /*glsl*/\"\\nprecision mediump float;\\n\\nvarying vec4 v_color;\\nvarying float v_border;\\n\\nconst float radius = 0.5;\\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\\n\\nvoid main(void) {\\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\\n float dist = radius - length(m);\\n\\n // No antialiasing for picking mode:\\n #ifdef PICKING_MODE\\n if (dist > v_border)\\n gl_FragColor = v_color;\\n else\\n gl_FragColor = transparent;\\n\\n #else\\n float t = 0.0;\\n if (dist > v_border)\\n t = 1.0;\\n else if (dist > 0.0)\\n t = dist / v_border;\\n\\n gl_FragColor = mix(transparent, v_color, t);\\n #endif\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$6;\n\n// language=GLSL\nvar SHADER_SOURCE$5 = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_position;\\nattribute float a_size;\\n\\nuniform float u_sizeRatio;\\nuniform float u_pixelRatio;\\nuniform mat3 u_matrix;\\n\\nvarying vec4 v_color;\\nvarying float v_border;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n gl_Position = vec4(\\n (u_matrix * vec3(a_position, 1)).xy,\\n 0,\\n 1\\n );\\n\\n // Multiply the point size twice:\\n // - x SCALING_RATIO to correct the canvas scaling\\n // - x 2 to correct the formulae\\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\\n\\n v_border = (0.5 / a_size) * u_sizeRatio;\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$3 = SHADER_SOURCE$5;\n\nvar _WebGLRenderingContex$3 = WebGLRenderingContext,\n UNSIGNED_BYTE$3 = _WebGLRenderingContex$3.UNSIGNED_BYTE,\n FLOAT$3 = _WebGLRenderingContex$3.FLOAT;\nvar UNIFORMS$3 = [\"u_sizeRatio\", \"u_pixelRatio\", \"u_matrix\"];\nvar NodePointProgram = /*#__PURE__*/function (_NodeProgram) {\n function NodePointProgram() {\n _classCallCheck(this, NodePointProgram);\n return _callSuper(this, NodePointProgram, arguments);\n }\n _inherits(NodePointProgram, _NodeProgram);\n return _createClass(NodePointProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 1,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$3,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$2,\n METHOD: WebGLRenderingContext.POINTS,\n UNIFORMS: UNIFORMS$3,\n ATTRIBUTES: [{\n name: \"a_position\",\n size: 2,\n type: FLOAT$3\n }, {\n name: \"a_size\",\n size: 1,\n type: FLOAT$3\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$3,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$3,\n normalized: true\n }]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(nodeIndex, startIndex, data) {\n var array = this.array;\n array[startIndex++] = data.x;\n array[startIndex++] = data.y;\n array[startIndex++] = data.size;\n array[startIndex++] = floatColor(data.color);\n array[startIndex++] = nodeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(_ref, _ref2) {\n var sizeRatio = _ref.sizeRatio,\n pixelRatio = _ref.pixelRatio,\n matrix = _ref.matrix;\n var gl = _ref2.gl,\n uniformLocations = _ref2.uniformLocations;\n var u_sizeRatio = uniformLocations.u_sizeRatio,\n u_pixelRatio = uniformLocations.u_pixelRatio,\n u_matrix = uniformLocations.u_matrix;\n gl.uniform1f(u_pixelRatio, pixelRatio);\n gl.uniform1f(u_sizeRatio, sizeRatio);\n gl.uniformMatrix3fv(u_matrix, false, matrix);\n }\n }]);\n}(NodeProgram);\n\n// language=GLSL\nvar SHADER_SOURCE$4 = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_normal;\\nattribute float a_normalCoef;\\nattribute vec2 a_positionStart;\\nattribute vec2 a_positionEnd;\\nattribute float a_positionCoef;\\nattribute float a_sourceRadius;\\nattribute float a_targetRadius;\\nattribute float a_sourceRadiusCoef;\\nattribute float a_targetRadiusCoef;\\n\\nuniform mat3 u_matrix;\\nuniform float u_zoomRatio;\\nuniform float u_sizeRatio;\\nuniform float u_pixelRatio;\\nuniform float u_correctionRatio;\\nuniform float u_minEdgeThickness;\\nuniform float u_lengthToThicknessRatio;\\nuniform float u_feather;\\n\\nvarying vec4 v_color;\\nvarying vec2 v_normal;\\nvarying float v_thickness;\\nvarying float v_feather;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n float minThickness = u_minEdgeThickness;\\n\\n vec2 normal = a_normal * a_normalCoef;\\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\\n\\n float normalLength = length(normal);\\n vec2 unitNormal = normal / normalLength;\\n\\n // These first computations are taken from edge.vert.glsl. Please read it to\\n // get better comments on what's happening:\\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\\n\\n // Here, we move the point to leave space for the arrow heads:\\n // Source arrow head\\n float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;\\n float sourceDirection = sign(sourceRadius);\\n float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;\\n float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\\n vec2 sourceCompensationVector =\\n vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)\\n * (webGLSourceRadius + webGLSourceArrowHeadLength);\\n \\n // Target arrow head\\n float targetRadius = a_targetRadius * a_targetRadiusCoef;\\n float targetDirection = sign(targetRadius);\\n float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;\\n float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\\n vec2 targetCompensationVector =\\n vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)\\n * (webGLTargetRadius + webGLTargetArrowHeadLength);\\n\\n // Here is the proper position of the vertex\\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);\\n\\n v_thickness = webGLThickness / u_zoomRatio;\\n\\n v_normal = unitNormal;\\n\\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;\n\nvar _WebGLRenderingContex$2 = WebGLRenderingContext,\n UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,\n FLOAT$2 = _WebGLRenderingContex$2.FLOAT;\nvar UNIFORMS$2 = [\"u_matrix\", \"u_zoomRatio\", \"u_sizeRatio\", \"u_correctionRatio\", \"u_pixelRatio\", \"u_feather\", \"u_minEdgeThickness\", \"u_lengthToThicknessRatio\"];\nvar DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = {\n lengthToThicknessRatio: DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS.lengthToThicknessRatio\n};\nfunction createEdgeDoubleClampedProgram(inputOptions) {\n var options = _objectSpread2(_objectSpread2({}, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS), inputOptions || {});\n return /*#__PURE__*/function (_EdgeProgram) {\n function EdgeDoubleClampedProgram() {\n _classCallCheck(this, EdgeDoubleClampedProgram);\n return _callSuper(this, EdgeDoubleClampedProgram, arguments);\n }\n _inherits(EdgeDoubleClampedProgram, _EdgeProgram);\n return _createClass(EdgeDoubleClampedProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 6,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$3,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS$2,\n ATTRIBUTES: [{\n name: \"a_positionStart\",\n size: 2,\n type: FLOAT$2\n }, {\n name: \"a_positionEnd\",\n size: 2,\n type: FLOAT$2\n }, {\n name: \"a_normal\",\n size: 2,\n type: FLOAT$2\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$2,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$2,\n normalized: true\n }, {\n name: \"a_sourceRadius\",\n size: 1,\n type: FLOAT$2\n }, {\n name: \"a_targetRadius\",\n size: 1,\n type: FLOAT$2\n }],\n CONSTANT_ATTRIBUTES: [\n // If 0, then position will be a_positionStart\n // If 1, then position will be a_positionEnd\n {\n name: \"a_positionCoef\",\n size: 1,\n type: FLOAT$2\n }, {\n name: \"a_normalCoef\",\n size: 1,\n type: FLOAT$2\n }, {\n name: \"a_sourceRadiusCoef\",\n size: 1,\n type: FLOAT$2\n }, {\n name: \"a_targetRadiusCoef\",\n size: 1,\n type: FLOAT$2\n }],\n CONSTANT_DATA: [[0, 1, -1, 0], [0, -1, 1, 0], [1, 1, 0, 1], [1, 1, 0, 1], [0, -1, 1, 0], [1, -1, 0, -1]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n var thickness = data.size || 1;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // Computing normals\n var dx = x2 - x1;\n var dy = y2 - y1;\n var sourceRadius = sourceData.size || 1;\n var targetRadius = targetData.size || 1;\n var len = dx * dx + dy * dy;\n var n1 = 0;\n var n2 = 0;\n if (len) {\n len = 1 / Math.sqrt(len);\n n1 = -dy * len * thickness;\n n2 = dx * len * thickness;\n }\n var array = this.array;\n array[startIndex++] = x1;\n array[startIndex++] = y1;\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = n1;\n array[startIndex++] = n2;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n array[startIndex++] = sourceRadius;\n array[startIndex++] = targetRadius;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_matrix = uniformLocations.u_matrix,\n u_zoomRatio = uniformLocations.u_zoomRatio,\n u_feather = uniformLocations.u_feather,\n u_pixelRatio = uniformLocations.u_pixelRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_sizeRatio = uniformLocations.u_sizeRatio,\n u_minEdgeThickness = uniformLocations.u_minEdgeThickness,\n u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n gl.uniform1f(u_zoomRatio, params.zoomRatio);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_pixelRatio, params.pixelRatio);\n gl.uniform1f(u_feather, params.antiAliasingFeather);\n gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);\n gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);\n }\n }]);\n }(EdgeProgram);\n}\nvar EdgeDoubleClampedProgram = createEdgeDoubleClampedProgram();\nvar EdgeDoubleClampedProgram$1 = EdgeDoubleClampedProgram;\n\nfunction createEdgeDoubleArrowProgram(inputOptions) {\n return createEdgeCompoundProgram([createEdgeDoubleClampedProgram(inputOptions), createEdgeArrowHeadProgram(inputOptions), createEdgeArrowHeadProgram(_objectSpread2(_objectSpread2({}, inputOptions), {}, {\n extremity: \"source\"\n }))]);\n}\nvar EdgeDoubleArrowProgram = createEdgeDoubleArrowProgram();\nvar EdgeDoubleArrowProgram$1 = EdgeDoubleArrowProgram;\n\n// language=GLSL\nvar SHADER_SOURCE$3 = /*glsl*/\"\\nprecision mediump float;\\n\\nvarying vec4 v_color;\\n\\nvoid main(void) {\\n gl_FragColor = v_color;\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE$1 = SHADER_SOURCE$3;\n\n// language=GLSL\nvar SHADER_SOURCE$2 = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_position;\\n\\nuniform mat3 u_matrix;\\n\\nvarying vec4 v_color;\\n\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n // Scale from [[-1 1] [-1 1]] to the container:\\n gl_Position = vec4(\\n (u_matrix * vec3(a_position, 1)).xy,\\n 0,\\n 1\\n );\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE$1 = SHADER_SOURCE$2;\n\nvar _WebGLRenderingContex$1 = WebGLRenderingContext,\n UNSIGNED_BYTE$1 = _WebGLRenderingContex$1.UNSIGNED_BYTE,\n FLOAT$1 = _WebGLRenderingContex$1.FLOAT;\nvar UNIFORMS$1 = [\"u_matrix\"];\nvar EdgeLineProgram = /*#__PURE__*/function (_EdgeProgram) {\n function EdgeLineProgram() {\n _classCallCheck(this, EdgeLineProgram);\n return _callSuper(this, EdgeLineProgram, arguments);\n }\n _inherits(EdgeLineProgram, _EdgeProgram);\n return _createClass(EdgeLineProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 2,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$1,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$1,\n METHOD: WebGLRenderingContext.LINES,\n UNIFORMS: UNIFORMS$1,\n ATTRIBUTES: [{\n name: \"a_position\",\n size: 2,\n type: FLOAT$1\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE$1,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE$1,\n normalized: true\n }]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n var array = this.array;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // First point\n array[startIndex++] = x1;\n array[startIndex++] = y1;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n\n // Second point\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_matrix = uniformLocations.u_matrix;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n }\n }]);\n}(EdgeProgram);\n\n// language=GLSL\nvar SHADER_SOURCE$1 = /*glsl*/\"\\nprecision mediump float;\\n\\nvarying vec4 v_color;\\n\\nvoid main(void) {\\n gl_FragColor = v_color;\\n}\\n\";\nvar FRAGMENT_SHADER_SOURCE = SHADER_SOURCE$1;\n\n// language=GLSL\nvar SHADER_SOURCE = /*glsl*/\"\\nattribute vec4 a_id;\\nattribute vec4 a_color;\\nattribute vec2 a_normal;\\nattribute float a_normalCoef;\\nattribute vec2 a_positionStart;\\nattribute vec2 a_positionEnd;\\nattribute float a_positionCoef;\\n\\nuniform mat3 u_matrix;\\nuniform float u_sizeRatio;\\nuniform float u_correctionRatio;\\n\\nvarying vec4 v_color;\\n\\nconst float minThickness = 1.7;\\nconst float bias = 255.0 / 254.0;\\n\\nvoid main() {\\n vec2 normal = a_normal * a_normalCoef;\\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\\n\\n // The only different here with edge.vert.glsl is that we need to handle null\\n // input normal vector. Apart from that, you can read edge.vert.glsl more info\\n // on how it works:\\n float normalLength = length(normal);\\n vec2 unitNormal = normal / normalLength;\\n if (normalLength <= 0.0) unitNormal = normal;\\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\\n\\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);\\n\\n #ifdef PICKING_MODE\\n // For picking mode, we use the ID as the color:\\n v_color = a_id;\\n #else\\n // For normal mode, we use the color:\\n v_color = a_color;\\n #endif\\n\\n v_color.a *= bias;\\n}\\n\";\nvar VERTEX_SHADER_SOURCE = SHADER_SOURCE;\n\nvar _WebGLRenderingContex = WebGLRenderingContext,\n UNSIGNED_BYTE = _WebGLRenderingContex.UNSIGNED_BYTE,\n FLOAT = _WebGLRenderingContex.FLOAT;\nvar UNIFORMS = [\"u_matrix\", \"u_sizeRatio\", \"u_correctionRatio\", \"u_minEdgeThickness\"];\nvar EdgeTriangleProgram = /*#__PURE__*/function (_EdgeProgram) {\n function EdgeTriangleProgram() {\n _classCallCheck(this, EdgeTriangleProgram);\n return _callSuper(this, EdgeTriangleProgram, arguments);\n }\n _inherits(EdgeTriangleProgram, _EdgeProgram);\n return _createClass(EdgeTriangleProgram, [{\n key: \"getDefinition\",\n value: function getDefinition() {\n return {\n VERTICES: 3,\n VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE,\n FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE,\n METHOD: WebGLRenderingContext.TRIANGLES,\n UNIFORMS: UNIFORMS,\n ATTRIBUTES: [{\n name: \"a_positionStart\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_positionEnd\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_normal\",\n size: 2,\n type: FLOAT\n }, {\n name: \"a_color\",\n size: 4,\n type: UNSIGNED_BYTE,\n normalized: true\n }, {\n name: \"a_id\",\n size: 4,\n type: UNSIGNED_BYTE,\n normalized: true\n }],\n CONSTANT_ATTRIBUTES: [\n // If 0, then position will be a_positionStart\n // If 1, then position will be a_positionEnd\n {\n name: \"a_positionCoef\",\n size: 1,\n type: FLOAT\n }, {\n name: \"a_normalCoef\",\n size: 1,\n type: FLOAT\n }],\n CONSTANT_DATA: [[0, 1], [0, -1], [1, 0]]\n };\n }\n }, {\n key: \"processVisibleItem\",\n value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {\n var thickness = data.size || 1;\n var x1 = sourceData.x;\n var y1 = sourceData.y;\n var x2 = targetData.x;\n var y2 = targetData.y;\n var color = floatColor(data.color);\n\n // Computing normals\n var dx = x2 - x1;\n var dy = y2 - y1;\n var len = dx * dx + dy * dy;\n var n1 = 0;\n var n2 = 0;\n if (len) {\n len = 1 / Math.sqrt(len);\n n1 = -dy * len * thickness;\n n2 = dx * len * thickness;\n }\n var array = this.array;\n\n // First point\n array[startIndex++] = x1;\n array[startIndex++] = y1;\n array[startIndex++] = x2;\n array[startIndex++] = y2;\n array[startIndex++] = n1;\n array[startIndex++] = n2;\n array[startIndex++] = color;\n array[startIndex++] = edgeIndex;\n }\n }, {\n key: \"setUniforms\",\n value: function setUniforms(params, _ref) {\n var gl = _ref.gl,\n uniformLocations = _ref.uniformLocations;\n var u_matrix = uniformLocations.u_matrix,\n u_sizeRatio = uniformLocations.u_sizeRatio,\n u_correctionRatio = uniformLocations.u_correctionRatio,\n u_minEdgeThickness = uniformLocations.u_minEdgeThickness;\n gl.uniformMatrix3fv(u_matrix, false, params.matrix);\n gl.uniform1f(u_sizeRatio, params.sizeRatio);\n gl.uniform1f(u_correctionRatio, params.correctionRatio);\n gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);\n }\n }]);\n}(EdgeProgram);\n\nexport { DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS, EdgeDoubleArrowProgram$1 as EdgeDoubleArrowProgram, EdgeDoubleClampedProgram$1 as EdgeDoubleClampedProgram, EdgeLineProgram, EdgeTriangleProgram, NodePointProgram, createEdgeDoubleArrowProgram, createEdgeDoubleClampedProgram };\n"],
5
+ "mappings": "q2EA0BA,IAAIA,EAZJ,UAAA,CAGE,QAFMC,EAASC,UAAU,CAAA,EAEhBC,EAAI,EAAGC,EAAIF,UAAUG,OAAQF,EAAIC,EAAGD,IAC3C,GAAKD,UAAUC,CAAAA,EAEf,QAAWG,KAAKJ,UAAUC,CAAAA,EAAIF,EAAOK,CAAAA,EAAKJ,UAAUC,CAAAA,EAAGG,CAAAA,EAGzD,OAAOL,CACT,EAmBO,SAASM,EAAgBC,EAAOC,EAAQR,EAAQS,EAAAA,CACrD,IAAMC,EAAaH,EAAMI,OAAOC,IAAIJ,CAAAA,EAEhCK,EAAO,KAEX,OAAKH,EAGHG,EADEJ,IAAS,QAERC,EAAWI,KAAOJ,EAAWI,IAAId,CAAAA,GACjCU,EAAWK,YAAcL,EAAWK,WAAWf,CAAAA,EACzCS,IAAS,WACXC,EAAWI,KAAOJ,EAAWI,IAAId,CAAAA,EAEjCU,EAAWK,YAAcL,EAAWK,WAAWf,CAAAA,EAThCa,CAa1B,CAQ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",
6
+ "names": ["assign", "target", "arguments", "i", "l", "length", "k", "getMatchingEdge", "graph", "source", "type", "sourceData", "_nodes", "get", "edge", "out", "undirected", "isPlainObject", "value", "_typeof", "isEmpty", "o", "privateProperty", "name", "Object", "defineProperty", "enumerable", "configurable", "writable", "readOnlyProperty", "descriptor", "validateHints", "hints", "attributes", "Array", "isArray", "ReflectOwnKeys", "R", "Reflect", "ReflectApply", "apply", "receiver", "args", "Function", "prototype", "call", "ownKeys", "getOwnPropertySymbols", "getOwnPropertyNames", "concat", "NumberIsNaN", "Number", "isNaN", "EventEmitter", "init", "this", "eventsModule", "exports", "events", "once", "emitter", "Promise", "resolve", "reject", "errorListener", "err", "removeListener", "resolver", "slice", "eventTargetAgnosticAddListener", "handler", "flags", "on", "_events", "_eventsCount", "_maxListeners", "defaultMaxListeners", "checkListener", "listener", "TypeError", "_getMaxListeners", "that", "_addListener", "prepend", "m", "existing", "warning", "create", "newListener", "emit", "unshift", "push", "warned", "w", "Error", "String", "count", "console", "warn", "onceWrapper", "fired", "wrapFn", "_onceWrap", "state", "wrapped", "bind", "_listeners", "unwrap", "evlistener", "arr", "ret", "arrayClone", "listenerCount", "n", "copy", "addEventListener", "wrapListener", "arg", "removeEventListener", "Iterator", "next", "set", "RangeError", "getPrototypeOf", "setMaxListeners", "getMaxListeners", "doError", "error", "er", "message", "context", "len", "listeners", "addListener", "prependListener", "prependOnceListener", "list", "position", "originalListener", "shift", "index", "pop", "off", "removeAllListeners", "key", "keys", "rawListeners", "eventNames", "Symbol", "iterator", "Iterator$2", "of", "done", "empty", "fromSequence", "sequence", "is", "support", "ARRAY_BUFFER_SUPPORT", "ArrayBuffer", "SYMBOL_SUPPORT", "require$$0", "require$$1", "iter", "isView", "take", "iterable", "step", "Infinity", "array", "GraphError", "_Error", "_this", "_inheritsLoose", "_wrapNativeSuper", "InvalidArgumentsGraphError", "_GraphError", "_this2", "captureStackTrace", "constructor", "NotFoundGraphError", "_GraphError2", "_this3", "UsageGraphError", "_GraphError3", "_this4", "MixedNodeData", "clear", "DirectedNodeData", "UndirectedNodeData", "EdgeData", "inDegree", "outDegree", "undirectedDegree", "undirectedLoops", "directedLoops", "attach", "outKey", "inKey", "attachMulti", "adj", "head", "previous", "detach", "detachMulti", "findRelevantNodeData", "method", "mode", "nodeOrEdge", "nameOrEdge", "add1", "add2", "nodeData", "edgeData", "arg1", "arg2", "_edges", "NODE_ATTRIBUTES_METHODS", "element", "attacher", "Class", "_findRelevantNodeData", "data", "_findRelevantNodeData3", "hasOwnProperty", "_findRelevantNodeData4", "_findRelevantNodeData5", "updater", "_findRelevantNodeData6", "_findRelevantNodeData7", "_findRelevantNodeData8", "_findRelevantNodeData9", "EDGE_ATTRIBUTES_METHODS", "multi", "chain", "iterables", "current", "EDGES_ITERATION", "direction", "forEachSimple", "breakable", "object", "callback", "avoid", "shouldBreak", "forEachMulti", "createIterator", "sourceAttributes", "targetAttributes", "forEachForKeySimple", "targetData", "forEachForKeyMulti", "createIteratorForKey", "createEdgeArray", "size", "from", "undirectedSize", "directedSize", "mask", "values", "forEachEdge", "shouldFilter", "_data", "createEdgeIterator", "forEachEdgeForNode", "found", "fn", "createEdgeArrayForNode", "edges", "createEdgeIteratorForNode", "forEachEdgeForPath", "createEdgeArrayForPath", "createEdgeIteratorForPath", "NEIGHBORS_ITERATION", "CompositeSetWrapper", "A", "B", "forEachInObjectOnce", "visited", "neighborData", "has", "forEachNeighbor", "wrap", "createDedupedObjectIterator", "neighbor", "attachNeighborArrayCreator", "description", "node", "neighbors", "attachNeighborIteratorCreator", "iteratorName", "forEachAdjacency", "assymetric", "disconnectedNodes", "hasEdges", "validateSerializedNode", "validateSerializedEdge", "INSTANCE_ID", "Math", "floor", "random", "TYPES", "Set", "EMITTER_PROPS", "DEFAULTS", "allowSelfLoops", "unsafeAddNode", "NodeDataClass", "addEdge", "mustGenerateKey", "eventData", "_edgeKeyGenerator", "isSelfLoop", "_undirectedSelfLoopCount", "_directedSelfLoopCount", "_undirectedSize", "_directedSize", "mergeEdge", "asUpdater", "undefined", "alreadyExistingEdgeData", "info", "oldAttributes", "sourceWasAdded", "targetWasAdded", "dropEdgeFromData", "Graph", "_EventEmitter", "options", "_assertThisInitialized", "instancePrefix", "edgeId", "Map", "availableEdgeKey", "forEach", "prop", "_options", "_proto", "_resetInstanceCounters", "hasNode", "hasDirectedEdge", "hasUndirectedEdge", "hasEdge", "directedEdge", "undirectedEdge", "areDirectedNeighbors", "areOutNeighbors", "areInNeighbors", "areUndirectedNeighbors", "areNeighbors", "areInboundNeighbors", "areOutboundNeighbors", "directedDegree", "inboundDegree", "degree", "outboundDegree", "inDegreeWithoutSelfLoops", "outDegreeWithoutSelfLoops", "directedDegreeWithoutSelfLoops", "undirectedDegreeWithoutSelfLoops", "inboundDegreeWithoutSelfLoops", "loops", "outboundDegreeWithoutSelfLoops", "degreeWithoutSelfLoops", "extremities", "opposite", "hasExtremity", "isUndirected", "isDirected", "addNode", "mergeNode", "updateNode", "dropNode", "dropEdge", "dropDirectedEdge", "dropUndirectedEdge", "clearEdges", "getAttribute", "_attributes", "getAttributes", "hasAttribute", "setAttribute", "updateAttribute", "removeAttribute", "replaceAttributes", "mergeAttributes", "updateAttributes", "updateEachNodeAttributes", "updateEachEdgeAttributes", "forEachAdjacencyEntry", "forEachAdjacencyEntryWithOrphans", "forEachAssymetricAdjacencyEntry", "forEachAssymetricAdjacencyEntryWithOrphans", "nodes", "forEachNode", "findNode", "mapNodes", "result", "order", "someNode", "everyNode", "filterNodes", "reduceNodes", "initialValue", "accumulator", "nodeEntries", "serialized", "merge", "a", "e", "s", "t", "_sa", "_ta", "u", "mergeUndirectedEdgeWithKey", "mergeDirectedEdgeWithKey", "addUndirectedEdgeWithKey", "addDirectedEdgeWithKey", "_node", "undirectedByDefault", "_edge", "_edge$undirected", "mergeUndirectedEdge", "mergeDirectedEdge", "addUndirectedEdge", "addDirectedEdge", "nullCopy", "emptyCopy", "toJSON", "toString", "inspect", "multiIndex", "tmp", "label", "desc", "startsWith", "dummy", "verb", "generateKey", "_ref", "forEachName", "toUpperCase", "mapName", "ea", "sa", "ta", "filterName", "reduceName", "findEdgeName", "someName", "everyName", "originalName", "capitalizedSingular", "findName", "DirectedGraph", "_Graph", "finalOptions", "UndirectedGraph", "_Graph2", "MultiGraph", "_Graph3", "MultiDirectedGraph", "_Graph4", "MultiUndirectedGraph", "_Graph5", "attachStaticFromMethod", "instance", "require_is_graph", "__commonJSMin", "exports", "module", "value", "require_getters", "__commonJSMin", "exports", "coerceWeight", "value", "createNodeValueGetter", "nameOrFunction", "defaultValue", "getter", "coerceToDefault", "v", "get", "attributes", "returnDefault", "graph", "node", "createEdgeValueGetter", "edge", "extremities", "e", "a", "s", "t", "sa", "ta", "u", "name", "require_iterate", "__commonJSMin", "exports", "module", "NODE_X", "NODE_Y", "NODE_DX", "NODE_DY", "NODE_OLD_DX", "NODE_OLD_DY", "NODE_MASS", "NODE_CONVERGENCE", "NODE_SIZE", "NODE_FIXED", "EDGE_SOURCE", "EDGE_TARGET", "EDGE_WEIGHT", "REGION_NODE", "REGION_CENTER_X", "REGION_CENTER_Y", "REGION_SIZE", "REGION_NEXT_SIBLING", "REGION_FIRST_CHILD", "REGION_MASS", "REGION_MASS_CENTER_X", "REGION_MASS_CENTER_Y", "SUBDIVISION_ATTEMPTS", "PPN", "PPE", "PPR", "MAX_FORCE", "options", "NodeMatrix", "EdgeMatrix", "l", "r", "n", "n1", "n2", "rn", "e", "w", "g", "s", "order", "size", "adjustSizes", "thetaSquared", "outboundAttCompensation", "coefficient", "xDist", "yDist", "ewc", "distance", "factor", "RegionMatrix", "minX", "maxX", "minY", "maxY", "q2", "subdivisionAttempts", "dx", "dy", "force", "swinging", "traction", "nodespeed", "newX", "newY", "require_helpers", "__commonJSMin", "exports", "PPN", "PPE", "target", "objects", "i", "k", "l", "settings", "graph", "getEdgeWeight", "order", "size", "index", "j", "NodeMatrix", "EdgeMatrix", "node", "attr", "edge", "source", "sa", "ta", "u", "sj", "tj", "weight", "outputReducer", "nodes", "positions", "newAttr", "fn", "xURL", "code", "objectUrl", "worker", "require_defaults", "__commonJSMin", "exports", "module", "require_graphology_layout_forceatlas2", "__commonJSMin", "exports", "module", "isGraph", "createEdgeWeightGetter", "iterate", "helpers", "DEFAULT_SETTINGS", "abstractSynchronousLayout", "assign", "graph", "params", "iterations", "getEdgeWeight", "outputReducer", "settings", "validationError", "matrices", "i", "inferSettings", "order", "synchronousLayout", "require_events", "__commonJSMin", "exports", "module", "R", "ReflectApply", "target", "receiver", "args", "ReflectOwnKeys", "ProcessEmitWarning", "warning", "NumberIsNaN", "value", "EventEmitter", "once", "defaultMaxListeners", "checkListener", "listener", "arg", "n", "_getMaxListeners", "that", "type", "i", "doError", "events", "er", "err", "handler", "len", "listeners", "arrayClone", "_addListener", "prepend", "m", "existing", "w", "onceWrapper", "_onceWrap", "state", "wrapped", "list", "position", "originalListener", "spliceOne", "keys", "key", "_listeners", "unwrap", "evlistener", "unwrapListeners", "emitter", "listenerCount", "arr", "copy", "index", "ret", "name", "resolve", "reject", "errorListener", "resolver", "eventTargetAgnosticAddListener", "addErrorHandlerIfEventEmitter", "flags", "wrapListener", "import_graphology", "import_graphology_layout_forceatlas2", "_toPrimitive", "t", "r", "i", "_toPropertyKey", "_classCallCheck", "a", "n", "_defineProperties", "e", "o", "_createClass", "_getPrototypeOf", "_isNativeReflectConstruct", "_assertThisInitialized", "_possibleConstructorReturn", "_callSuper", "_setPrototypeOf", "_inherits", "_arrayWithHoles", "r", "_iterableToArrayLimit", "l", "t", "e", "i", "u", "a", "f", "o", "_arrayLikeToArray", "n", "_unsupportedIterableToArray", "_nonIterableRest", "_slicedToArray", "HTML_COLORS", "INT8", "INT32", "FLOAT32", "RGBA_TEST_REGEX", "RGBA_EXTRACT_REGEX", "parseColor", "val", "r", "g", "b", "a", "match", "FLOAT_COLOR_CACHE", "htmlColor", "HTML_COLORS", "floatColor", "rgbaToFloat", "masking", "parsed", "color", "FLOAT_INDEX_CACHE", "indexToColor", "index", "r", "g", "b", "a", "color", "rgbaToFloat", "colorToIndex", "_a", "getPixelColor", "gl", "frameBuffer", "x", "y", "pixelRatio", "downSizingRatio", "bufferX", "bufferY", "pixel", "_pixel", "_slicedToArray", "_defineProperty", "e", "r", "t", "_toPropertyKey", "ownKeys", "o", "_objectSpread2", "_superPropBase", "_getPrototypeOf", "_get", "p", "_superPropGet", "getAttributeItemsCount", "attr", "getAttributesItemsCount", "attrs", "res", "loadShader", "type", "gl", "source", "glType", "shader", "successfullyCompiled", "infoLog", "loadVertexShader", "loadFragmentShader", "loadProgram", "shaders", "program", "i", "l", "successfullyLinked", "killProgram", "_ref", "buffer", "vertexShader", "fragmentShader", "PICKING_PREFIX", "SIZE_FACTOR_PER_ATTRIBUTE_TYPE", "_defineProperty", "Program", "gl", "pickingBuffer", "renderer", "_classCallCheck", "_defineProperty", "def", "getAttributesItemsCount", "PICKING_PREFIX", "constantAttributesItemsCount", "i", "vector", "j", "_createClass", "killProgram", "name", "vertexShaderSource", "fragmentShaderSource", "frameBuffer", "buffer", "vertexShader", "loadVertexShader", "fragmentShader", "loadFragmentShader", "program", "loadProgram", "uniformLocations", "uniformName", "location", "attributeLocations", "attr", "constantBuffer", "_this", "offset", "_this2", "setDivisor", "sizeFactor", "SIZE_FACTOR_PER_ATTRIBUTE_TYPE", "stride", "ext", "unsetDivisor", "capacity", "params", "programInfo", "_objectSpread2", "method", "_ref", "NodeProgram", "_ref", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "_superPropGet", "nodeIndex", "offset", "data", "i", "l", "indexToColor", "Program", "EdgeProgram", "_ref", "_this", "_classCallCheck", "_len", "args", "_key", "_callSuper", "_defineProperty", "_inherits", "_createClass", "_superPropGet", "edgeIndex", "offset", "sourceData", "targetData", "data", "i", "l", "indexToColor", "Program", "createEdgeCompoundProgram", "programClasses", "drawLabel", "EdgeCompoundProgram", "gl", "pickingBuffer", "renderer", "capacity", "program", "params", "drawStraightEdgeLabel", "context", "edgeData", "settings", "size", "font", "weight", "color", "label", "sSize", "tSize", "sx", "sy", "tx", "ty", "cx", "cy", "dx", "dy", "d", "textLength", "ellipsis", "angle", "drawDiscNodeLabel", "drawDiscNodeHover", "PADDING", "textWidth", "boxWidth", "boxHeight", "radius", "angleRadian", "xDeltaCoord", "SHADER_SOURCE$6", "FRAGMENT_SHADER_SOURCE$2", "SHADER_SOURCE$5", "VERTEX_SHADER_SOURCE$3", "_WebGLRenderingContex$3", "UNSIGNED_BYTE$3", "FLOAT$3", "UNIFORMS$3", "NodeCircleProgram", "_NodeProgram", "nodeIndex", "startIndex", "array", "floatColor", "uniformLocations", "u_sizeRatio", "u_correctionRatio", "u_matrix", "NodeProgram", "SHADER_SOURCE$4", "FRAGMENT_SHADER_SOURCE$1", "SHADER_SOURCE$3", "VERTEX_SHADER_SOURCE$2", "_WebGLRenderingContex$2", "UNSIGNED_BYTE$2", "FLOAT$2", "UNIFORMS$2", "DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS", "createEdgeArrowHeadProgram", "inputOptions", "options", "_objectSpread2", "_EdgeProgram", "EdgeArrowHeadProgram", "thickness", "x1", "y1", "x2", "y2", "len", "n1", "n2", "_ref2", "u_minEdgeThickness", "u_lengthToThicknessRatio", "u_widenessToThicknessRatio", "SHADER_SOURCE$2", "FRAGMENT_SHADER_SOURCE", "SHADER_SOURCE$1", "VERTEX_SHADER_SOURCE$1", "_WebGLRenderingContex$1", "UNSIGNED_BYTE$1", "FLOAT$1", "UNIFORMS$1", "DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS", "DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS", "createEdgeClampedProgram", "inputOptions", "options", "_objectSpread2", "_EdgeProgram", "EdgeClampedProgram", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "edgeIndex", "startIndex", "sourceData", "targetData", "data", "thickness", "x1", "y1", "x2", "y2", "color", "floatColor", "dx", "dy", "radius", "len", "n1", "n2", "array", "params", "_ref", "gl", "uniformLocations", "u_matrix", "u_zoomRatio", "u_feather", "u_pixelRatio", "u_correctionRatio", "u_sizeRatio", "u_minEdgeThickness", "u_lengthToThicknessRatio", "EdgeProgram", "createEdgeArrowProgram", "inputOptions", "createEdgeCompoundProgram", "createEdgeClampedProgram", "createEdgeArrowHeadProgram", "EdgeArrowProgram", "EdgeArrowProgram$1", "SHADER_SOURCE", "VERTEX_SHADER_SOURCE", "_WebGLRenderingContex", "UNSIGNED_BYTE", "FLOAT", "UNIFORMS", "EdgeRectangleProgram", "_EdgeProgram", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "FRAGMENT_SHADER_SOURCE", "edgeIndex", "startIndex", "sourceData", "targetData", "data", "thickness", "x1", "y1", "x2", "y2", "color", "floatColor", "dx", "dy", "len", "n1", "n2", "array", "params", "_ref", "gl", "uniformLocations", "u_matrix", "u_zoomRatio", "u_feather", "u_pixelRatio", "u_correctionRatio", "u_sizeRatio", "u_minEdgeThickness", "EdgeProgram", "import_events", "TypedEventEmitter", "_ref", "_this", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "import_is_graph", "linear", "k", "quadraticIn", "quadraticOut", "quadraticInOut", "cubicIn", "cubicOut", "cubicInOut", "easings", "ANIMATE_DEFAULTS", "identity", "scale", "m", "x", "y", "rotate", "r", "s", "c", "translate", "multiply", "a", "b", "a00", "a01", "a02", "a10", "a11", "a12", "a20", "a21", "a22", "b00", "b01", "b02", "b10", "b11", "b12", "b20", "b21", "b22", "multiplyVec2", "z", "b0", "b1", "getCorrectionRatio", "viewportDimensions", "graphDimensions", "viewportRatio", "graphRatio", "matrixFromCamera", "state", "padding", "inverse", "angle", "ratio", "width", "height", "matrix", "smallestDimension", "correctionRatio", "getMatrixImpact", "cameraState", "_multiplyVec", "graphExtent", "graph", "xMin", "xMax", "yMin", "yMax", "_", "attr", "validateGraph", "isGraph", "key", "attributes", "createElement", "tag", "style", "element", "k", "_k", "getPixelRatio", "zIndexOrdering", "_extent", "getter", "elements", "zA", "zB", "createNormalizationFunction", "extent", "_extent$x", "_slicedToArray", "minX", "maxX", "_extent$y", "minY", "maxY", "dX", "dY", "fn", "data", "_typeof", "o", "extend", "array", "values", "l2", "l1", "i", "value", "assign", "target", "i", "l", "o", "DEFAULT_SETTINGS", "drawStraightEdgeLabel", "drawDiscNodeLabel", "drawDiscNodeHover", "DEFAULT_NODE_PROGRAM_CLASSES", "NodeCircleProgram", "DEFAULT_EDGE_PROGRAM_CLASSES", "EdgeArrowProgram$1", "EdgeRectangleProgram", "validateSettings", "settings", "minCameraRatio", "maxCameraRatio", "resolveSettings", "resolvedSettings", "assign", "import_events", "import_is_graph", "DEFAULT_ZOOMING_RATIO", "Camera", "_TypedEventEmitter", "_this", "_classCallCheck", "_callSuper", "_defineProperty", "_inherits", "_createClass", "state", "ratio", "r", "validatedState", "_objectSpread2", "validState", "updater", "_this2", "opts", "callback", "resolve", "options", "ANIMATE_DEFAULTS", "easing", "easings", "start", "initialState", "_fn", "t", "coefficient", "newState", "factorOrOptions", "camera", "TypedEventEmitter", "getPosition", "e", "dom", "bbox", "getMouseCoords", "res", "cleanMouseCoords", "getWheelCoords", "getWheelDelta", "MAX_TOUCHES", "getTouchesArray", "touches", "arr", "i", "l", "getTouchCoords", "previousTouches", "touch", "Captor", "container", "renderer", "MOUSE_SETTINGS_KEYS", "DEFAULT_MOUSE_SETTINGS", "iter", "key", "DEFAULT_SETTINGS", "MouseCaptor", "_Captor", "mouseCoords", "newRatio", "_getPosition", "x", "y", "_this3", "_getPosition2", "cameraState", "previousCameraState", "shouldRefresh", "_this4", "_getPosition3", "eX", "eY", "lastMouse", "mouse", "offsetX", "offsetY", "_this5", "delta", "wheelCoords", "currentRatio", "ratioDiff", "wheelDirection", "now", "settings", "TOUCH_SETTINGS_KEYS", "DEFAULT_TOUCH_SETTINGS", "TouchCaptor", "_this$startTouchesPos", "_slicedToArray", "_this$startTouchesPos2", "x0", "y0", "_this$startTouchesPos3", "x1", "y1", "position", "downPosition", "dSquare", "touchCoords", "_camera", "_touchCoords", "touchesPositions", "lastTouches", "idx", "startPosition", "startCameraState", "padding", "_this$renderer$viewpo", "xStart", "yStart", "_this$renderer$viewpo2", "newCameraState", "_touchesPositions$", "_touchesPositions$2", "angleDiff", "dimensions", "touchGraphPosition", "smallestDimension", "dx", "dy", "_x", "_y", "_ref", "_arrayWithoutHoles", "_arrayLikeToArray", "_iterableToArray", "_nonIterableSpread", "_toConsumableArray", "_unsupportedIterableToArray", "_objectWithoutPropertiesLoose", "n", "_objectWithoutProperties", "o", "LabelCandidate", "size", "first", "second", "LabelGrid", "cellSize", "pos", "xIndex", "yIndex", "candidate", "index", "cell", "k", "density", "cellArea", "scaledCellArea", "scaledDensity", "labelsToDisplayPerCell", "labels", "edgeLabelsToDisplayFromNodes", "params", "graph", "hoveredNode", "highlightedNodes", "displayedNodeLabels", "worthyEdges", "edge", "_", "source", "target", "X_LABEL_MARGIN", "Y_LABEL_MARGIN", "hasOwnProperty", "applyNodeDefaults", "data", "applyEdgeDefaults", "_key", "Sigma$1", "Sigma", "identity", "createNormalizationFunction", "getPixelRatio", "resolveSettings", "validateSettings", "validateGraph", "type", "_type", "NodeProgramClass", "NodeHoverProgram", "EdgeProgramClass", "_this$nodePrograms", "program", "programs", "_toPropertyKey", "_this$nodeHoverProgra", "_program", "_programs", "_this$edgePrograms", "id", "gl", "frameBuffer", "currentTexture", "pickingTexture", "color", "getPixelColor", "colorToIndex", "itemAt", "event", "baseEvent", "nodeToHover", "node", "edgeToHover", "createInteractionListener", "eventType", "nodeAtPosition", "LAYOUT_IMPACTING_FIELDS", "_e$hints", "updatedFields", "layoutChanged", "f", "_e$hints2", "payload", "graphExtent", "width", "height", "_this$nodeExtent", "nullCamera", "nullCameraMatrix", "matrixFromCamera", "nodesPerPrograms", "nodeIndices", "edgeIndices", "itemIDsIndex", "incrID", "nodes", "attrs", "zIndexOrdering", "_i", "_l", "_node", "_data", "edgesPerPrograms", "edges", "_i2", "_l2", "_data2", "_type2", "_i3", "_l3", "_edge", "_data3", "oldSettings", "_this6", "_typeof", "_type3", "_type4", "_type5", "_ref$tolerance", "tolerance", "boundaries", "_ref2", "_ref2$x", "xMinGraph", "xMaxGraph", "_ref2$y", "yMinGraph", "yMaxGraph", "corners", "xMin", "xMax", "yMin", "yMax", "_ref3", "graphWidth", "graphHeight", "_this$getDimensions", "origin", "labelsToDisplay", "extend", "context", "_this$framedGraphToVi", "defaultDrawNodeLabel", "nodeProgram", "drawLabel", "edgeLabelsToDisplay", "displayedLabels", "extremities", "sourceData", "targetData", "edgeData", "defaultDrawEdgeLabel", "edgeProgram", "_this7", "render", "_this7$framedGraphToV", "defaultDrawNodeHover", "drawHover", "nodesToRender", "renderParams", "_type6", "_this8", "_this9", "exitRender", "layer", "mouseCaptor", "moving", "viewportDimensions", "graphDimensions", "getMatrixImpact", "_type7", "_program2", "attr", "fingerprint", "_this$settings", "stagePadding", "autoRescale", "tag", "element", "createElement", "canvas", "contextOptions", "newFrameBuffer", "_gl$getExtension", "extent", "value", "oldValues", "force", "previousWidth", "previousHeight", "_id", "_id2", "_this10", "skipIndexation", "schedule", "fullRefresh", "_opts$partialGraph", "_opts$partialGraph2", "programIndex", "_i4", "_l4", "_programIndex", "_this11", "viewportTarget", "_this$camera$getState", "angle", "_this$settings2", "minCameraRatio", "maxCameraRatio", "center", "graphMousePosition", "graphCenterPosition", "p1", "p2", "h", "coordinates", "override", "recomputeMatrix", "matrix", "viewportPos", "multiplyVec2", "invMatrix", "viewportPoint", "graphPoint", "graphP1", "graphP2", "graphD", "viewportP1", "viewportP2", "viewportD", "customBBox", "_type8", "_type9", "cameraRatio", "_WebGLRenderingContex$3", "UNSIGNED_BYTE$3", "FLOAT$3", "SHADER_SOURCE$4", "VERTEX_SHADER_SOURCE$2", "_WebGLRenderingContex$2", "UNSIGNED_BYTE$2", "FLOAT$2", "UNIFORMS$2", "DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS", "DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS", "createEdgeDoubleClampedProgram", "inputOptions", "options", "_objectSpread2", "_EdgeProgram", "EdgeDoubleClampedProgram", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "FRAGMENT_SHADER_SOURCE", "edgeIndex", "startIndex", "sourceData", "targetData", "data", "thickness", "x1", "y1", "x2", "y2", "color", "floatColor", "dx", "dy", "sourceRadius", "targetRadius", "len", "n1", "n2", "array", "params", "_ref", "gl", "uniformLocations", "u_matrix", "u_zoomRatio", "u_feather", "u_pixelRatio", "u_correctionRatio", "u_sizeRatio", "u_minEdgeThickness", "u_lengthToThicknessRatio", "EdgeProgram", "createEdgeDoubleArrowProgram", "inputOptions", "createEdgeCompoundProgram", "createEdgeDoubleClampedProgram", "createEdgeArrowHeadProgram", "_objectSpread2", "EdgeDoubleArrowProgram", "SHADER_SOURCE$3", "FRAGMENT_SHADER_SOURCE$1", "SHADER_SOURCE$2", "VERTEX_SHADER_SOURCE$1", "_WebGLRenderingContex$1", "UNSIGNED_BYTE$1", "FLOAT$1", "UNIFORMS$1", "EdgeLineProgram", "_EdgeProgram", "_classCallCheck", "_callSuper", "_inherits", "_createClass", "edgeIndex", "startIndex", "sourceData", "targetData", "data", "array", "x1", "y1", "x2", "y2", "color", "floatColor", "params", "_ref", "gl", "uniformLocations", "u_matrix", "EdgeProgram", "_WebGLRenderingContex", "UNSIGNED_BYTE", "FLOAT", "WELL_KNOWN_PATH", "DEFAULT_CONFIG", "isNode", "v", "isEdge", "isGraphGardenFile", "value", "obj", "site", "buildGraph", "file", "config", "graph", "Graph", "node", "absoluteUrl", "edge", "absoluteSource", "absoluteTarget", "edgeColor", "assignLayout", "iterations", "forceAtlas2", "fetchFriendGraphs", "origins", "_edge", "attributes", "_source", "target", "results", "origin", "response", "data", "result", "friendFile", "error", "GraphGarden", "shadow", "style", "css", "prop", "fallback", "attr", "name", "raw", "n", "Sigma", "EdgeLineProgram"]
7
+ }