{#each groups as group (group.key)}
{#if showGroupHeaders}
{@const selectable = groupSelectable(group)}
{@const selectedCount = selectable.filter((i) => selectedItems.includes(i.key)).length}
{@const selectedInGroup = group.items.filter((i) =>
selectedItems.includes(i.key)
).length}
{#if !hideSelection}
0 && selectedCount === selectable.length}
indeterminate={selectedCount > 0 && selectedCount < selectable.length}
disabled={selectable.length === 0}
title={selectedCount === selectable.length
? `Deselect all in ${group.label}`
: `Select all in ${group.label}`}
onChange={() => toggleGroup(group)}
/>
{/if}
{#if group.groupKind === 'folder'}
{:else if group.groupKind === 'user'}
{/if}
{group.label}
{group.items.length} item{group.items.length !== 1 ? 's' : ''}{selectedInGroup > 0
? ` · ${selectedInGroup} selected`
: ''}
{#if groupActions}
{@render groupActions(group.items)}
{/if}
{/if}
{#each group.items as item (item.key)}
{@const isSelectable = selectablePredicate(item)}
{@const isSelected = selectedItems.includes(item.key)}
{@const status = deploymentStatus[item.key]}
{@const isDeployed = status?.status === 'deployed'}
{@const blockedReason =
!isSelectable && !isDeployed ? selectBlockedReason?.(item) : undefined}
{@const showPath =
item.kind !== 'resource' && item.kind !== 'variable' && item.kind !== 'resource_type'}
{@const subPath =
group.key && item.path.startsWith(group.key + '/')
? item.path.slice(group.key.length + 1)
: item.path}
handleSelect(item)}
path={showPath ? item.path : ''}
marked={undefined}
kind={item.kind}
triggerKind={item.triggerKind}
canFavorite={false}
workspaceId=""
>
{#snippet customSummary()}
{#if itemSummary}
{@render itemSummary(item)}
{:else}
{item.path}
{/if}
{/snippet}
{#snippet pathDisplay()}
{#if itemPath}
{@render itemPath(item)}
{:else}
{showPath ? (showGroupHeaders ? subPath : item.path) : ''}
{/if}
{/snippet}
{#snippet actions()}
{#if itemActions}
{@render itemActions(item)}
{/if}
{#if status}
{#if status.status === 'loading'}
{:else if status.status === 'deployed'}
Deployed
{:else if status.status === 'failed'}
Failed
{status.error}
{/if}
{/if}
{/snippet}
{/each}
{/each}