var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/pisellPhone/utils/countryCodeHelper.ts
var countryCodeHelper_exports = {};
__export(countryCodeHelper_exports, {
  getCountryCodes: () => getCountryCodes,
  getCountryConfig: () => getCountryConfig,
  getCountryFlag: () => getCountryFlag,
  getMaxLength: () => getMaxLength
});
module.exports = __toCommonJS(countryCodeHelper_exports);
var import_countryCodes = require("../constants/countryCodes");
function getCountryFlag(countryCode) {
  const country = import_countryCodes.PRESET_COUNTRY_CODES.find((c) => c.code === countryCode);
  return (country == null ? void 0 : country.flag) || "🌐";
}
function getMaxLength(countryCode, countryCodes) {
  const country = countryCodes.find((c) => c.code === countryCode);
  return (country == null ? void 0 : country.maxLength) || 15;
}
function getCountryConfig(countryCode, countryCodes) {
  return countryCodes.find((c) => c.code === countryCode);
}
function getCountryCodes(props) {
  let codes;
  if (props.countryCodes && props.countryCodes.length > 0) {
    codes = props.countryCodes;
  } else if (props.availableCountryCodes && props.availableCountryCodes.length > 0) {
    codes = import_countryCodes.PRESET_COUNTRY_CODES.filter(
      (c) => props.availableCountryCodes.includes(c.code)
    );
  } else {
    codes = import_countryCodes.PRESET_COUNTRY_CODES;
  }
  if (props.commonCountryCodes && props.commonCountryCodes.length > 0) {
    const common = codes.filter((c) => props.commonCountryCodes.includes(c.code));
    const others = codes.filter((c) => !props.commonCountryCodes.includes(c.code));
    codes = [...common, ...others];
  }
  return codes;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getCountryCodes,
  getCountryConfig,
  getCountryFlag,
  getMaxLength
});
