var __decorate = (this && this.__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;
};
import { VegaInternalIconManager } from '../../../../../helpers/icon/internal-icon-manager';
import indent from '../../../assets/indent';
import { MapToComponentField } from 'vega-slimmer/core';
import { IndentAnnotationAction } from '../../../dto/actions/indent-annotation-action';
import { BlockAnnotationTypeEnum } from '../../../dto/annotations/block-annotation.abstract';
import { VisualModeToolbarButtonSlimmer } from './visual-mode-toolbar-button-slimmer.abstract';
export class MoreIndentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
  constructor() {
    super({
      icon: 'indent',
      tooltip: {
        text: 'More Indent',
      },
    });
  }
  isSelected() {
    return false;
  }
  isDisabled() {
    const selectedBlocks = this.selectionController.getSelectedBlocks();
    return (super.isDisabled() ||
      selectedBlocks.some((node) => this.shouldDisabledToolbar(node, IndentAnnotationAction.name)));
  }
  onClick() {
    this.selectionController.getSelectedBlocks().forEach((item) => {
      var _a, _b;
      const indent = (_b = (_a = item.getAnnotationByType(BlockAnnotationTypeEnum.INDENT)) === null || _a === void 0 ? void 0 : _a.indent) !== null && _b !== void 0 ? _b : 0;
      item.apply(new IndentAnnotationAction(indent + 1));
    });
  }
}
(() => {
  VegaInternalIconManager.register({ indent: indent });
})();
__decorate([
  MapToComponentField()
], MoreIndentToolbarButtonSlimmer.prototype, "selectionController", void 0);
