function f({
  decimals: e = 2,
  inputUnit: t = "B",
  targetUnit: n = "B",
  value: r
}) {
  const s = {
    B: 1,
    GB: 1073741824,
    KB: 1024,
    MB: 1048576,
    TB: 1099511627776
  }, i = {
    Gb: 1024 ** 3 / 8,
    Kb: 1024 / 8,
    Mb: 1024 ** 2 / 8,
    Tb: 1024 ** 4 / 8,
    b: 1 / 8
  }, o = { ...s, ...i }, u = o[n], d = r * o[t], c = Number.parseFloat((d / u).toFixed(e));
  return Number.isNaN(c) ? 0 : c;
}
function m(e) {
  return e > 360 ? 360 : e < -360 ? -360 : e;
}
function a(e, t) {
  return t === 0 ? e : a(t, e % t);
}
function N(e, t) {
  if (!e || !t)
    return "-- / --";
  const n = a(e, t);
  return `${e / n} / ${t / n}`;
}
function b(e, t) {
  const n = Math.round(e), r = Math.round(t), s = a(n, r);
  return {
    height: r / s,
    width: n / s
  };
}
function h(e, t, n) {
  const r = n * Math.PI / 180;
  if (n % 90 === 0)
    return {
      height: n % 180 === 0 ? t : e,
      width: n % 180 === 0 ? e : t
    };
  const s = Math.abs(Math.cos(r)), i = Math.abs(Math.sin(r)), o = e * s + t * i, u = e * i + t * s;
  return {
    height: Math.round(u),
    width: Math.round(o)
  };
}
function l(e) {
  if (!e || typeof e != "string")
    return 0;
  const t = e.trim();
  if (!t)
    return 0;
  if (t.endsWith("s") && !t.endsWith("ms")) {
    const n = Number.parseFloat(t);
    return Number.isNaN(n) || n < 0 ? 0 : n * 1e3;
  }
  if (t.endsWith("m")) {
    const n = Number.parseFloat(t);
    return Number.isNaN(n) || n < 0 ? 0 : n * 60 * 1e3;
  }
  if (t.endsWith("h")) {
    const n = Number.parseFloat(t);
    return Number.isNaN(n) || n < 0 ? 0 : n * 60 * 60 * 1e3;
  }
  if (t.endsWith("ms")) {
    const n = Number.parseFloat(t);
    return Number.isNaN(n) || n < 0 ? 0 : n;
  }
  return 0;
}
function g(e) {
  const t = /^(-?\d*\.?\d+)([a-zA-Z%]*)$/.exec(e.trim());
  if (!t)
    return null;
  const n = Number.parseFloat(t[1]);
  return { unit: t[2] || "", value: n };
}
function p(e) {
  if (!Number.isFinite(e))
    return "0";
  const [t, n] = String(e).split("."), r = t.startsWith("-"), i = (r ? t.slice(1) : t).replace(
    /\B(?=(\d{3})+(?!\d))/g,
    ","
  ), o = r ? "-" : "";
  return n !== void 0 ? `${o}${i}.${n}` : `${o}${i}`;
}
export {
  f as a,
  l as b,
  b as c,
  N as d,
  g as e,
  p as f,
  a as g,
  h as r,
  m as s
};
