"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const globalUrl_1 = require("../../../../../spec/globalUrl");
const _ids_1 = require("../../../../_ids");
class Detach extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['component', 'host', 'opt'],
            fo: [],
        }, {
            input: {
                component: {
                    ref: true,
                },
                host: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_DETACH);
    }
    f({ component, host, opt }, done) {
        this._component = component;
        const hostUrl = (0, globalUrl_1.globalUrl)(host.__global_id);
        component.emit('call', { method: 'detach', data: [hostUrl, opt] });
    }
    d() {
        if (this._component) {
            this._component.emit('call', {
                method: 'attach',
                data: [this._i.opt],
            });
            this._component = undefined;
        }
    }
}
exports.default = Detach;
//# sourceMappingURL=index.js.map