{#if summary} {#if summary.files > 0 || chatId !== null}
{formatBytes(summary.bytes) || t("storage.zero")} {#if chatId !== null} {t("storage.hero.chat", { files: filesLabel(summary.files) })} {:else if summary.trash_bytes > 0} {t("storage.hero.trash", { files: filesLabel(summary.files), size: formatBytes(summary.trash_bytes), })} {:else} {t("storage.hero.disk", { files: filesLabel(summary.files) })} {/if}
{#each groups as item (item.group)} {/each} {#if chatId === null && summary.trash_bytes > 0} {/if}
{#each groups as item (item.group)} {/each}
{/if} {#if chatId === null}
{#each LISTINGS as item (item.value)} {/each}
{:else} { hideUndo(); reload(); }} target={{ chatId }} bind:this={scope} /> {/if} {/if} {#if listing === "files" && files.length > 0}

{t("storage.heaviest")}

{#if summary && group === null && summary.heavy_files > 0} {t("storage.heavy", { files: filesLabel(summary.heavy_files), size: formatBytes(summary.heavy_bytes), threshold: formatBytes(summary.heavy_threshold), })} {/if}
{/if}
{#each heavyChats as chat (chat.chat_id)} openChat(chat.chat_id)} title={chatTitle(chat.chat_id)} weight={heaviestChat > 0 ? chat.bytes / heaviestChat : 0} > {#snippet menu()} openChat(chat.chat_id)}> {t("storage.menu.chatFiles")} visit(chat)}> {t("storage.menu.openChat")} policyUi.edit({ chatId: chat.chat_id }, chatTitle(chat.chat_id))} > {t("storage.menu.policy")} {/snippet} {/each} {#each files as file, index (file.media_id)} 1 ? messagesLabel(file.refs) : undefined} onopen={() => open(index)} ontoggle={() => toggle(file.media_id)} refetchable={file.refetchable} selected={selected.has(file.media_id)} size={file.file_size} src={mediaUrl(file.media_id)} sub={chatId === null ? chatTitle(file.chat_id) : formatListDate(file.date)} tail={chatId === null ? formatListDate(file.date) : undefined} weight={heaviest > 0 ? file.file_size / heaviest : 0} > {#snippet menu()} open(index)}> {t("ui.open")} jump(file)}> {t("ui.jumpToMessage")} save(file)}> {t("ui.downloadFile")} trash([file.media_id])} > {t("storage.toTrash")} {/snippet} {/each} {#if loading}
{:else if failed}

{t("storage.loadFailed")}

{:else if shown === 0}

{emptiness}

{:else if !done} {/if}
{#if chosen.length > 0} 0 ? t("storage.cantRefetch", { count: chosenGone }) : undefined} title="{filesLabel(chosen.length)} · {formatBytes(chosenBytes)}" warn > {:else if undo} {:else if failure} {/if}
{ if (item.mediaId !== null) { trash([item.mediaId]); } }} bind:index={viewerIndex} bind:open={viewerOpen} />