/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
const UINT8_MAX = 255;
const UINT16_MAX = 65535;
const UINT24_MAX = 16777215;
const UINT32_MAX = 4294967295;
const UINT64_MAX = BigInt("18446744073709551615");
const INT8_MIN = -128;
const INT16_MIN = -32768;
const INT32_MIN = -2147483648;
const INT64_MIN = BigInt("-9223372036854775808");
const INT8_MAX = 127;
const INT16_MAX = 32767;
const INT32_MAX = 2147483647;
const INT64_MAX = BigInt("9223372036854775807");
const FLOAT32_MIN = -34028234663852886e22;
const FLOAT32_MAX = 34028234663852886e22;
const FLOAT64_MIN = -Number.MAX_VALUE;
const FLOAT64_MAX = Number.MAX_VALUE;
function toNumber(value) {
  return typeof value === "bigint" ? Number(value) : value;
}
function minValue(a, b) {
  if (a === void 0) return b;
  if (b === void 0) return a;
  return a < b ? a : b;
}
function maxValue(a, b) {
  if (a === void 0) return b;
  if (b === void 0) return a;
  return a > b ? a : b;
}
function toHex(value) {
  const hex = value.toString(16);
  return hex.length % 2 === 0 ? hex : `0${hex}`;
}
function cropValueRange(value, min, max) {
  return Math.min(Math.max(value, min), max);
}
function addValueWithOverflow(value, add, min, max) {
  const newValue = value + add;
  if (newValue < min) {
    return newValue - min + max;
  } else if (newValue > max) {
    return newValue - max + min;
  }
  return newValue;
}
export {
  FLOAT32_MAX,
  FLOAT32_MIN,
  FLOAT64_MAX,
  FLOAT64_MIN,
  INT16_MAX,
  INT16_MIN,
  INT32_MAX,
  INT32_MIN,
  INT64_MAX,
  INT64_MIN,
  INT8_MAX,
  INT8_MIN,
  UINT16_MAX,
  UINT24_MAX,
  UINT32_MAX,
  UINT64_MAX,
  UINT8_MAX,
  addValueWithOverflow,
  cropValueRange,
  maxValue,
  minValue,
  toHex,
  toNumber
};
//# sourceMappingURL=Number.js.map
