import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import "core-js/modules/es.symbol.js";
import "core-js/modules/es.array.filter.js";
import "core-js/modules/es.array.for-each.js";
import "core-js/modules/es.array.push.js";
import "core-js/modules/es.number.constructor.js";
import "core-js/modules/es.number.is-nan.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.object.define-properties.js";
import "core-js/modules/es.object.define-property.js";
import "core-js/modules/es.object.get-own-property-descriptor.js";
import "core-js/modules/es.object.get-own-property-descriptors.js";
import "core-js/modules/es.object.keys.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.regexp.test.js";
import "core-js/modules/esnext.iterator.constructor.js";
import "core-js/modules/esnext.iterator.filter.js";
import "core-js/modules/esnext.iterator.for-each.js";
import "core-js/modules/web.dom-collections.for-each.js";
import React, { useEffect, useRef } from 'react';
import classnames from 'classnames';
import './index.css';
import { jsx as _jsx } from "react/jsx-runtime";
var FcrDivider = function FcrDivider(_ref) {
  var _ref$type = _ref.type,
    type = _ref$type === void 0 ? 'vertical' : _ref$type,
    _ref$text = _ref.text,
    text = _ref$text === void 0 ? '' : _ref$text,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    className = _ref.className,
    children = _ref.children,
    size = _ref.size;
  var selectorRef = useRef(null);
  useEffect(function () {
    var _selectorRef$current;
    size && ((_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.style.setProperty('--divider-size', /p[x|t|c]|[e|m|c]m|rem|v[h|w]|%/.test(size) ? size : Number.isNaN(Number(size)) ? '1px' : size + 'px'));
  }, []);
  return /*#__PURE__*/_jsx("div", {
    ref: selectorRef,
    className: "divider ".concat(classnames("divider-".concat(type), className)),
    style: _objectSpread({}, style),
    children: text ? /*#__PURE__*/_jsx("span", {
      className: "divider-text",
      children: text
    }) : children && typeof children === 'string' && /*#__PURE__*/_jsx("span", {
      className: "divider-text",
      children: children
    })
  });
};
export default FcrDivider;