"use client";
import { useCallback, useState } from "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] = useState(initialState);
	const open = useCallback((modal) => {
		setState((current) => ({
			...current,
			[modal]: true
		}));
	}, []);
	const close = useCallback((modal) => setState((current) => ({
		...current,
		[modal]: false
	})), []);
	const toggle = useCallback((modal) => setState((current) => ({
		...current,
		[modal]: !current[modal]
	})), []);
	return {
		state,
		open,
		close,
		closeAll: useCallback(() => setState(initialState), []),
		toggle,
		register: useCallback((modal) => ({
			opened: state[modal],
			onClose: () => close(modal),
			stackId: modal
		}), [state])
	};
}
const useDrawersStack = useModalsStack;
//#endregion
export { useDrawersStack, useModalsStack };

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