import { getClientArea } from "../../../base/browser/dom.mjs";
import { Event } from "../../../base/common/event.mjs";
import { ILayoutService } from "../../../platform/layout/browser/layoutService.mjs";
import { ICodeEditorService } from "../../browser/services/codeEditorService.mjs";
import { registerSingleton } from "../../../platform/instantiation/common/extensions.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);
  };
};
let StandaloneLayoutService = class StandaloneLayoutService2 {
  constructor(_codeEditorService) {
    this._codeEditorService = _codeEditorService;
    this.onDidLayout = Event.None;
  }
  get dimension() {
    if (!this._dimension) {
      this._dimension = getClientArea(window.document.body);
    }
    return this._dimension;
  }
  get hasContainer() {
    return false;
  }
  get container() {
    throw new Error(`ILayoutService.container is not available in the standalone editor!`);
  }
  focus() {
    var _a;
    (_a = this._codeEditorService.getFocusedCodeEditor()) === null || _a === void 0 ? void 0 : _a.focus();
  }
};
StandaloneLayoutService = __decorate([
  __param(0, ICodeEditorService)
], StandaloneLayoutService);
let EditorScopedLayoutService = class EditorScopedLayoutService2 extends StandaloneLayoutService {
  constructor(_container, codeEditorService) {
    super(codeEditorService);
    this._container = _container;
  }
  get hasContainer() {
    return false;
  }
  get container() {
    return this._container;
  }
};
EditorScopedLayoutService = __decorate([
  __param(1, ICodeEditorService)
], EditorScopedLayoutService);
registerSingleton(ILayoutService, StandaloneLayoutService);
export {
  EditorScopedLayoutService
};
