"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MainThreadTheme = void 0;
const tslib_1 = require("tslib");
const di_1 = require("@opensumi/di");
const ide_connection_1 = require("@opensumi/ide-connection");
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
const ide_theme_1 = require("@opensumi/ide-theme");
const sumi_1 = require("../../common/sumi");
let MainThreadTheme = class MainThreadTheme extends ide_core_browser_1.Disposable {
    constructor(rpcProtocol, injector) {
        super();
        this.rpcProtocol = rpcProtocol;
        this.injector = injector;
        this._proxy = this.rpcProtocol.getProxy(sumi_1.ExtHostSumiAPIIdentifier.ExtHostTheme);
        this.addDispose(this.themeService.onThemeChange(() => {
            this._proxy.$notifyThemeChanged();
        }));
    }
    async $getThemeColors() {
        const currentTheme = this.themeService.getCurrentThemeSync();
        const exportedColors = (0, ide_theme_1.getColorRegistry)()
            .getColors()
            .reduce((colors, entry) => {
            const color = currentTheme.getColor(entry.id);
            if (color) {
                colors[entry.id.replace('.', '-')] = color.toString();
            }
            return colors;
        }, {});
        return exportedColors;
    }
};
exports.MainThreadTheme = MainThreadTheme;
tslib_1.__decorate([
    (0, di_1.Autowired)(ide_theme_1.IThemeService),
    tslib_1.__metadata("design:type", Object)
], MainThreadTheme.prototype, "themeService", void 0);
exports.MainThreadTheme = MainThreadTheme = tslib_1.__decorate([
    (0, di_1.Injectable)({ multiple: true }),
    tslib_1.__metadata("design:paramtypes", [Object, di_1.Injector])
], MainThreadTheme);
//# sourceMappingURL=main.thread.theme.js.map