"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e);exports.useElementSize=function(){var e=t.useState(null),i=r.default(e,2),n=i[0],u=i[1],h=t.useState({width:0,height:0}),f=r.default(h,2),c=f[0],o=f[1],s=t.useCallback((function(e){u(e)}),[]);return t.useEffect((function(){if(n){o({width:n.offsetWidth,height:n.offsetHeight});var e=new ResizeObserver((function(e){var t=e[0];t&&o({width:t.contentRect.width,height:t.contentRect.height})}));return e.observe(n),function(){return e.disconnect()}}o({width:0,height:0})}),[n]),{ref:s,width:c.width,height:c.height}};
//# sourceMappingURL=useElementSize.js.map
