import { Codicon } from "../../../../base/common/codicons.mjs";
import { ModelDecorationOptions } from "../../../common/model/textModel.mjs";
import { localize } from "../../../../nls.mjs";
import { registerIcon } from "../../../../platform/theme/common/iconRegistry.mjs";
import { ThemeIcon } from "../../../../platform/theme/common/themeService.mjs";
const foldingExpandedIcon = registerIcon("folding-expanded", Codicon.chevronDown, localize("foldingExpandedIcon", "Icon for expanded ranges in the editor glyph margin."));
const foldingCollapsedIcon = registerIcon("folding-collapsed", Codicon.chevronRight, 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 = ModelDecorationOptions.register({
  description: "folding-collapsed-visual-decoration",
  stickiness: 1,
  afterContentClassName: "inline-folded",
  isWholeLine: true,
  firstLineDecorationClassName: ThemeIcon.asClassName(foldingCollapsedIcon)
});
FoldingDecorationProvider.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION = ModelDecorationOptions.register({
  description: "folding-collapsed-highlighted-visual-decoration",
  stickiness: 1,
  afterContentClassName: "inline-folded",
  className: "folded-background",
  isWholeLine: true,
  firstLineDecorationClassName: ThemeIcon.asClassName(foldingCollapsedIcon)
});
FoldingDecorationProvider.EXPANDED_AUTO_HIDE_VISUAL_DECORATION = ModelDecorationOptions.register({
  description: "folding-expanded-auto-hide-visual-decoration",
  stickiness: 1,
  isWholeLine: true,
  firstLineDecorationClassName: ThemeIcon.asClassName(foldingExpandedIcon)
});
FoldingDecorationProvider.EXPANDED_VISUAL_DECORATION = ModelDecorationOptions.register({
  description: "folding-expanded-visual-decoration",
  stickiness: 1,
  isWholeLine: true,
  firstLineDecorationClassName: "alwaysShowFoldIcons " + ThemeIcon.asClassName(foldingExpandedIcon)
});
FoldingDecorationProvider.HIDDEN_RANGE_DECORATION = ModelDecorationOptions.register({
  description: "folding-hidden-range-decoration",
  stickiness: 1
  /* NeverGrowsWhenTypingAtEdges */
});
export {
  FoldingDecorationProvider,
  foldingCollapsedIcon,
  foldingExpandedIcon
};
