import { IN_BROWSER, templateRef } from "./chunk-LZ5T2ERG.js"; import { onBeforeUnmount, readonly, ref, watch } from "./chunk-2MKFL3BX.js"; // node_modules/vuetify/lib/composables/resizeObserver.js function useResizeObserver(callback) { let box = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "content"; const resizeRef = templateRef(); const contentRect = ref(); if (IN_BROWSER) { const observer = new ResizeObserver((entries) => { callback?.(entries, observer); if (!entries.length) return; if (box === "content") { contentRect.value = entries[0].contentRect; } else { contentRect.value = entries[0].target.getBoundingClientRect(); } }); onBeforeUnmount(() => { observer.disconnect(); }); watch(() => resizeRef.el, (newValue, oldValue) => { if (oldValue) { observer.unobserve(oldValue); contentRect.value = void 0; } if (newValue) observer.observe(newValue); }, { flush: "post" }); } return { resizeRef, contentRect: readonly(contentRect) }; } export { useResizeObserver }; //# sourceMappingURL=chunk-XDSAO7OT.js.map