import { errorHandler, createConfiguredEditor, createModelReference as createModelReference$1 } from 'vscode/monaco';
import { initialize, editorOpenHandlerRegistry } from './services.js';
import '@codingame/monaco-vscode-theme-defaults-default-extension';
import '@codingame/monaco-vscode-clojure-default-extension';
import '@codingame/monaco-vscode-coffeescript-default-extension';
import '@codingame/monaco-vscode-cpp-default-extension';
import '@codingame/monaco-vscode-csharp-default-extension';
import '@codingame/monaco-vscode-css-default-extension';
import '@codingame/monaco-vscode-diff-default-extension';
import '@codingame/monaco-vscode-fsharp-default-extension';
import '@codingame/monaco-vscode-go-default-extension';
import '@codingame/monaco-vscode-groovy-default-extension';
import '@codingame/monaco-vscode-html-default-extension';
import '@codingame/monaco-vscode-java-default-extension';
import '@codingame/monaco-vscode-javascript-default-extension';
import '@codingame/monaco-vscode-json-default-extension';
import '@codingame/monaco-vscode-julia-default-extension';
import '@codingame/monaco-vscode-lua-default-extension';
import '@codingame/monaco-vscode-markdown-basics-default-extension';
import '@codingame/monaco-vscode-objective-c-default-extension';
import '@codingame/monaco-vscode-perl-default-extension';
import '@codingame/monaco-vscode-php-default-extension';
import '@codingame/monaco-vscode-powershell-default-extension';
import '@codingame/monaco-vscode-python-default-extension';
import '@codingame/monaco-vscode-r-default-extension';
import '@codingame/monaco-vscode-ruby-default-extension';
import '@codingame/monaco-vscode-rust-default-extension';
import '@codingame/monaco-vscode-scss-default-extension';
import '@codingame/monaco-vscode-shellscript-default-extension';
import '@codingame/monaco-vscode-sql-default-extension';
import '@codingame/monaco-vscode-swift-default-extension';
import '@codingame/monaco-vscode-typescript-basics-default-extension';
import '@codingame/monaco-vscode-vb-default-extension';
import '@codingame/monaco-vscode-xml-default-extension';
import '@codingame/monaco-vscode-yaml-default-extension';
import '@codingame/monaco-vscode-configuration-editing-default-extension';
import '@codingame/monaco-vscode-npm-default-extension';
import './extensions/Angular.ng-template-17.1.0.vsix.js';
import './extensions/Dart-Code.dart-code-3.81.20240117.vsix.js';
import './extensions/IMCTradingBV.svlangserver-0.4.1.vsix.js';
import './extensions/JakeBecker.elixir-ls-0.19.0.vsix.js';
import './extensions/JuanBlanco.solidity-0.0.165.vsix.js';
import './extensions/REditorSupport.r-2.8.2.vsix.js';
import './extensions/alefragnani.pascal-9.6.0.vsix.js';
import './extensions/batisteo.vscode-django-1.15.0.vsix.js';
import './extensions/bitwisecook.tcl-0.4.3.vsix.js';
import './extensions/broadcomMFD.cobol-language-support-2.1.0.vsix.js';
import './extensions/castwide.solargraph-0.24.1.vsix.js';
import './extensions/ckolkman.vscode-postgres-1.4.3.vsix.js';
import './extensions/golang.Go-0.40.3.vsix.js';
import './extensions/johnsoncodehk.vscode-angular-1.0.22.vsix.js';
import './extensions/justusadam.language-haskell-3.6.0.vsix.js';
import './extensions/mathiasfrohlich.Kotlin-1.7.1.vsix.js';
import './extensions/ms-dotnettools.csharp-2.16.24.vsix.js';
import './extensions/ms-python.python-2023.25.10221012.vsix.js';
import './extensions/ms-vscode.cpptools-1.19.2.vsix.js';
import './extensions/ocamllabs.ocaml-platform-1.16.1.vsix.js';
import './extensions/pgourlain.erlang-0.9.8.vsix.js';
import './extensions/redhat.java-1.27.2024012608.vsix.js';
import './extensions/scala-lang.scala-0.5.7.vsix.js';
import './extensions/scalameta.metals-1.27.3.vsix.js';
import './extensions/sumneko.lua-3.7.4.vsix.js';
import './extensions/svelte.svelte-vscode-108.2.1.vsix.js';
import './extensions/webfreak.code-d-0.23.2.vsix.js';
import './languages/index.js';
import './theme/index.js';
import './worker.js';
import setup from './editor/index.js';

errorHandler.setUnexpectedErrorHandler(error => {
    console.warn('Unexpected error', error);
});
let initialized = false;
const initializePromise = initialize().then(() => { initialized = true; });
function createEditor(domElement, options) {
    if (!initialized) {
        throw new Error('Monaco not initialized');
    }
    const editor = createConfiguredEditor(domElement, options);
    setup(editor);
    return editor;
}
async function createModelReference(resource, content) {
    await initializePromise;
    return createModelReference$1(resource, content);
}
function registerEditorOpenHandler(handler) {
    return editorOpenHandlerRegistry.registerEditorOpenHandler(handler);
}

export { createEditor, createModelReference, initializePromise, registerEditorOpenHandler };
