Liferay.Loader.define("journal-web@5.0.144/js/ai_creator/AICreatorModal",["module","exports","require","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/link","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$react","./ErrorMessage","./FormContent","./FormFooter","./LoadingMessage","./TextContent"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.AICreatorModal=function AICreatorModal({namespace:e,onClose:t}){const{observer:r,onClose:s}=(0,l.useModal)({defaultOpen:!0,onClose:t}),[y,p]=(0,o.useState)({type:"idle"});return o.default.createElement(l.default,{observer:r,size:"lg"},o.default.createElement(l.default.Header,null,Liferay.Language.get("ai-creator")),"loading"===y.type?o.default.createElement(c.LoadingMessage,null):null,o.default.createElement(a.default,{onSubmit:e=>{e.preventDefault(),p({type:"loading"}),setTimeout((()=>{Math.random()<.5?p({text:"Random result",type:"success"}):p({errorMessage:"Random error",type:"error"})}),3e3)}},o.default.createElement("fieldset",{className:"loading"===y.type?"sr-only":"",disabled:"loading"===y.type},"error"===y.type?o.default.createElement(u.ErrorMessage,null):null,o.default.createElement(l.default.Body,null,o.default.createElement(i.FormContent,{namespace:e}),"success"===y.type?o.default.createElement(f.TextContent,{content:y.text,namespace:e}):null,o.default.createElement(a.default.Group,null,o.default.createElement(n.default,{href:"#"},Liferay.Language.get("learn-more-about-openai-integration")))),o.default.createElement(l.default.Footer,{last:o.default.createElement(d.FormFooter,{onAdd:()=>{alert(JSON.stringify(y,null,2))},onClose:s,showAddButton:"success"===y.type&&Boolean(y.text),showCreateButton:"idle"===y.type||"error"===y.type,showRetryButton:"success"===y.type})}))))};var a=_interopRequireDefault(r("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/link")),l=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/modal")),o=_interopRequireWildcard(r("liferay!frontend-js-react-web$react")),u=r("./ErrorMessage"),i=r("./FormContent"),d=r("./FormFooter"),c=r("./LoadingMessage"),f=r("./TextContent");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=AICreatorModal.js.map