import{f as O,_ as c}from"./index.TkDYtvUB.js";import{i as R}from"./index.hZKuveGx.js";import{d as C,r as x,o as M,b as H,c as W,w as _,g as B}from"./index.CPcBO1Os.js";const y=C({compatConfig:{MODE:3},name:"ResizeObserver",props:{disabled:Boolean,onResize:Function},emits:["resize"],setup(i,v){let{slots:l}=v;const n=x({width:0,height:0,offsetHeight:0,offsetWidth:0});let h=null,s=null;const r=()=>{s&&(s.disconnect(),s=null)},b=e=>{const{onResize:t}=i,o=e[0].target,{width:p,height:w}=o.getBoundingClientRect(),{offsetWidth:a,offsetHeight:f}=o,g=Math.floor(p),m=Math.floor(w);if(n.width!==g||n.height!==m||n.offsetWidth!==a||n.offsetHeight!==f){const u={width:g,height:m,offsetWidth:a,offsetHeight:f};c(n,u),t&&Promise.resolve().then(()=>{t(c(c({},u),{offsetWidth:a,offsetHeight:f}),o)})}},z=B(),d=()=>{const{disabled:e}=i;if(e){r();return}const t=O(z);t!==h&&(r(),h=t),!s&&t&&(s=new R(b),s.observe(t))};return M(()=>{d()}),H(()=>{d()}),W(()=>{r()}),_(()=>i.disabled,()=>{d()},{flush:"post"}),()=>{var e;return(e=l.default)===null||e===void 0?void 0:e.call(l)[0]}}});export{y as R};
