'use client';
import React, { createContext, useContext } from 'react';
const Context = /*#__PURE__*/ createContext({
    collapsed: false,
    isVisible: true,
    toggle: ()=>{},
    withinCollapsible: true
});
export const CollapsibleProvider = ({ children, collapsed, toggle, withinCollapsible = true })=>{
    const { collapsed: parentIsCollapsed, isVisible } = useCollapsible();
    const contextValue = React.useMemo(()=>{
        return {
            collapsed: Boolean(collapsed),
            isVisible: isVisible && !parentIsCollapsed,
            toggle,
            withinCollapsible
        };
    }, [
        collapsed,
        withinCollapsible,
        toggle,
        parentIsCollapsed,
        isVisible
    ]);
    return /*#__PURE__*/ React.createElement(Context.Provider, {
        value: contextValue
    }, children);
};
export const useCollapsible = ()=>useContext(Context);

//# sourceMappingURL=provider.js.map