Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/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","../hooks/useId","../openImageSelector"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ImageSelector=function ImageSelector({fileEntryId:e,imageTitle:t="",label:a,onClearButtonPressed:f,onImageSelected:p}){var g,m;const y=(0,d.useId)(),b=(0,u.useSelector)((e=>e.selectedViewportSize)),I=(0,u.useSelector)(c.selectPageContents),C=null!==(g=null===(m=I.find((t=>t.classPK===e)))||void 0===m?void 0:m.title)&&void 0!==g?g:t,_=!!t.length,E=(0,r.sub)(_?Liferay.Language.get("change-x"):Liferay.Language.get("select-x"),Liferay.Language.get("image"));return b===i.VIEWPORT_SIZES.desktop?o.default.createElement(o.default.Fragment,null,o.default.createElement(n.default.Group,null,o.default.createElement("label",{htmlFor:y},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:y,onClick:()=>(0,s.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,{"aria-label":E,displayType:"secondary",onClick:()=>(0,s.openImageSelector)((e=>{p(e)})),size:"sm",symbol:_?"change":"plus",title:E})),_&&o.default.createElement(o.default.Fragment,null,o.default.createElement(n.ClayInput.GroupItem,{shrink:!0},o.default.createElement(l.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("clear-selection"),displayType:"secondary",onClick:f,size:"sm",symbol:"times-circle",title:Liferay.Language.get("clear-selection")})))))):o.default.createElement(ReadOnlyImageInput,{imageTitle:t,label:a})};var l=a("@frontend-taglib-clay$clayui/button"),n=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")),r=a("frontend-js-web"),o=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),i=a("../../app/config/constants/viewportSizes"),u=a("../../app/contexts/StoreContext"),c=a("../../app/selectors/selectPageContents"),d=a("../hooks/useId"),s=a("../openImageSelector");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}function ReadOnlyImageInput({imageTitle:e,label:t}){const a=(0,d.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