import u from "./getVariation.es.js";
import { variationPlacements as s, basePlacements as y, placements as b } from "../enums.es.js";
import g from "./detectOverflow.es.js";
import h from "./getBasePlacement.es.js";
function x(c, a) {
  a === void 0 && (a = {});
  var o = a, m = o.placement, p = o.boundary, f = o.rootBoundary, v = o.padding, w = o.flipVariations, i = o.allowedAutoPlacements, P = i === void 0 ? b : i, l = u(m), d = l ? w ? s : s.filter(function(e) {
    return u(e) === l;
  }) : y, n = d.filter(function(e) {
    return P.indexOf(e) >= 0;
  });
  n.length === 0 && (n = d, process.env.NODE_ENV !== "production" && console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" ")));
  var r = n.reduce(function(e, t) {
    return e[t] = g(c, {
      placement: t,
      boundary: p,
      rootBoundary: f,
      padding: v
    })[h(t)], e;
  }, {});
  return Object.keys(r).sort(function(e, t) {
    return r[e] - r[t];
  });
}
export {
  x as default
};
//# sourceMappingURL=computeAutoPlacement.es.js.map
