Liferay.Loader.define("journal-web@5.0.151/js/SelectFolder",["module","exports","require","@frontend-taglib-clay$clayui/core","@frontend-taglib-clay$clayui/empty-state","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a("@frontend-taglib-clay$clayui/core"),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/empty-state")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),u=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),c=a("frontend-js-web"),o=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function FolderTree({filterQuery:e,handleSelectionChange:t,items:a}){const[n,i]=(0,o.useState)(a),c=(0,o.useMemo)((()=>e?((e,t)=>e.reduce((function reducer(e,a){var r;return(null===(r=a.name)||void 0===r?void 0:r.toLowerCase().includes(t.toLowerCase()))?e.push(a):a.children&&e.concat(a.children.reduce(reducer,e)),e}),[]))(n,e):n),[n,e]),_onClick=(e,a)=>{e.preventDefault(),t(a)},_onKeyUp=(e,a)=>{" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),t(a))};return c.length?o.default.createElement(r.TreeView,{items:c,onItemsChange:i,showExpanderOnHover:!1},(e=>o.default.createElement(r.TreeView.Item,null,o.default.createElement(r.TreeView.ItemStack,{onClick:t=>_onClick(t,e),onKeyUp:t=>_onKeyUp(t,e)},o.default.createElement(u.default,{symbol:"folder"}),e.name),o.default.createElement(r.TreeView.Group,{items:e.children},(e=>o.default.createElement(r.TreeView.Item,{onClick:t=>_onClick(t,e),onKeyUp:t=>_onKeyUp(t,e)},o.default.createElement(u.default,{symbol:"folder"}),e.name)))))):o.default.createElement(l.default,{description:Liferay.Language.get("try-again-with-a-different-search"),imgSrc:"".concat(themeDisplay.getPathThemeImages(),"/states/search_state.gif"),small:!0,title:Liferay.Language.get("no-results-found")})}var _default=({itemSelectorSaveEvent:e,nodes:t})=>{const[a,r]=(0,o.useState)("");return o.default.createElement(i.default.ContainerFluid,{className:"p-4 select-folder"},o.default.createElement(n.default.Group,null,o.default.createElement(n.ClayInput.Group,null,o.default.createElement(n.ClayInput.GroupItem,{prepend:!0},o.default.createElement(n.ClayInput,{"aria-label":Liferay.Language.get("search"),className:"input-group-inset input-group-inset-after",onChange:e=>r(e.target.value),placeholder:"".concat(Liferay.Language.get("search")),type:"text"}),o.default.createElement(n.ClayInput.GroupInsetItem,{after:!0},o.default.createElement("div",{className:"link-monospaced"},o.default.createElement(u.default,{symbol:"search"})))))),o.default.createElement(FolderTree,{filterQuery:a,handleSelectionChange:t=>{(0,c.getOpener)().Liferay.fire(e,{data:{folderId:t.id,folderName:t.name}})},items:t}))};t.default=_default}}));
//# sourceMappingURL=SelectFolder.js.map