import _extends from "@babel/runtime/helpers/esm/extends";
var defaultRect = {
  top: -1000,
  left: -1000,
  right: -1000,
  bottom: -1000,
  width: 0,
  height: 0
};
export var getRect = function getRect(ref) {
  if (!ref || !ref.current) return defaultRect;
  var rect = ref.current.getBoundingClientRect();
  return _extends({}, rect, {
    width: rect.width || rect.right - rect.left,
    height: rect.height || rect.bottom - rect.top,
    top: rect.top + document.documentElement.scrollTop,
    bottom: rect.bottom + document.documentElement.scrollTop,
    left: rect.left + document.documentElement.scrollLeft,
    right: rect.right + document.documentElement.scrollLeft
  });
};

// export const getRect = (
//   ref: RefObject<HTMLElement | null>
// ): ReactiveDomReact => {
//   console.log('Parent Current', ref?.current);
//   if (!ref?.current) return defaultRect

//   const rect = ref.current.getBoundingClientRect()

//   return {
//     top: rect.top,
//     left: rect.left,
//     right: rect.right,
//     bottom: rect.bottom,
//     width: rect.width,
//     height: rect.height,
//   }
// }