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