import { isUndo as D, isRedo as S, isCopy as _, isPaste as d, isKey as i, isCmd as f } from "./KeyboardUtil.mjs";
var c = 500;
function v(u, r) {
  var n = this;
  u.on("editorActions.init", c, function(t) {
    var e = t.editorActions;
    n.registerBindings(r, e);
  });
}
v.$inject = [
  "eventBus",
  "keyboard"
];
v.prototype.registerBindings = function(u, r) {
  function n(t, e) {
    r.isRegistered(t) && u.addListener(e);
  }
  n("undo", function(t) {
    var e = t.keyEvent;
    if (D(e))
      return r.trigger("undo"), true;
  }), n("redo", function(t) {
    var e = t.keyEvent;
    if (S(e))
      return r.trigger("redo"), true;
  }), n("copy", function(t) {
    var e = t.keyEvent;
    if (_(e))
      return r.trigger("copy"), true;
  }), n("paste", function(t) {
    var e = t.keyEvent;
    if (d(e))
      return r.trigger("paste"), true;
  }), n("stepZoom", function(t) {
    var e = t.keyEvent;
    if (i(["+", "Add", "="], e) && f(e))
      return r.trigger("stepZoom", { value: 1 }), true;
  }), n("stepZoom", function(t) {
    var e = t.keyEvent;
    if (i(["-", "Subtract"], e) && f(e))
      return r.trigger("stepZoom", { value: -1 }), true;
  }), n("zoom", function(t) {
    var e = t.keyEvent;
    if (i("0", e) && f(e))
      return r.trigger("zoom", { value: 1 }), true;
  }), n("removeSelection", function(t) {
    var e = t.keyEvent;
    if (i(["Backspace", "Delete", "Del"], e))
      return r.trigger("removeSelection"), true;
  });
};
export {
  v as default
};
