import { effectScope as u, ref as d, readonly as m } from "vue";
function f(n) {
  let o = !1, c;
  const t = u(!0);
  return (...l) => (o || (c = t.run(() => n(...l)), o = !0), c);
}
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const p = f(() => {
  const n = d([]), o = (t) => n.value.includes(t), c = (t) => {
    n.value = t;
  };
  return {
    aclList: m(n),
    checkPermission: o,
    setPermission: c
  };
});
function v(n) {
  return !!(n && n.nodeType === 8);
}
const h = () => {
  const { checkPermission: n } = p(), o = "acl", c = `v-${o}`, t = /* @__PURE__ */ new WeakMap(), l = (e, r) => {
    const s = t.get(e);
    let { parentEl: a, comment: i } = s;
    if (n(r))
      i && i.nodeType === 8 && i.nodeValue === c && (a == null || a.replaceChild(e, i), t.set(e, {
        parentEl: e.parentElement,
        parentNode: e.parentNode
      }));
    else {
      if (i)
        return;
      i = document.createComment(c), a == null || a.replaceChild(i, e), t.set(e, { ...s, comment: i });
    }
  };
  return {
    name: o,
    directiveLifeCycle: {
      mounted(e, r) {
        t.set(e, {
          parentEl: e.parentElement,
          parentNode: e.parentNode
        }), l(e, r.value);
      },
      updated(e, r) {
        l(e, r.value);
      },
      unmounted(e) {
        const { parentEl: r, comment: s } = t.get(e);
        s && v(s) && s.nodeValue === c && (r == null || r.removeChild(s)), t.delete(e);
      }
    }
  };
}, C = [h], k = (n) => {
  C.map((o) => {
    const { name: c, directiveLifeCycle: t } = o();
    n.directive(c, t);
  });
};
export {
  k as installDirective
};
//# sourceMappingURL=install.mjs.map
