// src/utils/transformGQLName.tsx
var transformGQLName = (word, options) => {
  const { delimiters, firstLetterTransform, addSpacesBetweenWords } = options;
  if (!word) {
    return "";
  }
  let newWord = "";
  if (firstLetterTransform) {
    newWord += firstLetterTransform(word[0]);
  }
  let i = newWord.length;
  while (i < word.length) {
    const character = word[i];
    const nextCharacter = word[i + 1];
    const previousCharacter = word[i - 1];
    const isDelimiter = delimiters && character === delimiters.oldDelimiter;
    if (addSpacesBetweenWords && !isDelimiter) {
      const isCharacterUppercase = character === character.toUpperCase();
      const isPreviousCharacterUppercase = previousCharacter && previousCharacter === previousCharacter.toUpperCase();
      if (isCharacterUppercase && !isPreviousCharacterUppercase) {
        newWord += " ";
      }
      newWord += character;
    } else if (isDelimiter) {
      newWord += delimiters.newDelimiter;
      if (firstLetterTransform && nextCharacter) {
        newWord += firstLetterTransform(nextCharacter);
        i += 1;
      }
    } else {
      newWord += character;
    }
    i += 1;
  }
  return newWord;
};

export {
  transformGQLName
};
