function flipPlacement (placement) {
  const direction =
    (canUseDOM && document.body.getAttribute('dir')) ||
    'ltr'

  if (direction !== 'rtl') {
    return placement
  }

  switch (placement) {
    case 'bottom-end':
      return 'bottom-start'
    case 'bottom-start':
      return 'bottom-end'
    case 'top-end':
      return 'top-start'
    case 'top-start':
      return 'top-end'
    default:
      return placement
  }
}
Flips placement if in <body dir="rtl" />
@param {string} placement