const OM_EVENT_NAME = "om:event";
const CAPTURED_EVENTS_KEY = "__capturedOmEvents";
async function installOmEventCollector(page) {
  await page.evaluate(({ eventName, storageKey }) => {
    ;
    window[storageKey] = [];
    window.addEventListener(eventName, (event) => {
      const detail = event.detail;
      if (!detail || typeof detail !== "object") return;
      const store = window[storageKey];
      if (!Array.isArray(store)) return;
      store.push(detail);
    });
  }, { eventName: OM_EVENT_NAME, storageKey: CAPTURED_EVENTS_KEY });
}
async function getCapturedOmEvents(page) {
  return page.evaluate((storageKey) => {
    const store = window[storageKey];
    if (!Array.isArray(store)) return [];
    return store;
  }, CAPTURED_EVENTS_KEY);
}
export {
  getCapturedOmEvents,
  installOmEventCollector
};
//# sourceMappingURL=sseEventCollector.js.map
