/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b859c78 | Cube Dev Team */
import { ItemAction } from "./actions/ItemAction/ItemAction.js";
import { ItemBadge } from "./content/ItemBadge/ItemBadge.js";
import { Item } from "react-stately";

//#region src/components/CollectionItem.tsx
/**
* Service props that are used by react-stately or parent components
* and should not be passed to the Item component.
*/
const SERVICE_PROPS = new Set([
	"textValue",
	"hasChildItems",
	"childItems",
	"title",
	"onAction",
	"wrapper",
	"keywords",
	"forceMount"
]);
/**
* Filters out service props from collection item props, returning only
* props that should be passed to the Item component.
*
* This eliminates the need to manually extract and pass Item props
* in components like MenuItem, ListBox Option, and Select Option.
*
* @param itemProps - The props from a collection item (node.props)
* @returns Filtered props safe to spread onto Item component
*
* @example
* ```tsx
* const itemProps = filterCollectionItemProps(item.props);
* return <Item {...itemProps} />;
* ```
*/
function filterCollectionItemProps(itemProps) {
	if (!itemProps) return {};
	const filtered = {};
	for (const key in itemProps) if (Object.prototype.hasOwnProperty.call(itemProps, key) && !SERVICE_PROPS.has(key)) filtered[key] = itemProps[key];
	return filtered;
}
const _CollectionItem = Object.assign(Item, {
	Action: ItemAction,
	Badge: ItemBadge
});

//#endregion
export { _CollectionItem, filterCollectionItemProps };
//# sourceMappingURL=CollectionItem.js.map