import { useState as d, useCallback as m, useEffect as f } from "react";
const p = /^--[\w-]+$/, y = /^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/, C = /* @__PURE__ */ new Set(["currentcolor", "inherit", "initial", "revert", "revert-layer", "unset"]), s = typeof document < "u" ? document.createElement("span") : null;
function a(u) {
  const e = u.trim();
  if (!e || !s || C.has(e.toLowerCase()))
    return e;
  const t = document.body ?? document.documentElement;
  if (!t || (s.style.color = e, !s.style.color))
    return e;
  t.appendChild(s);
  const o = getComputedStyle(s).color.trim();
  return s.remove(), o || e;
}
function w(u, e = "currentColor") {
  var l;
  if (typeof document > "u")
    return e;
  const t = getComputedStyle(document.documentElement), o = /* @__PURE__ */ new Set();
  let n = u.trim();
  for (; n; ) {
    const r = n.match(y), c = (r == null ? void 0 : r[1]) ?? (p.test(n) ? n : null), i = (l = r == null ? void 0 : r[2]) == null ? void 0 : l.trim();
    if (!c)
      return a(n);
    if (o.has(c)) {
      n = i ?? "";
      continue;
    }
    o.add(c), n = t.getPropertyValue(c).trim() || i || "";
  }
  return a(e);
}
function b(u) {
  const [e, t] = d(!1), o = m(() => t(!0), []);
  return f(() => {
    t(!1);
  }, [u]), {
    touched: e,
    onBlur: o
  };
}
export {
  w as r,
  b as u
};
//# sourceMappingURL=utils--n2yqjCy.js.map
