export function toggleEsaFaq(currentIndex: number | null, nextIndex: number): number | null {
  return currentIndex === nextIndex ? null : nextIndex;
}

export function isValidEsaResourceUrl(url: string): boolean {
  if (!url || url === '#') {
    return false;
  }

  try {
    const parsedUrl = new URL(url);

    return parsedUrl.protocol === 'https:' || parsedUrl.protocol === 'http:';
  } catch {
    return false;
  }
}
