Liferay.Loader.define("@liferay/object-web@1.0.108/js/components/ModalImportObjectDefinition",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=c(a("@frontend-taglib-clay$clayui/alert")),n=c(a("@frontend-taglib-clay$clayui/button")),r=f(a("@frontend-taglib-clay$clayui/form")),u=f(a("@frontend-taglib-clay$clayui/modal")),i=f(a("liferay!frontend-js-react-web$react"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function c(e){return e&&e.__esModule?e:{default:e}}var d=({importObjectDefinitionURL:e,nameMaxLength:t,portletNamespace:a})=>{const[o,f]=(0,i.useState)(!1),c=(0,i.useRef)(),[d,p]=(0,i.useState)(""),y="".concat(a,"importObjectDefinitionModal"),m="".concat(a,"importObjectDefinitionForm"),s="".concat(a,"name"),g="".concat(a,"objectDefinitionJSON"),[{fileName:b,inputFile:L,inputFileValue:E},v]=(0,i.useState)({}),{observer:j,onClose:O}=(0,u.useModal)({onClose:()=>{f(!1),v({fileName:"",inputFile:null,inputFileValue:""}),p("")}});return(0,i.useEffect)((()=>(Liferay.component(y,{open:()=>{f(!0)}},{destroyOnNavigate:!0}),()=>Liferay.destroyComponent(y))),[y,f]),o?i.default.createElement(u.default,{observer:j},i.default.createElement(u.default.Header,null,Liferay.Language.get("import-object")),i.default.createElement(u.default.Body,null,i.default.createElement(r.default,{action:e,encType:"multipart/form-data",id:m,method:"POST"},i.default.createElement(l.default,{displayType:"info",title:"".concat(Liferay.Language.get("info"),":")},Liferay.Language.get("the-import-process-will-run-in-the-background-and-may-take-a-few-minutes")),i.default.createElement(r.default.Group,null,i.default.createElement("label",{htmlFor:s},Liferay.Language.get("name")),i.default.createElement(r.ClayInput,{id:s,maxLength:Number(t),name:s,onChange:e=>p(e.target.value),type:"text",value:d})),i.default.createElement(r.default.Group,null,i.default.createElement("label",{htmlFor:g},Liferay.Language.get("json-file")),i.default.createElement(r.ClayInput.Group,null,i.default.createElement(r.ClayInput.GroupItem,{prepend:!0},i.default.createElement(r.ClayInput,{disabled:!0,id:g,type:"text",value:b})),i.default.createElement(r.ClayInput.GroupItem,{append:!0,shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>c.current.click()},Liferay.Language.get("select"))),L&&i.default.createElement(r.ClayInput.GroupItem,{shrink:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:()=>{v({fileName:"",inputFile:null,inputFileValue:""})}},Liferay.Language.get("clear"))))),i.default.createElement("input",{className:"d-none",name:g,onChange:({target:e})=>{var t;const a=null===(t=e.files)||void 0===t?void 0:t.item(0);v({fileName:null==a?void 0:a.name,inputFile:a,inputFileValue:e.value})},ref:c,type:"file",value:E}))),i.default.createElement(u.default.Footer,{last:i.default.createElement(n.default.Group,{spaced:!0},i.default.createElement(n.default,{displayType:"secondary",onClick:O},Liferay.Language.get("cancel")),i.default.createElement(n.default,{disabled:!L||!d,form:m,type:"submit"},Liferay.Language.get("import")))})):null};t.default=d}}));
//# sourceMappingURL=ModalImportObjectDefinition.js.map