"use client";
import { createSplitProps } from "../../utils/create-split-props.js";
import { ark } from "../factory.js";
import { useListboxContext } from "./use-listbox-context.js";
import { ListboxItemProvider } from "./use-listbox-item-context.js";
import { ListboxItemPropsProvider } from "./use-listbox-item-props-context.js";
import { forwardRef } from "react";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/listbox/listbox-item.tsx
var splitItemProps = createSplitProps();
var ListboxItem = forwardRef((props, ref) => {
	const [itemProps, localProps] = splitItemProps(props, ["item", "highlightOnHover"]);
	const listbox = useListboxContext();
	const mergedProps = mergeProps(listbox.getItemProps(itemProps), localProps);
	return /* @__PURE__ */ jsx(ListboxItemPropsProvider, {
		value: itemProps,
		children: /* @__PURE__ */ jsx(ListboxItemProvider, {
			value: listbox.getItemState(itemProps),
			children: /* @__PURE__ */ jsx(ark.div, {
				...mergedProps,
				ref
			})
		})
	});
});
ListboxItem.displayName = "ListboxItem";
//#endregion
export { ListboxItem };
