import { isArray } from "../../../../min-dash/dist/index.esm.mjs";
var KEYCODE_C = 67;
var KEYCODE_V = 86;
var KEYCODE_Y = 89;
var KEYCODE_Z = 90;
var KEYS_COPY = ["c", "C", KEYCODE_C];
var KEYS_PASTE = ["v", "V", KEYCODE_V];
var KEYS_REDO = ["y", "Y", KEYCODE_Y];
var KEYS_UNDO = ["z", "Z", KEYCODE_Z];
function hasModifier(event) {
  return event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;
}
function isCmd(event) {
  if (event.altKey) {
    return false;
  }
  return event.ctrlKey || event.metaKey;
}
function isKey(keys, event) {
  keys = isArray(keys) ? keys : [keys];
  return keys.indexOf(event.key) !== -1 || keys.indexOf(event.keyCode) !== -1;
}
function isShift(event) {
  return event.shiftKey;
}
function isCopy(event) {
  return isCmd(event) && isKey(KEYS_COPY, event);
}
function isPaste(event) {
  return isCmd(event) && isKey(KEYS_PASTE, event);
}
function isUndo(event) {
  return isCmd(event) && !isShift(event) && isKey(KEYS_UNDO, event);
}
function isRedo(event) {
  return isCmd(event) && (isKey(KEYS_REDO, event) || isKey(KEYS_UNDO, event) && isShift(event));
}
export {
  hasModifier,
  isCmd,
  isCopy,
  isKey,
  isPaste,
  isRedo,
  isShift,
  isUndo
};
