Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/plugins/comments/components/FragmentEntryLinksWithComments",["module","exports","require","frontend-js-web","liferay!frontend-js-react-web$react","../../../app/config/constants/layoutDataItemTypes","../../../app/contexts/ControlsContext","../../../app/contexts/StoreContext","../../../common/components/SidebarPanelHeader","./NoCommentsMessage","./ResolvedCommentsToggle"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function FragmentEntryLinksWithComments(){const e=(0,s.useSelector)((e=>Object.values(e.layoutData.items).filter((e=>e.type===a.LAYOUT_DATA_ITEM_TYPES.fragment)).map((t=>[t,e.fragmentEntryLinks[t.config.fragmentEntryLinkId]])).map((([t,n])=>[t,_objectSpread(_objectSpread({},n),{},{comments:(n.comments||[]).filter((({resolved:t})=>e.showResolvedComments&&t||!t))})])).filter((([,e])=>e.comments.length))));return o.default.createElement(o.default.Fragment,null,o.default.createElement(m.default,null,Liferay.Language.get("comments")),o.default.createElement(c.default,null),e.length?o.default.createElement("nav",{className:"list-group mb-0 overflow-auto page-editor__fragments-with-comments"},e.map((([e,t])=>o.default.createElement(FragmentEntryLinkWithComments,{fragmentEntryLink:t,item:e,key:t.fragmentEntryLinkId})))):o.default.createElement(i.default,null))};var r=n("frontend-js-web"),o=_interopRequireDefault(n("liferay!frontend-js-react-web$react")),a=n("../../../app/config/constants/layoutDataItemTypes"),l=n("../../../app/contexts/ControlsContext"),s=n("../../../app/contexts/StoreContext"),m=_interopRequireDefault(n("../../../common/components/SidebarPanelHeader")),i=_interopRequireDefault(n("./NoCommentsMessage")),c=_interopRequireDefault(n("./ResolvedCommentsToggle"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FragmentEntryLinkWithComments({fragmentEntryLink:e,item:t}){const n=(0,l.useSelectItem)(),a=(0,l.useHoverItem)();return o.default.createElement("button",{"aria-label":Liferay.Language.get("show-comments"),className:"border-0 flex-shrink-0 list-group-item list-group-item-action",onClick:()=>n(t.itemId),onFocus:()=>a(t.itemId),onMouseOut:()=>a(null),onMouseOver:()=>a(t.itemId),type:"button"},o.default.createElement("strong",{className:"d-block text-dark"},e.name),o.default.createElement("span",{className:"text-secondary"},(0,r.sub)(1===e.comments.length?Liferay.Language.get("x-comment"):Liferay.Language.get("x-comments"),e.comments.length)))}}}));
//# sourceMappingURL=FragmentEntryLinksWithComments.js.map