Liferay.Loader.define("data-engine-js-components-web@1.0.79/js/core/thunks/fieldChange.es",["module","exports","require","../../utils/evaluation.es","../../utils/visitors.es","../actions/eventTypes.es","../utils/submitButtonController.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({defaultLanguageId:t,editingLanguageId:a,objectFields:i,pages:o,portletNamespace:u,properties:p,rules:g,submitButtonId:E,viewMode:y}){return async f=>{const{fieldInstance:b,key:v,value:P}=p,{evaluable:m,fieldName:O}=b,T=d({editingLanguageId:a,key:v,name:b.name,pages:o,value:P});if(c=T,f({payload:T,type:r.EVENT_TYPES.PAGE.UPDATE}),m)try{(0,l.disableSubmitButton)(E);let o=await(0,n.evaluate)(O,{defaultLanguageId:t,editingLanguageId:a,objectFields:i,pages:T,portletNamespace:u,rules:g,viewMode:y});if(f({payload:p,type:r.EVENT_TYPES.FIELD.CHANGE}),e.length&&(e.forEach((e=>{o=d(s(s({},e),{},{pages:o}))})),e=[]),b.isDisposed())return;const v=(0,n.mergePages)(t,a,O,o,c,y);f({payload:v,type:r.EVENT_TYPES.PAGE.UPDATE}),f({payload:v,type:r.EVENT_TYPES.FIELD.EVALUATE})}catch(e){f({payload:e,type:r.EVENT_TYPES.FIELD_EVALUATION_ERROR})}else f({payload:p,type:r.EVENT_TYPES.FIELD.CHANGE}),e.push({editingLanguageId:a,name:b.name,value:P})}};var n=a("../../utils/evaluation.es"),i=a("../../utils/visitors.es"),r=a("../actions/eventTypes.es"),l=a("../utils/submitButtonController.es");function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){u(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function u(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}let e=[];const d=({editingLanguageId:e,key:t="value",name:a,pages:n,value:r})=>new i.PagesVisitor(n).mapFields((n=>{var i;return n.name===a?s(s({},n),{},"value"!==t?{[t]:r}:{localizedValue:s(s({},n.localizedValue),{},{[e]:r}),localizedValueEdited:s(s({},null!==(i=n.localizedValueEdited)&&void 0!==i?i:{}),{},{[e]:!0}),value:r}):n}),!1,!0);let c=[]}}));
//# sourceMappingURL=fieldChange.es.js.map