/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

const require_runtime = require('../../_virtual/_rolldown/runtime.js');
const require_add_select_utils = require('./add-select-utils.js');
const require_AddSelectBody = require('./AddSelectBody.js');
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);

//#region src/components/AddSelect/AddSelect.tsx
const componentName = "AddSelect";
const AddSelect = (0, react.forwardRef)(({ items = { entries: [] }, globalFilters, ...props }, ref) => {
	const useNormalizedItems = !!items.entries.find((item) => item.children);
	const normalizedItems = useNormalizedItems ? require_add_select_utils.normalize(items) : null;
	const globalFilterOpts = props.multi && globalFilters?.length ? require_add_select_utils.getGlobalFilterValues(globalFilters, normalizedItems) : null;
	const defaultModifiers = props.multi && items.modifiers ? items.entries.map((item) => {
		const modifierAttribute = items?.modifiers?.id;
		return {
			id: item.id,
			...modifierAttribute && { [modifierAttribute]: item[modifierAttribute] }
		};
	}) : [];
	return /* @__PURE__ */ react.default.createElement(require_AddSelectBody.AddSelectBody, {
		...props,
		ref,
		items,
		normalizedItems,
		useNormalizedItems,
		globalFilterOpts,
		defaultModifiers
	});
});
AddSelect.propTypes = {
	className: prop_types.default.string,
	clearFiltersText: prop_types.default.string,
	closeIconDescription: prop_types.default.string.isRequired,
	columnInputPlaceholder: prop_types.default.string,
	description: prop_types.default.string.isRequired,
	filterByLabel: prop_types.default.string,
	globalFilters: prop_types.default.arrayOf(prop_types.default.shape({
		id: prop_types.default.string,
		label: prop_types.default.string
	})),
	globalFiltersIconDescription: prop_types.default.string,
	globalFiltersLabel: prop_types.default.string,
	globalFiltersPlaceholderText: prop_types.default.string,
	globalFiltersPrimaryButtonText: prop_types.default.string,
	globalFiltersSecondaryButtonText: prop_types.default.string,
	globalSearchLabel: prop_types.default.string.isRequired,
	globalSearchPlaceholder: prop_types.default.string,
	globalSortBy: prop_types.default.array,
	illustrationTheme: prop_types.default.oneOf(["light", "dark"]),
	influencerTitle: prop_types.default.string,
	items: prop_types.default.shape({
		modifiers: prop_types.default.shape({
			id: prop_types.default.string,
			label: prop_types.default.string,
			options: prop_types.default.array,
			multiSelect: prop_types.default.bool
		}),
		sortBy: prop_types.default.array,
		filterBy: prop_types.default.array,
		entries: prop_types.default.arrayOf(prop_types.default.shape({
			avatar: prop_types.default.shape({
				alt: prop_types.default.string,
				icon: prop_types.default.func,
				src: prop_types.default.string,
				theme: prop_types.default.oneOf(["light", "dark"])
			}),
			children: prop_types.default.object,
			icon: prop_types.default.func,
			id: prop_types.default.string.isRequired,
			meta: prop_types.default.oneOfType([prop_types.default.arrayOf(prop_types.default.shape({
				id: prop_types.default.string,
				title: prop_types.default.string,
				value: prop_types.default.string
			})), prop_types.default.node]),
			subtitle: prop_types.default.string,
			title: prop_types.default.string.isRequired,
			value: prop_types.default.string.isRequired
		})).isRequired
	}).isRequired,
	itemsLabel: prop_types.default.string.isRequired,
	metaIconDescription: prop_types.default.string,
	metaPanelTitle: prop_types.default.string,
	multi: prop_types.default.bool.isRequired,
	navIconDescription: prop_types.default.string,
	noResultsDescription: prop_types.default.string.isRequired,
	noResultsTitle: prop_types.default.string.isRequired,
	noSelectionDescription: prop_types.default.string,
	noSelectionTitle: prop_types.default.string,
	onClose: prop_types.default.func.isRequired,
	onCloseButtonText: prop_types.default.string.isRequired,
	onSubmit: prop_types.default.func.isRequired,
	onSubmitButtonText: prop_types.default.string.isRequired,
	open: prop_types.default.bool.isRequired,
	portalTarget: prop_types.default.node,
	searchResultsTitle: prop_types.default.string,
	sortByLabel: prop_types.default.string,
	title: prop_types.default.string.isRequired
};
AddSelect.displayName = componentName;

//#endregion
exports.AddSelect = AddSelect;