import { ChoiceIsNaNError, ChoiceIsNonPositiveError, InitialChoiceNotInChoicesError } from "./error.js";
function convertChoicesToNumbers(choices) {
    return choices.split(',').map((choice)=>{
        const parsedChoice = parseInt(choice, 10);
        if (Number.isNaN(parsedChoice)) throw new ChoiceIsNaNError(choice);
        if (parsedChoice <= 0) throw new ChoiceIsNonPositiveError(parsedChoice);
        return parsedChoice;
    });
}
function validateInitialChoice(initialChoice, choices) {
    if (!choices.includes(initialChoice)) throw new InitialChoiceNotInChoicesError(initialChoice, choices);
    return initialChoice;
}
export { convertChoicesToNumbers, validateInitialChoice };
