var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
    for (var name in all) __defProp(target, name, {
      get: all[name],
      enumerable: !0
    });
  },
  __copyProps = (to, from, except, desc) => {
    if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
      get: () => from[key],
      enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
    });
    return to;
  };
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
  value: !0
}), mod);
var render_exports = {};
__export(render_exports, {
  dateToHumanReadable: () => dateToHumanReadable,
  dateToHumanReadableDay: () => dateToHumanReadableDay,
  dateToHumanReadableRange: () => dateToHumanReadableRange,
  dateToHumanReadableTime: () => dateToHumanReadableTime,
  locationToAddress: () => locationToAddress,
  renderFileSize: () => renderFileSize,
  renderName: () => renderName,
  toCapitalCase: () => toCapitalCase,
  toSentenceCase: () => toSentenceCase
});
module.exports = __toCommonJS(render_exports);
var import_change_case = require("change-case"),
  import_date_fns = require("date-fns");
const dateToHumanReadable = date => date ? (date = new Date(date), (0, import_date_fns.format)(date, "dd MMM yyyy HH:mm")) : "",
  dateToHumanReadableDay = date => date ? (date = new Date(date), (0, import_date_fns.format)(date, "dd MMM yyyy")) : "",
  dateToHumanReadableTime = date => date ? (date = new Date(date), (0, import_date_fns.format)(date, "HH:mm")) : "",
  dateToHumanReadableRange = (start, end, includeTime) => includeTime ? `${dateToHumanReadable(start)} - ${dateToHumanReadable(end)}` : `${dateToHumanReadableDay(start)} - ${dateToHumanReadableDay(end)}`,
  toCapitalCase = str => str ? (0, import_change_case.capitalCase)(str) : "",
  toSentenceCase = str => str ? (0, import_change_case.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]}`;
  };