Liferay.Loader.define("journal-web@5.0.146/js/configuration/icon/ImportScript",["module","exports","require","frontend-js-web"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=function _default({namespace:e}){const r=document.getElementById("".concat(e,"importScriptInput"));Liferay.Util.setPortletConfigurationIconAction("".concat(e,"journalDDMTemplateImportScript"),(()=>{r.click()}));const onChange=r=>{const t=r.target,[n]=t.files||[];n?n.text().then((r=>{r?Liferay.fire("".concat(e,"scriptImported"),{fileName:n.name,script:r}):showInvalidFileError()})).catch((()=>{showInvalidFileError()})).finally((()=>{t.value=""})):(t.value="",showInvalidFileError())};return r.addEventListener("change",onChange),{dispose(){r.removeEventListener("change",onChange)}}};var n=t("frontend-js-web");function showInvalidFileError(){(0,n.openToast)({message:Liferay.Language.get("an-unexpected-error-occurred-while-importing-the-script"),title:Liferay.Language.get("error"),type:"danger"})}}}));
//# sourceMappingURL=ImportScript.js.map