"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThemesContributionPoint = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_core_common_1 = require("@opensumi/ide-core-common");
const ide_theme_1 = require("@opensumi/ide-theme");
const common_1 = require("../../../common");
const types_1 = require("../../types");
let ThemesContributionPoint = class ThemesContributionPoint extends common_1.VSCodeContributePoint {
    contribute() {
        for (const contrib of this.contributesMap) {
            const { extensionId, contributes } = contrib;
            const themes = contributes.map((t) => ({
                ...t,
                label: this.getLocalizeFromNlsJSON(t.label, extensionId),
                extensionId,
            }));
            const extension = this.extensionManageService.getExtensionInstanceByExtId(extensionId);
            if (extension) {
                this.themeService.registerThemes(themes, ide_core_common_1.URI.from(extension.uri));
            }
        }
    }
};
exports.ThemesContributionPoint = ThemesContributionPoint;
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_theme_1.IThemeService),
    tslib_1.__metadata("design:type", Object)
], ThemesContributionPoint.prototype, "themeService", void 0);
tslib_1.__decorate([
    (0, di_1.Autowired)(types_1.AbstractExtInstanceManagementService),
    tslib_1.__metadata("design:type", types_1.AbstractExtInstanceManagementService)
], ThemesContributionPoint.prototype, "extensionManageService", void 0);
exports.ThemesContributionPoint = ThemesContributionPoint = tslib_1.__decorate([
    (0, di_1.Injectable)(),
    (0, common_1.Contributes)('themes'),
    (0, common_1.LifeCycle)(2 /* LifeCyclePhase.Initialize */)
], ThemesContributionPoint);
//# sourceMappingURL=theme.js.map