var Direction = /* @__PURE__ */ ((Direction2) => {
  Direction2["Up"] = "up";
  Direction2["Down"] = "down";
  Direction2["Left"] = "left";
  Direction2["Right"] = "right";
  return Direction2;
})(Direction || {});
var AlertType = /* @__PURE__ */ ((AlertType2) => {
  AlertType2["Alarm"] = "alarm";
  AlertType2["Warning"] = "warning";
  AlertType2["Caution"] = "caution";
  return AlertType2;
})(AlertType || {});
var AlertCategory = /* @__PURE__ */ ((AlertCategory2) => {
  AlertCategory2["a"] = "a";
  AlertCategory2["b"] = "b";
  AlertCategory2["c"] = "c";
  return AlertCategory2;
})(AlertCategory || {});
function isActive(alert) {
  return alert.active === true;
}
function isAcknowledged(alert) {
  return alert.acknowledged !== false && alert.acknowledged !== void 0;
}
function isShelved(alert) {
  return alert.shelved !== false && alert.shelved !== void 0;
}
function isBlocked(alert) {
  return alert.blocked !== false && alert.blocked !== void 0;
}
const priorityOrder = [
  "alarm",
  "warning",
  "caution"
  /* Caution */
];
function comparePriorityAlerts(a, b) {
  if (a.type !== b.type) {
    return priorityOrder.indexOf(b.type) - priorityOrder.indexOf(a.type);
  }
  if (isActive(a) !== isActive(b)) {
    return isActive(a) ? 1 : -1;
  }
  if (isAcknowledged(a) !== isAcknowledged(b)) {
    return isAcknowledged(a) ? -1 : 1;
  }
  return a.time.getTime() - b.time.getTime();
}
function formatTimeSince(time) {
  const now = /* @__PURE__ */ new Date();
  const diff = now.getTime() - time.getTime();
  const diffInSeconds = diff / 1e3;
  if (diffInSeconds < 60) {
    return Math.round(diffInSeconds) + "s";
  }
  const diffInMinutes = diffInSeconds / 60;
  if (diffInMinutes < 60) {
    return Math.round(diffInMinutes) + "m " + Math.round(diffInSeconds % 60) + "s";
  }
  const diffInHours = diffInMinutes / 60;
  if (diffInHours < 24) {
    return Math.round(diffInHours) + "h " + Math.round(diffInMinutes % 60) + "m";
  }
  const diffInDays = diffInHours / 24;
  if (diffInDays < 365) {
    return Math.round(diffInDays) + "d " + Math.round(diffInHours % 24) + "h";
  }
  return Math.round(diffInDays / 365) + "y " + Math.round(diffInDays % 365) + "d";
}
export {
  AlertCategory,
  AlertType,
  Direction,
  comparePriorityAlerts,
  formatTimeSince,
  isAcknowledged,
  isActive,
  isBlocked,
  isShelved
};
//# sourceMappingURL=types.js.map
