Liferay.Loader.define("@liferay/template-web@1.0.51/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,"importScriptInput"));Liferay.Util.setPortletConfigurationIconAction("".concat(e,"templateImportScript"),(()=>{t.click()}));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 t.addEventListener("change",onChange),{dispose(){t.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