import { defineComponent as o, ref as u, nextTick as a, renderSlot as f, createCommentVNode as m } from "vue";
import { lazyBus as d } from "./lazyBus.js";
const s = 300, T = /* @__PURE__ */ o({
  __name: "Lazy",
  props: {
    id: {},
    isLazy: { type: Boolean, default: !0 },
    lazyTimeout: { default: 0 },
    prev: { type: Boolean, default: !1 }
  },
  setup(e) {
    const i = e.prev || !e.isLazy, n = (t) => {
      typeof window > "u" || ("requestIdleCallback" in window ? setTimeout(() => window.requestIdleCallback(t), e.lazyTimeout) : setTimeout(() => {
        a(() => {
          t();
        }), e.lazyTimeout;
      }));
    }, l = u(!e.isLazy);
    return d.emit({ loading: e.id, save: i }), e.isLazy ? n(() => {
      l.value = !0, e.id && a(() => d.emit({ loaded: e.id, save: i }));
    }) : e.id && a(() => d.emit({ loaded: e.id, save: i })), (t, y) => l.value ? f(t.$slots, "default", { key: 0 }) : m("", !0);
  }
});
export {
  T as default
};
