import { __require as requireGetIntrinsic } from "../../get-intrinsic/index.js";
import { __require as requireType } from "../../es-errors/type.js";
import { __require as requireIsPrimitive } from "../helpers/isPrimitive.js";
import { __require as requireToPrimitive } from "./ToPrimitive.js";
import { __require as requireStringToNumber } from "./StringToNumber.js";
var ToNumber;
var hasRequiredToNumber;
function requireToNumber() {
  if (hasRequiredToNumber) return ToNumber;
  hasRequiredToNumber = 1;
  var GetIntrinsic = requireGetIntrinsic();
  var $TypeError = requireType();
  var $Number = GetIntrinsic("%Number%");
  var isPrimitive = requireIsPrimitive();
  var ToPrimitive = requireToPrimitive();
  var StringToNumber = requireStringToNumber();
  ToNumber = function ToNumber2(argument) {
    var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
    if (typeof value === "symbol") {
      throw new $TypeError("Cannot convert a Symbol value to a number");
    }
    if (typeof value === "bigint") {
      throw new $TypeError("Conversion from 'BigInt' to 'number' is not allowed.");
    }
    if (typeof value === "string") {
      return StringToNumber(value);
    }
    return +value;
  };
  return ToNumber;
}
export {
  requireToNumber as __require
};
