{#if mode === "categories"}
{#if show_legend}
{#each Object.entries(_color_map) as [category, color], i}
handle_mouseover(category)}
on:focus={() => handle_mouseover(category)}
on:mouseout={() => handle_mouseout()}
on:blur={() => handle_mouseout()}
class="category-label"
style={"background-color:" + color.secondary}
>
{category}
{/each}
{/if}
{#each value as v, i}
{#each splitTextByNewline(v.token) as line, j}
{#if line.trim() !== ""}
{
dispatch("select", {
index: i,
value: [v.token, v.class_or_confidence]
});
}}
>
{line}
{#if !show_legend && show_inline_category && v.class_or_confidence !== null}
{v.class_or_confidence}
{/if}
{/if}
{#if j < splitTextByNewline(v.token).length - 1}
{/if}
{/each}
{/each}
{:else}
{#if show_legend}
-1
0
+1
{/if}
{#each value as v}
{@const score =
typeof v.class_or_confidence === "string"
? parseInt(v.class_or_confidence)
: v.class_or_confidence}
{v.token}
{/each}
{/if}