import { SharedProvider } from '@rcp/use.shared';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/lib/locale/zh_CN';
import React from 'react';
import { DndProvider } from 'react-dnd';
import getWindow from 'get-window';
import { getSharedFromMain } from '../utils/get-from-main';
const { _sharedMap, _sharedUpdateMap, ddManager } = getSharedFromMain();
export function Provider({ children, dom }) {
    React.useLayoutEffect(() => {
        const bk = ddManager.getBackend();
        const win = getWindow(dom);
        bk.addEventListeners(win);
        return () => {
            bk.removeEventListeners(win);
        };
    }, [ddManager]);
    return (React.createElement(SharedProvider, { _internal: { valuesMap: _sharedMap, updateMap: _sharedUpdateMap } },
        React.createElement(ConfigProvider, { locale: zhCN, prefixCls: 'mmt-ant' },
            React.createElement(DndProvider, { manager: ddManager }, children))));
}
//# sourceMappingURL=provider.js.map