Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/utils/useBackgroundImageValue",["module","exports","require","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../services/ImageService","./editable-value/resolveEditableValue"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){const a=(0,n.useIsMounted)(),[o,f]=(0,l.useState)({mediaQueries:"",url:(null==t?void 0:t.url)||""});return(0,l.useEffect)((()=>{t&&function(e,t){return(0,u.default)(c(c({},e||{}),{},{defaultValue:(null==e?void 0:e.url)||""}),null,t).then((e=>{var t;return{fileEntryId:e.fileEntryId||"",url:(null===(t=e.fieldValue)||void 0===t?void 0:t.url)||e.url||e||""}}))}(t,r).then((({fileEntryId:r,url:n})=>function(e,t){if(!e||!(null==t?void 0:t.fileEntryId))return Promise.resolve("");return i.default.getAvailableImageConfigurations({fileEntryId:t.fileEntryId,onNetworkStatus:()=>{}}).then((t=>(null==t?void 0:t.length)?t.filter((e=>e.mediaQuery&&e.url)).map((t=>"@media ".concat(t.mediaQuery," {\n\t\t\t\t\t\t#").concat(e," {\n\t\t\t\t\t\t\tbackground-image: url(").concat(t.url,") !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t}"))).join("\n"):""))}(e,c(c({},t),{},{fileEntryId:r||t.fileEntryId})).then((e=>({mediaQueries:e,url:n}))))).then((e=>{a()&&f(e)}))}),[e,t,a,r]),o};var n=r("@liferay/frontend-js-react-web"),l=r("liferay!frontend-js-react-web$react"),i=a(r("../services/ImageService")),u=a(r("./editable-value/resolveEditableValue"));function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=useBackgroundImageValue.js.map