"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 (b.hasOwnProperty(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);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var __values = (this && this.__values) || function(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArduinoToolbarContribution = exports.ArduinoToolbarContainer = void 0;
var browser_1 = require("@theia/core/lib/browser");
var inversify_1 = require("inversify");
var arduino_toolbar_1 = require("./arduino-toolbar");
var tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
var core_1 = require("@theia/core");
var label_parser_1 = require("@theia/core/lib/browser/label-parser");
var ArduinoToolbarContainer = /** @class */ (function (_super) {
    __extends(ArduinoToolbarContainer, _super);
    function ArduinoToolbarContainer() {
        var toolbars = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            toolbars[_i] = arguments[_i];
        }
        var _this = _super.call(this) || this;
        _this.id = 'arduino-toolbar-container';
        _this.toolbars = toolbars;
        return _this;
    }
    ArduinoToolbarContainer.prototype.onAfterAttach = function (msg) {
        var e_1, _a;
        try {
            for (var _b = __values(this.toolbars), _c = _b.next(); !_c.done; _c = _b.next()) {
                var toolbar_1 = _c.value;
                browser_1.Widget.attach(toolbar_1, this.node);
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    return ArduinoToolbarContainer;
}(browser_1.Widget));
exports.ArduinoToolbarContainer = ArduinoToolbarContainer;
var ArduinoToolbarContribution = /** @class */ (function () {
    function ArduinoToolbarContribution(tabBarToolBarRegistry, commandRegistry, labelParser) {
        this.tabBarToolBarRegistry = tabBarToolBarRegistry;
        this.commandRegistry = commandRegistry;
        this.labelParser = labelParser;
        var leftToolbarWidget = new arduino_toolbar_1.ArduinoToolbar(tabBarToolBarRegistry, commandRegistry, labelParser, 'left');
        var rightToolbarWidget = new arduino_toolbar_1.ArduinoToolbar(tabBarToolBarRegistry, commandRegistry, labelParser, 'right');
        this.arduinoToolbarContainer = new ArduinoToolbarContainer(leftToolbarWidget, rightToolbarWidget);
    }
    ArduinoToolbarContribution.prototype.onStart = function (app) {
        app.shell.addWidget(this.arduinoToolbarContainer, {
            area: 'top'
        });
    };
    ArduinoToolbarContribution = __decorate([
        inversify_1.injectable(),
        __param(0, inversify_1.inject(tab_bar_toolbar_1.TabBarToolbarRegistry)),
        __param(1, inversify_1.inject(core_1.CommandRegistry)),
        __param(2, inversify_1.inject(label_parser_1.LabelParser)),
        __metadata("design:paramtypes", [tab_bar_toolbar_1.TabBarToolbarRegistry,
            core_1.CommandRegistry,
            label_parser_1.LabelParser])
    ], ArduinoToolbarContribution);
    return ArduinoToolbarContribution;
}());
exports.ArduinoToolbarContribution = ArduinoToolbarContribution;
//# sourceMappingURL=arduino-toolbar-contribution.js.map