// src/utils/phone-helpers.ts
function getNationalMask(country) {
  if (!(country == null ? void 0 : country.phoneMask)) return "";
  const code = country.phoneCode.startsWith("+") ? country.phoneCode : `+${country.phoneCode}`;
  const escaped = code.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  return country.phoneMask.replace(new RegExp(`^\\s*${escaped}[\\s-]*`), "").trim();
}
function formatDigitsToMask(digits, mask) {
  if (digits.length === 0) return "";
  let i = 0;
  let out = "";
  for (const c of mask) {
    if (c === "#") {
      if (i < digits.length) out += digits[i++];
      else break;
    } else if (i < digits.length) {
      out += c;
    }
  }
  return out;
}
export {
  formatDigitsToMask,
  getNationalMask
};
//# sourceMappingURL=phone-helpers.js.map