"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const forEach = require("../lodash-es/forEach.cjs");
const min = require("../lodash-es/min.cjs");
const map = require("../lodash-es/map.cjs");
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 = min.default(
      map.default(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 === void 0 || // return value of _.map([]) for Lodash 4
    rank === null) {
      rank = 0;
    }
    return label.rank = rank;
  }
  forEach.default(g.sources(), dfs);
}
function slack(g, e) {
  return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;
}
exports.longestPath = longestPath;
exports.slack = slack;
//# sourceMappingURL=src-dagre-rank-util.cjs.map
