"use client";
function fallbackLabel(kind) {
  const segment = kind.split(".").pop() ?? kind;
  return segment.replace(/_/g, " ").replace(/\b\w/g, (ch) => ch.toUpperCase());
}
function lowercaseInitial(value) {
  if (!value) return value;
  return value.charAt(0).toLowerCase() + value.slice(1);
}
function resolveBaseActionLabel(entry) {
  return entry.actionLabel || entry.commandId;
}
function resolveHistoryAction(entry) {
  const historyAction = entry.context?.historyAction;
  return typeof historyAction === "string" ? historyAction : null;
}
function humanizeResourceKind(kind, t) {
  if (!kind) return "";
  return t(`audit_logs.resource_kind.${kind}`, fallbackLabel(kind));
}
function getVersionHistoryActionLabel(entry, t) {
  const baseAction = resolveBaseActionLabel(entry);
  const actionParam = lowercaseInitial(baseAction);
  switch (resolveHistoryAction(entry)) {
    case "undo":
      return t("audit_logs.version_history.action.undo", "Undo {action}", { action: actionParam });
    case "redo":
      return t("audit_logs.version_history.action.redo", "Redo {action}", { action: actionParam });
    default:
      return baseAction;
  }
}
function getVersionHistoryStatusLabel(state, t) {
  switch (state) {
    case "done":
      return t("audit_logs.version_history.status.done", "Done");
    case "undone":
      return t("audit_logs.version_history.status.undone", "Undone");
    case "redone":
      return t("audit_logs.version_history.status.redone", "Redone");
    case "failed":
      return t("audit_logs.version_history.status.failed", "Failed");
    default:
      return state || t("audit_logs.common.none");
  }
}
export {
  getVersionHistoryActionLabel,
  getVersionHistoryStatusLabel,
  humanizeResourceKind
};
//# sourceMappingURL=labels.js.map
