import React, { useContext, useState } from "react";
export const C3SidebarStateContext = React.createContext(null);
export const C3SidebarStateProvider = ({ children, ...value }) => {
    const [isNotificationSidebarOpen, setIsNotificationSidebarOpen] = useState(value.isNotificationSidebarOpen || false);
    const [isOrgSidebarOpen, setIsOrgSidebarOpen] = useState(value.isOrgSidebarOpen || false);
    const [isInfoSidebarOpen, setIsInfoSidebarOpen] = useState(value.isInfoSidebarOpen || false);
    const [isUserSidebarOpen, setIsUserSidebarOpen] = useState(value.isUserSidebarOpen || false);
    return (React.createElement(C3SidebarStateContext.Provider, { value: {
            notifications: {
                isOpen: isNotificationSidebarOpen,
                setIsOpen: setIsNotificationSidebarOpen,
            },
            org: { isOpen: isOrgSidebarOpen, setIsOpen: setIsOrgSidebarOpen },
            info: { isOpen: isInfoSidebarOpen, setIsOpen: setIsInfoSidebarOpen },
            user: { isOpen: isUserSidebarOpen, setIsOpen: setIsUserSidebarOpen },
        } }, children));
};
export const useSidebarState = () => {
    const value = useContext(C3SidebarStateContext);
    if (!value)
        throw new Error("No C3SidebarStateContextProvider found.");
    return value;
};
export const useNotificationSidebarState = () => useSidebarState().notifications;
export const useOrgSidebarState = () => useSidebarState().org;
export const useInfoSidebarState = () => useSidebarState().info;
export const useUserSidebarState = () => useSidebarState().user;
