'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _partial = require('lodash/partial');

var _partial2 = _interopRequireDefault(_partial);

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

var _Text2 = _interopRequireDefault(_Text);

var _formatMessage = require('../format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var immutableItemDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u90E8\u5206\u5B78\u751F\u5DF2\u5C31\u672C\u9805\u76EE\u63D0\u4F9B\u7B54\u6848\uFF01'
  ),
  '\xA0',
  '\u60A8\u53EF\u5728\u6B64\u7DE8\u8F2F\u672C\u9805\u76EE\u7684\u526F\u672C\uFF0C\u53EA\u6709\u6C92\u6709\u9032\u884C\u8A55\u4F30\u7684\u5B78\u751F\u624D\u6703\u770B\u5230\u3002'
);

var itemCopyDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u6B63\u5728\u7DE8\u8F2F\u526F\u672C\u3002'
  ),
  '\xA0',
  '\u51FA\u81EA\u65B0\u526F\u672C\u7684\u9805\u76EE\u6578\u64DA\u6703\u548C\u672C\u554F\u984C\u5148\u524D\u7248\u672C\u5206\u958B\u986F\u793A\u3002'
);

var immutableStimulusDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u90E8\u5206\u5B78\u751F\u5DF2\u5C31\u672C\u6FC0\u52F5\uFF08Stimulus\uFF09\u63D0\u4F9B\u7B54\u6848\uFF01'
  ),
  '\xA0',
  '\u60A8\u53EF\u5728\u6B64\u7DE8\u8F2F\u672C\u6FC0\u52F5 (Stimulus) \u7684\u526F\u672C\uFF0C\u53EA\u6709\u672A\u9032\u884C\u8A55\u4F30\u7684\u5B78\u751F\u624D\u6703\u770B\u5230\u3002\u9644\u4EF6\u9805\u76EE\u4E5F\u5C07\u88AB\u8907\u88FD\u3002'
);

var stimulusCopyDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u6B63\u5728\u7DE8\u8F2F\u526F\u672C\u3002'
  ),
  '\xA0',
  '\u51FA\u81EA\u65B0\u526F\u672C\u7684\u6FC0\u52F5\uFF08Stimulus\uFF09\u6578\u64DA\u6703\u548C\u5148\u524D\u7248\u672C\u5206\u958B\u986F\u793A\u3002'
);

var itemBankEntryEditDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u984C\u5EAB\u9805\u76EE\u3002'
  ),
  '\xA0',
  '\u90E8\u5206\u9078\u9805\u548C\u5206\u6578\u503C\u53EF\u65BC\u9019\u5152\u66F4\u6539\uFF0C\u4F46\u7DE8\u8F2F\u9808\u5728\u984C\u5EAB\u5167\u9032\u884C\u3002'
);

var stimulusBankEntryEditDescription = _react2.default.createElement(
  _Text2.default,
  { 'data-automation': 'sdk-editInBanks-warning' },
  _react2.default.createElement(
    'b',
    null,
    '\u984C\u5EAB\u4E2D\u7684\u6FC0\u52F5\u3002'
  ),
  '\xA0',
  '\u7DE8\u8F2F\u672C\u6FC0\u52F5\u5FC5\u9808\u5728\u984C\u5EAB\u5167\u9032\u884C\u3002'
);

var bankEntryUnauthorizedEditDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    '\u984C\u5EAB\u9805\u76EE\u3002'
  ),
  '\xA0',
  '\u60A8\u6C92\u6709\u6B0A\u9650\u7DE8\u8F2F\u6B64\u9805\u76EE\u3002'
);

var archivedBankEntryDescription = _react2.default.createElement(
  _Text2.default,
  null,
  '\u6B64\u9805\u76EE\u5DF2\u5F9E\u9805\u76EE\u984C\u5EAB\u4E2D\u522A\u9664\u3002\u5B78\u751F\u5011\u4ECD\u7136\u6703\u5728\u672A\u4F86\u7684\u905E\u4EA4\u5617\u8A66\u4E2D\u770B\u5230\u5B83\u3002\u8981\u9032\u884C\u7DE8\u8F2F\uFF0C\u8ACB\u8907\u88FD\u6B64\u9805\u76EE\u3002'
);

var propsForVersioningWrapper = function propsForVersioningWrapper(copyDescription, immutableDescription, isImmutable, shouldClone, setShouldClone, switchOffEditing, isEditing) {
  var alertType = arguments.length > 7 && arguments[7] !== undefined ? 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, _partial2.default)(setShouldClone, true),
      defaultActionText: '\u7DE8\u8F2F\u526F\u672C',
      description: immutableDescription,
      disableChildren: true,
      showAlert: true
    });
  }
  return defaultProps;
};

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

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

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

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

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

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

var propsForBankEntryEditPrompt = exports.propsForBankEntryEditPrompt = function propsForBankEntryEditPrompt(isEditing, switchOffEditing, defaultActionCallback, description) {
  if (!isEditing) return { showAlert: false };
  return {
    cancelActionCallback: switchOffEditing,
    disableChildren: true,
    description: description,
    defaultActionCallback: defaultActionCallback,
    defaultActionText: '\u7DE8\u8F2F\u984C\u5EAB',
    showAlert: true
  };
};

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

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

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

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

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