export const toggleIndex = (
  current: number[] | undefined,
  index: number,
): number[] => {
  const list = current ?? [];
  if (list.includes(index)) {
    return list.filter(i => i !== index);
  }
  return [...list, index].sort((a, b) => a - b);
};
