import{d as R,o as p,b as w,c as x,a as M,aC as H,j as c,k as W,r as j}from"./preload-helper.BAt0wiQU.js";import{j as B}from"./motion.DDNFslEg.js";const U=R({compatConfig:{MODE:3},name:"ResizeObserver",props:{disabled:Boolean,onResize:Function},emits:["resize"],setup(i,v){let{slots:l}=v;const n=j({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:C,height:O}=o.getBoundingClientRect(),{offsetWidth:d,offsetHeight:f}=o,g=Math.floor(C),u=Math.floor(O);if(n.width!==g||n.height!==u||n.offsetWidth!==d||n.offsetHeight!==f){const m={width:g,height:u,offsetWidth:d,offsetHeight:f};c(n,m),t&&Promise.resolve().then(()=>{t(c(c({},m),{offsetWidth:d,offsetHeight:f}),o)})}},z=W(),a=()=>{const{disabled:e}=i;if(e){r();return}const t=H(z);t!==h&&(r(),h=t),!s&&t&&(s=new B(b),s.observe(t))};return p(()=>{a()}),w(()=>{a()}),x(()=>{r()}),M(()=>i.disabled,()=>{a()},{flush:"post"}),()=>{var e;return(e=l.default)===null||e===void 0?void 0:e.call(l)[0]}}});export{U as R};
