import { mergeProps as c } from "../../utils/dist/module.es.js";
import d, { useState as u, useMemo as p } from "react";
import { useFocusWithin as f } from "../../interactions/dist/module.es.js";
const n = {
  border: 0,
  clip: "rect(0 0 0 0)",
  clipPath: "inset(50%)",
  height: 1,
  margin: "0 -1px -1px 0",
  overflow: "hidden",
  padding: 0,
  position: "absolute",
  width: 1,
  whiteSpace: "nowrap"
};
function $(s = {}) {
  let { style: e, isFocusable: t } = s, [i, r] = u(!1), { focusWithinProps: l } = f({
    isDisabled: !t,
    onFocusWithinChange: (a) => r(a)
  }), o = p(() => i ? e : e ? {
    ...n,
    ...e
  } : n, [
    i
  ]);
  return {
    visuallyHiddenProps: {
      ...l,
      style: o
    }
  };
}
function y(s) {
  let { children: e, elementType: t = "div", isFocusable: i, style: r, ...l } = s, { visuallyHiddenProps: o } = $(s);
  return /* @__PURE__ */ d.createElement(t, c(l, o), e);
}
export {
  y as VisuallyHidden,
  $ as useVisuallyHidden
};
//# sourceMappingURL=module.es.js.map
