Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/app/components/undo/undoUpdateFormItemConfig",["module","exports","require","../../actions/updateFormItemConfig","../../actions/updateItemLocalConfig","../../services/LayoutService","../../utils/getFragmentItem"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.undoAction=function undoAction({action:e,store:t}){const{config:r,deletedItems:d,isMapping:c,itemId:s,removedFragmentEntryLinkIds:u,restoredFragmentEntryLinkIds:p}=e,{layoutData:m}=t,l=u.map((e=>({itemId:(0,a.default)(m,e).itemId}))),f=p.map((e=>(0,a.default)(m,e).itemId)),g=m.items[s],y=_objectSpread(_objectSpread({},m),{},{deletedItems:[...d,...l],items:_objectSpread(_objectSpread({},m.items),{},{[s]:_objectSpread(_objectSpread({},g),{},{children:c?f:g.children,config:r})})});return e=>(c&&e((0,o.default)({disableUndo:!0,itemConfig:{loading:!0},itemId:s})),i.default.updateLayoutData({layoutData:y,onNetworkStatus:e,segmentsExperienceId:t.segmentsExperienceId}).then((()=>{e((0,n.default)({deletedItems:d,isMapping:c,itemId:s,layoutData:y,removedFragmentEntryLinkIds:u,restoredFragmentEntryLinkIds:p}))})))},t.getDerivedStateForUndo=function getDerivedStateForUndo({action:e,state:t}){const{addedFragmentEntryLinks:r,isMapping:n,itemId:o,removedFragmentEntryLinkIds:i,restoredFragmentEntryLinkIds:a}=e,{layoutData:d}=t;return{config:_objectSpread(_objectSpread({},d.items[o].config),{},{loading:!1}),deletedItems:d.deletedItems,isMapping:n,itemId:o,removedFragmentEntryLinkIds:r?Object.keys(r):a,restoredFragmentEntryLinkIds:i}};var n=_interopRequireDefault(r("../../actions/updateFormItemConfig")),o=_interopRequireDefault(r("../../actions/updateItemLocalConfig")),i=_interopRequireDefault(r("../../services/LayoutService")),a=_interopRequireDefault(r("../../utils/getFragmentItem"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=undoUpdateFormItemConfig.js.map