import { capitalCase, sentenceCase } from "change-case";
import { format } from "date-fns";
const dateToHumanReadable = (date) => date ? (date = new Date(date), format(date, "dd MMM yyyy HH:mm")) : "", dateToHumanReadableDay = (date) => date ? (date = new Date(date), format(date, "dd MMM yyyy")) : "", dateToHumanReadableTime = (date) => date ? (date = new Date(date), format(date, "HH:mm")) : "", dateToHumanReadableRange = (start, end, includeTime) => includeTime ? `${dateToHumanReadable(start)} - ${dateToHumanReadable(end)}` : `${dateToHumanReadableDay(start)} - ${dateToHumanReadableDay(end)}`, toCapitalCase = (str) => str ? capitalCase(str) : "", toSentenceCase = (str) => str ? sentenceCase(str) : "", renderName = ({
  firstName,
  middleName,
  lastName
}) => {
  if (!firstName && !middleName && !lastName) return "";
  let str = `${lastName}, ${firstName}`;
  return middleName && (str = `${str} ${middleName}`), str;
}, locationToAddress = (location) => location ? `${location?.streetAddressOne}, ${location?.city}, ${location.city?.toUpperCase()}, ${location.stateOrRegion?.toUpperCase()}, ${location?.postalCode}` : "", renderFileSize = (sizeInBytes) => {
  if (sizeInBytes < 0)
    throw new Error("Size must be a non-negative integer.");
  const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
  if (sizeInBytes === 0)
    return "0 B";
  let i = 0, size = sizeInBytes;
  for (; size >= 1024 && i < units.length - 1; )
    size /= 1024, i++;
  return `${size.toFixed(2)} ${units[i]}`;
};
export {
  dateToHumanReadable,
  dateToHumanReadableDay,
  dateToHumanReadableRange,
  dateToHumanReadableTime,
  locationToAddress,
  renderFileSize,
  renderName,
  toCapitalCase,
  toSentenceCase
};
//# sourceMappingURL=render.js.map
