import { inject, reactive, readonly, ref } from "vue";
//#region src/hooks/useSidebar.ts
/** Creates the sidebar state so that it can be unique across instances of the client */
var createSidebarState = ({ layout }) => {
	return {
		collapsedSidebarFolders: reactive({}),
		isSidebarOpen: ref(layout !== "modal")
	};
};
var SIDEBAR_SYMBOL = Symbol();
/** Handles any logic related to sidebar */
var useSidebar = () => {
	const sidebarState = inject(SIDEBAR_SYMBOL);
	if (!sidebarState) throw new Error("useSidebar must have injected SIDEBAR_SYMBOL");
	const { collapsedSidebarFolders, isSidebarOpen } = sidebarState;
	/** Open or close a sidebar folder directly */
	const setCollapsedSidebarFolder = (uid, value) => collapsedSidebarFolders[uid] = value;
	/** Toggle a sidebar folder open/closed */
	const toggleSidebarFolder = (key) => collapsedSidebarFolders[key] = !collapsedSidebarFolders[key];
	/** Set the sidebar open/closed */
	const setSidebarOpen = (value) => isSidebarOpen.value = value;
	/** Toggle the sidebar open/closed */
	const toggleSidebarOpen = () => isSidebarOpen.value = !isSidebarOpen.value;
	return {
		collapsedSidebarFolders: readonly(collapsedSidebarFolders),
		isSidebarOpen: readonly(isSidebarOpen),
		setCollapsedSidebarFolder,
		toggleSidebarFolder,
		setSidebarOpen,
		toggleSidebarOpen
	};
};
//#endregion
export { SIDEBAR_SYMBOL, createSidebarState, useSidebar };

//# sourceMappingURL=useSidebar.js.map