"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
const delegate = require("./delegate.js");
const warn = require("../../shared/warn.js");
const runtimeCore_esmBundler = require("../../../../../../@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const VResizeObserver = runtimeCore_esmBundler.defineComponent({
  name: "ResizeObserver",
  props: {
    onResize: Function
  },
  setup(props) {
    let registered = false;
    const proxy = runtimeCore_esmBundler.getCurrentInstance().proxy;
    function handleResize(entry) {
      const { onResize } = props;
      if (onResize !== void 0)
        onResize(entry);
    }
    runtimeCore_esmBundler.onMounted(() => {
      const el = proxy.$el;
      if (el === void 0) {
        warn.warn("resize-observer", "$el does not exist.");
        return;
      }
      if (el.nextElementSibling !== el.nextSibling) {
        if (el.nodeType === 3 && el.nodeValue !== "") {
          warn.warn("resize-observer", "$el can not be observed (it may be a text node).");
          return;
        }
      }
      if (el.nextElementSibling !== null) {
        delegate.default.registerHandler(el.nextElementSibling, handleResize);
        registered = true;
      }
    });
    runtimeCore_esmBundler.onBeforeUnmount(() => {
      if (registered) {
        delegate.default.unregisterHandler(proxy.$el.nextElementSibling);
      }
    });
  },
  render() {
    return runtimeCore_esmBundler.renderSlot(this.$slots, "default");
  }
});
exports.default = VResizeObserver;
