Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/DisabledArea",["module","exports","require","@frontend-taglib-clay$clayui/popover","@liferay/frontend-js-react-web","frontend-js-web","liferay!frontend-js-react-web$react","../contexts/ControlsContext","../contexts/GlobalContext"],(function(e,t,n){var o;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=(o=n("@frontend-taglib-clay$clayui/popover"))&&o.__esModule?o:{default:o},a=n("@liferay/frontend-js-react-web"),l=n("frontend-js-web"),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var a=o?Object.getOwnPropertyDescriptor(e,r):null;a&&(a.get||a.set)?Object.defineProperty(n,r,a):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),i=n("../contexts/ControlsContext"),u=n("../contexts/GlobalContext");function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}const e="page-editor__disabled-area",d="#content",p=[d,".".concat(e),".control-menu",".lfr-add-panel",".lfr-product-menu-panel",".page-editor__layout-breadcrumbs"],g={[l.ALIGN_POSITIONS.Bottom]:"bottom",[l.ALIGN_POSITIONS.BottomLeft]:"bottom",[l.ALIGN_POSITIONS.BottomRight]:"bottom",[l.ALIGN_POSITIONS.Left]:"left",[l.ALIGN_POSITIONS.Right]:"right",[l.ALIGN_POSITIONS.Top]:"top",[l.ALIGN_POSITIONS.TopLeft]:"top",[l.ALIGN_POSITIONS.TopRight]:"top"},y=["","static","relative"];var f=()=>{const t=(0,c.useRef)(null),[n,o]=(0,c.useState)(null),s=(0,u.useGlobalContext)(),[f,m]=(0,c.useState)(!1),[I,b]=(0,c.useState)("bottom"),S=(0,i.useSelectItem)(),O=(0,c.useCallback)((e=>{const{height:t}=e.getBoundingClientRect(),{position:n}=s.window.getComputedStyle(e),o=-1===y.indexOf(n);return!("SCRIPT"===e.tagName||0===t||o||p.some((t=>e.matches(t)||e.querySelector(t))))}),[s]);return(0,a.useEventListener)("scroll",(()=>{f&&(o(null),m(!1))}),!0,s.document),(0,a.useEventListener)("click",(t=>{Array.from(t.target.classList).includes(e)?(o(t.target),S(null),m(!0)):f&&(o(null),m(!1))}),!0,s.document.body),(0,c.useLayoutEffect)((()=>{if(t.current&&n&&f){const e=(0,l.suggestAlignBestRegion)(t.current,n,l.ALIGN_POSITIONS.TopCenter).position!==l.ALIGN_POSITIONS.TopCenter?l.ALIGN_POSITIONS.BottomCenter:l.ALIGN_POSITIONS.TopCenter;(0,l.align)(t.current,n,e,!1),b(g[e])}}),[f,t,n]),(0,c.useLayoutEffect)((()=>{let t=s.document.querySelector(d);for(;t&&t.parentElement&&t!==s.document.body;)Array.from(t.parentElement.children).forEach((t=>{O(t)&&t.classList.add(e)})),t=t.parentElement;return()=>{s.document.querySelectorAll(".".concat(e)).forEach((t=>t.classList.remove(e)))}}),[s,O]),f&&c.default.createElement(a.ReactPortal,{className:"cadmin",container:s.document.body},c.default.createElement(r.default,{alignPosition:I,defaultShow:!0,ref:t},c.default.createElement("div",{dangerouslySetInnerHTML:{__html:(0,l.sub)(Liferay.Language.get("this-area-is-defined-by-the-theme.-you-can-change-the-theme-settings-by-clicking-x-in-the-x-panel-on-the-sidebar"),["<strong>".concat(Liferay.Language.get("more"),"</strong>"),"<strong>".concat(Liferay.Language.get("page-design-options"),"</strong>")])}})))};t.default=f}}));
//# sourceMappingURL=DisabledArea.js.map