'use strict';

require('../../common/theme.js');
require('../../common/direction.js');
require('@transferwise/neptune-tokens');
var control = require('../../common/propsValues/control.js');
var size = require('../../common/propsValues/size.js');
require('../../common/propsValues/typography.js');
require('../../common/propsValues/width.js');
var type = require('../../common/propsValues/type.js');
require('../../common/propsValues/dateMode.js');
require('../../common/propsValues/monthFormat.js');
require('../../common/propsValues/position.js');
require('../../common/propsValues/layouts.js');
require('../../common/propsValues/status.js');
require('../../common/propsValues/sentiment.js');
require('../../common/propsValues/profileType.js');
require('../../common/propsValues/variant.js');
require('../../common/propsValues/scroll.js');
require('../../common/propsValues/markdownNodeType.js');
require('../../common/fileType.js');
require('@transferwise/formatting');
require('@transferwise/icons');
require('clsx');
require('react');
require('react-intl');
require('../../common/closeButton/CloseButton.messages.js');
require('react/jsx-runtime');
var logActionRequired = require('../../utilities/logActionRequired.js');

const deprecatedTypeMap = {
  [type.Type.PRIMARY]: control.ControlType.ACCENT,
  [type.Type.SECONDARY]: control.ControlType.ACCENT,
  [type.Type.LINK]: control.ControlType.ACCENT,
  [type.Type.PAY]: control.ControlType.POSITIVE,
  [type.Type.DANGER]: control.ControlType.NEGATIVE
};
const oldTypePriorityMap = {
  [type.Type.DANGER]: control.Priority.SECONDARY,
  [type.Type.LINK]: control.Priority.TERTIARY,
  [type.Type.SECONDARY]: control.Priority.SECONDARY
};
const deprecatedTypeMapMessage = {
  [type.Type.DANGER]: 'Type.NEGATIVE',
  [type.Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',
  [type.Type.PAY]: 'ControlType.POSITIVE',
  [type.Type.PRIMARY]: 'ControlType.ACCENT',
  [type.Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY'
};
const deprecatedTypes = Object.keys(deprecatedTypeMap);
const establishNewType = originalType => originalType && originalType in deprecatedTypeMap ? deprecatedTypeMap[originalType] : originalType;
const establishNewPriority = (originalPriority, originalType) => {
  const type = originalType ? establishNewType(originalType) : '';
  // The old SECONDARY and LINK types now map to priorities. If they're still using one of
  // these old types, ignore whatever priority they've passed and use this instead.
  if (originalType && originalType in oldTypePriorityMap) {
    return oldTypePriorityMap[originalType];
  }
  // Only ControlType.ACCENT supports tertiary styles
  if (originalPriority === control.Priority.TERTIARY && type !== control.ControlType.ACCENT) {
    return control.Priority.SECONDARY;
  }
  return originalPriority;
};
const logDeprecationNotices = ({
  size: size$1,
  type
}) => {
  logActionRequired.logActionRequiredIf('Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.', size$1 === size.Size.EXTRA_SMALL);
  if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {
    logActionRequired.logActionRequired(`Button has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage[type]}.`);
  }
};

exports.establishNewPriority = establishNewPriority;
exports.establishNewType = establishNewType;
exports.logDeprecationNotices = logDeprecationNotices;
//# sourceMappingURL=legacyUtils.js.map
