
import { createRequire } from 'module'; 
const require = createRequire(import.meta.url);
        

// src/server.ts
var Server = class {
  constructor(party) {
    this.party = party;
    party.storage.get("head").then((head) => {
      if (head) {
        this.lastMessage = head;
      }
    });
  }
  lastMessage = null;
  onConnect(conn) {
    if (this.lastMessage) {
      conn.send(this.lastMessage);
    }
  }
  onMessage(message, sender) {
    this.lastMessage = message;
    this.party.broadcast(message, [sender.id]);
    this.party.storage.put("head", message);
  }
};
export {
  Server as default
};
//# sourceMappingURL=server.esm.js.map
