Liferay.Loader.define("layout-content-page-editor-web@2.0.170/page_editor/plugins/fragments-widgets/components/TabCollection", ['module', 'exports', 'require', 'frontend-js-react-web$prop-types', 'frontend-js-react-web$react', '../../../common/components/Collapse', './TabItem'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = TabCollection;

    var _propTypes = _interopRequireDefault(require("frontend-js-react-web$prop-types"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _Collapse = _interopRequireDefault(require("../../../common/components/Collapse"));

    var _TabItem = _interopRequireDefault(require("./TabItem"));

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

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    function TabCollection(_ref) {
      var collection = _ref.collection,
          isSearchResult = _ref.isSearchResult,
          open = _ref.open;
      return (/*#__PURE__*/_react.default.createElement(_Collapse.default, {
          key: collection.collectionId,
          label: collection.label,
          open: isSearchResult || open
        }, collection.collections && collection.collections.map(function (collection, index) {
          return (/*#__PURE__*/_react.default.createElement(TabCollection, {
              collection: collection,
              isSearchResult: isSearchResult,
              key: index
            })
          );
        }), /*#__PURE__*/_react.default.createElement("ul", {
          className: "list-unstyled"
        }, collection.children.map(function (item) {
          var _item$portletItems;

          return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
              key: item.itemId
            }, /*#__PURE__*/_react.default.createElement(_TabItem.default, {
              item: item,
              key: item.itemId
            }), ((_item$portletItems = item.portletItems) === null || _item$portletItems === void 0 ? void 0 : _item$portletItems.length) && /*#__PURE__*/_react.default.createElement(TabPortletItems, {
              item: item
            }))
          );
        })))
      );
    }

    TabCollection.proptypes = {
      collection: _propTypes.default.shape({
        children: _propTypes.default.array,
        collectionId: _propTypes.default.string,
        label: _propTypes.default.string
      }).isRequired,
      isSearchResult: _propTypes.default.bool,
      open: _propTypes.default.bool
    };

    var TabPortletItems = function TabPortletItems(_ref2) {
      var item = _ref2.item;
      return (/*#__PURE__*/_react.default.createElement("ul", {
          className: "list-unstyled"
        }, item.portletItems.map(function (portlet, index) {
          return (/*#__PURE__*/_react.default.createElement(_TabItem.default, {
              item: portlet,
              key: index
            })
          );
        }))
      );
    };

    TabPortletItems.proptypes = {
      data: _propTypes.default.shape({
        instanceable: _propTypes.default.bool,
        portletId: _propTypes.default.string,
        portletItemId: _propTypes.default.string,
        used: _propTypes.default.bool
      }).isRequired,
      disabled: _propTypes.default.bool,
      icon: _propTypes.default.string,
      itemId: _propTypes.default.string,
      label: _propTypes.default.string,
      portletItems: _propTypes.default.array,
      preview: _propTypes.default.string,
      type: _propTypes.default.string
    };
    //# sourceMappingURL=TabCollection.js.map
  }
});
//# sourceMappingURL=TabCollection.js.map