"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const Async_1 = require("../../../../../types/interface/async/Async");
const clone_1 = require("../../../../../util/clone");
const System_1 = require("../../../../../wrap/System");
const _ids_1 = require("../../../../_ids");
class Boot extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['init'],
            fo: ['system'],
            i: [],
            o: [],
        }, {
            output: {
                system: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_BOOT);
    }
    f({ init }, done) {
        const { path } = init;
        const _system = this.__system.boot({
            path,
            specs: (0, clone_1.clone)(this.__system.specs),
            classes: this.__system.classes,
            components: this.__system.components,
        });
        this._system = _system;
        const system = (0, System_1.wrapSystem)(_system, this.__system);
        const $system = (0, Async_1.Async)(system, ['S'], this.__system.async);
        done({
            system: $system,
        });
    }
    d() {
        if (this._system) {
            this._system.destroy();
            this._system = undefined;
        }
    }
}
exports.default = Boot;
//# sourceMappingURL=index.js.map