"use client";
import { useCallback, useState } from "react";
//#region packages/@mantine/hooks/src/use-disclosure/use-disclosure.ts
function useDisclosure(initialState = false, options = {}) {
	const [opened, setOpened] = useState(initialState);
	const open = useCallback(() => {
		setOpened((isOpened) => {
			if (!isOpened) {
				options.onOpen?.();
				return true;
			}
			return isOpened;
		});
	}, [options.onOpen]);
	const close = useCallback(() => {
		setOpened((isOpened) => {
			if (isOpened) {
				options.onClose?.();
				return false;
			}
			return isOpened;
		});
	}, [options.onClose]);
	return [opened, {
		open,
		close,
		toggle: useCallback(() => {
			opened ? close() : open();
		}, [
			close,
			open,
			opened
		]),
		set: setOpened
	}];
}
//#endregion
export { useDisclosure };

//# sourceMappingURL=use-disclosure.mjs.map