Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/modal/Modal",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../utils/eventsDefinitions","../utils/iframes","../utils/index","../utils/modals/constants","../utils/modals/index"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=y(a("@frontend-taglib-clay$clayui/loading-indicator")),l=c(a("@frontend-taglib-clay$clayui/modal")),n=(y(a("liferay!frontend-js-react-web$prop-types")),c(a("liferay!frontend-js-react-web$react"))),i=a("../utils/eventsDefinitions"),o=a("../utils/iframes"),s=a("../utils/index"),f=a("../utils/modals/constants"),u=a("../utils/modals/index");function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function c(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function y(e){return e&&e.__esModule?e:{default:e}}var m=function({id:e,onClose:t,status:a,title:d,url:c}){const[y,m]=(0,n.useState)(!1),[L,O]=(0,n.useState)(!1),[b,p]=(0,n.useState)(null),[_,g]=(0,n.useState)(d),[v,M]=(0,n.useState)(c),[E,I]=(0,n.useState)(f.INITIAL_MODAL_SIZE),D=(0,n.useCallback)((e=>{b?b(e):t&&t(e),O(!1),m(!1)}),[b,t]),{observer:w,onClose:A}=(0,l.useModal)({onClose:D});return(0,n.useEffect)((()=>{function t(t){e!==t.id||y||(0,o.isPageInIframe)()||(O(!0),m(!0),t.url&&M(t.url),t.onClose&&p((()=>t.onClose)),t.title&&g(t.title),t.size||I(f.INITIAL_MODAL_SIZE))}function a({redirectURL:e="",successNotification:t={},willIframeRefresh:a=!0}){y&&(e?(0,s.liferayNavigate)(e):a?A(t):D(t))}function r(e){const{isLoading:t}=e;O(t||!1)}function l(){Liferay.detach(i.OPEN_MODAL,t),Liferay.detach(i.CLOSE_MODAL,a),Liferay.detach(i.IS_LOADING_MODAL,r),Liferay.detach("destroyPortlet",l)}return Liferay.on&&(Liferay.on(i.OPEN_MODAL,t),Liferay.on(i.CLOSE_MODAL,a),Liferay.on(i.IS_LOADING_MODAL,r),Liferay.on("destroyPortlet",l)),()=>l()}),[e,A,y,D]),(0,n.useEffect)((()=>{p((()=>b))}),[b]),n.default.createElement(n.default.Fragment,null,y&&n.default.createElement(l.default,{className:"clay-modal fds-modal",observer:w,size:E,status:a},_&&n.default.createElement(l.default.Header,null,_),n.default.createElement("div",{className:"fds-modal-body modal-body modal-body-iframe",style:{height:(0,u.resolveModalHeight)(E),maxHeight:"100%"}},n.default.createElement("iframe",{src:v,title:_}),L&&n.default.createElement("div",{className:"loader-container"},n.default.createElement(r.default,null)))))};t.default=m}}));
//# sourceMappingURL=Modal.js.map