import "../../common/languages/languageConfigurationRegistry.mjs";
import "./standaloneCodeEditorService.mjs";
import "./standaloneLayoutService.mjs";
import "../../../platform/undoRedo/common/undoRedoService.mjs";
import "../../common/services/languageFeatureDebounce.mjs";
import { format } from "../../../base/common/strings.mjs";
import { addDisposableListener, EventType } from "../../../base/browser/dom.mjs";
import { StandardKeyboardEvent } from "../../../base/browser/keyboardEvent.mjs";
import { Emitter } from "../../../base/common/event.mjs";
import { createKeybinding, SimpleKeybinding } from "../../../base/common/keybindings.mjs";
import { ImmortalReference, DisposableStore, toDisposable, Disposable } from "../../../base/common/lifecycle.mjs";
import { OS, isLinux, isMacintosh } from "../../../base/common/platform.mjs";
import Severity from "../../../base/common/severity.mjs";
import { URI } from "../../../base/common/uri.mjs";
import { ResourceTextEdit, IBulkEditService } from "../../browser/services/bulkEditService.mjs";
import { isEditorConfigurationKey, isDiffEditorConfigurationKey } from "../../common/config/editorConfigurationSchema.mjs";
import { EditOperation } from "../../common/core/editOperation.mjs";
import { Position } from "../../common/core/position.mjs";
import { Range } from "../../common/core/range.mjs";
import { IModelService } from "../../common/services/model.mjs";
import { ITextModelService } from "../../common/services/resolverService.mjs";
import { ITextResourceConfigurationService, ITextResourcePropertiesService } from "../../common/services/textResourceConfiguration.mjs";
import { ICommandService, CommandsRegistry } from "../../../platform/commands/common/commands.mjs";
import { IConfigurationService } from "../../../platform/configuration/common/configuration.mjs";
import { Configuration, DefaultConfigurationModel, ConfigurationModel, ConfigurationChangeEvent } from "../../../platform/configuration/common/configurationModels.mjs";
import { IContextKeyService } from "../../../platform/contextkey/common/contextkey.mjs";
import { IDialogService } from "../../../platform/dialogs/common/dialogs.mjs";
import { IInstantiationService, createDecorator } from "../../../platform/instantiation/common/instantiation.mjs";
import { AbstractKeybindingService } from "../../../platform/keybinding/common/abstractKeybindingService.mjs";
import { IKeybindingService } from "../../../platform/keybinding/common/keybinding.mjs";
import { KeybindingResolver } from "../../../platform/keybinding/common/keybindingResolver.mjs";
import { KeybindingsRegistry } from "../../../platform/keybinding/common/keybindingsRegistry.mjs";
import { ResolvedKeybindingItem } from "../../../platform/keybinding/common/resolvedKeybindingItem.mjs";
import { USLayoutResolvedKeybinding } from "../../../platform/keybinding/common/usLayoutResolvedKeybinding.mjs";
import { ILabelService } from "../../../platform/label/common/label.mjs";
import { INotificationService, NoOpNotification } from "../../../platform/notification/common/notification.mjs";
import { IEditorProgressService } from "../../../platform/progress/common/progress.mjs";
import { ITelemetryService } from "../../../platform/telemetry/common/telemetry.mjs";
import { IWorkspaceContextService, WorkspaceFolder } from "../../../platform/workspace/common/workspace.mjs";
import { ILayoutService } from "../../../platform/layout/browser/layoutService.mjs";
import { StandaloneServicesNLS } from "../../common/standaloneStrings.mjs";
import { ICodeEditorService } from "../../browser/services/codeEditorService.mjs";
import { ILogService, LogService, ConsoleLogger } from "../../../platform/log/common/log.mjs";
import { IWorkspaceTrustManagementService } from "../../../platform/workspace/common/workspaceTrust.mjs";
import { IContextViewService, IContextMenuService } from "../../../platform/contextview/browser/contextView.mjs";
import { ContextViewService } from "../../../platform/contextview/browser/contextViewService.mjs";
import { LanguageService } from "../../common/services/languageService.mjs";
import { ContextMenuService } from "../../../platform/contextview/browser/contextMenuService.mjs";
import { IThemeService } from "../../../platform/theme/common/themeService.mjs";
import { getSingletonServiceDescriptors, registerSingleton } from "../../../platform/instantiation/common/extensions.mjs";
import { OpenerService } from "../../browser/services/openerService.mjs";
import { IEditorWorkerService } from "../../common/services/editorWorker.mjs";
import { EditorWorkerService } from "../../browser/services/editorWorkerService.mjs";
import { ILanguageService } from "../../common/languages/language.mjs";
import { MarkerDecorationsService } from "../../common/services/markerDecorationsService.mjs";
import { IMarkerDecorationsService } from "../../common/services/markerDecorations.mjs";
import { ModelService } from "../../common/services/modelService.mjs";
import { StandaloneQuickInputService } from "./quickInput/standaloneQuickInputService.mjs";
import { StandaloneThemeService } from "./standaloneThemeService.mjs";
import { IStandaloneThemeService } from "../common/standaloneTheme.mjs";
import { AccessibilityService } from "../../../platform/accessibility/browser/accessibilityService.mjs";
import { IAccessibilityService } from "../../../platform/accessibility/common/accessibility.mjs";
import { IMenuService } from "../../../platform/actions/common/actions.mjs";
import { MenuService } from "../../../platform/actions/common/menuService.mjs";
import { BrowserClipboardService } from "../../../platform/clipboard/browser/clipboardService.mjs";
import { IClipboardService } from "../../../platform/clipboard/common/clipboardService.mjs";
import { ContextKeyService } from "../../../platform/contextkey/browser/contextKeyService.mjs";
import { SyncDescriptor } from "../../../platform/instantiation/common/descriptors.mjs";
import { InstantiationService } from "../../../platform/instantiation/common/instantiationService.mjs";
import { ServiceCollection } from "../../../platform/instantiation/common/serviceCollection.mjs";
import { ListService, IListService } from "../../../platform/list/browser/listService.mjs";
import { IMarkerService } from "../../../platform/markers/common/markers.mjs";
import { MarkerService } from "../../../platform/markers/common/markerService.mjs";
import { IOpenerService } from "../../../platform/opener/common/opener.mjs";
import { IQuickInputService } from "../../../platform/quickinput/common/quickInput.mjs";
import { InMemoryStorageService, IStorageService } from "../../../platform/storage/common/storage.mjs";
import "../../common/services/languageFeaturesService.mjs";
var __decorate = globalThis && globalThis.__decorate || function(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = globalThis && globalThis.__param || function(paramIndex, decorator) {
  return function(target, key) {
    decorator(target, key, paramIndex);
  };
};
var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function(resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
};
class SimpleModel {
  constructor(model) {
    this.disposed = false;
    this.model = model;
    this._onWillDispose = new Emitter();
  }
  get textEditorModel() {
    return this.model;
  }
  dispose() {
    this.disposed = true;
    this._onWillDispose.fire();
  }
}
let StandaloneTextModelService = class StandaloneTextModelService2 {
  constructor(modelService) {
    this.modelService = modelService;
  }
  createModelReference(resource) {
    const model = this.modelService.getModel(resource);
    if (!model) {
      return Promise.reject(new Error(`Model not found`));
    }
    return Promise.resolve(new ImmortalReference(new SimpleModel(model)));
  }
};
StandaloneTextModelService = __decorate([
  __param(0, IModelService)
], StandaloneTextModelService);
class StandaloneEditorProgressService {
  show() {
    return StandaloneEditorProgressService.NULL_PROGRESS_RUNNER;
  }
  showWhile(promise, delay) {
    return __awaiter(this, void 0, void 0, function* () {
      yield promise;
    });
  }
}
StandaloneEditorProgressService.NULL_PROGRESS_RUNNER = {
  done: () => {
  },
  total: () => {
  },
  worked: () => {
  }
};
class StandaloneDialogService {
  confirm(confirmation) {
    return this.doConfirm(confirmation).then((confirmed) => {
      return {
        confirmed,
        checkboxChecked: false
        // unsupported
      };
    });
  }
  doConfirm(confirmation) {
    let messageText = confirmation.message;
    if (confirmation.detail) {
      messageText = messageText + "\n\n" + confirmation.detail;
    }
    return Promise.resolve(window.confirm(messageText));
  }
  show(severity, message, buttons, options) {
    return Promise.resolve({ choice: 0 });
  }
}
class StandaloneNotificationService {
  info(message) {
    return this.notify({ severity: Severity.Info, message });
  }
  warn(message) {
    return this.notify({ severity: Severity.Warning, message });
  }
  error(error) {
    return this.notify({ severity: Severity.Error, message: error });
  }
  notify(notification) {
    switch (notification.severity) {
      case Severity.Error:
        console.error(notification.message);
        break;
      case Severity.Warning:
        console.warn(notification.message);
        break;
      default:
        console.log(notification.message);
        break;
    }
    return StandaloneNotificationService.NO_OP;
  }
  status(message, options) {
    return Disposable.None;
  }
}
StandaloneNotificationService.NO_OP = new NoOpNotification();
let StandaloneCommandService = class StandaloneCommandService2 {
  constructor(instantiationService) {
    this._onWillExecuteCommand = new Emitter();
    this._onDidExecuteCommand = new Emitter();
    this.onWillExecuteCommand = this._onWillExecuteCommand.event;
    this.onDidExecuteCommand = this._onDidExecuteCommand.event;
    this._instantiationService = instantiationService;
  }
  executeCommand(id, ...args) {
    const command = CommandsRegistry.getCommand(id);
    if (!command) {
      return Promise.reject(new Error(`command '${id}' not found`));
    }
    try {
      this._onWillExecuteCommand.fire({ commandId: id, args });
      const result = this._instantiationService.invokeFunction.apply(this._instantiationService, [command.handler, ...args]);
      this._onDidExecuteCommand.fire({ commandId: id, args });
      return Promise.resolve(result);
    } catch (err) {
      return Promise.reject(err);
    }
  }
};
StandaloneCommandService = __decorate([
  __param(0, IInstantiationService)
], StandaloneCommandService);
let StandaloneKeybindingService = class StandaloneKeybindingService2 extends AbstractKeybindingService {
  constructor(contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService) {
    super(contextKeyService, commandService, telemetryService, notificationService, logService);
    this._cachedResolver = null;
    this._dynamicKeybindings = [];
    this._domNodeListeners = [];
    const addContainer = (domNode) => {
      const disposables = new DisposableStore();
      disposables.add(addDisposableListener(domNode, EventType.KEY_DOWN, (e) => {
        const keyEvent = new StandardKeyboardEvent(e);
        const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
        if (shouldPreventDefault) {
          keyEvent.preventDefault();
          keyEvent.stopPropagation();
        }
      }));
      disposables.add(addDisposableListener(domNode, EventType.KEY_UP, (e) => {
        const keyEvent = new StandardKeyboardEvent(e);
        const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
        if (shouldPreventDefault) {
          keyEvent.preventDefault();
        }
      }));
      this._domNodeListeners.push(new DomNodeListeners(domNode, disposables));
    };
    const removeContainer = (domNode) => {
      for (let i = 0; i < this._domNodeListeners.length; i++) {
        const domNodeListeners = this._domNodeListeners[i];
        if (domNodeListeners.domNode === domNode) {
          this._domNodeListeners.splice(i, 1);
          domNodeListeners.dispose();
        }
      }
    };
    const addCodeEditor = (codeEditor) => {
      if (codeEditor.getOption(
        54
        /* inDiffEditor */
      )) {
        return;
      }
      addContainer(codeEditor.getContainerDomNode());
    };
    const removeCodeEditor = (codeEditor) => {
      if (codeEditor.getOption(
        54
        /* inDiffEditor */
      )) {
        return;
      }
      removeContainer(codeEditor.getContainerDomNode());
    };
    this._register(codeEditorService.onCodeEditorAdd(addCodeEditor));
    this._register(codeEditorService.onCodeEditorRemove(removeCodeEditor));
    codeEditorService.listCodeEditors().forEach(addCodeEditor);
    const addDiffEditor = (diffEditor) => {
      addContainer(diffEditor.getContainerDomNode());
    };
    const removeDiffEditor = (diffEditor) => {
      removeContainer(diffEditor.getContainerDomNode());
    };
    this._register(codeEditorService.onDiffEditorAdd(addDiffEditor));
    this._register(codeEditorService.onDiffEditorRemove(removeDiffEditor));
    codeEditorService.listDiffEditors().forEach(addDiffEditor);
  }
  addDynamicKeybinding(commandId, _keybinding, handler, when) {
    const keybinding = createKeybinding(_keybinding, OS);
    const toDispose = new DisposableStore();
    if (keybinding) {
      this._dynamicKeybindings.push({
        keybinding: keybinding.parts,
        command: commandId,
        when,
        weight1: 1e3,
        weight2: 0,
        extensionId: null,
        isBuiltinExtension: false
      });
      toDispose.add(toDisposable(() => {
        for (let i = 0; i < this._dynamicKeybindings.length; i++) {
          const kb = this._dynamicKeybindings[i];
          if (kb.command === commandId) {
            this._dynamicKeybindings.splice(i, 1);
            this.updateResolver({
              source: 1
              /* Default */
            });
            return;
          }
        }
      }));
    }
    toDispose.add(CommandsRegistry.registerCommand(commandId, handler));
    this.updateResolver({
      source: 1
      /* Default */
    });
    return toDispose;
  }
  updateResolver(event) {
    this._cachedResolver = null;
    this._onDidUpdateKeybindings.fire(event);
  }
  _getResolver() {
    if (!this._cachedResolver) {
      const defaults = this._toNormalizedKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
      const overrides = this._toNormalizedKeybindingItems(this._dynamicKeybindings, false);
      this._cachedResolver = new KeybindingResolver(defaults, overrides, (str) => this._log(str));
    }
    return this._cachedResolver;
  }
  _documentHasFocus() {
    return document.hasFocus();
  }
  _toNormalizedKeybindingItems(items, isDefault) {
    const result = [];
    let resultLen = 0;
    for (const item of items) {
      const when = item.when || void 0;
      const keybinding = item.keybinding;
      if (!keybinding) {
        result[resultLen++] = new ResolvedKeybindingItem(void 0, item.command, item.commandArgs, when, isDefault, null, false);
      } else {
        const resolvedKeybindings = USLayoutResolvedKeybinding.resolveUserBinding(keybinding, OS);
        for (const resolvedKeybinding of resolvedKeybindings) {
          result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault, null, false);
        }
      }
    }
    return result;
  }
  resolveKeyboardEvent(keyboardEvent) {
    const keybinding = new SimpleKeybinding(keyboardEvent.ctrlKey, keyboardEvent.shiftKey, keyboardEvent.altKey, keyboardEvent.metaKey, keyboardEvent.keyCode).toChord();
    return new USLayoutResolvedKeybinding(keybinding, OS);
  }
};
StandaloneKeybindingService = __decorate([
  __param(0, IContextKeyService),
  __param(1, ICommandService),
  __param(2, ITelemetryService),
  __param(3, INotificationService),
  __param(4, ILogService),
  __param(5, ICodeEditorService)
], StandaloneKeybindingService);
class DomNodeListeners extends Disposable {
  constructor(domNode, disposables) {
    super();
    this.domNode = domNode;
    this._register(disposables);
  }
}
function isConfigurationOverrides(thing) {
  return thing && typeof thing === "object" && (!thing.overrideIdentifier || typeof thing.overrideIdentifier === "string") && (!thing.resource || thing.resource instanceof URI);
}
class StandaloneConfigurationService {
  constructor() {
    this._onDidChangeConfiguration = new Emitter();
    this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
    this._configuration = new Configuration(new DefaultConfigurationModel(), new ConfigurationModel());
  }
  getValue(arg1, arg2) {
    const section = typeof arg1 === "string" ? arg1 : void 0;
    const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
    return this._configuration.getValue(section, overrides, void 0);
  }
  updateValues(values) {
    const previous = { data: this._configuration.toData() };
    const changedKeys = [];
    for (const entry of values) {
      const [key, value] = entry;
      if (this.getValue(key) === value) {
        continue;
      }
      this._configuration.updateValue(key, value);
      changedKeys.push(key);
    }
    if (changedKeys.length > 0) {
      const configurationChangeEvent = new ConfigurationChangeEvent({ keys: changedKeys, overrides: [] }, previous, this._configuration);
      configurationChangeEvent.source = 7;
      configurationChangeEvent.sourceConfig = null;
      this._onDidChangeConfiguration.fire(configurationChangeEvent);
    }
    return Promise.resolve();
  }
  updateValue(key, value, arg3, arg4) {
    return this.updateValues([[key, value]]);
  }
  inspect(key, options = {}) {
    return this._configuration.inspect(key, options, void 0);
  }
}
let StandaloneResourceConfigurationService = class StandaloneResourceConfigurationService2 {
  constructor(configurationService) {
    this.configurationService = configurationService;
    this._onDidChangeConfiguration = new Emitter();
    this.configurationService.onDidChangeConfiguration((e) => {
      this._onDidChangeConfiguration.fire({ affectedKeys: e.affectedKeys, affectsConfiguration: (resource, configuration) => e.affectsConfiguration(configuration) });
    });
  }
  getValue(resource, arg2, arg3) {
    const position = Position.isIPosition(arg2) ? arg2 : null;
    const section = position ? typeof arg3 === "string" ? arg3 : void 0 : typeof arg2 === "string" ? arg2 : void 0;
    if (typeof section === "undefined") {
      return this.configurationService.getValue();
    }
    return this.configurationService.getValue(section);
  }
};
StandaloneResourceConfigurationService = __decorate([
  __param(0, IConfigurationService)
], StandaloneResourceConfigurationService);
let StandaloneResourcePropertiesService = class StandaloneResourcePropertiesService2 {
  constructor(configurationService) {
    this.configurationService = configurationService;
  }
  getEOL(resource, language) {
    const eol = this.configurationService.getValue("files.eol", { overrideIdentifier: language, resource });
    if (eol && typeof eol === "string" && eol !== "auto") {
      return eol;
    }
    return isLinux || isMacintosh ? "\n" : "\r\n";
  }
};
StandaloneResourcePropertiesService = __decorate([
  __param(0, IConfigurationService)
], StandaloneResourcePropertiesService);
class StandaloneTelemetryService {
  publicLog(eventName, data) {
    return Promise.resolve(void 0);
  }
  publicLog2(eventName, data) {
    return this.publicLog(eventName, data);
  }
}
class StandaloneWorkspaceContextService {
  constructor() {
    const resource = URI.from({ scheme: StandaloneWorkspaceContextService.SCHEME, authority: "model", path: "/" });
    this.workspace = { id: "4064f6ec-cb38-4ad0-af64-ee6467e63c82", folders: [new WorkspaceFolder({ uri: resource, name: "", index: 0 })] };
  }
  getWorkspace() {
    return this.workspace;
  }
}
StandaloneWorkspaceContextService.SCHEME = "inmemory";
function updateConfigurationService(configurationService, source, isDiffEditor) {
  if (!source) {
    return;
  }
  if (!(configurationService instanceof StandaloneConfigurationService)) {
    return;
  }
  const toUpdate = [];
  Object.keys(source).forEach((key) => {
    if (isEditorConfigurationKey(key)) {
      toUpdate.push([`editor.${key}`, source[key]]);
    }
    if (isDiffEditor && isDiffEditorConfigurationKey(key)) {
      toUpdate.push([`diffEditor.${key}`, source[key]]);
    }
  });
  if (toUpdate.length > 0) {
    configurationService.updateValues(toUpdate);
  }
}
let StandaloneBulkEditService = class StandaloneBulkEditService2 {
  constructor(_modelService) {
    this._modelService = _modelService;
  }
  hasPreviewHandler() {
    return false;
  }
  apply(edits, _options) {
    return __awaiter(this, void 0, void 0, function* () {
      const textEdits = /* @__PURE__ */ new Map();
      for (let edit of edits) {
        if (!(edit instanceof ResourceTextEdit)) {
          throw new Error("bad edit - only text edits are supported");
        }
        const model = this._modelService.getModel(edit.resource);
        if (!model) {
          throw new Error("bad edit - model not found");
        }
        if (typeof edit.versionId === "number" && model.getVersionId() !== edit.versionId) {
          throw new Error("bad state - model changed in the meantime");
        }
        let array = textEdits.get(model);
        if (!array) {
          array = [];
          textEdits.set(model, array);
        }
        array.push(EditOperation.replaceMove(Range.lift(edit.textEdit.range), edit.textEdit.text));
      }
      let totalEdits = 0;
      let totalFiles = 0;
      for (const [model, edits2] of textEdits) {
        model.pushStackElement();
        model.pushEditOperations([], edits2, () => []);
        model.pushStackElement();
        totalFiles += 1;
        totalEdits += edits2.length;
      }
      return {
        ariaSummary: format(StandaloneServicesNLS.bulkEditServiceSummary, totalEdits, totalFiles)
      };
    });
  }
};
StandaloneBulkEditService = __decorate([
  __param(0, IModelService)
], StandaloneBulkEditService);
class StandaloneUriLabelService {
  getUriLabel(resource, options) {
    if (resource.scheme === "file") {
      return resource.fsPath;
    }
    return resource.path;
  }
}
let StandaloneContextViewService = class StandaloneContextViewService2 extends ContextViewService {
  constructor(layoutService, _codeEditorService) {
    super(layoutService);
    this._codeEditorService = _codeEditorService;
  }
  showContextView(delegate, container, shadowRoot) {
    if (!container) {
      const codeEditor = this._codeEditorService.getFocusedCodeEditor() || this._codeEditorService.getActiveCodeEditor();
      if (codeEditor) {
        container = codeEditor.getContainerDomNode();
      }
    }
    return super.showContextView(delegate, container, shadowRoot);
  }
};
StandaloneContextViewService = __decorate([
  __param(0, ILayoutService),
  __param(1, ICodeEditorService)
], StandaloneContextViewService);
class StandaloneWorkspaceTrustManagementService {
  constructor() {
    this._neverEmitter = new Emitter();
    this.onDidChangeTrust = this._neverEmitter.event;
  }
  isWorkspaceTrusted() {
    return true;
  }
}
class StandaloneLanguageService extends LanguageService {
  constructor() {
    super();
  }
}
class StandaloneLogService extends LogService {
  constructor() {
    super(new ConsoleLogger());
  }
}
let StandaloneContextMenuService = class StandaloneContextMenuService2 extends ContextMenuService {
  constructor(telemetryService, notificationService, contextViewService, keybindingService, themeService) {
    super(telemetryService, notificationService, contextViewService, keybindingService, themeService);
    this.configure({ blockMouse: false });
  }
};
StandaloneContextMenuService = __decorate([
  __param(0, ITelemetryService),
  __param(1, INotificationService),
  __param(2, IContextViewService),
  __param(3, IKeybindingService),
  __param(4, IThemeService)
], StandaloneContextMenuService);
registerSingleton(IConfigurationService, StandaloneConfigurationService);
registerSingleton(ITextResourceConfigurationService, StandaloneResourceConfigurationService);
registerSingleton(ITextResourcePropertiesService, StandaloneResourcePropertiesService);
registerSingleton(IWorkspaceContextService, StandaloneWorkspaceContextService);
registerSingleton(ILabelService, StandaloneUriLabelService);
registerSingleton(ITelemetryService, StandaloneTelemetryService);
registerSingleton(IDialogService, StandaloneDialogService);
registerSingleton(INotificationService, StandaloneNotificationService);
registerSingleton(IMarkerService, MarkerService);
registerSingleton(ILanguageService, StandaloneLanguageService);
registerSingleton(IStandaloneThemeService, StandaloneThemeService);
registerSingleton(ILogService, StandaloneLogService);
registerSingleton(IModelService, ModelService);
registerSingleton(IMarkerDecorationsService, MarkerDecorationsService);
registerSingleton(IContextKeyService, ContextKeyService);
registerSingleton(IEditorProgressService, StandaloneEditorProgressService);
registerSingleton(IStorageService, InMemoryStorageService);
registerSingleton(IEditorWorkerService, EditorWorkerService);
registerSingleton(IBulkEditService, StandaloneBulkEditService);
registerSingleton(IWorkspaceTrustManagementService, StandaloneWorkspaceTrustManagementService);
registerSingleton(ITextModelService, StandaloneTextModelService);
registerSingleton(IAccessibilityService, AccessibilityService);
registerSingleton(IListService, ListService);
registerSingleton(ICommandService, StandaloneCommandService);
registerSingleton(IKeybindingService, StandaloneKeybindingService);
registerSingleton(IQuickInputService, StandaloneQuickInputService);
registerSingleton(IContextViewService, StandaloneContextViewService);
registerSingleton(IOpenerService, OpenerService);
registerSingleton(IClipboardService, BrowserClipboardService);
registerSingleton(IContextMenuService, StandaloneContextMenuService);
registerSingleton(IMenuService, MenuService);
var StandaloneServices;
(function(StandaloneServices2) {
  const serviceCollection = new ServiceCollection();
  for (const [id, descriptor] of getSingletonServiceDescriptors()) {
    serviceCollection.set(id, descriptor);
  }
  const instantiationService = new InstantiationService(serviceCollection, true);
  serviceCollection.set(IInstantiationService, instantiationService);
  function get(serviceId) {
    const r = serviceCollection.get(serviceId);
    if (!r) {
      throw new Error("Missing service " + serviceId);
    }
    if (r instanceof SyncDescriptor) {
      return instantiationService.invokeFunction((accessor) => accessor.get(serviceId));
    } else {
      return r;
    }
  }
  StandaloneServices2.get = get;
  let initialized = false;
  function initialize(overrides) {
    if (initialized) {
      return instantiationService;
    }
    initialized = true;
    for (const [id, descriptor] of getSingletonServiceDescriptors()) {
      if (!serviceCollection.get(id)) {
        serviceCollection.set(id, descriptor);
      }
    }
    for (const serviceId in overrides) {
      if (overrides.hasOwnProperty(serviceId)) {
        const serviceIdentifier = createDecorator(serviceId);
        const r = serviceCollection.get(serviceIdentifier);
        if (r instanceof SyncDescriptor) {
          serviceCollection.set(serviceIdentifier, overrides[serviceId]);
        }
      }
    }
    return instantiationService;
  }
  StandaloneServices2.initialize = initialize;
})(StandaloneServices || (StandaloneServices = {}));
export {
  StandaloneCommandService,
  StandaloneConfigurationService,
  StandaloneKeybindingService,
  StandaloneNotificationService,
  StandaloneServices,
  updateConfigurationService
};
