"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../utils/disposables.js"),i=require("./use-iso-morphic-effect.js");function r(e){if(null===e)return{width:0,height:0};let{width:t,height:i}=e.getBoundingClientRect();return{width:t,height:i}}exports.useElementSize=function(h,s){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[n,o]=e.useState((()=>r(s)));return i.useIsoMorphicEffect((()=>{if(!s||!h)return;let e=t.disposables();return e.requestAnimationFrame((function t(){e.requestAnimationFrame(t),o((e=>{let t=r(s);return t.width===e.width&&t.height===e.height?e:t}))})),()=>{e.dispose()}}),[s,h]),u?{width:`${n.width}px`,height:`${n.height}px`}:n};
//# sourceMappingURL=use-element-size.js.map
