Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.141/page_editor/app/components/layout-data-items/CollectionWithControls",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../../core/hooks/useSetRef","../../../prop-types/index","../../config/constants/layoutDataItemTypes","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getLayoutDataItemTopperUniqueClassName","../../utils/getResponsiveConfig","../topper/Topper","./Collection","./isHovered"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=_interopRequireDefault(r("liferay!frontend-js-react-web$classnames")),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var a=o?Object.getOwnPropertyDescriptor(e,n):null;a&&(a.get||a.set)?Object.defineProperty(r,n,a):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),a=_interopRequireDefault(r("../../../core/hooks/useSetRef")),i=(r("../../../prop-types/index"),r("../../config/constants/layoutDataItemTypes")),l=r("../../contexts/ControlsContext"),u=r("../../contexts/StoreContext"),s=_interopRequireDefault(r("../../utils/getLayoutDataItemTopperUniqueClassName")),c=r("../../utils/getResponsiveConfig"),f=_interopRequireDefault(r("../topper/Topper")),d=_interopRequireDefault(r("./Collection")),p=_interopRequireDefault(r("./isHovered"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var y=n.default.forwardRef((({children:e,item:t},r)=>{const[i,l]=(0,n.useState)(!1),[p,y]=(0,a.default)(r),m=(0,u.useSelector)((e=>e.selectedViewportSize)),g=(0,c.getResponsiveConfig)(t.config,m),{display:_}=g.styles;return n.default.createElement(n.default.Fragment,null,n.default.createElement(HoverHandler,{hovered:i,item:t,setHovered:l}),n.default.createElement(f.default,{className:(0,o.default)((0,s.default)(t.itemId),{"page-editor__topper--hovered":i}),item:t,itemElement:y,style:{display:_}},n.default.createElement(d.default,{item:t,ref:p},e)))}));t.default=y;const HoverHandler=({hovered:e,item:t,setHovered:r})=>{const o=(0,l.useHoveredItemType)(),a=(0,l.useHoveredItemId)();return(0,n.useEffect)((()=>{if(t.type===i.LAYOUT_DATA_ITEM_TYPES.collection&&"collection"in t.config){const n=(0,p.default)({editableValue:t.config.collection,hoveredItemId:a,hoveredItemType:o});e!==n&&r(n)}}),[t,a,o,r,e]),null}}}));
//# sourceMappingURL=CollectionWithControls.js.map