function a(e) {
  var r;
  const t = [], c = /* @__PURE__ */ new Set();
  let n = ((r = e.ownerDocument) == null ? void 0 : r.defaultView) ?? null;
  for (; n; ) {
    try {
      const o = n.document;
      o && !c.has(o) && (c.add(o), t.push(o));
    } catch {
      break;
    }
    if (n.parent === n) break;
    try {
      n = n.parent;
    } catch {
      break;
    }
  }
  return t;
}
const d = {
  // `mounted`, not `beforeMount`: nodes inserted into a different document are adopted on
  // `appendChild`, which updates `ownerDocument`. Reading it before insertion returns the
  // runtime's document (where Vue created the node), not the iframe's.
  mounted(e, t) {
    const c = (n) => {
      !e.contains(n.target) && t.value && t.value(n);
    };
    e._handler = c, e._handlerDocs = a(e), e._handlerDocs.forEach((n) => n.body.addEventListener("click", c));
  },
  unmounted(e) {
    var t;
    e._handler && ((t = e._handlerDocs) == null || t.forEach((c) => c.body.removeEventListener("click", e._handler)), e._handler = void 0, e._handlerDocs = void 0);
  }
};
export {
  d as default
};
//# sourceMappingURL=clickoutside.js.map
