'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.interruptKernel = exports.killKernel = undefined;
exports.newKernel = newKernel;
exports.setNotebookKernelInfo = setNotebookKernelInfo;
exports.setExecutionState = setExecutionState;
exports.updateCellSource = updateCellSource;
exports.updateCellOutputs = updateCellOutputs;
exports.moveCell = moveCell;
exports.removeCell = removeCell;
exports.createCellAfter = createCellAfter;
exports.createCellBefore = createCellBefore;
exports.createCellAppend = createCellAppend;
exports.mergeCellAfter = mergeCellAfter;
exports.updateCellExecutionCount = updateCellExecutionCount;
exports.clearCellOutput = clearCellOutput;
exports.changeOutputVisibility = changeOutputVisibility;
exports.changeInputVisibility = changeInputVisibility;
exports.updateCellPagers = updateCellPagers;
exports.updateCellStatus = updateCellStatus;
exports.focusCell = focusCell;
exports.focusNextCell = focusNextCell;
exports.focusPreviousCell = focusPreviousCell;
exports.toggleStickyCell = toggleStickyCell;
exports.splitCell = splitCell;
exports.overwriteMetadata = overwriteMetadata;
exports.setNotificationSystem = setNotificationSystem;
exports.associateCellToMsg = associateCellToMsg;
exports.setForwardCheckpoint = setForwardCheckpoint;
exports.setBackwardCheckpoint = setBackwardCheckpoint;
exports.copyCell = copyCell;
exports.cutCell = cutCell;
exports.pasteCell = pasteCell;
exports.changeCellType = changeCellType;
exports.setModified = setModified;

var _constants = require('./constants');

var constants = _interopRequireWildcard(_constants);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function newKernel(kernelSpecName, cwd) {
  return {
    type: constants.LAUNCH_KERNEL,
    kernelSpecName,
    cwd
  };
}

function setNotebookKernelInfo(kernelInfo) {
  return {
    type: constants.SET_KERNEL_INFO,
    kernelInfo
  };
}

function setExecutionState(executionState) {
  return {
    type: constants.SET_EXECUTION_STATE,
    executionState
  };
}

function updateCellSource(id, source) {
  return {
    type: constants.UPDATE_CELL_SOURCE,
    id,
    source
  };
}

function updateCellOutputs(id, outputs) {
  return {
    type: constants.UPDATE_CELL_OUTPUTS,
    id,
    outputs
  };
}

function moveCell(id, destinationId, above) {
  return {
    type: constants.MOVE_CELL,
    id,
    destinationId,
    above
  };
}

function removeCell(id) {
  return {
    type: constants.REMOVE_CELL,
    id
  };
}

function createCellAfter(cellType, id, source) {
  return {
    type: constants.NEW_CELL_AFTER,
    source: source || '',
    cellType,
    id
  };
}

function createCellBefore(cellType, id) {
  return {
    type: constants.NEW_CELL_BEFORE,
    cellType,
    id
  };
}

function createCellAppend(cellType) {
  return {
    type: constants.NEW_CELL_APPEND,
    cellType
  };
}

function mergeCellAfter(id) {
  return {
    type: constants.MERGE_CELL_AFTER,
    id
  };
}

function updateCellExecutionCount(id, count) {
  return {
    type: constants.UPDATE_CELL_EXECUTION_COUNT,
    id,
    count
  };
}

function clearCellOutput(id) {
  return {
    type: constants.CLEAR_CELL_OUTPUT,
    id
  };
}

function changeOutputVisibility(id) {
  return {
    type: constants.CHANGE_OUTPUT_VISIBILITY,
    id
  };
}

function changeInputVisibility(id) {
  return {
    type: constants.CHANGE_INPUT_VISIBILITY,
    id
  };
}

function updateCellPagers(id, pagers) {
  return {
    type: constants.UPDATE_CELL_PAGERS,
    id,
    pagers
  };
}

function updateCellStatus(id, status) {
  return {
    type: constants.UPDATE_CELL_STATUS,
    id,
    status
  };
}

function focusCell(id) {
  return {
    type: constants.FOCUS_CELL,
    id
  };
}

function focusNextCell(id, createCellIfUndefined) {
  return {
    type: constants.FOCUS_NEXT_CELL,
    id,
    createCellIfUndefined
  };
}

function focusPreviousCell(id) {
  return {
    type: constants.FOCUS_PREVIOUS_CELL,
    id
  };
}

function toggleStickyCell(id) {
  return {
    type: constants.TOGGLE_STICKY_CELL,
    id
  };
}

function splitCell(id, position) {
  return {
    type: constants.SPLIT_CELL,
    id,
    position
  };
}

function overwriteMetadata(field, value) {
  return {
    type: constants.OVERWRITE_METADATA_FIELD,
    field,
    value
  };
}

const killKernel = exports.killKernel = {
  type: constants.KILL_KERNEL
};

const interruptKernel = exports.interruptKernel = {
  type: constants.INTERRUPT_KERNEL
};

function setNotificationSystem(notificationSystem) {
  return {
    type: constants.SET_NOTIFICATION_SYSTEM,
    notificationSystem
  };
}

function associateCellToMsg(cellId, msgId) {
  return {
    type: constants.ASSOCIATE_CELL_TO_MSG,
    cellId,
    msgId
  };
}

function setForwardCheckpoint(documentState) {
  return {
    type: constants.SET_FORWARD_CHECKPOINT,
    documentState
  };
}

function setBackwardCheckpoint(documentState, clearFutureStack) {
  return {
    type: constants.SET_BACKWARD_CHECKPOINT,
    documentState,
    clearFutureStack
  };
}

function copyCell(id) {
  return {
    type: constants.COPY_CELL,
    id
  };
}

function cutCell(id) {
  return {
    type: constants.CUT_CELL,
    id
  };
}

function pasteCell() {
  return {
    type: constants.PASTE_CELL
  };
}

function changeCellType(id, to) {
  return {
    type: constants.CHANGE_CELL_TYPE,
    id,
    to
  };
}

function setModified(value) {
  return {
    type: constants.SET_MODIFIED,
    value
  };
}