var w = Object.defineProperty;
var u = (e, o) => w(e, "name", { value: o, configurable: !0 });
import * as d from "yjs";
import { HocuspocusProvider as f } from "@hocuspocus/provider";
import { yCollab as p } from "y-codemirror.next";
import { Awareness as g } from "./node_modules/.pnpm/y-protocols@1.0.6_yjs@13.6.24/node_modules/y-protocols/awareness.js";
const r = {
  url: "ws://localhost:1234",
  room: "default"
}, s = /* @__PURE__ */ new Map();
function b({ url: e, room: o, component: c } = r) {
  const t = `${e}:${o}`;
  if (!s.has(t)) {
    const a = new d.Doc({ guid: o }), i = new g(a), l = new f({
      url: e || r.url,
      name: o || r.room,
      document: a,
      awareness: i,
      connect: !0
    });
    s.set(t, l);
  }
  const n = s.get(t), m = new d.UndoManager(n.document.getText(c));
  return p(
    n.document.getText(c),
    n.awareness,
    { undoManager: m }
  );
}
u(b, "cmCollab");
export {
  b as cmCollab,
  s as rooms
};
