Liferay.Loader.define("data-engine-js-components-web@1.0.86/js/custom/form/thunks/nextPage.es",["module","exports","require","../../../core/actions/eventTypes.es","../../../utils/evaluation.es","../../../utils/visitors.es"],(function(e,a,t){window;Object.defineProperty(a,"__esModule",{value:!0}),a.default=function nextPage({activePage:e,defaultLanguageId:a,editingLanguageId:t,formId:o,groupId:d,pages:l,portletNamespace:r,rules:u,selectedPage:g,viewMode:p}){const isValidPage=(e,a)=>{const t=new s.PagesVisitor(a);let n=!0;return t.mapFields((({valid:a},t,i,s,o)=>{e!==o||a||(n=!1)}),!0,!0),n};return s=>{(0,i.evaluate)(null,{activePage:e,defaultLanguageId:a,editingLanguageId:t,formId:o,groupId:d,nextPage:e+1,pages:l,portletNamespace:r,previousPage:e,rules:u,viewMode:p}).then((a=>{let t=!0,i=e;if(g)for(;t&&(t=isValidPage(i,a),i!==g);)t&&i++;else t=isValidPage(e,a);if(t||g){const t=g?a.findIndex((({enabled:e},a)=>e&&a===i)):a.findIndex((({enabled:a},t)=>a&&t>e)),d=Math.min(t,l.length-1);s({payload:{activePage:d},type:n.EVENT_TYPES.PAGE.CHANGE}),s({payload:a,type:n.EVENT_TYPES.PAGE.UPDATE}),Liferay.fire("ddmFormPageShow",{formId:o,page:d,title:l[d].title})}else{s({payload:{newPages:a,pageIndex:g?i:e},type:n.EVENT_TYPES.PAGE.VALIDATION_FAILED})}}))}};var n=t("../../../core/actions/eventTypes.es"),i=t("../../../utils/evaluation.es"),s=t("../../../utils/visitors.es")}));
//# sourceMappingURL=nextPage.es.js.map