Liferay.Loader.define("data-engine-taglib@3.3.53/data_layout_builder/js/utils/dataConverter.es",["module","exports","require","data-engine-js-components-web","./dataDefinition.es","./normalizers.es"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.getDDMFormField=getDDMFormField,a.getDefaultDataLayout=function getDefaultDataLayout(e){const{dataDefinitionFields:a}=e;return{dataLayoutPages:[{dataLayoutRows:a.map((({name:e})=>({dataLayoutColumns:[{columnSize:12,fieldNames:[e]}]})))}]}},a.getFieldSetDDMForm=function getFieldSetDDMForm({allowInvalidAvailableLocalesForProperty:e,editingLanguageId:a,fieldSet:t,fieldTypes:i}){var n,l;const{defaultDataLayout:o,defaultLanguageId:s}=t,{dataLayoutPages:u}=(0,d.normalizeDataLayout)(o,s),g=e?t:(0,d.normalizeDataDefinition)(t,s),f=u.map((e=>({rows:e.dataLayoutRows.map((e=>({columns:e.dataLayoutColumns.map((({columnSize:e,fieldNames:t})=>({fields:t.map((e=>getDDMFormField({dataDefinition:g,defaultLanguageId:s,editingLanguageId:a,fieldName:e,fieldTypes:i}))),size:e})))})))}))),{description:r,id:m,name:D}=g;return{description:null!==(n=r[a])&&void 0!==n?n:r[s],id:m,localizedDescription:r,localizedTitle:D,pages:f,title:null!==(l=D[a])&&void 0!==l?l:D[s]}};var i=t("data-engine-js-components-web"),n=t("./dataDefinition.es"),d=t("./normalizers.es");function getDDMFormField({dataDefinition:e,defaultLanguageId:a=themeDisplay.getDefaultLanguageId(),editingLanguageId:t=a,fieldName:d,fieldTypes:l}){const o=(0,n.getDataDefinitionField)(e,d),{fieldType:s,nestedDataDefinitionFields:u}=o;"ddm-text-html"===s&&(o.fieldType="rich_text");const g=(0,i.getDDMFormFieldSettingsContext)({dataDefinitionField:o,defaultLanguageId:a,editingLanguageId:t,fieldTypes:l}),f={nestedFields:u.map((({name:i})=>getDDMFormField({dataDefinition:e,defaultLanguageId:a,editingLanguageId:t,fieldName:i,fieldTypes:l}))),settingsContext:g};return new i.PagesVisitor(g.pages).mapFields((e=>{const{fieldName:i,localizable:n,type:d,value:l}=e;if("options"===d&&l)f[i]=l[t];else if("name"===i)f.fieldName=l;else{var o;f[i]=n?null!==(o=l[t])&&void 0!==o?o:l[a]:l}})),f.instanceId||(f.instanceId=i.FieldSupport.generateInstanceId()),f}}}));
//# sourceMappingURL=dataConverter.es.js.map