Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/fragment-configuration-fields/ImageSelectorField",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../common/components/ImageSelector","../../../common/components/ImageSelectorSize","../../../common/components/MappingSelector","../../../core/hooks/useId","../../../prop-types/index","../../config/constants/editableTypes","../../config/constants/viewportSizes","../../contexts/StoreContext","../../utils/editable-value/isMapped","../../utils/editable-value/isMappedToCollection","../../utils/editable-value/isMappedToInfoItem"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ImageSelectorField=function({field:t,onValueSelect:a,value:g={}}){const y=(0,u.useId)(),S=(0,f.useSelector)((e=>e.selectedViewportSize)),[I,b]=(0,n.useState)((()=>(0,p.default)(g)?e.mapping.value:e.direct.value)),v=e=>{a(t.name,e)};return n.default.createElement(n.default.Fragment,null,S===d.VIEWPORT_SIZES.desktop&&n.default.createElement(l.default.Group,{small:!0},n.default.createElement("label",{htmlFor:y},Liferay.Language.get("image-source")),n.default.createElement(l.ClaySelectWithOption,{id:y,onChange:e=>{b(e.target.value),Object.keys(g).length&&v({})},options:Object.values(e),value:I})),I===e.direct.value?n.default.createElement(n.default.Fragment,null,n.default.createElement(o.ImageSelector,{fileEntryId:g.fileEntryId,imageTitle:g.title||g.url,label:t.label,onClearButtonPressed:()=>v({}),onImageSelected:v}),(null==g?void 0:g.fileEntryId)&&n.default.createElement(r.ImageSelectorSize,{fieldValue:{fileEntryId:g.fileEntryId},imageSizeId:"auto"})):n.default.createElement(n.default.Fragment,null,S===d.VIEWPORT_SIZES.desktop?n.default.createElement(i.default,{fieldType:c.EDITABLE_TYPES.backgroundImage,mappedItem:g,onMappingSelect:v}):null,((null==g?void 0:g.fileEntryId)||(0,m.default)(g)||(0,s.default)(g))&&n.default.createElement(r.ImageSelectorSize,{fieldValue:g,imageSizeId:"auto"})))};var l=S(a("@frontend-taglib-clay$clayui/form")),n=(g(a("liferay!frontend-js-react-web$prop-types")),S(a("liferay!frontend-js-react-web$react"))),o=a("../../../common/components/ImageSelector"),r=a("../../../common/components/ImageSelectorSize"),i=g(a("../../../common/components/MappingSelector")),u=a("../../../core/hooks/useId"),c=(a("../../../prop-types/index"),a("../../config/constants/editableTypes")),d=a("../../config/constants/viewportSizes"),f=a("../../contexts/StoreContext"),p=g(a("../../utils/editable-value/isMapped")),s=g(a("../../utils/editable-value/isMappedToCollection")),m=g(a("../../utils/editable-value/isMappedToInfoItem"));function g(e){return e&&e.__esModule?e:{default:e}}function y(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return y=function(){return e},e}function S(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=y();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 o=l?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(a,n,o):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}const e={direct:{label:Liferay.Language.get("direct"),value:"direct"},mapping:{label:Liferay.Language.get("mapping"),value:"mapping"}}}}));
//# sourceMappingURL=ImageSelectorField.js.map