Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/utils/settingsForm.es",["module","exports","require","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useSettingsContextFilter=function(e){const{defaultLanguageId:t,editingLanguageId:r}=(0,n.useFormState)(),{disabledProperties:i,disabledTabs:s,unimplementedProperties:o,visibleProperties:l}=(0,n.useConfig)();return(0,a.useMemo)((()=>d({defaultLanguageId:t,disabledProperties:i,disabledTabs:s,editingLanguageId:r,settingsContext:e,unimplementedProperties:o,visibleProperties:l})),[t,i,s,r,e,o,l])};var n=r("data-engine-js-components-web"),a=r("liferay!frontend-js-react-web$react");function i(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 s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}const e=({locale:e,localizedValue:t,options:r})=>{const n=t[e];if(!Array.isArray(n))return n;const a=new Set(r.map((({value:e})=>e)));return n.filter((e=>a.has(e)))},d=t=>{let{defaultLanguageId:r,disabledProperties:a,disabledTabs:i,editingLanguageId:o,settingsContext:{pages:d},unimplementedProperties:u,visibleProperties:c}=t,b=l(t.settingsContext,["pages"]);const p=new Set([...u,...a]),f=new Set(i),g=d.filter((({title:e})=>!f.has(e))),m=new n.PagesVisitor(g).mapFields((({fieldName:t,instanceId:a,locale:i,localizedValue:l,name:d,options:u,portletNamespace:b,repeatedIndex:f})=>{const g=()=>(0,n.generateName)(d,{editingLanguageId:o,fieldName:t,instanceId:a,portletNamespace:b,repeatedIndex:f}),m={defaultLanguageId:r,editingLanguageId:o};if(p.has(t))return m.name=g(),m.visibilityExpression="FALSE",m.visible=!1,m;switch(c.includes(t)&&(m.visibilityExpression="TRUE",m.visible=!0),t){case"dataSourceType":m.name=g(),m.predefinedValue='["manual"]',d.includes("form_web")||(m.readOnly=!0,m.visibilityExpression="FALSE",m.visible=!1);break;case"ddmDataProviderInstanceId":case"ddmDataProviderInstanceOutput":d.includes("form_web")||(m.visibilityExpression="FALSE",m.visible=!1);break;case"localizable":m.showAsSwitcher=!0;break;case"name":m.readOnly=!0;break;case"predefinedValue":m.localizedValue=s(s({},l),{},{[i]:e({locale:i,localizedValue:l,options:u})}),m.name=g();break;case"repeatable":d.includes("form_web")||(m.name=g(),m.showMaximumRepetitionsInfo=!1);break;default:m.name=g()}return m}),!0);return s(s({},b),{},{pages:m})}}}));
//# sourceMappingURL=settingsForm.es.js.map