Liferay.Loader.define("@liferay/document-library-web@6.0.154/document_library/js/digital-signature/DigitalSignatureUtil",["module","exports","require","frontend-js-web"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.collectDigitalSignature=async function collectDigitalSignature(t,n){const i=await(0,a.fetch)((0,a.createResourceURL)(themeDisplay.getLayoutRelativeControlPanelURL(),{p_p_id:n,p_p_resource_id:"/digital_signature/get_invalid_file_extensions"}),{body:(0,a.objectToFormData)({["_".concat(n,"_fileEntryIds")]:t}),method:"POST"}),o=await i.json(),l=o.map((({fileEntryId:e})=>e)),r=t.filter((e=>!l.includes(Number(e)))),s=r.length>e;if(o.length||s)return _showWarningModal({crossedFileCountLimit:s,digitalSignaturePortlet:n,invalidFileExtensions:o,validFileExtensionEntryIds:r});_navigateToCollectDigitalSignature(n,t.length>1?t.join(","):t[0])};var a=n("frontend-js-web");const e=10,i={cancel:Liferay.Language.get("cancel"),continue:Liferay.Language.get("continue"),deselected:Liferay.Language.get("deselected"),maximum_files_message:(0,a.sub)(Liferay.Language.get("maximum-of-x-files-per-envelope"),e)},_invalidFileExtensionContent=e=>"".concat((0,a.sub)(Liferay.Language.get("these-file-extensions-are-not-supported-by-docusign-and-have-been-x"),_translatedStrongKeys(i.deselected)),'\n\n\t<p class="mt-2">').concat((0,a.sub)(Liferay.Language.get("please-x-or-x-to-choose-new-documents"),_translatedStrongKeys(i.continue),_translatedStrongKeys(i.cancel)),"</p>\n\t\n\t<ul>\n\t\t").concat(e.map((({fileName:e})=>'<li class="font-weight-bold">'.concat(e,"</li>"))).join(" "),"\n\t</ul>"),_invalidFileCountContent=t=>'<div class="alert alert-warning">\n\t\t'.concat((0,a.sub)(Liferay.Language.get("you-have-exceeded-the-maximum-amount-of-x-files-allowed-per-envelope"),e),"\n\n\t\t").concat(t?'<div class="mt-2">'.concat((0,a.sub)(Liferay.Language.get("please-x-or-x-to-remove-files-in-your-envelope"),_translatedStrongKeys(i.continue),_translatedStrongKeys(i.cancel)),"</div>"):"","\n\t</div>"),_composeBodyHTML=(e,t)=>{let n="";return e&&(n+=_invalidFileCountContent(!t.length)),t.length&&(n+=_invalidFileExtensionContent(t)),n},_navigateToCollectDigitalSignature=(e,t)=>(0,a.navigate)((0,a.createPortletURL)(themeDisplay.getLayoutRelativeControlPanelURL(),{backURL:window.location.href,fileEntryId:t,mvcRenderCommandName:"/digital_signature/collect_digital_signature",p_p_id:e}).toString()),_translatedStrongKeys=e=>"<strong>".concat(e.toLowerCase(),"</strong>"),_showWarningModal=({crossedFileCountLimit:t,digitalSignaturePortlet:n,invalidFileExtensions:i,validFileExtensionEntryIds:o})=>(0,a.openModal)({bodyHTML:_composeBodyHTML(t,i),buttons:[{displayType:"secondary",label:Liferay.Language.get("cancel"),type:"cancel"},{label:Liferay.Language.get("continue"),onClick:()=>_navigateToCollectDigitalSignature(n,o),type:"button"}],status:"warning",title:i.length?Liferay.Language.get("file-extensions-not-supported"):(0,a.sub)(Liferay.Language.get("maximum-of-x-files-per-envelope"),e)})}}));
//# sourceMappingURL=DigitalSignatureUtil.js.map