const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');
const require_metadata$1 = require('./metadata.js');
const require_checkNumberLength$1 = require('./helpers/checkNumberLength.js');

//#region ../../node_modules/.pnpm/libphonenumber-js@1.11.3/node_modules/libphonenumber-js/build/isPossible.js
var require_isPossible = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/libphonenumber-js@1.11.3/node_modules/libphonenumber-js/build/isPossible.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports["default"] = isPossiblePhoneNumber;
	exports.isPossibleNumber = isPossibleNumber;
	var _metadata = _interopRequireDefault(require_metadata$1.require_metadata());
	var _checkNumberLength = _interopRequireDefault(require_checkNumberLength$1.require_checkNumberLength());
	function _interopRequireDefault(obj) {
		return obj && obj.__esModule ? obj : { "default": obj };
	}
	/**
	* Checks if a phone number is "possible" (basically just checks its length).
	*
	* isPossible(phoneNumberInstance, { ..., v2: true }, metadata)
	*
	* isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
	* isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
	*
	* @param  {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
	* @param  {object} [options]
	* @param  {object} metadata
	* @return {string}
	*/
	function isPossiblePhoneNumber(input, options, metadata) {
		/* istanbul ignore if */
		if (options === void 0) options = {};
		metadata = new _metadata["default"](metadata);
		if (options.v2) {
			if (!input.countryCallingCode) throw new Error("Invalid phone number object passed");
			metadata.selectNumberingPlan(input.countryCallingCode);
		} else {
			if (!input.phone) return false;
			if (input.country) {
				if (!metadata.hasCountry(input.country)) throw new Error("Unknown country: ".concat(input.country));
				metadata.country(input.country);
			} else {
				if (!input.countryCallingCode) throw new Error("Invalid phone number object passed");
				metadata.selectNumberingPlan(input.countryCallingCode);
			}
		}
		if (metadata.possibleLengths()) return isPossibleNumber(input.phone || input.nationalNumber, metadata);
		else if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) return true;
		else throw new Error("Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.");
	}
	function isPossibleNumber(nationalNumber, metadata) {
		switch ((0, _checkNumberLength["default"])(nationalNumber, metadata)) {
			case "IS_POSSIBLE": return true;
			default: return false;
		}
	}
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_isPossible();
  }
});