import { __decorate, __metadata } from "tslib";
import { AppConfig, BrowserFS, FileSystemContribution, getExtensionPath, RuntimeConfig, SCM_ROOT, } from '@codeblitzjs/ide-sumi-core';
import { Autowired, Injectable } from '@opensumi/di';
import { BrowserModule, ClientAppContribution, CommandContribution, CommandService, Disposable, Domain, IContextKeyService, KeybindingContribution, KeybindingRegistryImpl, MonacoService, PreferenceProvider, PreferenceScope, QUICK_OPEN_COMMANDS, ServiceNames, URI, } from '@opensumi/ide-core-browser';
import { LayoutViewSizeConfig } from '@opensumi/ide-core-browser/lib/layout/constants';
import { RawContextKey } from '@opensumi/ide-core-browser/lib/raw-context-key';
import { GeneralSettingsId, uuid } from '@opensumi/ide-core-common';
import { BrowserEditorContribution, EditorCollectionService, EditorPreferences, WorkbenchEditorService, } from '@opensumi/ide-editor/lib/browser';
import { BreadCrumbServiceImpl } from '@opensumi/ide-editor/lib/browser/breadcrumb';
import { IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser/doc-model/types';
import { EditorHistoryService } from '@opensumi/ide-editor/lib/browser/history';
import { IBreadCrumbService } from '@opensumi/ide-editor/lib/browser/types';
import { FileSchemeDocumentProvider } from '@opensumi/ide-file-scheme/lib/browser/file-doc';
import * as monaco from '@opensumi/ide-monaco';
import { ICSSStyleService, IThemeService } from '@opensumi/ide-theme';
import { FindController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/find/browser/findController';
import { ContextKeyDefinedExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
import * as monacoKeybindings from '@opensumi/monaco-editor-core/esm/vs/platform/keybinding/common/keybindingsRegistry';
import debounce from 'lodash.debounce';
import { monacoBrowser } from '@opensumi/ide-monaco/lib/browser';
import { SCMService } from '@opensumi/ide-scm';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import md5 from 'md5';
import * as path from 'path';
import { CodeBlitzCommandContribution } from '../commands';
import { IDETheme } from '../extension/metadata';
import { IPropsService } from '../props.service';
import styles from '../style.module.less';
import { isCodeDocumentModel } from './types';
const ContextTrue = new RawContextKey('alex.context.true', undefined);
const ContextFalse = new RawContextKey('alex.context.false', undefined);
let BreadCrumbServiceImplOverride = class BreadCrumbServiceImplOverride extends BreadCrumbServiceImpl {
    getBreadCrumbs() {
        return undefined;
    }
};
BreadCrumbServiceImplOverride = __decorate([
    Injectable()
], BreadCrumbServiceImplOverride);
let FileSchemeDocumentProviderOverride = class FileSchemeDocumentProviderOverride extends FileSchemeDocumentProvider {
    provideEncoding(uri) {
        const encoding = this.propsService.props.documentModel.encoding;
        if (uri.scheme === 'file' && encoding) {
            return encoding;
        }
        return super.provideEncoding(uri);
    }
};
__decorate([
    Autowired(IPropsService),
    __metadata("design:type", Object)
], FileSchemeDocumentProviderOverride.prototype, "propsService", void 0);
FileSchemeDocumentProviderOverride = __decorate([
    Injectable()
], FileSchemeDocumentProviderOverride);
/**
 * editor 下无需 workspace 偏好，否则会导致请求报错
 * TODO：或许应该支持配置项来直接禁用
 */
let WorkspacePreferenceProvider = class WorkspacePreferenceProvider extends PreferenceProvider {
    constructor() {
        super();
        this._ready.resolve();
    }
    getPreferences() {
        return undefined;
    }
    getLanguagePreferences() {
        return undefined;
    }
    doSetPreference() {
        return Promise.resolve(false);
    }
};
WorkspacePreferenceProvider = __decorate([
    Injectable(),
    __metadata("design:paramtypes", [])
], WorkspacePreferenceProvider);
let FoldersPreferenceProvider = class FoldersPreferenceProvider extends PreferenceProvider {
    constructor() {
        super();
        this._ready.resolve();
    }
    getPreferences() {
        return undefined;
    }
    getLanguagePreferences() {
        return undefined;
    }
    doSetPreference() {
        return Promise.resolve(false);
    }
};
FoldersPreferenceProvider = __decorate([
    Injectable(),
    __metadata("design:paramtypes", [])
], FoldersPreferenceProvider);
let ThemeContribution = class ThemeContribution extends Disposable {
    async initialize() {
        this.themeService.registerThemes(IDETheme.packageJSON.contributes.themes, URI.parse(getExtensionPath(IDETheme.extension, 'public')));
        // 强制用集成设置的默认主题
        await this.themeService.applyTheme(this.defaultPreferenceProvider.get(GeneralSettingsId.Theme));
    }
};
__decorate([
    Autowired(IThemeService),
    __metadata("design:type", Object)
], ThemeContribution.prototype, "themeService", void 0);
__decorate([
    Autowired(PreferenceProvider, { tag: PreferenceScope.Default }),
    __metadata("design:type", PreferenceProvider)
], ThemeContribution.prototype, "defaultPreferenceProvider", void 0);
ThemeContribution = __decorate([
    Domain(ClientAppContribution)
], ThemeContribution);
/**
 * 获取 history 跳转时机，由外部控制
 */
let EditorHistoryServiceOverride = class EditorHistoryServiceOverride extends EditorHistoryService {
    restoreState(state) {
        var _a, _b;
        if (!state)
            return;
        const { uri, position: { lineNumber }, } = state;
        const documentModel = this.propsService.props.documentModel;
        if (uri.scheme !== 'file') {
            (_a = documentModel.onFilepathChange) === null || _a === void 0 ? void 0 : _a.call(documentModel, '');
            return super.restoreState(state);
        }
        const onLineNumberChange = () => {
            var _a;
            (_a = documentModel.onLineNumberChange) === null || _a === void 0 ? void 0 : _a.call(documentModel, lineNumber || 1);
        };
        if ('filepath' in documentModel) {
            let rootPath = '';
            if (isCodeDocumentModel(documentModel)) {
                rootPath = path.join(this.appConfig.workspaceDir, encodeURIComponent(documentModel.ref));
            }
            else {
                rootPath = this.appConfig.workspaceDir;
            }
            const relativePath = path.relative(rootPath, uri.path.toString());
            if (relativePath !== documentModel.filepath) {
                (_b = documentModel.onFilepathChange) === null || _b === void 0 ? void 0 : _b.call(documentModel, relativePath);
                setTimeout(() => {
                    onLineNumberChange();
                });
            }
            else {
                onLineNumberChange();
            }
        }
        else {
            const res = super.restoreState(state);
            // controlled
            onLineNumberChange();
            return res;
        }
    }
};
__decorate([
    Autowired(AppConfig),
    __metadata("design:type", Object)
], EditorHistoryServiceOverride.prototype, "appConfig", void 0);
__decorate([
    Autowired(IPropsService),
    __metadata("design:type", Object)
], EditorHistoryServiceOverride.prototype, "propsService", void 0);
EditorHistoryServiceOverride = __decorate([
    Injectable()
], EditorHistoryServiceOverride);
let EditorSpecialContribution = class EditorSpecialContribution extends Disposable {
    async mountFileSystem(rootFS) {
        var _a;
        // TODO: 提供配置选择存储在内存中还是 indexedDB 中
        const { createFileSystem, FileSystem: { Editor, OverlayFS, FolderAdapter, InMemory }, } = BrowserFS;
        const [editorSystem, memSystem] = await Promise.all([
            createFileSystem(Editor, {
                readFile: (filepath) => {
                    const slashIndex = filepath.indexOf('/');
                    return this.propsService.props.documentModel.readFile(filepath.slice(slashIndex + 1));
                },
                disableCache: (_a = this.propsService.props.editorConfig) === null || _a === void 0 ? void 0 : _a.disableCache,
            }),
            createFileSystem(InMemory, {}),
        ]);
        const folderSystem = await createFileSystem(FolderAdapter, {
            wrapped: memSystem,
            folder: `/${md5(this.appConfig.workspaceDir)}`,
        });
        const overlayFileSystem = await createFileSystem(OverlayFS, {
            readable: editorSystem,
            writable: folderSystem,
        });
        rootFS.mount(this.appConfig.workspaceDir, overlayFileSystem);
        rootFS.mount(SCM_ROOT, editorSystem);
        this.addDispose({
            dispose: () => {
                rootFS.umount(this.appConfig.workspaceDir);
                rootFS.umount(SCM_ROOT);
            },
        });
    }
    initialize() {
        // 恒为 true/false 的 contextKey
        ContextTrue.bind(this.globalContextKeyService);
        ContextFalse.bind(this.globalContextKeyService);
        // 提供写时 diff 视图
        // TODO: 暂时只有读，先去掉，避免编码改变导致的问题
        // this.scmService.registerSCMProvider({
        //   id: 'editor0',
        //   label: 'editor',
        //   contextValue: 'editor',
        //   getOriginalResource: (uri: Uri) => {
        //     return Promise.resolve(
        //       uri.with({ path: `${SCM_ROOT}${uri.path.slice(this.appConfig.workspaceDir.length)}` })
        //     );
        //   },
        //   groups: new Sequence(),
        //   onDidChangeResources: new Emitter<void>().event,
        //   onDidChange: new Emitter<void>().event,
        //   toJSON: () => ({}),
        //   dispose: () => {},
        // });
        // onStart阶段存在时序问题
        this.addDispose(this.editorCollection.onCodeEditorCreate((codeEditor) => {
            const disposer = this.contributeEditor(codeEditor);
            codeEditor.onDispose(() => {
                disposer.dispose();
            });
        }));
    }
    onDidRestoreState() {
        const documentModel = this.propsService.props.documentModel;
        if (isCodeDocumentModel(documentModel)) {
            this.openEditorForCode(documentModel.ref, documentModel.filepath);
            // 监听 props 变化
            this.addDispose(this.propsService.onPropsChange(({ props, prevProps }) => {
                const newModel = props.documentModel;
                const oldModel = prevProps.documentModel;
                if (newModel.filepath !== oldModel.filepath || newModel.ref !== oldModel.ref) {
                    this.openEditorForCode(newModel.ref, newModel.filepath);
                }
            }));
        }
        else {
            this.openEditorForFs(documentModel.filepath);
            // 监听 props 变化
            this.addDispose(this.propsService.onPropsChange((e) => {
                if (e.affect('documentModel', 'filepath')) {
                    this.openEditorForFs(e.props.documentModel.filepath);
                }
            }));
        }
        this.addDispose(this.propsService.onPropsChange((e) => {
            if (e.affect('documentModel', 'encoding')) {
                const encoding = e.props.documentModel.encoding;
                if (encoding) {
                    const resource = this.editorService.currentResource;
                    if (resource) {
                        this.editorDocumentModelService.changeModelOptions(resource.uri, {
                            encoding,
                        });
                    }
                }
            }
        }));
    }
    openEditorForFs(relativePath) {
        if (!relativePath)
            return;
        const uri = URI.file(path.join(this.appConfig.workspaceDir, relativePath));
        this.editorService.open(uri, {
            preview: true,
            replace: true,
            // 禁用 file tree 跳转
            disableNavigate: true,
        });
    }
    openEditorForCode(ref, filepath) {
        if (!ref || !filepath)
            return;
        return this.openEditorForFs(`${encodeURIComponent(ref)}/${filepath}`);
    }
    registerCommands(registry) {
        registry.registerCommand({ id: 'alex.codeServiceProject' }, {
            execute: () => {
                const documentModel = this.propsService.props.documentModel;
                if (!isCodeDocumentModel(documentModel))
                    return;
                return {
                    platform: 'github',
                    project: `${documentModel.owner}/${documentModel.name}`,
                    commit: documentModel.ref,
                    rootUri: URI.file(this.appConfig.workspaceDir).resolve(encodeURIComponent(documentModel.ref)).codeUri,
                };
            },
        });
        // 注销命令
        registry.unregisterCommand(QUICK_OPEN_COMMANDS.OPEN.id);
        registry.registerCommand(QUICK_OPEN_COMMANDS.OPEN);
    }
    /**
     * 只 contribute code editor，diff editor 暂不需要
     */
    contributeEditor(editor) {
        var _a, _b;
        // scrollbar 不支持偏好设置
        editor.monacoEditor.updateOptions({
            scrollbar: Object.assign({ alwaysConsumeMouseWheel: false }, (_a = this.propsService.props.editorConfig) === null || _a === void 0 ? void 0 : _a.scrollbar),
        });
        const disposer = new Disposable();
        let oldHoverDecorations = [];
        disposer.addDispose(editor.monacoEditor.onMouseMove(debounce((event) => {
            var _a;
            if (this.runtimeConfig.disableHighlightLine) {
                return;
            }
            const type = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.type;
            if (type === monacoBrowser.editor.MouseTargetType.GUTTER_LINE_NUMBERS
                || type === monacoBrowser.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
                const lineNumber = event.target.position.lineNumber;
                oldHoverDecorations = editor.monacoEditor.deltaDecorations(oldHoverDecorations, [
                    {
                        range: new monaco.Range(lineNumber, 1, lineNumber, 1),
                        options: {
                            description: 'line-content-description',
                            className: styles['line-content'],
                            glyphMarginClassName: styles['line-glyph-margin'],
                        },
                    },
                ]);
            }
            else {
                oldHoverDecorations = editor.monacoEditor.deltaDecorations(oldHoverDecorations, []);
            }
        }, 10)));
        let oldClickDecorations = [];
        const highlightLine = (lineNumber) => {
            if (this.runtimeConfig.disableHighlightLine) {
                return;
            }
            let centerLine;
            let newDecorations;
            if (Array.isArray(lineNumber) && Array.isArray(lineNumber[0])) {
                centerLine = lineNumber[0][0];
                newDecorations = lineNumber.map((line) => {
                    return {
                        range: new monaco.Range(line[0], 1, line[1], 1),
                        options: {
                            description: 'line-anchor-description',
                            isWholeLine: true,
                            linesDecorationsClassName: styles['line-anchor'],
                            className: styles['line-content'],
                        },
                    };
                });
            }
            else {
                const startLineNumber = typeof lineNumber === 'number' ? lineNumber : lineNumber[0];
                const endLineNumber = typeof lineNumber === 'number' ? lineNumber : lineNumber[1];
                centerLine = startLineNumber;
                newDecorations = [
                    {
                        range: new monaco.Range(startLineNumber, 1, endLineNumber, 1),
                        options: {
                            // @ts-ignore
                            description: 'line-anchor-description',
                            isWholeLine: true,
                            linesDecorationsClassName: styles['line-anchor'],
                            className: styles['line-content'],
                        },
                    },
                ];
            }
            // 延迟高亮，否则不居中
            oldClickDecorations = editor.monacoEditor.deltaDecorations(oldClickDecorations, newDecorations);
            setTimeout(() => {
                var _a;
                if ((_a = this.propsService.props.editorConfig) === null || _a === void 0 ? void 0 : _a.stretchHeight) {
                    const firstLine = document.querySelector(`.${styles['line-anchor']}`);
                    if (firstLine) {
                        firstLine.scrollIntoView({ block: 'center' });
                    }
                }
                else {
                    editor.monacoEditor.revealLineInCenterIfOutsideViewport(centerLine);
                }
            }, 0);
        };
        disposer.addDispose(editor.monacoEditor.onMouseDown((event) => {
            var _a, _b, _c, _d;
            const type = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.type;
            if (type === monacoBrowser.editor.MouseTargetType.GUTTER_LINE_NUMBERS
                || type === monacoBrowser.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
                const lineNumber = event.target.position.lineNumber;
                const lastLineNumber = this.propsService.props.documentModel.lineNumber;
                let nextLineNumber = lineNumber;
                if (((_b = event === null || event === void 0 ? void 0 : event.event) === null || _b === void 0 ? void 0 : _b.shiftKey) && lastLineNumber) {
                    let startLineNumber = Array.isArray(lastLineNumber)
                        ? Array.isArray(lastLineNumber[0])
                            ? lastLineNumber[0][0]
                            : lastLineNumber[0]
                        : lastLineNumber;
                    if (startLineNumber > nextLineNumber) {
                        nextLineNumber = [nextLineNumber, startLineNumber];
                    }
                    else if (startLineNumber < nextLineNumber) {
                        nextLineNumber = [startLineNumber, nextLineNumber];
                    }
                }
                // 非受控
                if (!('lineNumber' in this.propsService.props.documentModel)) {
                    highlightLine(nextLineNumber);
                }
                (_d = (_c = this.propsService.props.documentModel).onLineNumberChange) === null || _d === void 0 ? void 0 : _d.call(_c, nextLineNumber);
            }
        }));
        disposer.addDispose(editor.monacoEditor.onDidChangeModel(() => {
            const initialLineNumber = this.propsService.props.documentModel.lineNumber;
            if (initialLineNumber) {
                highlightLine(initialLineNumber);
            }
        }));
        disposer.addDispose(this.propsService.onPropsChange((e) => {
            if (e.affect('documentModel', 'lineNumber')) {
                const newLineNumber = e.props.documentModel.lineNumber;
                if (newLineNumber) {
                    highlightLine(newLineNumber);
                }
            }
        }));
        if ((_b = this.propsService.props.editorConfig) === null || _b === void 0 ? void 0 : _b.stretchHeight) {
            const { monacoEditor } = editor;
            const updateRootHeight = () => {
                const contentHeight = monacoEditor.getContentHeight() + 1;
                const tabHeight = this.runtimeConfig.hideEditorTab
                    ? 0
                    : this.layoutViewSize.editorTabsHeight;
                const root = document.querySelector('.codeblitz-root');
                root.style.height = `${contentHeight + tabHeight}px`;
                monacoEditor.layout();
            };
            disposer.addDispose(monacoEditor.onDidContentSizeChange(updateRootHeight));
            updateRootHeight();
        }
        this.adjustFindWidgetPosition(editor, disposer);
        return disposer;
    }
    adjustFindWidgetPosition(editor, disposer) {
        var _a;
        const adjustFindWidgetTop = (_a = this.propsService.props.editorConfig) === null || _a === void 0 ? void 0 : _a.adjustFindWidgetTop;
        if (typeof adjustFindWidgetTop === 'undefined') {
            return;
        }
        const findController = editor.monacoEditor.getContribution(FindController.ID);
        const findState = findController.getState();
        let styleDisposer = null;
        disposer.addDispose(findState.onFindReplaceStateChange((e) => {
            if (!e.isRevealed)
                return;
            try {
                if (findState.isRevealed) {
                    const widget = findController._widget;
                    const dom = widget.getDomNode();
                    const { top } = dom.parentElement.getBoundingClientRect();
                    const offsetTop = typeof adjustFindWidgetTop === 'number' ? top - adjustFindWidgetTop : top;
                    const className = `find-widget-top-${uuid()}`;
                    dom.classList.add(className);
                    if (offsetTop < 0) {
                        styleDisposer = this.cssStyleService.addClass(className, {
                            top: `${-offsetTop}px !important;`,
                        });
                    }
                }
                else {
                    styleDisposer === null || styleDisposer === void 0 ? void 0 : styleDisposer.dispose();
                }
            }
            catch (err) {
                console.error(err);
            }
        }));
    }
    registerKeybindings(keybindings) {
        var _a, _b;
        // editor 下默认注销的快捷键
        const keybindingList = [
            'ctrlcmd+,',
            'ctrlcmd+shift+p',
            'ctrlcmd+p',
            'F1',
            'alt+n',
            'alt+shift+t',
            'alt+shift+w',
            'ctrlcmd+\\',
        ];
        for (let i = 1; i < 10; i++) {
            keybindingList.push(`ctrlcmd+${i}`);
        }
        // 搜索快捷键
        if ((_a = this.propsService.props.editorConfig) === null || _a === void 0 ? void 0 : _a.disableEditorSearch) {
            keybindingList.push('ctrlcmd+f');
        }
        // 自定义注销的快捷键
        if (this.runtimeConfig.unregisterKeybindings) {
            keybindingList.push(...this.runtimeConfig.unregisterKeybindings);
        }
        keybindingList.forEach((binding) => {
            keybindings.unregisterKeybinding(binding);
        });
        // 通过设置 when 为 false 来禁用快捷键
        if ((_b = this.propsService.props.editorConfig) === null || _b === void 0 ? void 0 : _b.disableEditorSearch) {
            const findCommand = monacoKeybindings.KeybindingsRegistry.getDefaultKeybindings().find((item) => item.command === 'actions.find');
            if (findCommand) {
                findCommand.when = ContextKeyDefinedExpr.create('alex.context.false');
            }
        }
        else {
            // 设置为 passthrough，则忽略快捷键的处理，从而使事件冒泡，触发浏览器默认行为
            this.addDispose(keybindings.registerKeybinding({
                command: KeybindingRegistryImpl.PASSTHROUGH_PSEUDO_COMMAND,
                keybinding: 'ctrlcmd+f',
                when: '!editorFocus',
            }));
        }
    }
    onMonacoLoaded(monacoService) {
        const codeEditorService = monacoService.getOverride(ServiceNames.CODE_EDITOR_SERVICE);
        const _openCodeEditor = codeEditorService.openCodeEditor;
        codeEditorService.openCodeEditor = (input, source, sideBySide) => {
            return this.openCodeEditor(() => _openCodeEditor.call(codeEditorService, input, source, sideBySide), input, source, sideBySide);
        };
    }
    /**
     * 获取内部跳转的时机
     */
    async openCodeEditor(raw, input, source, sideBySide) {
        var _a, _b;
        // 非 file 协议路径设置为空，以触发 props 变化
        const documentModel = this.propsService.props.documentModel;
        if (input.resource.scheme !== 'file') {
            (_a = documentModel.onFilepathChange) === null || _a === void 0 ? void 0 : _a.call(documentModel, '');
            return raw();
        }
        const onLineNumberChange = () => {
            var _a, _b, _c;
            if ((_a = input.options) === null || _a === void 0 ? void 0 : _a.selection) {
                (_b = documentModel.onLineNumberChange) === null || _b === void 0 ? void 0 : _b.call(documentModel, ((_c = input.options) === null || _c === void 0 ? void 0 : _c.selection.startLineNumber) || 1);
            }
        };
        if ('filepath' in documentModel) {
            let rootPath = '';
            if (isCodeDocumentModel(documentModel)) {
                rootPath = path.join(this.appConfig.workspaceDir, encodeURIComponent(documentModel.ref));
            }
            else {
                rootPath = this.appConfig.workspaceDir;
            }
            const relativePath = path.relative(rootPath, input.resource.path);
            if (relativePath !== documentModel.filepath) {
                (_b = documentModel.onFilepathChange) === null || _b === void 0 ? void 0 : _b.call(documentModel, relativePath);
                setTimeout(() => {
                    onLineNumberChange();
                });
            }
            else {
                onLineNumberChange();
            }
        }
        else {
            const res = await raw();
            // controlled
            onLineNumberChange();
            return res;
        }
    }
};
__decorate([
    Autowired(WorkbenchEditorService),
    __metadata("design:type", WorkbenchEditorService)
], EditorSpecialContribution.prototype, "editorService", void 0);
__decorate([
    Autowired(AppConfig),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "appConfig", void 0);
__decorate([
    Autowired(CommandService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "commandService", void 0);
__decorate([
    Autowired(EditorPreferences),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "editorPreferences", void 0);
__decorate([
    Autowired(IEditorDocumentModelService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "editorDocumentModelService", void 0);
__decorate([
    Autowired(IWorkspaceService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "workspaceService", void 0);
__decorate([
    Autowired(SCMService),
    __metadata("design:type", SCMService)
], EditorSpecialContribution.prototype, "scmService", void 0);
__decorate([
    Autowired(),
    __metadata("design:type", MonacoService)
], EditorSpecialContribution.prototype, "monacoService", void 0);
__decorate([
    Autowired(RuntimeConfig),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "runtimeConfig", void 0);
__decorate([
    Autowired(EditorCollectionService),
    __metadata("design:type", EditorCollectionService)
], EditorSpecialContribution.prototype, "editorCollection", void 0);
__decorate([
    Autowired(IPropsService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "propsService", void 0);
__decorate([
    Autowired(ICSSStyleService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "cssStyleService", void 0);
__decorate([
    Autowired(LayoutViewSizeConfig),
    __metadata("design:type", LayoutViewSizeConfig)
], EditorSpecialContribution.prototype, "layoutViewSize", void 0);
__decorate([
    Autowired(IContextKeyService),
    __metadata("design:type", Object)
], EditorSpecialContribution.prototype, "globalContextKeyService", void 0);
EditorSpecialContribution = __decorate([
    Domain(FileSystemContribution, BrowserEditorContribution, ClientAppContribution, CommandContribution, KeybindingContribution)
], EditorSpecialContribution);
let EditorSpecialModule = class EditorSpecialModule extends BrowserModule {
    constructor() {
        super(...arguments);
        this.providers = [
            {
                token: IBreadCrumbService,
                useClass: BreadCrumbServiceImplOverride,
                override: true,
            },
            {
                token: FileSchemeDocumentProvider,
                useClass: FileSchemeDocumentProviderOverride,
                override: true,
            },
            {
                token: PreferenceProvider,
                useClass: WorkspacePreferenceProvider,
                tag: PreferenceScope.Workspace,
                override: true,
            },
            {
                token: PreferenceProvider,
                useClass: FoldersPreferenceProvider,
                tag: PreferenceScope.Folder,
                override: true,
            },
            {
                token: EditorHistoryService,
                useClass: EditorHistoryServiceOverride,
                override: true,
            },
            ThemeContribution,
            EditorSpecialContribution,
            CodeBlitzCommandContribution,
        ];
    }
};
EditorSpecialModule = __decorate([
    Injectable()
], EditorSpecialModule);
export { EditorSpecialModule };
//# sourceMappingURL=editor.module.js.map