Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.150/admin/js/hooks/useValidateFormWithObjects",["module","exports","require","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useValidateFormWithObjects=function useValidateFormWithObjects(){const{formSettingsContext:e,objectFields:t,pages:n}=(0,r.useFormState)();return(0,a.useCallback)((a=>{if(!e)return!0;let i=!1,o=!1;if(new r.PagesVisitor(e.pages).visitFields((({fieldName:e,value:t})=>{"objectDefinitionId"===e?i=!!t[0]:"storageType"===e&&"object"===t[0]&&(o=!0)})),i&&o||t.length){const e=(0,r.getFields)(n),i=getUnmappedFormFields(e),o=getUnmappedRequiredObjectFields(e,t);return!i.length&&!o.length||(a&&a({unmappedFormFields:i,unmappedRequiredObjectFields:o}),!1)}return!0}),[e,t,n])};var r=n("data-engine-js-components-web"),a=n("liferay!frontend-js-react-web$react");const getUnmappedFormFields=e=>e.filter((e=>{const t=(0,r.getObjectFieldName)(e);return t&&!(0,r.getSelectedValue)(t.value)})),getUnmappedRequiredObjectFields=(e,t)=>{const n=t.filter((({required:e})=>e)),a=e.map((e=>{const t=(0,r.getObjectFieldName)(e);return t&&(0,r.getSelectedValue)(t.value)})).filter(Boolean);return n.filter((({name:e})=>-1===a.indexOf(e)))}}}));
//# sourceMappingURL=useValidateFormWithObjects.js.map