"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const codicons = require("../../../../base/common/codicons.js");
const textModel = require("../../../common/model/textModel.js");
const nls = require("../../../../nls.js");
const iconRegistry = require("../../../../platform/theme/common/iconRegistry.js");
const themeService = require("../../../../platform/theme/common/themeService.js");
const foldingExpandedIcon = iconRegistry.registerIcon("folding-expanded", codicons.Codicon.chevronDown, nls.localize("foldingExpandedIcon", "Icon for expanded ranges in the editor glyph margin."));
const foldingCollapsedIcon = iconRegistry.registerIcon("folding-collapsed", codicons.Codicon.chevronRight, nls.localize("foldingCollapsedIcon", "Icon for collapsed ranges in the editor glyph margin."));
class FoldingDecorationProvider {
  constructor(editor) {
    this.editor = editor;
    this.autoHideFoldingControls = true;
    this.showFoldingHighlights = true;
  }
  getDecorationOption(isCollapsed, isHidden) {
    if (isHidden) {
      return FoldingDecorationProvider.HIDDEN_RANGE_DECORATION;
    }
    if (isCollapsed) {
      return this.showFoldingHighlights ? FoldingDecorationProvider.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION : FoldingDecorationProvider.COLLAPSED_VISUAL_DECORATION;
    } else if (this.autoHideFoldingControls) {
      return FoldingDecorationProvider.EXPANDED_AUTO_HIDE_VISUAL_DECORATION;
    } else {
      return FoldingDecorationProvider.EXPANDED_VISUAL_DECORATION;
    }
  }
  deltaDecorations(oldDecorations, newDecorations) {
    return this.editor.deltaDecorations(oldDecorations, newDecorations);
  }
  changeDecorations(callback) {
    return this.editor.changeDecorations(callback);
  }
}
FoldingDecorationProvider.COLLAPSED_VISUAL_DECORATION = textModel.ModelDecorationOptions.register({
  description: "folding-collapsed-visual-decoration",
  stickiness: 1,
  afterContentClassName: "inline-folded",
  isWholeLine: true,
  firstLineDecorationClassName: themeService.ThemeIcon.asClassName(foldingCollapsedIcon)
});
FoldingDecorationProvider.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION = textModel.ModelDecorationOptions.register({
  description: "folding-collapsed-highlighted-visual-decoration",
  stickiness: 1,
  afterContentClassName: "inline-folded",
  className: "folded-background",
  isWholeLine: true,
  firstLineDecorationClassName: themeService.ThemeIcon.asClassName(foldingCollapsedIcon)
});
FoldingDecorationProvider.EXPANDED_AUTO_HIDE_VISUAL_DECORATION = textModel.ModelDecorationOptions.register({
  description: "folding-expanded-auto-hide-visual-decoration",
  stickiness: 1,
  isWholeLine: true,
  firstLineDecorationClassName: themeService.ThemeIcon.asClassName(foldingExpandedIcon)
});
FoldingDecorationProvider.EXPANDED_VISUAL_DECORATION = textModel.ModelDecorationOptions.register({
  description: "folding-expanded-visual-decoration",
  stickiness: 1,
  isWholeLine: true,
  firstLineDecorationClassName: "alwaysShowFoldIcons " + themeService.ThemeIcon.asClassName(foldingExpandedIcon)
});
FoldingDecorationProvider.HIDDEN_RANGE_DECORATION = textModel.ModelDecorationOptions.register({
  description: "folding-hidden-range-decoration",
  stickiness: 1
  /* NeverGrowsWhenTypingAtEdges */
});
exports.FoldingDecorationProvider = FoldingDecorationProvider;
exports.foldingCollapsedIcon = foldingCollapsedIcon;
exports.foldingExpandedIcon = foldingExpandedIcon;
