import '../../common/theme.mjs';
import '../../common/direction.mjs';
import '@transferwise/neptune-tokens';
import { ControlType, Priority } from '../../common/propsValues/control.mjs';
import { Size } from '../../common/propsValues/size.mjs';
import '../../common/propsValues/typography.mjs';
import '../../common/propsValues/width.mjs';
import { Type } from '../../common/propsValues/type.mjs';
import '../../common/propsValues/dateMode.mjs';
import '../../common/propsValues/monthFormat.mjs';
import '../../common/propsValues/position.mjs';
import '../../common/propsValues/layouts.mjs';
import '../../common/propsValues/status.mjs';
import '../../common/propsValues/sentiment.mjs';
import '../../common/propsValues/profileType.mjs';
import '../../common/propsValues/variant.mjs';
import '../../common/propsValues/scroll.mjs';
import '../../common/propsValues/markdownNodeType.mjs';
import '../../common/fileType.mjs';
import '@transferwise/formatting';
import '@transferwise/icons';
import 'clsx';
import 'react';
import 'react-intl';
import '../../common/closeButton/CloseButton.messages.mjs';
import 'react/jsx-runtime';
import { logActionRequiredIf, logActionRequired } from '../../utilities/logActionRequired.mjs';

const deprecatedTypeMap = {
  [Type.PRIMARY]: ControlType.ACCENT,
  [Type.SECONDARY]: ControlType.ACCENT,
  [Type.LINK]: ControlType.ACCENT,
  [Type.PAY]: ControlType.POSITIVE,
  [Type.DANGER]: ControlType.NEGATIVE
};
const oldTypePriorityMap = {
  [Type.DANGER]: Priority.SECONDARY,
  [Type.LINK]: Priority.TERTIARY,
  [Type.SECONDARY]: Priority.SECONDARY
};
const deprecatedTypeMapMessage = {
  [Type.DANGER]: 'Type.NEGATIVE',
  [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',
  [Type.PAY]: 'ControlType.POSITIVE',
  [Type.PRIMARY]: 'ControlType.ACCENT',
  [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 === Priority.TERTIARY && type !== ControlType.ACCENT) {
    return Priority.SECONDARY;
  }
  return originalPriority;
};
const logDeprecationNotices = ({
  size,
  type
}) => {
  logActionRequiredIf('Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.', size === Size.EXTRA_SMALL);
  if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {
    logActionRequired(`Button has deprecated the ${type} value for the \`type\` prop. Please update to ${deprecatedTypeMapMessage[type]}.`);
  }
};

export { establishNewPriority, establishNewType, logDeprecationNotices };
//# sourceMappingURL=legacyUtils.mjs.map
