import { useCallback, useState } from 'react';
export var useDndMonitorProvider = function () {
    var listeners = useState(function () { return new Set(); })[0];
    var registerListener = useCallback(function (listener) {
        listeners.add(listener);
        return function () { return listeners.delete(listener); };
    }, [listeners]);
    var dispatch = useCallback(function (_a) {
        var type = _a.type, event = _a.event;
        listeners.forEach(function (listener) { var _a; return (_a = listener[type]) === null || _a === void 0 ? void 0 : _a.call(listener, event); });
    }, [listeners]);
    return [dispatch, registerListener];
};
