import{watch as f}from"vue";import{defaultWindow as d}from"./_configurable.mjs";import{tryOnScopeDispose as v}from"./tryOnScopeDispose.mjs";import{unrefElement as a}from"./unrefElement.mjs";import{useSupported as b}from"./useSupported.mjs";function R(n,p,m={}){const{window:o=d,...c}=m;let e;const r=b(()=>o&&"ResizeObserver"in o),t=()=>{e&&(e.disconnect(),e=void 0)},u=f(()=>a(n),i=>{t(),r.value&&o&&i&&(e=new ResizeObserver(p),e.observe(i,c))},{immediate:!0,flush:"post"}),s=()=>{t(),u()};return v(s),{isSupported:r,stop:s}}export{R as useResizeObserver};
