"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractUnplugPinEventData = extractUnplugPinEventData;
exports.stringifyUnplugPinEventData = stringifyUnplugPinEventData;
exports.watchGraphUnplugPinEvent = watchGraphUnplugPinEvent;
function extractUnplugPinEventData(...[type, pinId, subPinId, subPinSpec, path]) {
    return {
        type,
        pinId,
        subPinId,
        subPinSpec,
        path,
    };
}
function stringifyUnplugPinEventData(data) {
    return data;
}
function watchGraphUnplugPinEvent(event, graph, callback) {
    const listener = (...args) => {
        const data = stringifyUnplugPinEventData(extractUnplugPinEventData(...args));
        callback({
            type: 'graph',
            event,
            data,
        });
    };
    graph.prependListener(event, listener);
    return () => {
        graph.removeListener(event, listener);
    };
}
//# sourceMappingURL=watchGraphUnplugPinEvent.js.map