import { errorHandler, createConfiguredEditor, createModelReference as createModelReference$1 } from 'vscode/monaco';
import { isInitialized, initializePromise, editorOpenHandlerRegistry } from './services.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);
});
function createEditor(domElement, options) {
    if (!isInitialized()) {
        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, registerEditorOpenHandler };
