import v from "./index-objectWithoutPropertiesLoose.js";
import f from "./index-extends.js";
const h = ["values", "unit", "step"], $ = (i) => {
  const t = Object.keys(i).map((r) => ({
    key: r,
    val: i[r]
  })) || [];
  return t.sort((r, u) => r.val - u.val), t.reduce((r, u) => f({}, r, {
    [u.key]: u.val
  }), {});
};
function w(i) {
  const {
    // The breakpoint **start** at this value.
    // For instance with the first breakpoint xs: [xs, sm).
    values: t = {
      xs: 0,
      // phone
      sm: 600,
      // tablet
      md: 900,
      // small laptop
      lg: 1200,
      // desktop
      xl: 1536
      // large screen
    },
    unit: r = "px",
    step: u = 5
  } = i, m = v(i, h), c = $(t), n = Object.keys(c);
  function s(e) {
    return `@media (min-width:${typeof t[e] == "number" ? t[e] : e}${r})`;
  }
  function l(e) {
    return `@media (max-width:${(typeof t[e] == "number" ? t[e] : e) - u / 100}${r})`;
  }
  function a(e, o) {
    const d = n.indexOf(o);
    return `@media (min-width:${typeof t[e] == "number" ? t[e] : e}${r}) and (max-width:${(d !== -1 && typeof t[n[d]] == "number" ? t[n[d]] : o) - u / 100}${r})`;
  }
  function p(e) {
    return n.indexOf(e) + 1 < n.length ? a(e, n[n.indexOf(e) + 1]) : s(e);
  }
  function x(e) {
    const o = n.indexOf(e);
    return o === 0 ? s(n[1]) : o === n.length - 1 ? l(n[o]) : a(e, n[n.indexOf(e) + 1]).replace("@media", "@media not all and");
  }
  return f({
    keys: n,
    values: c,
    up: s,
    down: l,
    between: a,
    only: p,
    not: x,
    unit: r
  }, m);
}
export {
  w as default
};
