"use client";
const require_create_split_props = require("../../utils/create-split-props.cjs");
const require_compose_refs = require("../../utils/compose-refs.cjs");
const require_factory = require("../factory.cjs");
const require_use_safe_layout_effect = require("../../utils/use-safe-layout-effect.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let _zag_js_focus_trap = require("@zag-js/focus-trap");
//#region src/components/focus-trap/focus-trap.tsx
var splitTrapProps = require_create_split_props.createSplitProps();
var FocusTrap = (0, react.forwardRef)((props, ref) => {
	const localRef = (0, react.useRef)(null);
	const [trapProps, localProps] = splitTrapProps(props, [
		"disabled",
		"onActivate",
		"onDeactivate",
		"initialFocus",
		"fallbackFocus",
		"returnFocusOnDeactivate",
		"setReturnFocus"
	]);
	require_use_safe_layout_effect.useSafeLayoutEffect(() => {
		const node = localRef.current;
		if (!node || trapProps.disabled) return;
		return (0, _zag_js_focus_trap.trapFocus)(node, trapProps);
	}, [ref, trapProps]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.ark.div, {
		ref: require_compose_refs.composeRefs(localRef, ref),
		...localProps
	});
});
FocusTrap.displayName = "FocusTrap";
//#endregion
exports.FocusTrap = FocusTrap;
