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