Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.130/page_editor/plugins/page-content/components/ImageEditorModal",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","@frontend-taglib-clay$clayui/modal","item-selector-taglib","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../app/actions/updatePreviewImage","../../../app/config/index","../../../app/contexts/StoreContext","../../../app/selectors/selectLanguageId","../../../app/services/FragmentService","../../../app/services/ImageService"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.updateFragmentsPreviewImage=y,t.default=function({editImageURL:e,fileEntryId:t,fragmentEntryLinks:a,onCloseModal:o,previewURL:c}){const u=(0,d.useDispatch)(),f=(0,d.useSelector)(s.default),{observer:p,onClose:g}=(0,r.useModal)({onClose:o});return i.default.createElement(r.default,{className:"image-editor-modal",containerProps:{className:"cadmin"},observer:p,size:"full-screen"},i.default.createElement(r.default.Header,null,Liferay.Language.get("edit-image")),i.default.createElement(r.default.Body,null,c?i.default.createElement(l.ImageEditor,{imageId:t,imageSrc:c,onCancel:g,onSave:e=>{(null==e?void 0:e.success)&&(g(),y({dispatch:u,fileEntryId:t,fragmentEntryLinks:a,languageId:f}))},saveURL:e}):i.default.createElement(n.default,null)))};var n=g(a("@frontend-taglib-clay$clayui/loading-indicator")),r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("@frontend-taglib-clay$clayui/modal")),l=a("item-selector-taglib"),i=(g(a("liferay!frontend-js-react-web$prop-types")),g(a("liferay!frontend-js-react-web$react"))),o=g(a("../../../app/actions/updatePreviewImage")),c=a("../../../app/config/index"),d=a("../../../app/contexts/StoreContext"),s=g(a("../../../app/selectors/selectLanguageId")),u=g(a("../../../app/services/FragmentService")),f=g(a("../../../app/services/ImageService"));function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function g(e){return e&&e.__esModule?e:{default:e}}function y({dispatch:e,fileEntryId:t,fragmentEntryLinks:a,languageId:n}){const r=Object.values(a).filter((e=>Object.values(e.editableValues).reduce(((e,t)=>[...e,...Object.entries(t)]),[]).some((([,a])=>{var r,l;return!e.removed&&"object"==typeof a&&(a.classPK===t||(null===(r=a[n])||void 0===r?void 0:r.classPK)===t||(null===(l=a[c.config.defaultLanguageId])||void 0===l?void 0:l.classPK)===t)})))),l=f.default.getFileEntry({fileEntryId:t}),i=r.map((({fragmentEntryLinkId:e})=>u.default.renderFragmentEntryLinkContent({fragmentEntryLinkId:e}).then((({content:t})=>({content:t,fragmentEntryLinkId:e})))));return Promise.all([l,...i]).then((([{fileEntryURL:a},...n])=>{e((0,o.default)({contents:n,fileEntryId:t,previewURL:a}))}))}}}));
//# sourceMappingURL=ImageEditorModal.js.map