import { modifierPhases as f } from "../enums.js";
function i(e) {
  var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), a = [];
  e.forEach(function(r) {
    t.set(r.name, r);
  });
  function u(r) {
    n.add(r.name);
    var o = [].concat(r.requires || [], r.requiresIfExists || []);
    o.forEach(function(s) {
      if (!n.has(s)) {
        var c = t.get(s);
        c && u(c);
      }
    }), a.push(r);
  }
  return e.forEach(function(r) {
    n.has(r.name) || u(r);
  }), a;
}
function v(e) {
  var t = i(e);
  return f.reduce(function(n, a) {
    return n.concat(t.filter(function(u) {
      return u.phase === a;
    }));
  }, []);
}
export {
  v as default
};
//# sourceMappingURL=orderModifiers.js.map
