"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const start_1 = require("../../../../../start");
const _ids_1 = require("../../../../_ids");
class New extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['graph'],
            fo: ['graph'],
            i: [],
        }, {
            output: {
                graph: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_NEW_0);
    }
    f({ graph: graphClass }, done) {
        // console.log('New', 'f', bundle)
        const { unit, specs = {} } = graphClass.__bundle;
        this.__system.injectSpecs(specs);
        const spec = this.__system.getSpec(unit.id);
        const graph = (0, start_1.start)(this.__system, { spec, specs });
        this._graph = graph;
        done({ graph });
    }
    d() {
        if (this._graph) {
            this._graph.destroy();
            this._graph = undefined;
        }
    }
}
exports.default = New;
//# sourceMappingURL=index.js.map