"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MOVE_KEYS_VALUES = exports.MOVE_KEYS = exports.HIGHLIGHTED_CLASSNAME = exports.FloatingPanelContext = void 0;
exports.getHtmlElement = getHtmlElement;
exports.resizeHandlesMap = exports.resizeHandles = void 0;
var _react = require("react");
const FloatingPanelContext = exports.FloatingPanelContext = /*#__PURE__*/(0, _react.createContext)({
  onDrag: () => {},
  onDragStart: () => {},
  onDragEnd: () => {},
  isMoving: false,
  isDocked: false,
  setIsDocked: () => {},
  isCollapsed: false,
  setIsCollapsed: () => {},
  onMoveWithArrows: () => {},
  getPosition: () => ({
    left: 0,
    top: 0,
    width: 0,
    height: 0
  })
});
const MOVE_KEYS = exports.MOVE_KEYS = {
  UP: 'ArrowUp',
  DOWN: 'ArrowDown',
  RIGHT: 'ArrowRight',
  LEFT: 'ArrowLeft'
};
const MOVE_KEYS_VALUES = exports.MOVE_KEYS_VALUES = Object.values(MOVE_KEYS);
const HIGHLIGHTED_CLASSNAME = exports.HIGHLIGHTED_CLASSNAME = 'highlighted';
const resizeHandles = exports.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
}];
const resizeHandlesMap = exports.resizeHandlesMap = new Map(resizeHandles.map(handle => [handle.id, handle]));
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;
}