const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.js');

//#region ../../node_modules/.pnpm/libphonenumber-js@1.11.3/node_modules/libphonenumber-js/build/AsYouTypeState.js
var require_AsYouTypeState = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/.pnpm/libphonenumber-js@1.11.3/node_modules/libphonenumber-js/build/AsYouTypeState.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	function _classCallCheck(instance, Constructor) {
		if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
	}
	function _defineProperties(target, props) {
		for (var i = 0; i < props.length; i++) {
			var descriptor = props[i];
			descriptor.enumerable = descriptor.enumerable || false;
			descriptor.configurable = true;
			if ("value" in descriptor) descriptor.writable = true;
			Object.defineProperty(target, descriptor.key, descriptor);
		}
	}
	function _createClass(Constructor, protoProps, staticProps) {
		if (protoProps) _defineProperties(Constructor.prototype, protoProps);
		if (staticProps) _defineProperties(Constructor, staticProps);
		Object.defineProperty(Constructor, "prototype", { writable: false });
		return Constructor;
	}
	var AsYouTypeState = /* @__PURE__ */ function() {
		function AsYouTypeState$1(_ref) {
			var onCountryChange = _ref.onCountryChange, onCallingCodeChange = _ref.onCallingCodeChange;
			_classCallCheck(this, AsYouTypeState$1);
			this.onCountryChange = onCountryChange;
			this.onCallingCodeChange = onCallingCodeChange;
		}
		_createClass(AsYouTypeState$1, [
			{
				key: "reset",
				value: function reset(_ref2) {
					var country = _ref2.country, callingCode = _ref2.callingCode;
					this.international = false;
					this.missingPlus = false;
					this.IDDPrefix = void 0;
					this.callingCode = void 0;
					this.digits = "";
					this.resetNationalSignificantNumber();
					this.initCountryAndCallingCode(country, callingCode);
				}
			},
			{
				key: "resetNationalSignificantNumber",
				value: function resetNationalSignificantNumber() {
					this.nationalSignificantNumber = this.getNationalDigits();
					this.nationalSignificantNumberMatchesInput = true;
					this.nationalPrefix = void 0;
					this.carrierCode = void 0;
					this.complexPrefixBeforeNationalSignificantNumber = void 0;
				}
			},
			{
				key: "update",
				value: function update(properties) {
					for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {
						var key = _Object$keys[_i];
						this[key] = properties[key];
					}
				}
			},
			{
				key: "initCountryAndCallingCode",
				value: function initCountryAndCallingCode(country, callingCode) {
					this.setCountry(country);
					this.setCallingCode(callingCode);
				}
			},
			{
				key: "setCountry",
				value: function setCountry(country) {
					this.country = country;
					this.onCountryChange(country);
				}
			},
			{
				key: "setCallingCode",
				value: function setCallingCode(callingCode) {
					this.callingCode = callingCode;
					this.onCallingCodeChange(callingCode, this.country);
				}
			},
			{
				key: "startInternationalNumber",
				value: function startInternationalNumber(country, callingCode) {
					this.international = true;
					this.initCountryAndCallingCode(country, callingCode);
				}
			},
			{
				key: "appendDigits",
				value: function appendDigits(nextDigits) {
					this.digits += nextDigits;
				}
			},
			{
				key: "appendNationalSignificantNumberDigits",
				value: function appendNationalSignificantNumberDigits(nextDigits) {
					this.nationalSignificantNumber += nextDigits;
				}
			},
			{
				key: "getNationalDigits",
				value: function getNationalDigits() {
					if (this.international) return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));
					return this.digits;
				}
			},
			{
				key: "getDigitsWithoutInternationalPrefix",
				value: function getDigitsWithoutInternationalPrefix() {
					if (this.international) {
						if (this.IDDPrefix) return this.digits.slice(this.IDDPrefix.length);
					}
					return this.digits;
				}
			}
		]);
		return AsYouTypeState$1;
	}();
	exports["default"] = AsYouTypeState;
}) });

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