Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/common/components/ImageSelector",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../app/config/constants/viewportSizes","../../app/contexts/StoreContext","../../app/selectors/selectPageContents","../../core/hooks/useId","../../core/openImageSelector"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ImageSelector=function({fileEntryId:e,imageTitle:t="",label:a,onClearButtonPressed:d,onImageSelected:p}){var y,g;const b=(0,s.useId)(),I=(0,u.useSelector)((e=>e.selectedViewportSize)),E=(0,u.useSelector)(i.selectPageContents),C=null!==(y=null===(g=E.find((t=>t.classPK===e)))||void 0===g?void 0:g.title)&&void 0!==y?y:t,w=!!t.length;return I===c.VIEWPORT_SIZES.desktop?o.default.createElement(o.default.Fragment,null,o.default.createElement(n.default.Group,null,o.default.createElement("label",{htmlFor:b},a),o.default.createElement(n.ClayInput.Group,{small:!0},o.default.createElement(n.ClayInput.GroupItem,null,o.default.createElement(n.ClayInput,{className:"page-editor__item-selector__content-input",id:b,onClick:()=>(0,f.openImageSelector)((e=>{p(e)})),placeholder:Liferay.Language.get("select-image"),readOnly:!0,sizing:"sm",value:C})),o.default.createElement(n.ClayInput.GroupItem,{shrink:!0},o.default.createElement(l.ClayButtonWithIcon,{displayType:"secondary",onClick:()=>(0,f.openImageSelector)((e=>{p(e)})),small:!0,symbol:w?"change":"plus",title:(0,r.sub)(w?Liferay.Language.get("change-x"):Liferay.Language.get("select-x"),Liferay.Language.get("image"))})),w&&o.default.createElement(o.default.Fragment,null,o.default.createElement(n.ClayInput.GroupItem,{shrink:!0},o.default.createElement(l.ClayButtonWithIcon,{displayType:"secondary",onClick:d,small:!0,symbol:"times-circle",title:Liferay.Language.get("clear-selection")})))))):o.default.createElement(m,{imageTitle:t,label:a})};var l=a("@frontend-taglib-clay$clayui/button"),n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();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")),r=a("frontend-js-web"),o=(d(a("liferay!frontend-js-react-web$prop-types")),d(a("liferay!frontend-js-react-web$react"))),c=a("../../app/config/constants/viewportSizes"),u=a("../../app/contexts/StoreContext"),i=a("../../app/selectors/selectPageContents"),s=a("../../core/hooks/useId"),f=a("../../core/openImageSelector");function d(e){return e&&e.__esModule?e:{default:e}}function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function m({imageTitle:e,label:t}){const a=(0,s.useId)();return o.default.createElement(o.default.Fragment,null,o.default.createElement("label",{htmlFor:a},t),o.default.createElement(n.default.Group,{small:!0},o.default.createElement(n.ClayInput,{className:"mb-2",disabled:!0,id:a,readOnly:!0,value:e})))}}}));
//# sourceMappingURL=ImageSelector.js.map