/*
  Default comparison function to be used
   */

/*
  Fast version of a heappush followed by a heappop.
   */

/*
  Find the n largest elements in a dataset.
   */

/*
  Find the n smallest elements in a dataset.
   */

/*
  Insert item x in list a, and keep it sorted assuming a is sorted.
  
  If x is already in a, insert it to the right of the rightmost x.
  
  Optional args lo (default 0) and hi (default a.length) bound the slice
  of a to be searched.
   */

/*
  Pop and return the current smallest value, and add the new item.
  
  This is more efficient than heappop() followed by heappush(), and can be
  more appropriate when using a fixed size heap. Note that the value
  returned may be larger than item! That constrains reasonable use of
  this routine unless written as part of a conditional replacement:
      if item > array[0]
        item = heapreplace(array, item)
   */

/*
  Pop the smallest item off the heap, maintaining the heap invariant.
   */

/*
  Push item onto heap, maintaining the heap invariant.
   */

/*
  Transform list into a heap, in-place, in O(array.length) time.
   */

/*
  Update the position of the given item in the heap.
  This function should be called every time the item is being modified.
   */

/*  "The then Method" [Promises/A+ 1.1, 1.2, 2.2]  */

/*  [Promises/A+ 1.3, 2.1.2.2]  */

/*  [Promises/A+ 1.5, 2.1.3.2]  */

/*  [Promises/A+ 2.1.1]  */

/*  [Promises/A+ 2.1.2.1, 2.1.3.1]  */

/*  [Promises/A+ 2.1.2.2, 2.1.3.2]  */

/*  [Promises/A+ 2.2.1, 2.2.7.3, 2.2.7.4]  */

/*  [Promises/A+ 2.2.2.1, 2.2.3.1, 2.2.5, 3.2]  */

/*  [Promises/A+ 2.2.2.3, 2.2.3.3]  */

/*  [Promises/A+ 2.2.2/2.2.6]  */

/*  [Promises/A+ 2.2.3/2.2.6]  */

/*  [Promises/A+ 2.2.4, 3.1]  */

/*  [Promises/A+ 2.2.5]  */

/*  [Promises/A+ 2.2.7, 3.3]  */

/*  [Promises/A+ 2.2.7.2]  */

/*  [Promises/A+ 2.2.7.3, 2.2.7.4]  */

/*  [Promises/A+ 2.2.7]  */

/*  [Promises/A+ 2.3.1]  */

/*  [Promises/A+ 2.3.3.1, 3.5]  */

/*  [Promises/A+ 2.3.3.2]  */

/*  [Promises/A+ 2.3.3.3.1]  */

/*  [Promises/A+ 2.3.3.3.2]  */

/*  [Promises/A+ 2.3.3.3.3]  */

/*  [Promises/A+ 2.3.3.3.4]  */

/*  [Promises/A+ 2.3.3.3]  */

/*  [Promises/A+ 2.3.4, 2.3.3.4]  */

/*  [Promises/A+ 3.6]  */

/*  call retrieved "then" method */

/*  deliver an action  */

/*  execute all handlers  */

/*  execute procedure asynchronously  */

/*  handle other values  */

/*  handle own Thenables    [Promises/A+ 2.3.2]
    and similar "thenables" [Promises/A+ 2.3.3]  */

/*  initial handlers  */

/*  initial reason */

/*  initial state  */

/*  initial value  */

/*  initialize object  */

/*  iterate over all handlers, exactly once  */

/*  optionally support non-constructor/plain-function call  */

/*  promise API methods  */

/*  promise resolving methods  */

/*  promise states [Promises/A+ 2.1]  */

/*  provide optional information-hiding proxy  */

/*  rejectPromise  */

/*  resolvePromise  */

/*  sanity check arguments  */

/*  short-circuit processing  */

/*  support optional executor function  */

/*  surgically check for a "then" method
    (mainly to just call the "getter" of "then" only once)  */

/* . */

/* Arguments must be numbers. */

/* Built-in method references that are verified to be native. */

/* Calculate the actual time it takes for this animation to complete with the provided conditions. */

/* Compute the adjusted time delta. */

/* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass
   then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */

/* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the
       computed path and returns a snapshot of the position according to a given percentComplete. */

/* Must contain four arguments. */

/* Next/step function .*/

/* Run the simulation without a duration. */

/* Store the position. */

/* X values must be in the [0, 1] range. */

/* eslint-disable no-console */

/* eslint-disable no-unused-vars */

/* eslint-enable */

/* global Float32Array */

/* global Path2D */

/* global atob, ArrayBuffer, Uint8Array, Blob */

/* global document */

/* global document, window, ResizeObserver, MutationObserver */

/* global setImmediate: true */

/* global setTimeout: true */

/* placeholders */

/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/

/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */

/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */

/*#__PURE__*/

/**
 *  Elements are drawn in a specific order based on compound depth (low to high), the element type (nodes above edges),
 *  and z-index (low to high).  These styles affect how this applies:
 *
 *  z-compound-depth: May be `bottom | orphan | auto | top`.  The first drawn is `bottom`, then `orphan` which is the
 *      same depth as the root of the compound graph, followed by the default value `auto` which draws in order from
 *      root to leaves of the compound graph.  The last drawn is `top`.
 *  z-index-compare: May be `auto | manual`.  The default value is `auto` which always draws edges under nodes.
 *      `manual` ignores this convention and draws based on the `z-index` value setting.
 *  z-index: An integer value that affects the relative draw order of elements.  In general, an element with a higher
 *      `z-index` will be drawn on top of an element with a lower `z-index`.
 */

/**
 * @brief       : constructor
 * @arg options : object containing layout options
 */

/**
 * @brief     : Creates an object which is contains all the data
 *              used in the layout process
 * @arg cy    : cytoscape.js object
 * @return    : layoutInfo object initialized
 */

/**
 * @brief :  default layout options
 */

/**
 * @brief : This function finds the index of the lowest common
 *          graph ancestor between 2 nodes in the subtree
 *          (from the graph hierarchy induced tree) whose
 *          root is graphIx
 *
 * @arg node1: node1's ID
 * @arg node2: node2's ID
 * @arg layoutInfo: layoutInfo object
 *
 */

/**
 * @brief : called on continuous layouts to stop them before they finish
 */

/**
 * @brief : runs the layout
 */

/**
 * A check type enum-like object.  Uses integer values for fast match() lookup.
 * The ordering does not matter as long as the ints are unique.
 */

/**
 * A specialized version of `_.map` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the new mapped array.
 */

/**
 * A specialized version of `_.memoize` which clears the memoized function's
 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
 *
 * @private
 * @param {Function} func The function to have its output memoized.
 * @returns {Function} Returns the new memoized function.
 */

/**
 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the raw `toStringTag`.
 */

/**
 * Assigns `value` to `key` of `object` if the existing value is not equivalent
 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * for equality comparisons.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {string} key The key of the property to assign.
 * @param {*} value The value to assign.
 */

/**
 * Casts `value` to a path array if it's not one.
 *
 * @private
 * @param {*} value The value to inspect.
 * @param {Object} [object] The object to query keys on.
 * @returns {Array} Returns the cast property path array.
 */

/**
 * Checks if `func` has its source masked.
 *
 * @private
 * @param {Function} func The function to check.
 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
 */

/**
 * Checks if `value` is a property name and not a property path.
 *
 * @private
 * @param {*} value The value to check.
 * @param {Object} [object] The object to query keys on.
 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
 */

/**
 * Checks if `value` is a valid array-like index.
 *
 * @private
 * @param {*} value The value to check.
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
 */

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @example
 *
 * _.isFunction(_);
 * // => true
 *
 * _.isFunction(/abc/);
 * // => false
 */

/**
 * Checks if `value` is classified as a `Symbol` primitive or object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 * @example
 *
 * _.isSymbol(Symbol.iterator);
 * // => true
 *
 * _.isSymbol('abc');
 * // => false
 */

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */

/**
 * Checks if `value` is suitable for use as unique object key.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
 */

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */

/**
 * Checks if a hash value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Hash
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Checks if a list cache value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf ListCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Checks if a map value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf MapCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */

/**
 * Consume all the leading whitespace
 * @param {string} remaining The text to consume
 * @returns The text with the leading whitespace removed
 */

/**
 * Converts `func` to its source code.
 *
 * @private
 * @param {Function} func The function to convert.
 * @returns {string} Returns the source code.
 */

/**
 * Converts `value` to a number.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to process.
 * @returns {number} Returns the number.
 * @example
 *
 * _.toNumber(3.2);
 * // => 3.2
 *
 * _.toNumber(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toNumber(Infinity);
 * // => Infinity
 *
 * _.toNumber('3.2');
 * // => 3.2
 */

/**
 * Converts `value` to a property path array.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Util
 * @param {*} value The value to convert.
 * @returns {Array} Returns the new property path array.
 * @example
 *
 * _.toPath('a.b.c');
 * // => ['a', 'b', 'c']
 *
 * _.toPath('a[0].b.c');
 * // => ['a', '0', 'b', 'c']
 */

/**
 * Converts `value` to a string key if it's not a string or symbol.
 *
 * @private
 * @param {*} value The value to inspect.
 * @returns {string|symbol} Returns the key.
 */

/**
 * Converts `value` to a string using `Object.prototype.toString`.
 *
 * @private
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 */

/**
 * Converts `value` to a string. An empty string is returned for `null`
 * and `undefined` values. The sign of `-0` is preserved.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to convert.
 * @returns {string} Returns the converted string.
 * @example
 *
 * _.toString(null);
 * // => ''
 *
 * _.toString(-0);
 * // => '-0'
 *
 * _.toString([1, 2, 3]);
 * // => '1,2,3'
 */

/**
 * Copies the values of `source` to `array`.
 *
 * @private
 * @param {Array} source The array to copy values from.
 * @param {Array} [array=[]] The array to copy values to.
 * @returns {Array} Returns `array`.
 */

/**
 * Copyright (c) 2016-2022, The Cytoscape Consortium.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the “Software”), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/**
 * Creates a debounced function that delays invoking `func` until after `wait`
 * milliseconds have elapsed since the last time the debounced function was
 * invoked. The debounced function comes with a `cancel` method to cancel
 * delayed `func` invocations and a `flush` method to immediately invoke them.
 * Provide `options` to indicate whether `func` should be invoked on the
 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
 * with the last arguments provided to the debounced function. Subsequent
 * calls to the debounced function return the result of the last `func`
 * invocation.
 *
 * **Note:** If `leading` and `trailing` options are `true`, `func` is
 * invoked on the trailing edge of the timeout only if the debounced function
 * is invoked more than once during the `wait` timeout.
 *
 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
 *
 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
 * for details over the differences between `_.debounce` and `_.throttle`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to debounce.
 * @param {number} [wait=0] The number of milliseconds to delay.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=false]
 *  Specify invoking on the leading edge of the timeout.
 * @param {number} [options.maxWait]
 *  The maximum time `func` is allowed to be delayed before it's invoked.
 * @param {boolean} [options.trailing=true]
 *  Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new debounced function.
 * @example
 *
 * // Avoid costly calculations while the window size is in flux.
 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
 *
 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
 * jQuery(element).on('click', _.debounce(sendMail, 300, {
 *   'leading': true,
 *   'trailing': false
 * }));
 *
 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
 * var source = new EventSource('/stream');
 * jQuery(source).on('message', debounced);
 *
 * // Cancel the trailing debounced invocation.
 * jQuery(window).on('popstate', debounced.cancel);
 */

/**
 * Creates a function that memoizes the result of `func`. If `resolver` is
 * provided, it determines the cache key for storing the result based on the
 * arguments provided to the memoized function. By default, the first argument
 * provided to the memoized function is used as the map cache key. The `func`
 * is invoked with the `this` binding of the memoized function.
 *
 * **Note:** The cache is exposed as the `cache` property on the memoized
 * function. Its creation may be customized by replacing the `_.memoize.Cache`
 * constructor with one whose instances implement the
 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to have its output memoized.
 * @param {Function} [resolver] The function to resolve the cache key.
 * @returns {Function} Returns the new memoized function.
 * @example
 *
 * var object = { 'a': 1, 'b': 2 };
 * var other = { 'c': 3, 'd': 4 };
 *
 * var values = _.memoize(_.values);
 * values(object);
 * // => [1, 2]
 *
 * values(other);
 * // => [3, 4]
 *
 * object.a = 2;
 * values(object);
 * // => [1, 2]
 *
 * // Modify the result cache.
 * values.cache.set(object, ['a', 'b']);
 * values(object);
 * // => ['a', 'b']
 *
 * // Replace `_.memoize.Cache`.
 * _.memoize.Cache = WeakMap;
 */

/**
 * Creates a hash object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Creates a map cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Creates an list cache object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */

/**
 * Gets the data for `map`.
 *
 * @private
 * @param {Object} map The map to query.
 * @param {string} key The reference key.
 * @returns {*} Returns the map data.
 */

/**
 * Gets the hash value for `key`.
 *
 * @private
 * @name get
 * @memberOf Hash
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the index at which the `key` is found in `array` of key-value pairs.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {*} key The key to search for.
 * @returns {number} Returns the index of the matched value, else `-1`.
 */

/**
 * Gets the list cache value for `key`.
 *
 * @private
 * @name get
 * @memberOf ListCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the map value for `key`.
 *
 * @private
 * @name get
 * @memberOf MapCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */

/**
 * Gets the native function at `key` of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {string} key The key of the method to get.
 * @returns {*} Returns the function if it's native, else `undefined`.
 */

/**
 * Gets the timestamp of the number of milliseconds that have elapsed since
 * the Unix epoch (1 January 1970 00:00:00 UTC).
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Date
 * @returns {number} Returns the timestamp.
 * @example
 *
 * _.defer(function(stamp) {
 *   console.log(_.now() - stamp);
 * }, _.now());
 * // => Logs the number of milliseconds it took for the deferred invocation.
 */

/**
 * Gets the value at `key` of `object`.
 *
 * @private
 * @param {Object} [object] The object to query.
 * @param {string} key The key of the property to get.
 * @returns {*} Returns the property value.
 */

/**
 * Gets the value at `path` of `object`. If the resolved value is
 * `undefined`, the `defaultValue` is returned in its place.
 *
 * @static
 * @memberOf _
 * @since 3.7.0
 * @category Object
 * @param {Object} object The object to query.
 * @param {Array|string} path The path of the property to get.
 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
 * @returns {*} Returns the resolved value.
 * @example
 *
 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
 *
 * _.get(object, 'a[0].b.c');
 * // => 3
 *
 * _.get(object, ['a', '0', 'b', 'c']);
 * // => 3
 *
 * _.get(object, 'a.b.c', 'default');
 * // => 'default'
 */

/**
 * Make a new query object
 *
 * @prop type {Type} The type enum (int) of the query
 * @prop checks List of checks to make against an ele to test for a match
 */

/**
 * Of all the expressions, find the first match in the remaining text.
 * @param {string} remaining The remaining text to parse
 * @returns The matched expression and the newly remaining text `{ expr, match, name, remaining }`
 */

/**
 * Performs a
 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * comparison between two values to determine if they are equivalent.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * var object = { 'a': 1 };
 * var other = { 'a': 1 };
 *
 * _.eq(object, object);
 * // => true
 *
 * _.eq(object, other);
 * // => false
 *
 * _.eq('a', 'a');
 * // => true
 *
 * _.eq('a', Object('a'));
 * // => false
 *
 * _.eq(NaN, NaN);
 * // => true
 */

/**
 * Removes `key` and its value from the hash.
 *
 * @private
 * @name delete
 * @memberOf Hash
 * @param {Object} hash The hash to modify.
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes `key` and its value from the list cache.
 *
 * @private
 * @name delete
 * @memberOf ListCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes `key` and its value from the map.
 *
 * @private
 * @name delete
 * @memberOf MapCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */

/**
 * Removes all key-value entries from the hash.
 *
 * @private
 * @name clear
 * @memberOf Hash
 */

/**
 * Removes all key-value entries from the list cache.
 *
 * @private
 * @name clear
 * @memberOf ListCache
 */

/**
 * Removes all key-value entries from the map.
 *
 * @private
 * @name clear
 * @memberOf MapCache
 */

/**
 * Sets the hash `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Hash
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the hash instance.
 */

/**
 * Sets the list cache `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf ListCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the list cache instance.
 */

/**
 * Sets the map `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf MapCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the map cache instance.
 */

/**
 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
 * it's created. Arrays are created for missing index properties while objects
 * are created for all other missing properties. Use `_.setWith` to customize
 * `path` creation.
 *
 * **Note:** This method mutates `object`.
 *
 * @static
 * @memberOf _
 * @since 3.7.0
 * @category Object
 * @param {Object} object The object to modify.
 * @param {Array|string} path The path of the property to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns `object`.
 * @example
 *
 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
 *
 * _.set(object, 'a[0].b.c', 4);
 * console.log(object.a[0].b.c);
 * // => 4
 *
 * _.set(object, ['x', '0', 'y', 'z'], 5);
 * console.log(object.x[0].y.z);
 * // => 5
 */

/**
 * The base implementation of `_.get` without support for default values.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Array|string} path The path of the property to get.
 * @returns {*} Returns the resolved value.
 */

/**
 * The base implementation of `_.isNative` without bad shim checks.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a native function,
 *  else `false`.
 */

/**
 * The base implementation of `_.set`.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {Array|string} path The path of the property to set.
 * @param {*} value The value to set.
 * @param {Function} [customizer] The function to customize path creation.
 * @returns {Object} Returns `object`.
 */

/**
 * The base implementation of `_.toString` which doesn't convert nullish
 * values to empty strings.
 *
 * @private
 * @param {*} value The value to process.
 * @returns {string} Returns the string.
 */

/**
 * The base implementation of `_.trim`.
 *
 * @private
 * @param {string} string The string to trim.
 * @returns {string} Returns the trimmed string.
 */

/**
 * The base implementation of `assignValue` and `assignMergeValue` without
 * value checks.
 *
 * @private
 * @param {Object} object The object to modify.
 * @param {string} key The key of the property to assign.
 * @param {*} value The value to assign.
 */

/**
 * The base implementation of `getTag` without fallbacks for buggy environments.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */

/**
 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
 * character of `string`.
 *
 * @private
 * @param {string} string The string to inspect.
 * @returns {number} Returns the index of the last non-whitespace character.
 */

/**
 * Used to match `RegExp`
 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
 */

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */

/** Built-in value references. */

/** Detect free variable `global` from Node.js. */

/** Detect free variable `self`. */

/** Error message constants. */

/** Used as references for various `Number` constants. */

/** Used as the maximum memoize cache size. */

/** Used for built-in method references. */

/** Used to detect methods masquerading as native. */

/** Used to detect overreaching core-js shims. */

/** Used to detect unsigned integer values. */

/** Used to match a single whitespace character. */

/** Used to match leading whitespace. */

/** Used to match property names within property paths. */

/** Used to resolve the decompiled source of functions. */

/** Used to stand-in for `undefined` hash values. */

/** `Object#toString` result references. */

/** power **/

/** r **/

/***/

/*, conf*/

/*, eventObj*/

/*, extent*/

/*, listener, eventObj*/

//

//    console.log("base: " + basePoints);

//   ". OffsetX: " + offX + ". OffsetY: " + offY;

//   context.fillStyle = cache.fillStyle = fillStyle;

//   context.strokeStyle = cache.strokeStyle = strokeStyle;

//   tentative gScore is less than previous value

//   w not present in openSet

//  ". Depth: " + depth);

//  ". Index: " + lca + " Contents: " + lcaGraph.toString() +

//  return a random number or 4

// "Node centrality in weighted networks: Generalizing degree and shortest paths"

// #1582 safari doesn't load data uris with crossOrigin properly

// 'Give me everything from this box'

// 'core' is a special case and does not need a selector

// 'end' : Animate with the end result, from the initial positions to the end positions

// 'manual'

// 'orphan'

// (Coefficients are divided by 4)

// (and a request for recalc may come in between frames)

// (could be removed in a future major version)

// (disable eslint for next line as this serves as example layout code to external developers)

// (i.e. `left`, `auto`, etc)

// (i.e. there is an ele in between the eles in the layer)

// (may be removing more than specified due to connected edges etc)

// (otherwise intersection will yield nothing)

// (potentially expensive calculation)

// (prevents flashing on fast runs)

// (useful for init)

// (x, y) position pair

// (x2, y2) for fingers 1 and 2

// *2 b/c the stroke is drawn centred on the middle

// *2 radius guarantees outside shape

// - adding new props to an existing group gets handled automatically

// - adding the current slice would go beyond the full circle

// - bypass : true iff the property is a bypass property

// - bypasses can't be shared b/c the value can be changed by animations or otherwise overridden

// - collection of elements in the graph on selector arg

// - empty collection on no args

// - good for perf in certain cases but currently requires dirtying the rendered style

// - guarantee a returned collection when elements or collection specified

// - its bypass

// - mappings can't be shared b/c mappings are per-element

// - n.b. adding a new group of props may require updates to updateStyleHints()

// - name : the name of the property

// - strValue : a string value that represents the property value in valid css

// - try to use for only things like discrete layouts where the node position would change anyway

// - value : the parsed, native-typed value of the property

// - we're already beyond the full circle

// - what selectors match it

// - would be better to not modify the nodes but the nodes are read directly everywhere in the renderer...

// - zero size

// --

// -----

// .data('foo')

// .data('foo', 'bar')

// .data('foo', ...)

// .data({ 'foo': 'bar' })

// .pan('x')

// .pan('x', 100)

// .pan()

// .pan({ x: 0, y: 100 })

// .panBy('x', 100)

// .panBy({ x: 0, y: 100 })

// .removeData('foo bar')

// .removeData()

// 1 hash op vs n hash ops (for length n string)

// 1..N

// 50% reserved for white between the two borders

// @O Polygon drawing

// A contains the neighborhoods of every node

// A function that determines whether the node should be animated

// A random force has already been applied as node repulsion

// Add additional probability based on damping factor

// Add cMin to processed nodes

// Add children nodes as a new graph to graph set

// Add children to que queue to be visited

// Add children to queue to be visited

// Add entry to id-index map

// Add methods to `Hash`.

// Add methods to `ListCache`.

// Add methods to `MapCache`.

// Add new node

// Add node Id to parent's list of children

// Add root graph to graphSet

// Add this force to target and source nodes

// All edges pointing to partition2 should now point to partition1

// All nodes animated by default on animate enabled

// Also, initialize a null vector which will be used as shorthand

// Also, take into account columns that have sum = 0

// An implementation of the Cardano method from the year 1545

// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up

// Apply force

// Apply force to all nodes in graph

// Arc from bottom to left side

// Arc from left side to topBorder

// Arc from middle top to right side

// Arc from right side to bottom

// Assign nodes to clusters

// Assign nodes to clusters with highest probability.

// Assume CCW polygon winding

// Assuming percentage is number from 0 to 1

// Begin Markov cluster algorithm

// Begin affinity propagation algorithm

// Both nodes are present in this subgraph

// Browser Event object

// Build clusters from matrix

// Build k centroids, each represented as an n-dim feature vector

// Calculate d, direction vector of line

// Calculate edge forces

// Calculate gravity forces

// Calculate node repulsions

// Calculate the distance between each pair of clusters

// Calculates and returns node dimensions { x, y } based on options given

// Called on `layoutready`

// Called on `layoutstop`

// Cancel drag pan

// Case: Intersects the bottom border

// Case: Intersects the left border

// Case: Intersects the right border

// Case: Intersects the top border

// Case: Vertical direction (down)

// Case: Vertical direction (up)

// Check bottom right quarter circle

// Check endpoint of second line

// Check for convergence

// Check for negative weight cycles

// Check hBox

// Check if already process another edge between same 2 nodes

// Check if node n has a parent node

// Check if we are drag panning the entire graph

// Check source

// Check start point of second line

// Check target

// Check that both matrices have the same elements (i,j)

// Check to see if algorithm has converged, i.e. when centroids no longer change

// Check top left quarter circle

// Check top right quarter circle

// Check vBox

// Choose an edge randomly

// Clean up meta data used for clustering

// Collapse graph based on edge

// Compound edge

// Compute closeness for every node and find the maximum closeness

// Compute difference (squared module) of both vectors

// Compute dominant eigenvector using power method

// Compute graph center

// Compute ideal length

// Compute sum of node depths, relative to lca graph

// Compute the module and components of the force vector

// Computes the minimum cut of an undirected graph

// Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }

// Construct result

// Contract until stop point (stopSize nodes)

// Cooling factor (how the temperature is reduced between consecutive iterations

// Coordinates for selection box, plus enabled flag

// Counter

// Create a copy of the colapsed nodes state

// Create a timestamp if incoming event doesn't have one

// Create indexToGraph map

// Create null matrix

// Current line: [currentPointX, currentPointY] to [nextPointX, nextPointY]

// DAG functions

// Delete all edges between partition1 and partition2

// Dendrogram mode builds the hierarchy and adds intermediary nodes + edges

// Deselect all elements if nothing is currently under the mouse cursor and we aren't dragging something

// Determine which cluster the node is most likely to belong in

// Determine which cluster this node belongs to: node id => cluster #

// Direction vector of line

// Divisor to compute edge forces

// Do one step in the phisical simulation

// Don't include loops in the matrix

// Easing of the animation for animate:'end'

// Edge functions

// Edges relaxation

// Either this is the first call, activity has stopped and we're at the

// End of main loop

// End of neighbors update

// Endpoint of first line

// Ensure the intersection is on the desired quarter of the circle

// Event string

// Events bubbling up the document may have been marked as prevented

// Excludes the label when calculating node bounding boxes for the layout algorithm

// Exit early for strings to avoid a performance hit in some environments.

// Expose `MapCache`.

// Extra spacing between components in non-compound graphs

// Finally, return layoutInfo object

// Find lowest common graph ancestor

// Find min, max values for each attribute dimension

// Find minimum distance by using the minimum of the distance

// Find the closest pair of clusters and merge them into a single cluster.

// Find their common ancester, starting from the root graph

// Find two closest clusters from cached mins

// First, get sum of all elements

// Fit the graph if necessary

// Font style

// For simplicity the layout will be:

// For small data sets, the probability of medoid conflict is greater,

// Format for each edge (edge index, source node index, target node index)

// Functions

// Functions to help with handling mouseout/mouseover on the Cytoscape container

// Functions to help with whether mouse wheel should trigger zooming

// G should be symmetric and undirected

// Generate stochastic matrix M from input graph G (should be symmetric/undirected)

// Generated by CoffeeScript 1.8.0

// Get Parent Node

// Get Parent node for this graph, and use its position as center

// Get all nodes that belong to this cluster

// Get all nodes that belong to this medoid

// Get clipping points for both nodes

// Get direction of line connecting both node centers

// Get edge, source & target nodes

// Get the node to visit and remove it from queue

// Gives negative angle

// Go through each of the graphs in graphSet

// Gravity force (constant)

// Handle invocations in a tight loop.

// Handle mouseout on Cytoscape container

// Ideal edge (non nested) length

// Identify exemplars (cluster centers)

// If a node doesn't have a parent, then it's in the root graph

// If both centers are the same, apply a random force

// If both centers are the same, do nothing.

// If both nodes belongs to graphIx

// If difference is less than the desired threshold, stop iterating

// If nodes overlap, repulsion force is proportional

// If required, randomize node positions

// If something is under the cursor and it is draggable, prepare to grab it

// If the node has no child, skip it

// If there's no overlap, force is inversely proportional

// If undirected graph, process 'reversed' edge

// If undirected graph, we need to take into account the 'reverse' edge

// If updated boundaries, propagate changes upward

// If we've already chosen this node to be a medoid, don't choose it again (for small data sets).

// If we've found our goal, then we are done

// If we've reached here, then we've not reached our goal

// Implemented by Zoe Xi @zoexi for GSOC 2016

// Implemented from pseudocode from wikipedia

// Implemented from the algorithm in Opsahl's paper

// Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes

// In agglomerative (bottom-up) clustering, each node starts as its own cluster

// Initial temperature (maximum node displacement)

// Initializations { dist, pred, edge }

// Initialize A availability matrix

// Initialize R responsibility matrix

// Initialize and build S similarity matrix

// Initialize distance matrix

// Initialize layout info

// Initialize matrix used for path reconstruction

// Initialize selection box coordinates

// Inline implementation of a queue, used for traversing the graph in BFS order

// Instead choose a different random node.

// Invoke the leading edge.

// Is any of the 2 results the best cut so far?

// Iterate over all edges

// Iterate over all edges, creating Layout Edges

// Iterate over all nodes, creating layout nodes

// Join line

// L-shape (turn distance not respected, but works well for tree siblings)

// L-shape fallback (turn distance not respected, but works well with tree siblings)

// Layout has finished

// Limit displacement in order to improve stability

// Lower temperature threshold (below this point the layout will end)

// M(i,j) ^ inflatePower

// Main loop

// Make recursive calls for all subgraphs

// MaxX

// MaxY

// Maximum number of iterations to perform

// Merge two closest clusters

// MinX

// MinY

// Misc functions

// Move all nodes from partition2 to partition1

// Multiply matrix with previous result

// N x C matrix

// NB alpha === 0

// NB don't write to cxtProp, as it's shared among eles (stored in stylesheet)

// NB no restore

// NB the animation loop will exec in headless environments if style enabled

// NB: context.selector may be null for 'core'

// NOTE: when something is added here, add also to ele.json()

// Needs reproject due to pan changing viewport

// Neighbourhood functions

// Nested for loop is OK; total number of iterations for both loops = edgeCount

// Nesting factor (multiplier) to compute ideal edge length for nested edges

// New tentative score for node w

// No 'links' out from node jth, assume equal probability for each possible node

// No need to randomize compound nodes or locked nodes

// Node jth has outgoing link, compute normalized probabilities

// Node repulsion (non overlapping) multiplier

// Node repulsion (overlapping) multiplier

// Nodes only repel each other if they belong to the same graph

// Non-animated nodes are positioned immediately when the layout starts

// Now get all the pairs of nodes

// Now store edge destination as indexes

// Now, divide each by the sum of all elements

// Now, process edges

// Now, sum edge weights

// Now, sum incoming edge weights

// Now, sum outgoing edge weights

// Number of iterations between consecutive screen positions update

// OR

// One of (node1, node2) is present in this subgraph

// Only get each pair once, (A, B) = (B, A)

// Only invoke if we have `lastArgs` which means `func` has been

// Padding on fit

// Parallel, coincident lines. Check if overlap

// Place preferences on the diagonal of S

// Plain object containing all event details

// Points to the end of the queue

// Pre-compute control points

// Prepare to select the currently touched node, only if it hasn't been dragged past a certain distance

// Primary key

// Process edges

// Project mouse

// Propagate forces from parent to child

// Propagate offset

// Put explicitly provided properties onto the event object

// Randomize the initial positions of the nodes (true) or use existing positions (false)

// Randomly select k medoids from the n nodes

// Rasterize the layers, but only if container has nonzero size

// Re-project

// Recursively convert values (susceptible to call stack limits).

// Regular mode simply returns the clusters

// Relatively large data set, so pretty safe to not check and just select random nodes

// Remove duplicate clusters due to symmetry of graph and M matrix

// Reset any `maxWait` timer.

// Reset boundaries for compound nodes

// Reset meta node partition

// Reset parent offsets

// Resize canvas

// Restart the timer.

// Returns the correct answer with high probability

// Right click button

// Round rectangle drawing

// Row-wise attractors and elements that they attract belong in same cluster

// Run 2 iterations starting in the stop state

// Save previous step

// Second pass to add child information and

// Segments (multiple straight lines)

// Select different medoid if its configuration has the lowest cost

// Self-edge

// Set DEBUG - Global variable

// Shorcuts

// Shortcut

// Shorthand

// Show LayoutInfo contents if debugging

// Since these points depend on the radius length (which in turns depend on the width/height of the node) we will only pre-compute

// Single selection

// Solves a cubic function, returns root in form [r1, i1, r2, i2, r3, i3], where

// Start at top middle

// Start by visiting the nodes in the root graph

// Start the timer for the trailing edge.

// Start with a vector of all 1's

// Step 1: Add self loops to each node, ie. add multFactor to matrix diagonal

// Step 1: Initialize centroid positions

// Step 1: Initialize k medoids

// Step 1: Initialize letiables.

// Step 2: Assign nodes to the nearest centroid

// Step 2: Assign nodes to the nearest medoid

// Step 2: Calculate the centroids for each step.

// Step 2: M = normalize( M );

// Step 3:

// Step 3: For each medoid m, and for each node assciated with mediod m,

// Step 3: For each of the k clusters, update its centroid

// Step 3: Update the partition matrix U.

// Step 4:

// Step 4: Check for convergence.

// Step 5: check to see if ~steady state has been reached

// Straight edge within bundle

// TODO ensure re-used

// TODO: implement a seeded random number generator.

// Take into account if graph is directed or not

// Tap event, roughly same as mouse click event for touch

// Tap, taphold

// Target depth

// Taxicab geometry with two turns maximum

// Temp array with all 0's

// The duration of the animation for animate:'end'

// The layout animates only after this many milliseconds for animate:true

// The use of `Object#toString` avoids issues with the `typeof` operator

// These 3 fields related to tap, taphold events

// This gives the coefficients of the resulting cubic equation

// Traverse matrix, column by column

// Traverse the graph, level by level,

// Trigger layoutReady only on first call

// Turn every array into a collection of nodes

// Update A availability matrix

// Update R responsibility matrix

// Update ancestry boudaries

// Update cached mins

// Update centroids by calculating avg of all nodes within the cluster.

// Update column sum

// Update distances between new cluster and each of the old clusters, and loop until threshold reached.

// Update distances with new merged cluster

// Update gScore for node w if:

// Update idealLength

// Update matrix

// Update positions based on calculated forces

// Update scores for neighbors of cMin

// Update size, position of compund nodes

// Update temperature

// Use the cubic solving algorithm

// We only need to process the node if it's compound

// We will store the best cut found here

// We've already found both nodes, no need to keep searching

// Whether to animate while running the layout

// Whether to fit the network view after when done

// [ p0, UnitVectorP0P1, p1, UniVectorP1P2, ..., pn, UnitVectorPnP0 ]

// [0] in case elements is an array of collections, rather than array of elements

// a caching layer for property parsing

// a class name has the same rules as a variable except it can't have a '.' in the name

// a function that determines whether the node should be animated.  All nodes animated by default on animate enabled.  Non-animated nodes are positioned immediately when the layout starts

// a grabbable compound node below the ele => no passthrough panning

// a layer may want to use an ele cache of a higher level to avoid blurriness

// a restriction on whether to match this emitter

// a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }

// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }

// a value literal, either a string or number

// a variable name can have letters, numbers, dashes, and periods

// access data field

// accessible cy.style() function

// achromatic

// add ! variants to comparatorOp

// add @ variants to comparatorOp

// add a single css rule to the current context

// add alias prop for parsing

// add center point to style so bounding box calculations can use it

// add connected edge

// add connected edges

// add current node to the current options object and call degreeCentrality

// add descendant nodes

// add one or many css rules to the current context

// add padding around text dims, as the measurement isn't that accurate

// add property to current context if valid

// add the elements

// add to target's animation queue

// add to the animation loop pool

// adding an edge invalidates the traversal cache for the connected nodes

// adding an edge invalidates the traversal caches for the parallel edges

// affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)

// affects time of computation and cluster granularity to some extent: M * M

// against all other centroids

// aka DAG ancestors

// aka DAG descendants

// alias

// aliases

// aliases:

// all non finite (e.g. Infinity, NaN) elements must be -Infinity so they go to the start

// allow access by name as well

// allow access of properties by name ( e.g. style.properties.height )

// allow custom renderer name to be re-used, otherwise use canvas

// allow exiting early

// allow for passing a wrapped jquery object

// allow rendering hints in top level options

// allowed metadata fields (i.e. allowed functions to use from Collection)

// allows a core instance to access extensions internally

// allows negative

// also add nodes and edges related to the topmost ancestor

// always add to drag

// always need redraw in case eles unselectable

// always override as haystack in case set to different type previously

// always store the body bounds separately from the labels

// always store the individual arrow bounds

// always store the unrotated label bounds separately

// an apply() while playing shouldn't do anything

// an edge may be implicitly dirty b/c of one of its connected nodes

// an element id (follows variable conventions)

// ancestor implicitly refs the subject

// ancestor query

// and explicit cy.destroy() is necessary to stop the loop

// and later queue the current layerset so we can get the proper quality level soon

// and use elefn and elesfn as shorthands to the prototypes

// animate

// animated

// any change invalidates the layers

// append a dummy stylesheet object on a real style object

// applied style contexts from the styler

// apply a property to the style (for internal use)

// apply pixel ratio

// apply selector

// apply the not op, but null vals for inequalities should always stay non-matching

// apply the style to the element based on

// apply to all property names

// approximate curve pts based on the two t values

// args to pass to ext

// array of bound listeners

// array of children

// array of connected edges

// assign orphan nodes to a new top-level depth

// assign the nodes a depth and index

// assume 60 frames per second

// assume bb

// attributes/features used to group nodes, ie. similarity values between nodes

// auto justfication : center

// auto justification : left

// auto justification : right

// auto resize

// autorewind

// availability matrix (1D array)

// avoid division by zero while keeping the overall expression close in value

// avoid duplicate style updates

// avoiding the overhead of the rest of the function

// b - result , a - numeric letiable

// b/c drawToContext() may be async w.r.t. redraw(), keep track of last texture frame

// b/c have to half width/height

// backwards compatibility

// because a rogue async texture frame would clear needDraw

// because the bypassed property was already applied (and therefore parsed), we can just replace it (no reapplying necessary)

// because the pie properties are numbered, give access to a constant N (for renderer use)

// because we need to have up-to-date style (e.g. stylesheet mappers)

// before calculating rendered style (and pstyle might not be called yet)

// bellmanFord

// betweennessCentrality

// bezier-like or segment-like edge

// binary comparison op (used in data selectors)

// bind all the ready handlers registered before creating this instance

// bind to event

// boolean (unary) operators (used in data selectors)

// bounds cache of edge arrows

// bounds cache of element body, including overlay

// bounds cache of element body, w/o overlay

// bounds cache of labels

// box selection

// bring to front of queue

// build up the style to animate towards

// builds a style object for the 'core' selector

// but lazily -- only use non-default prop values to reduce the number of hashes

// but only if more than one node (can't overlap)

// but only if over threshold

// by a handler lower down the tree; reflect the correct value.

// bypass was overriding)

// bypasses are applied to an existing style on an element, and just tacked on temporarily

// cMin must be the source of edge if directed

// cache cycle (i.e. before fired events)

// cache of output of traversal functions

// cache of the current bounding box

// cached options

// caching large elements is not efficient

// calculate max size now based on potentially updated mappers

// calculate the node positions

// calculate the node value

// calculate the radius

// call onSet callback

// callback on layoutready

// callback on layoutstop

// callback to run

// callbacks on dequeue

// called on continuous layouts to stop them before they finish

// can be % or px only

// can be enum, deg, or rad only

// can only correct beziers for now...

// can only map to colours and numbers

// can replace only if same z-index

// can write to mapping, as it's a per-ele copy

// can't assign undefined

// can't be invalid or mapped

// can't centre pan to nothing

// can't create edge if one of its nodes doesn't exist

// can't create element if it has empty string as id or non-string id

// can't create element if one already has that id

// can't create element if prior id already exists

// can't create if source or target is not defined properly

// can't create this

// can't do anything without well defined properties

// can't fit to nothing

// can't get a spring w/ duration 0

// can't get from no eles

// can't make a mapper without a range

// can't make much of a mapper without a range

// can't override unless the context is active

// can't replace node

// can't set to no eles

// can't set undefined imperatively, so use null

// can't transition if there's nothing previous to transition from

// can't zoom with invalid params

// cancel ctx gestures if the distance b/t the fingers increases

// case: one bb above other

// case: one bb below other

// case: one bb to left of other

// case: one bb to right of other

// chainability

// chaining

// chaining and exit early when batching

// change of state => possible change of style

// change to neighbor check

// change to target node check

// chars we need to escape in let names, etc

// cheap collection ref check

// cheap element ref check

// cheap length check

// check and update each ele

// check for cached value before calling function

// check for nodes not found by bfs

// check if bypass is null or empty string (i.e. indication to delete bypass property)

// check if ele has all of the passed classes

// check if ele has classes outside of those passed

// check if it's path and a field with the same name doesn't exist

// check if this number type also accepts special keywords in place of numbers

// check if value is a function used as a mapper

// check if value is mapped

// check if value must be an integer

// check if valueMin and valueMax are the same

// check if we need to delete the current bypass

// check non-rounded top side

// check the heading 2 "Degree"

// check the type and return the appropriate object

// check this first b/c it's the most common/performant case

// check to cancel taphold

// check to see if we have a compound graph or not

// check value is within range

// checks under left refs the subject implicitly

// circ

// clean up refs etc.

// clean up shift

// clean up unused fields for new type

// clear b/c we've bound them all and don't want to keep it around in case a new core uses the same div etc

// clear holes

// clear mapping for current key

// clear out the key to req lookup

// clear the cache since we don't need it

// clear the cached points state

// clear the queue of future animations

// clearQueue

// closenessCentrality

// code from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript

// collect udpated elements (cascaded from the layers) and update each

// colours are simple, so just create the flat property instead of expensive string parsing

// combine forests for u and v

// common node/edge props

// common to all eles

// compare indices in the core (order added to graph w/ last on top)

// compound props

// compound split query

// connect with children

// connectedEdges() usually cached

// consider px values

// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }

// construct components corresponding to each disjoint subset of nodes

// constructor

// context swipe

// context swipe cancelling

// copy

// core props

// create a new context from the specified selector string and switch to that context

// create a rendered position based on the passed position

// create a table of edge (src, tgt) => list of edges between them

// create and cache new shape

// create instance

// create mock ids / indexes maps for element so it can be used like collections

// create positions from levels

// create the renderer

// create with args

// crop zoom

// ctrl pt itself

// ctrpt

// cubic

// cut at root

// cy is automatically populated for us in the constructor

// cytoscape is first arg to ext

// damping factor between [0.5, 1)

// data

// data for the core

// data object

// debounced at least once.

// debug('distance for param ' + params[i] + ": " + Math.sqrt(distSquared));

// default easings

// default midpt for labels etc

// default number of layers to use

// default: child query

// default: descendant query

// define

// define aliases

// define visual style properties

// degreeCentrality

// degreeCentralityNormalized

// delay

// delete bypassed

// delete each non-empty key

// delete the property and use the default value on falsey value

// delete the property that the

// delta

// delta finger1

// delta time % value for initVal (allows animating out of init zero opacity)

// depth at which dendrogram branches are merged into the returned clusters

// depth of deepest parent

// dequeueing isn't necessary with an existing cache

// desktop safari pinch to zoom start

// destroy the renderer

// detect problematic cases for old browsers with bad images (cheaper than try-catch)

// didn't match any

// diffProps : { name => { prev, next } }

// direct draw fallback

// direct mapping

// directed edge with subject on the target

// disable nonstandard wheel events

// displayed suffices, since we will find zero area eles anyway

// distance metric to compare attributes between two nodes

// distance metric to compare nodes

// distance to s

// djb2/string-hash

// do a cheaper bb check

// do compound node sanity checks

// do nothing if args are invalid

// do the transform on creation to save cycles (it's the same for all eles)

// does selector match a single element?

// does the node have at least one pie piece?

// don't affect touch devices like iphone

// don't cut tree, simply return all nodes as 1 single cluster

// don't update with null dim

// don't update with zero area boxes

// done if none left

// done if touched all outgoers already

// down++;

// drag node

// dragging nodes

// draw the current view

// draw the full bounds of the graph

// duration 0 => jump to end so impl doesn't matter

// duration of animation in ms if enabled

// during all of the remaining frame time

// e.g. 'c-0-2' => true

// e.g. (private) cy.nodes().select(['tapselect'])

// e.g. 2 => [ layer1, layer2, ..., layerN ]

// e.g. already registered some info (e.g. readies) via jquery

// e.g. center

// e.g. cy.data() changed => recalc ele mappers

// e.g. cy.nodes().select( data, handler )

// e.g. cy.nodes().select( handler )

// e.g. cy.nodes().select()

// e.g. cytoscape({ container: $('#cy') })

// e.g. cytoscape.use( require('cytoscape-foo'), bar )

// e.g. extension('renderer', 'svg')

// e.g. middle

// each cache should check for sub-key diff to see that the update affects that cache particularly

// each element

// each iteration yields a component

// each node

// each visual style property has a type and needs to be validated according to it

// easing of animation if enabled

// easing of animation if enabled,

// edge arrows

// edge must be in set of calling eles

// edge props

// edge sanity checks to prevent the client from making serious mistakes

// edges

// edges connected to compound nodes can not be haystacks

// either .start() or .run() is defined, so autogen the other

// element's style is replaced by what's pointed to by the `bypassed`

// elements being animated

// elements in the graph

// elements is optional

// elements: []

// elements: { nodes: [], edges: [] }

// eles who had classes changed

// elesfn

// else

// else not right mouse

// empty => remove bypass

// empty collection => can't get any value

// empty collections don't need to notify anything

// end if props allow ani

// end init FCM

// end of main loop

// endpt

// enqueue v

// ensure edge is within calling collection and edge is not in cut

// ensure ele ref

// error

// eslint-disable-line no-constant-condition

// eslint-disable-line no-undef

// eslint-disable-line no-unused-vars

// eslint-disable-next-line no-unused-vars

// even if we're comparing numbers

// exclude any node that is a descendant of the calling collection

// exclude loops

// existing element should be updated

// exit each early on return false

// exit if destroy() called on core or renderer in between frames #1499 #1528

// exit if population failed

// exit on disabled

// exit on failure

// exit or we loop forever

// expand bounds by 1 because antialiasing can increase the visual/effective size by 1 on all sides

// expand to work around browser dimension inaccuracies

// expo

// expose public apis (mostly for extensions)

// extend

// extend the map if necessary

// extra checks for edges

// extra checks for nodes

// extra spacing around nodes when avoidOverlap: true

// extract classes from string

// fall back on plain caching if no layers

// fall back on step size

// fallback compatibility layer for ms pointer events

// fallback if no container (not 0 b/c can be used for dividing etc)

// fallback on source and target positions

// false : Just show the end result

// field in the bypass property (i.e. restoring the property the

// fields :

// fill in missing layout functions in the prototype

// filter

// final node

// find min distance we need to leave between nodes

// find the depths of the nodes

// find the metrics for each level

// find the offset

// find the segment we're on

// find top-level parent

// find unused col

// find unused row

// first

// first check enums

// first half of the rectangle

// first try the second last one in case it has space at the end

// fit padding

// fixes slow wheel events on ff/linux and ff/windows

// flatten the field (e.g. data.foo.bar)

// flatten the property if mapped

// floydWarshall

// for

// for 1 id #foo queries, just get the element

// for all nodes

// for backwards compatibility

// for bb

// for cases where two data points shouldn't be linked together

// for compound graphs, hitting edge may actually want a connected node instead (b/c edge may have greater z-index precedence)

// for context

// for contexts

// for each connected edge, add the edge and the other node

// for each ele

// for each element

// for each node

// for each node (U is N x C matrix)

// for each pair (src, tgt), create the ctrl pts

// for each pair id, the edges should be sorted by index

// for each prop

// for elements

// for eles

// for empty collection case

// for empty text, skip all processing

// for future timeline/animations impl

// for i eles

// for initial kick off

// for internal use

// for internal use only

// for j classes

// for listener

// for pair edges

// for pair ids

// for parsedProp:{ bypass: true }

// for parsedProp:{ bypass: true, deleteBypass: true }

// for parsedProp:{ mapped: truthy }

// for props

// for style mapping

// for the directed case, try to make the edges all go down (i.e. depth i => depth i + 1)

// for very outofdate browsers

// force num of columns in the grid

// force num of rows in the grid

// forces

// from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection

// from is a selector string

// from pseudocode on wikipedia

// from val

// full event string

// fully updates (recalculates) the style for the elements

// function

// function between the given point and the curve

// function values can't be cached in all cases, and there isn't much benefit of caching them anyway

// generate a random number from 0 to 15

// generate a real style object from the dummy stylesheet

// get

// get a collection

// get ele or empty collection

// get elements if a selector is specified

// get hue

// get image, and if not loaded then ask to redraw when later loaded

// get json from cy.style() api

// get rid of leading whitespace

// get the cxt key

// get the internal parsed style object for the specified property

// get the leaf nodes in the DAG

// get the root nodes in the DAG

// get the specified css property as a rendered value (i.e. on-screen value)

// get the style key hashes per prop group

// get the weighted percent for an element based on its connectivity to other levels

// get whole object

// get/set the position relative to the parent

// get/set the rendered (i.e. on screen) positon of the element

// gets a computed ele style object based on matched contexts

// gets css property from the core container

// gets the raw style for an element

// gets the rendered style for an element

// gets what an em size corresponds to in pixels relative to a dom element

// getting

// getting for an element may need to add to the id list b/c eles can share keys

// ghost

// ghost props

// go over each prop

// go to lower quality blurry frames when several m/b frames have been rendered (avoids flashing)

// handle all eles

// handle edge arrow size

// handle edge dimensions (rough box estimate)

// handle label dimensions

// handle node dimensions

// has() is cheap

// hash of all clusters by key

// haystacks avoid the expense of pairInfo stuff (intersections etc.)

// headless or style disabled

// height of layout area (overrides container height)

// higher priority callbacks executed first

// higher priority execs before lower one

// horizontal

// horizontal Z-shape (direction not respected)

// horizontal Z-shape (turn distance not respected)

// horizontal fallbacks

// how many radians should be between the first and last node (defaults to full circle)

// html dom ele container

// http://en.wikipedia.org/wiki/Cubic_function#The_nature_of_the_roots

// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html

// https://bugs.webkit.org/show_bug.cgi?id=123978

// id => position

// id is finalised, now let's keep a ref

// id must be string

// ideal routing

// ie10 issue #1014

// if

// if a layer has been or will be replaced, then don't waste time with it

// if a layer is going to be replaced, queuing is a waste of time

// if a ready callback is specified as an option, the bind it

// if a selector is specified, then filter by it instead

// if already computed style, returned cached copy

// if bezier ctrl pts can not be calculated, then die

// if children take up zero area then keep position and fall back on stylesheet w/h

// if displayed

// if ellipsize

// if in a layer the eles are not in the same order, then the layer is invalid

// if is edge

// if listener matches

// if no options specified, use default

// if node is in closedSet, ignore it

// if node shapes overlap, then no ctrl pts to draw

// if not a number and enums not allowed, then the value is invalid

// if not handled by above, give 'em an empty collection

// if nothing currently animating, get something from the queue

// if outside the rough bounding box for the bezier, then it can't be a hit

// if pan dragging or cxt dragging, wheel movements make no zoom

// if preventDefault exists run it on the original event

// if rounding was too low, add rows or columns

// if rows or columns were set in options, use those values

// if specified parent

// if stopPropagation exists run it on the original event

// if target is outisde cy container, then this event is not for us

// if texture has been mostly filled and passed over several times, remove

// if the current level is incomplete, then use the closest, best quality layerset temporarily

// if the last one doesn't exist, we need a first one

// if the layer has all its eles done, then remove from the queue

// if the layer is invalid, the level is not complete

// if the prop change makes the bb of pll bezier edges invalid,

// if the property is a bypass property, then link the resultant property to the original one

// if the replaced layer is not in the active list for the level, then replacing

// if there are any eles needed to be drawn yet, the level is not complete

// if there's no room in the current texture, we need a new one

// if there's remaining text, put it in a wrapped line

// if this get was on an unused/invalidated cache, then restore the texture usage metric

// if this is a replacement layer that has been superceded, then forget it

// if update is a request from the ele cache, then it affects only

// if we aren't in a tick that causes a draw, then the rendered style

// if we can't flatten the property, then don't apply and fall back on the existing style

// if we can't flatten the property, then don't apply the property and fall back on the existing style

// if we're close to the edge but didn't hit it, maybe we hit its arrows

// if we're doing a case insensitive comparison, then we're using a STRING comparison

// if we're rendering faster than the ideal fps, then do dequeueing

// if( !isBypass ){

// if( cache.fillStyle !== fillStyle ){

// if( cache.strokeStyle !== strokeStyle ){

// if( tmpLayers ){

// if( y3 < y ){

// ignore

// ignore edges who are not to be displayed

// ignore group -- immutable

// ignore if

// ignore zero size case

// img

// implemented from pseudocode from wikipedia

// impossible to map to num

// in Safari 9 which returns 'object' for typed arrays and other constructors.

// in addition to returning the clusters.

// in case selector passed

// in case the user accidentally doesn't use camel case

// in case we used the `concentric` in style

// in future, this could potentially be allowed if there were operator precedence and detection of invalid combinations

// in place merge on calling collection

// included extensions

// indicate that we actually did drag the node

// indicates this is an element

// info for parent query

// init dictionaries

// init style

// init zoom bounds

// initial load

// initialize queue for hierarchical traversal

// insure it's an element

// intermediate parents may be moved by prior line, so make sure we remove by fresh refs

// internal helper to get nodes and edges as separate collections with single iteration over elements

// invalid

// invalid alpha value

// invalid channel value

// invalid gradient style

// invalidate all entries in the cache if the cache size is small

// it as the trailing edge, or we've hit the `maxWait` limit.

// it from the queue so we don't need to waste time looking at it to put new things

// it's done

// just go over all elements rather than doing a bunch of (possibly expensive) traversals

// just remove it if we don't want to consider holes

// just send to all eles

// just set the property

// just set the zoom

// just store the property to be parsed later

// just store the selector to be parsed later

// just to have some nice spacing

// just used for identifying when debugging

// keep a reference to the mapping

// keep nodes first in the array and edges after

// keep the prototypes in sync (an element has the same functions as a collection)

// key => true if immutable

// keys for style blocks, e.g. ttfftt

// kruskal's algorithm (finds min spanning tree, assuming undirected graph)

// label dims

// labels

// larger preference = greater # of clusters

// layer itself along the way

// layer.eles = [];

// left

// let changedEles = style.apply( updatedEles );

// let cy = ele.cy();

// let down = 0;

// let the core know we have a compound graph

// let the renderer know we've updated style

// let the renderer schedule animations

// let the token populate the selector object in currentQuery

// lightness is [0, 100]

// line is already short enough

// line is too long

// linkage criterion : how to determine the distance between clusters of nodes

// list of listeners

// list of property names

// load all data asynchronously, then exec rest of init

// load bg image

// log('--');

// log('--\nget layers with %s eles', eles.length);

// log('apply replacement layer %s over %s', layer.id, replaced.id);

// log('dequeue layer %s', layer.id);

// log('dequeue of layer %s complete', layer.id);

// log('do layers');

// log('draw ele %s in layer %s', ele.id(), layer.id);

// log('invalidate based on ordering', layer.id);

// log('invalidate layer', layer.id );

// log('layer %s in queue skipped b/c it already has a replacement', layer.id);

// log('layer is no longer the most uptodate replacement; dequeued', layer.id)

// log('level complete, using existing layers\n--');

// log('make new layer for ele %s', ele.id());

// log('queue ele %s in layer %s', ele.id(), layer.id);

// log('queue replacement layer refinement', rLyr.id);

// log('refine', eles.length);

// log('replacement layer %s is invalid; dequeued', layer.id);

// log('reuse layer for', ele.id());

// log('skip layers');

// log('update invalidate layer time from eles');

// log('update invalidate layer time');

// logDebug("Resetting boundaries of compound node: " + n.id);

// logDebug('LCA of nodes ' + tempEdge.sourceId + ' and ' + tempEdge.targetId +

// logDebug('propagateForces');

// logDebug(s);

// look at all the edges in the collection

// look at edges connected to the src node of this edge

// loop :)

// loops must be bundled beziers

// main algorithmic loop

// maintain chainability

// maintain chaining

// make a regex from the type string

// make elements from json and restore all at once later

// make sure container assoc'd reg points to this cy

// make sure layout has _private for use w/ std apis like .on()

// make sure newly created elements have valid ids

// make sure src/tgt distinction is consistent w.r.t. pairId

// make sure the nodes have a defined position

// make sure the property name is in dash form (e.g. 'property-name' not 'propertyName')

// make sure to bound percent value

// make the element array-like, just like a collection

// make the list of elements to remove

// manage the animation loop ourselves

// manually hook and run the animation

// map ( className => true )

// map aliases

// map integer range [0, 100] to [0, 1]

// map of (node id) => (position obj); or function(node){ return somPos; }

// mappers not allowed in bypass

// mark as removed

// mark self as parent and remove from data

// mark the cache as invalidated

// max number of iterations to run

// maximum number of iterations of the MCL algorithm in a single run

// maybe e.altKey

// memoized version of position function

// micro-optimisation vs Object.assign() -- reduces Element instantiation time

// micro-optimised for renderer

// mid source

// mid target

// middle

// might not be a number if it allows enums

// min & max are numeric

// min dist between nodes

// min number of iterations to run in order for clustering to stop

// min spacing between outside of nodes (used for radius adjustment)

// minimum cost configuration for each cluster

// mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters

// mode:'threshold' => clusters must be threshold distance apart

// modes store cluster values differently

// more efficient to manually copy fields we use

// motionblur: blit rendered blurry frames

// mouse already handled

// move node to new parent

// multi or single unbundled

// must all be percent values if one is

// must have an element and must be a node to return position

// must have at least row or col def'd

// must manually notify since trigger won't do this automatically once removed

// n.b. most layouts would use layoutPositions(), instead of positions() and manual events

// n.b. no spaces b/c of multiple support

// n.b. partitions are included to be compatible with the old api spec

// n.b. selectors that are starting substrings of others must have the longer ones first

// n.b. this flag should be set before apply() to avoid potential infinite recursion

// n.b. use cached key, not newly computed key

// n.b. use stored key rather than current (potential key)

// n.positionX + ", " + n.positionY + ").";

// name-value pair

// nb affects initial application on mapped values like control-point-distances

// nb negative because similarity should have an inverse relationship to distance

// need a bypass if one doesn't exist

// need a copy since props are mutated later in their lifecycles

// need check in case of loop

// need several frames before even high quality motionblur

// need to calc these after endpts

// need to fill bg at end like this in order to fill cleared transparent pixels in jpgs

// needs to be started by animation loop

// neighbourhood

// new context means new index

// next iteration of the animation loop, the animation

// nice, short mathematical alias

// no after specified => first layer made so put at start

// no context prop means delete

// no existing prop means nothing needs to be removed

// no more box selection if we don't have three fingers

// no need to remove

// no parent node: no nodes to add to the drag layer

// no property is generated, instead the bypass property in the

// no type, no luck

// node

// node gradient

// node must be in set of calling eles

// node pie bg

// node props

// nodes are removed last

// non-existant parent; just remove it

// non-ideal routing

// nonzero is truthy

// normalise on [0, 1]

// normalise value in ms

// normalise value in pixels

// normalise value in rad

// normalised delta

// normalize value in %

// normally called children in graph theory

// normally called parents in graph theory

// not a valid mapping

// not active bg now

// not possible to do on non-compound graphs or with the style disabled

// not set => px

// not supported

// not using def opts => need to build up bb from combination of sub bbs

// not valid if immutable

// nothing to animate

// nothing to do

// nothing to do really

// notify renderer

// notify the renderer of queued eles and event types

// now it's a string

// now pan to middle

// now populating the neighbor with following expressions

// now populating the right side's child

// now populating the right side's descendant

// now populating the target with the following expressions

// now, add the elements to the drag layer if not done already

// now, apply the bypass properties on the elements

// now, convert to rgb

// now, restore each element

// now, this function flattens the property, and here's how:

// number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123

// numbers are cheaper to hash than strings

// object for currently-running animations

// object in which the renderer can store information

// offset from non-finite values

// on by default

// on layoutready

// on layoutstop

// only allow explicit units if so set

// only for beziers -- so performance of other edges isn't affected

// only get influenced by elements above

// only one edge in node if loop

// only update if dirty and in graph

// only update if not display: none

// only useful in specific cases like animation

// onready

// optimisation for single ele call

// optional alpha

// optional self loops for each node. Use a neutral value to improve cluster computations.

// options : object containing layout options

// or get the whole rendered style if no property specified (NB doesn't allow setting)

// original cost

// otherise keep track of drag delta for later

// otherwise just remove ele from req

// otherwise save drag delta for when we actually start dragging so the relative grab pos is constant

// otherwise set automatically

// otherwise should be added

// otherwise, copy from json

// otherwise, the opaque arrow clears it for free :)

// overall style key

// overlay

// override pan & zoom w/ fit if set

// override pan w/ center if set

// override pan w/ panBy if set

// override zoom (& potentially pan) w/ zoom obj if set

// padding on fit

// padding used on fit

// pageRank

// panning

// panning disabled

// parent implicitly refs the subject

// parent is immutable via data()

// parent query

// parent ref

// parse a property; return null on invalid; return parsed property otherwise

// parse the block of properties and values

// parse the selector

// parse to validate

// pc query takes over

// per-group keys of style property values

// percent can't push beyond 1

// point to intersect with source shape

// points are in clockwise order, inner (imaginary) triangle pt on [4, 5]

// populate the subject and replace the q at the old spot (within left) with TRUE

// position but no notification to renderer

// position the nodes

// positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)

// precise edges

// prepend a stylesheet in the head such that

// prevent the dragging from triggering text selection on the page

// prevents node overlap, may overflow boundingBox and radius if not enough space

// prevents node overlap, may overflow boundingBox if not enough space

// private helper to get bounding box for custom node positions

// private: clears dirty flag and recalculates style

// project control point along line from src centre to outside the src shape

// project control point along line from tgt centre to outside the tgt shape

// prop is not bypass

// properties as set by the style

// properties for style sent from the renderer to the core

// pt outside src shape to calc distance/displacement from src to tgt

// pull in animation functions

// put all the properties (can specify one or many) in an array after parsing them

// put depths in concentric circles if true, put depths top down if false

// put in array if not array-like

// put lone nodes at the start

// put the grab target nodes last so it's on top of its neighbourhood

// put the parsed block in the style

// put the property in the style objects

// put the values into levels

// put to end of array if edge

// put to front of array if node

// puts all nodes at (0, 0)

// quad

// quart

// queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass

// queue

// queue of element draw requests at different scale levels

// queue of element draw requests at different scale levels (element id lookup)

// queue won't automatically be flushed before dequeueing starts

// quint

// r is the real component, i is the imaginary component

// r.registerBinding(r.container, 'DOMMouseScroll', wheelHandler, true);

// r.registerBinding(r.container, 'MozMousePixelScroll', wheelHandler, true); // older firefox

// r.registerBinding(r.container, 'mousewheel', wheelHandler, true);

// random initial value

// re-use array

// read the calculated css style of the element or override the style (via a bypass)

// recalc endpts

// record starting points for pinch-to-zoom

// redraw/restore path if steps after pie need it

// reducing the small side takes away the most cells, so try it first

// refs would be a mistake (i.e. overwriting the true active layer)

// regex for matching event strings (e.g. "click.namespace")

// regex matches

// regular colours

// remove all contexts

// remove child => parent ref

// remove comments from the style string

// remove data field

// remove dragged eles

// remove ele

// remove elements from list of currently animating if its queues are empty

// remove eles in place on calling collection

// remove from queue

// remove from queue since the old req was for the old state

// remove if last ele in the req

// remove old elements

// remove parent => child ref

// remove parent reference

// remove reference to parent

// remove references to this edge in its connected nodes

// remove single ele in place in calling collection

// remove space from the texture it belongs to

// remove the invalid layers; they will be replaced as needed later in this function

// remove the parsed property and value from the remaining block text to parse

// remove the parsed selector and block from the remaining text to parse

// remove the refs from the eles to the caches:

// removeData

// removing an edge invalidates the traversal caches for the parallel edges

// removing an edges invalidates the traversal cache for its nodes

// renderedPosition overrides if specified

// replace empty spot with last ele in collection

// replace level ref

// replace refs in eles

// replace useCapture w/ opts obj

// replaced by build system

// reset any line dashes

// reset drag elements, since near will be added again

// reset ele area in texture

// reset for next touchstart

// reset in case we changed the border style

// reset transform by applying inverse

// resizing resets the style

// restore the elements if we created them from json

// retire the texture from the active / searchable queue:

// retire the texture if its utility is low

// return null on property of unknown name

// return true if at least one succesful bypass applied

// returns numeric value for each node, placing higher nodes in levels towards the centre

// returns transformed text string

// returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)

// returns true iff application was successful for at least 1 specified property

// returns whether application was successful

// returns { row, col } for element

// reuse layer for later eles

// reverse order for precedence

// root may contain only edges

// runs the layout

// s += " New Position: (" + n.positionX + ", " + n.positionY + ").";

// s += ". No changes in boundaries/position of parent node " + p.id;

// s += ".\nResult: (" + res.x + ", " + res.y + ")";

// s += "\n Children: " + children.toString();

// s += "\n###############################\n";

// s += "\nNodes DO overlap.";

// s += "\nNodes do NOT overlap.";

// s += "\nOverlap: " + overlap;

// s += "\nSTEP: " + step;

// s += "\nUp direction";

// s += "\ndirectionX: " + directionX + ", directionY: " + directionY;

// s = "Center found at: " + centerX + ", " + centerY;

// s = "Node: " + n.id + " Previous position: (" +

// s = "Node: " + node.id;

// s = "Set: " + graph.toString();

// s = 'Triggering layoutready';

// s.t. no nodes overlapping

// safari on ios pans the page otherwise (normally you should be able to preventdefault on touchmove...)

// safety check -- not strictly necessary as no props of zero range should be passed here

// same instance => just restore

// sanitise the dimensions for external layouts (avoid division by zero)

// saturation is [0, 100]

// save cycles

// save cycles if mouse events aren't to be captured

// save cycles when a mapped context prop doesn't need to be applied

// save cycles when batching -- but bounds will be stale (or not exist yet)

// save cycles when no style used

// save cycles when the context prop doesn't need to be applied

// save recalc if the label is the same as before

// scratch object for core

// scratch objects

// sdbm/string-hash

// search the graph like jQuery

// second half of the rectangle

// second node is subject

// see if we have a manual position set

// select the node with the lowest configuration cost as new medoid.

// set

// set id and validate

// set one dimension

// set or get property

// set selection type

// set the value

// set transform to arrow position/orientation

// set up canvas context with font

// set up the right q

// set up the root compound q

// set whole position

// set zoom about position

// setup styles

// several types also allow enums

// shift applied to cached bb to be applied on next get

// shift by margin and expand by outline and border

// shift points so that the distance between the cross points matches edge width

// short alias

// sigma

// sine

// skip = b/c != is explicitly defined

// skip ops that explicitly contain !

// skip this property in the block

// skip this selector and block

// so borders are square with the node shape

// so text outlines aren't jagged

// so that children are not removed w/parent

// so the layer level might not equal the ele level

// so we always have Promise.all()

// so we need to check to see if we've already seen or chose this node before.

// sort each level to make connected nodes closer

// sort node values in descreasing order

// source

// source and target are immutable via data()

// source/target

// special colour names

// specified s.t. the cache is used, so check for this case to make it faster by

// specify an array of options

// specify options for one element

// specify via opts.nodes and opts.edges

// start at 12 o'clock

// start at 12 o'clock and go clockwise

// start with one forest per node

// start with the default stylesheet so we have something before loading an external stylesheet

// startpt

// static function

// static impl by name

// step and remove if done

// stepAll

// stepElement

// stop

// stop right click menu from appearing on cy

// store each ctrlpt info init

// store in the path cache with values easily manipulated later

// stretch factors

// string literals (used in data selectors) -- doublequotes | singlequotes

// string; 'nodes' or 'edges'

// success

// suitability of a data point to serve as an exemplar

// sw, sh

// swap styles

// sx, sy

// take impl from registrant

// take into account edge width

// take the checks from the left

// target

// target to source index

// temporarily cache the value in case of a miss

// the active bg indicator should be removed when making a swipe that is neither for dragging nodes or panning

// the animation loop will apply the animation at this progress

// the animation loop will start the animation...

// the collection is now 1 ele smaller

// the distance threshold

// the effective texture level

// the eles in the layer must be in the same continuous order, else the layer is invalid

// the event namespace (e.g. ".foo")

// the event type (e.g. 'click')

// the flattened (mapped) property is the one we want

// the generated flattenedProp:{ bypassed: parsedProp }

// the generated flattenedProp:{ mapping: prop }

// the label already fits

// the list of textures in which new subtextures for elements can be placed

// the list of usused textures which can be recycled (in use in texture queue)

// the main usecase is ele.boundingBox() for a single element with no/def options

// the matching level

// the midpt between ctrlpts as intermediate destination pts

// the nearest cache with a higher level

// the nearest cache with a lower level

// the node may have not been assigned a cluster if no valid attributes were specified

// the old start global pos'n may not be the same finger that remains

// the padding on fit

// the pan level to set (prob want fit = false if set)

// the parent-child query takes the place of the query previously being populated

// the parents who were modified by the removal need their style updated

// the previous query contains the checks for the parent

// the previous value is good for an animation only if it's different

// the property may be an alias

// the query in the selector should be the '>' itself

// the query in the selector should be the edge rather than the source

// the query in the selector should be the neighbourhood rather than the node

// the radius of the circle

// the renderer can't add tick callbacks when destroyed

// the renderer can't be notified after it's destroyed

// the renderer can't be used for calcs when destroyed, e.g. ele.boundingBox()

// the roots of the trees

// the traversal cache should start fresh when ele is added

// the unit vectors.

// the variation of concentric values in each level

// the zoom level to set (prob want fit = false if set)

// then add everything up and down for compound selector checks

// then add extra bounding box constraint

// then assume preparsed array

// then automake string

// then define w/ name

// then delete all keys

// then dirty the pll edge bb cache as well

// then don't apply and fall back on the existing style

// then dragging can happen

// then edge

// then extend the bypass

// then extra clear is needed

// then get the list of keys, and delete them

// then get the property from the style

// then just replace the old prop with the new one

// then keep the orig prop (since it's a bypass) and link to the new prop

// then make a prop of it

// then parse each property

// then parse the single property

// then replace existing edge

// then replace the bypass property with the original

// then selection overrides

// then set the bypass with the property value

// then set the zoom

// then strictly constrain to bb

// then the layer has nonexistant elements and is invalid

// then this bypass overrides the existing one

// then this property is just here to indicate we need to delete

// then update

// then use the higher cache for now and queue the next level down

// then use the lower quality cache for now and queue the better one for later

// then we can relatively cheaply rescale the existing image w/o rerendering

// then we can take action

// then we have convergence

// then zoom about a point

// there might be a normal field with a dot 

// these nodes <=edges= incoming nodes

// these nodes =edges=> outgoing nodes

// they shouldn't take up space

// this is just a wrapper alias of .on()

// this is the new query to be filled by the following exprs

// to avoid potential prototype pollution

// to be extra safe, remove the ref

// to be removed from animation queues

// to cheaply scale towards the smaller level

// to squared distance

// to the overlap

// to val

// top

// touchmove

// trailing edge, the system time has gone backwards and we're treating

// transform a given node position. Useful for changing flow direction in discrete layouts

// transform a given node position. Useful for changing flow direction in discrete layouts 

// trigger context drag if rmouse down

// trigger layoutready when each node has had its position set at least once

// trigger layoutstop when the layout stops (e.g. finishes)

// trigger update style on those eles that had class changes

// trim the value to make parsing easier

// true : Animate continuously as the layout is running

// try camel case name too

// try the last one if there is no second last one

// try to add to larger side first (adds less in multiplication)

// try to automatically infer the group if unspecified

// turn off for now, seems context does its own caching

// two fingers => pinch to zoom

// type is swapped on right side queries

// type[.namespace]

// unassigned neighbours shouldn't affect the ordering

// undirected edge

// undirected edge with subject on the second node

// update bb1 with bb2 bounds

// update each ctrlpt with segment info

// update edge data from projections

// update mappers if asked

// update node data from projections

// update position if w is in Q

// update rstyle positions

// update style b/c :backgrounding state changed

// update style for dirty eles

// update the old bg timestamp so diffs can be done in the ele txr caches

// update the ref since we moved things around for `query`

// updates the visual style for all elements (useful for manual style modification after init)

// updating the compound bounds happens outside of the regular

// use 'main' as an alias for the main label (i.e. null prefix)

// use a weighted average with a bias from the previous average so we don't spike so easily

// use cache by default for perf

// use cache so only 1x per edge

// use cached value from ctrlpt calc

// use caching on user-specified polygons so they are as fast as native shapes

// use default

// use line stroke style for triangle fill style

// use specified units if set

// use the max lvl b/c in between lvls are cheap to make

// use two fixed t values for the bezier curve approximation

// user param easings...

// user registered renderers inherit from base

// uses all available space on false, uses minimal space on true

// using standard layout options, apply position function (w/ or w/o animation)

// validate group

// var cache = this.paintCache(context);

// var fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';

// var isFirefox = typeof InstallTrigger !== 'undefined';

// var s = "Limiting force: (" + forceX + ", " + forceY + "). Max: " + max;

// var s = "Propagating new position/size of node " + node.id;

// var s = "Propagating offset from parent node : " + node.id +

// var s = "\n\n###############################";

// var s = 'Refreshing positions';

// var s = 'Updating positions';

// var s = 'calculateGravityForces';

// var s = 'calculateNodeForces';

// var strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';

// vertical Z-shape (direction not respected)

// vertical Z-shape (distance not respected)

// vertical fallbacks

// very efficient version of eles.add( eles.descendants() ).forEach()

// w already in openSet, but with greater gScore

// w not in openSet

// watch for when the cy container is removed from the dom

// we can map only if the type is a colour or a number

// we have to notify (the animation loop doesn't do it for us on `stop`)

// we missed this event by turning notifications off, so pass it on

// we need distance from this node to every other node

// we need only one entry in deqd to queue redrawing etc

// we should have exactly the number of eles passed in to be complete

// we want the low quality motionblur only when the viewport is being manipulated etc (where it's not noticed)

// we're a bypass if the mapping property is a bypass

// we're done when there's nothing left to parse

// we're now populating the child

// we're now populating the child query with expressions that follow

// we're now populating the descendant query with expressions that follow

// we're now populating the target query with expressions that follow

// we've consumed one expr, so we can return now

// we've failed if there are no valid properties

// when a replacement layer is dequeued, it replaces the old layer in the level

// where nodes start in radians

// whether background images are loading

// whether destroy was called

// whether it's inside the vis; true if removed (set true here since we call restore)

// whether it's selectable

// whether it's selected

// whether levels have an equal radial distance betwen them, may cause bounding box overflow

// whether notifications are sent to the renderer

// whether ready has been triggered

// whether the compound dimensions need to be recalculated the next time dimensions are read

// whether the element can be grabbed

// whether the element has passthrough panning enabled

// whether the element is active from user interaction

// whether the element is grabbed by the mouse; renderer sets this privately

// whether the element is locked (cannot be moved)

// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)

// whether the tree is directed downwards (or edges can point in any direction if false)

// whether to add the dendrogram to the graph for viz

// whether to create an even grid into which the DAG is placed (circle:false only)

// whether to fit the viewport to the graph

// whether to fit to viewport

// whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only)

// whether to transition the node positions

// whether to use Path2D caching for drawing

// which texture height this ele belongs to

// while

// while scrolling, ignore wheel-to-zoom

// whose roots tell us where a possible minimum is

// width and height of nodes calculated by the renderer when set to special 'auto' value

// width of layout area (overrides container width)

// width/height * splits^2 = cells where splits is number of times to split width

// will go straight to the end and be removed

// with the margin added after the rotation is applied

// word fits on current line

// word starts new line

// workaround for broken browsers like ie

// x

// x, y

// you probably wouldn't want to append a Style, since you'd duplicate the default parts

// zooming disabled

// }

//--Pointer-related data

////////

//////////

////////////////

/////////////////

/////////////////////////

//////////////////////////

//////////////////////////////////////////

//////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////

//0.8;

//console.log("Node " + node.id() + " is associated with medoid #: " + m);

//if any parent node in event hierarchy isn't pannable, reject passthrough

//if w is not in Q

//log eles.map(function(ele){ return ele.id() }) );

//r.fullQualityMb = false;

//self.queueLayer( layer );
