"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientConsoleViewContribution = exports.ClientConsole = exports.CLIENT_CONSOLE_WIDGET_ICON = exports.CLIENT_CONSOLE_WIDGET_ID = void 0;
var inversify_1 = require("inversify");
var base_console_1 = require("./base-console");
var browser_1 = require("@theia/core/lib/browser");
var fxdk_data_service_1 = require("fxdk-services/lib/browser/fxdk-data-service");
exports.CLIENT_CONSOLE_WIDGET_ID = 'fxdk-client-console';
exports.CLIENT_CONSOLE_WIDGET_ICON = 'fa fa-terminal';
var ClientConsole = /** @class */ (function (_super) {
    __extends(ClientConsole, _super);
    function ClientConsole() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ClientConsole.prototype.setup = function () {
        var _this = this;
        this.id = exports.CLIENT_CONSOLE_WIDGET_ID;
        this.title.caption = 'Client console';
        this.title.label = 'Client console';
        this.title.iconClass = 'fa fa-terminal';
        this.title.closable = true;
        this.toDispose.push(this.dataService.onStructuredGameMessageReceived(function (message) { return _this.receiveStructuredMessage(message); }));
        this.toDispose.push(this.dataService.onClearGameOutput(function () { return _this.clear(); }));
    };
    ClientConsole.prototype.initilizeConsole = function () {
        var _this = this;
        this.dataService.getStructuredGameMessage().forEach(function (message) { return _this.receiveStructuredMessage(message); });
    };
    ClientConsole.prototype.handleCommand = function (command) {
        window.invokeNative('sendCommand', command);
    };
    __decorate([
        inversify_1.inject(fxdk_data_service_1.FxdkDataService),
        __metadata("design:type", fxdk_data_service_1.FxdkDataService)
    ], ClientConsole.prototype, "dataService", void 0);
    ClientConsole = __decorate([
        inversify_1.injectable()
    ], ClientConsole);
    return ClientConsole;
}(base_console_1.BaseConsole));
exports.ClientConsole = ClientConsole;
var ClientConsoleViewContribution = /** @class */ (function (_super) {
    __extends(ClientConsoleViewContribution, _super);
    function ClientConsoleViewContribution() {
        return _super.call(this, {
            widgetId: exports.CLIENT_CONSOLE_WIDGET_ID,
            widgetName: 'Client console',
            toggleCommandId: ClientConsoleViewContribution_1.TOGGLE_COMMAND_ID,
            defaultWidgetOptions: {
                area: 'bottom',
            }
        }) || this;
    }
    ClientConsoleViewContribution_1 = ClientConsoleViewContribution;
    var ClientConsoleViewContribution_1;
    ClientConsoleViewContribution.TOGGLE_COMMAND_ID = 'Z_fxdkClientConsole:toggle';
    ClientConsoleViewContribution = ClientConsoleViewContribution_1 = __decorate([
        inversify_1.injectable(),
        __metadata("design:paramtypes", [])
    ], ClientConsoleViewContribution);
    return ClientConsoleViewContribution;
}(browser_1.AbstractViewContribution));
exports.ClientConsoleViewContribution = ClientConsoleViewContribution;
//# sourceMappingURL=client-console.js.map