export const PASSWORD_WORDS_COUNT = 12;
export const PASSWORD_MAX_LENGTH = 256;

export function normalizePasswordWords(wordsLike) {
  const words = Array.isArray(wordsLike) ? wordsLike : [];
  return Array.from({ length: PASSWORD_WORDS_COUNT }, (_, index) => String(words[index] || ''));
}

export function composePasswordFromWords(wordsLike) {
  return normalizePasswordWords(wordsLike)
    .map((word) => word.trim())
    .filter(Boolean)
    .join(' ');
}

export function emptyPasswordWords() {
  return Array.from({ length: PASSWORD_WORDS_COUNT }, () => '');
}
