Liferay.Loader.define("@liferay/document-library-web@6.0.141/document_library/js/saveDDMStructure.es",["module","exports","require","frontend-js-web"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.getInputLocalizedValues=getInputLocalizedValues,t.getDataEngineStructure=getDataEngineStructure,t.default=function saveDDMStructure({namespace:e}){const t=document["".concat(e,"fm")];t.addEventListener("submit",(async r=>{r.preventDefault();const a=await Liferay.componentReady("".concat(e,"dataLayoutBuilder"));(0,n.postForm)(t,{data:getDataEngineStructure({dataLayoutBuilder:a,namespace:e})})}),!0)};var n=r("frontend-js-web");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}function getInputLocalizedValues(e,t){const r=Liferay.component("".concat(e).concat(t)),n={};if(r){r.get("translatedLanguages").values().forEach((e=>{n[e]=r.getValue(e)}))}return n}function getDataEngineStructure({dataLayoutBuilder:e,namespace:t}){const{dataDefinition:r,dataLayout:n}=e.current.state,a=getInputLocalizedValues(t,"name"),o=getInputLocalizedValues(t,"description");return{dataDefinition:JSON.stringify(_objectSpread(_objectSpread({},r.serialize()),{},{description:o,name:a})),dataLayout:JSON.stringify(_objectSpread(_objectSpread({},n.serialize()),{},{description:o,name:a}))}}}}));
//# sourceMappingURL=saveDDMStructure.es.js.map