AUI.add("liferay-search-container",(e=>{const t=e.Lang,s="d-none",o="boundingBox",a=e.Component.create({_cache:{},ATTRS:{id:{value:""}},NAME:"searchcontainer",constructor:function constructor(e){const t=e.id;e.boundingBox=e.boundingBox||"#"+t,e.contentBox=e.contentBox||"#"+e.id+"SearchContainer",a.superclass.constructor.apply(this,arguments)},get(e){const t=this;let s=null;return s=t._cache[e]?t._cache[e]:new a({id:e}).render(),s},prototype:{_addRow(){const e=this;e._parentContainer.show(),e._emptyResultsMessage&&e._emptyResultsMessage.hide()},_deleteRow(){const e=this;let t="show";e._ids.length||(t="hide",e._emptyResultsMessage&&e._emptyResultsMessage.show()),e._parentContainer[t]()},addRow(e,t,o){const a=this;let n;if(t){const i=a._table.one(".d-none");if(i){n=i.previous()?i.previous().clone():i.clone();const r=n.all("> td");r.empty(),e.forEach(((e,t)=>{const s=r.item(t);s&&(s.html(e),o&&o[t]&&s.addClass(o[t]))})),i.placeBefore(n),n.removeClass(s),n.attr("id",a.get("id")+"_"+t),a._ids.push(t)}a.updateDataStore(),a.fire("addRow",{id:t,ids:a._ids,row:n,rowData:e})}return n},bindUI(){const e=this;e.publish("addRow",{defaultFn:e._addRow}),e.publish("deleteRow",{defaultFn:e._deleteRow})},deleteRow(o,a){const n=this;if(t.isNumber(o)||t.isString(o)){let e=null;n._table.all("tr").some(((t,a)=>(t.hasClass(s)||a!==o||(e=t),e))),o=e}else o=e.one(o);if(a){const e=n._ids.indexOf(a.toString());e>-1&&(n._ids.splice(e,1),n.updateDataStore())}n.fire("deleteRow",{id:a,ids:n._ids,row:o}),o&&("tr"!==o.get("nodeName").toLowerCase()&&(o=o.ancestor("tr")),setTimeout((()=>{o.remove(!0)}),0))},executeAction(e,t){const s=this;s._actions[e]&&s._actions[e](t)},getData(e){let t=this._ids;return e||(t=t.join(",")),t},getForm(){return this.get(o).ancestor("form")},getSize(){return this._ids.length},initializer(){const e=this;e._ids=[],e._actions={},a.register(e)},registerAction(e,t){this._actions[e]=t},renderUI(){const t=this,s=t.get("id"),a=t.get(o);if(t._dataStore=e.one("#"+s+"PrimaryKeys"),t._emptyResultsMessage=e.one("#"+s+"EmptyResultsMessage"),t._dataStore){const e=t._dataStore.attr("form");if(e){const s=e.attr("method").toLowerCase();s&&"get"===s&&(t._dataStore=null)}}t._table=a.one("table"),t._parentContainer=a.ancestor(".lfr-search-container-wrapper"),t._table&&t._table.setAttribute("data-searchContainerId",s)},syncUI(){const e=this,t=e._dataStore;let s=t&&t.val();s&&(s=s.split(","),e.updateDataStore(s))},updateDataStore(e){const t=this;e&&("string"==typeof e&&(e=e.split(",")),t._ids=e);const s=t._dataStore;s&&s.val(t._ids.join(","))}},register(e){const t=e.get("id");this._cache[t]=e,Liferay.component(t,e,{destroyOnNavigate:!0}),Liferay.fire("search-container:registered",{searchContainer:e})}});Liferay.SearchContainer=a}),"",{requires:["aui-base","aui-component"]});
//# sourceMappingURL=search_container.js.map