import{findDOMNode as e}from"../_util/props-util/index.mjs";import t from"../node_modules/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.mjs";import{defineComponent as n,getCurrentInstance as r,onMounted as i,onUnmounted as a,onUpdated as o,reactive as s,watch as c}from"vue";var l=n({compatConfig:{MODE:3},name:`ResizeObserver`,props:{disabled:Boolean,onResize:Function},emits:[`resize`],setup(n,{slots:l}){let u=s({width:0,height:0,offsetHeight:0,offsetWidth:0}),d=null,f=null,p=()=>{f&&(f.disconnect(),f=null)},m=e=>{let{onResize:t}=n,r=e[0].target,{width:i,height:a}=r.getBoundingClientRect(),{offsetWidth:o,offsetHeight:s}=r,c=Math.floor(i),l=Math.floor(a);if(u.width!==c||u.height!==l||u.offsetWidth!==o||u.offsetHeight!==s){let e={width:c,height:l,offsetWidth:o,offsetHeight:s};Object.assign(u,e),t&&Promise.resolve().then(()=>{t({...e,offsetWidth:o,offsetHeight:s},r)})}},h=r(),g=()=>{let{disabled:r}=n;if(r){p();return}let i=e(h);i!==d&&(p(),d=i),!f&&i&&(f=new t(m),f.observe(i))};return i(()=>{g()}),o(()=>{g()}),a(()=>{p()}),c(()=>n.disabled,()=>{g()},{flush:`post`}),()=>l.default?.()[0]}});export{l as default};