{#snippet renderEntries(dirPath: string, depth: number)}
{#if childrenCache.has(dirPath)}
{#each childrenCache.get(dirPath) ?? [] as entry}
{@const fullPath = `${dirPath}/${entry.name}`}
{#if entry.type === 'dir'}
{#if openDirs.has(fullPath)}
{@render renderEntries(fullPath, depth + 1)}
{/if}
{:else}
{/if}
{/each}
{:else if loadingDirs.has(dirPath)}
Loading...
{/if}
{/snippet}
{@render renderEntries(cwd, 0)}
{#if !selectedFile}
Select a file to view
{:else if fileLoading}
Loading...
{:else if fileError}
{fileError}
{:else if selectedType === 'pdf'}
{:else if selectedType === 'csv' && fileContent != null}
{:else if selectedType === 'image' && fileContent}
{@const ext = getExt(selectedName)}
{@const mime = ext === 'svg' ? 'image/svg+xml' : ext === 'png' ? 'image/png' : ext === 'gif' ? 'image/gif' : ext === 'webp' ? 'image/webp' : 'image/jpeg'}
{selectedName} ({formatSize(fileSize)})
{:else if selectedType === 'code' && fileContent != null}
{:else if fileContent != null}
{/if}