castVote(selected!)}>
{#each options.toSorted((a, b) => a.sort_order - b.sort_order) as choice} {@const active = selected == choice.id || (typeof selected !== 'number' && selected?.includes(choice.id))} {@const percentage = Math.floor( (choice.num_votes / totalVotes || 0) * 100, )}
{#if chosen}
{/if}
{#if post.poll.mode == 'single'}
{:else}
{/if}
{choice.choice_text}
{#if chosen}
{percentage}%
{/if}
{/each}
{$t('post.poll.votes', { votes: totalVotes })} {#snippet action()} {#if (selected && canVote) || loading}
{$t('form.submit')}
{:else if post.poll.end_poll} {$t('post.poll.results.ends', { time: formatRelativeDate(publishedToDate(post.poll.end_poll), {}), })} {/if} {/snippet}