const o = {
  xs: 0,
  // phone
  sm: 600,
  // tablet
  md: 900,
  // small laptop
  lg: 1200,
  // desktop
  xl: 1536
  // large screen
}, i = {
  // Sorted ASC by size. That's important.
  // It can't be configured as it's used statically for propTypes.
  keys: ["xs", "sm", "md", "lg", "xl"],
  up: (e) => `@media (min-width:${o[e]}px)`
};
function m(e, t, n) {
  const r = e.theme || {};
  if (Array.isArray(t)) {
    const s = r.breakpoints || i;
    return t.reduce((c, f, y) => (c[s.up(s.keys[y])] = n(t[y]), c), {});
  }
  if (typeof t == "object") {
    const s = r.breakpoints || i;
    return Object.keys(t).reduce((c, f) => {
      if (Object.keys(s.values || o).indexOf(f) !== -1) {
        const y = s.up(f);
        c[y] = n(t[f], f);
      } else {
        const y = f;
        c[y] = t[y];
      }
      return c;
    }, {});
  }
  return n(t);
}
function h(e = {}) {
  var t;
  return ((t = e.keys) == null ? void 0 : t.reduce((r, u) => {
    const s = e.up(u);
    return r[s] = {}, r;
  }, {})) || {};
}
function B(e, t) {
  return e.reduce((n, r) => {
    const u = n[r];
    return (!u || Object.keys(u).length === 0) && delete n[r], n;
  }, t);
}
function d(e, t) {
  if (typeof e != "object")
    return {};
  const n = {}, r = Object.keys(t);
  return Array.isArray(e) ? r.forEach((u, s) => {
    s < e.length && (n[u] = !0);
  }) : r.forEach((u) => {
    e[u] != null && (n[u] = !0);
  }), n;
}
function O({
  values: e,
  breakpoints: t,
  base: n
}) {
  const r = n || d(e, t), u = Object.keys(r);
  if (u.length === 0)
    return e;
  let s;
  return u.reduce((c, f, y) => (Array.isArray(e) ? (c[f] = e[y] != null ? e[y] : e[s], s = y) : typeof e == "object" ? (c[f] = e[f] != null ? e[f] : e[s], s = f) : c[f] = e, c), {});
}
export {
  d as computeBreakpointsBase,
  h as createEmptyBreakpointObject,
  m as handleBreakpoints,
  B as removeUnusedBreakpoints,
  O as resolveBreakpointValues,
  o as values
};
