"use client";
let react = require("react");
//#region packages/@mantine/core/src/components/Modal/use-modals-stack.ts
function useModalsStack(modals) {
	const initialState = modals.reduce((acc, modal) => ({
		...acc,
		[modal]: false
	}), {});
	const [state, setState] = (0, react.useState)(initialState);
	const open = (0, react.useCallback)((modal) => {
		setState((current) => ({
			...current,
			[modal]: true
		}));
	}, []);
	const close = (0, react.useCallback)((modal) => setState((current) => ({
		...current,
		[modal]: false
	})), []);
	const toggle = (0, react.useCallback)((modal) => setState((current) => ({
		...current,
		[modal]: !current[modal]
	})), []);
	return {
		state,
		open,
		close,
		closeAll: (0, react.useCallback)(() => setState(initialState), []),
		toggle,
		register: (0, react.useCallback)((modal) => ({
			opened: state[modal],
			onClose: () => close(modal),
			stackId: modal
		}), [state])
	};
}
const useDrawersStack = useModalsStack;
//#endregion
exports.useDrawersStack = useDrawersStack;
exports.useModalsStack = useModalsStack;

//# sourceMappingURL=use-modals-stack.cjs.map