"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractBulkEditEventData = extractBulkEditEventData;
exports.stringifyBulkEditEventData = stringifyBulkEditEventData;
exports.watchGraphBulkEditEvent = watchGraphBulkEditEvent;
const AsyncG_1 = require("../../types/interface/async/AsyncG");
function extractBulkEditEventData(...[actions, path]) {
    return {
        actions,
        path,
    };
}
function stringifyBulkEditEventData({ path, actions, }) {
    actions = (0, AsyncG_1.stringifyBulkEditActions)(actions);
    return {
        actions,
        path,
    };
}
function watchGraphBulkEditEvent(event, graph, callback) {
    const listener = (...args) => {
        const data = stringifyBulkEditEventData(extractBulkEditEventData(...args));
        callback({
            type: 'graph',
            event,
            data,
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
//# sourceMappingURL=watchGraphBulkEditEvent.js.map