You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
5765 lines
155 KiB
JavaScript
5765 lines
155 KiB
JavaScript
"use strict";
|
|
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([[4276],{
|
|
|
|
/***/ 24276:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
bK: () => (/* reexport */ layout)
|
|
});
|
|
|
|
// UNUSED EXPORTS: acyclic, normalize, rank
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/forEach.js
|
|
var forEach = __webpack_require__(21845);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/toString.js + 1 modules
|
|
var lodash_es_toString = __webpack_require__(70023);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/uniqueId.js
|
|
|
|
|
|
/** Used to generate unique IDs. */
|
|
var idCounter = 0;
|
|
|
|
/**
|
|
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
* @returns {string} Returns the unique ID.
|
|
* @example
|
|
*
|
|
* _.uniqueId('contact_');
|
|
* // => 'contact_104'
|
|
*
|
|
* _.uniqueId();
|
|
* // => '105'
|
|
*/
|
|
function uniqueId(prefix) {
|
|
var id = ++idCounter;
|
|
return (0,lodash_es_toString/* default */.Z)(prefix) + id;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_uniqueId = (uniqueId);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/constant.js
|
|
var constant = __webpack_require__(78795);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/flatten.js
|
|
var flatten = __webpack_require__(28099);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/map.js
|
|
var map = __webpack_require__(12930);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseRange.js
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
var nativeCeil = Math.ceil,
|
|
nativeMax = Math.max;
|
|
|
|
/**
|
|
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
|
* coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {number} start The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} step The value to increment or decrement by.
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Array} Returns the range of numbers.
|
|
*/
|
|
function baseRange(start, end, step, fromRight) {
|
|
var index = -1,
|
|
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
|
result = Array(length);
|
|
|
|
while (length--) {
|
|
result[fromRight ? length : ++index] = start;
|
|
start += step;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const _baseRange = (baseRange);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_isIterateeCall.js
|
|
var _isIterateeCall = __webpack_require__(47952);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/toFinite.js + 3 modules
|
|
var toFinite = __webpack_require__(41291);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_createRange.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates a `_.range` or `_.rangeRight` function.
|
|
*
|
|
* @private
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
* @returns {Function} Returns the new range function.
|
|
*/
|
|
function createRange(fromRight) {
|
|
return function(start, end, step) {
|
|
if (step && typeof step != 'number' && (0,_isIterateeCall/* default */.Z)(start, end, step)) {
|
|
end = step = undefined;
|
|
}
|
|
// Ensure the sign of `-0` is preserved.
|
|
start = (0,toFinite/* default */.Z)(start);
|
|
if (end === undefined) {
|
|
end = start;
|
|
start = 0;
|
|
} else {
|
|
end = (0,toFinite/* default */.Z)(end);
|
|
}
|
|
step = step === undefined ? (start < end ? 1 : -1) : (0,toFinite/* default */.Z)(step);
|
|
return _baseRange(start, end, step, fromRight);
|
|
};
|
|
}
|
|
|
|
/* harmony default export */ const _createRange = (createRange);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/range.js
|
|
|
|
|
|
/**
|
|
* Creates an array of numbers (positive and/or negative) progressing from
|
|
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
|
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
|
* it's set to `start` with `start` then set to `0`.
|
|
*
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
* floating-point values which can produce unexpected results.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Util
|
|
* @param {number} [start=0] The start of the range.
|
|
* @param {number} end The end of the range.
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
|
* @returns {Array} Returns the range of numbers.
|
|
* @see _.inRange, _.rangeRight
|
|
* @example
|
|
*
|
|
* _.range(4);
|
|
* // => [0, 1, 2, 3]
|
|
*
|
|
* _.range(-4);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 5);
|
|
* // => [1, 2, 3, 4]
|
|
*
|
|
* _.range(0, 20, 5);
|
|
* // => [0, 5, 10, 15]
|
|
*
|
|
* _.range(0, -4, -1);
|
|
* // => [0, -1, -2, -3]
|
|
*
|
|
* _.range(1, 4, 0);
|
|
* // => [1, 1, 1]
|
|
*
|
|
* _.range(0);
|
|
* // => []
|
|
*/
|
|
var range = _createRange();
|
|
|
|
/* harmony default export */ const lodash_es_range = (range);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/dagre-d3-es/src/graphlib/index.js
|
|
var graphlib = __webpack_require__(67406);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/data/list.js
|
|
/*
|
|
* Simple doubly linked list implementation derived from Cormen, et al.,
|
|
* "Introduction to Algorithms".
|
|
*/
|
|
|
|
|
|
|
|
class List {
|
|
constructor() {
|
|
var sentinel = {};
|
|
sentinel._next = sentinel._prev = sentinel;
|
|
this._sentinel = sentinel;
|
|
}
|
|
dequeue() {
|
|
var sentinel = this._sentinel;
|
|
var entry = sentinel._prev;
|
|
if (entry !== sentinel) {
|
|
unlink(entry);
|
|
return entry;
|
|
}
|
|
}
|
|
enqueue(entry) {
|
|
var sentinel = this._sentinel;
|
|
if (entry._prev && entry._next) {
|
|
unlink(entry);
|
|
}
|
|
entry._next = sentinel._next;
|
|
sentinel._next._prev = entry;
|
|
sentinel._next = entry;
|
|
entry._prev = sentinel;
|
|
}
|
|
toString() {
|
|
var strs = [];
|
|
var sentinel = this._sentinel;
|
|
var curr = sentinel._prev;
|
|
while (curr !== sentinel) {
|
|
strs.push(JSON.stringify(curr, filterOutLinks));
|
|
curr = curr._prev;
|
|
}
|
|
return '[' + strs.join(', ') + ']';
|
|
}
|
|
}
|
|
|
|
function unlink(entry) {
|
|
entry._prev._next = entry._next;
|
|
entry._next._prev = entry._prev;
|
|
delete entry._next;
|
|
delete entry._prev;
|
|
}
|
|
|
|
function filterOutLinks(k, v) {
|
|
if (k !== '_next' && k !== '_prev') {
|
|
return v;
|
|
}
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/greedy-fas.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* A greedy heuristic for finding a feedback arc set for a graph. A feedback
|
|
* arc set is a set of edges that can be removed to make a graph acyclic.
|
|
* The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, "A fast and
|
|
* effective heuristic for the feedback arc set problem." This implementation
|
|
* adjusts that from the paper to allow for weighted edges.
|
|
*/
|
|
|
|
|
|
var DEFAULT_WEIGHT_FN = constant/* default */.Z(1);
|
|
|
|
function greedyFAS(g, weightFn) {
|
|
if (g.nodeCount() <= 1) {
|
|
return [];
|
|
}
|
|
var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);
|
|
var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);
|
|
|
|
// Expand multi-edges
|
|
return flatten/* default */.Z(
|
|
map/* default */.Z(results, function (e) {
|
|
return g.outEdges(e.v, e.w);
|
|
}),
|
|
);
|
|
}
|
|
|
|
function doGreedyFAS(g, buckets, zeroIdx) {
|
|
var results = [];
|
|
var sources = buckets[buckets.length - 1];
|
|
var sinks = buckets[0];
|
|
|
|
var entry;
|
|
while (g.nodeCount()) {
|
|
while ((entry = sinks.dequeue())) {
|
|
removeNode(g, buckets, zeroIdx, entry);
|
|
}
|
|
while ((entry = sources.dequeue())) {
|
|
removeNode(g, buckets, zeroIdx, entry);
|
|
}
|
|
if (g.nodeCount()) {
|
|
for (var i = buckets.length - 2; i > 0; --i) {
|
|
entry = buckets[i].dequeue();
|
|
if (entry) {
|
|
results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
function removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {
|
|
var results = collectPredecessors ? [] : undefined;
|
|
|
|
forEach/* default */.Z(g.inEdges(entry.v), function (edge) {
|
|
var weight = g.edge(edge);
|
|
var uEntry = g.node(edge.v);
|
|
|
|
if (collectPredecessors) {
|
|
results.push({ v: edge.v, w: edge.w });
|
|
}
|
|
|
|
uEntry.out -= weight;
|
|
assignBucket(buckets, zeroIdx, uEntry);
|
|
});
|
|
|
|
forEach/* default */.Z(g.outEdges(entry.v), function (edge) {
|
|
var weight = g.edge(edge);
|
|
var w = edge.w;
|
|
var wEntry = g.node(w);
|
|
wEntry['in'] -= weight;
|
|
assignBucket(buckets, zeroIdx, wEntry);
|
|
});
|
|
|
|
g.removeNode(entry.v);
|
|
|
|
return results;
|
|
}
|
|
|
|
function buildState(g, weightFn) {
|
|
var fasGraph = new graphlib/* Graph */.k();
|
|
var maxIn = 0;
|
|
var maxOut = 0;
|
|
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
fasGraph.setNode(v, { v: v, in: 0, out: 0 });
|
|
});
|
|
|
|
// Aggregate weights on nodes, but also sum the weights across multi-edges
|
|
// into a single edge for the fasGraph.
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var prevWeight = fasGraph.edge(e.v, e.w) || 0;
|
|
var weight = weightFn(e);
|
|
var edgeWeight = prevWeight + weight;
|
|
fasGraph.setEdge(e.v, e.w, edgeWeight);
|
|
maxOut = Math.max(maxOut, (fasGraph.node(e.v).out += weight));
|
|
maxIn = Math.max(maxIn, (fasGraph.node(e.w)['in'] += weight));
|
|
});
|
|
|
|
var buckets = lodash_es_range(maxOut + maxIn + 3).map(function () {
|
|
return new List();
|
|
});
|
|
var zeroIdx = maxIn + 1;
|
|
|
|
forEach/* default */.Z(fasGraph.nodes(), function (v) {
|
|
assignBucket(buckets, zeroIdx, fasGraph.node(v));
|
|
});
|
|
|
|
return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };
|
|
}
|
|
|
|
function assignBucket(buckets, zeroIdx, entry) {
|
|
if (!entry.out) {
|
|
buckets[0].enqueue(entry);
|
|
} else if (!entry['in']) {
|
|
buckets[buckets.length - 1].enqueue(entry);
|
|
} else {
|
|
buckets[entry.out - entry['in'] + zeroIdx].enqueue(entry);
|
|
}
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/acyclic.js
|
|
|
|
|
|
|
|
|
|
|
|
function run(g) {
|
|
var fas = g.graph().acyclicer === 'greedy' ? greedyFAS(g, weightFn(g)) : dfsFAS(g);
|
|
forEach/* default */.Z(fas, function (e) {
|
|
var label = g.edge(e);
|
|
g.removeEdge(e);
|
|
label.forwardName = e.name;
|
|
label.reversed = true;
|
|
g.setEdge(e.w, e.v, label, lodash_es_uniqueId('rev'));
|
|
});
|
|
|
|
function weightFn(g) {
|
|
return function (e) {
|
|
return g.edge(e).weight;
|
|
};
|
|
}
|
|
}
|
|
|
|
function dfsFAS(g) {
|
|
var fas = [];
|
|
var stack = {};
|
|
var visited = {};
|
|
|
|
function dfs(v) {
|
|
if (Object.prototype.hasOwnProperty.call(visited, v)) {
|
|
return;
|
|
}
|
|
visited[v] = true;
|
|
stack[v] = true;
|
|
forEach/* default */.Z(g.outEdges(v), function (e) {
|
|
if (Object.prototype.hasOwnProperty.call(stack, e.w)) {
|
|
fas.push(e);
|
|
} else {
|
|
dfs(e.w);
|
|
}
|
|
});
|
|
delete stack[v];
|
|
}
|
|
|
|
forEach/* default */.Z(g.nodes(), dfs);
|
|
return fas;
|
|
}
|
|
|
|
function undo(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var label = g.edge(e);
|
|
if (label.reversed) {
|
|
g.removeEdge(e);
|
|
|
|
var forwardName = label.forwardName;
|
|
delete label.reversed;
|
|
delete label.forwardName;
|
|
g.setEdge(e.w, e.v, label, forwardName);
|
|
}
|
|
});
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/merge.js + 6 modules
|
|
var merge = __webpack_require__(20895);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_basePickBy.js + 1 modules
|
|
var _basePickBy = __webpack_require__(73338);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/hasIn.js + 1 modules
|
|
var hasIn = __webpack_require__(94180);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_basePick.js
|
|
|
|
|
|
|
|
/**
|
|
* The base implementation of `_.pick` without support for individual
|
|
* property identifiers.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePick(object, paths) {
|
|
return (0,_basePickBy/* default */.Z)(object, paths, function(value, path) {
|
|
return (0,hasIn/* default */.Z)(object, path);
|
|
});
|
|
}
|
|
|
|
/* harmony default export */ const _basePick = (basePick);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_overRest.js + 1 modules
|
|
var _overRest = __webpack_require__(15829);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_setToString.js + 2 modules
|
|
var _setToString = __webpack_require__(71649);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_flatRest.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A specialized version of `baseRest` which flattens the rest array.
|
|
*
|
|
* @private
|
|
* @param {Function} func The function to apply a rest parameter to.
|
|
* @returns {Function} Returns the new function.
|
|
*/
|
|
function flatRest(func) {
|
|
return (0,_setToString/* default */.Z)((0,_overRest/* default */.Z)(func, undefined, flatten/* default */.Z), func + '');
|
|
}
|
|
|
|
/* harmony default export */ const _flatRest = (flatRest);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/pick.js
|
|
|
|
|
|
|
|
/**
|
|
* Creates an object composed of the picked `object` properties.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The source object.
|
|
* @param {...(string|string[])} [paths] The property paths to pick.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
*
|
|
* _.pick(object, ['a', 'c']);
|
|
* // => { 'a': 1, 'c': 3 }
|
|
*/
|
|
var pick = _flatRest(function(object, paths) {
|
|
return object == null ? {} : _basePick(object, paths);
|
|
});
|
|
|
|
/* harmony default export */ const lodash_es_pick = (pick);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/defaults.js
|
|
var defaults = __webpack_require__(65479);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseExtremum.js
|
|
var _baseExtremum = __webpack_require__(41589);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseGt.js
|
|
/**
|
|
* The base implementation of `_.gt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseGt(value, other) {
|
|
return value > other;
|
|
}
|
|
|
|
/* harmony default export */ const _baseGt = (baseGt);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/identity.js
|
|
var identity = __webpack_require__(64056);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/max.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the maximum value.
|
|
* @example
|
|
*
|
|
* _.max([4, 2, 8, 6]);
|
|
* // => 8
|
|
*
|
|
* _.max([]);
|
|
* // => undefined
|
|
*/
|
|
function max(array) {
|
|
return (array && array.length)
|
|
? (0,_baseExtremum/* default */.Z)(array, identity/* default */.Z, _baseGt)
|
|
: undefined;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_max = (max);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/last.js
|
|
var lodash_es_last = __webpack_require__(36411);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseAssignValue.js
|
|
var _baseAssignValue = __webpack_require__(93586);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseForOwn.js
|
|
var _baseForOwn = __webpack_require__(6202);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseIteratee.js + 15 modules
|
|
var _baseIteratee = __webpack_require__(86494);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/mapValues.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates an object with the same keys as `object` and values generated
|
|
* by running each own enumerable string keyed property of `object` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, key, object).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 2.4.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns the new mapped object.
|
|
* @see _.mapKeys
|
|
* @example
|
|
*
|
|
* var users = {
|
|
* 'fred': { 'user': 'fred', 'age': 40 },
|
|
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
|
|
* };
|
|
*
|
|
* _.mapValues(users, function(o) { return o.age; });
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.mapValues(users, 'age');
|
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
|
*/
|
|
function mapValues(object, iteratee) {
|
|
var result = {};
|
|
iteratee = (0,_baseIteratee/* default */.Z)(iteratee, 3);
|
|
|
|
(0,_baseForOwn/* default */.Z)(object, function(value, key, object) {
|
|
(0,_baseAssignValue/* default */.Z)(result, key, iteratee(value, key, object));
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_mapValues = (mapValues);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isUndefined.js
|
|
var isUndefined = __webpack_require__(52307);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/min.js
|
|
var lodash_es_min = __webpack_require__(18519);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/has.js + 1 modules
|
|
var has = __webpack_require__(36004);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_root.js
|
|
var _root = __webpack_require__(94311);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/now.js
|
|
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
var now = function() {
|
|
return _root/* default */.Z.Date.now();
|
|
};
|
|
|
|
/* harmony default export */ const lodash_es_now = (now);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/util.js
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Adds a dummy node to the graph and return v.
|
|
*/
|
|
function addDummyNode(g, type, attrs, name) {
|
|
var v;
|
|
do {
|
|
v = lodash_es_uniqueId(name);
|
|
} while (g.hasNode(v));
|
|
|
|
attrs.dummy = type;
|
|
g.setNode(v, attrs);
|
|
return v;
|
|
}
|
|
|
|
/*
|
|
* Returns a new graph with only simple edges. Handles aggregation of data
|
|
* associated with multi-edges.
|
|
*/
|
|
function simplify(g) {
|
|
var simplified = new graphlib/* Graph */.k().setGraph(g.graph());
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
simplified.setNode(v, g.node(v));
|
|
});
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 };
|
|
var label = g.edge(e);
|
|
simplified.setEdge(e.v, e.w, {
|
|
weight: simpleLabel.weight + label.weight,
|
|
minlen: Math.max(simpleLabel.minlen, label.minlen),
|
|
});
|
|
});
|
|
return simplified;
|
|
}
|
|
|
|
function asNonCompoundGraph(g) {
|
|
var simplified = new graphlib/* Graph */.k({ multigraph: g.isMultigraph() }).setGraph(g.graph());
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
if (!g.children(v).length) {
|
|
simplified.setNode(v, g.node(v));
|
|
}
|
|
});
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
simplified.setEdge(e, g.edge(e));
|
|
});
|
|
return simplified;
|
|
}
|
|
|
|
function successorWeights(g) {
|
|
var weightMap = _.map(g.nodes(), function (v) {
|
|
var sucs = {};
|
|
_.forEach(g.outEdges(v), function (e) {
|
|
sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;
|
|
});
|
|
return sucs;
|
|
});
|
|
return _.zipObject(g.nodes(), weightMap);
|
|
}
|
|
|
|
function predecessorWeights(g) {
|
|
var weightMap = _.map(g.nodes(), function (v) {
|
|
var preds = {};
|
|
_.forEach(g.inEdges(v), function (e) {
|
|
preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;
|
|
});
|
|
return preds;
|
|
});
|
|
return _.zipObject(g.nodes(), weightMap);
|
|
}
|
|
|
|
/*
|
|
* Finds where a line starting at point ({x, y}) would intersect a rectangle
|
|
* ({x, y, width, height}) if it were pointing at the rectangle's center.
|
|
*/
|
|
function intersectRect(rect, point) {
|
|
var x = rect.x;
|
|
var y = rect.y;
|
|
|
|
// Rectangle intersection algorithm from:
|
|
// http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
|
|
var dx = point.x - x;
|
|
var dy = point.y - y;
|
|
var w = rect.width / 2;
|
|
var h = rect.height / 2;
|
|
|
|
if (!dx && !dy) {
|
|
throw new Error('Not possible to find intersection inside of the rectangle');
|
|
}
|
|
|
|
var sx, sy;
|
|
if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
|
// Intersection is top or bottom of rect.
|
|
if (dy < 0) {
|
|
h = -h;
|
|
}
|
|
sx = (h * dx) / dy;
|
|
sy = h;
|
|
} else {
|
|
// Intersection is left or right of rect.
|
|
if (dx < 0) {
|
|
w = -w;
|
|
}
|
|
sx = w;
|
|
sy = (w * dy) / dx;
|
|
}
|
|
|
|
return { x: x + sx, y: y + sy };
|
|
}
|
|
|
|
/*
|
|
* Given a DAG with each node assigned "rank" and "order" properties, this
|
|
* function will produce a matrix with the ids of each node.
|
|
*/
|
|
function buildLayerMatrix(g) {
|
|
var layering = map/* default */.Z(lodash_es_range(util_maxRank(g) + 1), function () {
|
|
return [];
|
|
});
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
var rank = node.rank;
|
|
if (!isUndefined/* default */.Z(rank)) {
|
|
layering[rank][node.order] = v;
|
|
}
|
|
});
|
|
return layering;
|
|
}
|
|
|
|
/*
|
|
* Adjusts the ranks for all nodes in the graph such that all nodes v have
|
|
* rank(v) >= 0 and at least one node w has rank(w) = 0.
|
|
*/
|
|
function normalizeRanks(g) {
|
|
var min = lodash_es_min/* default */.Z(
|
|
map/* default */.Z(g.nodes(), function (v) {
|
|
return g.node(v).rank;
|
|
}),
|
|
);
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
if (has/* default */.Z(node, 'rank')) {
|
|
node.rank -= min;
|
|
}
|
|
});
|
|
}
|
|
|
|
function removeEmptyRanks(g) {
|
|
// Ranks may not start at 0, so we need to offset them
|
|
var offset = lodash_es_min/* default */.Z(
|
|
map/* default */.Z(g.nodes(), function (v) {
|
|
return g.node(v).rank;
|
|
}),
|
|
);
|
|
|
|
var layers = [];
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var rank = g.node(v).rank - offset;
|
|
if (!layers[rank]) {
|
|
layers[rank] = [];
|
|
}
|
|
layers[rank].push(v);
|
|
});
|
|
|
|
var delta = 0;
|
|
var nodeRankFactor = g.graph().nodeRankFactor;
|
|
forEach/* default */.Z(layers, function (vs, i) {
|
|
if (isUndefined/* default */.Z(vs) && i % nodeRankFactor !== 0) {
|
|
--delta;
|
|
} else if (delta) {
|
|
forEach/* default */.Z(vs, function (v) {
|
|
g.node(v).rank += delta;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function addBorderNode(g, prefix, rank, order) {
|
|
var node = {
|
|
width: 0,
|
|
height: 0,
|
|
};
|
|
if (arguments.length >= 4) {
|
|
node.rank = rank;
|
|
node.order = order;
|
|
}
|
|
return addDummyNode(g, 'border', node, prefix);
|
|
}
|
|
|
|
function util_maxRank(g) {
|
|
return lodash_es_max(
|
|
map/* default */.Z(g.nodes(), function (v) {
|
|
var rank = g.node(v).rank;
|
|
if (!isUndefined/* default */.Z(rank)) {
|
|
return rank;
|
|
}
|
|
}),
|
|
);
|
|
}
|
|
|
|
/*
|
|
* Partition a collection into two groups: `lhs` and `rhs`. If the supplied
|
|
* function returns true for an entry it goes into `lhs`. Otherwise it goes
|
|
* into `rhs.
|
|
*/
|
|
function partition(collection, fn) {
|
|
var result = { lhs: [], rhs: [] };
|
|
forEach/* default */.Z(collection, function (value) {
|
|
if (fn(value)) {
|
|
result.lhs.push(value);
|
|
} else {
|
|
result.rhs.push(value);
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/*
|
|
* Returns a new function that wraps `fn` with a timer. The wrapper logs the
|
|
* time it takes to execute the function.
|
|
*/
|
|
function util_time(name, fn) {
|
|
var start = lodash_es_now();
|
|
try {
|
|
return fn();
|
|
} finally {
|
|
console.log(name + ' time: ' + (lodash_es_now() - start) + 'ms');
|
|
}
|
|
}
|
|
|
|
function notime(name, fn) {
|
|
return fn();
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/add-border-segments.js
|
|
|
|
|
|
|
|
|
|
|
|
function addBorderSegments(g) {
|
|
function dfs(v) {
|
|
var children = g.children(v);
|
|
var node = g.node(v);
|
|
if (children.length) {
|
|
forEach/* default */.Z(children, dfs);
|
|
}
|
|
|
|
if (Object.prototype.hasOwnProperty.call(node, 'minRank')) {
|
|
node.borderLeft = [];
|
|
node.borderRight = [];
|
|
for (var rank = node.minRank, maxRank = node.maxRank + 1; rank < maxRank; ++rank) {
|
|
add_border_segments_addBorderNode(g, 'borderLeft', '_bl', v, node, rank);
|
|
add_border_segments_addBorderNode(g, 'borderRight', '_br', v, node, rank);
|
|
}
|
|
}
|
|
}
|
|
|
|
forEach/* default */.Z(g.children(), dfs);
|
|
}
|
|
|
|
function add_border_segments_addBorderNode(g, prop, prefix, sg, sgNode, rank) {
|
|
var label = { width: 0, height: 0, rank: rank, borderType: prop };
|
|
var prev = sgNode[prop][rank - 1];
|
|
var curr = addDummyNode(g, 'border', label, prefix);
|
|
sgNode[prop][rank] = curr;
|
|
g.setParent(curr, sg);
|
|
if (prev) {
|
|
g.setEdge(prev, curr, { weight: 1 });
|
|
}
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/coordinate-system.js
|
|
|
|
|
|
|
|
|
|
function adjust(g) {
|
|
var rankDir = g.graph().rankdir.toLowerCase();
|
|
if (rankDir === 'lr' || rankDir === 'rl') {
|
|
swapWidthHeight(g);
|
|
}
|
|
}
|
|
|
|
function coordinate_system_undo(g) {
|
|
var rankDir = g.graph().rankdir.toLowerCase();
|
|
if (rankDir === 'bt' || rankDir === 'rl') {
|
|
reverseY(g);
|
|
}
|
|
|
|
if (rankDir === 'lr' || rankDir === 'rl') {
|
|
swapXY(g);
|
|
swapWidthHeight(g);
|
|
}
|
|
}
|
|
|
|
function swapWidthHeight(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
swapWidthHeightOne(g.node(v));
|
|
});
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
swapWidthHeightOne(g.edge(e));
|
|
});
|
|
}
|
|
|
|
function swapWidthHeightOne(attrs) {
|
|
var w = attrs.width;
|
|
attrs.width = attrs.height;
|
|
attrs.height = w;
|
|
}
|
|
|
|
function reverseY(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
reverseYOne(g.node(v));
|
|
});
|
|
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
forEach/* default */.Z(edge.points, reverseYOne);
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'y')) {
|
|
reverseYOne(edge);
|
|
}
|
|
});
|
|
}
|
|
|
|
function reverseYOne(attrs) {
|
|
attrs.y = -attrs.y;
|
|
}
|
|
|
|
function swapXY(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
swapXYOne(g.node(v));
|
|
});
|
|
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
forEach/* default */.Z(edge.points, swapXYOne);
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'x')) {
|
|
swapXYOne(edge);
|
|
}
|
|
});
|
|
}
|
|
|
|
function swapXYOne(attrs) {
|
|
var x = attrs.x;
|
|
attrs.x = attrs.y;
|
|
attrs.y = x;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/normalize.js
|
|
/**
|
|
* TypeScript type imports:
|
|
*
|
|
* @import { Graph } from '../graphlib/graph.js';
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Breaks any long edges in the graph into short segments that span 1 layer
|
|
* each. This operation is undoable with the denormalize function.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. The input graph is a DAG.
|
|
* 2. Each node in the graph has a "rank" property.
|
|
*
|
|
* Post-condition:
|
|
*
|
|
* 1. All edges in the graph have a length of 1.
|
|
* 2. Dummy nodes are added where edges have been split into segments.
|
|
* 3. The graph is augmented with a "dummyChains" attribute which contains
|
|
* the first dummy in each chain of dummy nodes produced.
|
|
*/
|
|
function normalize_run(g) {
|
|
g.graph().dummyChains = [];
|
|
forEach/* default */.Z(g.edges(), function (edge) {
|
|
normalizeEdge(g, edge);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @param {Graph} g
|
|
*/
|
|
function normalizeEdge(g, e) {
|
|
var v = e.v;
|
|
var vRank = g.node(v).rank;
|
|
var w = e.w;
|
|
var wRank = g.node(w).rank;
|
|
var name = e.name;
|
|
var edgeLabel = g.edge(e);
|
|
var labelRank = edgeLabel.labelRank;
|
|
|
|
if (wRank === vRank + 1) return;
|
|
|
|
g.removeEdge(e);
|
|
|
|
/**
|
|
* @typedef {Object} Attrs
|
|
* @property {number} width
|
|
* @property {number} height
|
|
* @property {ReturnType<Graph["node"]>} edgeLabel
|
|
* @property {any} edgeObj
|
|
* @property {ReturnType<Graph["node"]>["rank"]} rank
|
|
* @property {string} [dummy]
|
|
* @property {ReturnType<Graph["node"]>["labelpos"]} [labelpos]
|
|
*/
|
|
|
|
/** @type {Attrs | undefined} */
|
|
var attrs = undefined;
|
|
var dummy, i;
|
|
for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {
|
|
edgeLabel.points = [];
|
|
attrs = {
|
|
width: 0,
|
|
height: 0,
|
|
edgeLabel: edgeLabel,
|
|
edgeObj: e,
|
|
rank: vRank,
|
|
};
|
|
dummy = addDummyNode(g, 'edge', attrs, '_d');
|
|
if (vRank === labelRank) {
|
|
attrs.width = edgeLabel.width;
|
|
attrs.height = edgeLabel.height;
|
|
attrs.dummy = 'edge-label';
|
|
attrs.labelpos = edgeLabel.labelpos;
|
|
}
|
|
g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);
|
|
if (i === 0) {
|
|
g.graph().dummyChains.push(dummy);
|
|
}
|
|
v = dummy;
|
|
}
|
|
|
|
g.setEdge(v, w, { weight: edgeLabel.weight }, name);
|
|
}
|
|
|
|
function normalize_undo(g) {
|
|
forEach/* default */.Z(g.graph().dummyChains, function (v) {
|
|
var node = g.node(v);
|
|
var origLabel = node.edgeLabel;
|
|
var w;
|
|
g.setEdge(node.edgeObj, origLabel);
|
|
while (node.dummy) {
|
|
w = g.successors(v)[0];
|
|
g.removeNode(v);
|
|
origLabel.points.push({ x: node.x, y: node.y });
|
|
if (node.dummy === 'edge-label') {
|
|
origLabel.x = node.x;
|
|
origLabel.y = node.y;
|
|
origLabel.width = node.width;
|
|
origLabel.height = node.height;
|
|
}
|
|
v = w;
|
|
node = g.node(v);
|
|
}
|
|
});
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseLt.js
|
|
var _baseLt = __webpack_require__(79520);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/minBy.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* This method is like `_.min` except that it accepts `iteratee` which is
|
|
* invoked for each element in `array` to generate the criterion by which
|
|
* the value is ranked. The iteratee is invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
*
|
|
* _.minBy(objects, function(o) { return o.n; });
|
|
* // => { 'n': 1 }
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.minBy(objects, 'n');
|
|
* // => { 'n': 1 }
|
|
*/
|
|
function minBy(array, iteratee) {
|
|
return (array && array.length)
|
|
? (0,_baseExtremum/* default */.Z)(array, (0,_baseIteratee/* default */.Z)(iteratee, 2), _baseLt/* default */.Z)
|
|
: undefined;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_minBy = (minBy);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/rank/util.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Initializes ranks for the input graph using the longest path algorithm. This
|
|
* algorithm scales well and is fast in practice, it yields rather poor
|
|
* solutions. Nodes are pushed to the lowest layer possible, leaving the bottom
|
|
* ranks wide and leaving edges longer than necessary. However, due to its
|
|
* speed, this algorithm is good for getting an initial ranking that can be fed
|
|
* into other algorithms.
|
|
*
|
|
* This algorithm does not normalize layers because it will be used by other
|
|
* algorithms in most cases. If using this algorithm directly, be sure to
|
|
* run normalize at the end.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Input graph is a DAG.
|
|
* 2. Input graph node labels can be assigned properties.
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* 1. Each node will be assign an (unnormalized) "rank" property.
|
|
*/
|
|
function longestPath(g) {
|
|
var visited = {};
|
|
|
|
function dfs(v) {
|
|
var label = g.node(v);
|
|
if (Object.prototype.hasOwnProperty.call(visited, v)) {
|
|
return label.rank;
|
|
}
|
|
visited[v] = true;
|
|
|
|
var rank = lodash_es_min/* default */.Z(
|
|
map/* default */.Z(g.outEdges(v), function (e) {
|
|
return dfs(e.w) - g.edge(e).minlen;
|
|
}),
|
|
);
|
|
|
|
if (
|
|
rank === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
|
|
rank === undefined || // return value of _.map([]) for Lodash 4
|
|
rank === null
|
|
) {
|
|
// return value of _.map([null])
|
|
rank = 0;
|
|
}
|
|
|
|
return (label.rank = rank);
|
|
}
|
|
|
|
forEach/* default */.Z(g.sources(), dfs);
|
|
}
|
|
|
|
/*
|
|
* Returns the amount of slack for the given edge. The slack is defined as the
|
|
* difference between the length of the edge and its minimum length.
|
|
*/
|
|
function slack(g, e) {
|
|
return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Constructs a spanning tree with tight edges and adjusted the input node's
|
|
* ranks to achieve this. A tight edge is one that is has a length that matches
|
|
* its "minlen" attribute.
|
|
*
|
|
* The basic structure for this function is derived from Gansner, et al., "A
|
|
* Technique for Drawing Directed Graphs."
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Graph must be a DAG.
|
|
* 2. Graph must be connected.
|
|
* 3. Graph must have at least one node.
|
|
* 5. Graph nodes must have been previously assigned a "rank" property that
|
|
* respects the "minlen" property of incident edges.
|
|
* 6. Graph edges must have a "minlen" property.
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* - Graph nodes will have their rank adjusted to ensure that all edges are
|
|
* tight.
|
|
*
|
|
* Returns a tree (undirected graph) that is constructed using only "tight"
|
|
* edges.
|
|
*/
|
|
function feasibleTree(g) {
|
|
var t = new graphlib/* Graph */.k({ directed: false });
|
|
|
|
// Choose arbitrary node from which to start our tree
|
|
var start = g.nodes()[0];
|
|
var size = g.nodeCount();
|
|
t.setNode(start, {});
|
|
|
|
var edge, delta;
|
|
while (tightTree(t, g) < size) {
|
|
edge = findMinSlackEdge(t, g);
|
|
delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);
|
|
shiftRanks(t, g, delta);
|
|
}
|
|
|
|
return t;
|
|
}
|
|
|
|
/*
|
|
* Finds a maximal tree of tight edges and returns the number of nodes in the
|
|
* tree.
|
|
*/
|
|
function tightTree(t, g) {
|
|
function dfs(v) {
|
|
forEach/* default */.Z(g.nodeEdges(v), function (e) {
|
|
var edgeV = e.v,
|
|
w = v === edgeV ? e.w : edgeV;
|
|
if (!t.hasNode(w) && !slack(g, e)) {
|
|
t.setNode(w, {});
|
|
t.setEdge(v, w, {});
|
|
dfs(w);
|
|
}
|
|
});
|
|
}
|
|
|
|
forEach/* default */.Z(t.nodes(), dfs);
|
|
return t.nodeCount();
|
|
}
|
|
|
|
/*
|
|
* Finds the edge with the smallest slack that is incident on tree and returns
|
|
* it.
|
|
*/
|
|
function findMinSlackEdge(t, g) {
|
|
return lodash_es_minBy(g.edges(), function (e) {
|
|
if (t.hasNode(e.v) !== t.hasNode(e.w)) {
|
|
return slack(g, e);
|
|
}
|
|
});
|
|
}
|
|
|
|
function shiftRanks(t, g, delta) {
|
|
forEach/* default */.Z(t.nodes(), function (v) {
|
|
g.node(v).rank += delta;
|
|
});
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/find.js + 2 modules
|
|
var find = __webpack_require__(90970);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/filter.js
|
|
var filter = __webpack_require__(11382);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULT_WEIGHT_FUNC = constant/* default */.Z(1);
|
|
|
|
function dijkstra_dijkstra(g, source, weightFn, edgeFn) {
|
|
return runDijkstra(
|
|
g,
|
|
String(source),
|
|
weightFn || DEFAULT_WEIGHT_FUNC,
|
|
edgeFn ||
|
|
function (v) {
|
|
return g.outEdges(v);
|
|
},
|
|
);
|
|
}
|
|
|
|
function runDijkstra(g, source, weightFn, edgeFn) {
|
|
var results = {};
|
|
var pq = new PriorityQueue();
|
|
var v, vEntry;
|
|
|
|
var updateNeighbors = function (edge) {
|
|
var w = edge.v !== v ? edge.v : edge.w;
|
|
var wEntry = results[w];
|
|
var weight = weightFn(edge);
|
|
var distance = vEntry.distance + weight;
|
|
|
|
if (weight < 0) {
|
|
throw new Error(
|
|
'dijkstra does not allow negative edge weights. ' +
|
|
'Bad edge: ' +
|
|
edge +
|
|
' Weight: ' +
|
|
weight,
|
|
);
|
|
}
|
|
|
|
if (distance < wEntry.distance) {
|
|
wEntry.distance = distance;
|
|
wEntry.predecessor = v;
|
|
pq.decrease(w, distance);
|
|
}
|
|
};
|
|
|
|
g.nodes().forEach(function (v) {
|
|
var distance = v === source ? 0 : Number.POSITIVE_INFINITY;
|
|
results[v] = { distance: distance };
|
|
pq.add(v, distance);
|
|
});
|
|
|
|
while (pq.size() > 0) {
|
|
v = pq.removeMin();
|
|
vEntry = results[v];
|
|
if (vEntry.distance === Number.POSITIVE_INFINITY) {
|
|
break;
|
|
}
|
|
|
|
edgeFn(v).forEach(updateNeighbors);
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js
|
|
|
|
|
|
|
|
|
|
|
|
function dijkstraAll(g, weightFunc, edgeFunc) {
|
|
return _.transform(
|
|
g.nodes(),
|
|
function (acc, v) {
|
|
acc[v] = dijkstra(g, v, weightFunc, edgeFunc);
|
|
},
|
|
{},
|
|
);
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js
|
|
|
|
|
|
|
|
|
|
var floyd_warshall_DEFAULT_WEIGHT_FUNC = constant/* default */.Z(1);
|
|
|
|
function floydWarshall(g, weightFn, edgeFn) {
|
|
return runFloydWarshall(
|
|
g,
|
|
weightFn || floyd_warshall_DEFAULT_WEIGHT_FUNC,
|
|
edgeFn ||
|
|
function (v) {
|
|
return g.outEdges(v);
|
|
},
|
|
);
|
|
}
|
|
|
|
function runFloydWarshall(g, weightFn, edgeFn) {
|
|
var results = {};
|
|
var nodes = g.nodes();
|
|
|
|
nodes.forEach(function (v) {
|
|
results[v] = {};
|
|
results[v][v] = { distance: 0 };
|
|
nodes.forEach(function (w) {
|
|
if (v !== w) {
|
|
results[v][w] = { distance: Number.POSITIVE_INFINITY };
|
|
}
|
|
});
|
|
edgeFn(v).forEach(function (edge) {
|
|
var w = edge.v === v ? edge.w : edge.v;
|
|
var d = weightFn(edge);
|
|
results[v][w] = { distance: d, predecessor: v };
|
|
});
|
|
});
|
|
|
|
nodes.forEach(function (k) {
|
|
var rowK = results[k];
|
|
nodes.forEach(function (i) {
|
|
var rowI = results[i];
|
|
nodes.forEach(function (j) {
|
|
var ik = rowI[k];
|
|
var kj = rowK[j];
|
|
var ij = rowI[j];
|
|
var altDistance = ik.distance + kj.distance;
|
|
if (altDistance < ij.distance) {
|
|
ij.distance = altDistance;
|
|
ij.predecessor = kj.predecessor;
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
return results;
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseKeys.js + 1 modules
|
|
var _baseKeys = __webpack_require__(45934);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_getTag.js + 3 modules
|
|
var _getTag = __webpack_require__(41182);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLike.js
|
|
var isArrayLike = __webpack_require__(69959);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isString.js
|
|
var isString = __webpack_require__(75732);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseProperty.js
|
|
var _baseProperty = __webpack_require__(4561);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_asciiSize.js
|
|
|
|
|
|
/**
|
|
* Gets the size of an ASCII `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
var asciiSize = (0,_baseProperty/* default */.Z)('length');
|
|
|
|
/* harmony default export */ const _asciiSize = (asciiSize);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_hasUnicode.js
|
|
/** Used to compose unicode character classes. */
|
|
var rsAstralRange = '\\ud800-\\udfff',
|
|
rsComboMarksRange = '\\u0300-\\u036f',
|
|
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
|
|
rsVarRange = '\\ufe0e\\ufe0f';
|
|
|
|
/** Used to compose unicode capture groups. */
|
|
var rsZWJ = '\\u200d';
|
|
|
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
|
|
|
|
/**
|
|
* Checks if `string` contains Unicode symbols.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
*/
|
|
function hasUnicode(string) {
|
|
return reHasUnicode.test(string);
|
|
}
|
|
|
|
/* harmony default export */ const _hasUnicode = (hasUnicode);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_unicodeSize.js
|
|
/** Used to compose unicode character classes. */
|
|
var _unicodeSize_rsAstralRange = '\\ud800-\\udfff',
|
|
_unicodeSize_rsComboMarksRange = '\\u0300-\\u036f',
|
|
_unicodeSize_reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
_unicodeSize_rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
_unicodeSize_rsComboRange = _unicodeSize_rsComboMarksRange + _unicodeSize_reComboHalfMarksRange + _unicodeSize_rsComboSymbolsRange,
|
|
_unicodeSize_rsVarRange = '\\ufe0e\\ufe0f';
|
|
|
|
/** Used to compose unicode capture groups. */
|
|
var rsAstral = '[' + _unicodeSize_rsAstralRange + ']',
|
|
rsCombo = '[' + _unicodeSize_rsComboRange + ']',
|
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
rsNonAstral = '[^' + _unicodeSize_rsAstralRange + ']',
|
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
_unicodeSize_rsZWJ = '\\u200d';
|
|
|
|
/** Used to compose unicode regexes. */
|
|
var reOptMod = rsModifier + '?',
|
|
rsOptVar = '[' + _unicodeSize_rsVarRange + ']?',
|
|
rsOptJoin = '(?:' + _unicodeSize_rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
|
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
|
|
/**
|
|
* Gets the size of a Unicode `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function unicodeSize(string) {
|
|
var result = reUnicode.lastIndex = 0;
|
|
while (reUnicode.test(string)) {
|
|
++result;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const _unicodeSize = (unicodeSize);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_stringSize.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Gets the number of symbols in `string`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to inspect.
|
|
* @returns {number} Returns the string size.
|
|
*/
|
|
function stringSize(string) {
|
|
return _hasUnicode(string)
|
|
? _unicodeSize(string)
|
|
: _asciiSize(string);
|
|
}
|
|
|
|
/* harmony default export */ const _stringSize = (stringSize);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/size.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** `Object#toString` result references. */
|
|
var mapTag = '[object Map]',
|
|
setTag = '[object Set]';
|
|
|
|
/**
|
|
* Gets the size of `collection` by returning its length for array-like
|
|
* values or the number of own enumerable string keyed properties for objects.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object|string} collection The collection to inspect.
|
|
* @returns {number} Returns the collection size.
|
|
* @example
|
|
*
|
|
* _.size([1, 2, 3]);
|
|
* // => 3
|
|
*
|
|
* _.size({ 'a': 1, 'b': 2 });
|
|
* // => 2
|
|
*
|
|
* _.size('pebbles');
|
|
* // => 7
|
|
*/
|
|
function size(collection) {
|
|
if (collection == null) {
|
|
return 0;
|
|
}
|
|
if ((0,isArrayLike/* default */.Z)(collection)) {
|
|
return (0,isString/* default */.Z)(collection) ? _stringSize(collection) : collection.length;
|
|
}
|
|
var tag = (0,_getTag/* default */.Z)(collection);
|
|
if (tag == mapTag || tag == setTag) {
|
|
return collection.size;
|
|
}
|
|
return (0,_baseKeys/* default */.Z)(collection).length;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_size = (size);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/topsort.js
|
|
|
|
|
|
|
|
|
|
topsort_topsort.CycleException = topsort_CycleException;
|
|
|
|
function topsort_topsort(g) {
|
|
var visited = {};
|
|
var stack = {};
|
|
var results = [];
|
|
|
|
function visit(node) {
|
|
if (Object.prototype.hasOwnProperty.call(stack, node)) {
|
|
throw new topsort_CycleException();
|
|
}
|
|
|
|
if (!Object.prototype.hasOwnProperty.call(visited, node)) {
|
|
stack[node] = true;
|
|
visited[node] = true;
|
|
forEach/* default */.Z(g.predecessors(node), visit);
|
|
delete stack[node];
|
|
results.push(node);
|
|
}
|
|
}
|
|
|
|
forEach/* default */.Z(g.sinks(), visit);
|
|
|
|
if (lodash_es_size(visited) !== g.nodeCount()) {
|
|
throw new topsort_CycleException();
|
|
}
|
|
|
|
return results;
|
|
}
|
|
|
|
function topsort_CycleException() {}
|
|
topsort_CycleException.prototype = new Error(); // must be an instance of Error to pass testing
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js
|
|
|
|
|
|
|
|
|
|
function isAcyclic(g) {
|
|
try {
|
|
topsort(g);
|
|
} catch (e) {
|
|
if (e instanceof CycleException) {
|
|
return false;
|
|
}
|
|
throw e;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isArray.js
|
|
var isArray = __webpack_require__(64058);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/dfs.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* A helper that preforms a pre- or post-order traversal on the input graph
|
|
* and returns the nodes in the order they were visited. If the graph is
|
|
* undirected then this algorithm will navigate using neighbors. If the graph
|
|
* is directed then this algorithm will navigate using successors.
|
|
*
|
|
* Order must be one of "pre" or "post".
|
|
*/
|
|
function dfs(g, vs, order) {
|
|
if (!isArray/* default */.Z(vs)) {
|
|
vs = [vs];
|
|
}
|
|
|
|
var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g);
|
|
|
|
var acc = [];
|
|
var visited = {};
|
|
forEach/* default */.Z(vs, function (v) {
|
|
if (!g.hasNode(v)) {
|
|
throw new Error('Graph does not have node: ' + v);
|
|
}
|
|
|
|
doDfs(g, v, order === 'post', visited, navigation, acc);
|
|
});
|
|
return acc;
|
|
}
|
|
|
|
function doDfs(g, v, postorder, visited, navigation, acc) {
|
|
if (!Object.prototype.hasOwnProperty.call(visited, v)) {
|
|
visited[v] = true;
|
|
|
|
if (!postorder) {
|
|
acc.push(v);
|
|
}
|
|
forEach/* default */.Z(navigation(v), function (w) {
|
|
doDfs(g, w, postorder, visited, navigation, acc);
|
|
});
|
|
if (postorder) {
|
|
acc.push(v);
|
|
}
|
|
}
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/postorder.js
|
|
|
|
|
|
|
|
|
|
function postorder(g, vs) {
|
|
return dfs(g, vs, 'post');
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/preorder.js
|
|
|
|
|
|
|
|
|
|
function preorder(g, vs) {
|
|
return dfs(g, vs, 'pre');
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/dagre-d3-es/src/graphlib/graph.js + 1 modules
|
|
var graph = __webpack_require__(11109);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/prim.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function prim(g, weightFunc) {
|
|
var result = new Graph();
|
|
var parents = {};
|
|
var pq = new PriorityQueue();
|
|
var v;
|
|
|
|
function updateNeighbors(edge) {
|
|
var w = edge.v === v ? edge.w : edge.v;
|
|
var pri = pq.priority(w);
|
|
if (pri !== undefined) {
|
|
var edgeWeight = weightFunc(edge);
|
|
if (edgeWeight < pri) {
|
|
parents[w] = v;
|
|
pq.decrease(w, edgeWeight);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (g.nodeCount() === 0) {
|
|
return result;
|
|
}
|
|
|
|
_.each(g.nodes(), function (v) {
|
|
pq.add(v, Number.POSITIVE_INFINITY);
|
|
result.setNode(v);
|
|
});
|
|
|
|
// Start from an arbitrary node
|
|
pq.decrease(g.nodes()[0], 0);
|
|
|
|
var init = false;
|
|
while (pq.size() > 0) {
|
|
v = pq.removeMin();
|
|
if (Object.prototype.hasOwnProperty.call(parents, v)) {
|
|
result.setEdge(v, parents[v]);
|
|
} else if (init) {
|
|
throw new Error('Input graph is not connected: ' + g);
|
|
} else {
|
|
init = true;
|
|
}
|
|
|
|
g.nodeEdges(v).forEach(updateNeighbors);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/alg/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Expose some internals for testing purposes
|
|
networkSimplex.initLowLimValues = initLowLimValues;
|
|
networkSimplex.initCutValues = initCutValues;
|
|
networkSimplex.calcCutValue = calcCutValue;
|
|
networkSimplex.leaveEdge = leaveEdge;
|
|
networkSimplex.enterEdge = enterEdge;
|
|
networkSimplex.exchangeEdges = exchangeEdges;
|
|
|
|
/*
|
|
* The network simplex algorithm assigns ranks to each node in the input graph
|
|
* and iteratively improves the ranking to reduce the length of edges.
|
|
*
|
|
* Preconditions:
|
|
*
|
|
* 1. The input graph must be a DAG.
|
|
* 2. All nodes in the graph must have an object value.
|
|
* 3. All edges in the graph must have "minlen" and "weight" attributes.
|
|
*
|
|
* Postconditions:
|
|
*
|
|
* 1. All nodes in the graph will have an assigned "rank" attribute that has
|
|
* been optimized by the network simplex algorithm. Ranks start at 0.
|
|
*
|
|
*
|
|
* A rough sketch of the algorithm is as follows:
|
|
*
|
|
* 1. Assign initial ranks to each node. We use the longest path algorithm,
|
|
* which assigns ranks to the lowest position possible. In general this
|
|
* leads to very wide bottom ranks and unnecessarily long edges.
|
|
* 2. Construct a feasible tight tree. A tight tree is one such that all
|
|
* edges in the tree have no slack (difference between length of edge
|
|
* and minlen for the edge). This by itself greatly improves the assigned
|
|
* rankings by shorting edges.
|
|
* 3. Iteratively find edges that have negative cut values. Generally a
|
|
* negative cut value indicates that the edge could be removed and a new
|
|
* tree edge could be added to produce a more compact graph.
|
|
*
|
|
* Much of the algorithms here are derived from Gansner, et al., "A Technique
|
|
* for Drawing Directed Graphs." The structure of the file roughly follows the
|
|
* structure of the overall algorithm.
|
|
*/
|
|
function networkSimplex(g) {
|
|
g = simplify(g);
|
|
longestPath(g);
|
|
var t = feasibleTree(g);
|
|
initLowLimValues(t);
|
|
initCutValues(t, g);
|
|
|
|
var e, f;
|
|
while ((e = leaveEdge(t))) {
|
|
f = enterEdge(t, g, e);
|
|
exchangeEdges(t, g, e, f);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Initializes cut values for all edges in the tree.
|
|
*/
|
|
function initCutValues(t, g) {
|
|
var vs = postorder(t, t.nodes());
|
|
vs = vs.slice(0, vs.length - 1);
|
|
forEach/* default */.Z(vs, function (v) {
|
|
assignCutValue(t, g, v);
|
|
});
|
|
}
|
|
|
|
function assignCutValue(t, g, child) {
|
|
var childLab = t.node(child);
|
|
var parent = childLab.parent;
|
|
t.edge(child, parent).cutvalue = calcCutValue(t, g, child);
|
|
}
|
|
|
|
/*
|
|
* Given the tight tree, its graph, and a child in the graph calculate and
|
|
* return the cut value for the edge between the child and its parent.
|
|
*/
|
|
function calcCutValue(t, g, child) {
|
|
var childLab = t.node(child);
|
|
var parent = childLab.parent;
|
|
// True if the child is on the tail end of the edge in the directed graph
|
|
var childIsTail = true;
|
|
// The graph's view of the tree edge we're inspecting
|
|
var graphEdge = g.edge(child, parent);
|
|
// The accumulated cut value for the edge between this node and its parent
|
|
var cutValue = 0;
|
|
|
|
if (!graphEdge) {
|
|
childIsTail = false;
|
|
graphEdge = g.edge(parent, child);
|
|
}
|
|
|
|
cutValue = graphEdge.weight;
|
|
|
|
forEach/* default */.Z(g.nodeEdges(child), function (e) {
|
|
var isOutEdge = e.v === child,
|
|
other = isOutEdge ? e.w : e.v;
|
|
|
|
if (other !== parent) {
|
|
var pointsToHead = isOutEdge === childIsTail,
|
|
otherWeight = g.edge(e).weight;
|
|
|
|
cutValue += pointsToHead ? otherWeight : -otherWeight;
|
|
if (isTreeEdge(t, child, other)) {
|
|
var otherCutValue = t.edge(child, other).cutvalue;
|
|
cutValue += pointsToHead ? -otherCutValue : otherCutValue;
|
|
}
|
|
}
|
|
});
|
|
|
|
return cutValue;
|
|
}
|
|
|
|
function initLowLimValues(tree, root) {
|
|
if (arguments.length < 2) {
|
|
root = tree.nodes()[0];
|
|
}
|
|
dfsAssignLowLim(tree, {}, 1, root);
|
|
}
|
|
|
|
function dfsAssignLowLim(tree, visited, nextLim, v, parent) {
|
|
var low = nextLim;
|
|
var label = tree.node(v);
|
|
|
|
visited[v] = true;
|
|
forEach/* default */.Z(tree.neighbors(v), function (w) {
|
|
if (!Object.prototype.hasOwnProperty.call(visited, w)) {
|
|
nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);
|
|
}
|
|
});
|
|
|
|
label.low = low;
|
|
label.lim = nextLim++;
|
|
if (parent) {
|
|
label.parent = parent;
|
|
} else {
|
|
// TODO should be able to remove this when we incrementally update low lim
|
|
delete label.parent;
|
|
}
|
|
|
|
return nextLim;
|
|
}
|
|
|
|
function leaveEdge(tree) {
|
|
return find/* default */.Z(tree.edges(), function (e) {
|
|
return tree.edge(e).cutvalue < 0;
|
|
});
|
|
}
|
|
|
|
function enterEdge(t, g, edge) {
|
|
var v = edge.v;
|
|
var w = edge.w;
|
|
|
|
// For the rest of this function we assume that v is the tail and w is the
|
|
// head, so if we don't have this edge in the graph we should flip it to
|
|
// match the correct orientation.
|
|
if (!g.hasEdge(v, w)) {
|
|
v = edge.w;
|
|
w = edge.v;
|
|
}
|
|
|
|
var vLabel = t.node(v);
|
|
var wLabel = t.node(w);
|
|
var tailLabel = vLabel;
|
|
var flip = false;
|
|
|
|
// If the root is in the tail of the edge then we need to flip the logic that
|
|
// checks for the head and tail nodes in the candidates function below.
|
|
if (vLabel.lim > wLabel.lim) {
|
|
tailLabel = wLabel;
|
|
flip = true;
|
|
}
|
|
|
|
var candidates = filter/* default */.Z(g.edges(), function (edge) {
|
|
return (
|
|
flip === isDescendant(t, t.node(edge.v), tailLabel) &&
|
|
flip !== isDescendant(t, t.node(edge.w), tailLabel)
|
|
);
|
|
});
|
|
|
|
return lodash_es_minBy(candidates, function (edge) {
|
|
return slack(g, edge);
|
|
});
|
|
}
|
|
|
|
function exchangeEdges(t, g, e, f) {
|
|
var v = e.v;
|
|
var w = e.w;
|
|
t.removeEdge(v, w);
|
|
t.setEdge(f.v, f.w, {});
|
|
initLowLimValues(t);
|
|
initCutValues(t, g);
|
|
updateRanks(t, g);
|
|
}
|
|
|
|
function updateRanks(t, g) {
|
|
var root = find/* default */.Z(t.nodes(), function (v) {
|
|
return !g.node(v).parent;
|
|
});
|
|
var vs = preorder(t, root);
|
|
vs = vs.slice(1);
|
|
forEach/* default */.Z(vs, function (v) {
|
|
var parent = t.node(v).parent,
|
|
edge = g.edge(v, parent),
|
|
flipped = false;
|
|
|
|
if (!edge) {
|
|
edge = g.edge(parent, v);
|
|
flipped = true;
|
|
}
|
|
|
|
g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);
|
|
});
|
|
}
|
|
|
|
/*
|
|
* Returns true if the edge is in the tree.
|
|
*/
|
|
function isTreeEdge(tree, u, v) {
|
|
return tree.hasEdge(u, v);
|
|
}
|
|
|
|
/*
|
|
* Returns true if the specified node is descendant of the root node per the
|
|
* assigned low and lim attributes in the tree.
|
|
*/
|
|
function isDescendant(tree, vLabel, rootLabel) {
|
|
return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/rank/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Assigns a rank to each node in the input graph that respects the "minlen"
|
|
* constraint specified on edges between nodes.
|
|
*
|
|
* This basic structure is derived from Gansner, et al., "A Technique for
|
|
* Drawing Directed Graphs."
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Graph must be a connected DAG
|
|
* 2. Graph nodes must be objects
|
|
* 3. Graph edges must have "weight" and "minlen" attributes
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* 1. Graph nodes will have a "rank" attribute based on the results of the
|
|
* algorithm. Ranks can start at any index (including negative), we'll
|
|
* fix them up later.
|
|
*/
|
|
function rank(g) {
|
|
switch (g.graph().ranker) {
|
|
case 'network-simplex':
|
|
networkSimplexRanker(g);
|
|
break;
|
|
case 'tight-tree':
|
|
tightTreeRanker(g);
|
|
break;
|
|
case 'longest-path':
|
|
longestPathRanker(g);
|
|
break;
|
|
default:
|
|
networkSimplexRanker(g);
|
|
}
|
|
}
|
|
|
|
// A fast and simple ranker, but results are far from optimal.
|
|
var longestPathRanker = longestPath;
|
|
|
|
function tightTreeRanker(g) {
|
|
longestPath(g);
|
|
feasibleTree(g);
|
|
}
|
|
|
|
function networkSimplexRanker(g) {
|
|
networkSimplex(g);
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/values.js + 1 modules
|
|
var values = __webpack_require__(88873);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/reduce.js + 2 modules
|
|
var reduce = __webpack_require__(99413);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/nesting-graph.js
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,
|
|
* adds appropriate edges to ensure that all cluster nodes are placed between
|
|
* these boundries, and ensures that the graph is connected.
|
|
*
|
|
* In addition we ensure, through the use of the minlen property, that nodes
|
|
* and subgraph border nodes to not end up on the same rank.
|
|
*
|
|
* Preconditions:
|
|
*
|
|
* 1. Input graph is a DAG
|
|
* 2. Nodes in the input graph has a minlen attribute
|
|
*
|
|
* Postconditions:
|
|
*
|
|
* 1. Input graph is connected.
|
|
* 2. Dummy nodes are added for the tops and bottoms of subgraphs.
|
|
* 3. The minlen attribute for nodes is adjusted to ensure nodes do not
|
|
* get placed on the same rank as subgraph border nodes.
|
|
*
|
|
* The nesting graph idea comes from Sander, "Layout of Compound Directed
|
|
* Graphs."
|
|
*/
|
|
function nesting_graph_run(g) {
|
|
var root = addDummyNode(g, 'root', {}, '_root');
|
|
var depths = treeDepths(g);
|
|
var height = lodash_es_max(values/* default */.Z(depths)) - 1; // Note: depths is an Object not an array
|
|
var nodeSep = 2 * height + 1;
|
|
|
|
g.graph().nestingRoot = root;
|
|
|
|
// Multiply minlen by nodeSep to align nodes on non-border ranks.
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
g.edge(e).minlen *= nodeSep;
|
|
});
|
|
|
|
// Calculate a weight that is sufficient to keep subgraphs vertically compact
|
|
var weight = sumWeights(g) + 1;
|
|
|
|
// Create border nodes and link them up
|
|
forEach/* default */.Z(g.children(), function (child) {
|
|
nesting_graph_dfs(g, root, nodeSep, weight, height, depths, child);
|
|
});
|
|
|
|
// Save the multiplier for node layers for later removal of empty border
|
|
// layers.
|
|
g.graph().nodeRankFactor = nodeSep;
|
|
}
|
|
|
|
function nesting_graph_dfs(g, root, nodeSep, weight, height, depths, v) {
|
|
var children = g.children(v);
|
|
if (!children.length) {
|
|
if (v !== root) {
|
|
g.setEdge(root, v, { weight: 0, minlen: nodeSep });
|
|
}
|
|
return;
|
|
}
|
|
|
|
var top = addBorderNode(g, '_bt');
|
|
var bottom = addBorderNode(g, '_bb');
|
|
var label = g.node(v);
|
|
|
|
g.setParent(top, v);
|
|
label.borderTop = top;
|
|
g.setParent(bottom, v);
|
|
label.borderBottom = bottom;
|
|
|
|
forEach/* default */.Z(children, function (child) {
|
|
nesting_graph_dfs(g, root, nodeSep, weight, height, depths, child);
|
|
|
|
var childNode = g.node(child);
|
|
var childTop = childNode.borderTop ? childNode.borderTop : child;
|
|
var childBottom = childNode.borderBottom ? childNode.borderBottom : child;
|
|
var thisWeight = childNode.borderTop ? weight : 2 * weight;
|
|
var minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;
|
|
|
|
g.setEdge(top, childTop, {
|
|
weight: thisWeight,
|
|
minlen: minlen,
|
|
nestingEdge: true,
|
|
});
|
|
|
|
g.setEdge(childBottom, bottom, {
|
|
weight: thisWeight,
|
|
minlen: minlen,
|
|
nestingEdge: true,
|
|
});
|
|
});
|
|
|
|
if (!g.parent(v)) {
|
|
g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });
|
|
}
|
|
}
|
|
|
|
function treeDepths(g) {
|
|
var depths = {};
|
|
function dfs(v, depth) {
|
|
var children = g.children(v);
|
|
if (children && children.length) {
|
|
forEach/* default */.Z(children, function (child) {
|
|
dfs(child, depth + 1);
|
|
});
|
|
}
|
|
depths[v] = depth;
|
|
}
|
|
forEach/* default */.Z(g.children(), function (v) {
|
|
dfs(v, 1);
|
|
});
|
|
return depths;
|
|
}
|
|
|
|
function sumWeights(g) {
|
|
return reduce/* default */.Z(
|
|
g.edges(),
|
|
function (acc, e) {
|
|
return acc + g.edge(e).weight;
|
|
},
|
|
0,
|
|
);
|
|
}
|
|
|
|
function cleanup(g) {
|
|
var graphLabel = g.graph();
|
|
g.removeNode(graphLabel.nestingRoot);
|
|
delete graphLabel.nestingRoot;
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
if (edge.nestingEdge) {
|
|
g.removeEdge(e);
|
|
}
|
|
});
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseClone.js + 13 modules
|
|
var _baseClone = __webpack_require__(52390);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/cloneDeep.js
|
|
|
|
|
|
/** Used to compose bitmasks for cloning. */
|
|
var CLONE_DEEP_FLAG = 1,
|
|
CLONE_SYMBOLS_FLAG = 4;
|
|
|
|
/**
|
|
* This method is like `_.clone` except that it recursively clones `value`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to recursively clone.
|
|
* @returns {*} Returns the deep cloned value.
|
|
* @see _.clone
|
|
* @example
|
|
*
|
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
*
|
|
* var deep = _.cloneDeep(objects);
|
|
* console.log(deep[0] === objects[0]);
|
|
* // => false
|
|
*/
|
|
function cloneDeep(value) {
|
|
return (0,_baseClone/* default */.Z)(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_cloneDeep = (cloneDeep);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js
|
|
|
|
|
|
|
|
|
|
function addSubgraphConstraints(g, cg, vs) {
|
|
var prev = {},
|
|
rootPrev;
|
|
|
|
forEach/* default */.Z(vs, function (v) {
|
|
var child = g.parent(v),
|
|
parent,
|
|
prevChild;
|
|
while (child) {
|
|
parent = g.parent(child);
|
|
if (parent) {
|
|
prevChild = prev[parent];
|
|
prev[parent] = child;
|
|
} else {
|
|
prevChild = rootPrev;
|
|
rootPrev = child;
|
|
}
|
|
if (prevChild && prevChild !== child) {
|
|
cg.setEdge(prevChild, child);
|
|
return;
|
|
}
|
|
child = parent;
|
|
}
|
|
});
|
|
|
|
/*
|
|
function dfs(v) {
|
|
var children = v ? g.children(v) : g.children();
|
|
if (children.length) {
|
|
var min = Number.POSITIVE_INFINITY,
|
|
subgraphs = [];
|
|
_.each(children, function(child) {
|
|
var childMin = dfs(child);
|
|
if (g.children(child).length) {
|
|
subgraphs.push({ v: child, order: childMin });
|
|
}
|
|
min = Math.min(min, childMin);
|
|
});
|
|
_.reduce(_.sortBy(subgraphs, "order"), function(prev, curr) {
|
|
cg.setEdge(prev.v, curr.v);
|
|
return curr;
|
|
});
|
|
return min;
|
|
}
|
|
return g.node(v).order;
|
|
}
|
|
dfs(undefined);
|
|
*/
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Constructs a graph that can be used to sort a layer of nodes. The graph will
|
|
* contain all base and subgraph nodes from the request layer in their original
|
|
* hierarchy and any edges that are incident on these nodes and are of the type
|
|
* requested by the "relationship" parameter.
|
|
*
|
|
* Nodes from the requested rank that do not have parents are assigned a root
|
|
* node in the output graph, which is set in the root graph attribute. This
|
|
* makes it easy to walk the hierarchy of movable nodes during ordering.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Input graph is a DAG
|
|
* 2. Base nodes in the input graph have a rank attribute
|
|
* 3. Subgraph nodes in the input graph has minRank and maxRank attributes
|
|
* 4. Edges have an assigned weight
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* 1. Output graph has all nodes in the movable rank with preserved
|
|
* hierarchy.
|
|
* 2. Root nodes in the movable layer are made children of the node
|
|
* indicated by the root attribute of the graph.
|
|
* 3. Non-movable nodes incident on movable nodes, selected by the
|
|
* relationship parameter, are included in the graph (without hierarchy).
|
|
* 4. Edges incident on movable nodes, selected by the relationship
|
|
* parameter, are added to the output graph.
|
|
* 5. The weights for copied edges are aggregated as need, since the output
|
|
* graph is not a multi-graph.
|
|
*/
|
|
function buildLayerGraph(g, rank, relationship) {
|
|
var root = createRootNode(g),
|
|
result = new graphlib/* Graph */.k({ compound: true })
|
|
.setGraph({ root: root })
|
|
.setDefaultNodeLabel(function (v) {
|
|
return g.node(v);
|
|
});
|
|
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v),
|
|
parent = g.parent(v);
|
|
|
|
if (node.rank === rank || (node.minRank <= rank && rank <= node.maxRank)) {
|
|
result.setNode(v);
|
|
result.setParent(v, parent || root);
|
|
|
|
// This assumes we have only short edges!
|
|
forEach/* default */.Z(g[relationship](v), function (e) {
|
|
var u = e.v === v ? e.w : e.v,
|
|
edge = result.edge(u, v),
|
|
weight = !isUndefined/* default */.Z(edge) ? edge.weight : 0;
|
|
result.setEdge(u, v, { weight: g.edge(e).weight + weight });
|
|
});
|
|
|
|
if (Object.prototype.hasOwnProperty.call(node, 'minRank')) {
|
|
result.setNode(v, {
|
|
borderLeft: node.borderLeft[rank],
|
|
borderRight: node.borderRight[rank],
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
return result;
|
|
}
|
|
|
|
function createRootNode(g) {
|
|
var v;
|
|
while (g.hasNode((v = lodash_es_uniqueId('_root'))));
|
|
return v;
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_assignValue.js
|
|
var _assignValue = __webpack_require__(15561);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseZipObject.js
|
|
/**
|
|
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
|
*
|
|
* @private
|
|
* @param {Array} props The property identifiers.
|
|
* @param {Array} values The property values.
|
|
* @param {Function} assignFunc The function to assign values.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function baseZipObject(props, values, assignFunc) {
|
|
var index = -1,
|
|
length = props.length,
|
|
valsLength = values.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var value = index < valsLength ? values[index] : undefined;
|
|
assignFunc(result, props[index], value);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const _baseZipObject = (baseZipObject);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/zipObject.js
|
|
|
|
|
|
|
|
/**
|
|
* This method is like `_.fromPairs` except that it accepts two arrays,
|
|
* one of property identifiers and one of corresponding values.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.4.0
|
|
* @category Array
|
|
* @param {Array} [props=[]] The property identifiers.
|
|
* @param {Array} [values=[]] The property values.
|
|
* @returns {Object} Returns the new object.
|
|
* @example
|
|
*
|
|
* _.zipObject(['a', 'b'], [1, 2]);
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
function zipObject(props, values) {
|
|
return _baseZipObject(props || [], values || [], _assignValue/* default */.Z);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_zipObject = (zipObject);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseFlatten.js + 1 modules
|
|
var _baseFlatten = __webpack_require__(65029);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_arrayMap.js
|
|
var _arrayMap = __webpack_require__(33043);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseGet.js
|
|
var _baseGet = __webpack_require__(78402);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseMap.js
|
|
var _baseMap = __webpack_require__(15521);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseSortBy.js
|
|
/**
|
|
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
* sort order of `array` and replaces criteria objects with their corresponding
|
|
* values.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to sort.
|
|
* @param {Function} comparer The function to define sort order.
|
|
* @returns {Array} Returns `array`.
|
|
*/
|
|
function baseSortBy(array, comparer) {
|
|
var length = array.length;
|
|
|
|
array.sort(comparer);
|
|
while (length--) {
|
|
array[length] = array[length].value;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
/* harmony default export */ const _baseSortBy = (baseSortBy);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseUnary.js
|
|
var _baseUnary = __webpack_require__(20274);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isSymbol.js
|
|
var isSymbol = __webpack_require__(59660);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_compareAscending.js
|
|
|
|
|
|
/**
|
|
* Compares values to sort them in ascending order.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {number} Returns the sort order indicator for `value`.
|
|
*/
|
|
function compareAscending(value, other) {
|
|
if (value !== other) {
|
|
var valIsDefined = value !== undefined,
|
|
valIsNull = value === null,
|
|
valIsReflexive = value === value,
|
|
valIsSymbol = (0,isSymbol/* default */.Z)(value);
|
|
|
|
var othIsDefined = other !== undefined,
|
|
othIsNull = other === null,
|
|
othIsReflexive = other === other,
|
|
othIsSymbol = (0,isSymbol/* default */.Z)(other);
|
|
|
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
(!valIsDefined && othIsReflexive) ||
|
|
!valIsReflexive) {
|
|
return 1;
|
|
}
|
|
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
(!othIsDefined && valIsReflexive) ||
|
|
!othIsReflexive) {
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* harmony default export */ const _compareAscending = (compareAscending);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_compareMultiple.js
|
|
|
|
|
|
/**
|
|
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
* and stable sort them.
|
|
*
|
|
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
* of corresponding values.
|
|
*
|
|
* @private
|
|
* @param {Object} object The object to compare.
|
|
* @param {Object} other The other object to compare.
|
|
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
* @returns {number} Returns the sort order indicator for `object`.
|
|
*/
|
|
function compareMultiple(object, other, orders) {
|
|
var index = -1,
|
|
objCriteria = object.criteria,
|
|
othCriteria = other.criteria,
|
|
length = objCriteria.length,
|
|
ordersLength = orders.length;
|
|
|
|
while (++index < length) {
|
|
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
if (result) {
|
|
if (index >= ordersLength) {
|
|
return result;
|
|
}
|
|
var order = orders[index];
|
|
return result * (order == 'desc' ? -1 : 1);
|
|
}
|
|
}
|
|
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
// that causes it, under certain circumstances, to provide the same value for
|
|
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
// for more details.
|
|
//
|
|
// This also ensures a stable sort in V8 and other engines.
|
|
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
return object.index - other.index;
|
|
}
|
|
|
|
/* harmony default export */ const _compareMultiple = (compareMultiple);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseOrderBy.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The base implementation of `_.orderBy` without param guards.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
* @param {string[]} orders The sort orders of `iteratees`.
|
|
* @returns {Array} Returns the new sorted array.
|
|
*/
|
|
function baseOrderBy(collection, iteratees, orders) {
|
|
if (iteratees.length) {
|
|
iteratees = (0,_arrayMap/* default */.Z)(iteratees, function(iteratee) {
|
|
if ((0,isArray/* default */.Z)(iteratee)) {
|
|
return function(value) {
|
|
return (0,_baseGet/* default */.Z)(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
}
|
|
}
|
|
return iteratee;
|
|
});
|
|
} else {
|
|
iteratees = [identity/* default */.Z];
|
|
}
|
|
|
|
var index = -1;
|
|
iteratees = (0,_arrayMap/* default */.Z)(iteratees, (0,_baseUnary/* default */.Z)(_baseIteratee/* default */.Z));
|
|
|
|
var result = (0,_baseMap/* default */.Z)(collection, function(value, key, collection) {
|
|
var criteria = (0,_arrayMap/* default */.Z)(iteratees, function(iteratee) {
|
|
return iteratee(value);
|
|
});
|
|
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
});
|
|
|
|
return _baseSortBy(result, function(object, other) {
|
|
return _compareMultiple(object, other, orders);
|
|
});
|
|
}
|
|
|
|
/* harmony default export */ const _baseOrderBy = (baseOrderBy);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseRest.js
|
|
var _baseRest = __webpack_require__(99719);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/sortBy.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates an array of elements, sorted in ascending order by the results of
|
|
* running each element in a collection thru each iteratee. This method
|
|
* performs a stable sort, that is, it preserves the original sort order of
|
|
* equal elements. The iteratees are invoked with one argument: (value).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
* The iteratees to sort by.
|
|
* @returns {Array} Returns the new sorted array.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'fred', 'age': 48 },
|
|
* { 'user': 'barney', 'age': 36 },
|
|
* { 'user': 'fred', 'age': 30 },
|
|
* { 'user': 'barney', 'age': 34 }
|
|
* ];
|
|
*
|
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
*
|
|
* _.sortBy(users, ['user', 'age']);
|
|
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
*/
|
|
var sortBy = (0,_baseRest/* default */.Z)(function(collection, iteratees) {
|
|
if (collection == null) {
|
|
return [];
|
|
}
|
|
var length = iteratees.length;
|
|
if (length > 1 && (0,_isIterateeCall/* default */.Z)(collection, iteratees[0], iteratees[1])) {
|
|
iteratees = [];
|
|
} else if (length > 2 && (0,_isIterateeCall/* default */.Z)(iteratees[0], iteratees[1], iteratees[2])) {
|
|
iteratees = [iteratees[0]];
|
|
}
|
|
return _baseOrderBy(collection, (0,_baseFlatten/* default */.Z)(iteratees, 1), []);
|
|
});
|
|
|
|
/* harmony default export */ const lodash_es_sortBy = (sortBy);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/cross-count.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* A function that takes a layering (an array of layers, each with an array of
|
|
* ordererd nodes) and a graph and returns a weighted crossing count.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Input graph must be simple (not a multigraph), directed, and include
|
|
* only simple edges.
|
|
* 2. Edges in the input graph must have assigned weights.
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* 1. The graph and layering matrix are left unchanged.
|
|
*
|
|
* This algorithm is derived from Barth, et al., "Bilayer Cross Counting."
|
|
*/
|
|
function crossCount(g, layering) {
|
|
var cc = 0;
|
|
for (var i = 1; i < layering.length; ++i) {
|
|
cc += twoLayerCrossCount(g, layering[i - 1], layering[i]);
|
|
}
|
|
return cc;
|
|
}
|
|
|
|
function twoLayerCrossCount(g, northLayer, southLayer) {
|
|
// Sort all of the edges between the north and south layers by their position
|
|
// in the north layer and then the south. Map these edges to the position of
|
|
// their head in the south layer.
|
|
var southPos = lodash_es_zipObject(
|
|
southLayer,
|
|
map/* default */.Z(southLayer, function (v, i) {
|
|
return i;
|
|
}),
|
|
);
|
|
var southEntries = flatten/* default */.Z(
|
|
map/* default */.Z(northLayer, function (v) {
|
|
return lodash_es_sortBy(
|
|
map/* default */.Z(g.outEdges(v), function (e) {
|
|
return { pos: southPos[e.w], weight: g.edge(e).weight };
|
|
}),
|
|
'pos',
|
|
);
|
|
}),
|
|
);
|
|
|
|
// Build the accumulator tree
|
|
var firstIndex = 1;
|
|
while (firstIndex < southLayer.length) firstIndex <<= 1;
|
|
var treeSize = 2 * firstIndex - 1;
|
|
firstIndex -= 1;
|
|
var tree = map/* default */.Z(new Array(treeSize), function () {
|
|
return 0;
|
|
});
|
|
|
|
// Calculate the weighted crossings
|
|
var cc = 0;
|
|
forEach/* default */.Z(
|
|
// @ts-expect-error
|
|
southEntries.forEach(function (entry) {
|
|
var index = entry.pos + firstIndex;
|
|
tree[index] += entry.weight;
|
|
var weightSum = 0;
|
|
// @ts-expect-error
|
|
while (index > 0) {
|
|
// @ts-expect-error
|
|
if (index % 2) {
|
|
weightSum += tree[index + 1];
|
|
}
|
|
// @ts-expect-error
|
|
index = (index - 1) >> 1;
|
|
tree[index] += entry.weight;
|
|
}
|
|
cc += entry.weight * weightSum;
|
|
}),
|
|
);
|
|
|
|
return cc;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/init-order.js
|
|
|
|
|
|
/*
|
|
* Assigns an initial order value for each node by performing a DFS search
|
|
* starting from nodes in the first rank. Nodes are assigned an order in their
|
|
* rank as they are first visited.
|
|
*
|
|
* This approach comes from Gansner, et al., "A Technique for Drawing Directed
|
|
* Graphs."
|
|
*
|
|
* Returns a layering matrix with an array per layer and each layer sorted by
|
|
* the order of its nodes.
|
|
*/
|
|
function initOrder(g) {
|
|
var visited = {};
|
|
var simpleNodes = filter/* default */.Z(g.nodes(), function (v) {
|
|
return !g.children(v).length;
|
|
});
|
|
var maxRank = lodash_es_max(
|
|
map/* default */.Z(simpleNodes, function (v) {
|
|
return g.node(v).rank;
|
|
}),
|
|
);
|
|
var layers = map/* default */.Z(lodash_es_range(maxRank + 1), function () {
|
|
return [];
|
|
});
|
|
|
|
function dfs(v) {
|
|
if (has/* default */.Z(visited, v)) return;
|
|
visited[v] = true;
|
|
var node = g.node(v);
|
|
layers[node.rank].push(v);
|
|
forEach/* default */.Z(g.successors(v), dfs);
|
|
}
|
|
|
|
var orderedVs = lodash_es_sortBy(simpleNodes, function (v) {
|
|
return g.node(v).rank;
|
|
});
|
|
forEach/* default */.Z(orderedVs, dfs);
|
|
|
|
return layers;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/barycenter.js
|
|
|
|
|
|
|
|
|
|
function barycenter(g, movable) {
|
|
return map/* default */.Z(movable, function (v) {
|
|
var inV = g.inEdges(v);
|
|
if (!inV.length) {
|
|
return { v: v };
|
|
} else {
|
|
var result = reduce/* default */.Z(
|
|
inV,
|
|
function (acc, e) {
|
|
var edge = g.edge(e),
|
|
nodeU = g.node(e.v);
|
|
return {
|
|
sum: acc.sum + edge.weight * nodeU.order,
|
|
weight: acc.weight + edge.weight,
|
|
};
|
|
},
|
|
{ sum: 0, weight: 0 },
|
|
);
|
|
|
|
return {
|
|
v: v,
|
|
barycenter: result.sum / result.weight,
|
|
weight: result.weight,
|
|
};
|
|
}
|
|
});
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Given a list of entries of the form {v, barycenter, weight} and a
|
|
* constraint graph this function will resolve any conflicts between the
|
|
* constraint graph and the barycenters for the entries. If the barycenters for
|
|
* an entry would violate a constraint in the constraint graph then we coalesce
|
|
* the nodes in the conflict into a new node that respects the contraint and
|
|
* aggregates barycenter and weight information.
|
|
*
|
|
* This implementation is based on the description in Forster, "A Fast and
|
|
* Simple Hueristic for Constrained Two-Level Crossing Reduction," thought it
|
|
* differs in some specific details.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Each entry has the form {v, barycenter, weight}, or if the node has
|
|
* no barycenter, then {v}.
|
|
*
|
|
* Returns:
|
|
*
|
|
* A new list of entries of the form {vs, i, barycenter, weight}. The list
|
|
* `vs` may either be a singleton or it may be an aggregation of nodes
|
|
* ordered such that they do not violate constraints from the constraint
|
|
* graph. The property `i` is the lowest original index of any of the
|
|
* elements in `vs`.
|
|
*/
|
|
function resolveConflicts(entries, cg) {
|
|
var mappedEntries = {};
|
|
forEach/* default */.Z(entries, function (entry, i) {
|
|
var tmp = (mappedEntries[entry.v] = {
|
|
indegree: 0,
|
|
in: [],
|
|
out: [],
|
|
vs: [entry.v],
|
|
i: i,
|
|
});
|
|
if (!isUndefined/* default */.Z(entry.barycenter)) {
|
|
// @ts-expect-error
|
|
tmp.barycenter = entry.barycenter;
|
|
// @ts-expect-error
|
|
tmp.weight = entry.weight;
|
|
}
|
|
});
|
|
|
|
forEach/* default */.Z(cg.edges(), function (e) {
|
|
var entryV = mappedEntries[e.v];
|
|
var entryW = mappedEntries[e.w];
|
|
if (!isUndefined/* default */.Z(entryV) && !isUndefined/* default */.Z(entryW)) {
|
|
entryW.indegree++;
|
|
entryV.out.push(mappedEntries[e.w]);
|
|
}
|
|
});
|
|
|
|
var sourceSet = filter/* default */.Z(mappedEntries, function (entry) {
|
|
// @ts-expect-error
|
|
return !entry.indegree;
|
|
});
|
|
|
|
return doResolveConflicts(sourceSet);
|
|
}
|
|
|
|
function doResolveConflicts(sourceSet) {
|
|
var entries = [];
|
|
|
|
function handleIn(vEntry) {
|
|
return function (uEntry) {
|
|
if (uEntry.merged) {
|
|
return;
|
|
}
|
|
if (
|
|
isUndefined/* default */.Z(uEntry.barycenter) ||
|
|
isUndefined/* default */.Z(vEntry.barycenter) ||
|
|
uEntry.barycenter >= vEntry.barycenter
|
|
) {
|
|
mergeEntries(vEntry, uEntry);
|
|
}
|
|
};
|
|
}
|
|
|
|
function handleOut(vEntry) {
|
|
return function (wEntry) {
|
|
wEntry['in'].push(vEntry);
|
|
if (--wEntry.indegree === 0) {
|
|
sourceSet.push(wEntry);
|
|
}
|
|
};
|
|
}
|
|
|
|
while (sourceSet.length) {
|
|
var entry = sourceSet.pop();
|
|
entries.push(entry);
|
|
forEach/* default */.Z(entry['in'].reverse(), handleIn(entry));
|
|
forEach/* default */.Z(entry.out, handleOut(entry));
|
|
}
|
|
|
|
return map/* default */.Z(
|
|
filter/* default */.Z(entries, function (entry) {
|
|
return !entry.merged;
|
|
}),
|
|
function (entry) {
|
|
return lodash_es_pick(entry, ['vs', 'i', 'barycenter', 'weight']);
|
|
},
|
|
);
|
|
}
|
|
|
|
function mergeEntries(target, source) {
|
|
var sum = 0;
|
|
var weight = 0;
|
|
|
|
if (target.weight) {
|
|
sum += target.barycenter * target.weight;
|
|
weight += target.weight;
|
|
}
|
|
|
|
if (source.weight) {
|
|
sum += source.barycenter * source.weight;
|
|
weight += source.weight;
|
|
}
|
|
|
|
target.vs = source.vs.concat(target.vs);
|
|
target.barycenter = sum / weight;
|
|
target.weight = weight;
|
|
target.i = Math.min(source.i, target.i);
|
|
source.merged = true;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/sort.js
|
|
|
|
|
|
|
|
|
|
|
|
function sort(entries, biasRight) {
|
|
var parts = partition(entries, function (entry) {
|
|
return Object.prototype.hasOwnProperty.call(entry, 'barycenter');
|
|
});
|
|
var sortable = parts.lhs,
|
|
unsortable = lodash_es_sortBy(parts.rhs, function (entry) {
|
|
return -entry.i;
|
|
}),
|
|
vs = [],
|
|
sum = 0,
|
|
weight = 0,
|
|
vsIndex = 0;
|
|
|
|
sortable.sort(compareWithBias(!!biasRight));
|
|
|
|
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
|
|
|
|
forEach/* default */.Z(sortable, function (entry) {
|
|
vsIndex += entry.vs.length;
|
|
vs.push(entry.vs);
|
|
sum += entry.barycenter * entry.weight;
|
|
weight += entry.weight;
|
|
vsIndex = consumeUnsortable(vs, unsortable, vsIndex);
|
|
});
|
|
|
|
var result = { vs: flatten/* default */.Z(vs) };
|
|
if (weight) {
|
|
result.barycenter = sum / weight;
|
|
result.weight = weight;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function consumeUnsortable(vs, unsortable, index) {
|
|
var last;
|
|
while (unsortable.length && (last = lodash_es_last/* default */.Z(unsortable)).i <= index) {
|
|
unsortable.pop();
|
|
vs.push(last.vs);
|
|
index++;
|
|
}
|
|
return index;
|
|
}
|
|
|
|
function compareWithBias(bias) {
|
|
return function (entryV, entryW) {
|
|
if (entryV.barycenter < entryW.barycenter) {
|
|
return -1;
|
|
} else if (entryV.barycenter > entryW.barycenter) {
|
|
return 1;
|
|
}
|
|
|
|
return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;
|
|
};
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sortSubgraph(g, v, cg, biasRight) {
|
|
var movable = g.children(v);
|
|
var node = g.node(v);
|
|
var bl = node ? node.borderLeft : undefined;
|
|
var br = node ? node.borderRight : undefined;
|
|
var subgraphs = {};
|
|
|
|
if (bl) {
|
|
movable = filter/* default */.Z(movable, function (w) {
|
|
return w !== bl && w !== br;
|
|
});
|
|
}
|
|
|
|
var barycenters = barycenter(g, movable);
|
|
forEach/* default */.Z(barycenters, function (entry) {
|
|
if (g.children(entry.v).length) {
|
|
var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);
|
|
subgraphs[entry.v] = subgraphResult;
|
|
if (Object.prototype.hasOwnProperty.call(subgraphResult, 'barycenter')) {
|
|
mergeBarycenters(entry, subgraphResult);
|
|
}
|
|
}
|
|
});
|
|
|
|
var entries = resolveConflicts(barycenters, cg);
|
|
expandSubgraphs(entries, subgraphs);
|
|
|
|
var result = sort(entries, biasRight);
|
|
|
|
if (bl) {
|
|
result.vs = flatten/* default */.Z([bl, result.vs, br]);
|
|
if (g.predecessors(bl).length) {
|
|
var blPred = g.node(g.predecessors(bl)[0]),
|
|
brPred = g.node(g.predecessors(br)[0]);
|
|
if (!Object.prototype.hasOwnProperty.call(result, 'barycenter')) {
|
|
result.barycenter = 0;
|
|
result.weight = 0;
|
|
}
|
|
result.barycenter =
|
|
(result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2);
|
|
result.weight += 2;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
function expandSubgraphs(entries, subgraphs) {
|
|
forEach/* default */.Z(entries, function (entry) {
|
|
entry.vs = flatten/* default */.Z(
|
|
entry.vs.map(function (v) {
|
|
if (subgraphs[v]) {
|
|
return subgraphs[v].vs;
|
|
}
|
|
return v;
|
|
}),
|
|
);
|
|
});
|
|
}
|
|
|
|
function mergeBarycenters(target, other) {
|
|
if (!isUndefined/* default */.Z(target.barycenter)) {
|
|
target.barycenter =
|
|
(target.barycenter * target.weight + other.barycenter * other.weight) /
|
|
(target.weight + other.weight);
|
|
target.weight += other.weight;
|
|
} else {
|
|
target.barycenter = other.barycenter;
|
|
target.weight = other.weight;
|
|
}
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/order/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
* Applies heuristics to minimize edge crossings in the graph and sets the best
|
|
* order solution as an order attribute on each node.
|
|
*
|
|
* Pre-conditions:
|
|
*
|
|
* 1. Graph must be DAG
|
|
* 2. Graph nodes must be objects with a "rank" attribute
|
|
* 3. Graph edges must have the "weight" attribute
|
|
*
|
|
* Post-conditions:
|
|
*
|
|
* 1. Graph nodes will have an "order" attribute based on the results of the
|
|
* algorithm.
|
|
*/
|
|
function order(g) {
|
|
var maxRank = util_maxRank(g),
|
|
downLayerGraphs = buildLayerGraphs(g, lodash_es_range(1, maxRank + 1), 'inEdges'),
|
|
upLayerGraphs = buildLayerGraphs(g, lodash_es_range(maxRank - 1, -1, -1), 'outEdges');
|
|
|
|
var layering = initOrder(g);
|
|
assignOrder(g, layering);
|
|
|
|
var bestCC = Number.POSITIVE_INFINITY,
|
|
best;
|
|
|
|
for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {
|
|
sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);
|
|
|
|
layering = buildLayerMatrix(g);
|
|
var cc = crossCount(g, layering);
|
|
if (cc < bestCC) {
|
|
lastBest = 0;
|
|
best = lodash_es_cloneDeep(layering);
|
|
bestCC = cc;
|
|
}
|
|
}
|
|
|
|
assignOrder(g, best);
|
|
}
|
|
|
|
function buildLayerGraphs(g, ranks, relationship) {
|
|
return map/* default */.Z(ranks, function (rank) {
|
|
return buildLayerGraph(g, rank, relationship);
|
|
});
|
|
}
|
|
|
|
function sweepLayerGraphs(layerGraphs, biasRight) {
|
|
var cg = new graphlib/* Graph */.k();
|
|
forEach/* default */.Z(layerGraphs, function (lg) {
|
|
var root = lg.graph().root;
|
|
var sorted = sortSubgraph(lg, root, cg, biasRight);
|
|
forEach/* default */.Z(sorted.vs, function (v, i) {
|
|
lg.node(v).order = i;
|
|
});
|
|
addSubgraphConstraints(lg, cg, sorted.vs);
|
|
});
|
|
}
|
|
|
|
function assignOrder(g, layering) {
|
|
forEach/* default */.Z(layering, function (layer) {
|
|
forEach/* default */.Z(layer, function (v, i) {
|
|
g.node(v).order = i;
|
|
});
|
|
});
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js
|
|
|
|
|
|
|
|
|
|
function parentDummyChains(g) {
|
|
var postorderNums = parent_dummy_chains_postorder(g);
|
|
|
|
forEach/* default */.Z(g.graph().dummyChains, function (v) {
|
|
var node = g.node(v);
|
|
var edgeObj = node.edgeObj;
|
|
var pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w);
|
|
var path = pathData.path;
|
|
var lca = pathData.lca;
|
|
var pathIdx = 0;
|
|
var pathV = path[pathIdx];
|
|
var ascending = true;
|
|
|
|
while (v !== edgeObj.w) {
|
|
node = g.node(v);
|
|
|
|
if (ascending) {
|
|
while ((pathV = path[pathIdx]) !== lca && g.node(pathV).maxRank < node.rank) {
|
|
pathIdx++;
|
|
}
|
|
|
|
if (pathV === lca) {
|
|
ascending = false;
|
|
}
|
|
}
|
|
|
|
if (!ascending) {
|
|
while (
|
|
pathIdx < path.length - 1 &&
|
|
g.node((pathV = path[pathIdx + 1])).minRank <= node.rank
|
|
) {
|
|
pathIdx++;
|
|
}
|
|
pathV = path[pathIdx];
|
|
}
|
|
|
|
g.setParent(v, pathV);
|
|
v = g.successors(v)[0];
|
|
}
|
|
});
|
|
}
|
|
|
|
// Find a path from v to w through the lowest common ancestor (LCA). Return the
|
|
// full path and the LCA.
|
|
function findPath(g, postorderNums, v, w) {
|
|
var vPath = [];
|
|
var wPath = [];
|
|
var low = Math.min(postorderNums[v].low, postorderNums[w].low);
|
|
var lim = Math.max(postorderNums[v].lim, postorderNums[w].lim);
|
|
var parent;
|
|
var lca;
|
|
|
|
// Traverse up from v to find the LCA
|
|
parent = v;
|
|
do {
|
|
parent = g.parent(parent);
|
|
vPath.push(parent);
|
|
} while (parent && (postorderNums[parent].low > low || lim > postorderNums[parent].lim));
|
|
lca = parent;
|
|
|
|
// Traverse from w to LCA
|
|
parent = w;
|
|
while ((parent = g.parent(parent)) !== lca) {
|
|
wPath.push(parent);
|
|
}
|
|
|
|
return { path: vPath.concat(wPath.reverse()), lca: lca };
|
|
}
|
|
|
|
function parent_dummy_chains_postorder(g) {
|
|
var result = {};
|
|
var lim = 0;
|
|
|
|
function dfs(v) {
|
|
var low = lim;
|
|
forEach/* default */.Z(g.children(v), dfs);
|
|
result[v] = { low: low, lim: lim++ };
|
|
}
|
|
forEach/* default */.Z(g.children(), dfs);
|
|
|
|
return result;
|
|
}
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_castFunction.js
|
|
var _castFunction = __webpack_require__(87073);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/forOwn.js
|
|
|
|
|
|
|
|
/**
|
|
* Iterates over own enumerable string keyed properties of an object and
|
|
* invokes `iteratee` for each property. The iteratee is invoked with three
|
|
* arguments: (value, key, object). Iteratee functions may exit iteration
|
|
* early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forOwnRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forOwn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
|
*/
|
|
function forOwn(object, iteratee) {
|
|
return object && (0,_baseForOwn/* default */.Z)(object, (0,_castFunction/* default */.Z)(iteratee));
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_forOwn = (forOwn);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseFor.js + 1 modules
|
|
var _baseFor = __webpack_require__(49399);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/keysIn.js + 2 modules
|
|
var keysIn = __webpack_require__(48441);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/forIn.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Iterates over own and inherited enumerable string keyed properties of an
|
|
* object and invokes `iteratee` for each property. The iteratee is invoked
|
|
* with three arguments: (value, key, object). Iteratee functions may exit
|
|
* iteration early by explicitly returning `false`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.3.0
|
|
* @category Object
|
|
* @param {Object} object The object to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.forInRight
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* this.b = 2;
|
|
* }
|
|
*
|
|
* Foo.prototype.c = 3;
|
|
*
|
|
* _.forIn(new Foo, function(value, key) {
|
|
* console.log(key);
|
|
* });
|
|
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
|
|
*/
|
|
function forIn(object, iteratee) {
|
|
return object == null
|
|
? object
|
|
: (0,_baseFor/* default */.Z)(object, (0,_castFunction/* default */.Z)(iteratee), keysIn/* default */.Z);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_forIn = (forIn);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/position/bk.js
|
|
|
|
|
|
|
|
|
|
/*
|
|
* This module provides coordinate assignment based on Brandes and Köpf, "Fast
|
|
* and Simple Horizontal Coordinate Assignment."
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
* Marks all edges in the graph with a type-1 conflict with the "type1Conflict"
|
|
* property. A type-1 conflict is one where a non-inner segment crosses an
|
|
* inner segment. An inner segment is an edge with both incident nodes marked
|
|
* with the "dummy" property.
|
|
*
|
|
* This algorithm scans layer by layer, starting with the second, for type-1
|
|
* conflicts between the current layer and the previous layer. For each layer
|
|
* it scans the nodes from left to right until it reaches one that is incident
|
|
* on an inner segment. It then scans predecessors to determine if they have
|
|
* edges that cross that inner segment. At the end a final scan is done for all
|
|
* nodes on the current rank to see if they cross the last visited inner
|
|
* segment.
|
|
*
|
|
* This algorithm (safely) assumes that a dummy node will only be incident on a
|
|
* single node in the layers being scanned.
|
|
*/
|
|
function findType1Conflicts(g, layering) {
|
|
var conflicts = {};
|
|
|
|
function visitLayer(prevLayer, layer) {
|
|
var // last visited node in the previous layer that is incident on an inner
|
|
// segment.
|
|
k0 = 0,
|
|
// Tracks the last node in this layer scanned for crossings with a type-1
|
|
// segment.
|
|
scanPos = 0,
|
|
prevLayerLength = prevLayer.length,
|
|
lastNode = lodash_es_last/* default */.Z(layer);
|
|
|
|
forEach/* default */.Z(layer, function (v, i) {
|
|
var w = findOtherInnerSegmentNode(g, v),
|
|
k1 = w ? g.node(w).order : prevLayerLength;
|
|
|
|
if (w || v === lastNode) {
|
|
forEach/* default */.Z(layer.slice(scanPos, i + 1), function (scanNode) {
|
|
forEach/* default */.Z(g.predecessors(scanNode), function (u) {
|
|
var uLabel = g.node(u),
|
|
uPos = uLabel.order;
|
|
if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g.node(scanNode).dummy)) {
|
|
addConflict(conflicts, u, scanNode);
|
|
}
|
|
});
|
|
});
|
|
// @ts-expect-error
|
|
scanPos = i + 1;
|
|
k0 = k1;
|
|
}
|
|
});
|
|
|
|
return layer;
|
|
}
|
|
|
|
reduce/* default */.Z(layering, visitLayer);
|
|
return conflicts;
|
|
}
|
|
|
|
function findType2Conflicts(g, layering) {
|
|
var conflicts = {};
|
|
|
|
function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {
|
|
var v;
|
|
forEach/* default */.Z(lodash_es_range(southPos, southEnd), function (i) {
|
|
v = south[i];
|
|
if (g.node(v).dummy) {
|
|
forEach/* default */.Z(g.predecessors(v), function (u) {
|
|
var uNode = g.node(u);
|
|
if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {
|
|
addConflict(conflicts, u, v);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function visitLayer(north, south) {
|
|
var prevNorthPos = -1,
|
|
nextNorthPos,
|
|
southPos = 0;
|
|
|
|
forEach/* default */.Z(south, function (v, southLookahead) {
|
|
if (g.node(v).dummy === 'border') {
|
|
var predecessors = g.predecessors(v);
|
|
if (predecessors.length) {
|
|
nextNorthPos = g.node(predecessors[0]).order;
|
|
scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);
|
|
// @ts-expect-error
|
|
southPos = southLookahead;
|
|
prevNorthPos = nextNorthPos;
|
|
}
|
|
}
|
|
scan(south, southPos, south.length, nextNorthPos, north.length);
|
|
});
|
|
|
|
return south;
|
|
}
|
|
|
|
reduce/* default */.Z(layering, visitLayer);
|
|
return conflicts;
|
|
}
|
|
|
|
function findOtherInnerSegmentNode(g, v) {
|
|
if (g.node(v).dummy) {
|
|
return find/* default */.Z(g.predecessors(v), function (u) {
|
|
return g.node(u).dummy;
|
|
});
|
|
}
|
|
}
|
|
|
|
function addConflict(conflicts, v, w) {
|
|
if (v > w) {
|
|
var tmp = v;
|
|
v = w;
|
|
w = tmp;
|
|
}
|
|
|
|
var conflictsV = conflicts[v];
|
|
if (!conflictsV) {
|
|
conflicts[v] = conflictsV = {};
|
|
}
|
|
conflictsV[w] = true;
|
|
}
|
|
|
|
function hasConflict(conflicts, v, w) {
|
|
if (v > w) {
|
|
var tmp = v;
|
|
v = w;
|
|
w = tmp;
|
|
}
|
|
return !!conflicts[v] && Object.prototype.hasOwnProperty.call(conflicts[v], w);
|
|
}
|
|
|
|
/*
|
|
* Try to align nodes into vertical "blocks" where possible. This algorithm
|
|
* attempts to align a node with one of its median neighbors. If the edge
|
|
* connecting a neighbor is a type-1 conflict then we ignore that possibility.
|
|
* If a previous node has already formed a block with a node after the node
|
|
* we're trying to form a block with, we also ignore that possibility - our
|
|
* blocks would be split in that scenario.
|
|
*/
|
|
function verticalAlignment(g, layering, conflicts, neighborFn) {
|
|
var root = {},
|
|
align = {},
|
|
pos = {};
|
|
|
|
// We cache the position here based on the layering because the graph and
|
|
// layering may be out of sync. The layering matrix is manipulated to
|
|
// generate different extreme alignments.
|
|
forEach/* default */.Z(layering, function (layer) {
|
|
forEach/* default */.Z(layer, function (v, order) {
|
|
root[v] = v;
|
|
align[v] = v;
|
|
pos[v] = order;
|
|
});
|
|
});
|
|
|
|
forEach/* default */.Z(layering, function (layer) {
|
|
var prevIdx = -1;
|
|
forEach/* default */.Z(layer, function (v) {
|
|
var ws = neighborFn(v);
|
|
if (ws.length) {
|
|
ws = lodash_es_sortBy(ws, function (w) {
|
|
return pos[w];
|
|
});
|
|
var mp = (ws.length - 1) / 2;
|
|
for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {
|
|
var w = ws[i];
|
|
if (align[v] === v && prevIdx < pos[w] && !hasConflict(conflicts, v, w)) {
|
|
align[w] = v;
|
|
align[v] = root[v] = root[w];
|
|
prevIdx = pos[w];
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
return { root: root, align: align };
|
|
}
|
|
|
|
function horizontalCompaction(g, layering, root, align, reverseSep) {
|
|
// This portion of the algorithm differs from BK due to a number of problems.
|
|
// Instead of their algorithm we construct a new block graph and do two
|
|
// sweeps. The first sweep places blocks with the smallest possible
|
|
// coordinates. The second sweep removes unused space by moving blocks to the
|
|
// greatest coordinates without violating separation.
|
|
var xs = {},
|
|
blockG = buildBlockGraph(g, layering, root, reverseSep),
|
|
borderType = reverseSep ? 'borderLeft' : 'borderRight';
|
|
|
|
function iterate(setXsFunc, nextNodesFunc) {
|
|
var stack = blockG.nodes();
|
|
var elem = stack.pop();
|
|
var visited = {};
|
|
while (elem) {
|
|
if (visited[elem]) {
|
|
setXsFunc(elem);
|
|
} else {
|
|
visited[elem] = true;
|
|
stack.push(elem);
|
|
stack = stack.concat(nextNodesFunc(elem));
|
|
}
|
|
|
|
elem = stack.pop();
|
|
}
|
|
}
|
|
|
|
// First pass, assign smallest coordinates
|
|
function pass1(elem) {
|
|
xs[elem] = blockG.inEdges(elem).reduce(function (acc, e) {
|
|
return Math.max(acc, xs[e.v] + blockG.edge(e));
|
|
}, 0);
|
|
}
|
|
|
|
// Second pass, assign greatest coordinates
|
|
function pass2(elem) {
|
|
var min = blockG.outEdges(elem).reduce(function (acc, e) {
|
|
return Math.min(acc, xs[e.w] - blockG.edge(e));
|
|
}, Number.POSITIVE_INFINITY);
|
|
|
|
var node = g.node(elem);
|
|
if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {
|
|
xs[elem] = Math.max(xs[elem], min);
|
|
}
|
|
}
|
|
|
|
iterate(pass1, blockG.predecessors.bind(blockG));
|
|
iterate(pass2, blockG.successors.bind(blockG));
|
|
|
|
// Assign x coordinates to all nodes
|
|
forEach/* default */.Z(align, function (v) {
|
|
xs[v] = xs[root[v]];
|
|
});
|
|
|
|
return xs;
|
|
}
|
|
|
|
function buildBlockGraph(g, layering, root, reverseSep) {
|
|
var blockGraph = new graphlib/* Graph */.k(),
|
|
graphLabel = g.graph(),
|
|
sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
|
|
|
|
forEach/* default */.Z(layering, function (layer) {
|
|
var u;
|
|
forEach/* default */.Z(layer, function (v) {
|
|
var vRoot = root[v];
|
|
blockGraph.setNode(vRoot);
|
|
if (u) {
|
|
var uRoot = root[u],
|
|
prevMax = blockGraph.edge(uRoot, vRoot);
|
|
blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));
|
|
}
|
|
u = v;
|
|
});
|
|
});
|
|
|
|
return blockGraph;
|
|
}
|
|
|
|
/*
|
|
* Returns the alignment that has the smallest width of the given alignments.
|
|
*/
|
|
function findSmallestWidthAlignment(g, xss) {
|
|
return lodash_es_minBy(values/* default */.Z(xss), function (xs) {
|
|
var max = Number.NEGATIVE_INFINITY;
|
|
var min = Number.POSITIVE_INFINITY;
|
|
|
|
lodash_es_forIn(xs, function (x, v) {
|
|
var halfWidth = width(g, v) / 2;
|
|
|
|
max = Math.max(x + halfWidth, max);
|
|
min = Math.min(x - halfWidth, min);
|
|
});
|
|
|
|
return max - min;
|
|
});
|
|
}
|
|
|
|
/*
|
|
* Align the coordinates of each of the layout alignments such that
|
|
* left-biased alignments have their minimum coordinate at the same point as
|
|
* the minimum coordinate of the smallest width alignment and right-biased
|
|
* alignments have their maximum coordinate at the same point as the maximum
|
|
* coordinate of the smallest width alignment.
|
|
*/
|
|
function alignCoordinates(xss, alignTo) {
|
|
var alignToVals = values/* default */.Z(alignTo),
|
|
alignToMin = lodash_es_min/* default */.Z(alignToVals),
|
|
alignToMax = lodash_es_max(alignToVals);
|
|
|
|
forEach/* default */.Z(['u', 'd'], function (vert) {
|
|
forEach/* default */.Z(['l', 'r'], function (horiz) {
|
|
var alignment = vert + horiz,
|
|
xs = xss[alignment],
|
|
delta;
|
|
if (xs === alignTo) return;
|
|
|
|
var xsVals = values/* default */.Z(xs);
|
|
delta = horiz === 'l' ? alignToMin - lodash_es_min/* default */.Z(xsVals) : alignToMax - lodash_es_max(xsVals);
|
|
|
|
if (delta) {
|
|
xss[alignment] = lodash_es_mapValues(xs, function (x) {
|
|
return x + delta;
|
|
});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function balance(xss, align) {
|
|
return lodash_es_mapValues(xss.ul, function (ignore, v) {
|
|
if (align) {
|
|
return xss[align.toLowerCase()][v];
|
|
} else {
|
|
var xs = lodash_es_sortBy(map/* default */.Z(xss, v));
|
|
return (xs[1] + xs[2]) / 2;
|
|
}
|
|
});
|
|
}
|
|
|
|
function positionX(g) {
|
|
var layering = buildLayerMatrix(g);
|
|
var conflicts = merge/* default */.Z(findType1Conflicts(g, layering), findType2Conflicts(g, layering));
|
|
|
|
var xss = {};
|
|
var adjustedLayering;
|
|
forEach/* default */.Z(['u', 'd'], function (vert) {
|
|
adjustedLayering = vert === 'u' ? layering : values/* default */.Z(layering).reverse();
|
|
forEach/* default */.Z(['l', 'r'], function (horiz) {
|
|
if (horiz === 'r') {
|
|
adjustedLayering = map/* default */.Z(adjustedLayering, function (inner) {
|
|
return values/* default */.Z(inner).reverse();
|
|
});
|
|
}
|
|
|
|
var neighborFn = (vert === 'u' ? g.predecessors : g.successors).bind(g);
|
|
var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);
|
|
var xs = horizontalCompaction(g, adjustedLayering, align.root, align.align, horiz === 'r');
|
|
if (horiz === 'r') {
|
|
xs = lodash_es_mapValues(xs, function (x) {
|
|
return -x;
|
|
});
|
|
}
|
|
xss[vert + horiz] = xs;
|
|
});
|
|
});
|
|
|
|
var smallestWidth = findSmallestWidthAlignment(g, xss);
|
|
alignCoordinates(xss, smallestWidth);
|
|
return balance(xss, g.graph().align);
|
|
}
|
|
|
|
function sep(nodeSep, edgeSep, reverseSep) {
|
|
return function (g, v, w) {
|
|
var vLabel = g.node(v);
|
|
var wLabel = g.node(w);
|
|
var sum = 0;
|
|
var delta;
|
|
|
|
sum += vLabel.width / 2;
|
|
if (Object.prototype.hasOwnProperty.call(vLabel, 'labelpos')) {
|
|
switch (vLabel.labelpos.toLowerCase()) {
|
|
case 'l':
|
|
delta = -vLabel.width / 2;
|
|
break;
|
|
case 'r':
|
|
delta = vLabel.width / 2;
|
|
break;
|
|
}
|
|
}
|
|
if (delta) {
|
|
sum += reverseSep ? delta : -delta;
|
|
}
|
|
delta = 0;
|
|
|
|
sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;
|
|
sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;
|
|
|
|
sum += wLabel.width / 2;
|
|
if (Object.prototype.hasOwnProperty.call(wLabel, 'labelpos')) {
|
|
switch (wLabel.labelpos.toLowerCase()) {
|
|
case 'l':
|
|
delta = wLabel.width / 2;
|
|
break;
|
|
case 'r':
|
|
delta = -wLabel.width / 2;
|
|
break;
|
|
}
|
|
}
|
|
if (delta) {
|
|
sum += reverseSep ? delta : -delta;
|
|
}
|
|
delta = 0;
|
|
|
|
return sum;
|
|
};
|
|
}
|
|
|
|
function width(g, v) {
|
|
return g.node(v).width;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/position/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function position(g) {
|
|
g = asNonCompoundGraph(g);
|
|
|
|
positionY(g);
|
|
lodash_es_forOwn(positionX(g), function (x, v) {
|
|
g.node(v).x = x;
|
|
});
|
|
}
|
|
|
|
function positionY(g) {
|
|
var layering = buildLayerMatrix(g);
|
|
var rankSep = g.graph().ranksep;
|
|
var prevY = 0;
|
|
forEach/* default */.Z(layering, function (layer) {
|
|
var maxHeight = lodash_es_max(
|
|
map/* default */.Z(layer, function (v) {
|
|
return g.node(v).height;
|
|
}),
|
|
);
|
|
forEach/* default */.Z(layer, function (v) {
|
|
g.node(v).y = prevY + maxHeight / 2;
|
|
});
|
|
prevY += maxHeight + rankSep;
|
|
});
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/layout.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function layout(g, opts) {
|
|
var time = opts && opts.debugTiming ? util_time : notime;
|
|
time('layout', () => {
|
|
var layoutGraph = time(' buildLayoutGraph', () => buildLayoutGraph(g));
|
|
time(' runLayout', () => runLayout(layoutGraph, time));
|
|
time(' updateInputGraph', () => updateInputGraph(g, layoutGraph));
|
|
});
|
|
}
|
|
|
|
function runLayout(g, time) {
|
|
time(' makeSpaceForEdgeLabels', () => makeSpaceForEdgeLabels(g));
|
|
time(' removeSelfEdges', () => removeSelfEdges(g));
|
|
time(' acyclic', () => run(g));
|
|
time(' nestingGraph.run', () => nesting_graph_run(g));
|
|
time(' rank', () => rank(asNonCompoundGraph(g)));
|
|
time(' injectEdgeLabelProxies', () => injectEdgeLabelProxies(g));
|
|
time(' removeEmptyRanks', () => removeEmptyRanks(g));
|
|
time(' nestingGraph.cleanup', () => cleanup(g));
|
|
time(' normalizeRanks', () => normalizeRanks(g));
|
|
time(' assignRankMinMax', () => assignRankMinMax(g));
|
|
time(' removeEdgeLabelProxies', () => removeEdgeLabelProxies(g));
|
|
time(' normalize.run', () => normalize_run(g));
|
|
time(' parentDummyChains', () => parentDummyChains(g));
|
|
time(' addBorderSegments', () => addBorderSegments(g));
|
|
time(' order', () => order(g));
|
|
time(' insertSelfEdges', () => insertSelfEdges(g));
|
|
time(' adjustCoordinateSystem', () => adjust(g));
|
|
time(' position', () => position(g));
|
|
time(' positionSelfEdges', () => positionSelfEdges(g));
|
|
time(' removeBorderNodes', () => removeBorderNodes(g));
|
|
time(' normalize.undo', () => normalize_undo(g));
|
|
time(' fixupEdgeLabelCoords', () => fixupEdgeLabelCoords(g));
|
|
time(' undoCoordinateSystem', () => coordinate_system_undo(g));
|
|
time(' translateGraph', () => translateGraph(g));
|
|
time(' assignNodeIntersects', () => assignNodeIntersects(g));
|
|
time(' reversePoints', () => reversePointsForReversedEdges(g));
|
|
time(' acyclic.undo', () => undo(g));
|
|
}
|
|
|
|
/*
|
|
* Copies final layout information from the layout graph back to the input
|
|
* graph. This process only copies whitelisted attributes from the layout graph
|
|
* to the input graph, so it serves as a good place to determine what
|
|
* attributes can influence layout.
|
|
*/
|
|
function updateInputGraph(inputGraph, layoutGraph) {
|
|
forEach/* default */.Z(inputGraph.nodes(), function (v) {
|
|
var inputLabel = inputGraph.node(v);
|
|
var layoutLabel = layoutGraph.node(v);
|
|
|
|
if (inputLabel) {
|
|
inputLabel.x = layoutLabel.x;
|
|
inputLabel.y = layoutLabel.y;
|
|
|
|
if (layoutGraph.children(v).length) {
|
|
inputLabel.width = layoutLabel.width;
|
|
inputLabel.height = layoutLabel.height;
|
|
}
|
|
}
|
|
});
|
|
|
|
forEach/* default */.Z(inputGraph.edges(), function (e) {
|
|
var inputLabel = inputGraph.edge(e);
|
|
var layoutLabel = layoutGraph.edge(e);
|
|
|
|
inputLabel.points = layoutLabel.points;
|
|
if (Object.prototype.hasOwnProperty.call(layoutLabel, 'x')) {
|
|
inputLabel.x = layoutLabel.x;
|
|
inputLabel.y = layoutLabel.y;
|
|
}
|
|
});
|
|
|
|
inputGraph.graph().width = layoutGraph.graph().width;
|
|
inputGraph.graph().height = layoutGraph.graph().height;
|
|
}
|
|
|
|
var graphNumAttrs = ['nodesep', 'edgesep', 'ranksep', 'marginx', 'marginy'];
|
|
var graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: 'tb' };
|
|
var graphAttrs = ['acyclicer', 'ranker', 'rankdir', 'align'];
|
|
var nodeNumAttrs = ['width', 'height'];
|
|
var nodeDefaults = { width: 0, height: 0 };
|
|
var edgeNumAttrs = ['minlen', 'weight', 'width', 'height', 'labeloffset'];
|
|
var edgeDefaults = {
|
|
minlen: 1,
|
|
weight: 1,
|
|
width: 0,
|
|
height: 0,
|
|
labeloffset: 10,
|
|
labelpos: 'r',
|
|
};
|
|
var edgeAttrs = ['labelpos'];
|
|
|
|
/*
|
|
* Constructs a new graph from the input graph, which can be used for layout.
|
|
* This process copies only whitelisted attributes from the input graph to the
|
|
* layout graph. Thus this function serves as a good place to determine what
|
|
* attributes can influence layout.
|
|
*/
|
|
function buildLayoutGraph(inputGraph) {
|
|
var g = new graphlib/* Graph */.k({ multigraph: true, compound: true });
|
|
var graph = canonicalize(inputGraph.graph());
|
|
|
|
g.setGraph(
|
|
merge/* default */.Z({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), lodash_es_pick(graph, graphAttrs)),
|
|
);
|
|
|
|
forEach/* default */.Z(inputGraph.nodes(), function (v) {
|
|
var node = canonicalize(inputGraph.node(v));
|
|
g.setNode(v, defaults/* default */.Z(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));
|
|
g.setParent(v, inputGraph.parent(v));
|
|
});
|
|
|
|
forEach/* default */.Z(inputGraph.edges(), function (e) {
|
|
var edge = canonicalize(inputGraph.edge(e));
|
|
g.setEdge(
|
|
e,
|
|
merge/* default */.Z({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), lodash_es_pick(edge, edgeAttrs)),
|
|
);
|
|
});
|
|
|
|
return g;
|
|
}
|
|
|
|
/*
|
|
* This idea comes from the Gansner paper: to account for edge labels in our
|
|
* layout we split each rank in half by doubling minlen and halving ranksep.
|
|
* Then we can place labels at these mid-points between nodes.
|
|
*
|
|
* We also add some minimal padding to the width to push the label for the edge
|
|
* away from the edge itself a bit.
|
|
*/
|
|
function makeSpaceForEdgeLabels(g) {
|
|
var graph = g.graph();
|
|
graph.ranksep /= 2;
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
edge.minlen *= 2;
|
|
if (edge.labelpos.toLowerCase() !== 'c') {
|
|
if (graph.rankdir === 'TB' || graph.rankdir === 'BT') {
|
|
edge.width += edge.labeloffset;
|
|
} else {
|
|
edge.height += edge.labeloffset;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/*
|
|
* Creates temporary dummy nodes that capture the rank in which each edge's
|
|
* label is going to, if it has one of non-zero width and height. We do this
|
|
* so that we can safely remove empty ranks while preserving balance for the
|
|
* label's position.
|
|
*/
|
|
function injectEdgeLabelProxies(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
if (edge.width && edge.height) {
|
|
var v = g.node(e.v);
|
|
var w = g.node(e.w);
|
|
var label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };
|
|
addDummyNode(g, 'edge-proxy', label, '_ep');
|
|
}
|
|
});
|
|
}
|
|
|
|
function assignRankMinMax(g) {
|
|
var maxRank = 0;
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
if (node.borderTop) {
|
|
node.minRank = g.node(node.borderTop).rank;
|
|
node.maxRank = g.node(node.borderBottom).rank;
|
|
// @ts-expect-error
|
|
maxRank = lodash_es_max(maxRank, node.maxRank);
|
|
}
|
|
});
|
|
g.graph().maxRank = maxRank;
|
|
}
|
|
|
|
function removeEdgeLabelProxies(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
if (node.dummy === 'edge-proxy') {
|
|
g.edge(node.e).labelRank = node.rank;
|
|
g.removeNode(v);
|
|
}
|
|
});
|
|
}
|
|
|
|
function translateGraph(g) {
|
|
var minX = Number.POSITIVE_INFINITY;
|
|
var maxX = 0;
|
|
var minY = Number.POSITIVE_INFINITY;
|
|
var maxY = 0;
|
|
var graphLabel = g.graph();
|
|
var marginX = graphLabel.marginx || 0;
|
|
var marginY = graphLabel.marginy || 0;
|
|
|
|
function getExtremes(attrs) {
|
|
var x = attrs.x;
|
|
var y = attrs.y;
|
|
var w = attrs.width;
|
|
var h = attrs.height;
|
|
minX = Math.min(minX, x - w / 2);
|
|
maxX = Math.max(maxX, x + w / 2);
|
|
minY = Math.min(minY, y - h / 2);
|
|
maxY = Math.max(maxY, y + h / 2);
|
|
}
|
|
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
getExtremes(g.node(v));
|
|
});
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'x')) {
|
|
getExtremes(edge);
|
|
}
|
|
});
|
|
|
|
minX -= marginX;
|
|
minY -= marginY;
|
|
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
node.x -= minX;
|
|
node.y -= minY;
|
|
});
|
|
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
forEach/* default */.Z(edge.points, function (p) {
|
|
p.x -= minX;
|
|
p.y -= minY;
|
|
});
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'x')) {
|
|
edge.x -= minX;
|
|
}
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'y')) {
|
|
edge.y -= minY;
|
|
}
|
|
});
|
|
|
|
graphLabel.width = maxX - minX + marginX;
|
|
graphLabel.height = maxY - minY + marginY;
|
|
}
|
|
|
|
function assignNodeIntersects(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
var nodeV = g.node(e.v);
|
|
var nodeW = g.node(e.w);
|
|
var p1, p2;
|
|
if (!edge.points) {
|
|
edge.points = [];
|
|
p1 = nodeW;
|
|
p2 = nodeV;
|
|
} else {
|
|
p1 = edge.points[0];
|
|
p2 = edge.points[edge.points.length - 1];
|
|
}
|
|
edge.points.unshift(intersectRect(nodeV, p1));
|
|
edge.points.push(intersectRect(nodeW, p2));
|
|
});
|
|
}
|
|
|
|
function fixupEdgeLabelCoords(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
if (Object.prototype.hasOwnProperty.call(edge, 'x')) {
|
|
if (edge.labelpos === 'l' || edge.labelpos === 'r') {
|
|
edge.width -= edge.labeloffset;
|
|
}
|
|
switch (edge.labelpos) {
|
|
case 'l':
|
|
edge.x -= edge.width / 2 + edge.labeloffset;
|
|
break;
|
|
case 'r':
|
|
edge.x += edge.width / 2 + edge.labeloffset;
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function reversePointsForReversedEdges(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
var edge = g.edge(e);
|
|
if (edge.reversed) {
|
|
edge.points.reverse();
|
|
}
|
|
});
|
|
}
|
|
|
|
function removeBorderNodes(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
if (g.children(v).length) {
|
|
var node = g.node(v);
|
|
var t = g.node(node.borderTop);
|
|
var b = g.node(node.borderBottom);
|
|
var l = g.node(lodash_es_last/* default */.Z(node.borderLeft));
|
|
var r = g.node(lodash_es_last/* default */.Z(node.borderRight));
|
|
|
|
node.width = Math.abs(r.x - l.x);
|
|
node.height = Math.abs(b.y - t.y);
|
|
node.x = l.x + node.width / 2;
|
|
node.y = t.y + node.height / 2;
|
|
}
|
|
});
|
|
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
if (g.node(v).dummy === 'border') {
|
|
g.removeNode(v);
|
|
}
|
|
});
|
|
}
|
|
|
|
function removeSelfEdges(g) {
|
|
forEach/* default */.Z(g.edges(), function (e) {
|
|
if (e.v === e.w) {
|
|
var node = g.node(e.v);
|
|
if (!node.selfEdges) {
|
|
node.selfEdges = [];
|
|
}
|
|
node.selfEdges.push({ e: e, label: g.edge(e) });
|
|
g.removeEdge(e);
|
|
}
|
|
});
|
|
}
|
|
|
|
function insertSelfEdges(g) {
|
|
var layers = buildLayerMatrix(g);
|
|
forEach/* default */.Z(layers, function (layer) {
|
|
var orderShift = 0;
|
|
forEach/* default */.Z(layer, function (v, i) {
|
|
var node = g.node(v);
|
|
node.order = i + orderShift;
|
|
forEach/* default */.Z(node.selfEdges, function (selfEdge) {
|
|
addDummyNode(
|
|
g,
|
|
'selfedge',
|
|
{
|
|
width: selfEdge.label.width,
|
|
height: selfEdge.label.height,
|
|
rank: node.rank,
|
|
order: i + ++orderShift,
|
|
e: selfEdge.e,
|
|
label: selfEdge.label,
|
|
},
|
|
'_se',
|
|
);
|
|
});
|
|
delete node.selfEdges;
|
|
});
|
|
});
|
|
}
|
|
|
|
function positionSelfEdges(g) {
|
|
forEach/* default */.Z(g.nodes(), function (v) {
|
|
var node = g.node(v);
|
|
if (node.dummy === 'selfedge') {
|
|
var selfNode = g.node(node.e.v);
|
|
var x = selfNode.x + selfNode.width / 2;
|
|
var y = selfNode.y;
|
|
var dx = node.x - x;
|
|
var dy = selfNode.height / 2;
|
|
g.setEdge(node.e, node.label);
|
|
g.removeNode(v);
|
|
node.label.points = [
|
|
{ x: x + (2 * dx) / 3, y: y - dy },
|
|
{ x: x + (5 * dx) / 6, y: y - dy },
|
|
{ x: x + dx, y: y },
|
|
{ x: x + (5 * dx) / 6, y: y + dy },
|
|
{ x: x + (2 * dx) / 3, y: y + dy },
|
|
];
|
|
node.label.x = node.x;
|
|
node.label.y = node.y;
|
|
}
|
|
});
|
|
}
|
|
|
|
function selectNumberAttrs(obj, attrs) {
|
|
return lodash_es_mapValues(lodash_es_pick(obj, attrs), Number);
|
|
}
|
|
|
|
function canonicalize(attrs) {
|
|
var newAttrs = {};
|
|
forEach/* default */.Z(attrs, function (v, k) {
|
|
newAttrs[k.toLowerCase()] = v;
|
|
});
|
|
return newAttrs;
|
|
}
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/dagre/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 11109:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
k: () => (/* binding */ Graph)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/constant.js
|
|
var constant = __webpack_require__(78795);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isFunction.js
|
|
var isFunction = __webpack_require__(48489);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/keys.js
|
|
var keys = __webpack_require__(11723);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/filter.js
|
|
var filter = __webpack_require__(11382);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isEmpty.js
|
|
var isEmpty = __webpack_require__(66400);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/forEach.js
|
|
var forEach = __webpack_require__(21845);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isUndefined.js
|
|
var isUndefined = __webpack_require__(52307);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseFlatten.js + 1 modules
|
|
var _baseFlatten = __webpack_require__(65029);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseRest.js
|
|
var _baseRest = __webpack_require__(99719);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseUniq.js + 1 modules
|
|
var _baseUniq = __webpack_require__(99633);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLikeObject.js
|
|
var isArrayLikeObject = __webpack_require__(60492);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/union.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates an array of unique values, in order, from all given arrays using
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
* for equality comparisons.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {...Array} [arrays] The arrays to inspect.
|
|
* @returns {Array} Returns the new array of combined values.
|
|
* @example
|
|
*
|
|
* _.union([2], [1, 2]);
|
|
* // => [2, 1]
|
|
*/
|
|
var union = (0,_baseRest/* default */.Z)(function(arrays) {
|
|
return (0,_baseUniq/* default */.Z)((0,_baseFlatten/* default */.Z)(arrays, 1, isArrayLikeObject/* default */.Z, true));
|
|
});
|
|
|
|
/* harmony default export */ const lodash_es_union = (union);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/values.js + 1 modules
|
|
var values = __webpack_require__(88873);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/reduce.js + 2 modules
|
|
var reduce = __webpack_require__(99413);
|
|
;// CONCATENATED MODULE: ../node_modules/dagre-d3-es/src/graphlib/graph.js
|
|
|
|
|
|
var DEFAULT_EDGE_NAME = '\x00';
|
|
var GRAPH_NODE = '\x00';
|
|
var EDGE_KEY_DELIM = '\x01';
|
|
|
|
// Implementation notes:
|
|
//
|
|
// * Node id query functions should return string ids for the nodes
|
|
// * Edge id query functions should return an "edgeObj", edge object, that is
|
|
// composed of enough information to uniquely identify an edge: {v, w, name}.
|
|
// * Internally we use an "edgeId", a stringified form of the edgeObj, to
|
|
// reference edges. This is because we need a performant way to look these
|
|
// edges up and, object properties, which have string keys, are the closest
|
|
// we're going to get to a performant hashtable in JavaScript.
|
|
|
|
// Implementation notes:
|
|
//
|
|
// * Node id query functions should return string ids for the nodes
|
|
// * Edge id query functions should return an "edgeObj", edge object, that is
|
|
// composed of enough information to uniquely identify an edge: {v, w, name}.
|
|
// * Internally we use an "edgeId", a stringified form of the edgeObj, to
|
|
// reference edges. This is because we need a performant way to look these
|
|
// edges up and, object properties, which have string keys, are the closest
|
|
// we're going to get to a performant hashtable in JavaScript.
|
|
class Graph {
|
|
constructor(opts = {}) {
|
|
this._isDirected = Object.prototype.hasOwnProperty.call(opts, 'directed')
|
|
? opts.directed
|
|
: true;
|
|
this._isMultigraph = Object.prototype.hasOwnProperty.call(opts, 'multigraph')
|
|
? opts.multigraph
|
|
: false;
|
|
this._isCompound = Object.prototype.hasOwnProperty.call(opts, 'compound')
|
|
? opts.compound
|
|
: false;
|
|
|
|
// Label for the graph itself
|
|
this._label = undefined;
|
|
|
|
// Defaults to be set when creating a new node
|
|
this._defaultNodeLabelFn = constant/* default */.Z(undefined);
|
|
|
|
// Defaults to be set when creating a new edge
|
|
this._defaultEdgeLabelFn = constant/* default */.Z(undefined);
|
|
|
|
// v -> label
|
|
this._nodes = {};
|
|
|
|
if (this._isCompound) {
|
|
// v -> parent
|
|
this._parent = {};
|
|
|
|
// v -> children
|
|
this._children = {};
|
|
this._children[GRAPH_NODE] = {};
|
|
}
|
|
|
|
// v -> edgeObj
|
|
this._in = {};
|
|
|
|
// u -> v -> Number
|
|
this._preds = {};
|
|
|
|
// v -> edgeObj
|
|
this._out = {};
|
|
|
|
// v -> w -> Number
|
|
this._sucs = {};
|
|
|
|
// e -> edgeObj
|
|
this._edgeObjs = {};
|
|
|
|
// e -> label
|
|
this._edgeLabels = {};
|
|
}
|
|
/* === Graph functions ========= */
|
|
isDirected() {
|
|
return this._isDirected;
|
|
}
|
|
isMultigraph() {
|
|
return this._isMultigraph;
|
|
}
|
|
isCompound() {
|
|
return this._isCompound;
|
|
}
|
|
setGraph(label) {
|
|
this._label = label;
|
|
return this;
|
|
}
|
|
graph() {
|
|
return this._label;
|
|
}
|
|
/* === Node functions ========== */
|
|
setDefaultNodeLabel(newDefault) {
|
|
if (!isFunction/* default */.Z(newDefault)) {
|
|
newDefault = constant/* default */.Z(newDefault);
|
|
}
|
|
this._defaultNodeLabelFn = newDefault;
|
|
return this;
|
|
}
|
|
nodeCount() {
|
|
return this._nodeCount;
|
|
}
|
|
nodes() {
|
|
return keys/* default */.Z(this._nodes);
|
|
}
|
|
sources() {
|
|
var self = this;
|
|
return filter/* default */.Z(this.nodes(), function (v) {
|
|
return isEmpty/* default */.Z(self._in[v]);
|
|
});
|
|
}
|
|
sinks() {
|
|
var self = this;
|
|
return filter/* default */.Z(this.nodes(), function (v) {
|
|
return isEmpty/* default */.Z(self._out[v]);
|
|
});
|
|
}
|
|
setNodes(vs, value) {
|
|
var args = arguments;
|
|
var self = this;
|
|
forEach/* default */.Z(vs, function (v) {
|
|
if (args.length > 1) {
|
|
self.setNode(v, value);
|
|
} else {
|
|
self.setNode(v);
|
|
}
|
|
});
|
|
return this;
|
|
}
|
|
setNode(v, value) {
|
|
if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {
|
|
if (arguments.length > 1) {
|
|
this._nodes[v] = value;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// @ts-expect-error
|
|
this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
|
|
if (this._isCompound) {
|
|
this._parent[v] = GRAPH_NODE;
|
|
this._children[v] = {};
|
|
this._children[GRAPH_NODE][v] = true;
|
|
}
|
|
this._in[v] = {};
|
|
this._preds[v] = {};
|
|
this._out[v] = {};
|
|
this._sucs[v] = {};
|
|
++this._nodeCount;
|
|
return this;
|
|
}
|
|
node(v) {
|
|
return this._nodes[v];
|
|
}
|
|
hasNode(v) {
|
|
return Object.prototype.hasOwnProperty.call(this._nodes, v);
|
|
}
|
|
removeNode(v) {
|
|
if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {
|
|
var removeEdge = (e) => this.removeEdge(this._edgeObjs[e]);
|
|
delete this._nodes[v];
|
|
if (this._isCompound) {
|
|
this._removeFromParentsChildList(v);
|
|
delete this._parent[v];
|
|
forEach/* default */.Z(this.children(v), (child) => {
|
|
this.setParent(child);
|
|
});
|
|
delete this._children[v];
|
|
}
|
|
forEach/* default */.Z(keys/* default */.Z(this._in[v]), removeEdge);
|
|
delete this._in[v];
|
|
delete this._preds[v];
|
|
forEach/* default */.Z(keys/* default */.Z(this._out[v]), removeEdge);
|
|
delete this._out[v];
|
|
delete this._sucs[v];
|
|
--this._nodeCount;
|
|
}
|
|
return this;
|
|
}
|
|
setParent(v, parent) {
|
|
if (!this._isCompound) {
|
|
throw new Error('Cannot set parent in a non-compound graph');
|
|
}
|
|
|
|
if (isUndefined/* default */.Z(parent)) {
|
|
parent = GRAPH_NODE;
|
|
} else {
|
|
// Coerce parent to string
|
|
parent += '';
|
|
for (var ancestor = parent; !isUndefined/* default */.Z(ancestor); ancestor = this.parent(ancestor)) {
|
|
if (ancestor === v) {
|
|
throw new Error('Setting ' + parent + ' as parent of ' + v + ' would create a cycle');
|
|
}
|
|
}
|
|
|
|
this.setNode(parent);
|
|
}
|
|
|
|
this.setNode(v);
|
|
this._removeFromParentsChildList(v);
|
|
this._parent[v] = parent;
|
|
this._children[parent][v] = true;
|
|
return this;
|
|
}
|
|
_removeFromParentsChildList(v) {
|
|
delete this._children[this._parent[v]][v];
|
|
}
|
|
parent(v) {
|
|
if (this._isCompound) {
|
|
var parent = this._parent[v];
|
|
if (parent !== GRAPH_NODE) {
|
|
return parent;
|
|
}
|
|
}
|
|
}
|
|
children(v) {
|
|
if (isUndefined/* default */.Z(v)) {
|
|
v = GRAPH_NODE;
|
|
}
|
|
|
|
if (this._isCompound) {
|
|
var children = this._children[v];
|
|
if (children) {
|
|
return keys/* default */.Z(children);
|
|
}
|
|
} else if (v === GRAPH_NODE) {
|
|
return this.nodes();
|
|
} else if (this.hasNode(v)) {
|
|
return [];
|
|
}
|
|
}
|
|
predecessors(v) {
|
|
var predsV = this._preds[v];
|
|
if (predsV) {
|
|
return keys/* default */.Z(predsV);
|
|
}
|
|
}
|
|
successors(v) {
|
|
var sucsV = this._sucs[v];
|
|
if (sucsV) {
|
|
return keys/* default */.Z(sucsV);
|
|
}
|
|
}
|
|
neighbors(v) {
|
|
var preds = this.predecessors(v);
|
|
if (preds) {
|
|
return lodash_es_union(preds, this.successors(v));
|
|
}
|
|
}
|
|
isLeaf(v) {
|
|
var neighbors;
|
|
if (this.isDirected()) {
|
|
neighbors = this.successors(v);
|
|
} else {
|
|
neighbors = this.neighbors(v);
|
|
}
|
|
return neighbors.length === 0;
|
|
}
|
|
filterNodes(filter) {
|
|
// @ts-expect-error
|
|
var copy = new this.constructor({
|
|
directed: this._isDirected,
|
|
multigraph: this._isMultigraph,
|
|
compound: this._isCompound,
|
|
});
|
|
|
|
copy.setGraph(this.graph());
|
|
|
|
var self = this;
|
|
forEach/* default */.Z(this._nodes, function (value, v) {
|
|
if (filter(v)) {
|
|
copy.setNode(v, value);
|
|
}
|
|
});
|
|
|
|
forEach/* default */.Z(this._edgeObjs, function (e) {
|
|
// @ts-expect-error
|
|
if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
|
|
copy.setEdge(e, self.edge(e));
|
|
}
|
|
});
|
|
|
|
var parents = {};
|
|
function findParent(v) {
|
|
var parent = self.parent(v);
|
|
if (parent === undefined || copy.hasNode(parent)) {
|
|
parents[v] = parent;
|
|
return parent;
|
|
} else if (parent in parents) {
|
|
return parents[parent];
|
|
} else {
|
|
return findParent(parent);
|
|
}
|
|
}
|
|
|
|
if (this._isCompound) {
|
|
forEach/* default */.Z(copy.nodes(), function (v) {
|
|
copy.setParent(v, findParent(v));
|
|
});
|
|
}
|
|
|
|
return copy;
|
|
}
|
|
/* === Edge functions ========== */
|
|
setDefaultEdgeLabel(newDefault) {
|
|
if (!isFunction/* default */.Z(newDefault)) {
|
|
newDefault = constant/* default */.Z(newDefault);
|
|
}
|
|
this._defaultEdgeLabelFn = newDefault;
|
|
return this;
|
|
}
|
|
edgeCount() {
|
|
return this._edgeCount;
|
|
}
|
|
edges() {
|
|
return values/* default */.Z(this._edgeObjs);
|
|
}
|
|
setPath(vs, value) {
|
|
var self = this;
|
|
var args = arguments;
|
|
reduce/* default */.Z(vs, function (v, w) {
|
|
if (args.length > 1) {
|
|
self.setEdge(v, w, value);
|
|
} else {
|
|
self.setEdge(v, w);
|
|
}
|
|
return w;
|
|
});
|
|
return this;
|
|
}
|
|
/*
|
|
* setEdge(v, w, [value, [name]])
|
|
* setEdge({ v, w, [name] }, [value])
|
|
*/
|
|
setEdge() {
|
|
var v, w, name, value;
|
|
var valueSpecified = false;
|
|
var arg0 = arguments[0];
|
|
|
|
if (typeof arg0 === 'object' && arg0 !== null && 'v' in arg0) {
|
|
v = arg0.v;
|
|
w = arg0.w;
|
|
name = arg0.name;
|
|
if (arguments.length === 2) {
|
|
value = arguments[1];
|
|
valueSpecified = true;
|
|
}
|
|
} else {
|
|
v = arg0;
|
|
w = arguments[1];
|
|
name = arguments[3];
|
|
if (arguments.length > 2) {
|
|
value = arguments[2];
|
|
valueSpecified = true;
|
|
}
|
|
}
|
|
|
|
v = '' + v;
|
|
w = '' + w;
|
|
if (!isUndefined/* default */.Z(name)) {
|
|
name = '' + name;
|
|
}
|
|
|
|
var e = edgeArgsToId(this._isDirected, v, w, name);
|
|
if (Object.prototype.hasOwnProperty.call(this._edgeLabels, e)) {
|
|
if (valueSpecified) {
|
|
this._edgeLabels[e] = value;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
if (!isUndefined/* default */.Z(name) && !this._isMultigraph) {
|
|
throw new Error('Cannot set a named edge when isMultigraph = false');
|
|
}
|
|
|
|
// It didn't exist, so we need to create it.
|
|
// First ensure the nodes exist.
|
|
this.setNode(v);
|
|
this.setNode(w);
|
|
|
|
// @ts-expect-error
|
|
this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
|
|
|
|
var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
|
|
// Ensure we add undirected edges in a consistent way.
|
|
v = edgeObj.v;
|
|
w = edgeObj.w;
|
|
|
|
Object.freeze(edgeObj);
|
|
this._edgeObjs[e] = edgeObj;
|
|
incrementOrInitEntry(this._preds[w], v);
|
|
incrementOrInitEntry(this._sucs[v], w);
|
|
this._in[w][e] = edgeObj;
|
|
this._out[v][e] = edgeObj;
|
|
this._edgeCount++;
|
|
return this;
|
|
}
|
|
edge(v, w, name) {
|
|
var e =
|
|
arguments.length === 1
|
|
? edgeObjToId(this._isDirected, arguments[0])
|
|
: edgeArgsToId(this._isDirected, v, w, name);
|
|
return this._edgeLabels[e];
|
|
}
|
|
hasEdge(v, w, name) {
|
|
var e =
|
|
arguments.length === 1
|
|
? edgeObjToId(this._isDirected, arguments[0])
|
|
: edgeArgsToId(this._isDirected, v, w, name);
|
|
return Object.prototype.hasOwnProperty.call(this._edgeLabels, e);
|
|
}
|
|
removeEdge(v, w, name) {
|
|
var e =
|
|
arguments.length === 1
|
|
? edgeObjToId(this._isDirected, arguments[0])
|
|
: edgeArgsToId(this._isDirected, v, w, name);
|
|
var edge = this._edgeObjs[e];
|
|
if (edge) {
|
|
v = edge.v;
|
|
w = edge.w;
|
|
delete this._edgeLabels[e];
|
|
delete this._edgeObjs[e];
|
|
decrementOrRemoveEntry(this._preds[w], v);
|
|
decrementOrRemoveEntry(this._sucs[v], w);
|
|
delete this._in[w][e];
|
|
delete this._out[v][e];
|
|
this._edgeCount--;
|
|
}
|
|
return this;
|
|
}
|
|
inEdges(v, u) {
|
|
var inV = this._in[v];
|
|
if (inV) {
|
|
var edges = values/* default */.Z(inV);
|
|
if (!u) {
|
|
return edges;
|
|
}
|
|
return filter/* default */.Z(edges, function (edge) {
|
|
return edge.v === u;
|
|
});
|
|
}
|
|
}
|
|
outEdges(v, w) {
|
|
var outV = this._out[v];
|
|
if (outV) {
|
|
var edges = values/* default */.Z(outV);
|
|
if (!w) {
|
|
return edges;
|
|
}
|
|
return filter/* default */.Z(edges, function (edge) {
|
|
return edge.w === w;
|
|
});
|
|
}
|
|
}
|
|
nodeEdges(v, w) {
|
|
var inEdges = this.inEdges(v, w);
|
|
if (inEdges) {
|
|
return inEdges.concat(this.outEdges(v, w));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Number of nodes in the graph. Should only be changed by the implementation. */
|
|
Graph.prototype._nodeCount = 0;
|
|
|
|
/* Number of edges in the graph. Should only be changed by the implementation. */
|
|
Graph.prototype._edgeCount = 0;
|
|
|
|
function incrementOrInitEntry(map, k) {
|
|
if (map[k]) {
|
|
map[k]++;
|
|
} else {
|
|
map[k] = 1;
|
|
}
|
|
}
|
|
|
|
function decrementOrRemoveEntry(map, k) {
|
|
if (!--map[k]) {
|
|
delete map[k];
|
|
}
|
|
}
|
|
|
|
function edgeArgsToId(isDirected, v_, w_, name) {
|
|
var v = '' + v_;
|
|
var w = '' + w_;
|
|
if (!isDirected && v > w) {
|
|
var tmp = v;
|
|
v = w;
|
|
w = tmp;
|
|
}
|
|
return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (isUndefined/* default */.Z(name) ? DEFAULT_EDGE_NAME : name);
|
|
}
|
|
|
|
function edgeArgsToObj(isDirected, v_, w_, name) {
|
|
var v = '' + v_;
|
|
var w = '' + w_;
|
|
if (!isDirected && v > w) {
|
|
var tmp = v;
|
|
v = w;
|
|
w = tmp;
|
|
}
|
|
var edgeObj = { v: v, w: w };
|
|
if (name) {
|
|
edgeObj.name = name;
|
|
}
|
|
return edgeObj;
|
|
}
|
|
|
|
function edgeObjToId(isDirected, edgeObj) {
|
|
return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 67406:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ k: () => (/* reexport safe */ _graph_js__WEBPACK_IMPORTED_MODULE_0__.k)
|
|
/* harmony export */ });
|
|
/* unused harmony export version */
|
|
/* harmony import */ var _graph_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11109);
|
|
// Includes only the "core" of graphlib
|
|
|
|
|
|
|
|
const version = '2.1.9-pre';
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 41589:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _isSymbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59660);
|
|
|
|
|
|
/**
|
|
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
|
* `comparator` to determine the extremum value.
|
|
*
|
|
* @private
|
|
* @param {Array} array The array to iterate over.
|
|
* @param {Function} iteratee The iteratee invoked per iteration.
|
|
* @param {Function} comparator The comparator used to compare values.
|
|
* @returns {*} Returns the extremum value.
|
|
*/
|
|
function baseExtremum(array, iteratee, comparator) {
|
|
var index = -1,
|
|
length = array.length;
|
|
|
|
while (++index < length) {
|
|
var value = array[index],
|
|
current = iteratee(value);
|
|
|
|
if (current != null && (computed === undefined
|
|
? (current === current && !(0,_isSymbol_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(current))
|
|
: comparator(current, computed)
|
|
)) {
|
|
var computed = current,
|
|
result = value;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseExtremum);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 79520:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/**
|
|
* The base implementation of `_.lt` which doesn't coerce arguments.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to compare.
|
|
* @param {*} other The other value to compare.
|
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
|
* else `false`.
|
|
*/
|
|
function baseLt(value, other) {
|
|
return value < other;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseLt);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 15521:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _baseEach_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77201);
|
|
/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(69959);
|
|
|
|
|
|
|
|
/**
|
|
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
*/
|
|
function baseMap(collection, iteratee) {
|
|
var index = -1,
|
|
result = (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(collection) ? Array(collection.length) : [];
|
|
|
|
(0,_baseEach_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(collection, function(value, key, collection) {
|
|
result[++index] = iteratee(value, key, collection);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (baseMap);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 73338:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: () => (/* binding */ _basePickBy)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseGet.js
|
|
var _baseGet = __webpack_require__(78402);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_assignValue.js
|
|
var _assignValue = __webpack_require__(15561);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_castPath.js + 2 modules
|
|
var _castPath = __webpack_require__(94022);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_isIndex.js
|
|
var _isIndex = __webpack_require__(8616);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isObject.js
|
|
var isObject = __webpack_require__(60417);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_toKey.js
|
|
var _toKey = __webpack_require__(13550);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseSet.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 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`.
|
|
*/
|
|
function baseSet(object, path, value, customizer) {
|
|
if (!(0,isObject/* default */.Z)(object)) {
|
|
return object;
|
|
}
|
|
path = (0,_castPath/* default */.Z)(path, object);
|
|
|
|
var index = -1,
|
|
length = path.length,
|
|
lastIndex = length - 1,
|
|
nested = object;
|
|
|
|
while (nested != null && ++index < length) {
|
|
var key = (0,_toKey/* default */.Z)(path[index]),
|
|
newValue = value;
|
|
|
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
return object;
|
|
}
|
|
|
|
if (index != lastIndex) {
|
|
var objValue = nested[key];
|
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
if (newValue === undefined) {
|
|
newValue = (0,isObject/* default */.Z)(objValue)
|
|
? objValue
|
|
: ((0,_isIndex/* default */.Z)(path[index + 1]) ? [] : {});
|
|
}
|
|
}
|
|
(0,_assignValue/* default */.Z)(nested, key, newValue);
|
|
nested = nested[key];
|
|
}
|
|
return object;
|
|
}
|
|
|
|
/* harmony default export */ const _baseSet = (baseSet);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_basePickBy.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} paths The property paths to pick.
|
|
* @param {Function} predicate The function invoked per property.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePickBy(object, paths, predicate) {
|
|
var index = -1,
|
|
length = paths.length,
|
|
result = {};
|
|
|
|
while (++index < length) {
|
|
var path = paths[index],
|
|
value = (0,_baseGet/* default */.Z)(object, path);
|
|
|
|
if (predicate(value, path)) {
|
|
_baseSet(result, (0,_castPath/* default */.Z)(path, object), value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/* harmony default export */ const _basePickBy = (basePickBy);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 65479:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _baseRest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(99719);
|
|
/* harmony import */ var _eq_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35050);
|
|
/* harmony import */ var _isIterateeCall_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47952);
|
|
/* harmony import */ var _keysIn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(48441);
|
|
|
|
|
|
|
|
|
|
|
|
/** Used for built-in method references. */
|
|
var objectProto = Object.prototype;
|
|
|
|
/** Used to check objects for own properties. */
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
/**
|
|
* Assigns own and inherited enumerable string keyed properties of source
|
|
* objects to the destination object for all destination properties that
|
|
* resolve to `undefined`. Source objects are applied from left to right.
|
|
* Once a property is set, additional values of the same property are ignored.
|
|
*
|
|
* **Note:** This method mutates `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The destination object.
|
|
* @param {...Object} [sources] The source objects.
|
|
* @returns {Object} Returns `object`.
|
|
* @see _.defaultsDeep
|
|
* @example
|
|
*
|
|
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
* // => { 'a': 1, 'b': 2 }
|
|
*/
|
|
var defaults = (0,_baseRest_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(function(object, sources) {
|
|
object = Object(object);
|
|
|
|
var index = -1;
|
|
var length = sources.length;
|
|
var guard = length > 2 ? sources[2] : undefined;
|
|
|
|
if (guard && (0,_isIterateeCall_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(sources[0], sources[1], guard)) {
|
|
length = 1;
|
|
}
|
|
|
|
while (++index < length) {
|
|
var source = sources[index];
|
|
var props = (0,_keysIn_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(source);
|
|
var propsIndex = -1;
|
|
var propsLength = props.length;
|
|
|
|
while (++propsIndex < propsLength) {
|
|
var key = props[propsIndex];
|
|
var value = object[key];
|
|
|
|
if (value === undefined ||
|
|
((0,_eq_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
object[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
return object;
|
|
});
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (defaults);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 90970:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: () => (/* binding */ lodash_es_find)
|
|
});
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseIteratee.js + 15 modules
|
|
var _baseIteratee = __webpack_require__(86494);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isArrayLike.js
|
|
var isArrayLike = __webpack_require__(69959);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/keys.js
|
|
var keys = __webpack_require__(11723);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_createFind.js
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates a `_.find` or `_.findLast` function.
|
|
*
|
|
* @private
|
|
* @param {Function} findIndexFunc The function to find the collection index.
|
|
* @returns {Function} Returns the new find function.
|
|
*/
|
|
function createFind(findIndexFunc) {
|
|
return function(collection, predicate, fromIndex) {
|
|
var iterable = Object(collection);
|
|
if (!(0,isArrayLike/* default */.Z)(collection)) {
|
|
var iteratee = (0,_baseIteratee/* default */.Z)(predicate, 3);
|
|
collection = (0,keys/* default */.Z)(collection);
|
|
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
|
}
|
|
var index = findIndexFunc(collection, predicate, fromIndex);
|
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
|
};
|
|
}
|
|
|
|
/* harmony default export */ const _createFind = (createFind);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_baseFindIndex.js
|
|
var _baseFindIndex = __webpack_require__(9872);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/toInteger.js
|
|
var toInteger = __webpack_require__(98670);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/findIndex.js
|
|
|
|
|
|
|
|
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
var nativeMax = Math.max;
|
|
|
|
/**
|
|
* This method is like `_.find` except that it returns the index of the first
|
|
* element `predicate` returns truthy for instead of the element itself.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 1.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {number} Returns the index of the found element, else `-1`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'active': false },
|
|
* { 'user': 'fred', 'active': false },
|
|
* { 'user': 'pebbles', 'active': true }
|
|
* ];
|
|
*
|
|
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
|
* // => 0
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
|
* // => 1
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.findIndex(users, ['active', false]);
|
|
* // => 0
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.findIndex(users, 'active');
|
|
* // => 2
|
|
*/
|
|
function findIndex(array, predicate, fromIndex) {
|
|
var length = array == null ? 0 : array.length;
|
|
if (!length) {
|
|
return -1;
|
|
}
|
|
var index = fromIndex == null ? 0 : (0,toInteger/* default */.Z)(fromIndex);
|
|
if (index < 0) {
|
|
index = nativeMax(length + index, 0);
|
|
}
|
|
return (0,_baseFindIndex/* default */.Z)(array, (0,_baseIteratee/* default */.Z)(predicate, 3), index);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_findIndex = (findIndex);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/find.js
|
|
|
|
|
|
|
|
/**
|
|
* Iterates over elements of `collection`, returning the first element
|
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
* arguments: (value, index|key, collection).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to inspect.
|
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
* @param {number} [fromIndex=0] The index to search from.
|
|
* @returns {*} Returns the matched element, else `undefined`.
|
|
* @example
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney', 'age': 36, 'active': true },
|
|
* { 'user': 'fred', 'age': 40, 'active': false },
|
|
* { 'user': 'pebbles', 'age': 1, 'active': true }
|
|
* ];
|
|
*
|
|
* _.find(users, function(o) { return o.age < 40; });
|
|
* // => object for 'barney'
|
|
*
|
|
* // The `_.matches` iteratee shorthand.
|
|
* _.find(users, { 'age': 1, 'active': true });
|
|
* // => object for 'pebbles'
|
|
*
|
|
* // The `_.matchesProperty` iteratee shorthand.
|
|
* _.find(users, ['active', false]);
|
|
* // => object for 'fred'
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.find(users, 'active');
|
|
* // => object for 'barney'
|
|
*/
|
|
var find = _createFind(lodash_es_findIndex);
|
|
|
|
/* harmony default export */ const lodash_es_find = (find);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 28099:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65029);
|
|
|
|
|
|
/**
|
|
* Flattens `array` a single level deep.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to flatten.
|
|
* @returns {Array} Returns the new flattened array.
|
|
* @example
|
|
*
|
|
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
* // => [1, 2, [3, [4]], 5]
|
|
*/
|
|
function flatten(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? (0,_baseFlatten_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(array, 1) : [];
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (flatten);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 36004:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: () => (/* binding */ lodash_es_has)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseHas.js
|
|
/** Used for built-in method references. */
|
|
var objectProto = Object.prototype;
|
|
|
|
/** Used to check objects for own properties. */
|
|
var _baseHas_hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
/**
|
|
* The base implementation of `_.has` without support for deep paths.
|
|
*
|
|
* @private
|
|
* @param {Object} [object] The object to query.
|
|
* @param {Array|string} key The key to check.
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
*/
|
|
function baseHas(object, key) {
|
|
return object != null && _baseHas_hasOwnProperty.call(object, key);
|
|
}
|
|
|
|
/* harmony default export */ const _baseHas = (baseHas);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/_hasPath.js
|
|
var _hasPath = __webpack_require__(18625);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/has.js
|
|
|
|
|
|
|
|
/**
|
|
* Checks if `path` is a direct property of `object`.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Object
|
|
* @param {Object} object The object to query.
|
|
* @param {Array|string} path The path to check.
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
* @example
|
|
*
|
|
* var object = { 'a': { 'b': 2 } };
|
|
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
*
|
|
* _.has(object, 'a');
|
|
* // => true
|
|
*
|
|
* _.has(object, 'a.b');
|
|
* // => true
|
|
*
|
|
* _.has(object, ['a', 'b']);
|
|
* // => true
|
|
*
|
|
* _.has(other, 'a');
|
|
* // => false
|
|
*/
|
|
function has(object, path) {
|
|
return object != null && (0,_hasPath/* default */.Z)(object, path, _baseHas);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_has = (has);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 75732:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _baseGetTag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(77070);
|
|
/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64058);
|
|
/* harmony import */ var _isObjectLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9615);
|
|
|
|
|
|
|
|
|
|
/** `Object#toString` result references. */
|
|
var stringTag = '[object String]';
|
|
|
|
/**
|
|
* Checks if `value` is classified as a `String` primitive or object.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
* @example
|
|
*
|
|
* _.isString('abc');
|
|
* // => true
|
|
*
|
|
* _.isString(1);
|
|
* // => false
|
|
*/
|
|
function isString(value) {
|
|
return typeof value == 'string' ||
|
|
(!(0,_isArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(value) && (0,_isObjectLike_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(value) && (0,_baseGetTag_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(value) == stringTag);
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isString);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 36411:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/**
|
|
* Gets the last element of `array`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Array
|
|
* @param {Array} array The array to query.
|
|
* @returns {*} Returns the last element of `array`.
|
|
* @example
|
|
*
|
|
* _.last([1, 2, 3]);
|
|
* // => 3
|
|
*/
|
|
function last(array) {
|
|
var length = array == null ? 0 : array.length;
|
|
return length ? array[length - 1] : undefined;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (last);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 12930:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _arrayMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33043);
|
|
/* harmony import */ var _baseIteratee_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(86494);
|
|
/* harmony import */ var _baseMap_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(15521);
|
|
/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64058);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Creates an array of values by running each element in `collection` thru
|
|
* `iteratee`. The iteratee is invoked with three arguments:
|
|
* (value, index|key, collection).
|
|
*
|
|
* Many lodash methods are guarded to work as iteratees for methods like
|
|
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
|
*
|
|
* The guarded methods are:
|
|
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
|
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
|
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
|
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.1.0
|
|
* @category Collection
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|
* @returns {Array} Returns the new mapped array.
|
|
* @example
|
|
*
|
|
* function square(n) {
|
|
* return n * n;
|
|
* }
|
|
*
|
|
* _.map([4, 8], square);
|
|
* // => [16, 64]
|
|
*
|
|
* _.map({ 'a': 4, 'b': 8 }, square);
|
|
* // => [16, 64] (iteration order is not guaranteed)
|
|
*
|
|
* var users = [
|
|
* { 'user': 'barney' },
|
|
* { 'user': 'fred' }
|
|
* ];
|
|
*
|
|
* // The `_.property` iteratee shorthand.
|
|
* _.map(users, 'user');
|
|
* // => ['barney', 'fred']
|
|
*/
|
|
function map(collection, iteratee) {
|
|
var func = (0,_isArray_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(collection) ? _arrayMap_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z : _baseMap_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
|
|
return func(collection, (0,_baseIteratee_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(iteratee, 3));
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (map);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 18519:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _baseExtremum_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41589);
|
|
/* harmony import */ var _baseLt_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(79520);
|
|
/* harmony import */ var _identity_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(64056);
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
|
* `undefined` is returned.
|
|
*
|
|
* @static
|
|
* @since 0.1.0
|
|
* @memberOf _
|
|
* @category Math
|
|
* @param {Array} array The array to iterate over.
|
|
* @returns {*} Returns the minimum value.
|
|
* @example
|
|
*
|
|
* _.min([4, 2, 8, 6]);
|
|
* // => 2
|
|
*
|
|
* _.min([]);
|
|
* // => undefined
|
|
*/
|
|
function min(array) {
|
|
return (array && array.length)
|
|
? (0,_baseExtremum_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(array, _identity_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, _baseLt_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)
|
|
: undefined;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (min);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 41291:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: () => (/* binding */ lodash_es_toFinite)
|
|
});
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_trimmedEndIndex.js
|
|
/** Used to match a single whitespace character. */
|
|
var reWhitespace = /\s/;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
function trimmedEndIndex(string) {
|
|
var index = string.length;
|
|
|
|
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
return index;
|
|
}
|
|
|
|
/* harmony default export */ const _trimmedEndIndex = (trimmedEndIndex);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/_baseTrim.js
|
|
|
|
|
|
/** Used to match leading whitespace. */
|
|
var reTrimStart = /^\s+/;
|
|
|
|
/**
|
|
* The base implementation of `_.trim`.
|
|
*
|
|
* @private
|
|
* @param {string} string The string to trim.
|
|
* @returns {string} Returns the trimmed string.
|
|
*/
|
|
function baseTrim(string) {
|
|
return string
|
|
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
: string;
|
|
}
|
|
|
|
/* harmony default export */ const _baseTrim = (baseTrim);
|
|
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isObject.js
|
|
var isObject = __webpack_require__(60417);
|
|
// EXTERNAL MODULE: ../node_modules/lodash-es/isSymbol.js
|
|
var isSymbol = __webpack_require__(59660);
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/toNumber.js
|
|
|
|
|
|
|
|
|
|
/** Used as references for various `Number` constants. */
|
|
var NAN = 0 / 0;
|
|
|
|
/** Used to detect bad signed hexadecimal string values. */
|
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
|
|
/** Used to detect binary string values. */
|
|
var reIsBinary = /^0b[01]+$/i;
|
|
|
|
/** Used to detect octal string values. */
|
|
var reIsOctal = /^0o[0-7]+$/i;
|
|
|
|
/** Built-in method references without a dependency on `root`. */
|
|
var freeParseInt = parseInt;
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
function toNumber(value) {
|
|
if (typeof value == 'number') {
|
|
return value;
|
|
}
|
|
if ((0,isSymbol/* default */.Z)(value)) {
|
|
return NAN;
|
|
}
|
|
if ((0,isObject/* default */.Z)(value)) {
|
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
value = (0,isObject/* default */.Z)(other) ? (other + '') : other;
|
|
}
|
|
if (typeof value != 'string') {
|
|
return value === 0 ? value : +value;
|
|
}
|
|
value = _baseTrim(value);
|
|
var isBinary = reIsBinary.test(value);
|
|
return (isBinary || reIsOctal.test(value))
|
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
: (reIsBadHex.test(value) ? NAN : +value);
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_toNumber = (toNumber);
|
|
|
|
;// CONCATENATED MODULE: ../node_modules/lodash-es/toFinite.js
|
|
|
|
|
|
/** Used as references for various `Number` constants. */
|
|
var INFINITY = 1 / 0,
|
|
MAX_INTEGER = 1.7976931348623157e+308;
|
|
|
|
/**
|
|
* Converts `value` to a finite number.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.12.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted number.
|
|
* @example
|
|
*
|
|
* _.toFinite(3.2);
|
|
* // => 3.2
|
|
*
|
|
* _.toFinite(Number.MIN_VALUE);
|
|
* // => 5e-324
|
|
*
|
|
* _.toFinite(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toFinite('3.2');
|
|
* // => 3.2
|
|
*/
|
|
function toFinite(value) {
|
|
if (!value) {
|
|
return value === 0 ? value : 0;
|
|
}
|
|
value = lodash_es_toNumber(value);
|
|
if (value === INFINITY || value === -INFINITY) {
|
|
var sign = (value < 0 ? -1 : 1);
|
|
return sign * MAX_INTEGER;
|
|
}
|
|
return value === value ? value : 0;
|
|
}
|
|
|
|
/* harmony default export */ const lodash_es_toFinite = (toFinite);
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 98670:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _toFinite_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41291);
|
|
|
|
|
|
/**
|
|
* Converts `value` to an integer.
|
|
*
|
|
* **Note:** This method is loosely based on
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to convert.
|
|
* @returns {number} Returns the converted integer.
|
|
* @example
|
|
*
|
|
* _.toInteger(3.2);
|
|
* // => 3
|
|
*
|
|
* _.toInteger(Number.MIN_VALUE);
|
|
* // => 0
|
|
*
|
|
* _.toInteger(Infinity);
|
|
* // => 1.7976931348623157e+308
|
|
*
|
|
* _.toInteger('3.2');
|
|
* // => 3
|
|
*/
|
|
function toInteger(value) {
|
|
var result = (0,_toFinite_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(value),
|
|
remainder = result % 1;
|
|
|
|
return result === result ? (remainder ? result - remainder : result) : 0;
|
|
}
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (toInteger);
|
|
|
|
|
|
/***/ })
|
|
|
|
}]);
|
|
//# sourceMappingURL=4276.aa39300c806a420e8c6e.js.map?v=aa39300c806a420e8c6e
|