"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const nls = require("../../../nls.js");
require("../../../base/common/map.js");
const uri = require("../../../base/common/uri.js");
const instantiation = require("../../instantiation/common/instantiation.js");
const IWorkspaceContextService = instantiation.createDecorator("contextService");
function isSingleFolderWorkspaceIdentifier(obj) {
  const singleFolderIdentifier = obj;
  return typeof (singleFolderIdentifier === null || singleFolderIdentifier === void 0 ? void 0 : singleFolderIdentifier.id) === "string" && uri.URI.isUri(singleFolderIdentifier.uri);
}
function toWorkspaceIdentifier(workspace) {
  if (workspace.configuration) {
    return {
      id: workspace.id,
      configPath: workspace.configuration
    };
  }
  if (workspace.folders.length === 1) {
    return {
      id: workspace.id,
      uri: workspace.folders[0].uri
    };
  }
  return void 0;
}
class WorkspaceFolder {
  constructor(data, raw) {
    this.raw = raw;
    this.uri = data.uri;
    this.index = data.index;
    this.name = data.name;
  }
  toJSON() {
    return { uri: this.uri, name: this.name, index: this.index };
  }
}
const WORKSPACE_EXTENSION = "code-workspace";
[{ name: nls.localize("codeWorkspace", "Code Workspace"), extensions: [WORKSPACE_EXTENSION] }];
exports.IWorkspaceContextService = IWorkspaceContextService;
exports.WORKSPACE_EXTENSION = WORKSPACE_EXTENSION;
exports.WorkspaceFolder = WorkspaceFolder;
exports.isSingleFolderWorkspaceIdentifier = isSingleFolderWorkspaceIdentifier;
exports.toWorkspaceIdentifier = toWorkspaceIdentifier;
