"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("../node_modules/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js"),t=require("vue"),R=require("../_util/props-util/index.js"),w=t.defineComponent({compatConfig:{MODE:3},name:"ResizeObserver",props:{disabled:Boolean,onResize:Function},emits:["resize"],setup(o,{slots:b}){const s=t.reactive({width:0,height:0,offsetHeight:0,offsetWidth:0});let h=null,n=null;const r=()=>{n&&(n.disconnect(),n=null)},v=c=>{const{onResize:e}=o,i=c[0].target,{width:O,height:z}=i.getBoundingClientRect(),{offsetWidth:f,offsetHeight:l}=i,u=Math.floor(O),a=Math.floor(z);if(s.width!==u||s.height!==a||s.offsetWidth!==f||s.offsetHeight!==l){const g={width:u,height:a,offsetWidth:f,offsetHeight:l};Object.assign(s,g),e&&Promise.resolve().then(()=>{e({...g,offsetWidth:f,offsetHeight:l},i)})}},m=t.getCurrentInstance(),d=()=>{const{disabled:c}=o;if(c){r();return}const e=R.findDOMNode(m);e!==h&&(r(),h=e),!n&&e&&(n=new M.default(v),n.observe(e))};return t.onMounted(()=>{d()}),t.onUpdated(()=>{d()}),t.onUnmounted(()=>{r()}),t.watch(()=>o.disabled,()=>{d()},{flush:"post"}),()=>b.default?.()[0]}});exports.default=w;
