import { BigNumber as o } from "../../../../../bignumber.js@9.3.0/node_modules/bignumber.js/bignumber.mjs";
function T(t, e) {
  o.config({ EXPONENTIAL_AT: 78 });
  const n = new o(t), r = o(e), a = new o(10).pow(r);
  return n.div(a);
}
const g = [
  "bytes",
  "KB",
  "MB",
  "GB",
  "TB",
  "PB",
  "EB",
  "ZB",
  "YB"
], D = g.map((t, e) => ({
  label: t,
  value: (BigInt(1024) ** BigInt(e)).toString()
})), S = ["K", "M", "B", "T", "P"], M = S.map((t, e) => ({
  label: t,
  value: (BigInt(1e3) ** BigInt(e + 1)).toString()
}));
function m(t) {
  return t.replace(/(\.\d*[1-9])0+$|\.0*$/, "$1");
}
const f = (t, e, n) => {
  const r = new o(t), a = r.lt(new o(e[0].value));
  if (!e.length || a)
    return t;
  for (let i = 1; i < e.length; ++i)
    if (r.lt(new o(e[i].value))) {
      const s = e[i - 1], u = new o(s.value), l = r.div(u);
      return `${m(l.toFixed(n))} ${s.label}`;
    }
  return r.toExponential(n);
};
function p({
  num: t,
  units: e,
  minValue: n,
  maxValue: r
}) {
  const a = new o(t), i = new o(r), s = new o(n), u = a.gte(s), l = a.lte(i);
  return u && l ? m(a.toFixed(4)) : u ? l ? a.toExponential(2) : f(t, e, 2) : m(a.toExponential(2));
}
const c = 24 * 60 * 60 * 1e3;
function I(t = c) {
  const e = /* @__PURE__ */ new Date(), n = new Date(e.getTime() + t);
  return n.setUTCHours(0, 0, 0, 0), n.valueOf();
}
function d(t) {
  return t === void 0 || new Date(
    t
  ).valueOf() < I(-1 * c);
}
function w({
  lastPlaySessionCompletedDateTimeUTC: t,
  requiredStreakInDays: e,
  currentStreakInDays: n
}) {
  return n >= e ? { requiredStreakInDays: e, currentStreakInDays: e } : d(t) ? { requiredStreakInDays: e, currentStreakInDays: 0 } : (n = Math.min(n, e), n = Math.max(n, 0), { requiredStreakInDays: e, currentStreakInDays: n });
}
function B({
  minimumSessionTimeInSeconds: t,
  accumulatedPlaytimeTodayInSeconds: e,
  lastPlaySessionCompletedDateTimeUTC: n,
  dateTimeCurrentSessionStartedInMsSinceEpoch: r
}) {
  if (d(n))
    return 0;
  if (r) {
    const i = Date.now() - r;
    e += i / 1e3;
  }
  let a = Math.round(
    e / t * 100
  );
  return a = Math.min(a, 100), a = Math.max(a, 0), a;
}
function h(t) {
  const e = Math.round(t / 1e3), n = e % 60, r = Math.floor(e % 3600 / 60), a = Math.floor(e % 86400 / 3600), i = Math.floor(e / 86400);
  return i > 0 ? i > 1e3 ? "+1000d" : `${i}d` : a > 0 ? `${a}h:${r}m` : r > 0 ? `${r}m:${n}s` : `${n}s`;
}
export {
  D as bytesUnits,
  M as decimalUnits,
  f as formatLargeNumber,
  T as getDecimalNumberFromAmount,
  h as getETAStringFromMs,
  I as getMidnightUTCTimestamp,
  w as getPlayStreakDays,
  B as getPlaytimePercentage,
  c as oneDayInMs,
  p as parseNumIntoReadableString,
  d as questWillResetOnNextSession,
  m as removeTrailingZeros
};
//# sourceMappingURL=index.es.mjs.map
