Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/common/components/MappingFieldSelector",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","frontend-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../../app/config/constants/editableTypeLabels","../../app/config/constants/editableTypes","../../app/utils/getSelectedField"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function MappingFieldSelector({className:t,fieldType:a,fields:d,label:s=Liferay.Language.get("field"),defaultLabel:p,onValueSelect:b,value:g}){const y=(0,r.useId)(),m=(0,r.useId)(),E=d&&!d.length,L=(0,f.default)({fields:d,value:g});return u.default.createElement(l.default.Group,{className:(0,n.default)("mb-2 mt-3",t,{"has-warning":E}),small:!0},u.default.createElement("label",{htmlFor:m},s),u.default.createElement(l.ClaySelect,{"aria-describedby":y,disabled:!(d&&d.length),id:m,onChange:b,value:null==L?void 0:L.key},d&&!!d.length&&u.default.createElement(u.default.Fragment,null,u.default.createElement(l.ClaySelect.Option,{label:p||e.label,value:e.value}),d.map(((e,t)=>{const a="".concat(e.label||"").concat(t);return u.default.createElement((t=>{let{children:n}=t,r=function _objectWithoutProperties(e,t){if(null==e)return{};var a,l,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var a,l,n={},r=Object.keys(e);for(l=0;l<r.length;l++)a=r[l],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(l=0;l<r.length;l++)a=r[l],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}(t,["children"]);return e.label?u.default.createElement(l.ClaySelect.OptGroup,r,n):u.default.createElement(u.default.Fragment,{key:a},n)}),{key:a,label:e.label},e.fields.map((e=>u.default.createElement(l.ClaySelect.Option,{key:e.key,label:e.label,value:e.key}))))})))),L&&u.default.createElement("p",{className:"mt-2 text-3",id:y},u.default.createElement("b",null,Liferay.Language.get("field-type"),": ")," ".concat(L.typeLabel)),E&&u.default.createElement(l.default.FeedbackGroup,null,u.default.createElement(l.default.FeedbackItem,null,function getWarningText(e){const t=[c.EDITABLE_TYPES.backgroundImage,c.EDITABLE_TYPES.image].includes(e)?o.EDITABLE_TYPE_LABELS[c.EDITABLE_TYPES.image]:c.EDITABLE_TYPES[e];if(t)return(0,i.sub)(Liferay.Language.get("no-fields-are-available-for-x-editable"),t);return Liferay.Language.get("no-fields-are-available-for-this-type")}(a))))};var l=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),r=a("frontend-js-components-web"),i=a("frontend-js-web"),u=_interopRequireDefault(a("liferay!frontend-js-react-web$react")),o=a("../../app/config/constants/editableTypeLabels"),c=a("../../app/config/constants/editableTypes"),f=_interopRequireDefault(a("../../app/utils/getSelectedField"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}const e={label:"-- ".concat(Liferay.Language.get("unmapped")," --"),value:"unmapped"}}}));
//# sourceMappingURL=MappingFieldSelector.js.map