UNPKG

@readme/markdown

Version:

ReadMe's React-based Markdown parser

1,936 lines (1,590 loc) 158 kB
"use strict"; exports.id = 995; exports.ids = [995]; exports.modules = { /***/ 995: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // EXPORTS __webpack_require__.d(__webpack_exports__, { Zp: () => (/* reexport */ layout) }); // UNUSED EXPORTS: acyclic, normalize, rank // EXTERNAL MODULE: ./node_modules/lodash-es/forEach.js var forEach = __webpack_require__(9769); // EXTERNAL MODULE: ./node_modules/lodash-es/toString.js + 1 modules var lodash_es_toString = __webpack_require__(8574); ;// ./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 */.A)(prefix) + id; } /* harmony default export */ const lodash_es_uniqueId = (uniqueId); // EXTERNAL MODULE: ./node_modules/lodash-es/constant.js var constant = __webpack_require__(3659); // EXTERNAL MODULE: ./node_modules/lodash-es/flatten.js var flatten = __webpack_require__(4033); // EXTERNAL MODULE: ./node_modules/lodash-es/map.js var map = __webpack_require__(8937); ;// ./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__(1943); // EXTERNAL MODULE: ./node_modules/lodash-es/toFinite.js + 3 modules var toFinite = __webpack_require__(5157); ;// ./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 */.A)(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = (0,toFinite/* default */.A)(start); if (end === undefined) { end = start; start = 0; } else { end = (0,toFinite/* default */.A)(end); } step = step === undefined ? (start < end ? 1 : -1) : (0,toFinite/* default */.A)(step); return _baseRange(start, end, step, fromRight); }; } /* harmony default export */ const _createRange = (createRange); ;// ./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__(4416); ;// ./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; } } ;// ./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 */.A(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 */.A( map/* default */.A(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 */.A(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 */.A(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 */.T(); var maxIn = 0; var maxOut = 0; forEach/* default */.A(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 */.A(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 */.A(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); } } ;// ./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 */.A(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 */.A(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 */.A(g.nodes(), dfs); return fas; } function undo(g) { forEach/* default */.A(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__(1354); // EXTERNAL MODULE: ./node_modules/lodash-es/_basePickBy.js + 1 modules var _basePickBy = __webpack_require__(2107); // EXTERNAL MODULE: ./node_modules/lodash-es/hasIn.js + 1 modules var hasIn = __webpack_require__(2279); ;// ./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 */.A)(object, paths, function(value, path) { return (0,hasIn/* default */.A)(object, path); }); } /* harmony default export */ const _basePick = (basePick); // EXTERNAL MODULE: ./node_modules/lodash-es/_overRest.js + 1 modules var _overRest = __webpack_require__(5172); // EXTERNAL MODULE: ./node_modules/lodash-es/_setToString.js + 2 modules var _setToString = __webpack_require__(6989); ;// ./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 */.A)((0,_overRest/* default */.A)(func, undefined, flatten/* default */.A), func + ''); } /* harmony default export */ const _flatRest = (flatRest); ;// ./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__(8693); // EXTERNAL MODULE: ./node_modules/lodash-es/_baseExtremum.js var _baseExtremum = __webpack_require__(5852); ;// ./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__(3077); ;// ./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 */.A)(array, identity/* default */.A, _baseGt) : undefined; } /* harmony default export */ const lodash_es_max = (max); // EXTERNAL MODULE: ./node_modules/lodash-es/last.js var lodash_es_last = __webpack_require__(359); // EXTERNAL MODULE: ./node_modules/lodash-es/_baseAssignValue.js var _baseAssignValue = __webpack_require__(8657); // EXTERNAL MODULE: ./node_modules/lodash-es/_baseForOwn.js var _baseForOwn = __webpack_require__(9858); // EXTERNAL MODULE: ./node_modules/lodash-es/_baseIteratee.js + 15 modules var _baseIteratee = __webpack_require__(2457); ;// ./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 */.A)(iteratee, 3); (0,_baseForOwn/* default */.A)(object, function(value, key, object) { (0,_baseAssignValue/* default */.A)(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__(9523); // EXTERNAL MODULE: ./node_modules/lodash-es/min.js var lodash_es_min = __webpack_require__(963); // EXTERNAL MODULE: ./node_modules/lodash-es/has.js + 1 modules var has = __webpack_require__(8415); // EXTERNAL MODULE: ./node_modules/lodash-es/_root.js var _root = __webpack_require__(4606); ;// ./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 */.A.Date.now(); }; /* harmony default export */ const lodash_es_now = (now); ;// ./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 */.T().setGraph(g.graph()); forEach/* default */.A(g.nodes(), function (v) { simplified.setNode(v, g.node(v)); }); forEach/* default */.A(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 */.T({ multigraph: g.isMultigraph() }).setGraph(g.graph()); forEach/* default */.A(g.nodes(), function (v) { if (!g.children(v).length) { simplified.setNode(v, g.node(v)); } }); forEach/* default */.A(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 */.A(lodash_es_range(util_maxRank(g) + 1), function () { return []; }); forEach/* default */.A(g.nodes(), function (v) { var node = g.node(v); var rank = node.rank; if (!isUndefined/* default */.A(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 */.A( map/* default */.A(g.nodes(), function (v) { return g.node(v).rank; }), ); forEach/* default */.A(g.nodes(), function (v) { var node = g.node(v); if (has/* default */.A(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 */.A( map/* default */.A(g.nodes(), function (v) { return g.node(v).rank; }), ); var layers = []; forEach/* default */.A(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 */.A(layers, function (vs, i) { if (isUndefined/* default */.A(vs) && i % nodeRankFactor !== 0) { --delta; } else if (delta) { forEach/* default */.A(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 */.A(g.nodes(), function (v) { var rank = g.node(v).rank; if (!isUndefined/* default */.A(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 */.A(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(); } ;// ./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 */.A(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 */.A(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 }); } } ;// ./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 */.A(g.nodes(), function (v) { swapWidthHeightOne(g.node(v)); }); forEach/* default */.A(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 */.A(g.nodes(), function (v) { reverseYOne(g.node(v)); }); forEach/* default */.A(g.edges(), function (e) { var edge = g.edge(e); forEach/* default */.A(edge.points, reverseYOne); if (Object.prototype.hasOwnProperty.call(edge, 'y')) { reverseYOne(edge); } }); } function reverseYOne(attrs) { attrs.y = -attrs.y; } function swapXY(g) { forEach/* default */.A(g.nodes(), function (v) { swapXYOne(g.node(v)); }); forEach/* default */.A(g.edges(), function (e) { var edge = g.edge(e); forEach/* default */.A(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; } ;// ./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 */.A(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 */.A(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__(1135); ;// ./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 */.A)(array, (0,_baseIteratee/* default */.A)(iteratee, 2), _baseLt/* default */.A) : undefined; } /* harmony default export */ const lodash_es_minBy = (minBy); ;// ./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 */.A( map/* default */.A(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 */.A(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; } ;// ./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 */.T({ 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 */.A(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 */.A(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 */.A(t.nodes(), function (v) { g.node(v).rank += delta; }); } // EXTERNAL MODULE: ./node_modules/lodash-es/find.js + 2 modules var find = __webpack_require__(3313); // EXTERNAL MODULE: ./node_modules/lodash-es/filter.js var filter = __webpack_require__(7133); ;// ./node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js var DEFAULT_WEIGHT_FUNC = constant/* default */.A(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; } ;// ./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); }, {}, ); } ;// ./node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js var floyd_warshall_DEFAULT_WEIGHT_FUNC = constant/* default */.A(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__(6279); // EXTERNAL MODULE: ./node_modules/lodash-es/_getTag.js + 3 modules var _getTag = __webpack_require__(1424); // EXTERNAL MODULE: ./node_modules/lodash-es/isArrayLike.js var isArrayLike = __webpack_require__(1585); // EXTERNAL MODULE: ./node_modules/lodash-es/isString.js var isString = __webpack_require__(6378); // EXTERNAL MODULE: ./node_modules/lodash-es/_baseProperty.js var _baseProperty = __webpack_require__(3162); ;// ./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 */.A)('length'); /* harmony default export */ const _asciiSize = (asciiSize); ;// ./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); ;// ./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); ;// ./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); ;// ./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 */.A)(collection)) { return (0,isString/* default */.A)(collection) ? _stringSize(collection) : collection.length; } var tag = (0,_getTag/* default */.A)(collection); if (tag == mapTag || tag == setTag) { return collection.size; } return (0,_baseKeys/* default */.A)(collection).length; } /* harmony default export */ const lodash_es_size = (size); ;// ./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 */.A(g.predecessors(node), visit); delete stack[node]; results.push(node); } } forEach/* default */.A(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 ;// ./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__(9990); ;// ./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 */.A(vs)) { vs = [vs]; } var navigation = (g.isDirected() ? g.successors : g.neighbors).bind(g); var acc = []; var visited = {}; forEach/* default */.A(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 */.A(navigation(v), function (w) { doDfs(g, w, postorder, visited, navigation, acc); }); if (postorder) { acc.push(v); } } } ;// ./node_modules/dagre-d3-es/src/graphlib/alg/postorder.js function postorder(g, vs) { return dfs(g, vs, 'post'); } ;// ./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__(8448); ;// ./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; } ;// ./node_modules/dagre-d3-es/src/graphlib/alg/index.js ;// ./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 */.A(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 */.A(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 */.A(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 (par