Liferay.Loader.define("@liferay/document-library-web@6.0.111/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(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)))),c=r.length>e;if(o.length||c)return g({crossedFileCountLimit:c,digitalSignaturePortlet:n,invalidFileExtensions:o,validFileExtensionEntryIds:r});s(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)},o=e=>"".concat((0,a.sub)(Liferay.Language.get("these-file-extensions-are-not-supported-by-docusign-and-have-been-x"),c(i.deselected)),'\n\n\t<p class="mt-2">').concat((0,a.sub)(Liferay.Language.get("please-x-or-x-to-choose-new-documents"),c(i.continue),c(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>"),l=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"),c(i.continue),c(i.cancel)),"</div>"):"","\n\t</div>"),r=(e,t)=>{let n="";return e&&(n+=l(!t.length)),t.length&&(n+=o(t)),n},s=(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()),c=e=>"<strong>".concat(e.toLowerCase(),"</strong>"),g=({crossedFileCountLimit:t,digitalSignaturePortlet:n,invalidFileExtensions:i,validFileExtensionEntryIds:o})=>(0,a.openModal)({bodyHTML:r(t,i),buttons:[{displayType:"secondary",label:Liferay.Language.get("cancel"),type:"cancel"},{label:Liferay.Language.get("continue"),onClick:()=>s(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