import { createContext } from 'react';
export const FloatingPanelContext = /*#__PURE__*/createContext({
  onDrag: () => {},
  onDragStart: () => {},
  onDragEnd: () => {},
  isMoving: false,
  isDocked: false,
  setIsDocked: () => {},
  isCollapsed: false,
  setIsCollapsed: () => {},
  onMoveWithArrows: () => {},
  getPosition: () => ({
    left: 0,
    top: 0,
    width: 0,
    height: 0
  })
});
export const MOVE_KEYS = {
  UP: 'ArrowUp',
  DOWN: 'ArrowDown',
  RIGHT: 'ArrowRight',
  LEFT: 'ArrowLeft'
};
export const MOVE_KEYS_VALUES = Object.values(MOVE_KEYS);
export const HIGHLIGHTED_CLASSNAME = 'highlighted';
export const resizeHandles = [{
  id: 'top-left',
  left: true,
  top: true,
  bottom: false,
  right: false
}, {
  id: 'top',
  left: false,
  top: true,
  bottom: false,
  right: false
}, {
  id: 'top-right',
  left: false,
  top: true,
  bottom: false,
  right: true
}, {
  id: 'right',
  left: false,
  top: false,
  bottom: false,
  right: true
}, {
  id: 'bottom-right',
  left: false,
  top: false,
  bottom: true,
  right: true
}, {
  id: 'bottom',
  left: false,
  top: false,
  bottom: true,
  right: false
}, {
  id: 'bottom-left',
  left: true,
  top: false,
  bottom: true,
  right: false
}, {
  id: 'left',
  left: true,
  top: false,
  bottom: false,
  right: false
}];
export const resizeHandlesMap = new Map(resizeHandles.map(handle => [handle.id, handle]));
export function getHtmlElement(anchorEl) {
  if (typeof anchorEl === 'function') {
    return anchorEl();
  }
  if (anchorEl?.ref?.current) {
    return anchorEl.ref.current;
  }
  if (anchorEl?.current) {
    return anchorEl.current;
  }
  return anchorEl;
}