import d from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/filter.js";
import p from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/max.js";
import m from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/map.js";
import c from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/range.js";
import h from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/sortBy.js";
import a from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/forEach.js";
import l from "../../../../../../lodash-es@4.17.22/node_modules/lodash-es/has.js";
function O(n) {
  var o = {}, t = d(n.nodes(), function(r) {
    return !n.children(r).length;
  }), f = p(
    m(t, function(r) {
      return n.node(r).rank;
    })
  ), e = m(c(f + 1), function() {
    return [];
  });
  function i(r) {
    if (!l(o, r)) {
      o[r] = !0;
      var s = n.node(r);
      e[s.rank].push(r), a(n.successors(r), i);
    }
  }
  var u = h(t, function(r) {
    return n.node(r).rank;
  });
  return a(u, i), e;
}
export {
  O as initOrder
};
