Liferay.Loader.define("@liferay/document-library-web@6.0.154/document_library/js/DocumentLibrary",["module","exports","require","frontend-js-web"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function DocumentLibrary(t){let n,{editEntryUrl:r,namespace:a,searchContainerId:c,selectFolderURL:l}=t,i=function _objectWithoutProperties(e,t){if(null==e)return{};var n,o,r=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(t,["editEntryUrl","namespace","searchContainerId","selectFolderURL"]);const d=document["".concat(a,"fm2")],m=document.getElementById("".concat(a,"entriesContainer"));let s;Liferay.componentReady("".concat(a).concat(c)).then((e=>{n=e,n.registerAction("move-to-folder",_moveToFolder),n.registerAction("move-to-trash",_moveToTrash),n.on("rowToggled",_handleSearchContainerRowToggled)})),i.uploadable&&e&&themeDisplay.isSignedIn()&&m&&(i.appViewEntryTemplates=document.getElementById("".concat(a,"appViewEntryTemplates")),document.addEventListener("dragenter",_plugUpload,{once:!0}));function _handleSearchContainerRowToggled(){const e=n.select&&n.select.get("bulkSelection");d.elements["".concat(a,"selectAll")].value=e}function _moveCurrentSelection(e){d.action=r,d.method="POST",d.enctype="multipart/form-data",d.elements["".concat(a,"cmd")].value="move",d.elements["".concat(a,"newFolderId")].value=e,submitForm(d,r,!1)}function _moveToFolder(e){const t=e.targetItem,o=e.selectedItems,r=t.attr("data-folder-id");r&&(n.select&&!o.indexOf(t.one("input[type=checkbox]"))||_moveCurrentSelection(r))}function _moveToTrash(){const e="move_to_trash";d.elements["".concat(a,"javax-portlet-action")]?d.elements["".concat(a,"javax-portlet-action")].value=e:d.elements["".concat(a,"cmd")].value=e,submitForm(d,r,!1)}function _plugUpload(){AUI().use("document-library-upload-component",(()=>{s=new Liferay.DocumentLibraryUploadComponent({appViewEntryTemplates:i.appViewEntryTemplates,columnNames:i.columnNames,displayStyle:i.displayStyle,documentLibraryNamespace:a,entriesContainer:m,folderId:i.defaultParentFolderId,maxFileSize:i.maxFileSize,redirect:encodeURIComponent(i.redirect),scopeGroupId:i.scopeGroupId,uploadURL:i.uploadURL,viewFileEntryURL:i.viewFileEntryURL})}))}return window["".concat(a,"move")]=function(e,t,n){const c=1===e?Liferay.Language.get("select-destination-folder-for-x-item"):Liferay.Language.get("select-destination-folder-for-x-items");(0,o.openSelectionModal)({height:"480px",id:a,onSelect:e=>{t&&n?function _moveSingleElement(e,t,n){const c=document.createElement("div");c.appendChild((0,o.buildFragment)('<form action="'.concat(r,'" class="hide" method="POST">\n\t\t\t\t\t<input name="').concat(a,'cmd" value="move"/>\n\t\t\t\t\t<input name="').concat(a,'newFolderId" value="').concat(e,'"/>\n\t\t\t\t\t<input name="').concat(a).concat(t,'" value="').concat(n,'"/>\n\t\t\t\t</form>')));const l=c.firstElementChild;d.append(l),submitForm(l,r,!1)}(e.folderid,t,n):_moveCurrentSelection(e.folderid)},selectEventName:"".concat(a,"selectFolder"),size:"lg",title:(0,o.sub)(c,[e]),url:l})},{dispose(){var e;document.removeEventListener("dragenter",_plugUpload),null===(e=s)||void 0===e||e.destroy()}}};var o=n("frontend-js-web");const e=window&&window.File&&window.FormData&&window.XMLHttpRequest}}));
//# sourceMappingURL=DocumentLibrary.js.map