Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/utils/normalizers.es",["module","exports","require"],(function(e,t,a){window;{function n(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 i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?n(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t,a=themeDisplay.getDefaultLanguageId()){const n=t=>e.reduce(((e,n)=>(e[n]=t[n]||t[a]||"",e)),{}),o=t=>e.reduce(((e,n)=>(t[n]&&t[n].length?e[n]=t[n]:e[n]=t[a],e)),{}),{defaultValue:l,label:u,tip:s}=t,{options:d,placeholder:c,tooltip:p}=t.customProperties;return i(i(i(i(i({},t),l&&{defaultValue:Array.isArray(l[a])?o(l):n(l)}),u&&{label:n(u)}),s&&{tip:n(s)}),{},{customProperties:i(i(i(i({},t.customProperties),d&&{options:o(d)}),c&&{placeholder:n(c)}),p&&{tooltip:n(p)}),nestedDataDefinitionFields:t.nestedDataDefinitionFields.length?t.nestedDataDefinitionFields.map((t=>i(i({},t),r(e,t,a)))):[]})}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeDataDefinition=function(e,t=themeDisplay.getDefaultLanguageId(),a=!0){return i(i({},e),{},{dataDefinitionFields:e.dataDefinitionFields.map((n=>"fieldset"!==n.fieldType||a?r(e.availableLanguageIds,n,t):n)),name:e.availableLanguageIds.reduce(((a,n)=>(a[n]=e.name[n]||e.name[t]||"",a)),{})})},t.normalizeDataLayout=function(e,t=themeDisplay.getDefaultLanguageId()){const{dataLayoutPages:a,dataRules:n,description:o}=e;return i(i({},e),{},{dataLayoutPages:a.map((e=>i(i({},e),{},{dataLayoutRows:(e.dataLayoutRows||[]).map((e=>i(i({},e),{},{dataLayoutColumns:(e.dataLayoutColumns||[]).map((e=>i(i({},e),{},{fieldNames:e.fieldNames||[]})))}))),description:i(i({},o),{},{[t]:e.description[t]||""}),title:i(i({},e.title),{},{[t]:e.title[t]||""})}))),dataRules:n.map((e=>(delete e.ruleEditedIndex,e)))})},t.normalizeDataLayoutRows=function(e){return e[0].dataLayoutRows.map((({dataLayoutColumns:e})=>({columns:e.map((({columnSize:e,fieldNames:t})=>({fields:t,size:e})))})))},t.normalizeRule=function(e){return i(i({},e),{},{name:{en_US:e.name}})}}}));
//# sourceMappingURL=normalizers.es.js.map