{ overwriteChoice?.(true); overwriteChoice = null; }} on:cancel={() => { overwriteChoice?.(false); overwriteChoice = null; }} /> { if (deleteTarget) { if (deleteTarget.path === '__bulk__') { bulkDelete(); } else { handleDelete(deleteTarget.path, deleteTarget.name); } deleteTarget = null; } }} >

{$i18n.t('Are you sure you want to delete "{{NAME}}"?', { NAME: deleteTarget?.name ?? '' })}

{$i18n.t('This action cannot be undone. Do you wish to continue?')}

{ usingFileAsk = !!(event.target as Element)?.closest('[data-file-ask]'); }} /> { if (!active) return; if (event.key === 'Escape' && fileAsk) { fileAsk = null; } else handleKeydown(event); }} on:click={handleWindowClick} on:pointerdown|capture={(event) => { usingFileAsk = !!(event.target as Element)?.closest('[data-file-ask]'); selectingWithPointer = event.button === 0 && !usingFileAsk && !!viewerRoot?.contains(event.target as Node); pendingSelection = undefined; if (fileAsk && !dirtyChoice && !usingFileAsk) fileAsk = null; }} on:pointerup={() => { if (!selectingWithPointer) return; selectingWithPointer = false; captureSelection(pendingSelection); pendingSelection = undefined; }} on:pointercancel={() => { selectingWithPointer = false; pendingSelection = undefined; }} on:blur={() => { selectingWithPointer = false; pendingSelection = undefined; }} /> {#if comparison} {#key comparison} {/key} {/if} {#if terminalChatContextHidden} {:else if terminalChatContextPending}
{$i18n.t('Start the chat to use this terminal.')}
{:else if !selectedTerminal}
{$i18n.t('No Terminal connection configured.')}
{$i18n.t('Add your Open Terminal URL and API key in Settings → Integrations.')}
{:else}
!isSearching && handleDragOver(e)} on:dragleave={(e) => { if (!(e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget))) { isDragOver = false; } }} on:drop={(e) => !isSearching && handleDrop(e)} role="region" aria-label={$i18n.t('File browser')} tabindex="-1" > {#if isDragOver && !isSearching}
{$i18n.t('Drop to upload')}
{/if} { showGitDiff = !showGitDiff; fileAsk = null; }} breadcrumbs={buildBreadcrumbs(currentPath)} {selectedFile} fileSize={openedFile?.size ?? pendingFile?.size} {loading} {showSearch} onToggleSearch={onSelectDirectory ? null : toggleSearch} writable={currentWritable} canGoBack={!initialFile && canGoBack} canGoForward={!initialFile && canGoForward} {sortBy} {sortAsc} showDateAdded {showHidden} viewMode={isSearching ? null : viewMode} onViewModeChange={changeViewMode} onGoBack={goBack} onGoForward={goForward} onNavigate={initialFile && onBrowseDirectory ? onBrowseDirectory : loadDir} onRefresh={() => { if (selectedFile) { const fileName = selectedFile.split('/').pop() ?? ''; openEntry({ name: fileName, type: 'file', size: 0 }); } else { refreshBrowser(); } }} onNewFolder={startNewFolder} onNewFile={startNewFile} onUploadFiles={handleUploadFiles} onUploadFolder={() => openUploadPicker(true)} onDownloadDir={() => downloadFile(currentPath)} onMove={handleMovePaths} onSort={toggleSort} onToggleHidden={toggleHidden} > {#if isMarkdown && fileContent !== null} {#each [{ label: 'Editor', icon: 'pencil', raw: false }, { label: 'Source', icon: 'code', raw: true }] as mode} {/each} {:else if (isCsv || isHtml || isJson || isSvg || isNotebook) && fileContent !== null} {/if} {#if fileContent !== null} {/if} {#if getFileExt(selectedFile) === 'xlsx' && selectedTerminal} {/if} {#if isTextFile} {#if isHtml && showRaw} {:else if isHtml} {:else if isMarkdown} {:else if showRaw || (!isCsv && !isJson && !isSvg && !isNotebook) || dirty} {/if} {/if} {#if !selectedFile && showSearch}
{ if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); void toggleSearch(); } }} /> {#if searchQuery} {/if}
{/if} {#if pinnedComparison}
{$i18n.t('Comparing with {{name}}', { name: pinnedComparison.name })}
{/if} {#if diskChanged}
{$i18n.t('File updated on disk. Your local changes are preserved.')}
{/if}
0} class="flex-1 overflow-y-auto min-h-0 min-w-0" on:scroll|capture={() => { fileAsk = null; }} on:click={(e) => { closeDirectoryMenu(); if ( !comparison && selectedCount > 0 && (e.target === e.currentTarget || (e.target instanceof Element && e.target.matches('[data-file-list]'))) ) clearSelection(); }} on:contextmenu={(e) => { if (selectingFiles) { e.preventDefault(); return; } if (comparison || selectedFile || isSearching) return; if ((e.target as HTMLElement)?.closest('[data-file-row]')) return; e.preventDefault(); directoryMenu = { x: e.clientX, y: e.clientY }; }} > {#if selectedFile !== null} {#if showGitDiff} {/if}
{#if supportsComments(selectedFile) && selectedTerminal} {#key `${selectedTerminal.baseUrl}|${selectedTerminal.context.modelId}|${selectedTerminal.key}|${chatId}|${selectedFile}|${commentGeneration}`} { diskChanged = false; onViewChange?.({ ...captureView(), preview, dirty: preview?.dirty ?? false }); }} path={selectedFile} target={selectedTerminal} targetPage={documentTargetPage} initialSheet={selectedExcelSheet} onReady={() => { openedFile = pendingFile; publishFile(); }} bind:currentSlide bind:sheet={selectedExcelSheet} /> {/key} {:else} onOpenFile ? onOpenFile(path) : showFileNavPath.set({ path })} bind:currentSlide {selectedFile} readOnly={!selectedFileWritable} {fileLoading} {fileImageUrl} {fileVideoUrl} {fileAudioUrl} {filePdfData} {fileSqliteData} {fileModelData} {fileDocxData} {fileContent} {fileOfficeHtml} {fileOfficeSlides} targetPage={documentTargetPage} {excelSheetNames} {selectedExcelSheet} searchTarget={fileSearchTarget} onSheetChange={async (sheet) => { if (!excelWorkbook) return; selectedExcelSheet = sheet; const { excelToTable } = await import('$lib/utils/excelToTable'); const result = await excelToTable(excelWorkbook.Sheets[sheet]); const DOMPurify = (await import('dompurify')).default; fileOfficeHtml = DOMPurify.sanitize(result.html, { ADD_ATTR: ['target'] }); }} target={selectedTerminal} overlay={overlay || isDraggingHandle} onSave={saveFile} /> {/if}
{:else} {#if isSearching} {#if matchLoading}
{:else if matchError}
{matchError}
{:else if !matchResults?.length}
{$i18n.t('No matches')}
{:else} {#if filenameMatches.length > 0}
{$i18n.t('Filename matches')}
{#each filenameMatches as match (match.path)} {#if match.content_matches.length > 0} {@const preview = match.content_matches[0]} {/if} {/each} {/if} {#if contentOnlyMatches.length > 0}
{$i18n.t('Content matches')}
{#each contentOnlyMatches as match (match.path)} {#if match.content_matches.length > 0} {@const preview = match.content_matches[0]} {/if} {/each} {/if} {#if nextMatchOffset !== null}
{#if matchLoadingMore} {:else if matchLoadMoreError} {/if}
{/if} {/if} {:else if uploading}
{$i18n.t('Uploading...')}
{:else if loading || (effectiveTerminalId && $terminalServers === null)}
{:else if error}
{error}
{:else if visibleEntries.length === 0 && !creatingFolder && !creatingFile}
{$i18n.t('This folder is empty')}
{/if} {#if !isSearching && !loading && !error && !uploading && !(effectiveTerminalId && $terminalServers === null)} {#if visibleEntries.length > 0 || creatingFolder || creatingFile}
    {#if creatingFolder}
  • {#if viewMode === 'grid'} {:else} {/if} { if (e.key === 'Enter') submitNewFolder(); if (e.key === 'Escape') { creatingFolder = false; newFolderName = ''; } }} on:blur={submitNewFolder} />
  • {/if} {#if creatingFile}
  • {#if viewMode === 'list'} {:else} {/if} { if (e.key === 'Enter') submitNewFile(); if (e.key === 'Escape') { creatingFile = false; newFileName = ''; } }} on:blur={submitNewFile} />
  • {/if} {#each visibleEntries as entry (entry.fullPath)} openEntry({ ...row, fullPath: entry.fullPath, parentPath: entry.parentPath, depth: entry.depth, rowIndex: entry.rowIndex })} onSelectForComparison={() => (pinnedComparison = comparisonFile(entry))} comparisonPath={pinnedComparison?.path ?? null} onCompareWithSelected={pinnedComparison ? () => { if (pinnedComparison) openComparison([pinnedComparison, comparisonFile(entry)]); } : undefined} onDownload={downloadFile} onNewFolder={startNewFolderIn} onNewFile={startNewFileIn} onDelete={requestDelete} onMove={handleMovePaths} onRename={handleRename} onSelect={handleSelect} onLongPress={enterSelectionMode} onToggleExpand={toggleExpand} showDate={sortBy === 'date' || sortBy === 'created'} dateField={sortBy === 'created' ? 'created' : 'modified'} {showHidden} parentWritable={currentWritable} /> {/each}
{/if} {/if} {/if}
{#if !selectedFile && !isSearching && (selectingFiles ? keepSelectionToolbar : selectedCount > 0)} {/if} {#if onSelectDirectory}
{#if gitAvailable && showCloneRepository && selectedTerminal} {#key `${effectiveTerminalId}:${chatId}`} (showCloneRepository = false)} onCloned={async (path) => { const selector = effectiveTerminalId, session = chatId; showCloneRepository = false; await loadDir(path); if (!disposed && selector === effectiveTerminalId && session === chatId) onSelectDirectory?.(path); }} /> {/key} {:else}
{#if gitAvailable} {/if}
{/if}
{/if} {#if showTerminalDock && !onSelectDirectory}
{#if terminalExpanded}
{/if} {#key JSON.stringify([chatId, effectiveTerminalId, modelId])} {/key}
{/if} { if (!currentWritable || !directoryUploadInput?.files?.length) return; await handleUploadFiles(Array.from(directoryUploadInput.files)); directoryUploadInput.value = ''; }} /> {#if directoryMenu}
{/if}
{/if} {#if fileAsk} {#key fileAsk.anchor}
{#if fileAsk.text}
{fileAsk.text}
{/if}