/// <inheritdoc/>
    public async Task <T> ShowAsync(IAnsiConsole console, CancellationToken cancellationToken)
    {
        // Create the list prompt
        var prompt = new ListPrompt <T>(console, this);
        var result = await prompt.Show(_tree, cancellationToken, PageSize).ConfigureAwait(false);

        // Return the selected item
        return(result.Items[result.Index].Data);
    }
    /// <inheritdoc/>
    public async Task <List <T> > ShowAsync(IAnsiConsole console, CancellationToken cancellationToken)
    {
        // Create the list prompt
        var prompt = new ListPrompt <T>(console, this);
        var result = await prompt.Show(Tree, cancellationToken, PageSize).ConfigureAwait(false);

        if (Mode == SelectionMode.Leaf)
        {
            return(result.Items
                   .Where(x => x.IsSelected && x.Children.Count == 0)
                   .Select(x => x.Data)
                   .ToList());
        }

        return(result.Items
               .Where(x => x.IsSelected)
               .Select(x => x.Data)
               .ToList());
    }