"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const editorExtensions = require("../../../browser/editorExtensions.js");
const cursorWordOperations = require("../../../common/cursor/cursorWordOperations.js");
const range = require("../../../common/core/range.js");
const editorContextKeys = require("../../../common/editorContextKeys.js");
const wordOperations = require("../../wordOperations/browser/wordOperations.js");
const commands = require("../../../../platform/commands/common/commands.js");
class DeleteWordPartLeft extends wordOperations.DeleteWordCommand {
  constructor() {
    super({
      whitespaceHeuristics: true,
      wordNavigationType: 0,
      id: "deleteWordPartLeft",
      precondition: editorContextKeys.EditorContextKeys.writable,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 1
          /* Backspace */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
  _delete(ctx, wordNavigationType) {
    let r = cursorWordOperations.WordPartOperations.deleteWordPartLeft(ctx);
    if (r) {
      return r;
    }
    return new range.Range(1, 1, 1, 1);
  }
}
class DeleteWordPartRight extends wordOperations.DeleteWordCommand {
  constructor() {
    super({
      whitespaceHeuristics: true,
      wordNavigationType: 2,
      id: "deleteWordPartRight",
      precondition: editorContextKeys.EditorContextKeys.writable,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 20
          /* Delete */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
  _delete(ctx, wordNavigationType) {
    let r = cursorWordOperations.WordPartOperations.deleteWordPartRight(ctx);
    if (r) {
      return r;
    }
    const lineCount = ctx.model.getLineCount();
    const maxColumn = ctx.model.getLineMaxColumn(lineCount);
    return new range.Range(lineCount, maxColumn, lineCount, maxColumn);
  }
}
class WordPartLeftCommand extends wordOperations.MoveWordCommand {
  _move(wordSeparators, model, position, wordNavigationType) {
    return cursorWordOperations.WordPartOperations.moveWordPartLeft(wordSeparators, model, position);
  }
}
class CursorWordPartLeft extends WordPartLeftCommand {
  constructor() {
    super({
      inSelectionMode: false,
      wordNavigationType: 0,
      id: "cursorWordPartLeft",
      precondition: void 0,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 15
          /* LeftArrow */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
}
commands.CommandsRegistry.registerCommandAlias("cursorWordPartStartLeft", "cursorWordPartLeft");
class CursorWordPartLeftSelect extends WordPartLeftCommand {
  constructor() {
    super({
      inSelectionMode: true,
      wordNavigationType: 0,
      id: "cursorWordPartLeftSelect",
      precondition: void 0,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 1024 | 15
          /* LeftArrow */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
}
commands.CommandsRegistry.registerCommandAlias("cursorWordPartStartLeftSelect", "cursorWordPartLeftSelect");
class WordPartRightCommand extends wordOperations.MoveWordCommand {
  _move(wordSeparators, model, position, wordNavigationType) {
    return cursorWordOperations.WordPartOperations.moveWordPartRight(wordSeparators, model, position);
  }
}
class CursorWordPartRight extends WordPartRightCommand {
  constructor() {
    super({
      inSelectionMode: false,
      wordNavigationType: 2,
      id: "cursorWordPartRight",
      precondition: void 0,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 17
          /* RightArrow */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
}
class CursorWordPartRightSelect extends WordPartRightCommand {
  constructor() {
    super({
      inSelectionMode: true,
      wordNavigationType: 2,
      id: "cursorWordPartRightSelect",
      precondition: void 0,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.textInputFocus,
        primary: 0,
        mac: {
          primary: 256 | 512 | 1024 | 17
          /* RightArrow */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
}
editorExtensions.registerEditorCommand(new DeleteWordPartLeft());
editorExtensions.registerEditorCommand(new DeleteWordPartRight());
editorExtensions.registerEditorCommand(new CursorWordPartLeft());
editorExtensions.registerEditorCommand(new CursorWordPartLeftSelect());
editorExtensions.registerEditorCommand(new CursorWordPartRight());
editorExtensions.registerEditorCommand(new CursorWordPartRightSelect());
exports.CursorWordPartLeft = CursorWordPartLeft;
exports.CursorWordPartLeftSelect = CursorWordPartLeftSelect;
exports.CursorWordPartRight = CursorWordPartRight;
exports.CursorWordPartRightSelect = CursorWordPartRightSelect;
exports.DeleteWordPartLeft = DeleteWordPartLeft;
exports.DeleteWordPartRight = DeleteWordPartRight;
exports.WordPartLeftCommand = WordPartLeftCommand;
exports.WordPartRightCommand = WordPartRightCommand;
