import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import React, { useEffect, useContext, } from 'react';
import { ROOT_SCOPE } from '../../../consts/scopes';
import { HotkeysContext } from './hotkeys-provider';
export const HotkeysScopeContext = React.createContext(ROOT_SCOPE);
export const HotkeysScopeProvider = ({ name = ROOT_SCOPE, children, }) => {
    const { setActiveScope } = useContext(HotkeysContext);
    useEffect(() => {
        setActiveScope(name);
        return () => {
            setActiveScope(ROOT_SCOPE);
        };
    }, [name]);
    return (_jsx(HotkeysScopeContext.Provider, { value: name, children: children }));
};
