Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.145/page_editor/plugins/page-content/components/PageContents",["module","exports","require","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../app/config/constants/contentTypeLabels","../../../common/components/SearchResultsMessage","./ContentFilter","./ContentList"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function PageContents({pageContents:e}){const[t,n]=(0,r.useState)(""),[i,u]=(0,r.useState)(null),f=Object.keys(e),s=f.includes(o.CONTENT_TYPE_LABELS.collection)?[o.CONTENT_TYPE_LABELS.allContent,o.CONTENT_TYPE_LABELS.collection,...f.filter((e=>e!==o.CONTENT_TYPE_LABELS.collection))]:[o.CONTENT_TYPE_LABELS.allContent,...f],p=(0,r.useMemo)((()=>t?Object.entries(e).reduce(((e,[n,r])=>{const o=r.filter((e=>-1!==e.title.toLowerCase().indexOf(t.toLowerCase())));return o.length?_objectSpread(_objectSpread({},e),{[n]:o}):e}),{}):e),[e,t]),d=(0,r.useMemo)((()=>p!==e||i?(p[i]||Object.values(p).flatMap((e=>e))).length:null),[p,i,e]);return r.default.createElement(r.default.Fragment,null,r.default.createElement(c.default,{contentTypes:s,onChangeInput:n,onChangeSelect:u,selectedType:i||o.CONTENT_TYPE_LABELS.allContent}),r.default.createElement(l.default,{contents:p,selectedType:i}),r.default.createElement(a.default,{numberOfResults:d}))};_interopRequireDefault(n("liferay!frontend-js-react-web$prop-types"));var r=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 n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=r?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),o=n("../../../app/config/constants/contentTypeLabels"),a=_interopRequireDefault(n("../../../common/components/SearchResultsMessage")),c=_interopRequireDefault(n("./ContentFilter")),l=_interopRequireDefault(n("./ContentList"));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}}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}}}));
//# sourceMappingURL=PageContents.js.map