"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getOffsetWH = getOffsetWH;
exports.getOffsetLT = getOffsetLT;
exports.isTransformSupported = isTransformSupported;
exports.toArray = toArray;
exports.triggerEvents = void 0;

var _react = _interopRequireDefault(require("react"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var triggerEvents = {
  CLICK: 'click',
  HOVER: 'hover'
};
exports.triggerEvents = triggerEvents;

function getOffsetWH(node, tabPosition) {
  var prop = 'width';

  if (tabPosition === 'left' || tabPosition === 'right') {
    prop = 'height';
  }

  return node ? node.getBoundingClientRect()[prop] : 0;
}

function getOffsetLT(node, tabPosition) {
  var prop = 'left';

  if (tabPosition === 'left' || tabPosition === 'right') {
    prop = 'top';
  }

  return node.getBoundingClientRect()[prop];
}

function isTransformSupported(style) {
  return 'transform' in style || 'webkitTransform' in style || 'MozTransform' in style;
}

function toArray(children) {
  var ret = [];

  _react["default"].Children.forEach(children, function (child, index) {
    if (_react["default"].isValidElement(child)) {
      ret.push(_react["default"].cloneElement(child, {
        key: child.key || index
      }));
    }
  });

  return ret;
}