import n from"@babel/runtime/helpers/slicedToArray";import{useRef as e,useState as t,useCallback as r,useEffect as o}from"react";import{throttle as i}from"lodash";import{ISOLATED_PAGE_APP_CONTAINER_ID as u}from"../components/DevCenter/IsolatedDevCenterAppContainer/constants.js";var l=function(){var n;return null===(n=document.getElementById(u))||void 0===n?void 0:n.firstElementChild},m=function(){var m=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=m.width,d=m.height,c=e(l()),v=function(){var n,e=null===(n=c.current)||void 0===n?void 0:n.getBoundingClientRect();if(!e)return console.error("#".concat(u,' component is not available. Check if you are not using "useMatchAppContainerSize" hook outside of DC app')),null;var t="number"!=typeof(null==a?void 0:a.min)||a.min<e.width,r="number"!=typeof(null==a?void 0:a.max)||a.max>e.width,o="number"!=typeof(null==d?void 0:d.min)||d.min<e.height,i="number"!=typeof(null==d?void 0:d.max)||d.max>e.height;return t&&r&&o&&i},f=t(c.current?v():null),p=n(f,2),s=p[0],h=p[1],g=r(i((function(){return h(v())}),200),[a,d]);return o((function(){c.current||(c.current=l(),h(v()))}),[]),o((function(){return window.addEventListener("resize",g),function(){window.removeEventListener("resize",g)}}),[]),s};export{m as useMatchAppContainerSize};
//# sourceMappingURL=useMatchAppContainerSize.js.map
