Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.121/admin/js/reducers/elementSetReducer.es",["module","exports","require","data-engine-js-components-web","../eventTypes.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function elementSetReducer(e,{payload:t,type:r}){switch(r){case o.EVENT_TYPES.ELEMENT_SET_ADD:{const{elementSetPages:r,indexes:o}=t,{activePage:a,pages:i}=e,{pageIndex:s,rowIndex:c}=null!=o?o:{pageIndex:a,rowIndex:i[a].rows.length},p=new n.PagesVisitor(r).mapFields((e=>{const t=n.FieldUtil.generateFieldName(i,e.fieldName),r=new n.PagesVisitor(e.settingsContext.pages);return _objectSpread(_objectSpread({},e),{},{fieldName:t,fieldReference:t,settingsContext:_objectSpread(_objectSpread({},e.settingsContext),{},{pages:r.mapFields((e=>("fieldReference"!==e.fieldName&&"name"!==e.fieldName||(e=_objectSpread(_objectSpread({},e),{},{value:t})),e)))})})}));return{pages:i.map(((e,t)=>{if(t===s){const r=n.FormSupport.removeEmptyRows(i,t);return _objectSpread(_objectSpread({},e),{},{rows:[...r.slice(0,c+1),...p[0].rows,...r.slice(c+1)]})}return e}))}}default:return e}};var n=r("data-engine-js-components-web"),o=r("../eventTypes.es");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=elementSetReducer.es.js.map