Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/plugins/browser/components/page_structure/components/item_configuration_panels/FormMappingOptions",["module","exports","require","frontend-js-web","liferay!frontend-js-react-web$react","../../../../../../app/components/fragment_configuration_fields/SelectField","../../../../../../app/config/constants/formMappingSources","../../../../../../app/config/constants/layoutTypes","../../../../../../app/config/index"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function FormMappingOptions({hideLabel:e=!1,item:t,onValueSelect:n}){var s,c;let u=[{label:Liferay.Language.get("none"),value:"0"},...Liferay.FeatureFlags["LPS-169923"]?p.config.formTypes.filter((e=>!(null==e?void 0:e.isRestricted))):p.config.formTypes];Liferay.FeatureFlags["LPS-183727"]&&p.config.layoutType===i.LAYOUT_TYPES.display&&(u=u.map((e=>e.value===p.config.selectedMappingTypes.type.id?_objectSpread(_objectSpread({},e),{},{label:(0,a.sub)(Liferay.Language.get("x-default"),p.config.selectedMappingTypes.type.label)}):e)));const{classNameId:f,classTypeId:d}=t.config,g=u.find((({value:e})=>e===f)),y=null==g||null===(s=g.subtypes)||void 0===s?void 0:s.find((({value:e})=>e===d));return l.default.createElement(l.default.Fragment,null,l.default.createElement(o.SelectField,{field:{hideLabel:e,label:Liferay.Language.get("content-type"),name:"classNameId",typeOptions:{validValues:u.map((({label:e,value:t})=>({label:e,value:t})))}},onValueSelect:(e,t)=>{var a,l;const o=u.find((({value:e})=>e===t));return n({classNameId:t,classTypeId:(null==o||null===(a=o.subtypes)||void 0===a||null===(l=a[0])||void 0===l?void 0:l.value)||"0",formConfig:r.FORM_MAPPING_SOURCES.otherContentType})},value:g.value}),(null==g||null===(c=g.subtypes)||void 0===c?void 0:c.length)>0&&l.default.createElement(o.SelectField,{field:{hideLabel:e,label:Liferay.Language.get("subtype"),name:"classTypeId",typeOptions:{validValues:[{label:Liferay.Language.get("none"),value:""},...g.subtypes]}},onValueSelect:(e,a)=>n({classNameId:t.config.classNameId,classTypeId:a,formConfig:r.FORM_MAPPING_SOURCES.otherContentType}),value:y?d:""}))};var a=n("frontend-js-web"),l=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n("liferay!frontend-js-react-web$react")),o=n("../../../../../../app/components/fragment_configuration_fields/SelectField"),r=n("../../../../../../app/config/constants/formMappingSources"),i=n("../../../../../../app/config/constants/layoutTypes"),p=n("../../../../../../app/config/index");function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}}}));
//# sourceMappingURL=FormMappingOptions.js.map