Liferay.Loader.define("journal-web@5.0.105/js/configuration/icon/ImportScript",["module","exports","require","frontend-js-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function _default({namespace:e}){const t=document.getElementById("".concat(e,"importScript")),r=document.getElementById("".concat(e,"importScriptInput")),onButtonClick=()=>{r.click()};t.addEventListener("click",onButtonClick);const onChange=t=>{const r=t.target,[n]=r.files||[];n?n.text().then((t=>{t?Liferay.fire("".concat(e,"scriptImported"),{fileName:n.name,script:t}):showInvalidFileError()})).catch((()=>{showInvalidFileError()})).finally((()=>{r.value=""})):(r.value="",showInvalidFileError())};return r.addEventListener("change",onChange),{dispose(){t.removeEventListener("click",onButtonClick),r.removeEventListener("change",onChange)}}};var n=r("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