Liferay.Loader.define("@liferay/template-web@1.0.51/js/ddm_template_editor/components/ElementsSidebarPanel",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/empty-state","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./AppContext","./ButtonList","./CollapsableButtonList"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ElementsSidebarPanel=function ElementsSidebarPanel({className:t}){const{inputChannel:a,templateVariableGroups:p}=(0,c.useContext)(u.AppContext),d=(0,c.useMemo)((()=>p.map((e=>_objectSpread(_objectSpread({},e),{},{items:e.items.map((e=>e.repeatable?_objectSpread(_objectSpread({},e),{},{label:"".concat(e.label,"*")}):e))})))),[p]),onButtonClick=e=>a.sendData(e.content),[y,m]=(0,c.useState)(""),b=(0,c.useMemo)((()=>{const slugify=e=>e.toLowerCase().replace(/\s/g,""),e=slugify(y);return e?d.map((({items:t})=>t.filter((t=>slugify(t.label).includes(e))))).reduce(((e,t)=>e.concat(t)),[]):null}),[y,d]);return c.default.createElement("div",{className:(0,i.default)(t,"px-3")},c.default.createElement("h1",{className:"ddm_template_editor__App-sidebar-title my-3"},Liferay.Language.get("elements")),c.default.createElement(l.default.Group,{className:"mb-4",small:!0},c.default.createElement("label",{className:"sr-only",htmlFor:e},Liferay.Language.get("search")),c.default.createElement(l.ClayInput.Group,null,c.default.createElement(l.ClayInput.GroupItem,null,c.default.createElement(l.ClayInput,{id:e,insetAfter:!0,onChange:e=>m(e.target.value),placeholder:"".concat(Liferay.Language.get("search"),"..."),value:y}),c.default.createElement(l.ClayInput.GroupInsetItem,{after:!0,tag:"span"},y?c.default.createElement(r.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("clear"),borderless:!0,displayType:"secondary",monospaced:!1,onClick:()=>m(""),symbol:y?"times":"search",title:Liferay.Language.get("clear")}):c.default.createElement(o.default,{className:"search-icon",symbol:"search"}))))),b?0!==b.length?c.default.createElement(s.ButtonList,{items:b,onButtonClick:onButtonClick}):c.default.createElement(n.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")}):d.map((({items:e,label:t})=>c.default.createElement(f.CollapsableButtonList,{items:e,key:t,label:t,onButtonClick:onButtonClick}))))};var r=a("@frontend-taglib-clay$clayui/button"),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/empty-state")),l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),o=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),i=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),c=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),u=a("./AppContext"),s=a("./ButtonList"),f=a("./CollapsableButtonList");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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e="ddm_template_editor_Sidebar-SearchInputId"}}));
//# sourceMappingURL=ElementsSidebarPanel.js.map