{ if (panel && event.target instanceof Element && !event.target.closest('[data-search-panel]')) panel = null; }} />
0} aria-controls="workspace-search-results" aria-activedescendant={selected ? `search-result-${selectedIndex}` : undefined} autocomplete="off" spellcheck="false" maxlength="500" /> {#if query}{/if}
{#if sharing !== 'all' || scope}
{#if sharing !== 'all'}{/if} {#if scope}{/if}
{/if} {#if panel === 'types'}
{#each kinds as type}{/each}
{/if} {#if panel === 'filters'}
{#each [{ value: 'all', label: 'All' }, { value: 'mine', label: 'Created by you' }, { value: 'shared', label: 'Shared with you' }] as option} {/each} {#each [{ kind: 'folder', label: 'Folders' }, { kind: 'channel', label: 'Channels' }] as group} {#if scopes.some((item) => item.kind === group.kind)}
{$i18n.t(group.label)}
{#each scopes.filter((item) => item.kind === group.kind) as item} {/each} {/if} {/each}
{#if kind !== 'all' || sharing !== 'all' || scope}
{/if}
{/if}
{$i18n.t(query.trim() ? 'Results' : 'Pinned & recent')}{loading ? $i18n.t('Searching…') : results.length ? `${results.length}${hasMore ? '+' : ''}` : ''}
{#each results as result, index (result.id)}
(selectedIndex = index)} on:click={() => { selectedIndex = index; if (preview) input?.focus(); else open(result); }} on:dblclick={() => open(result)} >
{#if result.pinned}{/if}
{#if query.trim() && result.snippet}
{/if}
{/each}
{#if loading && !results.length}
{/if} {#if error} {:else if !loading && !results.length}

{$i18n.t(query ? 'No matches found' : 'Nothing here yet')}

{$i18n.t('Try another word or broaden your filters.')}

{#if kind !== 'all' || sharing !== 'all' || scope}{/if}
{/if} {#if hasMore && !error} { if (!loading) fetchResults(page + 1); }} >
{/if}
{#if preview && selected}
{$i18n.t(labels[selected.kind])}
{#if selected.kind === 'chat'}
{selected.title}
{:else}

{selected.title}

{selected.context} · {formatSearchDate(selected.updated_at)}
{#if selected.kind === 'note'} {:else} {/if}
{/if}
{/if}
{#if panel === 'actions'}
{#if selected}
{/if}{#if canCreateNote}{/if}
{/if}
{selected ? selected.context : $i18n.t('Workspace search')}