import { breakpoints as l } from "../props/prop-def.js";
import { hasOwnProperty as p } from "./has-own-property.js";
import { isResponsiveObject as m } from "./is-responsive-object.js";
function V({ className: n, customProperties: s, ...t }) {
  const u = v({ allowArbitraryValues: !0, className: n, ...t }), e = d({ customProperties: s, ...t });
  return [u, e];
}
function v({ allowArbitraryValues: n, value: s, className: t, propValues: u, parseValue: e = (i) => i }) {
  const i = [];
  if (s) {
    if (typeof s == "string" && u.includes(s)) return f(t, s, e);
    if (m(s)) {
      const o = s;
      for (const r in o) {
        if (!p(o, r) || !l.includes(r)) continue;
        const a = o[r];
        if (a !== void 0) {
          if (u.includes(a)) {
            const c = f(t, a, e), $ = r === "initial" ? c : `${r}:${c}`;
            i.push($);
          } else if (n) {
            const c = r === "initial" ? t : `${r}:${t}`;
            i.push(c);
          }
        }
      }
      return i.join(" ");
    }
    if (n) return t;
  }
}
function f(n, s, t) {
  const u = n ? "-" : "", e = t(s), i = e?.startsWith("-"), o = i ? "-" : "", r = i ? e?.substring(1) : e;
  return `${o}${n}${u}${r}`;
}
function d({ customProperties: n, value: s, propValues: t, parseValue: u = (e) => e }) {
  let e = {};
  if (!(!s || typeof s == "string" && t.includes(s))) {
    if (typeof s == "string" && (e = Object.fromEntries(n.map((i) => [i, s]))), m(s)) {
      const i = s;
      for (const o in i) {
        if (!p(i, o) || !l.includes(o)) continue;
        const r = i[o];
        if (!t.includes(r)) for (const a of n) e = { [o === "initial" ? a : `${a}-${o}`]: r, ...e };
      }
    }
    for (const i in e) {
      const o = e[i];
      o !== void 0 && (e[i] = u(o));
    }
    return e;
  }
}
export {
  v as getResponsiveClassNames,
  d as getResponsiveCustomProperties,
  V as getResponsiveStyles
};
//# sourceMappingURL=get-responsive-styles.js.map
