{#if visible && threadStructure.rootComments.length > 0}
{#each threadStructure.rootComments as rootComment (rootComment.id)} {@const replyCount = countReplies(rootComment.id, threadStructure.repliesByParent)} {@const isExpanded = expandedThreads.has(rootComment.id)}
{#if !isExpanded}

{rootComment.content}

{#if replyCount > 0} {replyCount} {replyCount === 1 ? 'reply' : 'replies'} {/if}
  • {#if canDelete(rootComment)}
  • {/if}
{:else}
{formatTimestamp(rootComment.created_at || 0)} {#if replyCount > 0} {replyCount} {replyCount === 1 ? 'reply' : 'replies'} {/if}
  • {#if canDelete(rootComment)}
  • {/if}
{@render basicMarkup(rootComment.content)}
{#if replyingTo === rootComment.id}