Liferay.Loader.define("data-engine-js-components-web@1.0.89/js/core/reducers/pageValidationReducer.es",["module","exports","require","../../utils/strings","../../utils/visitors.es","../actions/eventTypes.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function pageValidationReducer(e,t){switch(t.type){case s.EVENT_TYPES.PAGE.VALIDATION_FAILED:{const{newPages:r,pageIndex:s}=t.payload,a=new o.PagesVisitor(null!=r?r:e.pages);let i,c=null,l=null;const u=a.mapFields(((e,t,r,n,o)=>{const a=o===s;return a&&void 0!==e.errorMessage&&""!==e.errorMessage&&!e.valid&&null==c&&(c=e.label,l=document.querySelector("[name='".concat(e.name,"']")),i=e.name),_objectSpread(_objectSpread({},e),{},{displayErrors:a,pageValidationFailed:!0})}),!0,!0);return l&&("hidden"!==l.type?l.focus():document.getElementsByName(i)[0]&&document.getElementsByName(i)[0].parentElement&&document.getElementsByName(i)[0].parentElement.scrollIntoView()),{forceAriaUpdate:Date.now(),invalidFormMessage:(0,n.sub)(Liferay.Language.get("this-form-is-invalid-check-field-x"),[c]),pages:u}}default:return e}};var n=r("../../utils/strings"),o=r("../../utils/visitors.es"),s=r("../actions/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=pageValidationReducer.es.js.map