"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Vue = require("vue");
const collection2 = require("./collection2.js");
const collectionItem = require("./collection-item.js");
const M = "data-el-collection-item", v = (C) => {
  const l = `El${C}Collection`, s = `${l}Item`, c = Symbol(l), m = Symbol(s), f = {
    ...collection2.default,
    name: l,
    setup() {
      const i = Vue.ref(null), t = /* @__PURE__ */ new Map();
      Vue.provide(c, {
        itemMap: t,
        getItems: () => {
          const o = Vue.unref(i);
          if (!o)
            return [];
          const e = Array.from(o.querySelectorAll(`[${M}]`));
          return [...t.values()].sort((N, p) => e.indexOf(N.ref) - e.indexOf(p.ref));
        },
        collectionRef: i
      });
    }
  }, O = {
    ...collectionItem.default,
    name: s,
    setup(i, { attrs: t }) {
      const n = Vue.ref(null), o = Vue.inject(c, void 0);
      Vue.provide(m, {
        collectionItemRef: n
      }), Vue.onMounted(() => {
        const e = Vue.unref(n);
        e && o.itemMap.set(e, {
          ref: e,
          ...t
        });
      }), Vue.onBeforeUnmount(() => {
        const e = Vue.unref(n);
        o.itemMap.delete(e);
      });
    }
  };
  return {
    COLLECTION_INJECTION_KEY: c,
    COLLECTION_ITEM_INJECTION_KEY: m,
    ElCollection: f,
    ElCollectionItem: O
  };
};
exports.COLLECTION_ITEM_SIGN = M;
exports.createCollectionWithScope = v;
