"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Holder_1 = require("../../../../../Class/Holder");
const _ids_1 = require("../../../../_ids");
const Listen_1 = require("../Listen");
class Intercept extends Holder_1.Holder {
    constructor(system) {
        super({
            fi: ['system', 'opt'],
            fo: [],
            i: [],
            o: ['url'],
        }, {
            input: {
                system: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_INTERCEPT, 'stop');
    }
    async f({ system, opt }, done) {
        const handler = (0, Listen_1.makeHandler)(this.__system, (url) => {
            this._output.url.push(url);
        });
        this._unlisten = system.intercept(opt, handler);
    }
    d() {
        if (this._unlisten) {
            this._unlisten();
            this._unlisten = undefined;
        }
    }
}
exports.default = Intercept;
//# sourceMappingURL=index.js.map