import { __classPrivateFieldGet, __classPrivateFieldSet, __esDecorate, __runInitializers, __setFunctionName } from "tslib";
import * as React from 'react';
import { ComboBoxStore, inject } from '@journeyapps-labs/reactor-mod';
import { observer } from 'mobx-react';
import { MonacoThemeStore } from '../stores/MonacoThemeStore';
import { EditorThemePreferencesWidget } from './EditorThemePreferencesWidget';
let SmartEditorThemePreferencesWidget = (() => {
    var _SmartEditorThemePreferencesWidget_comboBoxStore_accessor_storage, _SmartEditorThemePreferencesWidget_monacoThemeStore_accessor_storage;
    let _classDecorators = [observer];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = React.Component;
    let _comboBoxStore_decorators;
    let _comboBoxStore_initializers = [];
    let _comboBoxStore_extraInitializers = [];
    let _monacoThemeStore_decorators;
    let _monacoThemeStore_initializers = [];
    let _monacoThemeStore_extraInitializers = [];
    var SmartEditorThemePreferencesWidget = _classThis = class extends _classSuper {
        get comboBoxStore() { return __classPrivateFieldGet(this, _SmartEditorThemePreferencesWidget_comboBoxStore_accessor_storage, "f"); }
        set comboBoxStore(value) { __classPrivateFieldSet(this, _SmartEditorThemePreferencesWidget_comboBoxStore_accessor_storage, value, "f"); }
        get monacoThemeStore() { return __classPrivateFieldGet(this, _SmartEditorThemePreferencesWidget_monacoThemeStore_accessor_storage, "f"); }
        set monacoThemeStore(value) { __classPrivateFieldSet(this, _SmartEditorThemePreferencesWidget_monacoThemeStore_accessor_storage, value, "f"); }
        render() {
            const currentTheme = this.monacoThemeStore.selectedTheme.entity;
            return (React.createElement(EditorThemePreferencesWidget, { theme: currentTheme, key: currentTheme.key, save: (theme) => {
                    if (theme.system) {
                        const cloned = this.monacoThemeStore.clone();
                        this.monacoThemeStore.patchTheme(Object.assign(Object.assign({}, cloned), { theme: theme.theme }));
                    }
                    else {
                        this.monacoThemeStore.patchTheme(theme);
                    }
                } }));
        }
        constructor() {
            super(...arguments);
            _SmartEditorThemePreferencesWidget_comboBoxStore_accessor_storage.set(this, __runInitializers(this, _comboBoxStore_initializers, void 0));
            _SmartEditorThemePreferencesWidget_monacoThemeStore_accessor_storage.set(this, (__runInitializers(this, _comboBoxStore_extraInitializers), __runInitializers(this, _monacoThemeStore_initializers, void 0)));
            __runInitializers(this, _monacoThemeStore_extraInitializers);
        }
    };
    _SmartEditorThemePreferencesWidget_comboBoxStore_accessor_storage = new WeakMap();
    _SmartEditorThemePreferencesWidget_monacoThemeStore_accessor_storage = new WeakMap();
    __setFunctionName(_classThis, "SmartEditorThemePreferencesWidget");
    (() => {
        var _a;
        const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
        _comboBoxStore_decorators = [inject(ComboBoxStore)];
        _monacoThemeStore_decorators = [inject(MonacoThemeStore)];
        __esDecorate(_classThis, null, _comboBoxStore_decorators, { kind: "accessor", name: "comboBoxStore", static: false, private: false, access: { has: obj => "comboBoxStore" in obj, get: obj => obj.comboBoxStore, set: (obj, value) => { obj.comboBoxStore = value; } }, metadata: _metadata }, _comboBoxStore_initializers, _comboBoxStore_extraInitializers);
        __esDecorate(_classThis, null, _monacoThemeStore_decorators, { kind: "accessor", name: "monacoThemeStore", static: false, private: false, access: { has: obj => "monacoThemeStore" in obj, get: obj => obj.monacoThemeStore, set: (obj, value) => { obj.monacoThemeStore = value; } }, metadata: _metadata }, _monacoThemeStore_initializers, _monacoThemeStore_extraInitializers);
        __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
        SmartEditorThemePreferencesWidget = _classThis = _classDescriptor.value;
        if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        __runInitializers(_classThis, _classExtraInitializers);
    })();
    return SmartEditorThemePreferencesWidget = _classThis;
})();
export { SmartEditorThemePreferencesWidget };
//# sourceMappingURL=SmartEditorThemePreferencesWidget.js.map