"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.propsForBankEntryUnauthorizedEdit = exports.propsForStimulusBankEntryEditPrompt = exports.propsForItemBankEntryEditPrompt = exports.propsForBankEntryEditPrompt = exports.propsForBankEntryVersioningWrapper = exports.propsForStimulusVersioningWrapper = exports.propsForItemVersioningWrapper = void 0;

var _react = _interopRequireDefault(require("react"));

var _partial = _interopRequireDefault(require("lodash/partial"));

var _Text = _interopRequireDefault(require("@instructure/ui-elements/lib/components/Text"));

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/lib/format-message"));

var immutableItemDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u4E00\u4E9B\u5B66\u751F\u5DF2\u7ECF\u63D0\u4EA4\u6B64\u9879\u76EE\u7684\u7B54\u6848\uFF01"), "\xA0", "\u60A8\u53EF\u4EE5\u5C06\u60A8\u7684\u7F16\u8F91\u5185\u5BB9\u5E94\u7528\u5230\u6B64\u9879\u76EE\u7684\u526F\u672C\uFF0C\u4EC5\u5BF9\u672A\u53C2\u52A0\u8BC4\u4F30\u7684\u5B66\u751F\u53EF\u89C1\u3002");

var itemCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u6B63\u5728\u7F16\u8F91\u526F\u672C\u3002"), "\xA0", "\u6765\u81EA\u6B64\u65B0\u526F\u672C\u7684\u9879\u76EE\u7EDF\u8BA1\u5C06\u4E0E\u6B64\u95EE\u9898\u7684\u4E0A\u4E00\u4E2A\u7248\u672C\u5206\u5F00\u663E\u793A\u3002");

var immutableStimulusDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u4E00\u4E9B\u5B66\u751F\u5DF2\u7ECF\u63D0\u4EA4\u6B64\u523A\u6FC0\u7684\u7B54\u6848\uFF01"), "\xA0", "\u60A8\u53EF\u4EE5\u5C06\u60A8\u7684\u7F16\u8F91\u5185\u5BB9\u5E94\u7528\u5230\u6B64\u6FC0\u52B1\u7684\u526F\u672C\uFF0C\u4EC5\u5BF9\u672A\u53C2\u52A0\u8BC4\u4F30\u7684\u5B66\u751F\u53EF\u89C1\u3002\u9644\u52A0\u9879\u76EE\u4E5F\u4F1A\u590D\u5236\u3002");

var stimulusCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u6B63\u5728\u7F16\u8F91\u526F\u672C\u3002"), "\xA0", "\u6765\u81EA\u6B64\u65B0\u526F\u672C\u7684\u523A\u6FC0\u7EDF\u8BA1\u5C06\u4E0E\u4E0A\u4E00\u4E2A\u7248\u672C\u5206\u5F00\u663E\u793A\u3002");

var itemBankEntryEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u9898\u5E93\u4E2D\u7684\u9879\u76EE\u3002"), "\xA0", "\u53EF\u4EE5\u5728\u6B64\u5904\u66F4\u6539\u4E00\u4E9B\u9009\u9879\u548C\u5F97\u5206\u503C\uFF0C\u4F46\u5FC5\u987B\u5728\u9898\u5E93\u5185\u8FDB\u884C\u7F16\u8F91\u3002");

var stimulusBankEntryEditDescription = _react.default.createElement(_Text.default, {
  "data-automation": "sdk-editInBanks-warning"
}, _react.default.createElement("b", null, "\u5DF2\u5165\u9898\u5E93\u7684\u6FC0\u52B1\u3002"), "\xA0", "\u5FC5\u987B\u5728\u9898\u5E93\u4E2D\u7F16\u8F91\u6B64\u6FC0\u52B1\u3002");

var bankEntryUnauthorizedEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "\u9898\u5E93\u4E2D\u7684\u9879\u76EE\u3002"), "\xA0", "\u60A8\u65E0\u6743\u7F16\u8F91\u6B64\u9879\u76EE\u3002");

var archivedBankEntryDescription = _react.default.createElement(_Text.default, null, "\u6B64\u9879\u76EE\u5DF2\u4ECE\u9879\u76EE\u5E93\u4E2D\u5220\u9664\u3002\u5B66\u751F\u5C06\u6765\u4ECD\u7136\u53EF\u4EE5\u770B\u5230\u5B83\u3002\u8981\u8FDB\u884C\u7F16\u8F91\uFF0C\u8BF7\u590D\u5236\u9879\u76EE\u3002");

var propsForVersioningWrapper = function propsForVersioningWrapper(copyDescription, immutableDescription, isImmutable, shouldClone, setShouldClone, switchOffEditing, isEditing) {
  var alertType = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : 'warning';
  var defaultProps = {
    disableChildren: false,
    showAlert: false
  };
  if (!isEditing) return {
    showAlert: false
  };

  if (isImmutable && shouldClone) {
    Object.assign(defaultProps, {
      description: copyDescription,
      hideActions: true,
      showAlert: true
    });
  } else if (isImmutable) {
    Object.assign(defaultProps, {
      alertType: alertType,
      cancelActionCallback: switchOffEditing,
      defaultActionCallback: (0, _partial.default)(setShouldClone, true),
      defaultActionText: "\u7F16\u8F91\u526F\u672C",
      description: immutableDescription,
      disableChildren: true,
      showAlert: true
    });
  }

  return defaultProps;
};

var propsForItemVersioningWrapper = function propsForItemVersioningWrapper() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, immutableItemDescription].concat(args));
};

exports.propsForItemVersioningWrapper = propsForItemVersioningWrapper;

var propsForStimulusVersioningWrapper = function propsForStimulusVersioningWrapper() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }

  return propsForVersioningWrapper.apply(void 0, [stimulusCopyDescription, immutableStimulusDescription].concat(args));
};

exports.propsForStimulusVersioningWrapper = propsForStimulusVersioningWrapper;

var propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
    args[_key3] = arguments[_key3];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, archivedBankEntryDescription].concat(args));
};

exports.propsForBankEntryVersioningWrapper = propsForBankEntryVersioningWrapper;

var propsForBankEntryEditPrompt = function propsForBankEntryEditPrompt(isEditing, switchOffEditing, defaultActionCallback, description) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    cancelActionCallback: switchOffEditing,
    disableChildren: true,
    description: description,
    defaultActionCallback: defaultActionCallback,
    defaultActionText: "\u5728\u9898\u5E93\u4E2D\u7F16\u8F91",
    showAlert: true
  };
};

exports.propsForBankEntryEditPrompt = propsForBankEntryEditPrompt;

var propsForItemBankEntryEditPrompt = function propsForItemBankEntryEditPrompt() {
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
    args[_key4] = arguments[_key4];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([itemBankEntryEditDescription]));
};

exports.propsForItemBankEntryEditPrompt = propsForItemBankEntryEditPrompt;

var propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
    args[_key5] = arguments[_key5];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([stimulusBankEntryEditDescription]));
};

exports.propsForStimulusBankEntryEditPrompt = propsForStimulusBankEntryEditPrompt;

var propsForBankEntryUnauthorizedEdit = function propsForBankEntryUnauthorizedEdit(isEditing) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    alertType: 'warning',
    disableChildren: true,
    description: bankEntryUnauthorizedEditDescription,
    hideActions: true,
    showAlert: true
  };
};

exports.propsForBankEntryUnauthorizedEdit = propsForBankEntryUnauthorizedEdit;