{#snippet locationRow(location: GeoLocation, removable: boolean)} {@const fav = favKeys.has(locationKey(location))}
{#if removable} {/if}
{/snippet} {label} { e.preventDefault(); focusInput(); }} >
{#await results}
{m.search_searching()}
{:then results} {#if searchQuery.length < 2} {#if $storedFavoriteLocations.length > 0 || recentToShow.length > 0} {#if $storedFavoriteLocations.length > 0}
{m.search_favorites()}
{#each $storedFavoriteLocations as loc (locationKey(loc))} {@render locationRow(loc, false)} {/each}
{/if} {#if recentToShow.length > 0}
{m.search_recent()}
{#each recentToShow as loc (locationKey(loc))} {@render locationRow(loc, true)} {/each}
{/if} {:else}
{m.search_hint()}
{/if} {:else if results.results && results.results.length > 0}
{#each results.results as location, i (i)} {@render locationRow(location, false)} {/each}
{:else if results.results} No locations found for "{searchQuery}". Try a different term. {:else} {m.search_no_results()} {/if} {:catch error} Error: {error.message} {/await}