import d from "./index-getVariation.js";
import { variationPlacements as f, basePlacements as g, placements as w } from "./index-enums.js";
import b from "./index-detectOverflow.js";
import A from "./index-getBasePlacement.js";
function _(m, r) {
  r === void 0 && (r = {});
  var t = r, c = t.placement, s = t.boundary, p = t.rootBoundary, v = t.padding, P = t.flipVariations, i = t.allowedAutoPlacements, y = i === void 0 ? w : i, l = d(c), u = l ? P ? f : f.filter(function(e) {
    return d(e) === l;
  }) : g, a = u.filter(function(e) {
    return y.indexOf(e) >= 0;
  });
  a.length === 0 && (a = u);
  var n = a.reduce(function(e, o) {
    return e[o] = b(m, {
      placement: o,
      boundary: s,
      rootBoundary: p,
      padding: v
    })[A(o)], e;
  }, {});
  return Object.keys(n).sort(function(e, o) {
    return n[e] - n[o];
  });
}
export {
  _ as default
};
