const NOTIFICATION_DOM_EVENTS = {
  NEW: "om:notifications:new",
  ACTIONED: "om:notifications:actioned",
  COUNT_CHANGED: "om:notifications:count-changed"
};
function emitNotificationNew(detail) {
  if (typeof window === "undefined" || typeof CustomEvent === "undefined") return;
  window.dispatchEvent(new CustomEvent(NOTIFICATION_DOM_EVENTS.NEW, { detail }));
}
function emitNotificationActioned(notificationId) {
  if (typeof window === "undefined" || typeof CustomEvent === "undefined") return;
  window.dispatchEvent(new CustomEvent(NOTIFICATION_DOM_EVENTS.ACTIONED, { detail: { notificationId } }));
}
function emitNotificationCountChanged(count) {
  if (typeof window === "undefined" || typeof CustomEvent === "undefined") return;
  window.dispatchEvent(new CustomEvent(NOTIFICATION_DOM_EVENTS.COUNT_CHANGED, { detail: { count } }));
}
function subscribeNotificationNew(handler) {
  if (typeof window === "undefined") return () => {
  };
  const listener = (event) => handler(event.detail);
  window.addEventListener(NOTIFICATION_DOM_EVENTS.NEW, listener);
  return () => window.removeEventListener(NOTIFICATION_DOM_EVENTS.NEW, listener);
}
function subscribeNotificationActioned(handler) {
  if (typeof window === "undefined") return () => {
  };
  const listener = (event) => handler(event.detail.notificationId);
  window.addEventListener(NOTIFICATION_DOM_EVENTS.ACTIONED, listener);
  return () => window.removeEventListener(NOTIFICATION_DOM_EVENTS.ACTIONED, listener);
}
function subscribeNotificationCountChanged(handler) {
  if (typeof window === "undefined") return () => {
  };
  const listener = (event) => handler(event.detail.count);
  window.addEventListener(NOTIFICATION_DOM_EVENTS.COUNT_CHANGED, listener);
  return () => window.removeEventListener(NOTIFICATION_DOM_EVENTS.COUNT_CHANGED, listener);
}
export {
  NOTIFICATION_DOM_EVENTS,
  emitNotificationActioned,
  emitNotificationCountChanged,
  emitNotificationNew,
  subscribeNotificationActioned,
  subscribeNotificationCountChanged,
  subscribeNotificationNew
};
//# sourceMappingURL=notificationEvents.js.map
