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