"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _flex = _interopRequireDefault(require("../../../components/templates/flex"));
var _excluded = ["children", "subTabs"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
var Tabs = function Tabs(_ref) {
  var children = _ref.children,
    subTabs = _ref.subTabs,
    rest = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _useState = (0, _react.useState)(false),
    collapsed = _useState[0],
    setCollapsed = _useState[1];
  var ref = (0, _react.useRef)();
  return /*#__PURE__*/_react["default"].createElement(_flex["default"], {
    column: true,
    width: "100%",
    position: "relative"
  }, /*#__PURE__*/_react["default"].createElement(_flex["default"], {
    height: "1px",
    background: "border",
    width: "100%",
    position: "absolute",
    top: 0,
    zIndex: 4
  }), /*#__PURE__*/_react["default"].createElement(_flex["default"], _extends({
    justifyContent: "start",
    alignSelf: "start",
    alignItems: "end",
    width: "100%",
    height: "100%",
    overflow: "auto",
    background: "topBarBg",
    ref: ref,
    zIndex: 1
  }, rest), _react["default"].Children.map(children, function (child) {
    return /*#__PURE__*/_react["default"].cloneElement(child, {
      collapsed: collapsed,
      onResize: setCollapsed,
      parentRef: ref
    });
  })), subTabs && /*#__PURE__*/_react["default"].cloneElement(subTabs, {
    collapsed: collapsed
  }), /*#__PURE__*/_react["default"].createElement(_flex["default"], {
    height: "1px",
    background: "border",
    width: "100%",
    position: "absolute",
    bottom: 0,
    zIndex: 0
  }));
};
var _default = exports["default"] = Tabs;